fix: 流程完善

This commit is contained in:
yjz
2023-12-14 09:09:08 +08:00
parent 6722d6c20c
commit d593e00195
5 changed files with 73 additions and 25 deletions
@@ -1,6 +1,5 @@
package com.jero.modules.activiti.process.esinspectplan.service.impl; package com.jero.modules.activiti.process.esinspectplan.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -37,7 +36,6 @@ import org.activiti.engine.*;
import org.activiti.engine.repository.ProcessDefinition; import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task; import org.activiti.engine.task.Task;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -97,6 +95,8 @@ public class EsInspectPlanFlowServiceImpl implements IEsInspectPlanFlowService {
RuntimeService runtimeService = processEngine.getRuntimeService(); RuntimeService runtimeService = processEngine.getRuntimeService();
@Resource @Resource
private TaskService taskService; private TaskService taskService;
private static final String COUNTERSIGN = "countersign";
private static final String COUNTERSIGN_TAG = "countersignTag";
@Override @Override
public void flowStart(EsInspectPlanFlowVO esInspectPlanFlowVO) { public void flowStart(EsInspectPlanFlowVO esInspectPlanFlowVO) {
@@ -189,6 +189,14 @@ public class EsInspectPlanFlowServiceImpl implements IEsInspectPlanFlowService {
.eq(ProcessDraft::getUserId, loginUser.getId())); .eq(ProcessDraft::getUserId, loginUser.getId()));
// 保存新草稿 // 保存新草稿
processDraftService.save(processDraft); processDraftService.save(processDraft);
// 稽查联络人汇总节点保存会签信息
if (StringUtils.isNotBlank(processAll.getTaskId())){
Task task = taskService.createTaskQuery().taskId(processAll.getTaskId()).singleResult();
if (EsInspectPlanCommon.PROCESS_NODE_3.equals(task.getTaskDefinitionKey())){
taskService.setVariable(processAll.getTaskId(), COUNTERSIGN, esInspectPlanFlowVO.getCountersign());
taskService.setVariable(processAll.getTaskId(), COUNTERSIGN_TAG, esInspectPlanFlowVO.getCountersignTag());
}
}
} }
private Map<String, Object> listToString(Map<String, Object> map) { private Map<String, Object> listToString(Map<String, Object> map) {
@@ -248,24 +256,30 @@ public class EsInspectPlanFlowServiceImpl implements IEsInspectPlanFlowService {
.eq(StringUtils.isNotBlank(taskId), ProcessApprovalRecord::getTaskId, taskId) .eq(StringUtils.isNotBlank(taskId), ProcessApprovalRecord::getTaskId, taskId)
, false); , false);
} }
if (StringUtils.isNotBlank(taskId)){ // 会签信息
Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); countersign(taskId, esInspectPlanFlowVO);
if (EsInspectPlanCommon.PROCESS_NODE_3.equals(task.getTaskDefinitionKey())){
Object obj = taskService.getVariable(taskId, "involveList");
List<String> involveList = JSON.parseObject(JSON.toJSONString(obj), List.class);
if (!CollectionUtils.isEmpty(involveList)){
HashMap<String, Object> stringObjectHashMap = new HashMap<>();
String join = String.join(",", involveList);
esInspectPlanFlowVO.setCountersign(join);
esInspectPlanFlowVO.setCountersignDictText(sysUserService.dictByIdsOrUserNames(join, ""));
}
}
}
esInspectPlanFlowVO.setProcessAll(processAll); esInspectPlanFlowVO.setProcessAll(processAll);
esInspectPlanFlowVO.setProcessApprovalRecord(processApprovalRecord); esInspectPlanFlowVO.setProcessApprovalRecord(processApprovalRecord);
return esInspectPlanFlowVO; return esInspectPlanFlowVO;
} }
private void countersign(String taskId, EsInspectPlanFlowVO esInspectPlanFlowVO) {
if (StringUtils.isNotBlank(taskId)){
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (EsInspectPlanCommon.PROCESS_NODE_3.equals(task.getTaskDefinitionKey())){
String countersign = (String) taskService.getVariable(taskId, COUNTERSIGN);
String countersignTag = (String) taskService.getVariable(taskId, COUNTERSIGN_TAG);
if (StringUtils.isNotBlank(countersign)){
esInspectPlanFlowVO.setCountersign(countersign);
esInspectPlanFlowVO.setCountersignDictText(sysUserService.dictByIdsOrUserNames(countersign, ""));
}
if (StringUtils.isNotBlank(countersignTag)){
esInspectPlanFlowVO.setCountersignTag(countersignTag);
}
}
}
}
@Override @Override
public List<ProcessNode> queryPersonInfo(String processDefinitionName, String processInstanceId) { public List<ProcessNode> queryPersonInfo(String processDefinitionName, String processInstanceId) {
List<ProcessNode> nodeList = new ArrayList<>(); List<ProcessNode> nodeList = new ArrayList<>();
@@ -326,6 +340,8 @@ public class EsInspectPlanFlowServiceImpl implements IEsInspectPlanFlowService {
Task task = taskService.createTaskQuery().taskId(processAll.getTaskId()).singleResult(); Task task = taskService.createTaskQuery().taskId(processAll.getTaskId()).singleResult();
if (task != null) { if (task != null) {
// 稽查联络人汇总节点保存会签信息
saveCountersign(esInspectPlanFlowVO, map, task);
// 完成任务 // 完成任务
taskService.complete(task.getId(), map); taskService.complete(task.getId(), map);
// 判断是否是最后一个节点 // 判断是否是最后一个节点
@@ -353,6 +369,17 @@ public class EsInspectPlanFlowServiceImpl implements IEsInspectPlanFlowService {
} }
} }
private static void saveCountersign(EsInspectPlanFlowVO esInspectPlanFlowVO, Map<String, Object> map, Task task) {
if (EsInspectPlanCommon.PROCESS_NODE_3.equals(task.getTaskDefinitionKey()) && map.containsKey("pass") && (boolean) map.get("pass")){
if (StringUtils.isNotBlank(esInspectPlanFlowVO.getCountersign())){
map.put(COUNTERSIGN, esInspectPlanFlowVO.getCountersign());
}
if (StringUtils.isNotBlank(esInspectPlanFlowVO.getCountersignTag())){
map.put(COUNTERSIGN_TAG, esInspectPlanFlowVO.getCountersignTag());
}
}
}
private void saveDataToInspect(String projectId) { private void saveDataToInspect(String projectId) {
// 企标稽查计划业务表数据 // 企标稽查计划业务表数据
List<ProcessEsInspectPlan> processEsInspectPlanList = processEsInspectPlanService.list( List<ProcessEsInspectPlan> processEsInspectPlanList = processEsInspectPlanService.list(
@@ -31,6 +31,12 @@ public class EsInspectPlanFlowVO {
@ApiModelProperty(value = "map") @ApiModelProperty(value = "map")
private Map<String, Object> map; private Map<String, Object> map;
/**
* 是否会签
*/
@ApiModelProperty(value="是否会签")
private String countersignTag;
/** /**
* 会签人员 * 会签人员
*/ */
@@ -26,6 +26,8 @@ import com.jero.modules.laws.standardization.entity.LawsStandardization;
import com.jero.modules.laws.standardization.entity.LawsStandardizationMeeting; import com.jero.modules.laws.standardization.entity.LawsStandardizationMeeting;
import com.jero.modules.laws.standardization.service.ILawsStandardizationService; import com.jero.modules.laws.standardization.service.ILawsStandardizationService;
import com.jero.modules.laws.standardization.vo.StandardizationVO; import com.jero.modules.laws.standardization.vo.StandardizationVO;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import org.activiti.engine.ProcessEngine; import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines; import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
@@ -58,6 +60,7 @@ public class MeetingManageFlowServiceImpl implements IMeetingManageFlowService {
private final IProcessMeetingManageService processMeetingManageService; private final IProcessMeetingManageService processMeetingManageService;
private final IProcessMeetingManagePersonnelService processMeetingManagePersonnelService; private final IProcessMeetingManagePersonnelService processMeetingManagePersonnelService;
private final ILawsStandardizationService lawsStandardizationService; private final ILawsStandardizationService lawsStandardizationService;
private final ISysUserService sysUserService;
public MeetingManageFlowServiceImpl(ProcessAllService processAllService, public MeetingManageFlowServiceImpl(ProcessAllService processAllService,
ProcessApprovalRecordService processApprovalRecordService, ProcessApprovalRecordService processApprovalRecordService,
@@ -65,7 +68,8 @@ public class MeetingManageFlowServiceImpl implements IMeetingManageFlowService {
ProcessNodeLinkService processNodeLinkService, ProcessNodeLinkService processNodeLinkService,
IProcessMeetingManageService processMeetingManageService, IProcessMeetingManageService processMeetingManageService,
IProcessMeetingManagePersonnelService processMeetingManagePersonnelService, IProcessMeetingManagePersonnelService processMeetingManagePersonnelService,
ILawsStandardizationService lawsStandardizationService) { ILawsStandardizationService lawsStandardizationService,
ISysUserService sysUserService) {
this.processAllService = processAllService; this.processAllService = processAllService;
this.processApprovalRecordService = processApprovalRecordService; this.processApprovalRecordService = processApprovalRecordService;
this.processDraftService = processDraftService; this.processDraftService = processDraftService;
@@ -73,6 +77,7 @@ public class MeetingManageFlowServiceImpl implements IMeetingManageFlowService {
this.processMeetingManageService = processMeetingManageService; this.processMeetingManageService = processMeetingManageService;
this.processMeetingManagePersonnelService = processMeetingManagePersonnelService; this.processMeetingManagePersonnelService = processMeetingManagePersonnelService;
this.lawsStandardizationService = lawsStandardizationService; this.lawsStandardizationService = lawsStandardizationService;
this.sysUserService = sysUserService;
} }
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
@@ -308,6 +313,8 @@ public class MeetingManageFlowServiceImpl implements IMeetingManageFlowService {
lawsStandardizationMeeting.setPersonnelId(meetingManagePersonnel.getPersonnelId()); lawsStandardizationMeeting.setPersonnelId(meetingManagePersonnel.getPersonnelId());
lawsStandardizationMeeting.setMeetingData(meetingManagePersonnel.getFileId()); lawsStandardizationMeeting.setMeetingData(meetingManagePersonnel.getFileId());
lawsStandardizationMeeting.setSource("2"); lawsStandardizationMeeting.setSource("2");
SysUser sysUser = sysUserService.getById(meetingManagePersonnel.getPersonnelId());
lawsStandardizationMeeting.setCreateBy(sysUser.getUsername());
lawsStandardizationMeetingList.add(lawsStandardizationMeeting); lawsStandardizationMeetingList.add(lawsStandardizationMeeting);
} }
@@ -1,8 +1,12 @@
package com.jero.modules.laws.dataCenter.service.impl; package com.jero.modules.laws.dataCenter.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.modules.laws.common.constant.FieldCommon; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.vo.ResultCommon; import com.jero.common.api.vo.ResultCommon;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.laws.common.constant.FieldCommon;
import com.jero.modules.laws.common.util.CurrentUserUtil; import com.jero.modules.laws.common.util.CurrentUserUtil;
import com.jero.modules.laws.common.util.DateUtil; import com.jero.modules.laws.common.util.DateUtil;
import com.jero.modules.laws.dataCenter.entity.LawsDataCenterFile; import com.jero.modules.laws.dataCenter.entity.LawsDataCenterFile;
@@ -18,15 +22,10 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; 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 java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/** /**
* @Description: 资料中心-文件数据 * @Description: 资料中心-文件数据
@@ -90,9 +89,11 @@ public class LawsDataCenterFileServiceImpl extends ServiceImpl<LawsDataCenterFil
// 校验管理权限 // 校验管理权限
checkManageAuthAdd(lawsDataCenterFile.getFolderId()); checkManageAuthAdd(lawsDataCenterFile.getFolderId());
lawsDataCenterFile.setOwnerId(CurrentUserUtil.getId()); if (StringUtils.isBlank(lawsDataCenterFile.getOwnerId())){
lawsDataCenterFile.setUploader(CurrentUserUtil.getName()); lawsDataCenterFile.setOwnerId(CurrentUserUtil.getId());
lawsDataCenterFile.setOrgCode(CurrentUserUtil.getOrgCode()); lawsDataCenterFile.setUploader(CurrentUserUtil.getName());
lawsDataCenterFile.setOrgCode(CurrentUserUtil.getOrgCode());
}
if (StringUtils.isBlank(lawsDataCenterFile.getFileId())) { if (StringUtils.isBlank(lawsDataCenterFile.getFileId())) {
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "fileId"); throw new JeroBootException(ResultCommon.EMPTY_COMMON, "fileId");
@@ -134,6 +134,13 @@ public class LawsStandardizationServiceImpl extends ServiceImpl<LawsStandardizat
lawsDataCenterFile.setFileId(meetingData); lawsDataCenterFile.setFileId(meetingData);
// XXX(分标委名称)- XXXX(工作组名称)-会议资料 // XXX(分标委名称)- XXXX(工作组名称)-会议资料
lawsDataCenterFile.setFileDescription(getFileDescription(lawsStandardization)); lawsDataCenterFile.setFileDescription(getFileDescription(lawsStandardization));
lawsDataCenterFile.setCreateBy(standardizationMeeting.getCreateBy());
List<SysDepart> sysDeparts = sysDepartService.queryDepartsByUsername(standardizationMeeting.getCreateBy());
SysUser sysUser = sysUserService.getUserByName(standardizationMeeting.getCreateBy());
List<String> orgCodeList = sysDeparts.stream().map(SysDepart::getOrgCode).collect(Collectors.toList());
lawsDataCenterFile.setOwnerId(sysUser.getId());
lawsDataCenterFile.setUploader(sysUser.calcNameWorkNo());
lawsDataCenterFile.setOrgCode(String.join(",", orgCodeList));
lawsDataCenterFileService.add(lawsDataCenterFile); lawsDataCenterFileService.add(lawsDataCenterFile);
} }
} else { } else {