Browse Source

规划差异分析最终版提交

wanger 3 tháng trước cách đây
mục cha
commit
437e10ccbc

+ 81 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/fxpj/GhcyController.java

@@ -0,0 +1,81 @@
+package com.onemap.apply.controller.fxpj;
+
+import com.onemap.apply.service.fxpj.GhcyService;
+import com.onemap.common.core.web.controller.BaseController;
+import com.onemap.common.core.web.domain.RequestResult;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * 规划差异分析
+ */
+@RestController
+@RequestMapping("/fxpj/ghcy")
+public class GhcyController extends BaseController {
+
+    @Resource
+    GhcyService ghcyService;
+
+    /**
+     * 查询数据源列表
+     *
+     * @param params
+     * @return
+     */
+    @RequestMapping("/sjylist")
+    public RequestResult sjylist(String params) {
+        RequestResult res = ghcyService.sjylist(params);
+        return res;
+    }
+
+    /**
+     * 查询差异分析结果
+     *
+     * @param plan1
+     * @param plan2
+     * @return
+     */
+    @RequestMapping("/cyfxjg")
+    public RequestResult cyfxjg(String plan1, String plan2) {
+        RequestResult res = ghcyService.cyfxjg(plan1, plan2);
+        return res;
+    }
+
+    /**
+     * 查询某项分析结果空间范围
+     *
+     * @param id
+     * @return
+     */
+    @RequestMapping("/getGeomById")
+    public RequestResult getGeomById(String id) {
+        RequestResult res = ghcyService.getGeomById(id);
+        return res;
+    }
+
+    /**
+     * 查询某项分析结果进行点击查询
+     *
+     * @param id
+     * @return
+     */
+    @RequestMapping("/intersects")
+    public RequestResult intersects(String id, Double x , Double y, Integer objectid) {
+        RequestResult res = ghcyService.intersects(id ,x , y, objectid);
+        return res;
+    }
+
+    /**
+     * 查询某项分析结果空间范围
+     *
+     * @param id
+     * @return
+     */
+    @RequestMapping("/getAttributesById")
+    public RequestResult getAttributesById(String id) {
+        RequestResult res = ghcyService.getAttributesById(id);
+        return res;
+    }
+}

+ 86 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/fxpj/GhcyjgDto.java

@@ -0,0 +1,86 @@
+package com.onemap.apply.domain.fxpj;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 规划差异数据源
+ */
+@TableName("T_YZT_GHCY_JG")
+public class GhcyjgDto {
+
+    private String id;
+    private String sjy;
+    private String fxmc;
+    private String tablename;
+    private String remark;
+    @TableField(exist = false)
+    private Boolean hasDetail = true;
+    @TableField(exist = false)
+    private List<Map<String, Object>> statics = new ArrayList<>();
+
+    public Boolean getHasDetail() {
+        return hasDetail;
+    }
+
+    public void setHasDetail(Boolean hasDetail) {
+        this.hasDetail = hasDetail;
+    }
+
+    public List<Map<String, Object>> getStatics() {
+        return statics;
+    }
+
+    public void setStatics(List<Map<String, Object>> statics) {
+        this.statics = statics;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getSjy() {
+        return sjy;
+    }
+
+    public void setSjy(String sjy) {
+        this.sjy = sjy;
+    }
+
+    public String getFxmc() {
+        return fxmc;
+    }
+
+    public void setFxmc(String fxmc) {
+        this.fxmc = fxmc;
+    }
+
+    public String getTablename() {
+        return tablename;
+    }
+
+    public void setTablename(String tablename) {
+        this.tablename = tablename;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+}
+
+
+
+

+ 94 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/fxpj/GhcysjyDto.java

@@ -0,0 +1,94 @@
+package com.onemap.apply.domain.fxpj;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+
+/**
+ * 规划差异数据源
+ */
+@TableName("T_YZT_GHCY_SJY")
+public class GhcysjyDto {
+
+    private String id;
+    private String flmc;
+    private String name;
+    private String xzqdm;
+    private String status;
+    private String tablename;
+    private String cxtj;
+    private String serviceid;
+    private String ghlx;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getFlmc() {
+        return flmc;
+    }
+
+    public void setFlmc(String flmc) {
+        this.flmc = flmc;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getXzqdm() {
+        return xzqdm;
+    }
+
+    public void setXzqdm(String xzqdm) {
+        this.xzqdm = xzqdm;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getTablename() {
+        return tablename;
+    }
+
+    public void setTablename(String tablename) {
+        this.tablename = tablename;
+    }
+
+    public String getCxtj() {
+        return cxtj;
+    }
+
+    public void setCxtj(String cxtj) {
+        this.cxtj = cxtj;
+    }
+
+    public String getServiceid() {
+        return serviceid;
+    }
+
+    public void setServiceid(String serviceid) {
+        this.serviceid = serviceid;
+    }
+
+    public String getGhlx() {
+        return ghlx;
+    }
+
+    public void setGhlx(String ghlx) {
+        this.ghlx = ghlx;
+    }
+}

+ 34 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/fxpj/GhcyjgMapper.java

@@ -0,0 +1,34 @@
+package com.onemap.apply.mapper.fxpj;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.onemap.apply.domain.fxpj.GhcyjgDto;
+import com.onemap.apply.domain.yzt.ZymlDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 规划差异数据源
+ */
+@Mapper
+public interface GhcyjgMapper extends BaseMapper<GhcyjgDto> {
+
+
+    Double getTbmj(@Param("tablename") String tablename);
+
+    String getGhlx(@Param("plan") String plan);
+
+    List<Map<String, Object>> getStatics(@Param("tablename") String tablename);
+
+    List<ZymlDTO> getZyml(@Param("zymc") String zymc);
+
+    List<String> getGeom(@Param("tablename") String tablename);
+
+    List<Map<String, Object>> getAttributes(@Param("tablename") String tablename);
+
+    Map<String, Object> intersects(@Param("tablename") String tablename, @Param("x") Double x, @Param("y") Double y);
+
+    String intersectsById(@Param("tablename") String tablename, @Param("objectid") Integer objectid);
+}

+ 18 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/fxpj/GhcysjyMapper.java

@@ -0,0 +1,18 @@
+package com.onemap.apply.mapper.fxpj;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.onemap.apply.domain.fxpj.GhcysjyDto;
+import com.onemap.apply.domain.fxpj.TGhwbDo;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 规划差异数据源
+ */
+@Mapper
+public interface GhcysjyMapper extends BaseMapper<GhcysjyDto> {
+
+    List<Map<String, Object>> sjylist(String params);
+}

+ 20 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/fxpj/GhcyService.java

@@ -0,0 +1,20 @@
+package com.onemap.apply.service.fxpj;
+
+
+import com.onemap.apply.domain.fxpj.TCtfxMainDTO;
+import com.onemap.common.core.web.domain.RequestResult;
+
+import java.util.List;
+
+public interface GhcyService {
+
+    RequestResult sjylist(String params);
+
+    RequestResult cyfxjg(String plan1, String plan2);
+
+    RequestResult getGeomById(String id);
+
+    RequestResult getAttributesById(String id);
+
+    RequestResult intersects(String id, Double x, Double y, Integer objectid);
+}

+ 194 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/fxpj/GhcyServiceImpl.java

@@ -0,0 +1,194 @@
+package com.onemap.apply.service.impl.fxpj;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.onemap.apply.domain.fxpj.GhcyjgDto;
+import com.onemap.apply.domain.yzt.ZymlDTO;
+import com.onemap.apply.mapper.fxpj.*;
+
+import com.onemap.apply.service.fxpj.GhcyService;
+import com.onemap.common.core.utils.StringUtils;
+import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.common.security.utils.SecurityUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.DecimalFormat;
+import java.util.*;
+
+
+@Service("GhcyService")
+public class GhcyServiceImpl implements GhcyService {
+
+
+    @Resource
+    private GhcysjyMapper ghcysjyMapper;
+    @Resource
+    private GhcyjgMapper ghcyjgMapper;
+
+    //简单的配置个字典用作于前端汉化显示,后续再考虑需不需要存到数据库
+    private Map<String, String> fieldAliasMap = new HashMap<String, String>() {{
+        put("OBJECTID", "编号");
+        put("A_YDYHFLDM", "控规_用地用海分类代码");
+        put("A_YDYHFLMC", "控规_用地用海分类名称");
+        put("B_YDYHFLDM", "总规_用地用海分类代码");
+        put("B_YDYHFLMC", "总规_用地用海分类名称");
+        put("TBMJ", "差异面积");
+        put("YDYHFLDM", "用地用海分类代码");
+        put("YDYHFLMC", "用地用海分类名称");
+        put("XXGHBZDYBH", "详细规划编制单元编号");
+        put("XXGHBZDYMC", "详细规划编制单元名称");
+    }};
+
+
+    @Override
+    public RequestResult sjylist(String params) {
+        List<Map<String, Object>> list = ghcysjyMapper.sjylist(params);
+        return RequestResult.success(list);
+    }
+
+    @Override
+    public RequestResult cyfxjg(String plan1, String plan2) {
+        if (StringUtils.isEmpty(plan1) || StringUtils.isEmpty(plan2)) {
+            return RequestResult.error("参数未传递!");
+        }
+        try {
+            //根据规划类型查询差异分析结果数据
+            QueryWrapper<GhcyjgDto> wrapper = new QueryWrapper();
+            wrapper.eq("sjy", String.format("%s,%s", plan1, plan2));
+            List<GhcyjgDto> res = ghcyjgMapper.selectList(wrapper);
+            if (res.size() > 0) {
+                //查询规划类型
+                String ghlx1 = ghcyjgMapper.getGhlx(plan1);
+                String ghlx2 = ghcyjgMapper.getGhlx(plan2);
+                //替换分析结论 %s
+                for (GhcyjgDto cur : res) {
+                    String tablename = cur.getTablename();
+                    Double tbmj = ghcyjgMapper.getTbmj(tablename);
+                    if (tbmj == null) {
+                        cur.setHasDetail(false);
+                        cur.setRemark(String.format(cur.getRemark(), plan1, plan2, "0"));
+                    } else {
+                        cur.setRemark(String.format(cur.getRemark(), plan1, plan2, "<span style='color: red; font-weight: bold;'>" + String.valueOf(tbmj) + "</span>"));
+                    }
+                    if ("1".equals(ghlx1) && "1".equals(ghlx2)) {
+                        //统计用地用海差异数据
+                        List<Map<String, Object>> statics = ghcyjgMapper.getStatics(tablename);
+                        cur.setStatics(statics);
+                    }
+                }
+                //继续查询资源目录
+                List<ZymlDTO> zyml = new ArrayList<>();
+                String[] zy = {plan1, plan2};
+                for (String zymc : zy) {
+                    String uuid = StringUtils.getUUID();
+                    ZymlDTO dto = new ZymlDTO();
+                    dto.setParent(1);
+                    dto.setName(zymc);
+                    dto.setBsm(uuid);
+                    zyml.add(dto);
+                    //查询下属资源服务
+                    List<ZymlDTO> mls = ghcyjgMapper.getZyml(zymc);
+                    for (ZymlDTO c : mls) {
+                        c.setPbsm(uuid);
+                        zyml.add(c);
+                    }
+                }
+                //返回体结构包装
+                Map<String, Object> map = new HashMap<>();
+                map.put("fxjg", res);
+                map.put("zyml", zyml);
+                return RequestResult.success(map);
+            } else {
+                return RequestResult.error("暂未获取到分析结果,请重新选择规划数据!");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return RequestResult.error("查询失败!");
+    }
+
+    @Override
+    public RequestResult getGeomById(String id) {
+        if (StringUtils.isEmpty(id)) {
+            return RequestResult.error("参数未传递!");
+        }
+        //根据规划类型查询差异分析结果数据
+        QueryWrapper<GhcyjgDto> wrapper = new QueryWrapper();
+        wrapper.eq("id", id);
+        GhcyjgDto res = ghcyjgMapper.selectOne(wrapper);
+        if (res != null) {
+            List<String> geoms = ghcyjgMapper.getGeom(res.getTablename());
+            return RequestResult.success(geoms);
+        } else {
+            return RequestResult.error("参数传递错误,没查到数据!");
+        }
+    }
+
+    @Override
+    public RequestResult getAttributesById(String id) {
+        if (StringUtils.isEmpty(id)) {
+            return RequestResult.error("参数未传递!");
+        }
+        //根据规划类型查询差异分析结果数据
+        QueryWrapper<GhcyjgDto> wrapper = new QueryWrapper();
+        wrapper.eq("id", id);
+        GhcyjgDto res = ghcyjgMapper.selectOne(wrapper);
+        if (res != null) {
+            DecimalFormat df = new DecimalFormat("#.00");
+            List<Map<String, Object>> attributes = ghcyjgMapper.getAttributes(res.getTablename());
+            List<Map<String, Object>> resultListMap = new ArrayList<>();
+            for (Map<String, Object> attribute : attributes) {
+                attribute.remove("SHAPE");
+                if (attribute.get("TBMJ") != null) {
+                    Double tbmj = Double.valueOf(String.valueOf(attribute.get("TBMJ")));
+                    attribute.put("TBMJ", df.format(tbmj));
+                }
+                resultListMap.add(convertAttributeKeys(attribute));
+            }
+            return RequestResult.success(resultListMap);
+        } else {
+            return RequestResult.error("参数传递错误,没查到数据!");
+        }
+    }
+
+    @Override
+    public RequestResult intersects(String id, Double x, Double y, Integer objectid) {
+        if (StringUtils.isEmpty(id)) {
+            return RequestResult.error("参数未传递!");
+        }
+        //根据规划类型查询差异分析结果数据
+        QueryWrapper<GhcyjgDto> wrapper = new QueryWrapper();
+        wrapper.eq("id", id);
+        GhcyjgDto res = ghcyjgMapper.selectOne(wrapper);
+        if (res != null) {
+            Map<String, Object> attributes = new HashMap<>();
+            if (objectid != null) {
+                String geom = ghcyjgMapper.intersectsById(res.getTablename(), objectid);
+                return RequestResult.success("查询成功", geom);
+            } else {
+                attributes = ghcyjgMapper.intersects(res.getTablename(), x, y);
+                if (attributes != null) {
+                    attributes.remove("SHAPE");
+                    return RequestResult.success(convertAttributeKeys(attributes));
+                } else {
+                    return RequestResult.success(null);
+                }
+            }
+        } else {
+            return RequestResult.error("参数传递错误,没查到数据!");
+        }
+    }
+
+    // 转换方法
+    public Map<String, Object> convertAttributeKeys(Map<String, Object> attributes) {
+        Map<String, Object> result = new HashMap<>();
+        for (Map.Entry<String, Object> entry : attributes.entrySet()) {
+            String originalKey = entry.getKey();
+            Object value = entry.getValue();
+            // 如果字典中有对应的中文名称,就使用中文名称,否则保持原key
+            String newKey = fieldAliasMap.getOrDefault(originalKey, originalKey);
+            result.put(newKey, value);
+        }
+        return result;
+    }
+}

+ 0 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/task/CoordinateTransformer.java


+ 49 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/oracle/fxpj/GhcyjgMapper.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.onemap.apply.mapper.fxpj.GhcyjgMapper">
+
+    <select id="getTbmj" resultType="java.lang.Double" parameterType="java.lang.String">
+        select round(sum(tbmj) , 2) as tbmj from ${tablename}
+    </select>
+
+    <select id="getGhlx" resultType="java.lang.String" parameterType="java.lang.String">
+        select ghlx from T_YZT_GHCY_SJY t where t.flmc = #{plan} and rownum = 1
+    </select>
+
+    <select id="getStatics" resultType="java.util.Map" parameterType="java.lang.String">
+        select aaa.*, bbb.dlmj from (
+         select t.a_ydyhfldm , t.a_ydyhflmc , t.b_ydyhfldm, t.b_ydyhflmc,  round(sum(tbmj) , 2) as tbmj
+         from ${tablename} t
+         group by t.a_ydyhfldm ,t.a_ydyhflmc ,  t.b_ydyhfldm,  t.b_ydyhflmc order by t.a_ydyhfldm , t.b_ydyhfldm) aaa
+
+         left join (
+              select t.a_ydyhfldm ,  round(sum(tbmj) , 2) as dlmj
+         from ${tablename} t
+         group by t.a_ydyhfldm
+         ) bbb on aaa.a_ydyhfldm = bbb.a_ydyhfldm
+    </select>
+
+    <select id="getZyml" resultType="com.onemap.apply.domain.yzt.ZymlDTO" parameterType="java.lang.String">
+        select * from t_yzt_zyml t where t.bsm in (select serviceid from T_YZT_GHCY_SJY where flmc = #{zymc})
+    </select>
+
+    <select id="getGeom" resultType="java.lang.String" parameterType="java.lang.String">
+        SELECT SDE.ST_AsText(shape) AS geom FROM  ${tablename} t
+    </select>
+
+    <select id="getAttributes" resultType="java.util.Map" parameterType="java.lang.String">
+        SELECT * FROM  ${tablename} t
+    </select>
+
+    <select id="intersects" resultType="java.util.Map">
+        SELECT t.* FROM ${tablename} t
+        WHERE sde.ST_Intersects(shape,  sde.ST_Point( ${x} , ${y}, 4490)) = 1 AND rownum = 1
+    </select>
+
+    <select id="intersectsById" resultType="java.lang.String">
+        SELECT SDE.ST_AsText(shape) AS geom FROM ${tablename} t
+        WHERE t.objectid = ${objectid}
+    </select>
+
+</mapper>

+ 9 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/oracle/fxpj/GhcysjyMapper.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.onemap.apply.mapper.fxpj.GhcysjyMapper">
+
+    <select id="sjylist" parameterType="java.lang.String" resultType="java.util.Map">
+        select distinct(flmc) as "name" from T_YZT_GHCY_SJY t
+    </select>
+</mapper>

+ 6 - 6
onemap-modules/onemap-apply/src/main/resources/mapper/oracle/ghss/ZbmxJcyjMapper.xml

@@ -16,9 +16,9 @@
             resultType="com.onemap.apply.domain.ghss.ZbmxJcpgyjListViewDTO">
         select t.xzqdm as "xzqdm", t.xzqmc as "xzqmc", t.jcz as "xzz", t.jcn as "year"
         from t_zbmx_zbjcz t
-        where
+        where 1 = 1
         <if test="xzqdm != null and xzqdm != ''">
-            t.xzqdm like '%'||#{xzqdm}||'%'
+            and t.xzqdm like '%'||#{xzqdm}||'%'
         </if>
         <if test="year != null and year != ''">
             and t.jcn = to_number(#{year})
@@ -134,9 +134,9 @@
         select a.bsm,a.zbbh,a.xzqdm,a.xzqmc,a.jcz,a.jcn,a.jcy from ( select
         t.bsm,t.zbbh,t.xzqdm,t.xzqmc,t.jcsj,t.jcz,t.jcyh,t.tjsj,t.jcn,t.jcy,row_number() over(order by t.jcsj
         desc) as rowindex
-        from t_zbmx_zbjcz t
+        from t_zbmx_zbjcz t where 1 = 1
         <if test="xzqdm != null and xzqdm != ''">
-            where t.xzqdm = #{xzqdm}
+             and t.xzqdm = #{xzqdm}
         </if>
         <if test="zbbh != null and zbbh != ''">
             and t.zbbh = #{zbbh}
@@ -152,9 +152,9 @@
     <select id="SelectGHMBZ" parameterType="java.lang.String"
             resultType="java.lang.Double">
         select d.jqmbz as "jqmbz" from (select 2025 as "key",a.jqmbz ,row_number() over(order by sysdate) as rowindex
-        from t_zbmx_zbghz a
+        from t_zbmx_zbghz a where 1 = 1
         <if test="xzqdm != null and xzqdm != ''">
-            where a.xzqdm = #{xzqdm}
+            and a.xzqdm = #{xzqdm}
         </if>
         <if test="zbbh != null and zbbh != ''">
             and a.zbbh = #{zbbh}