diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/TestGrantFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/TestGrantFormDTO.java new file mode 100644 index 0000000000..4c6e2fe66b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/TestGrantFormDTO.java @@ -0,0 +1,63 @@ +package com.epmet.dto.form.work; + +import com.alibaba.fastjson.JSON; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/30 12:15 + */ +@Data +public class TestGrantFormDTO implements Serializable { + private static final long serialVersionUID = -2643821406956680381L; + public interface AddUserInternalGroup {} + /** + * 当前客户id + */ + @NotBlank(message = "客户id不能为空",groups = AddUserInternalGroup.class) + private String customerId; + /** + * 居民id + */ + @NotBlank(message = "userId不能为空",groups = AddUserInternalGroup.class) + private String userId; + /** + * 分值 + */ + @NotNull(message = "分值不能为空",groups = AddUserInternalGroup.class) + private Integer reward; + /** + * 业务id eg:活动id + */ + @NotBlank(message = "业务id不能为空",groups = AddUserInternalGroup.class) + private String sourceId; + /** + * 备注 + */ + @NotBlank(message = "备注不能为空",groups = AddUserInternalGroup.class) + private String remark; + + /** + * 加减分标识 plus/minus + */ + @NotBlank(message = "加减分标识 plus/minus不能为空",groups = AddUserInternalGroup.class) + private String actionFlag; + + TestGrantFormDTO(){ + this.customerId=""; + this.userId=""; + this.sourceId="111"; + this.reward=20; + this.remark="test"; + this.actionFlag="plus"; + } + public static void main(String[] args) { + System.out.println(JSON.toJSON(new TestGrantFormDTO())); + } +} 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 67eb62f18d..175e54bdaf 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 @@ -190,6 +190,12 @@ public class WorkActController { return new Result(); } + @PostMapping("testgrantpoint") + public Result testGrantPoint(@RequestBody TestGrantFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,TestGrantFormDTO.AddUserInternalGroup.class); + workActService.testGrantPoint(formDTO); + return new Result(); + } /** * @return com.epmet.commons.tools.utils.Result * @param formDTO 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 8aca54049d..bc72cc7d67 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 @@ -146,4 +146,6 @@ public interface WorkActService { * @Date 2020/7/27 13:55 **/ PublishActResultDTO rePublish(RePublishFormDTO rePublishFormDTO); + + void testGrantPoint(TestGrantFormDTO formDTO); } 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 e93d288699..3d4b26a331 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 @@ -873,6 +873,39 @@ public class WorkActServiceImpl implements WorkActService { } } + @Override + public void testGrantPoint(TestGrantFormDTO formDTO) { + //查询当前用户所属组织信息 + Result userResult = govOrgOpenFeignClient.getAgencyByStaff(loginUserUtil.getLoginUserId()); + String opAgencyId = userResult.getData().getId(); + MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO(); + //mq的事件类型 + mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_SEND_POINT.getEventClass()); + //事件code + mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_SEND_POINT.getEventTag()); + List basePointEventMsgArrayList = new ArrayList<>(); + BasePointEventMsg basePointEventMsg = new BasePointEventMsg(); + basePointEventMsg.setOpAgencyId(opAgencyId); + basePointEventMsg.setCustomerId(formDTO.getCustomerId()); + basePointEventMsg.setUserId(formDTO.getUserId()); + basePointEventMsg.setActionFlag(formDTO.getActionFlag()); + basePointEventMsg.setPoint(formDTO.getReward()); + basePointEventMsg.setIsCommon(true); + basePointEventMsg.setRemark(formDTO.getRemark()); + basePointEventMsg.setSourceId(formDTO.getSourceId()); + basePointEventMsg.setOperatorId(loginUserUtil.getLoginUserId()); + basePointEventMsgArrayList.add(basePointEventMsg); + mqBaseMsgDTO.setMsg(JSON.toJSONString(basePointEventMsgArrayList)); + logger.info("发送消息入参:"+JSON.toJSON(mqBaseMsgDTO)); + Result result = SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + logger.info("发送消息返参:"+JSON.toJSON(result)); + if (!result.success()) { + logger.error("积分发放失败"); + return; + } + logger.info("积分发方成功"); + } + private void updateHeartUserInfo(ActInfoDTO actInfoDTO) { List actUserRelationDTOList=actUserRelationService.getUserList(actInfoDTO.getId(),StrConstant.EPMETY_STR); for(ActUserRelationDTO actUserRelation:actUserRelationDTOList){ @@ -1082,6 +1115,7 @@ public class WorkActServiceImpl implements WorkActService { return publishActResultDTO; } + private void noticePassedPeople(ActInfoDTO originalActInfo, ActInfoEntity newActInfoEntity) { /* List actUserRelationDTOList=actUserRelationDao.selectAuditingAndPassedList(originalActInfo.getId()); if(null==actUserRelationDTOList||actUserRelationDTOList.size()<1){