Przeglądaj źródła

拼接组织业务编码

chenendian 1 miesiąc temu
rodzic
commit
1779a3085b

+ 2 - 2
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/enums/ProjectType.java

@@ -11,10 +11,10 @@ public enum ProjectType {
     private final String name;
     private final String code;
 
-    ProjectType(String code, String info)
+    ProjectType(String code, String name)
     {
         this.code = code;
-        this.name = info;
+        this.name = name;
     }
 
     public String getCode()

+ 46 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/enums/RegistrationProcessType.java

@@ -0,0 +1,46 @@
+package com.siwei.apply.enums;
+
+
+/**
+ * 审批环节类型
+ */
+public enum RegistrationProcessType {
+    Registration01(1,"01", "用地预审与选址","t_ydysyxz"),
+    Registration02(2,"02", "规划条件与用地红线出具","t_tjyydhx"),
+    Registration03(3,"03", "用地报批","t_ydbp"),
+    Registration04(4,"04", "土地供应","t_tdgy"),
+    Registration05A(5,"05", "建设用地规划许可","t_jsydghxk"),
+    Registration05B(6,"05", "建设工程规划许可","t_jsgcghxk"),
+    Registration06(7,"06", "土地核验与规划核实","t_tdhyhs"),
+    Registration00(8,"00", "全部办结","");
+
+    private final Integer index;
+    private final String name;
+    private final String code;
+    private final String table;
+
+    RegistrationProcessType(Integer index,String code, String name,String table) {
+        this.index = index;
+        this.code = code;
+        this.name = name;
+        this.table = table;
+    }
+
+    public String getCode()
+    {
+        return code;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public String getTable() {
+        return table;
+    }
+    public Integer getIndex() {
+        return index;
+    }
+
+}

+ 144 - 18
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/LandOneCodeServiceImpl.java

@@ -1,19 +1,21 @@
 package com.siwei.apply.service.impl;
 
-import com.siwei.apply.domain.LandOneCode;
-import com.siwei.apply.domain.ProjectWorkflow;
+import com.siwei.apply.domain.*;
 import com.siwei.apply.domain.res.ProjectCycleRes;
 import com.siwei.apply.enums.ProjectType;
-import com.siwei.apply.mapper.LandOneCodeMapper;
-import com.siwei.apply.mapper.ProjectWorkflowMapper;
-import com.siwei.apply.mapper.WorkflowMapper;
+import com.siwei.apply.enums.RegistrationProcessType;
+import com.siwei.apply.mapper.*;
 import com.siwei.apply.service.LandOneCodeService;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @Service
@@ -29,6 +31,16 @@ public class LandOneCodeServiceImpl implements LandOneCodeService {
     @Autowired
     private WorkflowMapper workflowMapper;
 
+    @Autowired
+    private TdgyMapper tdgyMapper;
+
+    @Autowired
+    private YdbpMapper ydbpMapper;
+
+    @Autowired
+    private YdysyxzMapper ydysyxzMapper;
+
+
 
 
     @Override
@@ -66,8 +78,8 @@ public class LandOneCodeServiceImpl implements LandOneCodeService {
     @Override
     public String getBusinessCode(String projectWorkflowId, Integer projectType) {
         ProjectWorkflow  projectWorkflow= projectWorkflowMapper.selectById(projectWorkflowId);
-        projectWorkflow.getProjectId();
-        projectWorkflow.getNodeId();
+        String projectId = projectWorkflow.getProjectId();
+        String nodeId = projectWorkflow.getNodeId();
 
         String nodeTableName = projectWorkflow.getNodeTableName();
         // 获取不同类型的流程
@@ -77,29 +89,143 @@ public class LandOneCodeServiceImpl implements LandOneCodeService {
 
         // 过滤出小于等于当前节点的所有节点
         workflows = workflows.stream().filter(s->s.getIndex()<=index).collect(Collectors.toList());
-        String tmpCode = "#";
         String returnCode = "";
+        String replaceCode = "#";
+
+        String talbeName0 = "t_ydysyxz"; //用地预审与选址
+        String talbeName1 = "t_ydbp"; //用地报批
+        String talbeName2 = "t_tdgy";//土地供应
+
+        String talbeName3 = "t_gyjsydscdj";//国有建设用地使用权首次登记
+        String talbeName4 = "t_gyjsydjfwscdj";//国有建设用地使用权及房屋所有权首次登记
 
-        //取征转状态
-        workflows.stream().anyMatch(s->s.getTableName().equalsIgnoreCase(nodeTableName));
+        String talbeName5 = "t_jsydghxk";//建设用地规划许可
+        String talbeName6 = "t_jsgcghxk";//建设工程规划许可
+
+        String levyStatusCode = replaceCode;
+        String landSupplyModeCode = replaceCode;
+        String approvalProcessCode = replaceCode;
+        String registrationProcessCode = replaceCode;
+        String licenseStagesCode = replaceCode;
 
         //单独选址
         if(ProjectType.ALONE.equals(projectType)){
+            Tdgy globalTdgy = null; //土地供应对象
+            //取征转状态
+            //优先获取土地供应的值
+            if(workflows.stream().anyMatch(s->s.getTableName().equalsIgnoreCase(talbeName2))){
+                Tdgy tdgy = tdgyMapper.getById(nodeId);
+                globalTdgy = tdgy;
+                if(StringUtils.isNoneBlank(tdgy.getHasZz())){
+                    levyStatusCode =  "是".equalsIgnoreCase(tdgy.getHasZz()) ? "1": "否".equalsIgnoreCase(tdgy.getHasZz()) ? "0": "";
+                }
+             //其次获取用地报批的值
+            } else if(workflows.stream().anyMatch(s->s.getTableName().equalsIgnoreCase(talbeName1))){
+                Ydbp ydbp = ydbpMapper.getById(nodeId);
+                if(StringUtils.isNoneBlank(ydbp.getHasZz())){
+                    levyStatusCode =  "是".equalsIgnoreCase(ydbp.getHasZz()) ? "1": "否".equalsIgnoreCase(ydbp.getHasZz()) ? "0": "";
+                }
+            }else if(workflows.stream().anyMatch(s->s.getTableName().equalsIgnoreCase(talbeName0))){
+                Ydysyxz ydysyxz = ydysyxzMapper.getById(nodeId);
+                if(StringUtils.isNoneBlank(ydysyxz.getHasZz())){
+                    levyStatusCode =  "是".equalsIgnoreCase(ydysyxz.getHasZz()) ? "1": "否".equalsIgnoreCase(ydysyxz.getHasZz()) ? "0": "";
+                }
+            }
+
+            //获取土地供应方式
+            if(Objects.nonNull(globalTdgy) && StringUtils.isNoneBlank(globalTdgy.getGdType())){
+                if("划拨".equalsIgnoreCase(globalTdgy.getGdType())){
+                    landSupplyModeCode = "H";
+                } else if  ("出让".equalsIgnoreCase(globalTdgy.getGdType())) {
+                    landSupplyModeCode = "C";
+                }
+            }
+
+            //获取审批环节代码
+            List<String>  currentNodeTableList = workflows.stream().map(s->s.getTableName()).collect(Collectors.toList());
+            RegistrationProcessType[] values = RegistrationProcessType.values();
+            List<RegistrationProcessType>  reversedValues = Arrays.stream(values).sequential().sorted(Comparator.comparing(RegistrationProcessType::getIndex).reversed()).collect(Collectors.toList());
+            for(RegistrationProcessType registrationProcess : reversedValues){
+                if(currentNodeTableList.contains(registrationProcess.getTable())){
+                    approvalProcessCode = registrationProcess.getCode();
+                    break;
+                }
+            }
+
+            //获取登记环节编码
+            if(currentNodeTableList.contains(talbeName4)){
+                registrationProcessCode = "2";
+            } else if(currentNodeTableList.contains(talbeName3)){
+                registrationProcessCode = "1";
+            }
+
+            //许可分期编码
+            if(currentNodeTableList.contains(talbeName6)){
+                licenseStagesCode = "2";
+            } else if(currentNodeTableList.contains(talbeName5)){
+                licenseStagesCode = "1";
+            }
+        }else if(ProjectType.BATCH.equals(projectType)){
+            Tdgy globalTdgy = null; //土地供应对象
+            //取征转状态
+            //优先获取土地供应的值
+            if(workflows.stream().anyMatch(s->s.getTableName().equalsIgnoreCase(talbeName2))){
+                Tdgy tdgy = tdgyMapper.getById(nodeId);
+                globalTdgy = tdgy;
+                if(StringUtils.isNoneBlank(tdgy.getHasZz())){
+                    levyStatusCode =  "是".equalsIgnoreCase(tdgy.getHasZz()) ? "1": "否".equalsIgnoreCase(tdgy.getHasZz()) ? "0": "";
+                }
+            }
+
+            //获取土地供应方式
+            if(Objects.nonNull(globalTdgy) && StringUtils.isNoneBlank(globalTdgy.getGdType())){
+                if("划拨".equalsIgnoreCase(globalTdgy.getGdType())){
+                    landSupplyModeCode = "H";
+                } else if  ("出让".equalsIgnoreCase(globalTdgy.getGdType())) {
+                    landSupplyModeCode = "C";
+                }
+            }
+
+            //获取审批环节代码
+            List<String>  currentNodeTableList = workflows.stream().map(s->s.getTableName()).collect(Collectors.toList());
+            RegistrationProcessType[] values = RegistrationProcessType.values();
+            List<RegistrationProcessType>  reversedValues = Arrays.stream(values).sequential().sorted(Comparator.comparing(RegistrationProcessType::getIndex).reversed()).collect(Collectors.toList());
+            for(RegistrationProcessType registrationProcess : reversedValues){
+                if(currentNodeTableList.contains(registrationProcess.getTable())){
+                    approvalProcessCode = registrationProcess.getCode();
+                    break;
+                }
+            }
+
+            //获取登记环节编码
+            if(currentNodeTableList.contains(talbeName4)){
+                registrationProcessCode = "2";
+            } else if(currentNodeTableList.contains(talbeName3)){
+                registrationProcessCode = "1";
+            }
+
+            //许可分期编码
+            if(currentNodeTableList.contains(talbeName6)){
+                licenseStagesCode = "2";
+            } else if(currentNodeTableList.contains(talbeName5)){
+                licenseStagesCode = "1";
+            }
+        }
+
+       returnCode = levyStatusCode+landSupplyModeCode+approvalProcessCode+registrationProcessCode+licenseStagesCode;
+       return returnCode;
+    }
+
+
+
+
 
 
 
-        }else if(ProjectType.BATCH.equals(projectType)){
 
 
-        }
 
 
-//        LandOneCode entity = new LandOneCode();
-//        entity.setProjectWorkflowId(projectWorkflowId);
-//        entity.setCodeType(codeType);
-//        return mapper.getById(id);
-        return null;
-    }