Преглед изворни кода

Merge branch 'dev-excel0521' into dev-to-user-1

chenendian пре 1 недеља
родитељ
комит
d9fbc7b1f7
28 измењених фајлова са 791 додато и 307 уклоњено
  1. 4 0
      siwei-api/siwei-api-spatial/src/main/java/com/siwei/spatial/api/RemoteSpatialFilesDbService.java
  2. 5 0
      siwei-api/siwei-api-spatial/src/main/java/com/siwei/spatial/api/factory/RemoteSpatialFilesDbFallbackFactory.java
  3. 63 4
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/StorageController.java
  4. 1 1
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/third/OfferDataController.java
  5. 5 7
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/third/TakeDataController.java
  6. 15 68
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/HouseFirstParamVo.java
  7. 7 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/FwmxMapper.java
  8. 2 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GjShijiShouchuMapper.java
  9. 12 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GjShouchuJihuaMapper.java
  10. 6 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GyjsydscdjMapper.java
  11. 6 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/GyjsydscdjService.java
  12. 1 1
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/CadastreManageServiceImpl.java
  13. 263 15
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/StorageServiceImpl.java
  14. 7 0
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/GyjsydscdjImpl.java
  15. 5 5
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/ProjectImpl.java
  16. 0 7
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/OfferDataService.java
  17. 2 2
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/TakeDataService.java
  18. 3 116
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/OfferDataServiceImpl.java
  19. 176 73
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/TakeDataServiceImpl.java
  20. 0 5
      siwei-modules/siwei-apply/src/main/java/com/siwei/apply/utils/ServiceUtil.java
  21. 26 0
      siwei-modules/siwei-apply/src/main/resources/mapper/FwmxMapper.xml
  22. 16 0
      siwei-modules/siwei-apply/src/main/resources/mapper/GjShijiShouchuMapper.xml
  23. 117 1
      siwei-modules/siwei-apply/src/main/resources/mapper/GjShouchuJihuaMapper.xml
  24. 9 0
      siwei-modules/siwei-apply/src/main/resources/mapper/GyjsydscdjMapper.xml
  25. 5 0
      siwei-modules/siwei-spatial/src/main/java/com/siwei/spatial/controller/file/SpatialFilesDbController.java
  26. 1 1
      siwei-modules/siwei-spatial/src/main/java/com/siwei/spatial/service/file/ISpatialFilesDbService.java
  27. 31 0
      siwei-modules/siwei-spatial/src/main/java/com/siwei/spatial/service/file/impl/SpatialFilesDbServiceImpl.java
  28. 3 1
      siwei-modules/siwei-system/src/main/resources/mapper/postgresql/system/SysUserMapper.xml

+ 4 - 0
siwei-api/siwei-api-spatial/src/main/java/com/siwei/spatial/api/RemoteSpatialFilesDbService.java

@@ -16,6 +16,10 @@ import java.util.Map;
 
 @FeignClient(contextId = "remoteSpatialFilesDbService", value = ServiceNameConstants.SPATIAL_SERVICE, fallbackFactory = RemoteSpatialFilesDbFallbackFactory.class)
 public interface RemoteSpatialFilesDbService {
+
+    @PostMapping("/files/db/read/shpfile")
+    public R<List<Map<String, Object>>> readShpFile(@RequestParam("shpFilePath") String shpFilePath, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
+
     @PostMapping("/files/db/read/shp")
     public R<TGeomDb> readShp(@RequestParam("shpFileName") String shpFileName, @RequestParam("shpFilePath") String shpFilePath, @RequestParam("fromRoute") String fromRoute, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 

+ 5 - 0
siwei-api/siwei-api-spatial/src/main/java/com/siwei/spatial/api/factory/RemoteSpatialFilesDbFallbackFactory.java

@@ -27,6 +27,11 @@ public class RemoteSpatialFilesDbFallbackFactory implements FallbackFactory<Remo
     public RemoteSpatialFilesDbService create(Throwable throwable) {
         log.error("日志服务调用失败:{}", throwable.getMessage());
         return new RemoteSpatialFilesDbService() {
+            @Override
+            public R<List<Map<String, Object>>> readShpFile( String shpFilePath,String source) {
+                return R.fail("内部调用异常");
+            }
+
             @Override
             public R<TGeomDb> readShp(String shpFileName, String shpFilePath, String fromRoute, String source) {
                 return R.fail("内部调用异常");

+ 63 - 4
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/cadastre/StorageController.java

@@ -2,13 +2,11 @@ package com.siwei.apply.controller.cadastre;
 
 import com.siwei.apply.domain.cadastre.LandStorageInOutReportDTO;
 import com.siwei.apply.domain.cadastre.LandStorageReportDTO;
-import com.siwei.apply.domain.cadastre.LandSupplyReportDTO;
 import com.siwei.apply.domain.res.StorageYearStatisticsRes;
 import com.siwei.apply.domain.res.TrendStatisticsData;
 import com.siwei.apply.domain.res.TrendStatisticsRes;
 import com.siwei.apply.domain.res.TrendUseStatisticsData;
 import com.siwei.apply.domain.vo.LandSupplyProjectVO;
-import com.siwei.apply.domain.vo.LandSupplyReportVO;
 import com.siwei.apply.service.cadastre.impl.StorageServiceImpl;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.web.controller.BaseController;
@@ -23,7 +21,6 @@ import javax.servlet.http.HttpServletResponse;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -198,7 +195,6 @@ public class StorageController extends BaseController {
 
 
 
-
     /**
      * 收储进度报表导出
      * @param response
@@ -599,6 +595,69 @@ public class StorageController extends BaseController {
     }
 
 
+    /**
+     *
+     * 收储文件上传入库
+     * 0 全量更新;1 增量更新
+     */
+    @PostMapping("/schedule/import")
+    public R<String> importSchedule(String shpFilePath,String sourceType,String addType) {
+        try {
+            Map<String, Object>  res = storageServiceImpl.importSchedule(shpFilePath,sourceType,addType);
+            return R.ok("success");
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+    @GetMapping("/schedule/list")
+    public  R<?> scheduleList(
+            @RequestParam(value = "sourceType") String sourceType,
+            @RequestParam(value = "pageNum", required = false) Integer pageNum,
+            @RequestParam(value = "pageSize", required = false) Integer pageSize) {
+        try {
+            startPage();
+            List<Map<String, Object>>  resList = storageServiceImpl.actualList("gj_shouchu_xiangmu",sourceType);
+            return R.ok(getDataTable(resList));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+
+    /**
+     *
+     * 收储文件上传入库
+     * 0 全量更新;1 增量更新
+     */
+    @PostMapping("/actual/import")
+    public R<String> importActual(String shpFilePath,String addType) {
+        try {
+            Map<String, Object>  res = storageServiceImpl.importActual(shpFilePath,addType);
+            return R.ok("success");
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
+
+
+    @GetMapping("/actual/list")
+    public  R<?> actualList(
+            @RequestParam(value = "pageNum", required = false) Integer pageNum,
+            @RequestParam(value = "pageSize", required = false) Integer pageSize) {
+        try {
+            startPage();
+            List<Map<String, Object>>  resList = storageServiceImpl.actualList("gj_shouchu_xiangmu_shiji","");
+            return R.ok(getDataTable(resList));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(e.getMessage());
+        }
+    }
 
 
 

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

@@ -86,7 +86,7 @@ public class OfferDataController extends BaseController {
 
 
     /**
-     * 接收推送的登簿状体数据
+     * 接收推送的登簿数据
      *
      * @param body
      * @return

+ 5 - 7
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/third/TakeDataController.java

@@ -57,7 +57,8 @@ public class TakeDataController extends BaseController {
             body.setYfbdcdyh("360122014004GB60018");
             body.setYwlx("1");
             body.setYwh("20251023145611");
-            Map<String, Object> map = takeDataService.remoteLandFirstRegistration(body);
+            //Map<String, Object> map = takeDataService.remoteLandFirstRegistration(body);
+            Map<String, Object> map = null;
             map.put("id", map.get("id"));
             return R.ok(map);
         } catch (Exception e) {
@@ -84,7 +85,8 @@ public class TakeDataController extends BaseController {
             body.setYwlx("2");
             body.setYwh("20251023145611");
 
-            Map<String, Object> map = takeDataService.remoteHouseFirstRegistration(body);
+            //Map<String, Object> map = takeDataService.remoteHouseFirstRegistration(body);
+            Map<String, Object> map = null;
 
             map.put("id", map.get("id"));
             return R.ok(map);
@@ -104,11 +106,7 @@ public class TakeDataController extends BaseController {
         String projectId = paramMap.get("projectId");
         String nodeTableName = paramMap.get("nodeTableName");
         if(StringUtils.isNotBlank(projectId) && StringUtils.isNotBlank(nodeTableName)){
-            if(AloneWorkFlowEnum.NODE_3.getTableName().equalsIgnoreCase(nodeTableName)){
-                takeDataService.syncLandNodeInfo(projectId,nodeTableName);
-            }else if(AloneWorkFlowEnum.NODE_7.getTableName().equalsIgnoreCase(nodeTableName)){
-                takeDataService.syncHouseNodeInfo(projectId,nodeTableName);
-            }
+            takeDataService.syncLandOrHouseNodeInfo(projectId,nodeTableName);
         }
         return R.ok("syncOneNode success");
     }

+ 15 - 68
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/HouseFirstParamVo.java

@@ -2,6 +2,7 @@ package com.siwei.apply.domain.vo;
 
 import lombok.Data;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -39,82 +40,27 @@ public class HouseFirstParamVo {
      */
     private String bdcdyh;
 
-    /**
-     * 权利人
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String qlr;
+    // 告知单盖章时间
+    private Date gzdgzsj;
 
-    /**
-     * 坐落位置
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String zl;
+    // 开发单位
+    private String kfdw;
 
-    /**
-     * 共有情况(如:共同共有)
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String gyqk;
+    // 不动产情况
+    private String bdcqk;
 
-    /**
-     * 权利类型(如:国有建设用地使用权)
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String qllx;
+    // 建筑面积
+    private String jzmj;
 
-    /**
-     * 权利性质(出让/划拨)
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String qlxz;
+    private String jzmjDw;         // 建筑面积单位
 
-    /**
-     * 土地用途
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String tdyt;
+    private String tnmj;           // 套内面积
 
-    /**
-     * 土地面积
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String tdmj;
+    private String tnmjDw;          // 套内面积单位
 
-    /**
-     * 土地面积单位
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String tdmjdw;
+    private String ftmj;           // 分摊面积
 
-    /**
-     * 不动产证件号
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String bdczh;
-
-    /**
-     * 登记机构
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String djjg;
-
-    /**
-     * 登记日期(如:2025-10-09)
-     * 必选: 是
-     * 业务类型: 业务
-     */
-    private String djrq;
+    private String ftmjDw;         // 分摊面积单位
 
     /**
      * 空间地块矢量图数据(EWKT格式)
@@ -123,6 +69,7 @@ public class HouseFirstParamVo {
      */
     private List<String> geoms;
 
+
     /**
      * 附件材料信息(zip或文档结构待定)
      * 必选: 是

+ 7 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/FwmxMapper.java

@@ -26,10 +26,17 @@ public interface FwmxMapper {
      */
     Fwmx getById(@Param("id") String id);
 
+
+    Fwmx getStatisticsByYwh(@Param("ywh") String ywh);
+
+
     /**
      * 更新房屋首次登记明细信息
      *
      * @param fwmxUpdateVo
      */
     void update(Fwmx fwmxUpdateVo);
+
+    void deleteByYwh(@Param("ywh") String ywh);
+
 }

+ 2 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GjShijiShouchuMapper.java

@@ -16,6 +16,8 @@ public interface GjShijiShouchuMapper {
 
     List<Map<String, Object>> getStatsByYearAndUse(@Param("year") String year);
 
+    List<Map<String, Object>> getCompleteStatsByMethod(@Param("year") String year);
+
     void add(GjShijiShouchu gjShijiShouchu);
 
     GjShijiShouchu get(@Param("gid") Integer gid);

+ 12 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GjShouchuJihuaMapper.java

@@ -19,4 +19,16 @@ public interface GjShouchuJihuaMapper {
     List<TdgyStatisticsRes> getPlanListByYear(@Param("year") String year,@Param("startYear") String startYear,@Param("endYear") String endYear, @Param("keyWord") String keyWord);
 
     Map<String, Object> getPlanProject(@Param("gid") String gid);
+
+
+    int insertTableData(@Param("tableName") String tableName, @Param("data") Map<String, Object> data, @Param("shpDbSRID") Integer shpDbSRID);
+
+    int deleteByTable(@Param("tableName") String tableName, @Param("gid") String gid,@Param("sourceType") String sourceType);
+
+    int insertTableActualData(@Param("tableName") String tableName, @Param("data") Map<String, Object> data, @Param("shpDbSRID") Integer shpDbSRID);
+
+
+    List<Map<String, Object>> actualList(@Param("tableName") String tableName,@Param("sourceType") String sourceType,@Param("year") String year);
+
+
 }

+ 6 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/GyjsydscdjMapper.java

@@ -31,6 +31,12 @@ public interface GyjsydscdjMapper {
      */
     Gyjsydscdj getById(@Param("id") String id);
 
+    /**
+     * 获取国有建设用地使用权首次登记信息(按主键ID)
+     */
+    Gyjsydscdj getBySourceId(@Param("sourceId") String sourceId);
+
+
     /**
      * 更新国有建设用地使用权首次登记信息
      *

+ 6 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/GyjsydscdjService.java

@@ -1,5 +1,6 @@
 package com.siwei.apply.service;
 
+import com.siwei.apply.domain.Gyjsydscdj;
 import com.siwei.apply.domain.res.GyjsydscdjRes;
 import com.siwei.apply.domain.res.GyjsydscdjSinglRes;
 import com.siwei.apply.domain.vo.GyjsydscdjUpdateVo;
@@ -35,6 +36,11 @@ public interface GyjsydscdjService {
      */
     GyjsydscdjSinglRes getById(String id);
 
+
+    Gyjsydscdj getBySourceId(String sourceId);
+
+
+
     /**
      * 更新国有建设用地使用权首次登记信息
      *

+ 1 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/CadastreManageServiceImpl.java

@@ -327,7 +327,7 @@ public class CadastreManageServiceImpl implements CadastreManageService {
                     } else if ("2".equals(fileType)) {//如果是mdb文件
                         String innerExtractFileName = FileExtractUtil.getInnerFileByDirName(unZipPath);
                         if (StringUtils.isBlank(innerExtractFileName)) {
-                            throw new ServiceException("可能入库失败或没有历史版本,无法回退");
+                            throw new ServiceException("处理文件并保存附件信息异常,压缩包内的文件格式不是mdb,请重新输入");
                         }
                         theFileName = innerExtractFileName;
                         if (StringUtils.isNotBlank(theFileName) && !theFileName.toLowerCase(Locale.ROOT).endsWith(".mdb")) {

+ 263 - 15
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/StorageServiceImpl.java

@@ -8,19 +8,43 @@ import com.siwei.apply.domain.vo.LandSupplyProjectVO;
 import com.siwei.apply.mapper.GjShijiShouchuMapper;
 import com.siwei.apply.mapper.GjShouchuJihuaMapper;
 import com.siwei.apply.mapper.TdgyMapper;
+import com.siwei.common.core.constant.SecurityConstants;
+import com.siwei.common.core.domain.R;
+import com.siwei.common.core.exception.ServiceException;
 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 org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
+@Slf4j
 @Service
 public class StorageServiceImpl {
 
+    /**
+     * gj_shouchu_xiangmu_shiji 表允许入库的字段白名单
+     * (除 gid / geom / create_time / update_time 外的全部业务列,外加 shp 读取时的 the_geom)
+     * shp 字段数量可能多于数据表字段,需通过白名单过滤多余字段
+     */
+    private static final Set<String> SHIJI_ALLOWED_COLUMNS = new HashSet<>(Arrays.asList(
+            "dabh", "scfs", "scjg", "scmj", "scnd", "scsj", "scwh",
+            "shape_area", "shape_leng", "tdzl", "wzfbck", "xzq", "yqsdw",
+            "ytdsyqxz", "ytdyt", "cblx", "htqdsj", "nf", "schtbh", "sczj",
+            "yqsxz", "yzfbck", "sccb", "mj_m", "xmmc", "ghyt", "jzwmj",
+            "jzwjj", "pggs", "tdpgjg", "jzwpgjg", "qyzcpg", "tctgss",
+            "zfjl", "bz", "the_geom"
+    ));
+
     @Autowired
     private GjShijiShouchuMapper gjShijiShouchuMapper;
 
@@ -31,6 +55,11 @@ public class StorageServiceImpl {
     private TdgyMapper tdgyMapper;
 
 
+    @Autowired
+    private RemoteSpatialFilesDbService remoteSpatialFilesDbService;
+
+
+
     public LandStorageInOutReportDTO inOutDetails() {
         LandStorageInOutReportDTO report = new LandStorageInOutReportDTO();
         report.setTitle("收储出入库分析报表");
@@ -223,14 +252,10 @@ public class StorageServiceImpl {
     }
 
 
-
     //统计分析
     public LandStorageReportDTO stroageProgress(String startYear, String endYear) {
         LandStorageReportDTO report = new LandStorageReportDTO();
 
-        startYear = "2025";
-        endYear = "2026";
-
         report.setTitle("收储进度分析报表");
         report.setStatTimeRange(startYear + " 至 " + endYear);
 
@@ -459,6 +484,7 @@ public class StorageServiceImpl {
         Map<String, Object> planSummary = gjShouchuJihuaMapper.getPlanSummaryByYear(year);
         List<TdgyStatisticsRes> completeList = gjShijiShouchuMapper.gjShijiShouchuListByYear(year, null, null, null, null, null);
         BigDecimal planArea = toBigDecimal(planSummary == null ? null : planSummary.get("plan_area"));
+        BigDecimal planCost = toBigDecimal(planSummary == null ? null : planSummary.get("plan_cost"));
         int planCount = toInteger(planSummary == null ? null : planSummary.get("plan_project_count"));
         BigDecimal completeArea = sumArea(completeList);
         int completeCount = CollectionUtils.isEmpty(completeList) ? 0 : completeList.size();
@@ -471,9 +497,10 @@ public class StorageServiceImpl {
         storageRate.setPlanArea(planArea.floatValue());
         storageRate.setCompleteArea(completeArea.floatValue());
         storageRate.setGdUnit("亩");
-        storageRate.setEstimatedCost(0f);
-        storageRate.setExpenditureCost(0f);
-
+        storageRate.setEstimatedCost(planCost.floatValue());
+        //完成成本
+        BigDecimal completeCost = sumCost(completeList);
+        storageRate.setExpenditureCost(completeCost.floatValue());
         res.setStorageRate(storageRate);
         res.setLandUseStatisticsList(buildLandUseStatistics(year));
         res.setProjectSupplyList(buildMethodStatistics(year));
@@ -589,16 +616,29 @@ public class StorageServiceImpl {
 
     private List<ProjectSupplyRes> buildMethodStatistics(String year) {
         List<Map<String, Object>> planStats = gjShouchuJihuaMapper.getPlanStatsByMethod(year);
+        List<Map<String, Object>> completeStats = gjShijiShouchuMapper.getCompleteStatsByMethod(year);
+        String[]  category = {"征收","收回","收购","其他"};
         List<ProjectSupplyRes> res = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(planStats)) {
+        for(String cate : category){
+            ProjectSupplyRes item = new ProjectSupplyRes();
+            item.setGdUnit("亩");
+            item.setGdType(cate);
+            item.setPlanArea(0f);
+            item.setCompleteArea(0f);
+
             for (Map<String, Object> stat : planStats) {
-                ProjectSupplyRes item = new ProjectSupplyRes();
-                item.setGdType(convertCategory(String.valueOf(stat.get("category"))));
-                item.setGdUnit("亩");
-                Float area = toBigDecimal(stat.get("plan_area")).floatValue();
-                item.setGdArea(area);
-                item.setPlanArea(area);
-                item.setCompleteArea(0f);
+                if(String.valueOf(stat.get("category")).equals(cate)){
+                    Float area = toBigDecimal(stat.get("plan_area")).floatValue();
+                    item.setPlanArea(area);
+                }
+            }
+            for (Map<String, Object> stat : completeStats) {
+                if(String.valueOf(stat.get("category")).equals(cate)){
+                    Float area = toBigDecimal(stat.get("complate_area")).floatValue();
+                    item.setCompleteArea(area);
+                }
+            }
+            if(item.getPlanArea()>0 || item.getCompleteArea()>0){
                 res.add(item);
             }
         }
@@ -623,6 +663,19 @@ public class StorageServiceImpl {
         return sum.setScale(2, RoundingMode.HALF_UP);
     }
 
+    private BigDecimal sumCost(List<TdgyStatisticsRes> list) {
+        BigDecimal sum = BigDecimal.ZERO;
+        if (CollectionUtils.isNotEmpty(list)) {
+            for (TdgyStatisticsRes item : list) {
+                sum = sum.add(item.getCost() == null ? BigDecimal.ZERO : item.getCost());
+            }
+        }
+        return sum.setScale(2, RoundingMode.HALF_UP);
+    }
+
+
+
+
     private Integer toRoundedInt(Object value) {
         return toBigDecimal(value).setScale(0, RoundingMode.HALF_UP).intValue();
     }
@@ -664,4 +717,199 @@ public class StorageServiceImpl {
             return 0;
         }
     }
+
+
+    public Map<String, Object> importSchedule(String shpFilePath,String sourceType , String addType) {
+        Map<String, Object> retMap = new LinkedHashMap<>();
+        if(StringUtils.isBlank(shpFilePath)){
+            throw new  ServiceException("文件不存在请重新上传!");
+        }
+        File file = new File(shpFilePath);
+        if (!file.exists()) {
+            throw new  ServiceException("文件不存在请重新上传!");
+        }
+
+
+        R<List<Map<String, Object>>> shpGeomResult  = remoteSpatialFilesDbService.readShpFile(shpFilePath, SecurityConstants.INNER);
+        List<Map<String, Object>> shpDataList = shpGeomResult.getData();
+        log.info("远程调用geom获取,返回结果:{}", shpDataList);
+
+        int count = 1;
+        for (Map<String, Object> shpData : shpDataList){
+            String sccb = shpData.get("sccb").toString();
+            String scnf = shpData.get("scnf").toString();
+            String scfs = shpData.get("scfs").toString();
+            String ghyt = shpData.get("ghyt").toString();
+            String mj_m = shpData.get("mj_m").toString();
+            if(StringUtils.isBlank(sccb)|| StringUtils.isBlank(scfs) ||StringUtils.isBlank(scnf) || StringUtils.isBlank(ghyt) || StringUtils.isBlank(mj_m)){
+                throw new  ServiceException("关键字段不能为空(sccb,scnf,scfs,ghyt,mj_m),请检查第"+count+"条数据");
+            }
+            count++;
+        }
+
+
+        if("0".equals(addType)){
+            //这里把当前表清空,重新写入;
+            gjShouchuJihuaMapper.deleteByTable("gj_shouchu_xiangmu","",sourceType);
+        }
+
+        // 收储项目表 geom 列的 SRID(参考建表语句 vector.gj_shouchu_xiangmu)
+        int shpDbSRID = 4326;
+        // 日期字段:shp 读取出来是 ISO8601 字符串(例如 2025-12-24T00:00:00.000+08:00),入库仅保留到 "T" 之前
+        Set<String> dateFields = new HashSet<>(Arrays.asList("scsj", "ngysj", "qdrq"));
+        // 数值字段:建表语句中为 numeric(18,4)
+        Set<String> numericFields = new HashSet<>(Arrays.asList(
+                "sccb", "mj_m", "jhxzmj", "yscmj", "bndscmj", "bndkfmj", "ngymj", "yjgysr", "mj_12"));
+
+        for (Map<String, Object> shpData : shpDataList) {
+            Map<String, Object> insertData = new LinkedHashMap<>();
+            for (Map.Entry<String, Object> e : shpData.entrySet()) {
+                String key = e.getKey();
+                Object val = e.getValue();
+                if (val == null) {
+                    continue;
+                }
+                // 字符串做一次清洗:空白置为 null
+                if (val instanceof String) {
+                    String s = ((String) val).trim();
+                    if (s.isEmpty()) {
+                        continue;
+                    }
+                    if (dateFields.contains(key)) {
+                        int t = s.indexOf('T');
+                        if (t > 0) {
+                            s = s.substring(0, t);
+                        }
+                        insertData.put(key, s);
+                        continue;
+                    }
+                    if (numericFields.contains(key)) {
+                        try {
+                            insertData.put(key, new BigDecimal(s));
+                        } catch (NumberFormatException ex) {
+                            log.warn("字段 {} 数值转换失败,原值:{}", key, s);
+                        }
+                        continue;
+                    }
+                    insertData.put(key, s);
+                } else {
+                    insertData.put(key, val);
+                }
+            }
+            if (MapUtils.isEmpty(insertData)) {
+                continue;
+            }
+            //区分收储和转接
+            if(sourceType.equals("0")){
+                insertData.put("source_type","0");
+            }else {
+                insertData.put("source_type","1");
+            }
+            gjShouchuJihuaMapper.insertTableData(
+                    "gj_shouchu_xiangmu", insertData, shpDbSRID);
+        }
+        retMap.put("status","success");
+        retMap.put("path",shpFilePath);
+        return retMap;
+    }
+
+
+
+    //导入实际的数据
+    public Map<String, Object> importActual(String shpFilePath,String addType) {
+        Map<String, Object> retMap = new LinkedHashMap<>();
+        if(StringUtils.isBlank(shpFilePath)){
+            throw new  ServiceException("文件不存在请重新上传!");
+        }
+        File file = new File(shpFilePath);
+        if (!file.exists()) {
+            throw new  ServiceException("文件不存在请重新上传!");
+        }
+
+        R<List<Map<String, Object>>> shpGeomResult  = remoteSpatialFilesDbService.readShpFile(shpFilePath, SecurityConstants.INNER);
+        List<Map<String, Object>> shpDataList = shpGeomResult.getData();
+        log.info("远程调用geom获取,返回结果:{}", shpDataList);
+
+        //数据字段进行校验
+        int count = 1;
+        for (Map<String, Object> shpData : shpDataList){
+//            String scfs = shpData.get("scfs").toString();
+            String scnd = shpData.get("scnd").toString();
+//            String sccb = shpData.get("sccb").toString();
+            String mj_m = shpData.get("mj_m").toString();
+//            String ghyt = shpData.get("ghyt").toString();
+//            if(StringUtils.isBlank(sccb)|| StringUtils.isBlank(scfs) ||StringUtils.isBlank(scnd) || StringUtils.isBlank(ghyt) || StringUtils.isBlank(mj_m)){
+//                throw new  ServiceException("关键字段不能为空(sccb,scnd,scfs,ghyt,mj_m),请检查第"+count+"条数据");
+//            }
+            if(StringUtils.isBlank(mj_m)){
+                throw new  ServiceException("关键字段不能为空(mj_m),请检查第"+count+"条数据");
+            }
+            if(StringUtils.isBlank(scnd)){
+                throw new  ServiceException("关键字段不能为空(scnd),请检查第"+count+"条数据");
+            }
+            count++;
+        }
+        if("0".equals(addType)){
+            //这里把当前表清空,重新写入;
+            gjShouchuJihuaMapper.deleteByTable("gj_shouchu_xiangmu_shiji","","");
+        }
+
+        // 实际收储项目表 gj_shouchu_xiangmu_shiji geom 列的 SRID(建表语句中为 geometry(MULTIPOLYGON, 4326))
+        int shpDbSRID = 4326;
+        // 日期字段(shp 读取出来是 ISO8601 字符串,如 2025-12-24T00:00:00.000+08:00):
+        // 该表对应字段均为 varchar(100),为避免脏数据,统一截取 "T" 之前部分入库
+        Set<String> dateFields = new HashSet<>(Arrays.asList("scsj", "htqdsj"));
+        // 该表除 gid、geom、create_time、update_time 外,其余字段均为 varchar(100),
+        // 无需做 numeric 转换,仅做字符串清洗即可
+
+        for (Map<String, Object> shpData : shpDataList) {
+            Map<String, Object> insertData = new LinkedHashMap<>();
+            for (Map.Entry<String, Object> e : shpData.entrySet()) {
+                String key = e.getKey();
+                // shp 字段数量可能多于数据表字段,通过白名单过滤多余字段
+                if (!SHIJI_ALLOWED_COLUMNS.contains(key)) {
+                    continue;
+                }
+                Object val = e.getValue();
+                if (val == null) {
+                    continue;
+                }
+                if (val instanceof String) {
+                    String s = ((String) val).trim();
+                    if (s.isEmpty()) {
+                        continue;
+                    }
+                    if (dateFields.contains(key)) {
+                        int t = s.indexOf('T');
+                        if (t > 0) {
+                            s = s.substring(0, t);
+                        }
+                        insertData.put(key, s);
+                        continue;
+                    }
+                    insertData.put(key, s);
+                } else {
+                    insertData.put(key, val);
+                }
+            }
+            if (MapUtils.isEmpty(insertData)) {
+                continue;
+            }
+            gjShouchuJihuaMapper.insertTableActualData(
+                    "gj_shouchu_xiangmu_shiji", insertData, shpDbSRID);
+        }
+        retMap.put("status", "success");
+        retMap.put("path", shpFilePath);
+        return retMap;
+    }
+
+
+    //导入实际的数据
+    public List<Map<String, Object>> actualList(String tableName,String sourceType) {
+        List<Map<String, Object>> actualList = gjShouchuJihuaMapper.actualList(tableName,sourceType,"");
+        return actualList;
+    }
+
+
+
 }

+ 7 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/GyjsydscdjImpl.java

@@ -115,6 +115,13 @@ public class GyjsydscdjImpl implements GyjsydscdjService {
         return res;
     }
 
+    @Override
+    public Gyjsydscdj getBySourceId(String sourceId) {
+        Gyjsydscdj item = gyjsydscdjMapper.getBySourceId(sourceId);
+        return item;
+    }
+
+
     @Override
     public void update(GyjsydscdjUpdateVo gyjsydscdjUpdateVo) {
         gyjsydscdjMapper.update(gyjsydscdjUpdateVo);

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

@@ -1951,11 +1951,11 @@ public class ProjectImpl implements ProjectService {
     public void addPreAssignCode(String nodeId,String projectId,String geomDbId,Integer validFlag) throws RuntimeException {
         /*
          *  1.获取当前节点3个地块。
-         *  2.分别对当前三个地块进行赋码
-         *  3.赋码过程,先查找当前项目内,是否有相同geomId ,及detailsId的号,如果有,直接赋码。
-         *  4.如果没有,则查找当前项目中所有地块,查找相同的地形的直接赋码。
-         *  5.如果仍然没有,则进行地块的三方去获取数据
-         *  6.需要修改三方的接口,只支持一个地块detailsId 传递,和获取区号。
+         *  2.遍历分别对当前三个地块进行赋码
+         *  3.赋码过程:先查找当前项目内,是否有相同geomId ,detailsId的条目,如果有,判定同一块地,直接赋码。
+         *  4.如果没有,则查找当前项目中所有地块,使用图形比较函数确定是否一块地,查找到相同的地块的直接赋码。
+         *  5.如果仍然没有,则进行接口调用三方数据去获取序列号进行赋码
+         *  6.注意点:一次处理一个节点的所有地块,批量赋码
          */
         List<Map<String,String>>  currentNodeDetailsList =  nodeLandService.selectTGeomDbDetailsByNodeId(nodeId);
         if (CollectionUtils.isNotEmpty(currentNodeDetailsList)) {

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

@@ -1,8 +1,6 @@
 package com.siwei.apply.service.third;
 
 import com.siwei.apply.domain.NodeAttachment;
-import com.siwei.apply.domain.vo.HouseFirstParamVo;
-import com.siwei.apply.domain.vo.LandFirstParamVo;
 import com.siwei.apply.domain.vo.ThirdProjectParamVo;
 import com.siwei.apply.domain.vo.ThirdRecordStatusParamVo;
 
@@ -22,7 +20,6 @@ public interface OfferDataService {
      */
     Map<String,String> get(String projectId);
 
-
     /**
      *
      */
@@ -32,10 +29,6 @@ public interface OfferDataService {
 
     NodeAttachment getThirdNodeAttachment(String preImmobileCode, String projectId, String dqjd) throws Exception;
 
-    Map<String, Object> landFirstRegistration(LandFirstParamVo body);
-
-    Map<String, Object> houseFirstRegistration(HouseFirstParamVo body);
-
     List<Map<String, Object>> landSupplyAndProjectList(ThirdProjectParamVo body) ;
 
     Map<String, Object> addRecordStatusData(ThirdRecordStatusParamVo body);

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

@@ -34,9 +34,9 @@ public interface TakeDataService {
 
     Map<String, Object> remoteHouseFirstRegistration(ThirdRecordStatusParamVo paramVo);
 
-    void syncLandNodeInfo(String projectId,String nodeTableName);
+    void syncLandOrHouseNodeInfo(String projectId,String nodeTableName);
 
-    void syncHouseNodeInfo(String projectId,String nodeTableName);
+    //void syncHouseNodeInfo(String projectId,String nodeTableName);
 
     void syncRemoteData(ThirdRecordStatusParamVo body);
 

+ 3 - 116
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/OfferDataServiceImpl.java

@@ -26,15 +26,11 @@ import lombok.extern.slf4j.Slf4j;
 
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
+
 import java.util.stream.Collectors;
 
 
@@ -169,11 +165,9 @@ public class OfferDataServiceImpl implements OfferDataService {
         if (StringUtils.isBlank(ywh)) {
             throw new ServiceException("业务号为空");
         }
-
         log.info("登簿数据校验通过开始入库: {}" , JSON.toJSONString(body));
-
         String id="";
-        String tbztFlag;
+        String tbztFlag="0";
         // 入库:以 yfbdcdyh 或 ywh 及 ywlx 判重,已存在则按主键覆盖更新,避免重复插入
         ThirdRecordStatusParamVo existing = thirdRecordStatusMapper.selectByYfbdcdyhAndYwhAndYwlx(yfbdcdyh, ywh, ywlx);
         if (existing != null) {
@@ -183,9 +177,8 @@ public class OfferDataServiceImpl implements OfferDataService {
         } else {
             id = IdUtils.fastSimpleUUID();
             body.setId(id);
-            body.setTbzt("0");
+            body.setTbzt(tbztFlag);
             thirdRecordStatusMapper.insert(body);
-            tbztFlag = "0";
         }
         log.info("登簿数据入库成功: {}" , id);
         if("0".equals(tbztFlag)) {
@@ -197,117 +190,11 @@ public class OfferDataServiceImpl implements OfferDataService {
         return map;
     }
 
-    @Override
-    public Map<String, Object> landFirstRegistration(LandFirstParamVo body) {
-        String yfbdcdyh = body.getYfbdcdyh();
-        if (StringUtils.isBlank(yfbdcdyh)) {
-            throw new ServiceException("预分不动产单元号为空");
-        }
-        String ywbh = body.getYwbh();
-        if (StringUtils.isBlank(ywbh)) {
-            throw new ServiceException("业务编号为空");
-        }
-        List<String> geomsList = body.getGeoms();
-        if (CollectionUtils.isEmpty(geomsList)) {
-            throw new ServiceException("geom信息为空");
-        }
-        //todo 这里进行文件下载入库:
-
-        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 (StringUtils.isNotBlank(body.getTdmj())) {
-                gyjsydscdjVo.setArea(Float.valueOf(body.getTdmj()));
-            }
-            gyjsydscdjVo.setAreaUnit(body.getTdmjdw());
-            gyjsydscdjVo.setBdcdyh(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("调用矢量保存文件错误,业务编号:{}: ", ywbh);
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-
-    @Override
-    public Map<String, Object> houseFirstRegistration(HouseFirstParamVo body) {
-        String yfbdcdyh = body.getYfbdcdyh();
-        if (StringUtils.isBlank(yfbdcdyh)) {
-            throw new ServiceException("预分不动产单元号为空");
-        }
-        String ywbh = body.getYwbh();
-        if (StringUtils.isBlank(ywbh)) {
-            throw new ServiceException("业务编号为空");
-        }
-        List<String> geomsList = body.getGeoms();
-        if (CollectionUtils.isEmpty(geomsList)) {
-            throw new ServiceException("geom信息为空");
-        }
-        //todo 这里进行文件下载入库:
-        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();
-        }
-        return null;
-    }
-
-
     @Override
     public String getTheFile(String attachmentId, String dirName, String fileName) {
         String fileAndPath = "";
         NodeAttachment nodeAttachment = nodeAttachmentService.getById(attachmentId);
         nodeAttachment = nodeAttachmentService.getNodeAttachmentData(nodeAttachment.getNodeId(), null);
-
         if (Objects.nonNull(nodeAttachment)) {
             List<Map<String, String>> fileList = ServiceUtil.getDirChildrenList(dirName, nodeAttachment);
             if (Objects.nonNull(fileList)) {

+ 176 - 73
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/TakeDataServiceImpl.java

@@ -3,9 +3,7 @@ package com.siwei.apply.service.third.impl;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
 import com.siwei.apply.domain.*;
-import com.siwei.apply.domain.res.GyjsydjfwscdjSinglRes;
-import com.siwei.apply.domain.res.GyjsydscdjRes;
-import com.siwei.apply.domain.res.GyjsydscdjSinglRes;
+
 import com.siwei.apply.domain.vo.*;
 import com.siwei.apply.enums.AloneWorkFlowEnum;
 
@@ -18,8 +16,8 @@ import com.siwei.apply.service.third.TakeDataService;
 import com.siwei.apply.utils.HttpClientUtil;
 import com.siwei.apply.utils.ServiceUtil;
 import com.siwei.common.core.exception.ServiceException;
-import com.siwei.common.core.utils.DateUtils;
 import com.siwei.common.core.utils.StringUtils;
+import com.siwei.common.core.utils.bean.BeanUtils;
 import com.siwei.spatial.api.RemoteSpatialFilesDbService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -71,6 +69,9 @@ public class TakeDataServiceImpl implements TakeDataService {
     @Autowired
     private ThirdRecordStatusMapper thirdRecordStatusMapper;
 
+    @Autowired
+    private FwmxMapper fwmxMapper;
+
 
 
     @Override
@@ -81,19 +82,24 @@ public class TakeDataServiceImpl implements TakeDataService {
 
 
 
-
     /**
-     * 同步土地首次登记数据
+     * 同步土地或房屋首次登记数据
      * @param projectId
      * @param nodeTableName
      */
     @Override
-    public void syncLandNodeInfo(String projectId,String nodeTableName) {
+    public void syncLandOrHouseNodeInfo(String projectId,String nodeTableName) {
         Project project = projectMapper.get(projectId);
         if (Objects.isNull(project) || StringUtils.isBlank(project.getId())) {
             throw new ServiceException("当前项目不具备同步条件,请检查项目代码是否存在");
         }
-        List<ThirdRecordStatusParamVo> syncRecordList =  thirdRecordStatusMapper.selectByProjectIdAndType(projectId,"2");
+        String ywlx = "0";
+        if(AloneWorkFlowEnum.NODE_3.getTableName().equalsIgnoreCase(nodeTableName)){
+            ywlx = "2"; //土地
+        }else if(AloneWorkFlowEnum.NODE_7.getTableName().equalsIgnoreCase(nodeTableName)){
+            ywlx = "1";
+        }
+        List<ThirdRecordStatusParamVo> syncRecordList =  thirdRecordStatusMapper.selectByProjectIdAndType(projectId,ywlx);
         if (CollectionUtils.isEmpty(syncRecordList)) {
             throw new ServiceException("当前项目不具备同步条件,检查不动产是否已推送完成数据");
         }
@@ -105,27 +111,26 @@ public class TakeDataServiceImpl implements TakeDataService {
 
 
 
-    /**
-     * 同步房屋首次登记数据
-     * @param projectId
-     * @param nodeTableName
-     */
-    @Override
-    public void syncHouseNodeInfo(String projectId,String nodeTableName) {
-        Project project = projectMapper.get(projectId);
-        if (Objects.isNull(project) || StringUtils.isBlank(project.getCode())) {
-            throw new ServiceException("当前项目不具备同步条件,请检查项目代码是否存在");
-        }
-
-        List<Object> constructList = null;
-        if (CollectionUtils.isEmpty(constructList)) {
-            return;
-        }
-        //todo 这里最多支持8条数据
-        if (constructList.size() > 8) {
-            constructList = constructList.subList(0, 8);
-        }
-    }
+//    /**
+//     * 同步房屋首次登记数据
+//     * @param projectId
+//     * @param nodeTableName
+//     */
+//    @Override
+//    public void syncHouseNodeInfo(String projectId,String nodeTableName) {
+//        Project project = projectMapper.get(projectId);
+//        if (Objects.isNull(project) || StringUtils.isBlank(project.getId())) {
+//            throw new ServiceException("当前项目不具备同步条件,请检查项目代码是否存在");
+//        }
+//        List<ThirdRecordStatusParamVo> syncRecordList =  thirdRecordStatusMapper.selectByProjectIdAndType(projectId,"1");
+//        if (CollectionUtils.isEmpty(syncRecordList)) {
+//            throw new ServiceException("当前项目不具备同步条件,检查不动产是否已推送完成数据");
+//        }
+//        for(ThirdRecordStatusParamVo  paramVo : syncRecordList){
+//            //这里调用相关同步方法
+//            syncRemoteData(paramVo);
+//        }
+//    }
 
 
 
@@ -226,7 +231,6 @@ public class TakeDataServiceImpl implements TakeDataService {
 
 
 
-
     /**
      * 远程获取国有建设用地使用权首次登记数据
      * 并且入库
@@ -251,22 +255,28 @@ public class TakeDataServiceImpl implements TakeDataService {
         //todo 这里进行远程请求,获取相关数据,解析后入库
         try {
             Map<String,Object> paramMap = new LinkedHashMap<>();
-            paramMap.put("ywbh","12345");
-            paramMap.put("yfbdcdyh",yfbdcdyh);
+            paramMap.put("ywbh","20260602500601");
+            paramMap.put("yfbdcdyh","360122014005GB60012");
             String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.landRegist.datas",paramMap);
             JSONObject root = JSON.parseObject(remoteResult);
-            JSONObject innerData = root.getJSONObject("data").getJSONObject("data");
+            //todo 这里需要确认用户返回的是数组还是对象
+            JSONObject innerData = (JSONObject) root.getJSONObject("data").getJSONArray("data").get(0);
+
             LandFirstParamVo body = JSON.parseObject(innerData.toString(), LandFirstParamVo.class);
             if(Objects.nonNull(body)){
                 ProjectImmobileCode immobileCodeRes = projectImmobileCodeMapper.selectByPreAssignCode(yfbdcdyh);
                 if (Objects.isNull(immobileCodeRes)) {
                     throw new ServiceException("检查预赋不动产单元号是否正确");
                 }
-                //todo  这里根据 sourceId 确认是修改还是新增
+                //todo 这里需要确认是否返回ywh字段
+                if(StringUtils.isBlank(body.getYwbh())){
+                    body.setYwbh("20260602500601");
+                }
+
                 String needUpdateNodeId = "";
                 String projectId = immobileCodeRes.getProjectId();
                 String sourceId = body.getYwbh();
-                Gyjsydjfwscdj existsNode = gyjsydjfwscdjService.getBySourceId(sourceId);//todo 这里需要根据sourceId 检查
+                Gyjsydscdj existsNode = gyjsydscdjService.getBySourceId(sourceId);//这里需要根据sourceId 检查
                 if(Objects.nonNull(existsNode)){
                     needUpdateNodeId = existsNode.getId();
                 }
@@ -275,6 +285,7 @@ public class TakeDataServiceImpl implements TakeDataService {
                 if(Objects.nonNull(body.getAttachment()) && !body.getAttachment().isEmpty()){
                     nodeAttachmentService.getThirdAttachment(projectId,addNodeId,AloneWorkFlowEnum.NODE_3.getName(),body.getAttachment());
                 }
+                retMap.put("nodeId",addNodeId);
             }
         } catch (Exception e) {
             log.error("调用矢量保存文件错误,业务编号:{}: ", ywh);
@@ -299,7 +310,7 @@ public class TakeDataServiceImpl implements TakeDataService {
 
             //土地用途转化
             if (StringUtils.isNotBlank(body.getTdyt())) {
-                String code = null; //todo 转化
+                String code = this.getTdytCodeByName(body.getTdyt());
                 gyjsydscdjUpdateVo.setTdyt(code);
             }
             if (StringUtils.isNotBlank(body.getTdmj())) {
@@ -344,9 +355,54 @@ public class TakeDataServiceImpl implements TakeDataService {
 
 
 
-
-
-
+    public String  addOrUpdateHouseFirstRegistration(HouseFirstParamVo body,String projectId,String needUpdateNodeId) {
+        String addNodeId = "";
+        if (StringUtils.isNotBlank(needUpdateNodeId)) {
+            GyjsydjfwscdjUpdateVo gyjsydjfwscdjUpdateVo = new GyjsydjfwscdjUpdateVo();
+            gyjsydjfwscdjUpdateVo.setId(needUpdateNodeId); //修改设置id
+            gyjsydjfwscdjUpdateVo.setProjectId(projectId);
+            gyjsydjfwscdjUpdateVo.setYwh(body.getYwbh());
+//            if(StringUtils.isNotBlank(body.getGzdgzsj())){
+//                Date djDate = DateUtils.parseDate(body.getGzdgzsj());
+//                gyjsydjfwscdjUpdateVo.setGzdgzsj(djDate);//告知单时间
+//            }
+            gyjsydjfwscdjUpdateVo.setGzdgzsj(body.getGzdgzsj());//告知单时间
+            gyjsydjfwscdjUpdateVo.setKfdw(body.getKfdw());
+            gyjsydjfwscdjUpdateVo.setBdcqk(body.getBdcqk()); //不动产情况
+            gyjsydjfwscdjUpdateVo.setJzmj(body.getJzmj()); //建筑面积
+            gyjsydjfwscdjUpdateVo.setJzmjDw(body.getJzmjDw());//建筑面积单位
+            gyjsydjfwscdjUpdateVo.setTnmj(body.getTnmj());
+            gyjsydjfwscdjUpdateVo.setTnmjDw(body.getTnmjDw());
+            gyjsydjfwscdjUpdateVo.setFtmj(body.getFtmj());
+            gyjsydjfwscdjUpdateVo.setFtmjDw(body.getFtmjDw());
+            gyjsydjfwscdjUpdateVo.setBz("");//备注
+            gyjsydjfwscdjUpdateVo.setSourceId(body.getYwbh());
+            gyjsydjfwscdjService.update(gyjsydjfwscdjUpdateVo);
+            addNodeId = needUpdateNodeId;
+        }else{
+            GyjsydjfwscdjVo gyjsydjfwscdjVo = new GyjsydjfwscdjVo();
+            gyjsydjfwscdjVo.setProjectId(projectId);
+            gyjsydjfwscdjVo.setYwh(body.getYwbh());
+//            if(StringUtils.isNotBlank(body.getGzdgzsj())){
+//                Date djDate = DateUtils.parseDate(body.getGzdgzsj());
+//                gyjsydjfwscdjVo.setGzdgzsj(djDate);//告知单时间
+//            }
+            gyjsydjfwscdjVo.setGzdgzsj(body.getGzdgzsj());//告知单时间
+            gyjsydjfwscdjVo.setKfdw(body.getKfdw());
+            gyjsydjfwscdjVo.setBdcqk(body.getBdcqk()); //不动产情况
+            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("");//备注
+            gyjsydjfwscdjVo.setSourceId(body.getYwbh());
+            String nodeId = gyjsydjfwscdjService.add(gyjsydjfwscdjVo);
+            addNodeId = nodeId;
+        }
+        return addNodeId;
+    }
 
 
     @Override
@@ -368,59 +424,108 @@ public class TakeDataServiceImpl implements TakeDataService {
             throw new ServiceException("业务类型为空");
         }
         Map<String, Object> retMap = new HashMap<>();
-
         //todo 这里进行远程请求,获取相关数据,解析后入库
+        /**
+         * 1.获取关于附件信息。
+         * 2.先去创建节点。
+         * 3.如果已经存在当前业务号的数据呢?进行修改。
+         */
         try {
             Map<String,Object> paramMap = new LinkedHashMap<>();
-            paramMap.put("ywbh","");
-            //paramMap.put("bdcdyh",yfbdcdyh);
-            paramMap.put("bdcdyh",bdcdyh);
-            String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.houseRegist.datas",paramMap);
+            paramMap.put("ywbh",ywh);
+            String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.houseRegist.datas222",paramMap);
             JSONObject root = JSON.parseObject(remoteResult);
+            //todo 这里需要确认返回数据是否是array结构
             JSONObject innerData = root.getJSONObject("data").getJSONObject("data");
             HouseFirstParamVo body = JSON.parseObject(innerData.toString(), HouseFirstParamVo.class);
-
             if(Objects.nonNull(body)) {
                 ProjectImmobileCode immobileCodeRes = projectImmobileCodeMapper.selectByPreAssignCode(yfbdcdyh);
                 if (Objects.isNull(immobileCodeRes)) {
                     throw new ServiceException("检查预赋不动产单元号是否正确");
                 }
                 String projectId = immobileCodeRes.getProjectId();
-                GyjsydjfwscdjVo gyjsydjfwscdjVo = new GyjsydjfwscdjVo();
-
-                gyjsydjfwscdjVo.setProjectId(projectId);
-                gyjsydjfwscdjVo.setYwh(body.getYwbh());
-
-                if(StringUtils.isNotBlank(body.getDjrq())){
-                    Date djDate = DateUtils.parseDate(body.getDjrq());
-                    gyjsydjfwscdjVo.setGzdgzsj(djDate);//告知单时间
+                String sourceId = body.getYwbh();
+                String addNodeId = "";
+                Gyjsydjfwscdj existsNode = gyjsydjfwscdjService.getBySourceId(sourceId);//这里需要根据sourceId 检查已经存在
+                if(Objects.nonNull(existsNode)){ //如果已经存在不做处理
+                    addNodeId = existsNode.getId();
+                }else  {
+                    addNodeId = addOrUpdateHouseFirstRegistration(body,projectId,"");
                 }
-                gyjsydjfwscdjVo.setKfdw(body.getQlr());
-                gyjsydjfwscdjVo.setBdcqk(""); //不动产情况
-
-                gyjsydjfwscdjVo.setJzmj(body.getTdmj()); //建筑面积
-                gyjsydjfwscdjVo.setJzmjDw(body.getTdmjdw());//建筑面积单位
-                gyjsydjfwscdjVo.setTnmj(body.getTdmj());
-                gyjsydjfwscdjVo.setTnmjDw(body.getTdmjdw());
-                gyjsydjfwscdjVo.setFtmj("0");
-                gyjsydjfwscdjVo.setFtmjDw(body.getTdmjdw());
-                gyjsydjfwscdjVo.setBz("");//备注
-                gyjsydjfwscdjVo.setSourceId(ywh);
-                String nodeId = gyjsydjfwscdjService.add(gyjsydjfwscdjVo);
-                retMap.put("id", nodeId);
                 //这里保存附件信息
+                // todo 这里的附件下载,为了性能考虑,是否要放在最后面
                 if(Objects.nonNull(body.getAttachment()) && !body.getAttachment().isEmpty()){
-                    nodeAttachmentService.getThirdAttachment(projectId,nodeId,AloneWorkFlowEnum.NODE_7.getName(),body.getAttachment());
+                    nodeAttachmentService.getThirdAttachment(projectId,addNodeId,AloneWorkFlowEnum.NODE_7.getName(),body.getAttachment());
                 }
+                retMap.put("projectId",projectId);
+                retMap.put("nodeId",addNodeId);
             }
-            return retMap;
         } catch (Exception e) {
-            log.error("调用矢量保存文件错误,业务号:{}: ", ywh);
+            log.error("调用不动产获取附件信息错误,业务号:{}: ", ywh);
             e.printStackTrace();
         }
-        return null;
-    }
 
+        // 第二部分,同步房屋的明细数据入库:
+        try {
+            //todo 这里需要同步房屋明细数据
+            // 同步完成后再次修改更新当前节点数据。把统计信息更新到数据表中。
+            // todo 这里需要分页进行查询,并且把数据都同步完毕。
+            // 既然开启了同步,需要把当前业务号的数据进行删除。
+            // 数据同步完成后,再计算统计数据,然后修改主表数据。
+            if(MapUtils.isNotEmpty(retMap)){
+                //同步前先删除
+                fwmxMapper.deleteByYwh(ywh);
+                Integer totalNum = 0;
+                Integer currentNum = 0;
+                Integer pageNumber = 1;
+                int pageSize = 20;
+                do{
+                    Map<String,Object> paramMap = new LinkedHashMap<>();
+                    paramMap.put("ywbh",ywh);
+                    paramMap.put("yfbdcdyh",yfbdcdyh);
+                    paramMap.put("pageNumber",pageNumber);
+                    paramMap.put("pageSize",pageSize);
+                    String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.houseRegist.datas333",paramMap);
+                    JSONObject root = JSON.parseObject(remoteResult);
+                    //todo 这里需要确认返回数据是否是array结构
+                    JSONObject innerData = root.getJSONObject("data").getJSONObject("data");
+                    if(Objects.nonNull(innerData.get("total")) && totalNum == 0){
+                        totalNum = (Integer) innerData.get("total");//获取总条数
+                    }
+                    FwmxVo body = JSON.parseObject(innerData.toString(), FwmxVo.class);
+                    if(Objects.nonNull(body)) {
+                        Fwmx fwmx = new Fwmx();
+                        fwmx.generateId();
+                        BeanUtils.copyProperties(body, fwmx);
+                        fwmxMapper.add(fwmx);
+                    }
+                    pageNumber++;
+                    //todo 这里是否需要考虑不满20条情况
+                    currentNum += pageSize;
+                }while (totalNum > currentNum);
+                //这里再次查询明细,并更新主表
+                Fwmx statisticsData = fwmxMapper.getStatisticsByYwh(ywh);
+                //这边直接更新当前数据
+                if(Objects.nonNull(statisticsData)){
+                    HouseFirstParamVo body = new HouseFirstParamVo();
+                    body.setYwbh(statisticsData.getYwh()); //todo 这里的业务号不一定等于房屋中的业务号ywh
+                    body.setGzdgzsj(statisticsData.getGzdgzsj());
+                    body.setKfdw(statisticsData.getKfdw());
+                    body.setBdcqk(statisticsData.getBdcqk());
+                    body.setJzmj(statisticsData.getJzmj());
+                    body.setJzmjDw(statisticsData.getMjdw());
+                    body.setFtmj(statisticsData.getFtmj());
+                    body.setTnmjDw(statisticsData.getMjdw());
+                    body.setFtmj(statisticsData.getFtmj());
+                    body.setFtmjDw(statisticsData.getMjdw());
+                    addOrUpdateHouseFirstRegistration(body,retMap.get("projectId").toString(),retMap.get("nodeId").toString());
+                }
+            }
+        }catch (Exception e) {
+                log.error("调用不动产获取明细信息错误,业务号:{}: ", ywh);
+        }
+        return retMap;
+    }
 
     /**
      * 通过土地用途名称获取土地的编码
@@ -441,7 +546,6 @@ public class TakeDataServiceImpl implements TakeDataService {
         return code;
     }
 
-
     /**
      * 根据登簿数据同步不动产数据
      * 异步执行
@@ -478,7 +582,6 @@ public class TakeDataServiceImpl implements TakeDataService {
             return null;
         });
 
-
     }
 
 

+ 0 - 5
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/utils/ServiceUtil.java

@@ -213,15 +213,12 @@ public class ServiceUtil {
         // 3. 组装业务数据
         Map<String, Object> dataMap = new HashMap<>(4);
         dataMap.putAll(paramMap);
-//        dataMap.put("ywbh", "");
-//        dataMap.put("bdcdyh", "360122011006GB00318F00010001");
 
         // 4. 对象转 JSON ->  公钥加密  -> URLEncode
         ObjectMapper mapper = new ObjectMapper();
         String json = mapper.writeValueAsString(dataMap);
         logger.info("入参:{} ", json);
         String encrypted = encryptByPublicKey(publicKey, json);
-        //System.out.println("密文: " + encrypted);
         logger.info("密文:{} ", encrypted);
         String payload = encrypted;
 
@@ -239,11 +236,9 @@ public class ServiceUtil {
 
         // 7. 使用HttpClientUtil 发起远程POST请求
         String resp = HttpClientUtil.doPostJson(THIRD_API_DOMAIN+THIRD_API_BASE_URL, payload, headers);
-        //System.out.println("响应原文: " + resp);
         logger.info("响应原文:{} ", resp);
         // 8. 用我方私钥解密响应密文
         String plain = decryptByPrivateKey(privateKey, resp);
-        //System.out.println("响应解密明文: " + plain);
         logger.info("响应解密明文:{} ", plain);
         return plain;
     }

+ 26 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/FwmxMapper.xml

@@ -46,6 +46,24 @@
         WHERE id = #{id}
     </select>
 
+
+    <select id="getStatisticsByYwh" resultMap="FwmxResultMap" parameterType="String">
+        SELECT
+        MIN ( ywh ) AS ywh,
+        MIN ( gzdgzsj ) AS gzdgzsj,
+        MIN ( kfdw ) AS kfdw,
+        MIN ( bdcqk ) AS bdcqk,
+        MIN ( mjdw ) AS mjdw,
+        SUM ( jzmj :: NUMERIC ) AS jzmj,
+        SUM ( tnmj :: NUMERIC ) AS tnmj,
+        SUM ( ftmj :: NUMERIC ) AS ftmj
+        FROM
+        PUBLIC.t_fwmx
+        WHERE ywh = #{ywh}
+    </select>
+
+
+
     <!-- 更新记录 -->
     <update id="update" parameterType="com.siwei.apply.domain.vo.FwmxVo">
         UPDATE t_fwmx
@@ -68,4 +86,12 @@
         </set>
         WHERE id = #{id}
     </update>
+
+    <!-- 根据ywh删除 -->
+    <delete id="deleteByYwh" parameterType="String">
+        DELETE FROM t_fwmx WHERE ywh = #{ywh}
+    </delete>
+
+
+
 </mapper>

+ 16 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/GjShijiShouchuMapper.xml

@@ -124,6 +124,22 @@
         </foreach>
     </delete>
 
+
+    <select id="getCompleteStatsByMethod" resultType="map">
+        SELECT
+        COALESCE(scfs, '其他') AS category,
+        ROUND(COALESCE(SUM("面积_亩"), 0), 2) AS complate_area
+        FROM vector.gj_shiji_shouchu
+        WHERE 1=1
+        <if test="year != null and year != '' and year != '0'">
+            AND scnd = #{year}::NUMERIC
+        </if>
+        GROUP BY COALESCE(scfs, '其他')
+        ORDER BY complate_area DESC
+    </select>
+
+
+
     <select id="getStatsByYear" resultType="map">
         SELECT
             COALESCE(CAST(scnd AS VARCHAR), '其它') AS year,

+ 117 - 1
siwei-modules/siwei-apply/src/main/resources/mapper/GjShouchuJihuaMapper.xml

@@ -7,7 +7,8 @@
     <select id="getPlanSummaryByYear" resultType="map">
         SELECT
             COUNT(*) AS plan_project_count,
-            ROUND(COALESCE(SUM(mj_mu), 0), 2) AS plan_area
+            ROUND(COALESCE(SUM(mj_mu), 0), 2) AS plan_area,
+            ROUND(COALESCE(SUM(sccb), 0), 2) AS plan_cost
         FROM vector.gj_shouchu_jihua
         WHERE 1=1
         <if test="year != null and year != '' and year != '0'">
@@ -120,4 +121,119 @@
         LIMIT 1
     </select>
 
+
+
+    <insert id="insertTableData" parameterType="map">
+        INSERT INTO vector.${tableName}
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="data.xmmc != null">xmmc,</if>
+            <if test="data.sccb != null">sccb,</if>
+            <if test="data.scsj != null">scsj,</if>
+            <if test="data.scnf != null">scnf,</if>
+            <if test="data.tdyyt != null">tdyyt,</if>
+            <if test="data.ghyt != null">ghyt,</if>
+            <if test="data.mj_m != null">mj_m,</if>
+            <if test="data.scfs != null">scfs,</if>
+            <if test="data.dkmc != null">dkmc,</if>
+            <if test="data.xzqmc != null">xzqmc,</if>
+            <if test="data.wz != null">wz,</if>
+            <if test="data.jhxzmj != null">jhxzmj,</if>
+            <if test="data.yscmj != null">yscmj,</if>
+            <if test="data.bndscmj != null">bndscmj,</if>
+            <if test="data.qqkf != null">qqkf,</if>
+            <if test="data.bndkfmj != null">bndkfmj,</if>
+            <if test="data.bndwccb != null">bndwccb,</if>
+            <if test="data.ngymj != null">ngymj,</if>
+            <if test="data.ngysj != null">ngysj,</if>
+            <if test="data.gyfs != null">gyfs,</if>
+            <if test="data.yjgysr != null">yjgysr,</if>
+            <if test="data.mj_12 != null">mj_12,</if>
+            <if test="data.xzqdm != null">xzqdm,</if>
+            <if test="data.dzjgh != null">dzjgh,</if>
+            <if test="data.htbh != null">htbh,</if>
+            <if test="data.htmc != null">htmc,</if>
+            <if test="data.qdrq != null">qdrq,</if>
+            <if test="data.the_geom != null">geom,</if>
+            <if test="data.source_type != null">source_type,</if>
+        </trim>
+        <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
+            <if test="data.xmmc != null">#{data.xmmc}::varchar,</if>
+            <if test="data.sccb != null">#{data.sccb}::numeric(18,4),</if>
+            <if test="data.scsj != null">#{data.scsj}::date,</if>
+            <if test="data.scnf != null">#{data.scnf}::varchar,</if>
+            <if test="data.tdyyt != null">#{data.tdyyt}::varchar,</if>
+            <if test="data.ghyt != null">#{data.ghyt}::varchar,</if>
+            <if test="data.mj_m != null">#{data.mj_m}::numeric(18,4),</if>
+            <if test="data.scfs != null">#{data.scfs}::varchar,</if>
+            <if test="data.dkmc != null">#{data.dkmc}::varchar,</if>
+            <if test="data.xzqmc != null">#{data.xzqmc}::varchar,</if>
+            <if test="data.wz != null">#{data.wz}::varchar,</if>
+            <if test="data.jhxzmj != null">#{data.jhxzmj}::numeric(18,4),</if>
+            <if test="data.yscmj != null">#{data.yscmj}::numeric(18,4),</if>
+            <if test="data.bndscmj != null">#{data.bndscmj}::numeric(18,4),</if>
+            <if test="data.qqkf != null">#{data.qqkf}::varchar,</if>
+            <if test="data.bndkfmj != null">#{data.bndkfmj}::numeric(18,4),</if>
+            <if test="data.bndwccb != null">#{data.bndwccb}::varchar,</if>
+            <if test="data.ngymj != null">#{data.ngymj}::numeric(18,4),</if>
+            <if test="data.ngysj != null">#{data.ngysj}::date,</if>
+            <if test="data.gyfs != null">#{data.gyfs}::varchar,</if>
+            <if test="data.yjgysr != null">#{data.yjgysr}::numeric(18,4),</if>
+            <if test="data.mj_12 != null">#{data.mj_12}::numeric(18,4),</if>
+            <if test="data.xzqdm != null">#{data.xzqdm}::varchar,</if>
+            <if test="data.dzjgh != null">#{data.dzjgh}::varchar,</if>
+            <if test="data.htbh != null">#{data.htbh}::varchar,</if>
+            <if test="data.htmc != null">#{data.htmc}::varchar,</if>
+            <if test="data.qdrq != null">#{data.qdrq}::date,</if>
+            <if test="data.the_geom != null">public.st_transform(public.st_geomfromewkt(#{data.the_geom}), #{shpDbSRID}),</if>
+            <if test="data.source_type != null">#{data.source_type}::varchar,</if>
+        </trim>
+    </insert>
+
+    <insert id="insertTableActualData" parameterType="map">
+        INSERT INTO vector.${tableName} (
+            <foreach collection="data" index="k" item="v" separator=",">
+                <choose>
+                    <when test="k == 'the_geom'">geom</when>
+                    <otherwise>"${k}"</otherwise>
+                </choose>
+            </foreach>
+        ) VALUES (
+            <foreach collection="data" index="k" item="v" separator=",">
+                <choose>
+                    <when test="k == 'the_geom'">
+                        public.st_transform(public.st_geomfromewkt(#{v}), #{shpDbSRID})
+                    </when>
+                    <otherwise>#{v}::varchar</otherwise>
+                </choose>
+            </foreach>
+        )
+    </insert>
+
+    <select id="actualList" resultType="map">
+        SELECT *
+        FROM vector.${tableName}
+        WHERE 1=1
+        <if test="year != null and year != '' and year != '0'">
+            AND scnd = #{year}
+        </if>
+        <if test="sourceType != null and sourceType != ''">
+            AND source_type = #{sourceType}
+        </if>
+        ORDER BY gid ASC
+    </select>
+
+
+
+    <!-- 根据gid删除记录 -->
+    <delete id="deleteByTable" parameterType="String">
+        DELETE FROM vector.${tableName}
+        WHERE 1=1
+        <if test="gid != null and gid !=''">
+            and gid = #{gid}
+        </if>
+        <if test="sourceType != null and sourceType !=''">
+            and source_type = #{sourceType}
+        </if>
+    </delete>
+
 </mapper>

+ 9 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/GyjsydscdjMapper.xml

@@ -54,6 +54,15 @@
         WHERE id = #{id}
     </select>
 
+    <!-- 新增:根据主键ID获取单条记录 -->
+    <select id="getBySourceId" resultMap="GyjsydscdjResultMap" parameterType="String">
+        SELECT *
+        FROM t_gyjsydscdj
+        WHERE source_id = #{sourceId}
+        Limit 1
+    </select>
+
+
     <!-- 更新记录 -->
     <update id="update" parameterType="com.siwei.apply.domain.vo.GyjsydscdjUpdateVo">
         UPDATE t_gyjsydscdj

+ 5 - 0
siwei-modules/siwei-spatial/src/main/java/com/siwei/spatial/controller/file/SpatialFilesDbController.java

@@ -36,6 +36,11 @@ public class SpatialFilesDbController extends BaseController {
     @Autowired
     private ITGeomDbService itGeomDbService;
 
+    @PostMapping("/read/shpfile")
+    public R<List<Map<String, Object>>> readShpFile(String shpFilePath) throws IOException {
+        return R.ok(iSpatialFilesDbService.readShpFileByPath(shpFilePath));
+    }
+
     @PostMapping("/read/shp")
     // @InnerAuth
     public R<TGeomDb> readShp(String shpFileName, String shpFilePath, String fromRoute) throws IOException {

+ 1 - 1
siwei-modules/siwei-spatial/src/main/java/com/siwei/spatial/service/file/ISpatialFilesDbService.java

@@ -35,8 +35,8 @@ public interface ISpatialFilesDbService {
 
     void writeShapefileByTable(String tableName, String filePath, String fileName) throws Exception ;
 
-
     TGeomDb excelImportGeom(List<String> gdIdList);
 
+    List<Map<String, Object>> readShpFileByPath(String shpFilePath) throws IOException;
 
 }

+ 31 - 0
siwei-modules/siwei-spatial/src/main/java/com/siwei/spatial/service/file/impl/SpatialFilesDbServiceImpl.java

@@ -89,6 +89,34 @@ public class SpatialFilesDbServiceImpl implements ISpatialFilesDbService {
     @Autowired
     private TGeomDbDetailsMapper tGeomDbDetailsMapper;
 
+    @Override
+    public List<Map<String, Object>> readShpFileByPath(String shpFilePath) throws IOException {
+        if (StringUtils.isEmpty(shpFilePath)) {
+            log.error("读取SHP文件路径失败");
+            return null;
+        }
+        String shpDir = shpFilePath.substring(0, shpFilePath.lastIndexOf(".zip"));
+        FileUtils.unzipAutoCharset(shpFilePath, shpDir);
+        List<Map<String, String>> shpFiles = FileUtils.readShpFiles(shpDir);
+
+        if (shpFiles.isEmpty()) {
+            log.error("读取SHP文件失败");
+            return null;
+        }
+        // TODO 目前只用了一个.shp文件,后续如果有多个shp文件,可能需要处理
+        Map<String, String> shpFileMap = shpFiles.get(0);
+        File shpFile = new File(shpFileMap.get("shp"));
+        File dbfFile = new File(shpFileMap.get("dbf"));
+        File shxFile = new File(shpFileMap.get("shx"));
+        File prjFile = new File(shpFileMap.get("prj"));
+        if (!shpFile.exists() || !dbfFile.exists() || !shxFile.exists()) {
+            log.error("读取SHP文件缺失");
+            return null;
+        }
+        List<Map<String, Object>> shpFeaturesList = readShapeFile(shpFile);
+        return shpFeaturesList;
+    }
+
 
 
 
@@ -159,6 +187,9 @@ public class SpatialFilesDbServiceImpl implements ISpatialFilesDbService {
         return dto;
     }
 
+
+
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public TGeomDb readGeom(String shpFileName, String geom, String fromRoute) {

+ 3 - 1
siwei-modules/siwei-system/src/main/resources/mapper/postgresql/system/SysUserMapper.xml

@@ -57,8 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
     
     <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
-		select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
+		select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader,r.role_id, r.role_name, r.role_sort from sys_user u
 		left join sys_dept d on u.dept_id = d.dept_id
+        left join sys_user_role ur on u.user_id = ur.user_id
+        left join sys_role r on r.role_id = ur.role_id
 		where u.del_flag = '0'
 		<if test="userId != null and userId != 0">
 			AND u.user_id = #{userId}