yangys
2025-08-11 b5b668d2728665ca05d15be8862ceb0a2796fc67
blade-service/blade-mdm/src/main/java/org/springblade/mdm/flow/service/FlowCommonService.java
@@ -3,10 +3,17 @@
import lombok.AllArgsConstructor;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.mdm.flow.constants.FlowContants;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map;
@@ -15,6 +22,7 @@
public class FlowCommonService {
   private final RuntimeService runtimeService;
   private final HistoryService historyService;
   /**
    * 根据流程实例id获取definitionKey
    * @param processInstanceId
@@ -39,6 +47,7 @@
      Map<String, Object> vars = runtimeService.getVariables(processInstanceId);
      programProperties.setTitle(String.valueOf(vars.get(FlowContants.TITLE)));
      programProperties.setDrawingNo(String.valueOf(vars.get(FlowContants.DRAWING_NO)));
      programProperties.setDrawingNoEdition(String.valueOf(vars.get(FlowContants.DRAWING_NO_EDITION)));
      programProperties.setProductModel(String.valueOf(vars.get(FlowContants.PRODUCT_MODEL)));
@@ -47,10 +56,19 @@
      programProperties.setProcessEdition(String.valueOf(vars.get(FlowContants.PROCESS_EDITION)));//工序版次
      programProperties.setProcessName(String.valueOf(vars.get(FlowContants.PROCESS_NAME)));
      programProperties.setMachineCode(String.valueOf(vars.get(FlowContants.MACHINE_CODE)));
      programProperties.setMachineMode(String.valueOf(vars.get(FlowContants.MACHINE_MODE)));
      //数据处理名称为版次以前,零件号加工序号:YZL4-1100-01-50 零组件号:YZL4-1100-01 工序号 50
      programProperties.setCraftEdition(String.valueOf(vars.get(FlowContants.CRAFT_EDITION)));
      programProperties.setHasCuredProgram(String.valueOf(vars.get(FlowContants.HAS_CURED_PROGRAM)));
      programProperties.setIsProcessEditionSame(String.valueOf(vars.get(FlowContants.IS_PROCESS_EDITION_SAME)));
      if(vars.containsKey(FlowContants.DEVIATION)) {
         programProperties.setDeviation(String.valueOf(vars.get(FlowContants.DEVIATION)));
      }
      if(vars.containsKey(FlowContants.CURED_NODE_ID)){
         programProperties.setCuredNodeId(Func.toLong(vars.get(FlowContants.CURED_NODE_ID)));
      }
      ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
         .processInstanceId(processInstanceId)
@@ -84,4 +102,8 @@
      return historicInstance != null && historicInstance.getEndTime() == null;
   }
}