|
@@ -3,24 +3,25 @@ package com.siwei.apply.service.third.impl;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
+import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.siwei.apply.domain.*;
|
|
import com.siwei.apply.domain.*;
|
|
|
|
|
|
|
|
import com.siwei.apply.domain.vo.*;
|
|
import com.siwei.apply.domain.vo.*;
|
|
|
import com.siwei.apply.enums.AloneWorkFlowEnum;
|
|
import com.siwei.apply.enums.AloneWorkFlowEnum;
|
|
|
|
|
|
|
|
import com.siwei.apply.mapper.*;
|
|
import com.siwei.apply.mapper.*;
|
|
|
-import com.siwei.apply.service.GyjsydjfwscdjService;
|
|
|
|
|
-import com.siwei.apply.service.GyjsydscdjService;
|
|
|
|
|
-import com.siwei.apply.service.NodeAttachmentService;
|
|
|
|
|
-import com.siwei.apply.service.NodeLandService;
|
|
|
|
|
|
|
+import com.siwei.apply.service.*;
|
|
|
import com.siwei.apply.service.third.TakeDataService;
|
|
import com.siwei.apply.service.third.TakeDataService;
|
|
|
|
|
+import com.siwei.apply.utils.ArcGisUtil;
|
|
|
import com.siwei.apply.utils.HttpClientUtil;
|
|
import com.siwei.apply.utils.HttpClientUtil;
|
|
|
import com.siwei.apply.utils.ServiceUtil;
|
|
import com.siwei.apply.utils.ServiceUtil;
|
|
|
|
|
+import com.siwei.common.core.domain.R;
|
|
|
import com.siwei.common.core.exception.ServiceException;
|
|
import com.siwei.common.core.exception.ServiceException;
|
|
|
import com.siwei.common.core.utils.DateUtils;
|
|
import com.siwei.common.core.utils.DateUtils;
|
|
|
import com.siwei.common.core.utils.StringUtils;
|
|
import com.siwei.common.core.utils.StringUtils;
|
|
|
import com.siwei.common.core.utils.bean.BeanUtils;
|
|
import com.siwei.common.core.utils.bean.BeanUtils;
|
|
|
import com.siwei.spatial.api.RemoteSpatialFilesDbService;
|
|
import com.siwei.spatial.api.RemoteSpatialFilesDbService;
|
|
|
|
|
+import com.siwei.spatial.api.domain.file.TGeomDb;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
import org.apache.commons.collections4.MapUtils;
|
|
@@ -74,6 +75,17 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FwmxMapper fwmxMapper;
|
|
private FwmxMapper fwmxMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private LandOneCodeMapper landOneCodeMapper;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ LandOneCodeService landOneCodeService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ ProjectService projectService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -82,8 +94,6 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
return "1";
|
|
return "1";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 同步土地或房屋首次登记数据
|
|
* 同步土地或房屋首次登记数据
|
|
|
* @param projectId
|
|
* @param projectId
|
|
@@ -139,65 +149,6 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 远程获取第三方最大序号
|
|
|
|
|
- * 然后根据规则生成预赋不动产单元号
|
|
|
|
|
- * @param projectId
|
|
|
|
|
- * @param nodeId
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- @Override
|
|
|
|
|
- public Map<String, String> getThirdMaxSequence(String projectId, String nodeId,String detailsId) {
|
|
|
|
|
- Map<String, String> retMap = new LinkedHashMap<>();
|
|
|
|
|
- Project project = projectMapper.get(projectId);
|
|
|
|
|
- String firstPlotCode = project.getFirstPlotCode();
|
|
|
|
|
- String secondPlotCode = project.getSecondPlotCode();
|
|
|
|
|
- if (StringUtils.isEmpty(firstPlotCode)) {
|
|
|
|
|
- firstPlotCode = "G";
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isEmpty(secondPlotCode)) {
|
|
|
|
|
- secondPlotCode = "B";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //获取地籍子区的代码
|
|
|
|
|
- String regionCode = "";
|
|
|
|
|
- //当前地块所属地籍子区编号
|
|
|
|
|
- Map<String, String> detailGeomBelongToDjzqMap = nodeLandService.getDjzqContainsNodeList(detailsId);
|
|
|
|
|
- if (!MapUtils.isEmpty(detailGeomBelongToDjzqMap)) {
|
|
|
|
|
- regionCode = detailGeomBelongToDjzqMap.get("djzqdm");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- log.info("这里计算地籍子区的代码,区域号:{}", regionCode);
|
|
|
|
|
- //这里三方接口入参
|
|
|
|
|
- retMap.put("maxSequence", "");
|
|
|
|
|
- retMap.put("plotCode", firstPlotCode + secondPlotCode);
|
|
|
|
|
- retMap.put("regionCode", regionCode);
|
|
|
|
|
- retMap.put("code", "201");
|
|
|
|
|
-
|
|
|
|
|
- if (StringUtils.isNotBlank(regionCode)) {
|
|
|
|
|
- retMap.put("code", "200");
|
|
|
|
|
- try{
|
|
|
|
|
- Map<String,Object> paramMap = new LinkedHashMap<>();
|
|
|
|
|
- paramMap.put("regionCode",regionCode+firstPlotCode + secondPlotCode);
|
|
|
|
|
- //这里调用 httpClient 进行远程调用
|
|
|
|
|
- String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.getMaxSeq.datas",paramMap);
|
|
|
|
|
- log.info("远程获取最大序列号解析数据为:{}", remoteResult);
|
|
|
|
|
-
|
|
|
|
|
- JSONObject root = JSON.parseObject(remoteResult);
|
|
|
|
|
- JSONObject innerData = root.getJSONObject("data");
|
|
|
|
|
-
|
|
|
|
|
- if(innerData.get("code").equals("200") && StringUtils.isNumeric(String.valueOf(innerData.get("maxsequence")))){
|
|
|
|
|
- retMap.put("maxSequence", innerData.get("maxsequence").toString());
|
|
|
|
|
- }
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- log.error("调用矢量保存文件错误,区域号:{}", regionCode,e);
|
|
|
|
|
- }
|
|
|
|
|
- }else {
|
|
|
|
|
- log.error("远程获取最大序列号-计算区域代码为空-项目号:{},", projectId);
|
|
|
|
|
- }
|
|
|
|
|
- return retMap;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public Map<String, String> getImmobileCode(String projectId) {
|
|
public Map<String, String> getImmobileCode(String projectId) {
|
|
@@ -244,6 +195,11 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
if (StringUtils.isBlank(yfbdcdyh)) {
|
|
if (StringUtils.isBlank(yfbdcdyh)) {
|
|
|
throw new ServiceException("预赋不动产单元号为空");
|
|
throw new ServiceException("预赋不动产单元号为空");
|
|
|
}
|
|
}
|
|
|
|
|
+ String bdcdyh = paramVo.getBdcdyh();
|
|
|
|
|
+ if (StringUtils.isBlank(bdcdyh)) {
|
|
|
|
|
+ throw new ServiceException("不动产单元号为空");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
String ywh = paramVo.getYwh();
|
|
String ywh = paramVo.getYwh();
|
|
|
if (StringUtils.isBlank(ywh)) {
|
|
if (StringUtils.isBlank(ywh)) {
|
|
|
throw new ServiceException("业务编号为空");
|
|
throw new ServiceException("业务编号为空");
|
|
@@ -257,7 +213,7 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
try {
|
|
try {
|
|
|
Map<String,Object> paramMap = new LinkedHashMap<>();
|
|
Map<String,Object> paramMap = new LinkedHashMap<>();
|
|
|
paramMap.put("ywbh",ywh);
|
|
paramMap.put("ywbh",ywh);
|
|
|
- paramMap.put("yfbdcdyh",yfbdcdyh);
|
|
|
|
|
|
|
+ //paramMap.put("yfbdcdyh",yfbdcdyh);
|
|
|
|
|
|
|
|
String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.landRegist.datas",paramMap);
|
|
String remoteResult = ServiceUtil.getRemoteDataByHttpClient("query.landRegist.datas",paramMap);
|
|
|
JSONObject root = JSON.parseObject(remoteResult);
|
|
JSONObject root = JSON.parseObject(remoteResult);
|
|
@@ -285,6 +241,48 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
retMap.put("projectId",projectId);
|
|
retMap.put("projectId",projectId);
|
|
|
retMap.put("nodeId",addNodeId);
|
|
retMap.put("nodeId",addNodeId);
|
|
|
}
|
|
}
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("调用不动产基本信息保存错误,业务编号:{}: ", ywh);
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //todo 这里进行远程请求,获取不动产矢量数据
|
|
|
|
|
+ try {
|
|
|
|
|
+
|
|
|
|
|
+ String projectId = retMap.get("projectId").toString();
|
|
|
|
|
+ String nodeId = retMap.get("nodeId").toString();
|
|
|
|
|
+
|
|
|
|
|
+ ArcGisUtil client = new ArcGisUtil(ArcGisUtil.ARCGIS_BASE_URL, ArcGisUtil.LAYER_ID, ArcGisUtil.SRID);
|
|
|
|
|
+ String where = "BDCDYH='"+bdcdyh+"'";
|
|
|
|
|
+ JsonNode page = client.query(where, ArcGisUtil.WITH_GEOMETRY, 0, ArcGisUtil.PAGE_SIZE);
|
|
|
|
|
+ log.info("run get ArcGIS service OK: {} (layer={}, srid={})", ArcGisUtil.PAGE_SIZE, ArcGisUtil.LAYER_ID, ArcGisUtil.SRID);
|
|
|
|
|
+ JsonNode features = page.path("features");
|
|
|
|
|
+ JsonNode f = features.get(0);
|
|
|
|
|
+ if (ArcGisUtil.WITH_GEOMETRY) {
|
|
|
|
|
+ JsonNode rings = f.path("geometry").path("rings");
|
|
|
|
|
+ String ewkt4490 = client.ringsToEwkt(rings);
|
|
|
|
|
+ log.info("ewkt OK: {} ", ewkt4490);
|
|
|
|
|
+ // 这里进行数据入库更新建立关联
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+ map.put("geoms", ewkt4490);
|
|
|
|
|
+ map.put("sourceType", "bdc");
|
|
|
|
|
+ R<TGeomDb> saveGeomRes = remoteSpatialFilesDbService.saveGeom(map);
|
|
|
|
|
+ TGeomDb tGeomDb = saveGeomRes.getData();
|
|
|
|
|
+ log.info("远程调用geom保存,返回结果:{}", tGeomDb);
|
|
|
|
|
+ //这里保存geom映射关系
|
|
|
|
|
+ nodeLandService.createNodeLand(nodeId, tGeomDb.getId());
|
|
|
|
|
+ //预赋码逻辑
|
|
|
|
|
+ projectService.addPreAssignCode(nodeId,projectId,tGeomDb.getId(),0);
|
|
|
|
|
+ //这里进行上链操作:
|
|
|
|
|
+ gyjsydscdjService.updateHasOnchain(nodeId,true);
|
|
|
|
|
+ // 更新项目表的上链数量
|
|
|
|
|
+ projectService.countOnChinaNum(projectId);
|
|
|
|
|
+ //这里生成资源吗
|
|
|
|
|
+ landOneCodeService.addOrUpdateLandOneCodeInfo(projectId,nodeId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("调用矢量保存文件错误,业务编号:{}: ", ywh);
|
|
log.error("调用矢量保存文件错误,业务编号:{}: ", ywh);
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -390,8 +388,6 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
public String addOrUpdateLandFirstRegistration(LandFirstParamVo body,String projectId,String needUpdateNodeId) {
|
|
public String addOrUpdateLandFirstRegistration(LandFirstParamVo body,String projectId,String needUpdateNodeId) {
|
|
|
String addNodeId = "";
|
|
String addNodeId = "";
|
|
|
if (StringUtils.isNotBlank(needUpdateNodeId)) {
|
|
if (StringUtils.isNotBlank(needUpdateNodeId)) {
|
|
@@ -785,11 +781,16 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
updateVo.setTbzt("1");
|
|
updateVo.setTbzt("1");
|
|
|
thirdRecordStatusMapper.updateById(updateVo);
|
|
thirdRecordStatusMapper.updateById(updateVo);
|
|
|
|
|
|
|
|
- //这里需要更新绑定关系
|
|
|
|
|
- ProjectImmobileCode updateImmobileCode = new ProjectImmobileCode();
|
|
|
|
|
- updateImmobileCode.setCode(bdcdyh);
|
|
|
|
|
- updateImmobileCode.setPreAssignCode(yfbdcdyh);
|
|
|
|
|
- projectImmobileCodeMapper.updateByPreCode(updateImmobileCode);
|
|
|
|
|
|
|
+ ProjectImmobileCode immobileCodeRes = projectImmobileCodeMapper.selectByPreAssignCode(yfbdcdyh);
|
|
|
|
|
+ if(Objects.nonNull(immobileCodeRes)){
|
|
|
|
|
+ //这里需要更新绑定关系
|
|
|
|
|
+ ProjectImmobileCode updateImmobileCode = new ProjectImmobileCode();
|
|
|
|
|
+ updateImmobileCode.setCode(bdcdyh);
|
|
|
|
|
+ projectImmobileCodeMapper.updateById(updateImmobileCode);
|
|
|
|
|
+ //这里需要更新当前项目的不动产登记号(保证资源码正确)
|
|
|
|
|
+ String projectId = immobileCodeRes.getProjectId();
|
|
|
|
|
+ landOneCodeMapper.updateCodeByProjectId(projectId,bdcdyh);
|
|
|
|
|
+ }
|
|
|
return body.getId();
|
|
return body.getId();
|
|
|
}).exceptionally(e -> {
|
|
}).exceptionally(e -> {
|
|
|
log.error("不动产远程抓取数据失败: ywh={}, ywlx={}", ywh, ywlx, e);
|
|
log.error("不动产远程抓取数据失败: ywh={}, ywlx={}", ywh, ywlx, e);
|