fix(企标流程): 数据存储方式变更

This commit is contained in:
yjz
2024-01-03 13:54:25 +08:00
parent 3856a58bf5
commit 547f31cb6f
10 changed files with 97 additions and 67 deletions
@@ -136,11 +136,6 @@ public class EsDeclareFlowServiceImpl implements IEsDeclareFlowService {
// 自动完成第一个节点 // 自动完成第一个节点
taskService.complete(task.getId()); taskService.complete(task.getId());
// 删除草稿
processDraftService.remove(new LambdaQueryWrapper<ProcessDraft>()
.eq(ProcessDraft::getProjectId, processAll.getProjectId())
.eq(ProcessDraft::getUserId, loginUser.getId()));
// 发起即结束 // 发起即结束
ProcessEsDeclare processEsDeclare = processEsDeclareService.queryByProjectId(processAll.getProjectId()); ProcessEsDeclare processEsDeclare = processEsDeclareService.queryByProjectId(processAll.getProjectId());
// 保存数据至企标宣贯 // 保存数据至企标宣贯
@@ -158,9 +158,16 @@ public class EsInspectFlowServiceImpl implements IEsInspectFlowService {
private void handleBusinessData(EsInspectFlowVO esInspectFlowVO) { private void handleBusinessData(EsInspectFlowVO esInspectFlowVO) {
List<ProcessEsInspect> processEsInspectList = esInspectFlowVO.getProcessEsInspectList(); List<ProcessEsInspect> processEsInspectList = esInspectFlowVO.getProcessEsInspectList();
// 删除数据
if (StringUtils.isNotBlank(esInspectFlowVO.getProcessAllDelIds())){
List<String> idList = Arrays.asList(esInspectFlowVO.getProcessAllDelIds().split(","));
processEsInspectService.removeByIds(idList);
enterpriseStandardInspectContentService.removeByIds(idList);
enterpriseStandardInspectReportService.removeByIds(idList);
enterpriseStandardInspectRectifyPlanService.removeByIds(idList);
}
ProcessAll processAll = esInspectFlowVO.getProcessAll(); ProcessAll processAll = esInspectFlowVO.getProcessAll();
String projectId = processAll.getProjectId(); String projectId = processAll.getProjectId();
processEsInspectList.stream().map(v -> { processEsInspectList.stream().map(v -> {
if (StringUtils.isBlank(v.getId())){ if (StringUtils.isBlank(v.getId())){
v.setId(String.valueOf(SnowflakeUtils.snowflake())); v.setId(String.valueOf(SnowflakeUtils.snowflake()));
@@ -175,49 +182,37 @@ public class EsInspectFlowServiceImpl implements IEsInspectFlowService {
for (ProcessEsInspect processEsInspect : processEsInspectList) { for (ProcessEsInspect processEsInspect : processEsInspectList) {
// 处理稽查内容 // 处理稽查内容
if (EsInspectCommon.PROCESS_NODE_1.equals(processAll.getNodeId())){ if (EsInspectCommon.PROCESS_NODE_1.equals(processAll.getNodeId())){
// 清除旧稽查内容
enterpriseStandardInspectContentService.remove(
new LambdaQueryWrapper<EnterpriseStandardInspectContent>()
.eq(EnterpriseStandardInspectContent::getProcessEsInspectId, processEsInspect.getId()));
// 添加新稽查内容 // 添加新稽查内容
List<EnterpriseStandardInspectContent> enterpriseStandardInspectContentList = processEsInspect.getEnterpriseStandardInspectContentList(); List<EnterpriseStandardInspectContent> enterpriseStandardInspectContentList = processEsInspect.getEnterpriseStandardInspectContentList();
enterpriseStandardInspectContentList = enterpriseStandardInspectContentList.stream().filter(v -> StringUtils.isBlank(v.getId())).collect(Collectors.toList());
for (EnterpriseStandardInspectContent enterpriseStandardInspectContent : enterpriseStandardInspectContentList) { for (EnterpriseStandardInspectContent enterpriseStandardInspectContent : enterpriseStandardInspectContentList) {
if (StringUtils.isBlank(enterpriseStandardInspectContent.getId())){ enterpriseStandardInspectContent.setId(String.valueOf(SnowflakeUtils.snowflake()));
enterpriseStandardInspectContent.setId(String.valueOf(SnowflakeUtils.snowflake()));
}
enterpriseStandardInspectContent.setProcessEsInspectId(processEsInspect.getId()); enterpriseStandardInspectContent.setProcessEsInspectId(processEsInspect.getId());
} }
enterpriseStandardInspectContentService.saveOrUpdateBatch(enterpriseStandardInspectContentList); enterpriseStandardInspectContentService.saveOrUpdateBatch(enterpriseStandardInspectContentList);
} }
// 处理稽查报告 和 整改计划 // 处理稽查报告 和 整改计划
if (EsInspectCommon.PROCESS_NODE_3.equals(processAll.getNodeId())){ handleReportAndRectifyPlan(processAll, processEsInspect);
// 清除旧稽查报告 }
enterpriseStandardInspectReportService.remove( }
new LambdaQueryWrapper<EnterpriseStandardInspectReport>()
.eq(EnterpriseStandardInspectReport::getProcessEsInspectId, processEsInspect.getId()));
// 添加新稽查报告
List<EnterpriseStandardInspectReport> enterpriseStandardInspectReportList = processEsInspect.getEnterpriseStandardInspectReportList();
for (EnterpriseStandardInspectReport enterpriseStandardInspectReport : enterpriseStandardInspectReportList) {
if (StringUtils.isBlank(enterpriseStandardInspectReport.getId())){
enterpriseStandardInspectReport.setId(String.valueOf(SnowflakeUtils.snowflake()));
}
enterpriseStandardInspectReport.setInspectId(processEsInspect.getId());
}
enterpriseStandardInspectReportService.saveOrUpdateBatch(enterpriseStandardInspectReportList);
// 清除旧整改计划 private void handleReportAndRectifyPlan(ProcessAll processAll, ProcessEsInspect processEsInspect) {
enterpriseStandardInspectRectifyPlanService.remove( if (EsInspectCommon.PROCESS_NODE_3.equals(processAll.getNodeId())){
new LambdaQueryWrapper<EnterpriseStandardInspectRectifyPlan>() // 添加新稽查报告
.eq(EnterpriseStandardInspectRectifyPlan::getProcessEsInspectId, processEsInspect.getId())); List<EnterpriseStandardInspectReport> enterpriseStandardInspectReportList = processEsInspect.getEnterpriseStandardInspectReportList();
// 添加新整改计划 enterpriseStandardInspectReportList = enterpriseStandardInspectReportList.stream().filter(v -> StringUtils.isBlank(v.getId())).collect(Collectors.toList());
List<EnterpriseStandardInspectRectifyPlan> enterpriseStandardInspectRectifyPlanList = processEsInspect.getEnterpriseStandardInspectRectifyPlanList(); for (EnterpriseStandardInspectReport enterpriseStandardInspectReport : enterpriseStandardInspectReportList) {
for (EnterpriseStandardInspectRectifyPlan enterpriseStandardInspectRectifyPlan : enterpriseStandardInspectRectifyPlanList) { enterpriseStandardInspectReport.setId(String.valueOf(SnowflakeUtils.snowflake()));
if (StringUtils.isBlank(enterpriseStandardInspectRectifyPlan.getId())){ enterpriseStandardInspectReport.setInspectId(processEsInspect.getId());
enterpriseStandardInspectRectifyPlan.setId(String.valueOf(SnowflakeUtils.snowflake())); }
} enterpriseStandardInspectReportService.saveOrUpdateBatch(enterpriseStandardInspectReportList);
enterpriseStandardInspectRectifyPlan.setInspectId(processEsInspect.getId());
} // 添加新整改计划
List<EnterpriseStandardInspectRectifyPlan> enterpriseStandardInspectRectifyPlanList = processEsInspect.getEnterpriseStandardInspectRectifyPlanList();
enterpriseStandardInspectRectifyPlanList = enterpriseStandardInspectRectifyPlanList.stream().filter(v -> StringUtils.isBlank(v.getId())).collect(Collectors.toList());
for (EnterpriseStandardInspectRectifyPlan enterpriseStandardInspectRectifyPlan : enterpriseStandardInspectRectifyPlanList) {
enterpriseStandardInspectRectifyPlan.setId(String.valueOf(SnowflakeUtils.snowflake()));
enterpriseStandardInspectRectifyPlan.setInspectId(processEsInspect.getId());
} }
} }
} }
@@ -226,7 +221,7 @@ public class EsInspectFlowServiceImpl implements IEsInspectFlowService {
List<ProcessEsInspect> list = processEsInspectService.list( List<ProcessEsInspect> list = processEsInspectService.list(
new LambdaQueryWrapper<ProcessEsInspect>() new LambdaQueryWrapper<ProcessEsInspect>()
.in(ProcessEsInspect::getId, processEsInspectList.stream().map(ProcessEsInspect::getId).collect(Collectors.toList()))); .in(ProcessEsInspect::getId, processEsInspectList.stream().map(ProcessEsInspect::getId).collect(Collectors.toList())));
if (list.size() > 0){ if (!list.isEmpty()){
List<EnterpriseStandardInspect> enterpriseStandardInspectList = enterpriseStandardInspectService.listByIds(list.stream().map(ProcessEsInspect::getInspectId).collect(Collectors.toList())); List<EnterpriseStandardInspect> enterpriseStandardInspectList = enterpriseStandardInspectService.listByIds(list.stream().map(ProcessEsInspect::getInspectId).collect(Collectors.toList()));
String inspectNos = enterpriseStandardInspectList.stream().map(EnterpriseStandardInspect::getInspectNo).collect(Collectors.joining(",")); String inspectNos = enterpriseStandardInspectList.stream().map(EnterpriseStandardInspect::getInspectNo).collect(Collectors.joining(","));
throw new JeroBootException("稽查依据标准编号为:" + inspectNos + "的稽查已发起过企标稽查流程,请勿重复选择!"); throw new JeroBootException("稽查依据标准编号为:" + inspectNos + "的稽查已发起过企标稽查流程,请勿重复选择!");
@@ -33,4 +33,9 @@ public class EsInspectFlowVO {
/**草稿信息json字符串*/ /**草稿信息json字符串*/
@ApiModelProperty(value = "草稿信息json字符串") @ApiModelProperty(value = "草稿信息json字符串")
private String infoJsonStr; private String infoJsonStr;
/**
* 流程全局删除ids
*/
@ApiModelProperty(value="流程全局删除ids")
private String processAllDelIds;
} }
@@ -117,16 +117,33 @@ public class EsInspectDelayApplyFlowServiceImpl implements IEsInspectDelayApplyF
new LambdaUpdateWrapper<ProcessApprovalRecord>() new LambdaUpdateWrapper<ProcessApprovalRecord>()
.eq(ProcessApprovalRecord::getTaskId, task.getId())); .eq(ProcessApprovalRecord::getTaskId, task.getId()));
// 处理业务表数据
handleBusinessData(esInspectDelayApplyFlowVO);
// 新增流程实例节点关联用户表 // 新增流程实例节点关联用户表
processNodeLinkService.saveNodeUserLink(processInstance.getProcessDefinitionId(), processInstance.getId(), listToString(map)); processNodeLinkService.saveNodeUserLink(processInstance.getProcessDefinitionId(), processInstance.getId(), listToString(map));
// 自动完成第一个节点 // 自动完成第一个节点
taskService.complete(task.getId()); taskService.complete(task.getId());
}
// 删除草稿 private void handleBusinessData(EsInspectDelayApplyFlowVO esInspectDelayApplyFlowVO) {
processDraftService.remove(new LambdaQueryWrapper<ProcessDraft>() List<ProcessEsInspectDelayApply> processEsInspectDelayApplyList = esInspectDelayApplyFlowVO.getProcessEsInspectDelayApplyList();
.eq(ProcessDraft::getProjectId, processAll.getProjectId()) // 删除数据
.eq(ProcessDraft::getUserId, loginUser.getId())); if (StringUtils.isNotBlank(esInspectDelayApplyFlowVO.getProcessAllDelIds())){
List<String> idList = Arrays.asList(esInspectDelayApplyFlowVO.getProcessAllDelIds().split(","));
processEsInspectDelayApplyService.removeByIds(idList);
}
ProcessAll processAll = esInspectDelayApplyFlowVO.getProcessAll();
String projectId = processAll.getProjectId();
processEsInspectDelayApplyList.stream().map(v -> {
if (StringUtils.isBlank(v.getId())){
v.setId(String.valueOf(SnowflakeUtils.snowflake()));
}
v.setProjectId(projectId);
return v;
}).collect(Collectors.toList()).forEach(v -> log.info(v.toString()));
processEsInspectDelayApplyService.saveOrUpdateBatch(processEsInspectDelayApplyList);
} }
private Map<String, Object> listToString(Map<String, Object> map) { private Map<String, Object> listToString(Map<String, Object> map) {
@@ -183,6 +200,8 @@ public class EsInspectDelayApplyFlowServiceImpl implements IEsInspectDelayApplyF
.eq(ProcessDraft::getUserId, loginUser.getId())); .eq(ProcessDraft::getUserId, loginUser.getId()));
// 保存新草稿 // 保存新草稿
processDraftService.save(processDraft); processDraftService.save(processDraft);
// 处理业务表数据
handleBusinessData(esInspectDelayApplyFlowVO);
} }
@Override @Override
@@ -264,6 +283,8 @@ public class EsInspectDelayApplyFlowServiceImpl implements IEsInspectDelayApplyF
if (task!= null) { if (task!= null) {
// 完成任务 // 完成任务
taskService.complete(task.getId(), map); taskService.complete(task.getId(), map);
// 处理业务表数据
handleBusinessData(esInspectDelayApplyFlowVO);
// 再次更新流程审批信息 // 再次更新流程审批信息
processApprovalRecordService.update(new LambdaUpdateWrapper<ProcessApprovalRecord>() processApprovalRecordService.update(new LambdaUpdateWrapper<ProcessApprovalRecord>()
.eq(ProcessApprovalRecord::getUserId, loginUser.getId()) .eq(ProcessApprovalRecord::getUserId, loginUser.getId())
@@ -33,4 +33,9 @@ public class EsInspectDelayApplyFlowVO {
/**草稿信息json字符串*/ /**草稿信息json字符串*/
@ApiModelProperty(value = "草稿信息json字符串") @ApiModelProperty(value = "草稿信息json字符串")
private String infoJsonStr; private String infoJsonStr;
/**
* 流程全局删除ids
*/
@ApiModelProperty(value="流程全局删除ids")
private String processAllDelIds;
} }
@@ -153,6 +153,12 @@ public class EsInspectPlanFlowServiceImpl implements IEsInspectPlanFlowService {
private void handleBusinessData(EsInspectPlanFlowVO esInspectPlanFlowVO) { private void handleBusinessData(EsInspectPlanFlowVO esInspectPlanFlowVO) {
List<ProcessEsInspectPlan> processEsInspectPlanList = esInspectPlanFlowVO.getProcessEsInspectPlanList(); List<ProcessEsInspectPlan> processEsInspectPlanList = esInspectPlanFlowVO.getProcessEsInspectPlanList();
// 删除数据
if (StringUtils.isNotBlank(esInspectPlanFlowVO.getProcessAllDelIds())){
List<String> idList = Arrays.asList(esInspectPlanFlowVO.getProcessAllDelIds().split(","));
processEsInspectPlanService.removeByIds(idList);
processEsInspectPlanOpinionService.removeByIds(idList);
}
ProcessAll processAll = esInspectPlanFlowVO.getProcessAll(); ProcessAll processAll = esInspectPlanFlowVO.getProcessAll();
String projectId = processAll.getProjectId(); String projectId = processAll.getProjectId();
processEsInspectPlanList.stream().map(v -> { processEsInspectPlanList.stream().map(v -> {
@@ -179,7 +185,6 @@ public class EsInspectPlanFlowServiceImpl implements IEsInspectPlanFlowService {
// 保存意见 // 保存意见
processEsInspectPlanOpinionService.saveOrUpdateBatch(processEsInspectPlanOpinions); processEsInspectPlanOpinionService.saveOrUpdateBatch(processEsInspectPlanOpinions);
} }
} }
@@ -51,4 +51,10 @@ public class EsInspectPlanFlowVO {
*/ */
@ApiModelProperty(value="会签人员 翻译") @ApiModelProperty(value="会签人员 翻译")
private String countersignDictText; private String countersignDictText;
/**
* 流程全局删除ids
*/
@ApiModelProperty(value="流程全局删除ids")
private String processAllDelIds;
} }
@@ -121,6 +121,11 @@ public class EsInspectRectifyFlowServiceImpl implements IEsInspectRectifyFlowSer
processNodeLinkService.saveNodeUserLink(processInstance.getProcessDefinitionId(), processInstance.getId(), listToString(map)); processNodeLinkService.saveNodeUserLink(processInstance.getProcessDefinitionId(), processInstance.getId(), listToString(map));
} }
private void handleBusinessData(EsInspectRectifyFlowVO esInspectReportFlowVO) {
ProcessEsInspectRectify processEsInspectRectify = esInspectReportFlowVO.getProcessEsInspectRectify();
processEsInspectRectifyService.saveOrUpdate(processEsInspectRectify);
}
@Override @Override
public void flowSave(EsInspectRectifyFlowVO esInspectReportFlowVO) { public void flowSave(EsInspectRectifyFlowVO esInspectReportFlowVO) {
// 流程信息 // 流程信息
@@ -164,9 +169,8 @@ public class EsInspectRectifyFlowServiceImpl implements IEsInspectRectifyFlowSer
// 保存新草稿 // 保存新草稿
processDraftService.save(processDraft); processDraftService.save(processDraft);
// 保存业务表信息 // 处理业务表数据
ProcessEsInspectRectify processEsInspectReport = esInspectReportFlowVO.getProcessEsInspectRectify(); handleBusinessData(esInspectReportFlowVO);
processEsInspectRectifyService.updateById(processEsInspectReport);
} }
@Override @Override
@@ -244,9 +248,8 @@ public class EsInspectRectifyFlowServiceImpl implements IEsInspectRectifyFlowSer
.set(ProcessNodeLink::getUserId, userInfo.getLinkUserIds())); .set(ProcessNodeLink::getUserId, userInfo.getLinkUserIds()));
} }
// 保存业务表信息 // 处理业务表数据
ProcessEsInspectRectify processEsInspectReport = esInspectReportFlowVO.getProcessEsInspectRectify(); handleBusinessData(esInspectReportFlowVO);
processEsInspectRectifyService.updateById(processEsInspectReport);
// 更新流程审批信息 // 更新流程审批信息
processApprovalRecordService.update( processApprovalRecordService.update(
@@ -86,9 +86,8 @@ public class EsPermissionApplyFlowServiceImpl implements EsPermissionApplyFlowSe
// 再次设置map // 再次设置map
runtimeService.setVariables(processInstance.getId(), map); runtimeService.setVariables(processInstance.getId(), map);
// 保存业务数据 // 处理业务表数据
ProcessEsPermissionApply processEsPermissionApply = esPermissionApplyFlowVO.getProcessEsPermissionApply(); handleBusinessData(esPermissionApplyFlowVO);
processEsPermissionApplyService.saveOrUpdate(processEsPermissionApply);
// 更新流程总表信息 // 更新流程总表信息
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@@ -117,11 +116,11 @@ public class EsPermissionApplyFlowServiceImpl implements EsPermissionApplyFlowSe
// 自动完成第一个节点 // 自动完成第一个节点
taskService.complete(task.getId()); taskService.complete(task.getId());
}
// 删除草稿 private void handleBusinessData(EsPermissionApplyFlowVO esPermissionApplyFlowVO) {
processDraftService.remove(new LambdaQueryWrapper<ProcessDraft>() ProcessEsPermissionApply processEsPermissionApply = esPermissionApplyFlowVO.getProcessEsPermissionApply();
.eq(ProcessDraft::getProjectId, processAll.getProjectId()) processEsPermissionApplyService.saveOrUpdate(processEsPermissionApply);
.eq(ProcessDraft::getUserId, loginUser.getId()));
} }
private Map<String, Object> listToString(Map<String, Object> map) { private Map<String, Object> listToString(Map<String, Object> map) {
@@ -179,9 +178,8 @@ public class EsPermissionApplyFlowServiceImpl implements EsPermissionApplyFlowSe
// 保存新草稿 // 保存新草稿
processDraftService.save(processDraft); processDraftService.save(processDraft);
// 保存业务数据 // 处理业务表数据
ProcessEsPermissionApply processEsPermissionApply = esPermissionApplyFlowVO.getProcessEsPermissionApply(); handleBusinessData(esPermissionApplyFlowVO);
processEsPermissionApplyService.saveOrUpdate(processEsPermissionApply);
} }
@Override @Override
@@ -263,6 +261,8 @@ public class EsPermissionApplyFlowServiceImpl implements EsPermissionApplyFlowSe
if (task!= null) { if (task!= null) {
// 完成任务 // 完成任务
taskService.complete(task.getId(), map); taskService.complete(task.getId(), map);
// 处理业务表数据
handleBusinessData(esPermissionApplyFlowVO);
// 再次更新流程审批信息 // 再次更新流程审批信息
processApprovalRecordService.update(new LambdaUpdateWrapper<ProcessApprovalRecord>() processApprovalRecordService.update(new LambdaUpdateWrapper<ProcessApprovalRecord>()
.eq(ProcessApprovalRecord::getUserId, loginUser.getId()) .eq(ProcessApprovalRecord::getUserId, loginUser.getId())
@@ -132,11 +132,6 @@ public class MeetingManageFlowServiceImpl implements IMeetingManageFlowService {
// 自动完成第一个节点 // 自动完成第一个节点
taskService.complete(task.getId()); taskService.complete(task.getId());
// 删除草稿
processDraftService.remove(new LambdaQueryWrapper<ProcessDraft>()
.eq(ProcessDraft::getProjectId, processAll.getProjectId())
.eq(ProcessDraft::getUserId, loginUser.getId()));
} }
@Override @Override