update 法规变更流程结束发消息
This commit is contained in:
+8
@@ -73,6 +73,14 @@ public class ProcessFbEntryChange implements Serializable {
|
|||||||
@Excel(name = "操作类型(1标准法规入库、2标准法规变更)", width = 15)
|
@Excel(name = "操作类型(1标准法规入库、2标准法规变更)", width = 15)
|
||||||
@ApiModelProperty(value = "操作类型(1标准法规入库、2标准法规变更)")
|
@ApiModelProperty(value = "操作类型(1标准法规入库、2标准法规变更)")
|
||||||
private java.lang.String operateType;
|
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字符串*/
|
/**JSON字符串*/
|
||||||
@Excel(name = "JSON字符串", width = 15)
|
@Excel(name = "JSON字符串", width = 15)
|
||||||
@ApiModelProperty(value = "JSON字符串")
|
@ApiModelProperty(value = "JSON字符串")
|
||||||
|
|||||||
+52
-5
@@ -1,6 +1,9 @@
|
|||||||
package com.jero.modules.activiti.process.fb.service.impl;
|
package com.jero.modules.activiti.process.fb.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
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.constant.enums.YesOrNoEnum;
|
||||||
import com.jero.common.util.UUIDUtils;
|
import com.jero.common.util.UUIDUtils;
|
||||||
import com.jero.modules.activiti.enums.ProcessTypeEnum;
|
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.IProcessFbEntryChangeService;
|
||||||
import com.jero.modules.activiti.process.fb.service.IProcessHandleService;
|
import com.jero.modules.activiti.process.fb.service.IProcessHandleService;
|
||||||
import com.jero.modules.activiti.process.fb.vo.ProcessInfoVO;
|
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.modules.laws.common.constant.FieldCommon;
|
||||||
import com.jero.common.api.vo.ResultCommon;
|
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.mapper.LawsCommonMapper;
|
||||||
import com.jero.modules.laws.common.service.ILawsCommonService;
|
import com.jero.modules.laws.common.service.ILawsCommonService;
|
||||||
import com.jero.modules.laws.common.util.CurrentUserUtil;
|
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.entity.LawsTag;
|
||||||
import com.jero.modules.tag.enums.TableNameEnum;
|
import com.jero.modules.tag.enums.TableNameEnum;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -50,6 +56,10 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
|
|||||||
private ILawsCommonService lawsCommonService;
|
private ILawsCommonService lawsCommonService;
|
||||||
@Resource
|
@Resource
|
||||||
private LawsCommonMapper lawsCommonMapper;
|
private LawsCommonMapper lawsCommonMapper;
|
||||||
|
@Resource
|
||||||
|
private SendMessageAPI sendMessageAPI;
|
||||||
|
@Resource
|
||||||
|
private ILawsEnterpriseStandardService lawsEnterpriseStandardService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: liao
|
* @Author: liao
|
||||||
@@ -64,6 +74,7 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
|
|||||||
processFbEntryChange.setBusinessJson(JSON.toJSONString(businessMap));
|
processFbEntryChange.setBusinessJson(JSON.toJSONString(businessMap));
|
||||||
processFbEntryChange.setSource((String) businessMap.get("source"));
|
processFbEntryChange.setSource((String) businessMap.get("source"));
|
||||||
processFbEntryChange.setOperateType((String) businessMap.get("operateType"));
|
processFbEntryChange.setOperateType((String) businessMap.get("operateType"));
|
||||||
|
processFbEntryChange.setStandardNumber((String) businessMap.get(FieldCommon.STANDARD_NUMBER));
|
||||||
save(processFbEntryChange);
|
save(processFbEntryChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +90,7 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
|
|||||||
processFbEntryChange.setBusinessJson(JSON.toJSONString(businessMap));
|
processFbEntryChange.setBusinessJson(JSON.toJSONString(businessMap));
|
||||||
processFbEntryChange.setSource((String) businessMap.get("source"));
|
processFbEntryChange.setSource((String) businessMap.get("source"));
|
||||||
processFbEntryChange.setOperateType((String) businessMap.get("operateType"));
|
processFbEntryChange.setOperateType((String) businessMap.get("operateType"));
|
||||||
|
processFbEntryChange.setStandardNumber((String) businessMap.get(FieldCommon.STANDARD_NUMBER));
|
||||||
updateById(processFbEntryChange);
|
updateById(processFbEntryChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +120,7 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
|
|||||||
if (StringUtils.isBlank(businessInfoDTO.getId())) {
|
if (StringUtils.isBlank(businessInfoDTO.getId())) {
|
||||||
businessInfoDTO.setId(UUIDUtils.randomUUID20());
|
businessInfoDTO.setId(UUIDUtils.randomUUID20());
|
||||||
}
|
}
|
||||||
|
businessInfoDTO.setUserId(CurrentUserUtil.getId());
|
||||||
processInfoVO.setBusinessId(businessInfoDTO.getId());
|
processInfoVO.setBusinessId(businessInfoDTO.getId());
|
||||||
addBusinessInfo(businessInfoDTO); // 保存业务信息
|
addBusinessInfo(businessInfoDTO); // 保存业务信息
|
||||||
|
|
||||||
@@ -159,6 +172,8 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
|
|||||||
private void sendMsg(Map<String, Object> objectMap) {
|
private void sendMsg(Map<String, Object> objectMap) {
|
||||||
String module = (String) objectMap.get(FieldCommon.MODULE);
|
String module = (String) objectMap.get(FieldCommon.MODULE);
|
||||||
String id = (String) objectMap.get("id");
|
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);
|
Map<String, Object> oldMap = lawsCommonService.getByIdAndModule(id, module, "2", null);
|
||||||
|
|
||||||
String replaced = (String) objectMap.get(FieldCommon.REPLACED_STANDARD); // 代替标准
|
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 replacedOld = (String) oldMap.get(FieldCommon.REPLACED_STANDARD); // 代替标准
|
||||||
String referenceOld = (String) oldMap.get(FieldCommon.REFERENCE_STANDARD); // 引用标准
|
String referenceOld = (String) oldMap.get(FieldCommon.REFERENCE_STANDARD); // 引用标准
|
||||||
|
|
||||||
|
String userId = "";
|
||||||
|
String templateCode = "";
|
||||||
if (StringUtils.isNotBlank(replaced) && !replaced.equals(replacedOld)) { // 代替标准
|
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)) { // 引用标准
|
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);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user