From a638cb450abb78346ecf19754b639fc945bc486b Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期日, 10 八月 2025 19:21:16 +0800
Subject: [PATCH] zip包判断修复
---
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/ReplaceFlowService.java | 73 ++++++++++++++++++++++++++----------
1 files changed, 53 insertions(+), 20 deletions(-)
diff --git a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/ReplaceFlowService.java b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/ReplaceFlowService.java
index c1d1eef..204c196 100644
--- a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/ReplaceFlowService.java
+++ b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/ReplaceFlowService.java
@@ -18,11 +18,14 @@
import org.springblade.mdm.flow.vo.TaskAssignVO;
import org.springblade.mdm.program.entity.NcNode;
import org.springblade.mdm.program.service.NcNodeService;
+import org.springblade.mdm.program.service.NodeDeptQueryService;
+import org.springblade.mdm.program.vo.NcNodeVO;
import org.springblade.mdm.utils.EntityUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -37,15 +40,16 @@
private final IdentityService identityService;
private final FlowProgramFileService flowProgramFileService;
private final ReplaceProgramFileService replaceProgramFileService;
- private final MachineService machineService;
+ private final NodeDeptQueryService nodeDeptQueryService;
public static final String NODE_ID = "nodeId";
/**
* 杞淳锛屽苟璁板綍鑷繁鐨勫娉ㄤ俊鎭�
* @param nodeId 鏇挎崲鐨勮妭鐐筰d
*/
+ /*
@Transactional
- public void pre(long nodeId,String tempInstanceId) {
+ public void prestart(long nodeId,String tempInstanceId) {
List<NcNode> fileNodes = nodeService.lambdaQuery()
.eq(NcNode::getParentId, nodeId)
.eq(NcNode::getIsLastEdition,1)
@@ -58,21 +62,48 @@
//灏嗙幇鏈夋枃浠跺鍒跺埌鐙珛鐨勮〃涓紝鍚庣画浣滀负瀹℃壒鐨勬枃浠讹紝瀹℃壒鐣岄潰璋冪敤鐨勬帴鍙d篃涓嶅悓锛屾渶濂藉崟鐙紑鍙�
for(FlowProgramFile programFile : programFiles) {
- /*
- ReplaceProgramFile replaceProgramFile = new ReplaceProgramFile();
- BeanUtils.copyProperties(programFile, replaceProgramFile);
- EntityUtil.clearBaseProperties(replaceProgramFile);
- replaceProgramFile.setTempId(tempId);
-
- replaceProgramFileService.save(replaceProgramFile);
-
- */
FlowProgramFile newFile = new FlowProgramFile();
BeanUtils.copyProperties(programFile, newFile);
EntityUtil.clearBaseProperties(newFile);
newFile.setProcessInstanceId(tempInstanceId);
flowProgramFileService.save(newFile);
}
+ }
+
+ */
+
+ @Transactional
+ public NcNodeVO pre(long nodeId, String tempInstanceId) {
+
+ List<NcNode> fileNodes = nodeService.lambdaQuery()
+ .eq(NcNode::getParentId, nodeId)
+ .eq(NcNode::getIsLastEdition,1)
+ .eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_FILE).list();
+ List<Long> fileIds = fileNodes.stream().map(NcNode::getFlowProgramFileId).toList();
+ if(fileIds.isEmpty()){
+ throw new RuntimeException("鏈壘鍒扮▼搴忔枃浠�");
+ }
+ List<FlowProgramFile> programFiles = flowProgramFileService.lambdaQuery()
+ .in(FlowProgramFile::getId, fileIds).list();
+
+
+ //灏嗙幇鏈夋枃浠跺鍒跺埌鐙珛鐨勮〃涓紝鍚庣画浣滀负瀹℃壒鐨勬枃浠讹紝瀹℃壒鐣岄潰璋冪敤鐨勬帴鍙d篃涓嶅悓锛屾渶濂藉崟鐙紑鍙�
+ for(FlowProgramFile programFile : programFiles) {
+ FlowProgramFile newFile = new FlowProgramFile();
+ BeanUtils.copyProperties(programFile, newFile);
+ EntityUtil.clearBaseProperties(newFile);
+ newFile.setProcessInstanceId(tempInstanceId);
+ flowProgramFileService.save(newFile);
+ }
+
+ NcNode node = nodeService.getById(nodeId);
+ NcNodeVO vo = new NcNodeVO();
+ BeanUtils.copyProperties(node, vo);
+ vo.setProcessInstanceId(tempInstanceId);
+
+ vo.setWorkshop(nodeDeptQueryService.getWorkshopNameByMachineCode(node.getMachineCode()));
+
+ return vo;
}
/**
@@ -85,23 +116,25 @@
vars.put(FlowContants.ASSIGNEE,startVO.getAssignee());//绗竴涓鎵圭敤鎴�
vars.put(FlowContants.TITLE,startVO.getTitle());
- NcNode programPackge = nodeService.getById(startVO.getNodeId());
+ NcNode programPackage = nodeService.getById(startVO.getNodeId());
//鏈哄簥缂栧彿
- vars.put(FlowContants.MACHINE_CODE,programPackge.getMachineCode());
+ vars.put(FlowContants.MACHINE_CODE,programPackage.getMachineCode());
//Machine machine = machineService.getByCode(programPackge.getMachineCode());
//鏈哄簥鍨嬪彿
//if(machine != null) {
//vars.put(FlowContants.MACHINE_MODE, programPackge.getMachineMode());
//}
- vars.put(FlowContants.PROCESS_NO,programPackge.getProcessNo());
- vars.put(FlowContants.PROCESS_NAME,programPackge.getProcessName());
- vars.put(FlowContants.PROCESS_EDITION,programPackge.getProcessEdition());
- vars.put(FlowContants.CRAFT_EDITION,programPackge.getCraftEdition());
+ vars.put(FlowContants.PROCESS_NO,programPackage.getProcessNo());
+ vars.put(FlowContants.PROCESS_NAME,programPackage.getProcessName());
+ vars.put(FlowContants.PROCESS_EDITION,programPackage.getProcessEdition());
+ vars.put(FlowContants.CRAFT_EDITION,programPackage.getCraftEdition());
- vars.put(FlowContants.DRAWING_NO,programPackge.getDrawingNo());
- vars.put(FlowContants.DRAWING_NO_EDITION,programPackge.getDrawingNoEdition());
+ vars.put(FlowContants.DRAWING_NO,programPackage.getDrawingNo());
+ vars.put(FlowContants.DRAWING_NO_EDITION,programPackage.getDrawingNoEdition());
- vars.put(FlowContants.PRODUCT_MODEL,programPackge.getProductModel());
+ vars.put(FlowContants.PROGRAM_PACKAGE_NAME,programPackage.getName());
+
+ vars.put(FlowContants.PRODUCT_MODEL,programPackage.getProductModel());
vars.put(NODE_ID, startVO.getNodeId());
identityService.setAuthenticatedUserId(String.valueOf(AuthUtil.getUserId()));//璁剧疆娴佺▼鍙戣捣浜�
ProcessInstance inst = runtimeService.startProcessInstanceByKey(FlowContants.REPLACE_PROCESS_KEY,startVO.getNodeId()+"",vars);
--
Gitblit v1.9.3