|
|
|
@ -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) { |
|
|
|
|