Просмотр исходного кода

20220930_sun修正流程扩展

15143018065 2 лет назад
Родитель
Сommit
a9ed732d10

+ 16 - 6
ruoyi-modules/mz-business-djpd/src/main/java/com/ruoyi/business/service/impl/DjpdSqServiceImpl.java

@@ -681,16 +681,26 @@ public class DjpdSqServiceImpl implements IDjpdSqService
         String cityAreaCode = getCityArea();
         ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
                 .orderByProcessDefinitionId().orderByProcessDefinitionVersion().desc();
-        processDefinitionQuery.processDefinitionKey(WorkFlowStatus.DJPD.getCode() + "_" + cityAreaCode);
+        processDefinitionQuery.processDefinitionKey(WorkFlowStatus.DJPD.getCode() + "_" + SecurityUtils.getAreaCode());
         if (processDefinitionQuery.count() > 0) {
             ProcessInstance processInstance = runtimeService
-                    .startProcessInstanceByKey(WorkFlowStatus.DJPD.getCode() + "_" + cityAreaCode, id);
+                    .startProcessInstanceByKey(WorkFlowStatus.DJPD.getCode() + "_" + SecurityUtils.getAreaCode(), id);
             djpdSq.setInstanceId(processInstance.getId());
-            djpdSq.setSqzt(ApplicationStatus.APPLY.getCode());
+            djpdSq.setSqzt(definitionService.getDjpdSqztByInstanceId(processInstance.getId()));
         } else {
-            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(WorkFlowStatus.DJPD.getCode(), id);
-            djpdSq.setInstanceId(processInstance.getId());
-            djpdSq.setSqzt(ApplicationStatus.APPLY.getCode());
+            ProcessDefinitionQuery processDefinitionQueryCity = repositoryService.createProcessDefinitionQuery()
+                    .orderByProcessDefinitionId().orderByProcessDefinitionVersion().desc();
+            processDefinitionQueryCity.processDefinitionKey(WorkFlowStatus.DJPD.getCode() + "_" + cityAreaCode);
+            if (processDefinitionQueryCity.count() > 0) {
+                ProcessInstance processInstance = runtimeService
+                        .startProcessInstanceByKey(WorkFlowStatus.DJPD.getCode() + "_" + cityAreaCode, id);
+                djpdSq.setInstanceId(processInstance.getId());
+                djpdSq.setSqzt(definitionService.getDjpdSqztByInstanceId(processInstance.getId()));
+            } else {
+                ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(WorkFlowStatus.DJPD.getCode(), id);
+                djpdSq.setInstanceId(processInstance.getId());
+                djpdSq.setSqzt(definitionService.getDjpdSqztByInstanceId(processInstance.getId()));
+            }
         }
         return djpdSqMapper.updateById(djpdSq);
     }

+ 3 - 2
ruoyi-modules/mz-system-lcdy/src/main/java/com/ruoyi/system/service/impl/ProcessDefinitionServiceImpl.java

@@ -295,8 +295,9 @@ public class ProcessDefinitionServiceImpl implements IProcessDefinitionService {
     @Override
     public List<ProcessDefinition> getDefinitionsByAreaCode(String code) {
         Map<String,String> map = SubCodeUtil.getSubCode(code);
-        if (ObjectUtils.isEmpty(map) || !StringUtils.equals(map.get("level").toString(), "2")) {
-            throw new ServiceException("请选择地市级别");
+        if (ObjectUtils.isEmpty(map) || (!StringUtils.equals(map.get("level").toString(), "2")
+                && !StringUtils.equals(map.get("level").toString(), "3"))) {
+            throw new ServiceException("请选择地市或区县级别");
         }
         ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
                 .processDefinitionKey(WorkFlowStatus.DJPD.getCode() + "_" + code);