From 74083c50026fe028abc31f33f2d42a439701adf3 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 30 Jun 2022 18:49:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/result/work/ActUserResDTO.java | 96 +++++++++++++++++++ .../controller/WorkActUserController.java | 13 +++ .../com/epmet/service/WorkActUserService.java | 8 ++ .../service/impl/WorkActUserServiceImpl.java | 49 ++++++++++ 4 files changed, 166 insertions(+) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActUserResDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActUserResDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActUserResDTO.java new file mode 100644 index 0000000000..01fcf7e293 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActUserResDTO.java @@ -0,0 +1,96 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description + * @Author yzm + * @Date 2022/6/30 17:58 + */ +@Data +public class ActUserResDTO implements Serializable { + private static final long serialVersionUID = 7621004224467504031L; + /** + * 主键 + */ + private String actUserRelationId; + + /** + * 活动id + */ + private String actId; + + /** + * 用户id + */ + private String userId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 联系方式 + */ + private String mobile; + + /** + * 身份证号 + */ + private String idNum; + + /** + * 报名时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date signUpTime; + + /** + * true: 是志愿者 false : 不是志愿者 + */ + private Boolean volunteerFlag; + + /** + * 实际参加活动个数 + */ + private Integer signInActNum; + /** + * 报名活动个数 + */ + private Integer signUpActNum; + /** + * 获得积分活动个数 + */ + private Integer obtainPointsActNum; + + /** + * 已处理: handled; 默认"",重新处理时reward_flag置为空字符串 + */ + private String processFlag; + + /** + * 已签到:signed_in; 默认"" + */ + private String signInFlag; + + /** + * 已给分:agree, 不给分:deny 默认"" + */ + private String rewardFlag; + public ActUserResDTO(){ + this.signInActNum=0; + this.signUpActNum=0; + this.obtainPointsActNum=0; + } +} + 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 a7ddc2c6dc..e1b4eca9c0 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 @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.work.AactUserDetailFormDTO; @@ -174,4 +175,16 @@ public class WorkActUserController { ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result>().ok(workActUserService.queryCanceledUserList(formDTO)); } + + /** + * 数字社区查看人员列表:报名审核、查看人员、活动结束发放积分页面人员列表 + * @param formDTO + * @return + */ + @PostMapping("userlist") + public Result> queryUserList(@RequestBody ActIdFormDTO formDTO){ + return new Result>().ok(workActUserService.queryUserList(formDTO.getActId())); + } + + } 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 281d8e7556..ae4bf7acc9 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,5 +1,6 @@ package com.epmet.service; +import com.epmet.commons.tools.page.PageData; import com.epmet.dto.form.work.AactUserDetailFormDTO; import com.epmet.dto.form.work.ActIdFormDTO; import com.epmet.dto.form.work.AuditUserFormDTO; @@ -141,4 +142,11 @@ public interface WorkActUserService { * @Date 2020/7/24 12:52 **/ Boolean getVolunteerFlag(String userId); + + /** + * 数字社区查看人员列表:报名审核、查看人员、活动结束发放积分页面人员列表 + * @param actId + * @return + */ + PageData queryUserList(String actId); } 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 2a67649019..67dbefd705 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 @@ -6,7 +6,9 @@ import com.epmet.commons.tools.constant.NumConstant; 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.page.PageData; import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ActConstant; import com.epmet.constant.ActMessageConstant; @@ -36,6 +38,7 @@ import com.epmet.service.ActInfoService; import com.epmet.service.ActUserRelationService; import com.epmet.service.HeartUserInfoService; import com.epmet.service.WorkActUserService; +import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -46,6 +49,8 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; /** * 工作端:活动人员相关api @@ -775,4 +780,48 @@ public class WorkActUserServiceImpl implements WorkActUserService { } return resultUserList.getData().get(0); } + + /** + * 数字社区查看人员列表:报名审核、查看人员、活动结束发放积分页面人员列表 + * + * @param actId + * @return + */ + @Override + public PageData queryUserList(String actId) { + List list = new ArrayList<>(); + // 活动相关人员 + List actUserRelationDTOList = actUserRelationService.getUserList(actId, StrConstant.EPMETY_STR); + if (null == actUserRelationDTOList || actUserRelationDTOList.size() == 0) { + return new PageData<>(list, NumConstant.ZERO); + } + // 查询人员id集合 + Set userIdList = actUserRelationDTOList.stream().map(ActUserRelationDTO::getUserId).collect(Collectors.toSet()); + // 查询出用户基本信息 + List userInfoList = this.queryUserBaseInfoList(new ArrayList<>(userIdList)); + for (ActUserRelationDTO actUserRelationDTO : actUserRelationDTOList) { + ActUserResDTO resultDTO = ConvertUtils.sourceToTarget(actUserRelationDTO,ActUserResDTO.class); + resultDTO.setActUserRelationId(actUserRelationDTO.getId()); + resultDTO.setSignUpTime(actUserRelationDTO.getCreatedTime()); + // true: 是志愿者 false : 不是志愿者 + resultDTO.setVolunteerFlag(getVolunteerFlag(actUserRelationDTO.getUserId())); + // 赋值基本信息 + for (UserBaseInfoResultDTO userBaseInfoResultDTO : userInfoList) { + if (actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())) { + resultDTO.setRealName(StringUtils.isNotBlank(userBaseInfoResultDTO.getRealName()) ? userBaseInfoResultDTO.getRealName() : StrConstant.EPMETY_STR); + resultDTO.setNickName(StringUtils.isNotBlank(userBaseInfoResultDTO.getNickname()) ? userBaseInfoResultDTO.getNickname() : StrConstant.EPMETY_STR); + resultDTO.setMobile(StringUtils.isNotBlank(userBaseInfoResultDTO.getMobile()) ? userBaseInfoResultDTO.getMobile() : StrConstant.EPMETY_STR); + resultDTO.setIdNum(StringUtils.isNotBlank(userBaseInfoResultDTO.getIdNum()) ? userBaseInfoResultDTO.getIdNum() : StrConstant.EPMETY_STR); + break; + } + } + HistoricalActInfo historicalActInfo = this.getHistoricalActInfo(resultDTO.getUserId(), actId); + resultDTO.setSignInActNum(historicalActInfo.getSignInActNum()); + resultDTO.setSignUpActNum(historicalActInfo.getSignUpActNum()); + resultDTO.setObtainPointsActNum(historicalActInfo.getObtainPointsActNum()); + list.add(resultDTO); + } + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } } From 030b569286b233c5f394f3e979aaa548b67aec0e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 30 Jun 2022 19:00:22 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=80=9A=E8=BF=87.?= =?UTF-8?q?=E6=8B=92=E7=BB=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/work/AuditUserFormDTO.java | 5 +++++ .../epmet/dto/result/work/ActUserResDTO.java | 12 +++++++++++ .../controller/WorkActUserController.java | 21 +++++++++++++++++++ 3 files changed, 38 insertions(+) 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 0df68ec7a8..f10fa57149 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 @@ -3,6 +3,7 @@ package com.epmet.dto.form.work; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.Valid; import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -12,6 +13,7 @@ import java.io.Serializable; * @author yinzuomei@elink-cn.com * @date 2020/7/23 17:28 */ +@Valid @Data public class AuditUserFormDTO implements Serializable { private static final long serialVersionUID = 243279409415285207L; @@ -28,4 +30,7 @@ public class AuditUserFormDTO implements Serializable { @NotBlank(message = "拒绝理由不能为空", groups = {RefusedUserShowGroup.class}) private String rejectReason; + @NotBlank(message = "type不能为空【通过:pass;拒绝:refused】", groups = {AddUserInternalGroup.class}) + private String type; + } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActUserResDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActUserResDTO.java index 01fcf7e293..17b09b3687 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActUserResDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActUserResDTO.java @@ -87,6 +87,18 @@ public class ActUserResDTO implements Serializable { * 已给分:agree, 不给分:deny 默认"" */ private String rewardFlag; + + + /** + * 当前状态(已报名/待审核auditing, + 审核通过passed, + 审核不通过refused + 取消报名canceled, + ) + */ + private String status; + + public ActUserResDTO(){ this.signInActNum=0; this.signUpActNum=0; 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 e1b4eca9c0..41f5b456eb 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 @@ -3,6 +3,7 @@ package com.epmet.controller; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.ActConstant; import com.epmet.dto.form.work.AactUserDetailFormDTO; import com.epmet.dto.form.work.ActIdFormDTO; import com.epmet.dto.form.work.AuditUserFormDTO; @@ -131,6 +132,7 @@ public class WorkActUserController { **/ @PostMapping("auditpass") public Result auditPass(@RequestBody AuditUserFormDTO formDTO){ + formDTO.setType(ActConstant.ACT_USER_STATUS_PASSED); ValidatorUtils.validateEntity(formDTO, AuditUserFormDTO.AddUserInternalGroup.class); workActUserService.auditPass(formDTO.getActUserRelationId()); return new Result(); @@ -145,6 +147,7 @@ public class WorkActUserController { **/ @PostMapping("auditrefuse") public Result auditrefuse(@RequestBody AuditUserFormDTO formDTO){ + formDTO.setType(ActConstant.ACT_USER_STATUS_REFUSED); ValidatorUtils.validateEntity(formDTO, AuditUserFormDTO.RefusedUserShowGroup.class); workActUserService.auditRefuse(formDTO); return new Result(); @@ -186,5 +189,23 @@ public class WorkActUserController { return new Result>().ok(workActUserService.queryUserList(formDTO.getActId())); } + /** + * 批量审核通过、拒绝调用原来的接口 + * @param formDTOList + * @return + */ + @PostMapping("audit-user") + public Result auditUser(@RequestBody List formDTOList) { + ValidatorUtils.validateEntity(formDTOList); + for (AuditUserFormDTO formDTO : formDTOList) { + if (ActConstant.ACT_USER_STATUS_REFUSED.equals(formDTO.getType())) { + workActUserService.auditRefuse(formDTO); + } else if (ActConstant.ACT_USER_STATUS_PASSED.equals(formDTO.getType())) { + workActUserService.auditPass(formDTO.getActUserRelationId()); + } + } + return new Result(); + } + } From d40bd347355518b189b1fb2ead2064265b10a049 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 1 Jul 2022 09:14:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=BB=93=E6=9D=9F=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/work/FinishActFormDTO.java | 21 ++++++++++++ .../dto/form/work/GrantPointsFormDTO.java | 6 ++++ .../epmet/dto/result/work/ActPageResDTO.java | 5 +++ .../controller/GrantPointsController.java | 2 ++ .../epmet/controller/WorkActController.java | 12 +++++++ .../com/epmet/service/WorkActService.java | 6 ++++ .../service/impl/GrantPointsServiceImpl.java | 24 ++++--------- .../service/impl/WorkActServiceImpl.java | 34 ++++++++++++++++++- .../src/main/resources/mapper/ActInfoDao.xml | 3 +- 9 files changed, 94 insertions(+), 19 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/FinishActFormDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/FinishActFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/FinishActFormDTO.java new file mode 100644 index 0000000000..6fe6f5ae7d --- /dev/null +++ b/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 userList; +} + 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 index b3b79453b5..ef0631ccc9 100644 --- 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 @@ -4,6 +4,7 @@ import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -27,4 +28,9 @@ public class GrantPointsFormDTO implements Serializable { @NotBlank(message = "理由不能为空", groups = {DenyUserShowGroup.class}) private String denyRewardReason; + /** + * true:给分;false:不给分 + */ + @NotNull(message = "请选择是否给分", groups = DenyUserShowGroup.class) + private Boolean grantPoint; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPageResDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPageResDTO.java index dff386732b..ce729c351b 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPageResDTO.java +++ b/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未总结 */ private Boolean summaryFlag; + + /** + * 活动积分 + */ + private Integer reward; } 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 72f402337a..390b3bfe21 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 @@ -54,6 +54,7 @@ public class GrantPointsController { **/ @PostMapping("deny") public Result deny(@RequestBody GrantPointsFormDTO formDTO){ + formDTO.setGrantPoint(false); ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.DenyUserShowGroup.class); grantPointsService.deny(formDTO); return new Result(); @@ -68,6 +69,7 @@ public class GrantPointsController { **/ @PostMapping("agree") public Result agree(@RequestBody GrantPointsFormDTO formDTO){ + formDTO.setGrantPoint(true); ValidatorUtils.validateEntity(formDTO, GrantPointsFormDTO.AddUserInternalGroup.class); grantPointsService.agree(formDTO); return new Result(); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index abc846eb86..845e6d239a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -328,4 +328,16 @@ public class WorkActController { public Result queryActDetail(@LoginUser TokenDto tokenDto, @RequestBody ActIdFormDTO formDTO) { return new Result().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(); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java index 588f8c4ef2..8d3f98cb37 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -164,4 +164,10 @@ public interface WorkActService { * @return */ ActDetailResultDTO queryActDetail(String actId, String userId); + + /** + * + * @param formDTO + */ + void finish(FinishActFormDTO formDTO); } 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 index d761445c55..32607d5d9d 100644 --- 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 @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; @@ -108,19 +109,14 @@ public class GrantPointsServiceImpl implements GrantPointsService { @Transactional(rollbackFor = Exception.class) 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()); + ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId()); + if (null == actUserRelationDTO || ActConstant.HANDLED.equals(actUserRelationDTO.getProcessFlag())) { return; } //查取分值 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"); return; } @@ -152,20 +148,14 @@ public class GrantPointsServiceImpl implements GrantPointsService { @Override @Transactional(rollbackFor = Exception.class) 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()); + ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId()); + if (null == actUserRelationDTO || ActConstant.HANDLED.equals(actUserRelationDTO.getProcessFlag())) { return; } //查取分值 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"); return; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 57ae820fbc..59cbd317aa 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/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; @Resource private IcActivityServiceRelationService icActivityServiceRelationService; - + @Autowired + private ActPointLogService actPointLogService; /** * @author yinzuomei @@ -1716,4 +1717,35 @@ public class WorkActServiceImpl implements WorkActService { } 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()); + } } 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 c0bdf44c43..465dd8adb1 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 @@ -828,7 +828,8 @@ AND aur.DEL_FLAG = '0' AND ( aur.`STATUS` = 'auditing' OR aur.`STATUS` = 'passed' ) ) AS signedUp, - ai.SUMMARY_FLAG as summaryFlag + ai.SUMMARY_FLAG as summaryFlag, + ai.REWARD as reward, FROM act_info ai WHERE