update 法规变更流程结束发消息

This commit is contained in:
liao
2023-11-30 15:25:53 +08:00
parent 6de448aedb
commit 8deefed5ab
2 changed files with 60 additions and 5 deletions
@@ -73,6 +73,14 @@ public class ProcessFbEntryChange implements Serializable {
@Excel(name = "操作类型(1标准法规入库、2标准法规变更)", width = 15)
@ApiModelProperty(value = "操作类型(1标准法规入库、2标准法规变更)")
private java.lang.String operateType;
/**标准编号*/
@Excel(name = "标准编号", width = 15)
@ApiModelProperty(value = "标准编号")
private java.lang.String standardNumber;
/**用户id*/
@Excel(name = "用户id", width = 15)
@ApiModelProperty(value = "用户id")
private java.lang.String userId;
/**JSON字符串*/
@Excel(name = "JSON字符串", width = 15)
@ApiModelProperty(value = "JSON字符串")
@@ -1,6 +1,9 @@
package com.jero.modules.activiti.process.fb.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.api.dto.message.SendMessageDTO;
import com.jero.common.api.vo.SendMessageAPI;
import com.jero.common.constant.enums.YesOrNoEnum;
import com.jero.common.util.UUIDUtils;
import com.jero.modules.activiti.enums.ProcessTypeEnum;
@@ -11,25 +14,28 @@ import com.jero.modules.activiti.process.fb.mapper.ProcessFbEntryChangeMapper;
import com.jero.modules.activiti.process.fb.service.IProcessFbEntryChangeService;
import com.jero.modules.activiti.process.fb.service.IProcessHandleService;
import com.jero.modules.activiti.process.fb.vo.ProcessInfoVO;
import com.jero.modules.laws.common.constant.DictCommon;
import com.jero.modules.laws.common.constant.FieldCommon;
import com.jero.common.api.vo.ResultCommon;
import com.jero.modules.laws.common.constant.MessageTemplateCodeCommon;
import com.jero.modules.laws.common.mapper.LawsCommonMapper;
import com.jero.modules.laws.common.service.ILawsCommonService;
import com.jero.modules.laws.common.util.CurrentUserUtil;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.tag.entity.LawsTag;
import com.jero.modules.tag.enums.TableNameEnum;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jero.common.exception.JeroBootException;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@@ -50,6 +56,10 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
private ILawsCommonService lawsCommonService;
@Resource
private LawsCommonMapper lawsCommonMapper;
@Resource
private SendMessageAPI sendMessageAPI;
@Resource
private ILawsEnterpriseStandardService lawsEnterpriseStandardService;
/**
* @Author: liao
@@ -64,6 +74,7 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
processFbEntryChange.setBusinessJson(JSON.toJSONString(businessMap));
processFbEntryChange.setSource((String) businessMap.get("source"));
processFbEntryChange.setOperateType((String) businessMap.get("operateType"));
processFbEntryChange.setStandardNumber((String) businessMap.get(FieldCommon.STANDARD_NUMBER));
save(processFbEntryChange);
}
@@ -79,6 +90,7 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
processFbEntryChange.setBusinessJson(JSON.toJSONString(businessMap));
processFbEntryChange.setSource((String) businessMap.get("source"));
processFbEntryChange.setOperateType((String) businessMap.get("operateType"));
processFbEntryChange.setStandardNumber((String) businessMap.get(FieldCommon.STANDARD_NUMBER));
updateById(processFbEntryChange);
}
@@ -108,6 +120,7 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
if (StringUtils.isBlank(businessInfoDTO.getId())) {
businessInfoDTO.setId(UUIDUtils.randomUUID20());
}
businessInfoDTO.setUserId(CurrentUserUtil.getId());
processInfoVO.setBusinessId(businessInfoDTO.getId());
addBusinessInfo(businessInfoDTO); // 保存业务信息
@@ -159,6 +172,8 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
private void sendMsg(Map<String, Object> objectMap) {
String module = (String) objectMap.get(FieldCommon.MODULE);
String id = (String) objectMap.get("id");
String standardNumber = (String) objectMap.get(FieldCommon.STANDARD_NUMBER);
String standardName = (String) objectMap.get(FieldCommon.STANDARD_NAME);
Map<String, Object> oldMap = lawsCommonService.getByIdAndModule(id, module, "2", null);
String replaced = (String) objectMap.get(FieldCommon.REPLACED_STANDARD); // 代替标准
@@ -166,12 +181,44 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
String replacedOld = (String) oldMap.get(FieldCommon.REPLACED_STANDARD); // 代替标准
String referenceOld = (String) oldMap.get(FieldCommon.REFERENCE_STANDARD); // 引用标准
String userId = "";
String templateCode = "";
if (StringUtils.isNotBlank(replaced) && !replaced.equals(replacedOld)) { // 代替标准
String content = getContent(objectMap, oldMap, module);
List<String> replacedList = Arrays.asList(replaced.split(","));
LambdaQueryWrapper<ProcessFbEntryChange> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(ProcessFbEntryChange::getStandardNumber, replacedList);
queryWrapper.eq(ProcessFbEntryChange::getOperateType, "1");
List<ProcessFbEntryChange> fbEntryChangeList = list(queryWrapper);
List<String> userIdList = fbEntryChangeList.stream()
.map(ProcessFbEntryChange::getUserId)
.distinct().collect(Collectors.toList());
userId = StringUtils.join(userIdList, ",");
templateCode = MessageTemplateCodeCommon.STANDARD_CHANGE_REPLACE;
}
if (StringUtils.isNotBlank(reference) && !reference.equals(referenceOld)) { // 引用标准
LambdaQueryWrapper<LawsEnterpriseStandard> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(LawsEnterpriseStandard::getReferenceStandard, standardNumber);
queryWrapper.isNotNull(LawsEnterpriseStandard::getMainDraftingUser);
List<LawsEnterpriseStandard> enterpriseStandardList = lawsEnterpriseStandardService.list(queryWrapper);
List<String> userIdList = enterpriseStandardList.stream()
.map(LawsEnterpriseStandard::getMainDraftingUser)
.distinct().collect(Collectors.toList());
userId = StringUtils.join(userIdList, ",");
templateCode = MessageTemplateCodeCommon.STANDARD_CHANGE_REFERENCE;
}
if (StringUtils.isNotBlank(userId)) {
String content = getContent(objectMap, oldMap, module);
SendMessageDTO sendMessageDTO = new SendMessageDTO();
sendMessageDTO.setTemplateCode(templateCode);
sendMessageDTO.setToUserId(userId);
Map<String, String> map = new HashMap<>();
map.put("standardNumber", standardNumber);
map.put("standardName", standardName);
map.put("content", content);
sendMessageDTO.setMap(map);
sendMessageAPI.sendMessage(sendMessageDTO);
}
}