Explorar el Código

兼容土地用途

chenendian hace 21 horas
padre
commit
fb09a52bcb

+ 1 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/DealExcelServiceImpl.java

@@ -59,7 +59,7 @@ public class DealExcelServiceImpl {
     private final String rootPathZip = Constant.IMPORT_EXCEL_DATA_FILE_PATH + "\\zip";
     private final String targectDir = Constant.FILE_UPLOAD_PATH;
 
-    private static List<LandType> allLandTypeList = new ArrayList<>();
+    public final static List<LandType> allLandTypeList = new ArrayList<>();
 
     @Autowired
     private ProjectService projectService;

+ 27 - 17
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/TakeDataServiceImpl.java

@@ -3,6 +3,7 @@ package com.siwei.apply.service.third.impl;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
+import com.siwei.apply.domain.LandType;
 import com.siwei.apply.domain.Project;
 import com.siwei.apply.domain.ProjectImmobileCode;
 import com.siwei.apply.domain.ProjectWorkflow;
@@ -11,6 +12,7 @@ import com.siwei.apply.domain.res.GyjsydscdjSinglRes;
 import com.siwei.apply.domain.vo.*;
 import com.siwei.apply.enums.AloneWorkFlowEnum;
 
+import com.siwei.apply.mapper.LandTypeMapper;
 import com.siwei.apply.mapper.ProjectImmobileCodeMapper;
 import com.siwei.apply.mapper.ProjectMapper;
 import com.siwei.apply.mapper.ProjectWorkflowMapper;
@@ -36,6 +38,8 @@ import org.springframework.stereotype.Service;
 
 import java.util.*;
 
+import static com.siwei.apply.service.third.impl.DealExcelServiceImpl.allLandTypeList;
+
 /**
  * 获取三方数据服务实现类
  */
@@ -61,7 +65,6 @@ public class TakeDataServiceImpl implements TakeDataService {
     @Autowired
     private RemoteSpatialFilesDbService remoteSpatialFilesDbService;
 
-
     @Autowired
     private NodeAttachmentService nodeAttachmentService;
 
@@ -69,9 +72,8 @@ public class TakeDataServiceImpl implements TakeDataService {
     private ProjectImmobileCodeMapper projectImmobileCodeMapper;
 
 
-
     @Autowired
-    DealExcelServiceImpl  dealExcelService;
+    private LandTypeMapper landTypeMapper;
 
 
     @Override
@@ -232,7 +234,7 @@ public class TakeDataServiceImpl implements TakeDataService {
                 gyjsydscdjVo.setQlxz(body.getQlxz());
                 //土地用途转化
                 if(StringUtils.isNotBlank(body.getTdyt())){
-                    String code = dealExcelService.getTdytCodeByName(body.getTdyt());
+                    String code = this.getTdytCodeByName(body.getTdyt());
                     gyjsydscdjVo.setTdyt(code);
                 }
                 if (StringUtils.isNotBlank(body.getTdmj())) {
@@ -259,19 +261,6 @@ public class TakeDataServiceImpl implements TakeDataService {
     }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
     @Override
     public Map<String, Object> remoteHouseFirstRegistration(ThirdRecordStatusParamVo paramVo) {
         String yfbdcdyh = paramVo.getYfbdcdyh();
@@ -331,4 +320,25 @@ public class TakeDataServiceImpl implements TakeDataService {
     }
 
 
+    /**
+     * 通过土地用途名称获取土地的编码
+     * @param useName
+     * @return
+     */
+    public String getTdytCodeByName(String useName) {
+        if (allLandTypeList.isEmpty()) {
+            List<LandType> all = landTypeMapper.selectAll();
+            allLandTypeList.addAll(all);
+        }
+        String code = "";
+        // 转换为节点
+        Optional<LandType> filterRes = allLandTypeList.stream().filter(s -> s.getName().equalsIgnoreCase(useName)).findFirst();
+        if (filterRes.isPresent()) {
+            code = filterRes.get().getCode();
+        }
+        return code;
+    }
+
+
+
 }