消息待办
parent
85413e02d5
commit
09f5dec44b
|
|
@ -1,8 +1,13 @@
|
||||||
package com.zcloud.domain.command;
|
package com.zcloud.domain.command;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.jjb.saas.message.client.message.facede.MessageFacade;
|
||||||
|
import com.jjb.saas.message.client.message.request.MessageSendCmd;
|
||||||
|
import com.jjb.saas.message.client.message.request.MessageTargetCmd;
|
||||||
import com.zcloud.domain.command.convertor.ProjectTaskGroupUserCoConvertor;
|
import com.zcloud.domain.command.convertor.ProjectTaskGroupUserCoConvertor;
|
||||||
import com.zcloud.domain.command.convertor.ProjectTaskInfoCoConvertor;
|
import com.zcloud.domain.command.convertor.ProjectTaskInfoCoConvertor;
|
||||||
import com.zcloud.domain.command.convertor.ProjectTaskScoreInfoCoConvertor;
|
import com.zcloud.domain.command.convertor.ProjectTaskScoreInfoCoConvertor;
|
||||||
|
|
@ -25,13 +30,18 @@ import com.zcloud.domain.persistence.repository.ProjectTaskScoreInfoRepository;
|
||||||
import com.zcloud.gbscommon.todolistmq.TodoListEventPusherUtil;
|
import com.zcloud.gbscommon.todolistmq.TodoListEventPusherUtil;
|
||||||
import com.zcloud.gbscommon.todolistmq.event.TodoListAddEvent;
|
import com.zcloud.gbscommon.todolistmq.event.TodoListAddEvent;
|
||||||
import com.zcloud.gbscommon.utils.Tools;
|
import com.zcloud.gbscommon.utils.Tools;
|
||||||
|
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -42,6 +52,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class ProjectTaskAddExe {
|
public class ProjectTaskAddExe {
|
||||||
private final ProjectTaskGateway projectTaskGateway;
|
private final ProjectTaskGateway projectTaskGateway;
|
||||||
private final ProjectTaskGroupUserCoConvertor projectTaskGroupUserCoConvertor;
|
private final ProjectTaskGroupUserCoConvertor projectTaskGroupUserCoConvertor;
|
||||||
|
|
@ -52,7 +63,8 @@ public class ProjectTaskAddExe {
|
||||||
private final ProjectTaskScoreInfoCoConvertor projectTaskScoreInfoCoConvertor;
|
private final ProjectTaskScoreInfoCoConvertor projectTaskScoreInfoCoConvertor;
|
||||||
private final DomainDepartmentRepository domainDepartmentRepository;
|
private final DomainDepartmentRepository domainDepartmentRepository;
|
||||||
private final TodoListEventPusherUtil todoListEventPusherUtil;
|
private final TodoListEventPusherUtil todoListEventPusherUtil;
|
||||||
|
@DubboReference
|
||||||
|
private MessageFacade messageFacade;
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean execute(ProjectTaskAddCmd cmd) {
|
public boolean execute(ProjectTaskAddCmd cmd) {
|
||||||
ProjectTaskE projectTaskE = new ProjectTaskE();
|
ProjectTaskE projectTaskE = new ProjectTaskE();
|
||||||
|
|
@ -130,8 +142,25 @@ public class ProjectTaskAddExe {
|
||||||
projectTaskGateway.update(projectTaskE);
|
projectTaskGateway.update(projectTaskE);
|
||||||
|
|
||||||
|
|
||||||
|
//消息通知
|
||||||
|
try{
|
||||||
String domainDepartmentId = projectTaskE.getDomainDepartmentId();
|
String domainDepartmentId = projectTaskE.getDomainDepartmentId();
|
||||||
DomainDepartmentDO infoByUUID = domainDepartmentRepository.getInfoByUUID(domainDepartmentId);
|
DomainDepartmentDO infoByUUID = domainDepartmentRepository.getInfoByUUID(domainDepartmentId);
|
||||||
|
MessageSendCmd messageSendCmd = new MessageSendCmd();
|
||||||
|
messageSendCmd.setBusinessId(UuidUtil.get32UUID());
|
||||||
|
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
||||||
|
messageTargetCmd.setUserId(infoByUUID.getMasterUserId());
|
||||||
|
messageSendCmd.setTargetCmd(messageTargetCmd);
|
||||||
|
messageSendCmd.setSourceCode("MS000105");
|
||||||
|
messageSendCmd.setNeedTokenEnum(false);
|
||||||
|
Map<String, Object> sendParams = new HashMap<String, Object>();
|
||||||
|
messageSendCmd.setParams(sendParams);
|
||||||
|
|
||||||
|
log.info("评分完成消息提醒发送消息参数:messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd));
|
||||||
|
SingleResponse<Boolean> d = messageFacade.send(messageSendCmd);
|
||||||
|
log.info("评分完成消息提醒发送消息结果:d: {}", JSONUtil.toJsonStr(d));
|
||||||
|
|
||||||
|
|
||||||
// 发送待办
|
// 发送待办
|
||||||
TodoListAddEvent event = new TodoListAddEvent();
|
TodoListAddEvent event = new TodoListAddEvent();
|
||||||
event.setTitle("您有一条【专项领域】待处理");
|
event.setTitle("您有一条【专项领域】待处理");
|
||||||
|
|
@ -143,6 +172,9 @@ public class ProjectTaskAddExe {
|
||||||
event.setAppFlag(0); // 是否APP端待办 1是 0否
|
event.setAppFlag(0); // 是否APP端待办 1是 0否
|
||||||
event.setOtherParams(new JSONObject());
|
event.setOtherParams(new JSONObject());
|
||||||
todoListEventPusherUtil.sendMessageAddEvent( event);
|
todoListEventPusherUtil.sendMessageAddEvent( event);
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.error("评分完成消息提醒发送消息异常:", e);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,11 @@ import com.zcloud.domain.domain.model.CorpInfoE;
|
||||||
import com.zcloud.domain.domain.model.ProjectTaskScoreInfoE;
|
import com.zcloud.domain.domain.model.ProjectTaskScoreInfoE;
|
||||||
import com.zcloud.domain.dto.ProjectTaskScoreInfoUpdateCmd;
|
import com.zcloud.domain.dto.ProjectTaskScoreInfoUpdateCmd;
|
||||||
import com.zcloud.domain.dto.ProjectTaskSetScoreCmd;
|
import com.zcloud.domain.dto.ProjectTaskSetScoreCmd;
|
||||||
|
import com.zcloud.domain.persistence.dataobject.DomainGroupDO;
|
||||||
import com.zcloud.domain.persistence.dataobject.ProjectTaskDO;
|
import com.zcloud.domain.persistence.dataobject.ProjectTaskDO;
|
||||||
import com.zcloud.domain.persistence.dataobject.ProjectTaskGroupUserDO;
|
import com.zcloud.domain.persistence.dataobject.ProjectTaskGroupUserDO;
|
||||||
import com.zcloud.domain.persistence.dataobject.ProjectTaskScoreInfoDO;
|
import com.zcloud.domain.persistence.dataobject.ProjectTaskScoreInfoDO;
|
||||||
import com.zcloud.domain.persistence.repository.CorpInfoRepository;
|
import com.zcloud.domain.persistence.repository.*;
|
||||||
import com.zcloud.domain.persistence.repository.ProjectTaskGroupUserRepository;
|
|
||||||
import com.zcloud.domain.persistence.repository.ProjectTaskRepository;
|
|
||||||
import com.zcloud.domain.persistence.repository.ProjectTaskScoreInfoRepository;
|
|
||||||
import com.zcloud.gbscommon.todolistmq.TodoListEventPusherUtil;
|
import com.zcloud.gbscommon.todolistmq.TodoListEventPusherUtil;
|
||||||
import com.zcloud.gbscommon.todolistmq.event.TodoListCompleteEvent;
|
import com.zcloud.gbscommon.todolistmq.event.TodoListCompleteEvent;
|
||||||
import com.zcloud.gbscommon.todolistmq.event.TodoListDeleteEvent;
|
import com.zcloud.gbscommon.todolistmq.event.TodoListDeleteEvent;
|
||||||
|
|
@ -57,6 +55,7 @@ public class ProjectTaskScoreInfoUpdateExe {
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private final MessageFacade messageFacade;
|
private final MessageFacade messageFacade;
|
||||||
private final TodoListEventPusherUtil todoListEventPusherUtil;
|
private final TodoListEventPusherUtil todoListEventPusherUtil;
|
||||||
|
private final DomainGroupRepository domainGroupRepository;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void execute(ProjectTaskScoreInfoUpdateCmd projectTaskScoreInfoUpdateCmd) {
|
public void execute(ProjectTaskScoreInfoUpdateCmd projectTaskScoreInfoUpdateCmd) {
|
||||||
|
|
@ -117,6 +116,9 @@ public class ProjectTaskScoreInfoUpdateExe {
|
||||||
|
|
||||||
|
|
||||||
if(finish && averageScore !=null){
|
if(finish && averageScore !=null){
|
||||||
|
ProjectTaskDO infoByTaskId = projectTaskRepository.getInfoByTaskId(info.getProjectTaskId());
|
||||||
|
DomainGroupDO infoByGroupId = domainGroupRepository.getInfoByGroupId(infoByTaskId.getDomainGroupId());
|
||||||
|
|
||||||
//完成后,发送消息通知
|
//完成后,发送消息通知
|
||||||
List<ProjectTaskGroupUserDO> projectTaskGroupUserDOList = projectTaskGroupUserRepository.getListByTaskId(info.getProjectTaskId());
|
List<ProjectTaskGroupUserDO> projectTaskGroupUserDOList = projectTaskGroupUserRepository.getListByTaskId(info.getProjectTaskId());
|
||||||
for (ProjectTaskGroupUserDO projectTaskGroupUserDO : projectTaskGroupUserDOList) {
|
for (ProjectTaskGroupUserDO projectTaskGroupUserDO : projectTaskGroupUserDOList) {
|
||||||
|
|
@ -125,11 +127,13 @@ public class ProjectTaskScoreInfoUpdateExe {
|
||||||
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
||||||
messageTargetCmd.setUserId(projectTaskGroupUserDO.getUserId());
|
messageTargetCmd.setUserId(projectTaskGroupUserDO.getUserId());
|
||||||
messageSendCmd.setTargetCmd(messageTargetCmd);
|
messageSendCmd.setTargetCmd(messageTargetCmd);
|
||||||
messageSendCmd.setSourceCode("");
|
messageSendCmd.setSourceCode("MS000107");
|
||||||
messageSendCmd.setNeedTokenEnum(false);
|
messageSendCmd.setNeedTokenEnum(false);
|
||||||
Map<String, Object> sendParams = new HashMap<String, Object>();
|
Map<String, Object> sendParams = new HashMap<String, Object>();
|
||||||
// sendParams.put("FirefightinglistName", info.getFireCheckName());
|
|
||||||
// sendParams.put("checkPeriod", info.getFireCheckTypeName());
|
sendParams.put("SpecialTaskForceName", infoByGroupId.getDomainGroupName());
|
||||||
|
sendParams.put("ResearchTask", infoByTaskId.getProjectName());
|
||||||
|
sendParams.put("AverageScore", averageScore);
|
||||||
messageSendCmd.setParams(sendParams);
|
messageSendCmd.setParams(sendParams);
|
||||||
try{
|
try{
|
||||||
log.info("评分完成消息提醒发送消息参数:messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd));
|
log.info("评分完成消息提醒发送消息参数:messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd));
|
||||||
|
|
@ -140,7 +144,6 @@ public class ProjectTaskScoreInfoUpdateExe {
|
||||||
log.error("评分完成消息提醒发送消息异常:messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd), e);
|
log.error("评分完成消息提醒发送消息异常:messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ProjectTaskDO infoByTaskId = projectTaskRepository.getInfoByTaskId(info.getProjectTaskId());
|
|
||||||
//任务完成待办
|
//任务完成待办
|
||||||
TodoListCompleteEvent event1 = new TodoListCompleteEvent();
|
TodoListCompleteEvent event1 = new TodoListCompleteEvent();
|
||||||
event1.setForeignSubsidiaryKey(infoByTaskId.getId());// 业务附表ID 没有附表时为foreignKey的值
|
event1.setForeignSubsidiaryKey(infoByTaskId.getId());// 业务附表ID 没有附表时为foreignKey的值
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,7 @@ import com.zcloud.domain.dto.ProjectTaskGroupUserAddCmd;
|
||||||
import com.zcloud.domain.dto.ProjectTaskInfoAddCmd;
|
import com.zcloud.domain.dto.ProjectTaskInfoAddCmd;
|
||||||
import com.zcloud.domain.dto.ProjectTaskScoreInfoAddCmd;
|
import com.zcloud.domain.dto.ProjectTaskScoreInfoAddCmd;
|
||||||
import com.zcloud.domain.dto.ProjectTaskUpdateCmd;
|
import com.zcloud.domain.dto.ProjectTaskUpdateCmd;
|
||||||
import com.zcloud.domain.persistence.dataobject.ProjectTaskDO;
|
import com.zcloud.domain.persistence.dataobject.*;
|
||||||
import com.zcloud.domain.persistence.dataobject.ProjectTaskGroupUserDO;
|
|
||||||
import com.zcloud.domain.persistence.dataobject.ProjectTaskInfoDO;
|
|
||||||
import com.zcloud.domain.persistence.dataobject.ProjectTaskScoreInfoDO;
|
|
||||||
import com.zcloud.domain.persistence.repository.*;
|
import com.zcloud.domain.persistence.repository.*;
|
||||||
import com.zcloud.gbscommon.todolistmq.TodoListEventPusherUtil;
|
import com.zcloud.gbscommon.todolistmq.TodoListEventPusherUtil;
|
||||||
import com.zcloud.gbscommon.todolistmq.event.TodoListAddBatchEvent;
|
import com.zcloud.gbscommon.todolistmq.event.TodoListAddBatchEvent;
|
||||||
|
|
@ -59,6 +56,7 @@ public class ProjectTaskUpdateExe {
|
||||||
private final ProjectTaskScoreInfoRepository projectTaskScoreInfoRepository;
|
private final ProjectTaskScoreInfoRepository projectTaskScoreInfoRepository;
|
||||||
private final ProjectTaskScoreInfoCoConvertor projectTaskScoreInfoCoConvertor;
|
private final ProjectTaskScoreInfoCoConvertor projectTaskScoreInfoCoConvertor;
|
||||||
private final TodoListEventPusherUtil todoListEventPusherUtil;
|
private final TodoListEventPusherUtil todoListEventPusherUtil;
|
||||||
|
private final DomainGroupRepository domainGroupRepository;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private MessageFacade messageFacade;
|
private MessageFacade messageFacade;
|
||||||
|
|
||||||
|
|
@ -177,6 +175,8 @@ public class ProjectTaskUpdateExe {
|
||||||
//每一个都需要 消息提醒和待办
|
//每一个都需要 消息提醒和待办
|
||||||
for (ProjectTaskDO projectTaskDO : projectTaskDOExecutingList) {
|
for (ProjectTaskDO projectTaskDO : projectTaskDOExecutingList) {
|
||||||
try{
|
try{
|
||||||
|
DomainGroupDO infoByGroupId = domainGroupRepository.getInfoByGroupId(projectTaskDO.getDomainGroupId());
|
||||||
|
|
||||||
List<TodoListAddEvent> todoListAddEventList = new ArrayList<>();
|
List<TodoListAddEvent> todoListAddEventList = new ArrayList<>();
|
||||||
List<ProjectTaskScoreInfoDO> projectTaskScoreInfoDOList = projectTaskScoreInfoRepository.getListByTaskId(projectTaskDO.getProjectTaskId());
|
List<ProjectTaskScoreInfoDO> projectTaskScoreInfoDOList = projectTaskScoreInfoRepository.getListByTaskId(projectTaskDO.getProjectTaskId());
|
||||||
for (ProjectTaskScoreInfoDO projectTaskScoreInfoDO : projectTaskScoreInfoDOList) {
|
for (ProjectTaskScoreInfoDO projectTaskScoreInfoDO : projectTaskScoreInfoDOList) {
|
||||||
|
|
@ -186,11 +186,10 @@ public class ProjectTaskUpdateExe {
|
||||||
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
||||||
messageTargetCmd.setUserId(projectTaskScoreInfoDO.getUserId());
|
messageTargetCmd.setUserId(projectTaskScoreInfoDO.getUserId());
|
||||||
messageSendCmd.setTargetCmd(messageTargetCmd);
|
messageSendCmd.setTargetCmd(messageTargetCmd);
|
||||||
messageSendCmd.setSourceCode("");
|
messageSendCmd.setSourceCode("MS000106");
|
||||||
messageSendCmd.setNeedTokenEnum(false);
|
messageSendCmd.setNeedTokenEnum(false);
|
||||||
Map<String, Object> sendParams = new HashMap<String, Object>();
|
Map<String, Object> sendParams = new HashMap<String, Object>();
|
||||||
// sendParams.put("FirefightinglistName", info.getFireCheckName());
|
sendParams.put("SpecialLaskForceName", infoByGroupId.getDomainGroupName());
|
||||||
// sendParams.put("checkPeriod", info.getFireCheckTypeName());
|
|
||||||
messageSendCmd.setParams(sendParams);
|
messageSendCmd.setParams(sendParams);
|
||||||
try{
|
try{
|
||||||
log.info("任务结束消息提醒发送消息参数:messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd));
|
log.info("任务结束消息提醒发送消息参数:messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd));
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,7 @@ public interface DomainGroupMapper extends BaseMapper<DomainGroupDO> {
|
||||||
DomainGroupDO getInfoById(Long id);
|
DomainGroupDO getInfoById(Long id);
|
||||||
|
|
||||||
List<DomainGroupDO> listAll(Map<String, Object> params);
|
List<DomainGroupDO> listAll(Map<String, Object> params);
|
||||||
|
|
||||||
|
DomainGroupDO getInfoByGroupId(String domainGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,7 @@ public interface DomainGroupRepository extends BaseRepository<DomainGroupDO> {
|
||||||
List<DomainGroupDO> listAll(Map<String, Object> params);
|
List<DomainGroupDO> listAll(Map<String, Object> params);
|
||||||
|
|
||||||
List<DomainGroupDO> getListByCorpinfoId(@NotNull(message = "主责企业不能为空") Long corpinfoId);
|
List<DomainGroupDO> getListByCorpinfoId(@NotNull(message = "主责企业不能为空") Long corpinfoId);
|
||||||
|
|
||||||
|
DomainGroupDO getInfoByGroupId(String domainGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,5 +61,10 @@ public class DomainGroupRepositoryImpl extends BaseRepositoryImpl<DomainGroupMap
|
||||||
queryWrapper.eq("corpinfo_id", corpinfoId);
|
queryWrapper.eq("corpinfo_id", corpinfoId);
|
||||||
return domainGroupMapper.selectList(queryWrapper);
|
return domainGroupMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DomainGroupDO getInfoByGroupId(String domainGroupId) {
|
||||||
|
return domainGroupMapper.getInfoByGroupId(domainGroupId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,5 +59,16 @@
|
||||||
</if>
|
</if>
|
||||||
order by dg.create_time desc
|
order by dg.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getInfoByGroupId" resultType="com.zcloud.domain.persistence.dataobject.DomainGroupDO">
|
||||||
|
select dg.*,
|
||||||
|
c.corp_name as corpinfoname,
|
||||||
|
d.name as teamdepartmentname,
|
||||||
|
u.name as teamusername
|
||||||
|
from domain_group dg
|
||||||
|
left join corp_info c on dg.corpinfo_id = c.id and c.delete_enum = 'false'
|
||||||
|
left join department d on dg.team_department_id = d.id and d.delete_enum = 'false'
|
||||||
|
left join user u on dg.team_user_id = u.id and u.delete_enum = 'false'
|
||||||
|
where dg.delete_enum = 'false' and dg.domain_group_id=#{domainGroupId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue