|
@ -33,11 +33,10 @@ import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
import com.elink.esua.epdc.constant.ActStateConstant; |
|
|
import com.elink.esua.epdc.constant.ActStateConstant; |
|
|
import com.elink.esua.epdc.constant.ActUserRelationStatusConstant; |
|
|
import com.elink.esua.epdc.constant.ActUserRelationStatusConstant; |
|
|
import com.elink.esua.epdc.dto.UserDTO; |
|
|
import com.elink.esua.epdc.dto.UserDTO; |
|
|
|
|
|
import com.elink.esua.epdc.dto.epdc.form.EpdcVolunteerKindnessTimeFormDTO; |
|
|
import com.elink.esua.epdc.dto.logs.PointsLogsDTO; |
|
|
import com.elink.esua.epdc.dto.logs.PointsLogsDTO; |
|
|
import com.elink.esua.epdc.modules.activity.dao.ActUserClockLogDao; |
|
|
import com.elink.esua.epdc.modules.activity.dao.ActUserClockLogDao; |
|
|
import com.elink.esua.epdc.modules.activity.dao.ActUserRelationDao; |
|
|
|
|
|
import com.elink.esua.epdc.modules.activity.entity.ActUserClockLogEntity; |
|
|
import com.elink.esua.epdc.modules.activity.entity.ActUserClockLogEntity; |
|
|
import com.elink.esua.epdc.modules.activity.redis.ActUserClockLogRedis; |
|
|
|
|
|
import com.elink.esua.epdc.modules.activity.service.*; |
|
|
import com.elink.esua.epdc.modules.activity.service.*; |
|
|
import com.elink.esua.epdc.modules.feign.PointsFeignClient; |
|
|
import com.elink.esua.epdc.modules.feign.PointsFeignClient; |
|
|
import com.elink.esua.epdc.modules.feign.UserInfoFeignClient; |
|
|
import com.elink.esua.epdc.modules.feign.UserInfoFeignClient; |
|
@ -47,6 +46,7 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
|
|
|
|
|
|
|
|
|
|
|
import java.text.DecimalFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -58,9 +58,6 @@ import java.util.*; |
|
|
@Service |
|
|
@Service |
|
|
public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogDao, ActUserClockLogEntity> implements ActUserClockLogService { |
|
|
public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogDao, ActUserClockLogEntity> implements ActUserClockLogService { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ActUserClockLogRedis actUserClockLogRedis; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ActUserRelationService actUserRelationService; |
|
|
private ActUserRelationService actUserRelationService; |
|
|
|
|
|
|
|
@ -69,6 +66,7 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ActUserLogService actUserLogService; |
|
|
private ActUserLogService actUserLogService; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ActUserPointsLogService actUserPointsLogService; |
|
|
private ActUserPointsLogService actUserPointsLogService; |
|
|
|
|
|
|
|
@ -77,10 +75,9 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private UserInfoFeignClient userInfoFeignClient; |
|
|
private UserInfoFeignClient userInfoFeignClient; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private PointsFeignClient pointsFeignClient; |
|
|
private PointsFeignClient pointsFeignClient; |
|
|
@Autowired |
|
|
|
|
|
private ActUserRelationDao actUserRelationDao; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -149,6 +146,11 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD |
|
|
pointsLogDTO.setOperationPointsType(ActStateConstant.OPERATION_POINTS_TYPE_ADD); |
|
|
pointsLogDTO.setOperationPointsType(ActStateConstant.OPERATION_POINTS_TYPE_ADD); |
|
|
point =actInfoDTO.getReward(); |
|
|
point =actInfoDTO.getReward(); |
|
|
pointsLogDTO.setPoints(point); |
|
|
pointsLogDTO.setPoints(point); |
|
|
|
|
|
// 志愿者增加爱心时长
|
|
|
|
|
|
Result result = this.calculationKindnessTime(actInfoDTO, dto.getId()); |
|
|
|
|
|
if (!result.success()) { |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//拒绝加积分
|
|
|
//拒绝加积分
|
|
|
} else if (ActStateConstant.ACT_USER_RELATION_STATUS_POINTREJECT.equals(dto.getStatus())) { |
|
|
} else if (ActStateConstant.ACT_USER_RELATION_STATUS_POINTREJECT.equals(dto.getStatus())) { |
|
@ -171,7 +173,7 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD |
|
|
//增加积分记录
|
|
|
//增加积分记录
|
|
|
actUserPointsLogService.save(pointsLogDTO); |
|
|
actUserPointsLogService.save(pointsLogDTO); |
|
|
// 更新用户状态
|
|
|
// 更新用户状态
|
|
|
return userInfoHandle(dto,pointsLogsEntity); |
|
|
return userInfoHandle(dto,pointsLogsEntity); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -277,4 +279,34 @@ public class ActUserClockLogServiceImpl extends BaseServiceImpl<ActUserClockLogD |
|
|
return new Result().ok("打卡成功"); |
|
|
return new Result().ok("打卡成功"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* |
|
|
|
|
|
* 确认积分时志愿者增加爱心时长 |
|
|
|
|
|
* |
|
|
|
|
|
* @params [actInfoDTO, actUserId] |
|
|
|
|
|
* @return Result |
|
|
|
|
|
* @author liuchuang |
|
|
|
|
|
* @since 2020/2/7 17:06 |
|
|
|
|
|
*/ |
|
|
|
|
|
private Result calculationKindnessTime(ActInfoDTO actInfoDTO, String actUserId) { |
|
|
|
|
|
ActUserRelationDTO actUserRelationDto = actUserRelationService.get(actUserId); |
|
|
|
|
|
if (null != actUserRelationDto) { |
|
|
|
|
|
try { |
|
|
|
|
|
// 计算爱心时长(单位:小时,保留两位小数)
|
|
|
|
|
|
DecimalFormat df = new DecimalFormat("0.00"); |
|
|
|
|
|
String kindnessTime = df.format((float) actInfoDTO.getActEndTime().getTime() / actInfoDTO.getActStartTime().getTime()); |
|
|
|
|
|
|
|
|
|
|
|
EpdcVolunteerKindnessTimeFormDTO formDto = new EpdcVolunteerKindnessTimeFormDTO(); |
|
|
|
|
|
formDto.setKindnessTime(Float.valueOf(kindnessTime)); |
|
|
|
|
|
formDto.setUserId(actUserRelationDto.getUserId()); |
|
|
|
|
|
return userInfoFeignClient.addKindnessTime(formDto); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
return new Result().error(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new Result(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|