diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java index 52b18e59e4..a7bff8713b 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java @@ -53,7 +53,7 @@ public class ActUserLogDTO implements Serializable { * 操作类型(已报名/待审核auditing, * 审核通过passed, * 审核不通过refused - * 取消报名canceld, + * 取消报名canceled, * ) */ private String operationType; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java index 57952477e7..2c7c7a2d8d 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -52,7 +53,7 @@ public class ActUserRelationDTO implements Serializable { * 当前状态(已报名/待审核auditing, 审核通过passed, 审核不通过refused -取消报名canceld, +取消报名canceled, ) */ private String status; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditUserFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditUserFormDTO.java index 580aa5ea7c..0df68ec7a8 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditUserFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditUserFormDTO.java @@ -17,15 +17,15 @@ public class AuditUserFormDTO implements Serializable { private static final long serialVersionUID = 243279409415285207L; public interface AddUserInternalGroup { } - public interface UserShowGroup extends CustomerClientShowGroup { + public interface RefusedUserShowGroup extends CustomerClientShowGroup { } /** * 列表页返回的主键 */ - @NotBlank(message = "主键不能为空", groups = {AddUserInternalGroup.class}) + @NotBlank(message = "主键不能为空", groups = {AddUserInternalGroup.class,RefusedUserShowGroup.class}) private String actUserRelationId; - @NotBlank(message = "拒绝理由不能为空", groups = {UserShowGroup.class}) + @NotBlank(message = "拒绝理由不能为空", groups = {RefusedUserShowGroup.class}) private String rejectReason; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/GrantPointsFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/GrantPointsFormDTO.java new file mode 100644 index 0000000000..b3b79453b5 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/GrantPointsFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 积分发放给分,不给分,通用入参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 13:10 + */ +@Data +public class GrantPointsFormDTO implements Serializable { + private static final long serialVersionUID = 4785107755585941804L; + public interface AddUserInternalGroup { + } + public interface DenyUserShowGroup extends CustomerClientShowGroup { + } + /** + * 积分发放待处理列表返参中的actUserRelationId + */ + @NotBlank(message = "主键不能为空", groups = {AddUserInternalGroup.class,DenyUserShowGroup.class}) + private String actUserRelationId; + + @NotBlank(message = "理由不能为空", groups = {DenyUserShowGroup.class}) + private String denyRewardReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PendingUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PendingUserResultDTO.java new file mode 100644 index 0000000000..d8f3837265 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PendingUserResultDTO.java @@ -0,0 +1,50 @@ +package com.epmet.dto.result.work; + +import com.epmet.commons.tools.constant.StrConstant; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 积分发放-待处理列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 12:20 + */ +@Data +public class PendingUserResultDTO implements Serializable { + private static final long serialVersionUID = -5744298386442386198L; + /** + * 活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 积分奖励 + */ + private Integer reward; + + /** + * 已签到人员列表 + */ + private List signedInList; + + /** + * 未签到人员列表 + */ + private List noSignInList; + public PendingUserResultDTO(String actId){ + this.actId= actId; + this.title=StrConstant.EPMETY_STR; + this.reward=0; + this.signedInList=new ArrayList<>(); + this.noSignInList=new ArrayList<>(); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserBaseInfo.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserBaseInfo.java new file mode 100644 index 0000000000..b7ec382f5e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserBaseInfo.java @@ -0,0 +1,45 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 积分发放待处理界面,用户基本信息 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 12:22 + */ +@Data +public class UserBaseInfo implements Serializable { + private static final long serialVersionUID = 4316319460642833716L; + /** + * act_user_relation主键 + */ + private String actUserRelationId; + + /** + * 用户id + */ + private String userId; + + /** + * 姓名 + */ + private String realName; + + /** + * 微信昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * true: 是志愿者 false : 不是志愿者 + */ + private Boolean volunteerFlag; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java index aec0849ddd..86e935c2a3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java @@ -1,7 +1,14 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.work.ActIdFormDTO; +import com.epmet.dto.form.work.GrantPointsFormDTO; +import com.epmet.dto.result.work.PendingUserResultDTO; +import com.epmet.service.GrantPointsService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -14,9 +21,61 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("grantpoints") public class GrantPointsController { + @Autowired + private GrantPointsService grantPointsService; + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 积分发放-待处理列表 + * @Date 2020/7/24 12:28 + **/ @PostMapping("pendinglist") - public Result queryPendingList(){ + public Result queryPendingList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(grantPointsService.queryPendingList(formDTO.getActId())); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 积分发放-不给分 + * @Date 2020/7/24 13:14 + **/ + @PostMapping("deny") + public Result deny(@RequestBody GrantPointsFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.DenyUserShowGroup.class); + grantPointsService.deny(formDTO); return new Result(); } + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 积分发放-给分 + * @Date 2020/7/24 13:13 + **/ + @PostMapping("agree") + public Result agree(@RequestBody GrantPointsFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.AddUserInternalGroup.class); + grantPointsService.agree(formDTO); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 积分发放-重新处理 + * @Date 2020/7/24 15:16 + **/ + @PostMapping("reset") + public Result reset(@RequestBody GrantPointsFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.AddUserInternalGroup.class); + grantPointsService.reset(formDTO); + return new Result(); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java index d7d1d0eb2e..59769d69b9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java @@ -141,7 +141,7 @@ public class WorkActUserController { **/ @PostMapping("auditrefuse") public Result auditrefuse(@RequestBody AuditUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditUserFormDTO.UserShowGroup.class,AuditUserFormDTO.AddUserInternalGroup.class); + ValidatorUtils.validateEntity(formDTO, AuditUserFormDTO.RefusedUserShowGroup.class); workActUserService.auditRefuse(formDTO); return new Result(); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index 2c901f5717..bb6598d312 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -118,4 +118,22 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/23 16:46 **/ List selectAllByUserId(String userId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 查询待处理的记录 + * @Date 2020/7/24 13:02 + **/ + List selectInProgress(String actId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 查询待处理的人员id集合 + * @Date 2020/7/24 13:02 + **/ + List selectInProgressUserIds(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java index 6dd224fec0..751f535f5f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java @@ -49,7 +49,7 @@ public class ActUserLogEntity extends BaseEpmetEntity { * 操作类型(已报名/待审核auditing, * 审核通过passed, * 审核不通过refused - * 取消报名canceld, + * 取消报名canceled, * ) */ private String operationType; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java index 4eb9a68cdd..f5af4a176d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserRelationEntity.java @@ -52,7 +52,7 @@ public class ActUserRelationEntity extends BaseEpmetEntity { * 当前状态(已报名/待审核auditing, 审核通过passed, 审核不通过refused -取消报名canceld, +取消报名canceled, ) */ private String status; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java new file mode 100644 index 0000000000..92d306ac92 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java @@ -0,0 +1,48 @@ +package com.epmet.service; + +import com.epmet.dto.form.work.GrantPointsFormDTO; +import com.epmet.dto.result.work.PendingUserResultDTO; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 12:26 + */ +public interface GrantPointsService { + /** + * @return com.epmet.dto.result.work.PendingUserResultDTO + * @param actId + * @author yinzuomei + * @description 积分发放-待处理列表 + * @Date 2020/7/24 12:28 + **/ + PendingUserResultDTO queryPendingList(String actId); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 积分发放-给分 + * @Date 2020/7/24 13:34 + **/ + void agree(GrantPointsFormDTO formDTO); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 积分发放-不给分 + * @Date 2020/7/24 15:03 + **/ + void deny(GrantPointsFormDTO formDTO); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 积分发放-重新处理 + * @Date 2020/7/24 15:16 + **/ + void reset(GrantPointsFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java index bcd3807014..281d8e7556 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java @@ -1,6 +1,10 @@ package com.epmet.service; -import com.epmet.dto.form.work.*; +import com.epmet.dto.form.work.AactUserDetailFormDTO; +import com.epmet.dto.form.work.ActIdFormDTO; +import com.epmet.dto.form.work.AuditUserFormDTO; +import com.epmet.dto.form.work.UserHistoricalActFormDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.work.*; import java.util.List; @@ -110,4 +114,31 @@ public interface WorkActUserService { * @Date 2020/7/24 10:54 **/ List queryCanceledUserList(ActIdFormDTO formDTO); + + /** + * @return com.epmet.dto.result.UserBaseInfoResultDTO + * @param userId + * @author yinzuomei + * @description 根据用户id获取用户基本信息 + * @Date 2020/7/24 12:47 + **/ + UserBaseInfoResultDTO queryUserBaseInfo(String userId); + + /** + * @return java.util.List + * @param userIdList + * @author yinzuomei + * @description 传入用户id集合,返回用户的基本信息(包含微信基本信息) + * @Date 2020/7/24 12:47 + **/ + List queryUserBaseInfoList(List userIdList); + + /** + * @return java.lang.Boolean + * @param userId + * @author yinzuomei + * @description 根据用户id判断是否志愿者 + * @Date 2020/7/24 12:52 + **/ + Boolean getVolunteerFlag(String userId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java new file mode 100644 index 0000000000..7374577050 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java @@ -0,0 +1,236 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.constant.ActConstant; +import com.epmet.dao.ActUserRelationDao; +import com.epmet.dto.ActInfoDTO; +import com.epmet.dto.ActPointLogDTO; +import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.work.GrantPointsFormDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.work.PendingUserResultDTO; +import com.epmet.dto.result.work.UserBaseInfo; +import com.epmet.service.*; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * 积分发放 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 12:27 + */ +@Service +public class GrantPointsServiceImpl implements GrantPointsService { + private Logger logger = LogManager.getLogger(GrantPointsServiceImpl.class); + @Autowired + private ActInfoService actInfoService; + @Autowired + private ActUserRelationDao actUserRelationDao; + @Autowired + private WorkActUserService workActUserService; + @Autowired + private ActUserRelationService actUserRelationService; + @Autowired + private ActPointLogService actPointLogService; + @Autowired + private LoginUserUtil loginUserUtil; + /** + * @param actId + * @return com.epmet.dto.result.work.PendingUserResultDTO + * @author yinzuomei + * @description 积分发放-待处理列表 + * @Date 2020/7/24 12:28 + **/ + @Override + public PendingUserResultDTO queryPendingList(String actId) { + PendingUserResultDTO pendingUserResultDTO = new PendingUserResultDTO(actId); + ActInfoDTO actInfoDTO = actInfoService.get(actId); + if (null == actInfoDTO) { + return pendingUserResultDTO; + } + pendingUserResultDTO.setActId(actId); + pendingUserResultDTO.setReward(actInfoDTO.getReward()); + pendingUserResultDTO.setTitle(actInfoDTO.getTitle()); + //已签到人员列表 + List signedInList = new ArrayList<>(); + //未签到人员列表 + List noSignInList = new ArrayList<>(); + List signedActUserList = actUserRelationDao.selectInProgress(actId); + List userIdList = actUserRelationDao.selectInProgressUserIds(actId); + List userInfoList = workActUserService.queryUserBaseInfoList(userIdList); + for (ActUserRelationDTO actUserRelation : signedActUserList) { + UserBaseInfo userBaseInfo = new UserBaseInfo(); + userBaseInfo.setActUserRelationId(actUserRelation.getId()); + userBaseInfo.setUserId(actUserRelation.getUserId()); + userBaseInfo.setVolunteerFlag(workActUserService.getVolunteerFlag(actUserRelation.getUserId())); + for (UserBaseInfoResultDTO userBaseInfoResultDTO : userInfoList) { + if (actUserRelation.getUserId().equals(userBaseInfoResultDTO.getUserId())) { + userBaseInfo.setRealName(userBaseInfoResultDTO.getRealName()); + userBaseInfo.setNickName(userBaseInfoResultDTO.getNickname()); + userBaseInfo.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + break; + } + } + if (ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())) { + //已签到 + signedInList.add(userBaseInfo); + } else { + //未签到 + noSignInList.add(userBaseInfo); + } + } + pendingUserResultDTO.setNoSignInList(noSignInList); + pendingUserResultDTO.setSignedInList(signedInList); + return pendingUserResultDTO; + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 积分发放-给分 + * @Date 2020/7/24 13:34 + **/ + @Override + 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())){ + logger.info("积分发放-给分act_user_relation already handled,actUserRelationId="+formDTO.getActUserRelationId()); + return; + } + //查取分值 + ActInfoDTO actInfoDTO=actInfoService.get(actUserRelationDTO.getActId()); + if (null == actInfoDTO || ActConstant.ACT_STATUS_FINISHED.equals(actInfoDTO.getActStatus())) { + logger.warn("积分发放-给分act_info is null or act_info is finished"); + return; + } + if(!loginUserUtil.getLoginUserId().equals(actInfoDTO.getCreatedBy())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + //更新act_user_relation改为已处理,给分 + actUserRelationDTO.setProcessFlag(ActConstant.HANDLED); + actUserRelationDTO.setRewardFlag(ActConstant.ACT_USER_STATUS_AGREE); + 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(actInfoDTO.getReward()); + actPointLogDTO.setOperateType(ActConstant.ACT_USER_STATUS_AGREE); + actPointLogDTO.setRemark(StrConstant.EPMETY_STR); + /** + * 1有效0无效,只有在活动真正结束后才是1 + * true有效 false无效 + */ + actPointLogDTO.setEffectFlag(false); + actPointLogService.save(actPointLogDTO); + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 积分发放-不给分 + * @Date 2020/7/24 15:03 + **/ + @Override + 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())){ + logger.info("积分发放-不给分act_user_relation already handled,actUserRelationId="+formDTO.getActUserRelationId()); + return; + } + //查取分值 + ActInfoDTO actInfoDTO=actInfoService.get(actUserRelationDTO.getActId()); + if (null == actInfoDTO || ActConstant.ACT_STATUS_FINISHED.equals(actInfoDTO.getActStatus())) { + logger.warn("积分发放-不给分act_info is null or act_info is finished"); + return; + } + if(!loginUserUtil.getLoginUserId().equals(actInfoDTO.getCreatedBy())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + //更新act_user_relation改为已处理,给分 + actUserRelationDTO.setProcessFlag(ActConstant.HANDLED); + actUserRelationDTO.setRewardFlag(ActConstant.ACT_USER_STATUS_DENY); + actUserRelationDTO.setDenyRewardReason(formDTO.getDenyRewardReason()); + actUserRelationService.update(actUserRelationDTO); + //增加一条act_point_log + ActPointLogDTO actPointLogDTO=new ActPointLogDTO(); + actPointLogDTO.setActId(actUserRelationDTO.getActId()); + actPointLogDTO.setUserId(actUserRelationDTO.getUserId()); + actPointLogDTO.setPoints(actInfoDTO.getReward()); + actPointLogDTO.setOperateType(ActConstant.ACT_USER_STATUS_DENY); + actPointLogDTO.setRemark(formDTO.getDenyRewardReason()); + /** + * 1有效0无效,只有在活动真正结束后才是1 + * true有效 false无效 + */ + actPointLogDTO.setEffectFlag(false); + actPointLogService.save(actPointLogDTO); + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 积分发放-重新处理 + * @Date 2020/7/24 15:16 + **/ + @Override + public void reset(GrantPointsFormDTO formDTO) { + ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId()); + if(null==actUserRelationDTO){ + logger.warn("积分发放-重新处理act_user_relation is null,actUserRelationId="+formDTO.getActUserRelationId()); + return; + } + //查取分值 + ActInfoDTO actInfoDTO=actInfoService.get(actUserRelationDTO.getActId()); + if (null == actInfoDTO || ActConstant.ACT_STATUS_FINISHED.equals(actInfoDTO.getActStatus())) { + logger.warn("积分发放-重新处理act_info is null or act_info is finished"); + return; + } + if(!loginUserUtil.getLoginUserId().equals(actInfoDTO.getCreatedBy())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + //更新act_user_relation改为未处理 初始状态 + actUserRelationDTO.setProcessFlag(StrConstant.EPMETY_STR); + actUserRelationDTO.setRewardFlag(StrConstant.EPMETY_STR); + 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(actInfoDTO.getReward()); + actPointLogDTO.setOperateType(ActConstant.RESET); + actPointLogDTO.setRemark(StrConstant.EPMETY_STR); + /** + * 1有效0无效,只有在活动真正结束后才是1 + * true有效 false无效 + */ + actPointLogDTO.setEffectFlag(false); + actPointLogService.save(actPointLogDTO); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index 6d6c81157a..3ec8d2dea5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -560,7 +560,15 @@ public class WorkActUserServiceImpl implements WorkActUserService { return historicalActInfo; } - private Boolean getVolunteerFlag(String userId) { + /** + * @return java.lang.Boolean + * @param userId + * @author yinzuomei + * @description 根据用户id判断是否志愿者 + * @Date 2020/7/24 12:51 + **/ + @Override + public Boolean getVolunteerFlag(String userId) { HeartUserInfoDTO heartUserInfoDTO=heartUserInfoService.getByUserId(userId); //true: 是志愿者 false : 不是志愿者 if(null!=heartUserInfoDTO){ @@ -576,7 +584,8 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @description 传入用户id集合,返回用户的基本信息(包含微信基本信息) * @Date 2020/7/22 10:38 **/ - private List queryUserBaseInfoList(List userIdList) { + @Override + public List queryUserBaseInfoList(List userIdList) { List userInfoList=new ArrayList<>(); if(null==userIdList||userIdList.size()==0){ return userInfoList; @@ -598,7 +607,8 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @description 根据用户id获取用户基本信息 * @Date 2020/7/23 12:52 **/ - private UserBaseInfoResultDTO queryUserBaseInfo(String userId) { + @Override + public UserBaseInfoResultDTO queryUserBaseInfo(String userId) { List userIdList = new ArrayList<>(); userIdList.add(userId); //调用epemet_user服务获取用户的基本信息 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index ce22f96e49..380e0197a7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -573,7 +573,7 @@ and ai.DEL_FLAG='0') WHERE aur.DEL_FLAG = '0' - AND aur.`STATUS` = 'canceld' + AND aur.`STATUS` = 'canceled' AND aur.ACT_ID =#{actId} order by aur.CANCEL_TIME desc diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index ac63e1f255..d2872098fd 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -162,4 +162,31 @@ ORDER BY acr.CREATED_TIME DESC + + + + + +