|
@@ -2,16 +2,17 @@ package com.onemap.apply.service.gdbh.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.onemap.apply.domain.gdbh.*;
|
|
|
-import com.onemap.apply.mapper.gdbh.GdbhRwJgMapper;
|
|
|
-import com.onemap.apply.mapper.gdbh.GdbhYzMapper;
|
|
|
+import com.onemap.apply.mapper.gdbh.*;
|
|
|
import com.onemap.apply.service.analyse.HttpAnalyseService;
|
|
|
import com.onemap.common.core.utils.StringUtils;
|
|
|
+import com.onemap.common.core.web.domain.RequestResult;
|
|
|
import com.onemap.system.api.domain.IntersectionTableWktVo;
|
|
|
import com.onemap.system.api.domain.IntersectsTableWktVo;
|
|
|
import com.onemap.system.api.domain.TargetTableVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -24,29 +25,53 @@ public class GdbhJgService {
|
|
|
private HttpAnalyseService httpAnalyseService;
|
|
|
@Autowired
|
|
|
private GdbhRwJgMapper gdbhRwJgMapper;
|
|
|
+ @Autowired
|
|
|
+ private GdbhMapper gdbhMapper;
|
|
|
+ @Autowired
|
|
|
+ private GdbhRwMxMapper gdbhRwMxMapper;
|
|
|
+ @Autowired
|
|
|
+ private GdbhRwMxYzMapper gdbhRwMxYzMapper;
|
|
|
|
|
|
- void gdbhAnalysisHandle(GdbhDto gdbhDto) {
|
|
|
- //获取范围
|
|
|
- String xzfw = gdbhDto.getGeom();
|
|
|
+ RequestResult gdbhAnalysisHandle(String rwBsm) {
|
|
|
+ QueryWrapper<GdbhDto> wrapper0_1 = new QueryWrapper<>();
|
|
|
+ wrapper0_1.eq("bsm", rwBsm);
|
|
|
+ GdbhDto gdbhDto = gdbhMapper.selectOne(wrapper0_1);
|
|
|
+ if (StringUtils.isNull(gdbhDto)) {
|
|
|
+ return RequestResult.error("未查询到数据");
|
|
|
+ }
|
|
|
|
|
|
- //获取因子
|
|
|
- QueryWrapper<GdbhYzDTO> yzWrapper = new QueryWrapper<>();
|
|
|
- yzWrapper.eq("status", 1);
|
|
|
- List<GdbhYzDTO> gdbhYzRes = gdbhYzMapper.selectList(yzWrapper);
|
|
|
- Map<String, GdbhYzDTO> yzDataMap = new HashMap<>();
|
|
|
- for (GdbhYzDTO yz : gdbhYzRes) {
|
|
|
- if (StringUtils.isNotEmpty(yz.getBsm())) {
|
|
|
- yzDataMap.put(yz.getId(), yz);
|
|
|
- }
|
|
|
+ //获取范围
|
|
|
+ Map xzfw = gdbhMapper.selectGdbhXzfw(gdbhDto.getXzfw());
|
|
|
+ if (StringUtils.isEmpty(xzfw)) {
|
|
|
+ return RequestResult.error("选址范围参数为空");
|
|
|
+ }
|
|
|
+ Double area = Double.valueOf(xzfw.get("area").toString());
|
|
|
+ String ewkt = (String) xzfw.get("geom");
|
|
|
+ if (StringUtils.isEmpty(ewkt)) {
|
|
|
+ return RequestResult.error("选址范围参数为空");
|
|
|
}
|
|
|
+ gdbhDto.setGeom(ewkt);
|
|
|
+ gdbhDto.setXzmj(area);
|
|
|
|
|
|
+ //计算1 模型
|
|
|
+ QueryWrapper<GdbhRwMxDto> wrapper0_2 = new QueryWrapper<>();
|
|
|
+ wrapper0_2.eq("rwbsm", rwBsm);
|
|
|
+ List<GdbhRwMxDto> mxlist = gdbhRwMxMapper.selectList(wrapper0_2);
|
|
|
//计算
|
|
|
- List<GdbhRwMxDto> mxlist = gdbhDto.getMxlist();
|
|
|
if (mxlist == null || mxlist.size() == 0) {
|
|
|
- return;
|
|
|
+ return RequestResult.error("模型参数为空");
|
|
|
}
|
|
|
+
|
|
|
+ List<Map<String, Object>>
|
|
|
+ ret = new ArrayList<>();
|
|
|
+
|
|
|
for (GdbhRwMxDto mx : mxlist) {
|
|
|
- List<GdbhRwMxYzDto> yiList = mx.getGdbhMxYz();
|
|
|
+
|
|
|
+ //计算1 模型
|
|
|
+ QueryWrapper<GdbhRwMxYzDto> wrapper0_3 = new QueryWrapper<>();
|
|
|
+ wrapper0_3.eq("rwbsm", rwBsm);
|
|
|
+ wrapper0_3.eq("mx_bsm", mx.getBsm());
|
|
|
+ List<GdbhRwMxYzDto> yiList = gdbhRwMxYzMapper.selectList(wrapper0_3);
|
|
|
if (yiList == null || yiList.size() == 0) {
|
|
|
continue;
|
|
|
}
|
|
@@ -55,45 +80,24 @@ public class GdbhJgService {
|
|
|
if (StringUtils.isEmpty(v_yz_0)) {
|
|
|
continue;
|
|
|
}
|
|
|
- GdbhYzDTO d_yz_dto = yzDataMap.get(v_yz_0);
|
|
|
- if (StringUtils.isNull(d_yz_dto)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- String d_analysis_xzfw = xzfw;
|
|
|
- String d_analysis_table = d_yz_dto.getBsm();
|
|
|
- //交集
|
|
|
- IntersectsTableWktVo analyseUtilsVo = new IntersectsTableWktVo();
|
|
|
- analyseUtilsVo.setEwkt(d_analysis_xzfw);
|
|
|
- analyseUtilsVo.setTableName(d_analysis_table);
|
|
|
- List<String> ids = httpAnalyseService.intersectsTableWkt(analyseUtilsVo);
|
|
|
- if (ids != null && ids.size() > 0) {
|
|
|
- //相交
|
|
|
- IntersectionTableWktVo intersectionTableWktVo = new IntersectionTableWktVo();
|
|
|
- intersectionTableWktVo.setTableName(d_analysis_table);
|
|
|
- intersectionTableWktVo.setEwkt(d_analysis_xzfw);
|
|
|
- intersectionTableWktVo.setTableIds(ids);
|
|
|
- String tableName = httpAnalyseService.intersectionTableWkt(intersectionTableWktVo);
|
|
|
-
|
|
|
- TargetTableVo targetTableVo = new TargetTableVo();
|
|
|
- targetTableVo.setSrid(4525);
|
|
|
- targetTableVo.setIsGeography(false);
|
|
|
- targetTableVo.setSiweiArea(true);
|
|
|
- targetTableVo.setTargetTableName(tableName);
|
|
|
- targetTableVo.setRawTableName(d_analysis_table);
|
|
|
- List<Map> map = httpAnalyseService.targetTable(targetTableVo);
|
|
|
+ //计算1 模型
|
|
|
+ QueryWrapper<GdbhYzDTO> wrapper0_4 = new QueryWrapper<>();
|
|
|
+ wrapper0_4.eq("id", yi.getBsm());
|
|
|
+ GdbhYzDTO yiRus = gdbhYzMapper.selectOne(wrapper0_4);
|
|
|
|
|
|
- for (Map map1 : map) {
|
|
|
- GdbhRwJgDTO d_dto_0 = new GdbhRwJgDTO();
|
|
|
- d_dto_0.setId(StringUtils.getUUID());
|
|
|
- d_dto_0.setRwbsm(gdbhDto.getBsm());
|
|
|
- d_dto_0.setMx_bsm(mx.getBsm());
|
|
|
- d_dto_0.setYz_bsm(d_yz_dto.getId());
|
|
|
- d_dto_0.setSumvalue(((Double) map1.get("siweiarea")).toString());
|
|
|
- d_dto_0.setGeomvalue((String) map1.get("geom"));
|
|
|
- gdbhRwJgMapper.insertGdbhRwJgGeom(d_dto_0);
|
|
|
- }
|
|
|
+ Map<String, Object> retMapData0 = gdbhRwJgMapper.selectGdbhRwJgMap(gdbhDto.getBsm(), v_yz_0);
|
|
|
+ String bsmmc = yiRus.getRetbsmmc();
|
|
|
+ if (StringUtils.isEmpty(bsmmc)) {
|
|
|
+ bsmmc = yiRus.getName();
|
|
|
}
|
|
|
+ retMapData0.put("bsmmc", bsmmc);
|
|
|
+ ret.add(retMapData0);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ Map<String, Object> retMap = new HashMap<>();
|
|
|
+ retMap.put("xmxx", gdbhDto);
|
|
|
+ retMap.put("yzjg", ret);
|
|
|
+ return RequestResult.success(retMap);
|
|
|
}
|
|
|
}
|