1
0
فهرست منبع

房屋台账数据更新处理

chenendian 5 روز پیش
والد
کامیت
62c728a0af

+ 4 - 4
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/third/DealExcelController.java

@@ -35,7 +35,6 @@ public class DealExcelController extends BaseController {
     DealExcelServiceImpl  dealExcelService;
 
 
-
     @GetMapping("testData/{fileName}")
     public R<List<Map<String,String>>> testDealData(@PathVariable String fileName) {
         try {
@@ -52,7 +51,6 @@ public class DealExcelController extends BaseController {
     }
 
 
-
     /**
      * 获取土地供应对应的矢量数据,在地表宗地中对应的ywh,和不动产单元号
      * 这里遍历循环关于list   (4.projectId , 不动产单元号,业务号。)
@@ -70,7 +68,7 @@ public class DealExcelController extends BaseController {
                 tdgyShpOfZdList = dealExcelService.getBusinessCodeFromExcel(tdgyShpOfZdList, excelDataMap);
 
                 //这里进行数据入库处理,直接根据业务号,和项目id去抓取不动产的附件信息并且增加节点:
-                dealExcelService.addBDCDataAndAttachment(tdgyShpOfZdList);
+                dealExcelService.addBDCDataAndAttachment(tdgyShpOfZdList,1);
             }
             return R.ok(tdgyShpOfZdList);
         } catch (Exception e) {
@@ -80,7 +78,6 @@ public class DealExcelController extends BaseController {
     }
 
 
-
     /**
      * 获取土地供应对应的矢量数据,在地表宗地中对应的ywh,和不动产单元号
      * 这里遍历循环关于list   (4.projectId , 不动产单元号,业务号。)
@@ -96,6 +93,9 @@ public class DealExcelController extends BaseController {
                 File file = filePath.toFile();
                 Map<String, List<Map<String, String>>> excelDataMap = readExcelWithMergedHeaders(file);
                 tdgyShpOfZdList = dealExcelService.getBusinessCodeFromExcelOfHouse(tdgyShpOfZdList, excelDataMap);
+
+                //这里进行数据入库处理,直接根据业务号,和项目id去抓取不动产的附件信息并且增加节点:
+                dealExcelService.addBDCDataAndAttachment(tdgyShpOfZdList,2);
             }
             return R.ok(tdgyShpOfZdList);
         } catch (Exception e) {

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

@@ -41,8 +41,9 @@ public interface TakeDataService {
     void syncRemoteData(ThirdRecordStatusParamVo body);
 
 
-
     Map<String, Object> remoteLandFirstRegistration_tmp(String projectId,String ywh) ;
 
 
+    Map<String, Object> remoteHouseFirstRegistration_tmp(String projectId,String ywh);
+
 }

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

@@ -156,13 +156,18 @@ public class DealExcelServiceImpl {
      *  这里进行数据入库处理,直接根据业务号,和项目id去抓取不动产的附件信息并且增加节点:
      * @param list
      */
-    public void addBDCDataAndAttachment(List<Map<String, String>> list) {
+    public void addBDCDataAndAttachment(List<Map<String, String>> list,int type) {
         list = list.stream().filter(s->Objects.nonNull(s.get("ywh"))).collect(Collectors.toList());
         for (Map<String, String> map : list) {
             String ywh = map.get("ywh");
             String projectId = map.get("projectId");
-            Map<String, Object> retMap = takeDataService.remoteLandFirstRegistration_tmp(projectId,ywh);
-            log.info("result map:{}",retMap);
+            if(1==type){
+                Map<String, Object> retMap = takeDataService.remoteLandFirstRegistration_tmp(projectId,ywh);
+                log.info("result type1 map:{}",retMap);
+            }else if(2==type){
+                Map<String, Object> retMap = takeDataService.remoteHouseFirstRegistration_tmp(projectId,ywh);
+                log.info("result type2 map:{}",retMap);
+            }
         }
     }
 

+ 108 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/third/impl/TakeDataServiceImpl.java

@@ -625,6 +625,114 @@ public class TakeDataServiceImpl implements TakeDataService {
         return retMap;
     }
 
+
+    @Override
+    public Map<String, Object> remoteHouseFirstRegistration_tmp(String projectId,String ywh) {
+        Map<String, Object> retMap = new HashMap<>();
+        try {
+            Map<String,Object> paramMap = new LinkedHashMap<>();
+            paramMap.put("ywbh",ywh);
+            String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.ywFiles.datas",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)) {
+                //String projectId = immobileCodeRes.getProjectId();
+                //todo 这里的业务号不一定等于房屋中的业务号ywh
+                String addNodeId = "";
+                Gyjsydjfwscdj existsNode = gyjsydjfwscdjService.getBySourceId(ywh);//这里需要根据sourceId 检查已经存在
+                if(Objects.nonNull(existsNode)){ //如果已经存在不做处理
+                    addNodeId = existsNode.getId();
+                }else  {
+                    body.setYwbh(ywh);
+                    addNodeId = addOrUpdateHouseFirstRegistration(body,projectId,"");
+                }
+                //这里保存附件信息
+                // todo 这里的附件下载,为了性能考虑,是否要放在最后面
+                if(Objects.nonNull(body.getAttachment()) && !body.getAttachment().isEmpty()){
+                    nodeAttachmentService.getThirdAttachment(projectId,addNodeId,AloneWorkFlowEnum.NODE_7.getName(),body.getAttachment());
+                }
+                retMap.put("projectId",projectId);
+                retMap.put("nodeId",addNodeId);
+            }
+        } catch (Exception e) {
+            log.error("调用不动产获取附件信息错误,业务号:{}: ", ywh);
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+
+        // 第二部分,同步房屋的明细数据入库:
+        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",null);
+                    paramMap.put("pageNumber",pageNumber);
+                    paramMap.put("pageSize",pageSize);
+                    String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.houseRegist.datas",paramMap);
+                    JSONObject root = JSON.parseObject(remoteResult);
+                    //todo 这里需要确认返回数据是否是array结构
+                    JSONObject innerData = root.getJSONObject("data");
+                    if(Objects.nonNull(innerData.get("total")) && totalNum == 0){
+                        totalNum = (Integer) innerData.get("total");//获取总条数
+                    }
+                    JSONArray innerArr = innerData.getJSONArray("data");
+                    if(innerArr != null && !innerArr.isEmpty()) {
+                        for (int i = 0; i < innerArr.size(); i++) {
+                            JSONObject innerObj = innerArr.getJSONObject(i);
+                            FwmxVo body = JSON.parseObject(innerObj.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.setGzdgzsj(statisticsData.getGzdgzsj());
+                    body.setKfdw(statisticsData.getKfdw());
+                    body.setBdcqk(statisticsData.getBdcqk());
+                    body.setJzmj(statisticsData.getJzmj());
+                    body.setJzmjDw(statisticsData.getTdmjdw());
+                    body.setTnmj(statisticsData.getTnmj());
+                    body.setTnmjDw(statisticsData.getTdmjdw());
+                    body.setFtmj(statisticsData.getFtmj());
+                    body.setFtmjDw(statisticsData.getTdmjdw());
+                    addOrUpdateHouseFirstRegistration(body,retMap.get("projectId").toString(),retMap.get("nodeId").toString());
+                }
+            }
+        }catch (Exception e) {
+            log.error("调用不动产获取明细信息错误,业务号:{}: ", ywh);
+            throw new RuntimeException(e);
+        }
+        return retMap;
+    }
+
+
+
+
     /**
      * 通过土地用途名称获取土地的编码
      * @param useName