|
|
@@ -20,6 +20,7 @@ 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 +72,9 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
@Autowired
|
|
|
private ThirdRecordStatusMapper thirdRecordStatusMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FwmxMapper fwmxMapper;
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -81,19 +85,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 +114,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 +234,6 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 远程获取国有建设用地使用权首次登记数据
|
|
|
* 并且入库
|
|
|
@@ -251,22 +258,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 这里需要确认是否返回
|
|
|
+ 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);//todo 这里需要根据sourceId 检查
|
|
|
if(Objects.nonNull(existsNode)){
|
|
|
needUpdateNodeId = existsNode.getId();
|
|
|
}
|
|
|
@@ -275,6 +288,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 +313,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,13 +358,182 @@ 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
|
|
|
+ public Map<String, Object> remoteHouseFirstRegistration(ThirdRecordStatusParamVo paramVo) {
|
|
|
+ String yfbdcdyh = paramVo.getYfbdcdyh();
|
|
|
+ if (StringUtils.isBlank(yfbdcdyh)) {
|
|
|
+ throw new ServiceException("预赋不动产单元号为空");
|
|
|
+ }
|
|
|
+ String bdcdyh = paramVo.getBdcdyh();
|
|
|
+ if (StringUtils.isBlank(bdcdyh)) {
|
|
|
+ throw new ServiceException("不动产单元号为空");
|
|
|
+ }
|
|
|
+ String ywh = paramVo.getYwh();
|
|
|
+ if (StringUtils.isBlank(ywh)) {
|
|
|
+ throw new ServiceException("业务号为空");
|
|
|
+ }
|
|
|
+ String ywlx = paramVo.getYwlx();
|
|
|
+ if (StringUtils.isBlank(ywlx)) {
|
|
|
+ throw new ServiceException("业务类型为空");
|
|
|
+ }
|
|
|
+ Map<String, Object> retMap = new HashMap<>();
|
|
|
+ //todo 这里进行远程请求,获取相关数据,解析后入库
|
|
|
+ /**
|
|
|
+ * 1.获取关于附件信息。
|
|
|
+ * 2.先去创建节点。
|
|
|
+ * 3.如果已经存在当前业务号的数据呢?进行修改。
|
|
|
+ */
|
|
|
+ try {
|
|
|
+ Map<String,Object> paramMap = new LinkedHashMap<>();
|
|
|
+ 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();
|
|
|
+ String needUpdateNodeId = "";
|
|
|
+ String sourceId = body.getYwbh();
|
|
|
+ Gyjsydjfwscdj existsNode = gyjsydjfwscdjService.getBySourceId(sourceId);//这里需要根据sourceId 检查已经存在
|
|
|
+ if(Objects.nonNull(existsNode)){
|
|
|
+ needUpdateNodeId = existsNode.getId();
|
|
|
+ }
|
|
|
+ String addNodeId = addOrUpdateHouseFirstRegistration(body,projectId,needUpdateNodeId);
|
|
|
+ //这里保存附件信息
|
|
|
+ // 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();
|
|
|
+ }
|
|
|
|
|
|
+ // 第二部分,同步房屋的明细数据入库:
|
|
|
+ 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();
|
|
|
+ BeanUtils.copyProperties(body, fwmx);
|
|
|
+ fwmx.generateId();
|
|
|
+ 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;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
- public Map<String, Object> remoteHouseFirstRegistration(ThirdRecordStatusParamVo paramVo) {
|
|
|
+
|
|
|
+
|
|
|
+/*
|
|
|
+ public Map<String, Object> remoteHouseFirstRegistration222_delete(ThirdRecordStatusParamVo paramVo) {
|
|
|
String yfbdcdyh = paramVo.getYfbdcdyh();
|
|
|
if (StringUtils.isBlank(yfbdcdyh)) {
|
|
|
throw new ServiceException("预赋不动产单元号为空");
|
|
|
@@ -420,6 +603,9 @@ public class TakeDataServiceImpl implements TakeDataService {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+*/
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
/**
|