Browse Source

heart-work:积分发放添加消息事件

master
yinzuomei 5 years ago
parent
commit
2dd2c7fd11
  1. 20
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java
  2. 18
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java
  3. 8
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java
  4. 7
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java
  5. 9
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java
  6. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java
  7. 68
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  8. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

20
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java

@ -0,0 +1,20 @@
package com.epmet.commons.tools.constant;
/**
* 消息常亮
*
* @author yinzuomei@elink-cn.com
* @date 2020/7/27 9:58
*/
public interface MqConstant {
/**
* 加分 plus
*/
String PLUS="plus";
/**
* 减分标识 minus
*/
String MINUS="minus";
}

18
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java

@ -0,0 +1,18 @@
package com.epmet.commons.tools.dto.form.mq.eventmsg;
import lombok.Data;
/**
* 结束活动发放活动积分消息体
*
* @author yinzuomei@elink-cn.com
* @date 2020/7/27 9:26
*/
@Data
public class ActPointEventMsg extends BasePointEventMsg{
/**
* 参与活动的备注
*/
private String remark;
}

8
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java

@ -1,6 +1,7 @@
package com.epmet.dto.result.work;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -94,6 +95,13 @@ public class CanceledActDetailResultDTO implements Serializable {
* 活动详情
*/
private List<ActPreviewContentResultDTO> actContent;
/**
* true我发布的false,其他人发布的
*/
private Boolean isMyPublish;
@JsonIgnore
private String createdBy;
@Override
public String toString() {

7
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java

@ -1,6 +1,7 @@
package com.epmet.dto.result.work;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -105,5 +106,11 @@ public class FinishedActDetailResultDTO implements Serializable {
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date actualEndTime;
/**
* true我发布的false,其他人发布的
*/
private Boolean isMyPublish;
@JsonIgnore
private String createdBy;
}

9
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java

@ -1,6 +1,7 @@
package com.epmet.dto.result.work;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -89,4 +90,12 @@ public class InProgressActDetailResultDTO implements Serializable {
* 活动详情
*/
private List<ActPreviewContentResultDTO> actContent;
/**
* true我发布的false,其他人发布的
*/
private Boolean isMyPublish;
@JsonIgnore
private String createdBy;
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java

@ -20,4 +20,6 @@ public interface ActMessageConstant {
* 活动被取消给已经通过审核的居民端用户发送消息
*/
String ACT_CANCELED="您报名的活动%s,已取消,原因:%s";
String ACT_POINTS_EVENT_REMARK="参与%s";
}

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

@ -1,8 +1,14 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg;
import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
@ -24,6 +30,7 @@ import com.epmet.dto.result.work.*;
import com.epmet.entity.ActContentEntity;
import com.epmet.entity.ActInfoEntity;
import com.epmet.entity.ActOperationRecEntity;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.*;
@ -566,6 +573,11 @@ public class WorkActServiceImpl implements WorkActService {
CanceledActDetailResultDTO canceledActDetailResultDTO=actInfoDao.selectCanceledActInfo(actId);
if(null!=canceledActDetailResultDTO){
canceledActDetailResultDTO.setActContent(actContentDao.selectByActId(actId));
if(canceledActDetailResultDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){
canceledActDetailResultDTO.setIsMyPublish(true);
}else{
canceledActDetailResultDTO.setIsMyPublish(false);
}
}
return canceledActDetailResultDTO;
}
@ -604,6 +616,11 @@ public class WorkActServiceImpl implements WorkActService {
if (null != resultDTO) {
List<ActPreviewContentResultDTO> list = actContentDao.selectByActId(formDTO.getActId());
resultDTO.setActContent(list);
if(resultDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){
resultDTO.setIsMyPublish(true);
}else{
resultDTO.setIsMyPublish(false);
}
}
return resultDTO;
}
@ -621,6 +638,11 @@ public class WorkActServiceImpl implements WorkActService {
if (null != resultDTO) {
List<ActPreviewContentResultDTO> list = actContentDao.selectByActId(actId);
resultDTO.setActContent(list);
if(resultDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){
resultDTO.setIsMyPublish(true);
}else{
resultDTO.setIsMyPublish(false);
}
}
return resultDTO;
}
@ -646,7 +668,51 @@ public class WorkActServiceImpl implements WorkActService {
this.saveActOperationRec(actId);
//生成统计表
this.saveActStatistical(actId);
//发放积分调用事件 TODO
//发放积分调用事件
if(actInfoDTO.getReward()>0){
this.grantActPoints(actInfoDTO);
}
}
private void grantActPoints(ActInfoDTO actInfoDTO) {
//查询已经给分的用户
QueryWrapper<ActUserRelationEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(actInfoDTO.getId()), FieldConstant.ID, actInfoDTO.getId())
.eq("PROCESS_FLAG",ActConstant.HANDLED)
.eq("REWARD_FLAG",ActConstant.ACT_USER_STATUS_AGREE);
List<ActUserRelationEntity> actUserRelationEntityList=actUserRelationDao.selectList(wrapper);
if(null==actUserRelationEntityList||actUserRelationEntityList.size()<1){
logger.info("不存在给分的记录,无需发送消息时间");
return;
}
Result<CustomerAgencyDTO> userResult=govOrgOpenFeignClient.getAgencyByStaff(loginUserUtil.getLoginUserId());
if(!userResult.success()||null==userResult.getData()){
logger.error(String.format("根据staffId查询所属的组织机构失败,staffId=%s",loginUserUtil.getLoginUserId()));
}
String opAgencyId=userResult.getData().getId();
String remark=String.format(ActMessageConstant.ACT_POINTS_EVENT_REMARK,actInfoDTO.getTitle());
MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO();
//mq的事件类型
mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_SEND_POINT.getEventClass());
//事件code
mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_SEND_POINT.getEventTag());
List<ActPointEventMsg> actPointEventMsgList=new ArrayList<>();
for(ActUserRelationEntity actUserRelationEntity:actUserRelationEntityList){
ActPointEventMsg actPointEventMsg=new ActPointEventMsg();
actPointEventMsg.setOpAgencyId(opAgencyId);
actPointEventMsg.setCustomerId(actInfoDTO.getCustomerId());
actPointEventMsg.setUserId(actUserRelationEntity.getUserId());
actPointEventMsg.setActionFlag(MqConstant.PLUS);
actPointEventMsg.setPoint(actInfoDTO.getReward());
actPointEventMsg.setIsCommon(true);
actPointEventMsg.setRemark(remark);
actPointEventMsgList.add(actPointEventMsg);
}
mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList));
Result result=SendMqMsgUtils.sendMsg(mqBaseMsgDTO);
if(!result.success()){
logger.error("活动积分发放失败");
}
}
private void updateHeartUserInfo(ActInfoDTO actInfoDTO) {

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

@ -597,7 +597,8 @@
ai.SPONSOR_NAME AS sponsorName,
ai.REQUIREMENT AS requirement,
ai.CANCEL_TIME AS cancelTime,
ai.CANCEL_REASON AS cancelReason
ai.CANCEL_REASON AS cancelReason,
ai.CREATED_BY as createdBy
FROM
act_info ai
WHERE
@ -625,7 +626,8 @@
ai.REQUIREMENT AS requirement,
AI.SUMMARY_FLAG AS summaryFlag,
AI.ACTUAL_START_TIME AS actualStartTime,
AI.ACTUAL_END_TIME AS actualEndTime
AI.ACTUAL_END_TIME AS actualEndTime,
ai.CREATED_BY as createdBy
FROM
act_info ai
WHERE
@ -649,7 +651,8 @@
ai.SPONSOR_TEL AS sponsorTel,
ai.REWARD AS reward,
ai.SPONSOR_NAME AS sponsorName,
ai.REQUIREMENT AS requirement
ai.REQUIREMENT AS requirement,
ai.CREATED_BY as createdBy
FROM
act_info ai
WHERE

Loading…
Cancel
Save