feat(标准解读流程): 发起
This commit is contained in:
+18
@@ -15,6 +15,8 @@ import com.jero.modules.activiti.process.standardinterpret.vo.FlowApproveInfo;
|
||||
import com.jero.modules.activiti.service.ProcessAllService;
|
||||
import com.jero.modules.activiti.service.ProcessApprovalRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -41,6 +43,7 @@ public class FlowUtility {
|
||||
private final ProcessAllService processAllService;
|
||||
private final ProcessApprovalRecordService processApprovalRecordService;
|
||||
private final ProcessDraftService processDraftService;
|
||||
private final RuntimeService runtimeService;
|
||||
|
||||
public void flowApprovalUpdate(ProcessAll processAll, ProcessApprovalRecord processApprovalRecord){
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
@@ -127,6 +130,21 @@ public class FlowUtility {
|
||||
return flowApproveInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程是否结束
|
||||
* @param processInstanceId
|
||||
* @return
|
||||
*/
|
||||
public boolean isLastNode(String processInstanceId) {
|
||||
// 查询流程实例状态
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
.singleResult();
|
||||
|
||||
// 如果流程实例为null,表示流程已结束
|
||||
return processInstance == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Map中值为List类型的元素转换为以逗号分隔的字符串。
|
||||
* 这样做的目的是为了简化Map的表示,尤其是当List中包含多个元素时。
|
||||
|
||||
+26
-9
@@ -40,6 +40,7 @@ import com.jero.modules.activiti.service.ProcessApprovalRecordService;
|
||||
import com.jero.modules.activiti.service.ProcessNodeLinkService;
|
||||
import com.jero.modules.laws.documenttool.entity.LawsDocumentSplit;
|
||||
import com.jero.modules.laws.documenttool.mapper.DocumentSplitMapper;
|
||||
import com.jero.modules.laws.documenttool.mapper.LawsDocumentSplitMapper;
|
||||
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
|
||||
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
||||
import com.jero.modules.laws.standard.entity.PartName;
|
||||
@@ -49,7 +50,6 @@ import com.jero.modules.laws.standard.service.ILawsPartNameService;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.service.ISarFileSplitInfoService;
|
||||
import com.jero.modules.system.entity.SysDepart;
|
||||
import com.jero.modules.system.service.ISysCategoryService;
|
||||
import com.jero.modules.system.service.ISysDepartService;
|
||||
import com.jero.modules.system.service.ISysDictService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -68,6 +68,7 @@ import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -111,10 +112,10 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
||||
private final ISarFileSplitInfoService sarFileSplitInfoService;
|
||||
private final DocumentSplitMapper documentSplitMapper;
|
||||
private final ISysDictService sysDictService;
|
||||
private final ISysCategoryService sysCategoryService;
|
||||
private final ISysDepartService sysDepartService;
|
||||
private final ILawsPartNameService lawsPartNameService;
|
||||
private final ILawsEnterpriseStandardService lawsEnterpriseStandardService;
|
||||
private final LawsDocumentSplitMapper lawsDocumentSplitMapper;
|
||||
|
||||
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
@@ -136,9 +137,6 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
||||
+ lawsDomesticStandard.getStandardName() + "-解读";
|
||||
processAll.setPrcName(prcName);
|
||||
|
||||
// 设置主流程实例id
|
||||
map.put(ActivitiCommon.MAIN_INSTANCE_ID, SnowflakeUtils.snowflake());
|
||||
|
||||
// 根据流程key启动流程,设置流程变量,更新流程总表信息,更新流程审批信息,返回任务信息
|
||||
Task task = startProcessInstanceByKey(StandardInterpretCommon.KEY_1, map,
|
||||
processAll, processApprovalRecord, data);
|
||||
@@ -198,6 +196,21 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
||||
// 完成任务
|
||||
taskService.complete(processAll.getTaskId(), map);
|
||||
|
||||
// 流程结束
|
||||
if (flowUtility.isLastNode(processAll.getProcessInstanceId())){
|
||||
// 查询业务信息
|
||||
StandardInterpretDTO standardInterpretDTO = queryBusinessData(processAll, processApprovalRecord);
|
||||
// 更新数据到拆分库
|
||||
List<ProcessStandardInterpretClauseSublist> processStandardInterpretClauseSublistList =
|
||||
standardInterpretDTO.getProcessStandardInterpretClauseSublistList();
|
||||
for (ProcessStandardInterpretClauseSublist standardInterpretClauseSublist :
|
||||
processStandardInterpretClauseSublistList) {
|
||||
LawsDocumentSplit lawsDocumentSplit = new LawsDocumentSplit();
|
||||
BeanUtils.copyProperties(standardInterpretClauseSublist, lawsDocumentSplit);
|
||||
lawsDocumentSplit.setId(standardInterpretClauseSublist.getClauseId());
|
||||
lawsDocumentSplitMapper.updateById(lawsDocumentSplit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -497,11 +510,13 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
||||
.isNull(SarFileSplitInfoEO::getPublishBeforeId), false);
|
||||
if (!Objects.isNull(sarFileSplitInfoEO)){
|
||||
LawsDocumentSplit lawsDocumentSplit = new LawsDocumentSplit();
|
||||
lawsDocumentSplit.setInfoId(sarFileSplitInfoEO.getId());
|
||||
list = documentSplitMapper.selectClauseList(lawsDocumentSplit);
|
||||
|
||||
// 添加标准数据
|
||||
LawsDomesticStandard lawsDomesticStandard = lawsDomesticStandardService.getById(standardId);
|
||||
ProcessStandardInterpretClause processStandardInterpretClause = new ProcessStandardInterpretClause();
|
||||
processStandardInterpretClause.setClauseId(lawsDomesticStandard.getId());
|
||||
processStandardInterpretClause.setItemNum(lawsDomesticStandard.getStandardNumber());
|
||||
processStandardInterpretClause.setItemTitle(lawsDomesticStandard.getStandardName());
|
||||
list.add(0, processStandardInterpretClause);
|
||||
@@ -926,6 +941,7 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
||||
ProcessStandardInterpret processStandardInterpret = data.getProcessStandardInterpret();
|
||||
String standardInterpretId = StringUtils.isBlank(processStandardInterpret.getId()) ?
|
||||
String.valueOf(SnowflakeUtils.snowflake()) : processStandardInterpret.getId();
|
||||
processStandardInterpret.setId(standardInterpretId);
|
||||
// 标准解读流程_条款中间表
|
||||
List<ProcessStandardInterpretClause> processStandardInterpretClauseList =
|
||||
data.getProcessStandardInterpretClauseList();
|
||||
@@ -950,10 +966,6 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
||||
break;
|
||||
// 主控部门联络人分发
|
||||
case StandardInterpretCommon.CONTACT_PERSON_DISTRIBUTE:
|
||||
// 保存主解读人
|
||||
processStandardInterpret.setMasterInterpretId(
|
||||
String.valueOf(map.get(StandardInterpretCommon.MASTER_INTERPRET)));
|
||||
|
||||
processStandardInterpretService.updateById(processStandardInterpret);
|
||||
|
||||
List<String> clauseIdList = processStandardInterpretClauseList.stream()
|
||||
@@ -964,6 +976,9 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
||||
removeQueryWrapper.notIn(ProcessStandardInterpretClause::getId, clauseIdList);
|
||||
removeQueryWrapper.eq(ProcessStandardInterpretClause::getStandardInterpretId, standardInterpretId);
|
||||
processStandardInterpretClauseService.remove(removeQueryWrapper);
|
||||
|
||||
// 标准主解读人
|
||||
map.put(StandardInterpretCommon.MASTER_INTERPRET, processStandardInterpret.getMasterInterpretId());
|
||||
break;
|
||||
// 标准主解读人分发
|
||||
case StandardInterpretCommon.MASTER_INTERPRET_DISTRIBUTE:
|
||||
@@ -999,6 +1014,8 @@ public class StandardInterpretFlowServiceImpl implements StandardInterpretFlowSe
|
||||
map.put(StandardInterpretCommon.UNALLOCATED_QUANTITY, unallocatedQuantity);
|
||||
// 设置子解读人
|
||||
map.put(StandardInterpretCommon.INTERPRETING_PEOPLE, new ArrayList<>(interpretPersonIdList));
|
||||
// 设置主流程实例id
|
||||
map.put(ActivitiCommon.MAIN_INSTANCE_ID, String.valueOf(SnowflakeUtils.snowflake()));
|
||||
processStandardInterpretClauseSublistService.saveBatch(processStandardInterpretClauseSublists);
|
||||
}else {
|
||||
// 保存会签人员、审核人员、批准人员
|
||||
|
||||
+2
@@ -2,11 +2,13 @@ package com.jero.modules.laws.documenttool.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.laws.documenttool.entity.LawsDocumentSplit;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author: yjz
|
||||
* @Date: 2023/10/15/19:32
|
||||
* @Description:
|
||||
*/
|
||||
@Mapper
|
||||
public interface LawsDocumentSplitMapper extends BaseMapper<LawsDocumentSplit> {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user