Browse Source

结束活动

dev
yinzuomei 3 years ago
parent
commit
d40bd34735
  1. 21
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/FinishActFormDTO.java
  2. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/GrantPointsFormDTO.java
  3. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPageResDTO.java
  4. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java
  5. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java
  6. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java
  7. 24
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java
  8. 34
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  9. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

21
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/FinishActFormDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.form.work;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author yzm
* @Date 2022/6/30 19:22
*/
@Data
public class FinishActFormDTO extends SaveActualTimeFormDTO implements Serializable {
private static final long serialVersionUID = -4352058593501077516L;
@NotNull(message = "分值不能为空",groups =AddUserInternalGroup.class )
private Integer reward;
private List<GrantPointsFormDTO> userList;
}

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/GrantPointsFormDTO.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -27,4 +28,9 @@ public class GrantPointsFormDTO implements Serializable {
@NotBlank(message = "理由不能为空", groups = {DenyUserShowGroup.class}) @NotBlank(message = "理由不能为空", groups = {DenyUserShowGroup.class})
private String denyRewardReason; private String denyRewardReason;
/**
* true:给分false不给分
*/
@NotNull(message = "请选择是否给分", groups = DenyUserShowGroup.class)
private Boolean grantPoint;
} }

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPageResDTO.java

@ -89,5 +89,10 @@ public class ActPageResDTO implements Serializable {
* 1已经总结0未总结 * 1已经总结0未总结
*/ */
private Boolean summaryFlag; private Boolean summaryFlag;
/**
* 活动积分
*/
private Integer reward;
} }

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java

@ -54,6 +54,7 @@ public class GrantPointsController {
**/ **/
@PostMapping("deny") @PostMapping("deny")
public Result deny(@RequestBody GrantPointsFormDTO formDTO){ public Result deny(@RequestBody GrantPointsFormDTO formDTO){
formDTO.setGrantPoint(false);
ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.DenyUserShowGroup.class); ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.DenyUserShowGroup.class);
grantPointsService.deny(formDTO); grantPointsService.deny(formDTO);
return new Result(); return new Result();
@ -68,6 +69,7 @@ public class GrantPointsController {
**/ **/
@PostMapping("agree") @PostMapping("agree")
public Result agree(@RequestBody GrantPointsFormDTO formDTO){ public Result agree(@RequestBody GrantPointsFormDTO formDTO){
formDTO.setGrantPoint(true);
ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.AddUserInternalGroup.class); ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.AddUserInternalGroup.class);
grantPointsService.agree(formDTO); grantPointsService.agree(formDTO);
return new Result(); return new Result();

12
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java

@ -328,4 +328,16 @@ public class WorkActController {
public Result<ActDetailResultDTO> queryActDetail(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO) { public Result<ActDetailResultDTO> queryActDetail(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO) {
return new Result<ActDetailResultDTO>().ok(workActService.queryActDetail(formDTO.getActId(), tokenDto.getUserId())); return new Result<ActDetailResultDTO>().ok(workActService.queryActDetail(formDTO.getActId(), tokenDto.getUserId()));
} }
/**
* 数字社区结束活动
* @param formDTO
* @return
*/
@PostMapping("finish")
public Result finish(@RequestBody FinishActFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO,SaveActualTimeFormDTO.AddUserInternalGroup.class,SaveActualTimeFormDTO.UserShowGroup.class);
workActService.finish(formDTO);
return new Result();
}
} }

6
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java

@ -164,4 +164,10 @@ public interface WorkActService {
* @return * @return
*/ */
ActDetailResultDTO queryActDetail(String actId, String userId); ActDetailResultDTO queryActDetail(String actId, String userId);
/**
*
* @param formDTO
*/
void finish(FinishActFormDTO formDTO);
} }

24
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
@ -108,19 +109,14 @@ public class GrantPointsServiceImpl implements GrantPointsService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void agree(GrantPointsFormDTO formDTO) { public void agree(GrantPointsFormDTO formDTO) {
//是否是待处理 //是否是待处理
ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId());
if(null==actUserRelationDTO){
logger.warn("积分发放-给分act_user_relation is null,actUserRelationId="+formDTO.getActUserRelationId());
return;
}
//如果是已处理直接返回 //如果是已处理直接返回
if(ActConstant.HANDLED.equals(actUserRelationDTO.getProcessFlag())){ ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId());
logger.info("积分发放-给分act_user_relation already handled,actUserRelationId="+formDTO.getActUserRelationId()); if (null == actUserRelationDTO || ActConstant.HANDLED.equals(actUserRelationDTO.getProcessFlag())) {
return; return;
} }
//查取分值 //查取分值
ActInfoDTO actInfoDTO=actInfoService.get(actUserRelationDTO.getActId()); ActInfoDTO actInfoDTO=actInfoService.get(actUserRelationDTO.getActId());
if (null == actInfoDTO || ActConstant.ACT_STATUS_FINISHED.equals(actInfoDTO.getActStatus())) { if (null == actInfoDTO || ActConstant.ACT_STATUS_FINISHED.equals(actInfoDTO.getActStatus())|| NumConstant.ZERO==actInfoDTO.getReward()) {
logger.warn("积分发放-给分act_info is null or act_info is finished"); logger.warn("积分发放-给分act_info is null or act_info is finished");
return; return;
} }
@ -152,20 +148,14 @@ public class GrantPointsServiceImpl implements GrantPointsService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deny(GrantPointsFormDTO formDTO) { public void deny(GrantPointsFormDTO formDTO) {
//是否是待处理
ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId());
if(null==actUserRelationDTO){
logger.warn("积分发放-不给分act_user_relation is null,actUserRelationId="+formDTO.getActUserRelationId());
return;
}
//如果是已处理直接返回 //如果是已处理直接返回
if(ActConstant.HANDLED.equals(actUserRelationDTO.getProcessFlag())){ ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId());
logger.info("积分发放-不给分act_user_relation already handled,actUserRelationId="+formDTO.getActUserRelationId()); if (null == actUserRelationDTO || ActConstant.HANDLED.equals(actUserRelationDTO.getProcessFlag())) {
return; return;
} }
//查取分值 //查取分值
ActInfoDTO actInfoDTO=actInfoService.get(actUserRelationDTO.getActId()); ActInfoDTO actInfoDTO=actInfoService.get(actUserRelationDTO.getActId());
if (null == actInfoDTO || ActConstant.ACT_STATUS_FINISHED.equals(actInfoDTO.getActStatus())) { if (null == actInfoDTO || ActConstant.ACT_STATUS_FINISHED.equals(actInfoDTO.getActStatus())|| NumConstant.ZERO==actInfoDTO.getReward()) {
logger.warn("积分发放-不给分act_info is null or act_info is finished"); logger.warn("积分发放-不给分act_info is null or act_info is finished");
return; return;
} }

34
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

@ -113,7 +113,8 @@ public class WorkActServiceImpl implements WorkActService {
private IcActivityUnitRelationService icActivityUnitRelationService; private IcActivityUnitRelationService icActivityUnitRelationService;
@Resource @Resource
private IcActivityServiceRelationService icActivityServiceRelationService; private IcActivityServiceRelationService icActivityServiceRelationService;
@Autowired
private ActPointLogService actPointLogService;
/** /**
* @author yinzuomei * @author yinzuomei
@ -1716,4 +1717,35 @@ public class WorkActServiceImpl implements WorkActService {
} }
return resultDTO; return resultDTO;
} }
/**
* @param formDTO
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void finish(FinishActFormDTO formDTO) {
// 1、保存活动实际开始、结束时间
saveActualTime(formDTO);
// 2、积分大于0的->发放积分
if (formDTO.getReward() > NumConstant.ZERO) {
for (GrantPointsFormDTO grantPointsFormDTO : formDTO.getUserList()) {
ActUserRelationDTO actUserRelationDTO = actUserRelationService.get(grantPointsFormDTO.getActUserRelationId());
// 更新act_user_relation改为已处理,给分
actUserRelationDTO.setProcessFlag(ActConstant.HANDLED);
actUserRelationDTO.setRewardFlag(grantPointsFormDTO.getGrantPoint() ? ActConstant.ACT_USER_STATUS_AGREE : ActConstant.ACT_USER_STATUS_DENY);
actUserRelationDTO.setDenyRewardReason(StrConstant.EPMETY_STR);
actUserRelationService.update(actUserRelationDTO);
// 增加一条act_point_log
ActPointLogDTO actPointLogDTO = new ActPointLogDTO();
actPointLogDTO.setActId(actUserRelationDTO.getActId());
actPointLogDTO.setUserId(actUserRelationDTO.getUserId());
actPointLogDTO.setPoints(formDTO.getReward());
actPointLogDTO.setOperateType(grantPointsFormDTO.getGrantPoint() ? ActConstant.ACT_USER_STATUS_AGREE : ActConstant.ACT_USER_STATUS_DENY);
actPointLogDTO.setRemark(grantPointsFormDTO.getGrantPoint() ? StrConstant.EPMETY_STR : grantPointsFormDTO.getDenyRewardReason());
actPointLogService.save(actPointLogDTO);
}
}
// 3、结束活动
finishAct(formDTO.getActId());
}
} }

3
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

@ -828,7 +828,8 @@
AND aur.DEL_FLAG = '0' AND aur.DEL_FLAG = '0'
AND ( aur.`STATUS` = 'auditing' OR aur.`STATUS` = 'passed' ) AND ( aur.`STATUS` = 'auditing' OR aur.`STATUS` = 'passed' )
) AS signedUp, ) AS signedUp,
ai.SUMMARY_FLAG as summaryFlag ai.SUMMARY_FLAG as summaryFlag,
ai.REWARD as reward,
FROM FROM
act_info ai act_info ai
WHERE WHERE

Loading…
Cancel
Save