浏览代码

添加查询接口

LAPTOP-BJJ3IV5R\SIWEI 7 月之前
父节点
当前提交
dcae549bca

+ 9 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/gdbh/GdbhController.java

@@ -2,6 +2,7 @@ package com.onemap.apply.controller.gdbh;
 
 import com.onemap.apply.domain.gdbh.GdbhDto;
 import com.onemap.apply.service.gdbh.IGdbhService;
+import com.onemap.common.core.utils.StringUtils;
 import com.onemap.common.core.web.controller.BaseController;
 import com.onemap.common.core.web.domain.RequestResult;
 import com.onemap.common.core.web.page.TableDataInfo;
@@ -46,6 +47,14 @@ public class GdbhController extends BaseController {
         return list;
     }
 
+    @GetMapping("/QueryGdbhJg")
+    public RequestResult AddGdbh(String bsm) {
+        if (StringUtils.isEmpty(bsm)) {
+            return RequestResult.error("bsm is null");
+        }
+        return gdbhService.QueryGdbhJg(bsm);
+    }
+
     @DeleteMapping("/DeleteGdbh/{bsm}")
     public RequestResult DeleteGdbh(@PathVariable String bsm) {
         RequestResult list = gdbhService.DeleteGdbh(bsm);

+ 2 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/gdbh/GdbhRwMxYzDto.java

@@ -51,4 +51,6 @@ public class GdbhRwMxYzDto {
     public void setBsm(String bsm) {
         this.bsm = bsm;
     }
+
+
 }

+ 9 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/gdbh/GdbhYzDTO.java

@@ -28,6 +28,7 @@ public class GdbhYzDTO {
     // 条件信息
     @TableField("condition_info")
     private String conditionInfo;
+    private String retbsmmc;
 
     public String getId() {
         return id;
@@ -92,4 +93,12 @@ public class GdbhYzDTO {
     public void setConditionInfo(String conditionInfo) {
         this.conditionInfo = conditionInfo;
     }
+
+    public String getRetbsmmc() {
+        return retbsmmc;
+    }
+
+    public void setRetbsmmc(String retbsmmc) {
+        this.retbsmmc = retbsmmc;
+    }
 }

+ 7 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gdbh/GdbhRwJgMapper.java

@@ -2,8 +2,15 @@ package com.onemap.apply.mapper.gdbh;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.onemap.apply.domain.gdbh.GdbhRwJgDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
 
 public interface GdbhRwJgMapper extends BaseMapper<GdbhRwJgDTO> {
 
     int insertGdbhRwJgGeom(GdbhRwJgDTO gdbhRwJgDTO);
+
+    Map<String, Object> selectGdbhRwJgMap(@Param("rwbsm") String rwbsm, @Param("yzbsm") String yzbsm);
+
+//    int selectGdbhRwJgList(GdbhRwJgDTO gdbhRwJgDTO);
 }

+ 2 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/IGdbhService.java

@@ -12,6 +12,8 @@ public interface IGdbhService {
 
     RequestResult AddGdbh(GdbhDto gdbhDto);
 
+    RequestResult QueryGdbhJg(String bsm) ;
+
     RequestResult DeleteGdbh(String bsm);
 
     List<GdbhDto> SelectGdbhList(GdbhDto gdbhDto);

+ 57 - 53
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/GdbhJgService.java

@@ -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);
     }
 }

+ 9 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/gdbh/impl/GdbhServiceImpl.java

@@ -31,6 +31,8 @@ public class GdbhServiceImpl implements IGdbhService {
     private GdbhMapper gdbhMapper;
     @Autowired
     private GdbhHandleService gdbhHandleService;
+    @Autowired
+    private GdbhJgService gdbhJgService;
 
     @Override
     public RequestResult GetMxList(String param) {
@@ -75,6 +77,12 @@ public class GdbhServiceImpl implements IGdbhService {
         }
     }
 
+    @Override
+    public RequestResult QueryGdbhJg(String bsm) {
+        return gdbhJgService.gdbhAnalysisHandle(bsm);
+    }
+
+
     @Override
     public RequestResult AddGdbh(GdbhDto gdbhDto) {
         try {
@@ -104,7 +112,7 @@ public class GdbhServiceImpl implements IGdbhService {
                 gdbhRwMxMapper.insert(mxDto);
             }
             gdbhHandleService.gdbhAnalysisHandle(gdbhDto);
-            return RequestResult.success("添加成功", 0);
+            return RequestResult.success("添加成功", rebsm);
         } catch (Exception e) {
             e.printStackTrace();
             return RequestResult.error("添加失败", null);