Parcourir la source

赋码逻辑默认值,登簿数据接收后异步调用查询

chenendian il y a 1 semaine
Parent
commit
38a848e85b

+ 2 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/TdgyController.java

@@ -135,6 +135,8 @@ public class TdgyController extends BaseController {
             tdgyService.updateHasOnchain(id,projectId, hasOnchain);
             tdgyService.updateHasOnchain(id,projectId, hasOnchain);
             // 更新项目表的上链数量
             // 更新项目表的上链数量
             projectService.countOnChinaNum(projectId);
             projectService.countOnChinaNum(projectId);
+            //这里进行预赋码逻辑
+            tdgyService.addPreAssignCode(id,projectId,nodeLand.getGeomDbId());
             //这里生成资源吗
             //这里生成资源吗
             landOneCodeService.addOrUpdateLandOneCodeInfo(projectId,id);
             landOneCodeService.addOrUpdateLandOneCodeInfo(projectId,id);
             return R.ok();
             return R.ok();

+ 13 - 8
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/third/TakeDataController.java

@@ -68,14 +68,6 @@ public class TakeDataController extends BaseController {
         }
         }
     }
     }
 
 
-    @PostMapping("addEntity")
-    public R<String> addEntity(@RequestBody LandOneCode body) {
-        try {
-            return R.fail(502, "土地统一编码信息已自动生成,无需手动添加");
-        } catch (Exception e) {
-            return R.fail(e.getMessage());
-        }
-    }
 
 
     /**
     /**
      * 添加数据
      * 添加数据
@@ -95,4 +87,17 @@ public class TakeDataController extends BaseController {
         }
         }
     }
     }
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
 }
 }

+ 2 - 2
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/ProjectImmobileCode.java

@@ -25,10 +25,10 @@ public class ProjectImmobileCode extends BaseId {
     private String nodeId;
     private String nodeId;
 
 
     /** 矢量批次 */
     /** 矢量批次 */
-    private Integer geomDbId;
+    private String geomDbId;
 
 
     /** 数据id */
     /** 数据id */
-    private Integer geomDetailsId;
+    private String geomDetailsId;
 
 
     /** 预赋不动产单元号 */
     /** 预赋不动产单元号 */
     private String preAssignCode;
     private String preAssignCode;

+ 1 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/ThirdRecordStatusMapper.java

@@ -20,7 +20,7 @@ public interface ThirdRecordStatusMapper {
      * 匹配优先级:yfbdydyh 命中优先,其次 ywh
      * 匹配优先级:yfbdydyh 命中优先,其次 ywh
      */
      */
     ThirdRecordStatusParamVo selectByYfbdydyhOrYwh(@Param("yfbdydyh") String yfbdydyh,
     ThirdRecordStatusParamVo selectByYfbdydyhOrYwh(@Param("yfbdydyh") String yfbdydyh,
-                                                   @Param("ywh") String ywh);
+                                                   @Param("ywh") String ywh, @Param("ywlx") String ywlx);
 
 
     /**
     /**
      * 根据主键 ID 更新登簿状态信息(覆盖更新)
      * 根据主键 ID 更新登簿状态信息(覆盖更新)

+ 8 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/TdgyService.java

@@ -57,4 +57,12 @@ public interface TdgyService {
      * @param hasOnchain 是否已上链
      * @param hasOnchain 是否已上链
      */
      */
     void updateHasOnchain(String id,String projectId ,Boolean hasOnchain);
     void updateHasOnchain(String id,String projectId ,Boolean hasOnchain);
+
+
+    void addPreAssignCode(String nodeId,String projectId,String geomDbId) throws RuntimeException ;
+
+
+
+
+
 }
 }

+ 39 - 5
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/TdgyImpl.java

@@ -4,12 +4,13 @@ import com.siwei.apply.domain.*;
 import com.siwei.apply.domain.res.TdgyRes;
 import com.siwei.apply.domain.res.TdgyRes;
 import com.siwei.apply.domain.vo.TdgyUpdateVo;
 import com.siwei.apply.domain.vo.TdgyUpdateVo;
 import com.siwei.apply.domain.vo.TdgyVo;
 import com.siwei.apply.domain.vo.TdgyVo;
+import com.siwei.apply.enums.AloneWorkFlowEnum;
 import com.siwei.apply.enums.ProjectType;
 import com.siwei.apply.enums.ProjectType;
-import com.siwei.apply.mapper.ProjectMapper;
-import com.siwei.apply.mapper.TdgyMapper;
+import com.siwei.apply.mapper.*;
 import com.siwei.apply.service.LandOneCodeService;
 import com.siwei.apply.service.LandOneCodeService;
 import com.siwei.apply.service.NodeLandService;
 import com.siwei.apply.service.NodeLandService;
 import com.siwei.apply.service.TdgyService;
 import com.siwei.apply.service.TdgyService;
+import com.siwei.apply.service.third.TakeDataService;
 import com.siwei.common.core.exception.ServiceException;
 import com.siwei.common.core.exception.ServiceException;
 import com.siwei.common.core.utils.bean.BeanUtils;
 import com.siwei.common.core.utils.bean.BeanUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.CollectionUtils;
@@ -18,7 +19,6 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.siwei.apply.domain.res.LandTypeTreeRes;
 import com.siwei.apply.domain.res.LandTypeTreeRes;
-import com.siwei.apply.mapper.LandTypeMapper;
 
 
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -26,8 +26,6 @@ import java.util.stream.Collectors;
 import static com.siwei.apply.common.Common.UserId;
 import static com.siwei.apply.common.Common.UserId;
 
 
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
-import com.siwei.apply.mapper.ProjectWorkflowMapper;
-import com.siwei.apply.mapper.WorkflowMapper;
 
 
 /**
 /**
  * 土地供应 服务实现类
  * 土地供应 服务实现类
@@ -52,6 +50,12 @@ public class TdgyImpl implements TdgyService {
     @Autowired
     @Autowired
     private NodeLandService nodeLandService;
     private NodeLandService nodeLandService;
 
 
+    @Autowired
+    private TakeDataService takeDataService;
+
+    @Autowired
+    private ProjectImmobileCodeMapper projectImmobileCodeMapper;
+
 
 
 
 
     @Override
     @Override
@@ -226,4 +230,34 @@ public class TdgyImpl implements TdgyService {
         }
         }
         tdgyMapper.updateHasOnchain(id, hasOnchain);
         tdgyMapper.updateHasOnchain(id, hasOnchain);
     }
     }
+
+    @Override
+    public void addPreAssignCode(String nodeId,String projectId,String geomDbId) throws RuntimeException {
+        //这里进行预赋码逻辑,先查询是否已经存在预赋码,如果存在则不进行生成
+        List<ProjectImmobileCode> existsList = projectImmobileCodeMapper.selectByProjectId(projectId);
+        if(CollectionUtils.isNotEmpty(existsList)){
+            String existsPreAssignCode  = existsList.get(0).getPreAssignCode();
+            if(StringUtils.isNotBlank(existsPreAssignCode)){
+                return;
+            }
+        }
+        //这里生成预赋码逻辑,调用三方接口获取最大序号,然后生成预赋码,插入到不动产单元号表中
+        Map<String, String> maxSequenceMap = takeDataService.getThirdMaxSequence(projectId,AloneWorkFlowEnum.NODE_2.getTableName());
+        if(MapUtils.isNotEmpty(maxSequenceMap) && maxSequenceMap.containsKey("preAssignCode")){
+            String preAssignCode  = maxSequenceMap.get("preAssignCode");
+            //这里需要校验是否已经存在预赋码,如果存在则修改
+            if(com.siwei.common.core.utils.StringUtils.isNotBlank(preAssignCode)){
+                //这里进行入库
+                ProjectImmobileCode projectImmobileCode = new ProjectImmobileCode();
+                projectImmobileCode.generateId();
+                projectImmobileCode.setProjectId(projectId);
+                projectImmobileCode.setNodeId(nodeId);
+                projectImmobileCode.setGeomDbId(geomDbId);
+                projectImmobileCode.setCode(null);
+                projectImmobileCode.setPreAssignCode(preAssignCode);
+                projectImmobileCodeMapper.insert(projectImmobileCode);
+            }
+        }
+    }
+
 }
 }

+ 7 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/TakeDataService.java

@@ -6,6 +6,8 @@ import com.siwei.apply.domain.vo.GyjsydscdjUpdateVo;
 import com.siwei.apply.domain.vo.GyjsydscdjVo;
 import com.siwei.apply.domain.vo.GyjsydscdjVo;
 
 
 import com.siwei.apply.domain.vo.TakeDataAddVo;
 import com.siwei.apply.domain.vo.TakeDataAddVo;
+import com.siwei.apply.domain.vo.ThirdRecordStatusParamVo;
+
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -52,5 +54,10 @@ public interface TakeDataService {
      */
      */
     Map<String, String> getThirdMaxSequence(String projectId,String tableName);
     Map<String, String> getThirdMaxSequence(String projectId,String tableName);
 
 
+    Map<String, Object> remoteLandFirstRegistration(ThirdRecordStatusParamVo paramVo);
+
+    Map<String, Object> remoteHouseFirstRegistration(ThirdRecordStatusParamVo paramVo);
+
+
 
 
 }
 }

+ 49 - 21
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/OfferDataServiceImpl.java

@@ -14,6 +14,7 @@ import com.siwei.apply.service.GyjsydscdjService;
 import com.siwei.apply.service.NodeAttachmentService;
 import com.siwei.apply.service.NodeAttachmentService;
 import com.siwei.apply.service.NodeLandService;
 import com.siwei.apply.service.NodeLandService;
 import com.siwei.apply.service.third.OfferDataService;
 import com.siwei.apply.service.third.OfferDataService;
+import com.siwei.apply.service.third.TakeDataService;
 import com.siwei.apply.utils.ServiceUtil;
 import com.siwei.apply.utils.ServiceUtil;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.exception.ServiceException;
 import com.siwei.common.core.exception.ServiceException;
@@ -28,6 +29,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.*;
 import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 
 
 
 /**
 /**
@@ -49,7 +54,6 @@ public class OfferDataServiceImpl implements OfferDataService {
     @Autowired
     @Autowired
     private GyjsydjfwscdjService gyjsydjfwscdjService;
     private GyjsydjfwscdjService gyjsydjfwscdjService;
 
 
-
     @Autowired
     @Autowired
     private RemoteSpatialFilesDbService remoteSpatialFilesDbService;
     private RemoteSpatialFilesDbService remoteSpatialFilesDbService;
 
 
@@ -66,6 +70,9 @@ public class OfferDataServiceImpl implements OfferDataService {
     @Autowired
     @Autowired
     private ProjectImmobileCodeMapper projectImmobileCodeMapper;
     private ProjectImmobileCodeMapper projectImmobileCodeMapper;
 
 
+    @Autowired
+    private TakeDataService takeDataService;
+
 
 
 
 
     @Override
     @Override
@@ -82,20 +89,21 @@ public class OfferDataServiceImpl implements OfferDataService {
     }
     }
 
 
     /**
     /**
-     *         获取 1.项目与土地供应,两个表进行关联。
-     *         并且为上链的,并且不动产单元号不经存在的数据。
+     * 获取 1.项目与土地供应,两个表进行关联。
+     * 并且为上链的,并且不动产单元号不经存在的数据。
      * 根据入参数据,多个取并集,获取项目的相关数据
      * 根据入参数据,多个取并集,获取项目的相关数据
+     *
      * @param body
      * @param body
      * @return
      * @return
      */
      */
     @Override
     @Override
     public List<Map<String, Object>> landSupplyAndProjectList(ThirdProjectParamVo body) {
     public List<Map<String, Object>> landSupplyAndProjectList(ThirdProjectParamVo body) {
-       String projectName =  body.getXmmc();
-       String projectCode =  body.getXmdm();
-       String srf =  body.getSrf();
-       String yfbdcdyh =  body.getYfbdcdyh();
-       String ewktString =  body.getGeom();
-        List<Map<String,Object>>  result = projectMapper.getTdyProjectList(
+        String projectName = body.getXmmc();
+        String projectCode = body.getXmdm();
+        String srf = body.getSrf();
+        String yfbdcdyh = body.getYfbdcdyh();
+        String ewktString = body.getGeom();
+        List<Map<String, Object>> result = projectMapper.getTdyProjectList(
                 projectName, projectCode, srf, yfbdcdyh, ewktString);
                 projectName, projectCode, srf, yfbdcdyh, ewktString);
         return result;
         return result;
     }
     }
@@ -143,8 +151,8 @@ public class OfferDataServiceImpl implements OfferDataService {
             throw new ServiceException("业务号为空");
             throw new ServiceException("业务号为空");
         }
         }
 
 
-        // 入库:以 yfbdydyh 或 ywh 判重,已存在则按主键覆盖更新,避免重复插入
-        ThirdRecordStatusParamVo existing = thirdRecordStatusMapper.selectByYfbdydyhOrYwh(yfbdydyh, ywh);
+        // 入库:以 yfbdydyh 或 ywh 及 ywlx 判重,已存在则按主键覆盖更新,避免重复插入
+        ThirdRecordStatusParamVo existing = thirdRecordStatusMapper.selectByYfbdydyhOrYwh(yfbdydyh, ywh, ywlx);
         String id;
         String id;
         if (existing != null) {
         if (existing != null) {
             // 复用原主键,覆盖更新业务字段
             // 复用原主键,覆盖更新业务字段
@@ -158,24 +166,44 @@ public class OfferDataServiceImpl implements OfferDataService {
             thirdRecordStatusMapper.insert(body);
             thirdRecordStatusMapper.insert(body);
         }
         }
 
 
+        //todo 这里更新完成之后,需要同步进行数据的抓取;这里需要异步处理,否则下载文件会阻塞接口的返回,导致超时。
+        CompletableFuture.supplyAsync(()-> {
+            if("1".equals(ywlx)){ //土地首次登记
+                takeDataService.remoteLandFirstRegistration(body);
+            }else if("2".equals(ywlx)){ //房屋首次登记
+                takeDataService.remoteHouseFirstRegistration(body);
+            }
+            ThirdRecordStatusParamVo updateVo = new ThirdRecordStatusParamVo();
+            updateVo.setId(body.getId());
+            updateVo.setTbzt("1");
+            thirdRecordStatusMapper.updateById(updateVo);
+            return body.getId();
+        }).exceptionally(e -> {
+            log.error("不动产远程抓取数据失败: ywh={}, ywlx={}", ywh, ywlx, e);
+            e.printStackTrace();
+            return null;
+        });
+
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         map.put("id", id);
         map.put("id", id);
         return map;
         return map;
     }
     }
 
 
 
 
+
+
     @Override
     @Override
     public Map<String, Object> landFirstRegistration(LandFirstParamVo body) {
     public Map<String, Object> landFirstRegistration(LandFirstParamVo body) {
         String yfbdcdyh = body.getYfbdcdyh();
         String yfbdcdyh = body.getYfbdcdyh();
-        if(StringUtils.isBlank(yfbdcdyh)){
+        if (StringUtils.isBlank(yfbdcdyh)) {
             throw new ServiceException("预分不动产单元号为空");
             throw new ServiceException("预分不动产单元号为空");
         }
         }
         String ywbh = body.getYwbh();
         String ywbh = body.getYwbh();
-        if(StringUtils.isBlank(ywbh)){
+        if (StringUtils.isBlank(ywbh)) {
             throw new ServiceException("业务编号为空");
             throw new ServiceException("业务编号为空");
         }
         }
         List<String> geomsList = body.getGeoms();
         List<String> geomsList = body.getGeoms();
-        if(CollectionUtils.isEmpty(geomsList)){
+        if (CollectionUtils.isEmpty(geomsList)) {
             throw new ServiceException("geom信息为空");
             throw new ServiceException("geom信息为空");
         }
         }
         //todo 这里进行文件下载入库:
         //todo 这里进行文件下载入库:
@@ -211,7 +239,7 @@ public class OfferDataServiceImpl implements OfferDataService {
             map.put("id", nodeId);
             map.put("id", nodeId);
             return map;
             return map;
         } catch (Exception e) {
         } catch (Exception e) {
-            log.error("调用矢量保存文件错误,业务编号:{}: ",ywbh);
+            log.error("调用矢量保存文件错误,业务编号:{}: ", ywbh);
             e.printStackTrace();
             e.printStackTrace();
         }
         }
         return null;
         return null;
@@ -221,15 +249,15 @@ public class OfferDataServiceImpl implements OfferDataService {
     @Override
     @Override
     public Map<String, Object> houseFirstRegistration(HouseFirstParamVo body) {
     public Map<String, Object> houseFirstRegistration(HouseFirstParamVo body) {
         String yfbdcdyh = body.getYfbdcdyh();
         String yfbdcdyh = body.getYfbdcdyh();
-        if(StringUtils.isBlank(yfbdcdyh)){
+        if (StringUtils.isBlank(yfbdcdyh)) {
             throw new ServiceException("预分不动产单元号为空");
             throw new ServiceException("预分不动产单元号为空");
         }
         }
         String ywbh = body.getYwbh();
         String ywbh = body.getYwbh();
-        if(StringUtils.isBlank(ywbh)){
+        if (StringUtils.isBlank(ywbh)) {
             throw new ServiceException("业务编号为空");
             throw new ServiceException("业务编号为空");
         }
         }
         List<String> geomsList = body.getGeoms();
         List<String> geomsList = body.getGeoms();
-        if(CollectionUtils.isEmpty(geomsList)){
+        if (CollectionUtils.isEmpty(geomsList)) {
             throw new ServiceException("geom信息为空");
             throw new ServiceException("geom信息为空");
         }
         }
         //todo 这里进行文件下载入库:
         //todo 这里进行文件下载入库:
@@ -262,7 +290,7 @@ public class OfferDataServiceImpl implements OfferDataService {
             map.put("id", nodeId);
             map.put("id", nodeId);
             return map;
             return map;
         } catch (Exception e) {
         } catch (Exception e) {
-            log.error("调用矢量保存文件错误,业务编号:{}: ",ywbh);
+            log.error("调用矢量保存文件错误,业务编号:{}: ", ywbh);
             e.printStackTrace();
             e.printStackTrace();
         }
         }
         return null;
         return null;
@@ -291,13 +319,13 @@ public class OfferDataServiceImpl implements OfferDataService {
     public NodeAttachment getThirdNodeAttachment(String preImmobileCode, String projectId, String dqjd) throws Exception {
     public NodeAttachment getThirdNodeAttachment(String preImmobileCode, String projectId, String dqjd) throws Exception {
         NodeAttachment nodeAttachment = null;
         NodeAttachment nodeAttachment = null;
         //这里根据预赋不动产单元号获取项目id
         //这里根据预赋不动产单元号获取项目id
-        if(StringUtils.isBlank(projectId)){
+        if (StringUtils.isBlank(projectId)) {
             ProjectImmobileCode existing = projectImmobileCodeMapper.selectByPreAssignCode(preImmobileCode);
             ProjectImmobileCode existing = projectImmobileCodeMapper.selectByPreAssignCode(preImmobileCode);
             if (Objects.nonNull(existing)) {
             if (Objects.nonNull(existing)) {
                 projectId = existing.getProjectId();
                 projectId = existing.getProjectId();
             }
             }
         }
         }
-        if(StringUtils.isNotBlank(projectId)){
+        if (StringUtils.isNotBlank(projectId)) {
             String nodeTableName = dqjd.equals("00") ? AloneWorkFlowEnum.NODE_2.getTableName() : dqjd.equals("01") ? AloneWorkFlowEnum.NODE_6.getTableName() : "";
             String nodeTableName = dqjd.equals("00") ? AloneWorkFlowEnum.NODE_2.getTableName() : dqjd.equals("01") ? AloneWorkFlowEnum.NODE_6.getTableName() : "";
             List<ProjectWorkflow> projectWorkflows = projectWorkflowMapper.selectByProjectIdAndNodeTableName(projectId, nodeTableName);
             List<ProjectWorkflow> projectWorkflows = projectWorkflowMapper.selectByProjectIdAndNodeTableName(projectId, nodeTableName);
             Optional<ProjectWorkflow> res = projectWorkflows.stream().findFirst();
             Optional<ProjectWorkflow> res = projectWorkflows.stream().findFirst();

+ 179 - 22
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/TakeDataServiceImpl.java

@@ -4,22 +4,29 @@ import com.siwei.apply.domain.Project;
 import com.siwei.apply.domain.ProjectWorkflow;
 import com.siwei.apply.domain.ProjectWorkflow;
 import com.siwei.apply.domain.res.GyjsydscdjRes;
 import com.siwei.apply.domain.res.GyjsydscdjRes;
 import com.siwei.apply.domain.res.GyjsydscdjSinglRes;
 import com.siwei.apply.domain.res.GyjsydscdjSinglRes;
-import com.siwei.apply.domain.vo.GyjsydscdjUpdateVo;
-import com.siwei.apply.domain.vo.TakeDataAddVo;
+import com.siwei.apply.domain.vo.*;
 import com.siwei.apply.enums.AloneWorkFlowEnum;
 import com.siwei.apply.enums.AloneWorkFlowEnum;
 
 
 import com.siwei.apply.mapper.ProjectWorkflowMapper;
 import com.siwei.apply.mapper.ProjectWorkflowMapper;
+import com.siwei.apply.service.GyjsydjfwscdjService;
+import com.siwei.apply.service.GyjsydscdjService;
 import com.siwei.apply.service.NodeLandService;
 import com.siwei.apply.service.NodeLandService;
 import com.siwei.apply.service.ProjectService;
 import com.siwei.apply.service.ProjectService;
 import com.siwei.apply.service.third.TakeDataService;
 import com.siwei.apply.service.third.TakeDataService;
 import com.siwei.apply.utils.HttpClientUtil;
 import com.siwei.apply.utils.HttpClientUtil;
+import com.siwei.common.core.domain.R;
+import com.siwei.common.core.exception.ServiceException;
 import com.siwei.common.core.utils.StringUtils;
 import com.siwei.common.core.utils.StringUtils;
+import com.siwei.spatial.api.RemoteSpatialFilesDbService;
+import com.siwei.spatial.api.domain.file.TGeomDb;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.RandomStringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -40,22 +47,56 @@ public class TakeDataServiceImpl implements TakeDataService {
     @Autowired
     @Autowired
     private NodeLandService nodeLandService;
     private NodeLandService nodeLandService;
 
 
+    @Autowired
+    private GyjsydscdjService gyjsydscdjService;
+
+    @Autowired
+    private GyjsydjfwscdjService gyjsydjfwscdjService;
+
+    @Autowired
+    private RemoteSpatialFilesDbService remoteSpatialFilesDbService;
+
+
     @Override
     @Override
     public String add(TakeDataAddVo takeDataAddVo) {
     public String add(TakeDataAddVo takeDataAddVo) {
         // TODO: Implement add logic
         // TODO: Implement add logic
         return "1";
         return "1";
     }
     }
 
 
+
+    @Override
+    public GyjsydscdjRes get(String projectId) {
+        return null;
+    }
+
     @Override
     @Override
-    public Map<String, String> getThirdMaxSequence(String projectId,String tableName) {
+    public GyjsydscdjSinglRes getById(String id) {
+        return null;
+    }
+
+    @Override
+    public void update(GyjsydscdjUpdateVo gyjsydscdjUpdateVo) {
+
+    }
+
+    /**
+     * 远程获取第三方最大序号
+     * 然后根据规则生成预赋不动产单元号
+     *
+     * @param projectId
+     * @param tableName
+     * @return
+     */
+    @Override
+    public Map<String, String> getThirdMaxSequence(String projectId, String tableName) {
         Map<String, String> retMap = new LinkedHashMap<>();
         Map<String, String> retMap = new LinkedHashMap<>();
         Project project = projectService.get(projectId);
         Project project = projectService.get(projectId);
         String firstPlotCode = project.getFirstPlotCode();
         String firstPlotCode = project.getFirstPlotCode();
         String secondPlotCode = project.getSecondPlotCode();
         String secondPlotCode = project.getSecondPlotCode();
-        if(StringUtils.isEmpty(firstPlotCode)){
+        if (StringUtils.isEmpty(firstPlotCode)) {
             firstPlotCode = "G";
             firstPlotCode = "G";
         }
         }
-        if(StringUtils.isEmpty(secondPlotCode)){
+        if (StringUtils.isEmpty(secondPlotCode)) {
             secondPlotCode = "B";
             secondPlotCode = "B";
         }
         }
 
 
@@ -69,29 +110,36 @@ public class TakeDataServiceImpl implements TakeDataService {
             for (Map<String, String> geomDetailsMap : geomDetailsList) {
             for (Map<String, String> geomDetailsMap : geomDetailsList) {
                 String geomDetailsId = geomDetailsMap.get("id");
                 String geomDetailsId = geomDetailsMap.get("id");
                 //当前地块所属地籍子区编号
                 //当前地块所属地籍子区编号
-                Map<String, String>  detailGeomBelongToDjzqMap = nodeLandService.getDjzqContainsNodeList(geomDetailsId);
-                if(!MapUtils.isEmpty(detailGeomBelongToDjzqMap)){
-                    String djzqdm = detailGeomBelongToDjzqMap.get("djzqdm");
-                    regionCode = djzqdm + firstPlotCode + secondPlotCode;
+                Map<String, String> detailGeomBelongToDjzqMap = nodeLandService.getDjzqContainsNodeList(geomDetailsId);
+                if (!MapUtils.isEmpty(detailGeomBelongToDjzqMap)) {
+                    regionCode = detailGeomBelongToDjzqMap.get("djzqdm");
                 }
                 }
             }
             }
         }
         }
 
 
-        if(StringUtils.isNotBlank(regionCode)){
+        String preAssignCode = "";
+        String maxSequence = RandomStringUtils.randomNumeric(5);
+        if (StringUtils.isNotBlank(regionCode)) {
+            preAssignCode = regionCode + firstPlotCode + secondPlotCode + maxSequence;
+        }
+
+        //todo 这里三方接口完成后联调后修改
+        if (StringUtils.isNotBlank(regionCode) && false) {
             Map<String, Object> paramMap = new LinkedHashMap<>();
             Map<String, Object> paramMap = new LinkedHashMap<>();
             paramMap.put("regionCode", regionCode);
             paramMap.put("regionCode", regionCode);
             // todo 这里调用 httpClient 进行远程调用
             // todo 这里调用 httpClient 进行远程调用
             String result = HttpClientUtil.doGet("https://www.baidu.com", paramMap);
             String result = HttpClientUtil.doGet("https://www.baidu.com", paramMap);
             log.info("获取解析数据为:{}", result);
             log.info("获取解析数据为:{}", result);
-            String maxSequence = "";
-            retMap.put("maxSequence", maxSequence);
-            retMap.put("state", "success");
         }
         }
+
+        retMap.put("maxSequence", maxSequence);
+        retMap.put("preAssignCode", preAssignCode);
+        retMap.put("state", "success");
+        retMap.put("code", "200");
         return retMap;
         return retMap;
     }
     }
 
 
 
 
-
     @Override
     @Override
     public Map<String, String> getImmobileCode(String projectId) {
     public Map<String, String> getImmobileCode(String projectId) {
         Map<String, String> retMap = new LinkedHashMap<>();
         Map<String, String> retMap = new LinkedHashMap<>();
@@ -125,23 +173,132 @@ public class TakeDataServiceImpl implements TakeDataService {
     }
     }
 
 
 
 
+    /**
+     * 远程获取国有建设用地使用权首次登记数据
+     * 并且入库
+     *
+     * @param paramVo
+     * @return
+     */
+    @Override
+    public Map<String, Object> remoteLandFirstRegistration(ThirdRecordStatusParamVo paramVo) {
+        String yfbdcdyh = paramVo.getYfbdydyh();
+        if (org.apache.commons.lang3.StringUtils.isBlank(yfbdcdyh)) {
+            throw new ServiceException("预分不动产单元号为空");
+        }
+        String ywh = paramVo.getYwh();
+        if (org.apache.commons.lang3.StringUtils.isBlank(ywh)) {
+            throw new ServiceException("业务编号为空");
+        }
+        String ywlx = paramVo.getYwlx();
+        if (org.apache.commons.lang3.StringUtils.isBlank(ywlx)) {
+            throw new ServiceException("业务类型为空");
+        }
 
 
+        //todo 这里进行远程请求,获取相关数据,解析后入库
+        LandFirstParamVo body = new LandFirstParamVo(); //这里需要调整
+        List<String> geomsList = body.getGeoms();
+        if (CollectionUtils.isEmpty(geomsList)) {
+            throw new ServiceException("geom信息为空");
+        }
+        try {
+            GyjsydscdjVo gyjsydscdjVo = new GyjsydscdjVo();
+            gyjsydscdjVo.setProjectId(body.getXmbh());
+            gyjsydscdjVo.setQlr(body.getQlr());
+            gyjsydscdjVo.setGyqk(body.getGyqk());
+            gyjsydscdjVo.setZl(body.getZl());
+            gyjsydscdjVo.setQllx(body.getQllx());
+            gyjsydscdjVo.setQlxz(body.getQlxz());
+            gyjsydscdjVo.setTdyt(body.getTdyt());
+            if (org.apache.commons.lang3.StringUtils.isNotBlank(body.getTdmj())) {
+                gyjsydscdjVo.setArea(Float.valueOf(body.getTdmj()));
+            }
+            gyjsydscdjVo.setAreaUnit(body.getTdmjdw());
+            gyjsydscdjVo.setBdcdyh(org.apache.commons.lang3.StringUtils.isNotBlank(body.getBdcdyh()) ? body.getBdcdyh() : body.getYfbdcdyh());
+            gyjsydscdjVo.setBdczh(body.getBdczh());
+            gyjsydscdjVo.setDjjg(body.getDjjg());
+            gyjsydscdjVo.setDjDate(body.getDjrq());
+
+            String nodeId = gyjsydscdjService.add(gyjsydscdjVo);
+            Map<String, Object> map1 = new HashMap<>();
+            map1.put("geomData", geomsList);
+            map1.put("sourceType", "third");
+            //todo 这里进行矢量文件的保存及其传输。
+            R<TGeomDb> res = remoteSpatialFilesDbService.saveGeom(map1);
+            TGeomDb tGeomDb = res.getData();
+            //这里保存geom映射关系
+            nodeLandService.createNodeLand(nodeId, tGeomDb.getId());
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", nodeId);
+            return map;
+        } catch (Exception e) {
+            log.error("调用矢量保存文件错误,业务编号:{}: ", ywh);
+            e.printStackTrace();
+        }
+        //todo 同步完成之后,需要修改t_third_record_status 表的状态值,同步完成;
 
 
-    @Override
-    public GyjsydscdjRes get(String projectId) {
-        return null;
-    }
 
 
-    @Override
-    public GyjsydscdjSinglRes getById(String id) {
         return null;
         return null;
     }
     }
 
 
+
     @Override
     @Override
-    public void update(GyjsydscdjUpdateVo gyjsydscdjUpdateVo) {
+    public Map<String, Object> remoteHouseFirstRegistration(ThirdRecordStatusParamVo paramVo) {
+        String yfbdcdyh = paramVo.getYfbdydyh();
+        if (org.apache.commons.lang3.StringUtils.isBlank(yfbdcdyh)) {
+            throw new ServiceException("预分不动产单元号为空");
+        }
+        String ywbh = paramVo.getYwh();
+        if (org.apache.commons.lang3.StringUtils.isBlank(ywbh)) {
+            throw new ServiceException("业务编号为空");
+        }
+        String ywlx = paramVo.getYwlx();
+        if (org.apache.commons.lang3.StringUtils.isBlank(ywlx)) {
+            throw new ServiceException("业务类型为空");
+        }
 
 
-    }
+        //todo 这里进行远程请求,获取相关数据,解析后入库
+        HouseFirstParamVo body = new HouseFirstParamVo(); //这里需要调整
+        List<String> geomsList = body.getGeoms();
+        if (CollectionUtils.isEmpty(geomsList)) {
+            throw new ServiceException("geom信息为空");
+        }
+        try {
+            GyjsydjfwscdjVo gyjsydjfwscdjVo = new GyjsydjfwscdjVo();
+            gyjsydjfwscdjVo.setProjectId(body.getXmbh());
+//            gyjsydjfwscdjVo.setYwh(body.getYwh());
+//            gyjsydjfwscdjVo.setGzdgzsj(body.getGzdgzsj());
+//            gyjsydjfwscdjVo.setKfdw(body.getKfdw());
+//            gyjsydjfwscdjVo.setBdcqk(body.getBdcqk());
+//            if (StringUtils.isNotBlank(body.getJzmj())) {
+//                gyjsydjfwscdjVo.setJzmj(body.getJzmj());
+//            }
+//            gyjsydjfwscdjVo.setJzmjDw(body.getJzmjDw());
+//            gyjsydjfwscdjVo.setTnmj(body.getTnmj());
+//            gyjsydjfwscdjVo.setTnmjDw(body.getTnmjDw());
+//            gyjsydjfwscdjVo.setFtmj(body.getFtmj());
+//            gyjsydjfwscdjVo.setFtmjDw(body.getFtmjDw());
+//            gyjsydjfwscdjVo.setBz(body.getBz());
+
+            String nodeId = gyjsydjfwscdjService.add(gyjsydjfwscdjVo);
+            Map<String, Object> map1 = new HashMap<>();
+            map1.put("geomData", geomsList);
+            //todo 这里进行矢量文件的保存及其传输。
+            R<TGeomDb> res = remoteSpatialFilesDbService.saveGeom(map1);
+            TGeomDb tGeomDb = res.getData();
+            //这里保存geom映射关系
+            nodeLandService.createNodeLand(nodeId, tGeomDb.getId());
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", nodeId);
+            return map;
+        } catch (Exception e) {
+            log.error("调用矢量保存文件错误,业务编号:{}: ", ywbh);
+            e.printStackTrace();
+        }
+        //todo 同步完成之后,需要修改t_third_record_status 表的状态值,同步完成;
 
 
+        return null;
+    }
 
 
 
 
 }
 }

+ 9 - 8
siwei-modules/siwei-apply/src/main/resources/mapper/ProjectImmobileCodeMapper.xml

@@ -17,13 +17,13 @@
         <result property="nodeId" column="node_id"/>
         <result property="nodeId" column="node_id"/>
         <result property="geomDbId" column="geom_db_id"/>
         <result property="geomDbId" column="geom_db_id"/>
         <result property="geomDetailsId" column="geom_details_id"/>
         <result property="geomDetailsId" column="geom_details_id"/>
-        <result property="preAssignCode" column="preAssignCode"/>
+        <result property="preAssignCode" column="pre_assign_code"/>
     </resultMap>
     </resultMap>
 
 
     <!-- 基础查询字段 -->
     <!-- 基础查询字段 -->
     <sql id="Base_Column_List">
     <sql id="Base_Column_List">
         id, project_id, business_id, code, valid_flag, created_at, updated_at,
         id, project_id, business_id, code, valid_flag, created_at, updated_at,
-        node_id, geom_db_id, geom_details_id, "preAssignCode"
+        node_id, geom_db_id, geom_details_id, pre_assign_code
     </sql>
     </sql>
 
 
     <!-- 根据ID查询 -->
     <!-- 根据ID查询 -->
@@ -40,6 +40,7 @@
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
         FROM t_project_immobile_code
         FROM t_project_immobile_code
         WHERE project_id = #{projectId}
         WHERE project_id = #{projectId}
+        AND  valid_flag = 1
     </select>
     </select>
 
 
     <!-- 根据业务ID查询(只返回一条) -->
     <!-- 根据业务ID查询(只返回一条) -->
@@ -93,15 +94,15 @@
             node_id,
             node_id,
             geom_db_id,
             geom_db_id,
             geom_details_id,
             geom_details_id,
-            "preAssignCode"
+            pre_assign_code
         ) VALUES (
         ) VALUES (
             #{id},
             #{id},
             #{projectId},
             #{projectId},
             #{businessId},
             #{businessId},
             #{code},
             #{code},
-            #{validFlag},
-            #{createdAt},
-            #{updatedAt},
+            1,
+            now(),
+            now(),
             #{nodeId},
             #{nodeId},
             #{geomDbId},
             #{geomDbId},
             #{geomDetailsId},
             #{geomDetailsId},
@@ -118,7 +119,7 @@
             node_id = #{nodeId},
             node_id = #{nodeId},
             geom_db_id = #{geomDbId},
             geom_db_id = #{geomDbId},
             geom_details_id = #{geomDetailsId},
             geom_details_id = #{geomDetailsId},
-            "preAssignCode" = #{preAssignCode}
+            pre_assign_code = #{preAssignCode}
         WHERE business_id = #{businessId}
         WHERE business_id = #{businessId}
     </update>
     </update>
 
 
@@ -133,7 +134,7 @@
             <if test="nodeId != null">node_id = #{nodeId},</if>
             <if test="nodeId != null">node_id = #{nodeId},</if>
             <if test="geomDbId != null">geom_db_id = #{geomDbId},</if>
             <if test="geomDbId != null">geom_db_id = #{geomDbId},</if>
             <if test="geomDetailsId != null">geom_details_id = #{geomDetailsId},</if>
             <if test="geomDetailsId != null">geom_details_id = #{geomDetailsId},</if>
-            <if test="preAssignCode != null">"preAssignCode" = #{preAssignCode},</if>
+            <if test="preAssignCode != null">pre_assign_code = #{preAssignCode},</if>
             <if test="updatedAt != null">updated_at = #{updatedAt}</if>
             <if test="updatedAt != null">updated_at = #{updatedAt}</if>
         </set>
         </set>
         WHERE id = #{id}
         WHERE id = #{id}

+ 3 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/ThirdRecordStatusMapper.xml

@@ -66,6 +66,9 @@
                 <when test="ywh != null and ywh != ''">
                 <when test="ywh != null and ywh != ''">
                     ywh = #{ywh}
                     ywh = #{ywh}
                 </when>
                 </when>
+                <when test="ywlx != null and ywlx != ''">
+                    ywlx = #{ywlx}
+                </when>
             </choose>
             </choose>
         </where>
         </where>
         ORDER BY
         ORDER BY