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