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

解决循环依赖,地籍子区计算

chenendian 1 неделя назад
Родитель
Сommit
0eedd6a9bb

+ 0 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/third/OfferDataController.java

@@ -46,7 +46,6 @@ public class OfferDataController extends BaseController {
     private RedisService redisService;
 
 
-
     /**
      *  接收推送的登簿状体数据
      * @param body

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

@@ -46,14 +46,14 @@ public class ThirdRecordStatusParamVo {
      * 必选: 否
      * 业务类型: 业务
      */
-    private String bdydyh;
+    private String bdcdyh;
 
     /**
      * 预赋不动产单元号
      * 必选: 否
      * 业务类型: 业务
      */
-    private String yfbdydyh;
+    private String yfbdcdyh;
 
     /**
      * 业务类型(1-国有建设用地使用权首次登记,2-国有建设用地使用权及房屋所有权首次登记)

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

@@ -17,11 +17,19 @@ public interface ThirdRecordStatusMapper {
 
     /**
      * 根据预赋不动产单元号 或 业务号 查询已存在的记录(用于判重/覆盖更新)
-     * 匹配优先级:yfbdydyh 命中优先,其次 ywh
+     * 匹配优先级:yfbdcdyh 命中优先,其次 ywh
      */
-    ThirdRecordStatusParamVo selectByYfbdydyhOrYwh(@Param("yfbdydyh") String yfbdydyh,
+    ThirdRecordStatusParamVo selectByYfbdcdyhOrYwh(@Param("yfbdcdyh") String yfbdcdyh,
                                                    @Param("ywh") String ywh, @Param("ywlx") String ywlx);
 
+
+    ThirdRecordStatusParamVo selectByYfbdcdyhAndYwhAndYwlx(@Param("yfbdcdyh") String yfbdcdyh,
+                                                   @Param("ywh") String ywh, @Param("ywlx") String ywlx);
+
+
+
+
+
     /**
      * 根据主键 ID 更新登簿状态信息(覆盖更新)
      */

+ 28 - 26
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/OfferDataServiceImpl.java

@@ -110,13 +110,12 @@ public class OfferDataServiceImpl implements OfferDataService {
 
     @Override
     public Map<String, Object> addRecordStatusData(ThirdRecordStatusParamVo body) {
-
         // 字段校验:参考 landFirstRegistration 的校验方式
-        String yfbdydyh = body.getYfbdydyh();
-        if (StringUtils.isBlank(yfbdydyh)) {
+        String yfbdcdyh = body.getYfbdcdyh();
+        if (StringUtils.isBlank(yfbdcdyh)) {
             throw new ServiceException("预赋不动产单元号为空");
         }
-        if (yfbdydyh.length() != 19) {
+        if (yfbdcdyh.length() != 19) {
             throw new ServiceException("预赋不动产单元号长度必须为19位");
         }
 
@@ -151,38 +150,41 @@ public class OfferDataServiceImpl implements OfferDataService {
             throw new ServiceException("业务号为空");
         }
 
-        // 入库:以 yfbdydyh 或 ywh 及 ywlx 判重,已存在则按主键覆盖更新,避免重复插入
-        ThirdRecordStatusParamVo existing = thirdRecordStatusMapper.selectByYfbdydyhOrYwh(yfbdydyh, ywh, ywlx);
-        String id;
+        String id="";
+        String tbztFlag;
+        // 入库:以 yfbdcdyh 或 ywh 及 ywlx 判重,已存在则按主键覆盖更新,避免重复插入
+        ThirdRecordStatusParamVo existing = thirdRecordStatusMapper.selectByYfbdcdyhAndYwhAndYwlx(yfbdcdyh, ywh, ywlx);
         if (existing != null) {
-            // 复用原主键,覆盖更新业务字段
+            tbztFlag = existing.getTbzt();
             id = existing.getId();
             body.setId(id);
-            thirdRecordStatusMapper.updateById(body);
         } else {
             id = IdUtils.fastSimpleUUID();
             body.setId(id);
             body.setTbzt("0");
             thirdRecordStatusMapper.insert(body);
+            tbztFlag = "0";
         }
 
-        //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;
-        });
+        if("0".equals(tbztFlag)) {
+            //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.put("id", id);

+ 10 - 6
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/TakeDataServiceImpl.java

@@ -7,11 +7,11 @@ import com.siwei.apply.domain.res.GyjsydscdjSinglRes;
 import com.siwei.apply.domain.vo.*;
 import com.siwei.apply.enums.AloneWorkFlowEnum;
 
+import com.siwei.apply.mapper.ProjectMapper;
 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.ProjectService;
 import com.siwei.apply.service.third.TakeDataService;
 import com.siwei.apply.utils.HttpClientUtil;
 import com.siwei.common.core.domain.R;
@@ -38,8 +38,12 @@ import java.util.Map;
 @Service
 public class TakeDataServiceImpl implements TakeDataService {
 
+//    @Autowired
+//    private ProjectService projectService;
+
+
     @Autowired
-    private ProjectService projectService;
+    private ProjectMapper projectMapper;
 
     @Autowired
     private ProjectWorkflowMapper projectWorkflowMapper;
@@ -90,7 +94,7 @@ public class TakeDataServiceImpl implements TakeDataService {
     @Override
     public Map<String, String> getThirdMaxSequence(String projectId, String tableName) {
         Map<String, String> retMap = new LinkedHashMap<>();
-        Project project = projectService.get(projectId);
+        Project project = projectMapper.get(projectId);
         String firstPlotCode = project.getFirstPlotCode();
         String secondPlotCode = project.getSecondPlotCode();
         if (StringUtils.isEmpty(firstPlotCode)) {
@@ -143,7 +147,7 @@ public class TakeDataServiceImpl implements TakeDataService {
     @Override
     public Map<String, String> getImmobileCode(String projectId) {
         Map<String, String> retMap = new LinkedHashMap<>();
-        Project project = projectService.get(projectId);
+        Project project = projectMapper.get(projectId);
         String firstPlotCode = project.getFirstPlotCode();
         String secondPlotCode = project.getSecondPlotCode();
         String tableName = AloneWorkFlowEnum.NODE_2.getTableName(); // 土地供应图斑
@@ -182,7 +186,7 @@ public class TakeDataServiceImpl implements TakeDataService {
      */
     @Override
     public Map<String, Object> remoteLandFirstRegistration(ThirdRecordStatusParamVo paramVo) {
-        String yfbdcdyh = paramVo.getYfbdydyh();
+        String yfbdcdyh = paramVo.getYfbdcdyh();
         if (org.apache.commons.lang3.StringUtils.isBlank(yfbdcdyh)) {
             throw new ServiceException("预分不动产单元号为空");
         }
@@ -244,7 +248,7 @@ public class TakeDataServiceImpl implements TakeDataService {
 
     @Override
     public Map<String, Object> remoteHouseFirstRegistration(ThirdRecordStatusParamVo paramVo) {
-        String yfbdcdyh = paramVo.getYfbdydyh();
+        String yfbdcdyh = paramVo.getYfbdcdyh();
         if (org.apache.commons.lang3.StringUtils.isBlank(yfbdcdyh)) {
             throw new ServiceException("预分不动产单元号为空");
         }

+ 2 - 4
siwei-modules/siwei-apply/src/main/resources/mapper/NodeLandMapper.xml

@@ -160,12 +160,10 @@
             djzq.ysdm,
             djzq.djzqdm,
             djzq.djzqmc,
-            djzq.bz,
-            djq.djqmc,
-            djq.djqdm
+            djzq.bz
         FROM vector.djzq
         WHERE (djzq.valid_flag IS NULL OR djzq.valid_flag = 0)
-            and st_contains(ST_Buffer(djzq.geom::geography, 0.1)::geometry, (SELECT geom FROM   "public".t_geom_db_details   WHERE id = #{detailsId})) )
+            and st_contains(ST_Buffer(djzq.geom::geography, 0.1)::geometry, (SELECT geom FROM   "public".t_geom_db_details   WHERE id = #{detailsId}))
             limit 1
         </select>
 

+ 41 - 14
siwei-modules/siwei-apply/src/main/resources/mapper/ThirdRecordStatusMapper.xml

@@ -11,8 +11,8 @@
         <result property="tbzt" column="tbzt"/>
         <result property="createdAt" column="created_at"/>
         <result property="updatedAt" column="updated_at"/>
-        <result property="bdydyh" column="bdydyh"/>
-        <result property="yfbdydyh" column="yfbdydyh"/>
+        <result property="bdcdyh" column="bdcdyh"/>
+        <result property="yfbdcdyh" column="yfbdcdyh"/>
         <result property="ywlx" column="ywlx"/>
         <result property="sfdengbu" column="sfdengbu"/>
         <result property="dengburq" column="dengburq"/>
@@ -28,8 +28,8 @@
             tbzt,
             created_at,
             updated_at,
-            bdydyh,
-            yfbdydyh,
+            bdcdyh,
+            yfbdcdyh,
             ywlx,
             sfdengbu,
             dengburq,
@@ -41,8 +41,8 @@
             #{tbzt},
             now(),
             now(),
-            #{bdydyh},
-            #{yfbdydyh},
+            #{bdcdyh},
+            #{yfbdcdyh},
             #{ywlx},
             #{sfdengbu},
             #{dengburq},
@@ -52,16 +52,16 @@
         )
     </insert>
 
-    <!-- 根据预赋不动产单元号 或 业务号 查询已存在的记录(yfbdydyh 优先) -->
-    <select id="selectByYfbdydyhOrYwh" resultMap="BaseResultMap">
+    <!-- 根据预赋不动产单元号 或 业务号 查询已存在的记录(yfbdcdyh 优先) -->
+    <select id="selectByYfbdcdyhOrYwh" resultMap="BaseResultMap">
         SELECT
-            id, tbzt, created_at, updated_at, bdydyh, yfbdydyh, ywlx,
+            id, tbzt, created_at, updated_at, bdcdyh, yfbdcdyh, ywlx,
             sfdengbu, dengburq, qlrmc, qlrzjh, ywh
         FROM t_third_record_status
         <where>
             <choose>
-                <when test="yfbdydyh != null and yfbdydyh != ''">
-                    yfbdydyh = #{yfbdydyh}
+                <when test="yfbdcdyh != null and yfbdcdyh != ''">
+                    yfbdcdyh = #{yfbdcdyh}
                 </when>
                 <when test="ywh != null and ywh != ''">
                     ywh = #{ywh}
@@ -72,18 +72,45 @@
             </choose>
         </where>
         ORDER BY
-            CASE WHEN yfbdydyh = #{yfbdydyh} THEN 0 ELSE 1 END,
+            CASE WHEN yfbdcdyh = #{yfbdcdyh} THEN 0 ELSE 1 END,
             updated_at DESC
         LIMIT 1
     </select>
 
+    <!-- 根据预赋不动产单元号 业务号 业务类型 查询已存在的记录 -->
+    <select id="selectByYfbdcdyhAndYwhAndYwlx" resultMap="BaseResultMap">
+        SELECT
+            id, tbzt, created_at, updated_at, bdcdyh, yfbdcdyh, ywlx,
+            sfdengbu, dengburq, qlrmc, qlrzjh, ywh
+        FROM t_third_record_status
+        <where>
+            <if test="yfbdcdyh != null and yfbdcdyh != ''">
+                AND yfbdcdyh = #{yfbdcdyh}
+            </if>
+            <if test="ywh != null and ywh != ''">
+                AND ywh = #{ywh}
+            </if>
+            <if test="ywlx != null and ywlx != ''">
+                AND ywlx = #{ywlx}
+            </if>
+        </where>
+        ORDER BY
+            CASE WHEN yfbdcdyh = #{yfbdcdyh} THEN 0 ELSE 1 END,
+            updated_at DESC
+        LIMIT 1
+    </select>
+
+
+
+
+
     <!-- 根据主键 ID 覆盖更新登簿状态信息 -->
     <update id="updateById" parameterType="com.siwei.apply.domain.vo.ThirdRecordStatusParamVo">
         UPDATE t_third_record_status
         <set>
             <if test="tbzt != null">tbzt = #{tbzt},</if>
-            <if test="bdydyh != null">bdydyh = #{bdydyh},</if>
-            <if test="yfbdydyh != null">yfbdydyh = #{yfbdydyh},</if>
+            <if test="bdcdyh != null">bdcdyh = #{bdcdyh},</if>
+            <if test="yfbdcdyh != null">yfbdcdyh = #{yfbdcdyh},</if>
             <if test="ywlx != null">ywlx = #{ywlx},</if>
             <if test="sfdengbu != null">sfdengbu = #{sfdengbu},</if>
             <if test="dengburq != null">dengburq = #{dengburq},</if>