Forráskód Böngészése

后台运维接口提交

wanger 1 éve
szülő
commit
2769385eb2

+ 29 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/yzt/searchController.java

@@ -0,0 +1,29 @@
+package com.onemap.apply.controller.yzt;
+
+import com.onemap.apply.domain.yzt.PoiSearchDTO;
+import com.onemap.apply.service.yzt.ISearchService;
+import com.onemap.common.core.web.controller.BaseController;
+import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.common.security.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+@RestController
+@RequestMapping("/yzt/search")
+public class searchController extends BaseController {
+
+    @Autowired
+    private ISearchService searchService;
+
+
+    /**
+     * 兴趣点查询
+     *
+     * @return
+     */
+    @PostMapping("/poi")
+    public RequestResult poi(@RequestBody PoiSearchDTO poiSearchDTO) {
+        return searchService.poi(poiSearchDTO);
+    }
+}

+ 40 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/yzt/PoiDTO.java

@@ -0,0 +1,40 @@
+package com.onemap.apply.domain.yzt;
+
+public class PoiDTO {
+    private String name ;
+    private String address ;
+    private String x ;
+    private String y ;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getX() {
+        return x;
+    }
+
+    public void setX(String x) {
+        this.x = x;
+    }
+
+    public String getY() {
+        return y;
+    }
+
+    public void setY(String y) {
+        this.y = y;
+    }
+}

+ 34 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/yzt/PoiSearchDTO.java

@@ -0,0 +1,34 @@
+package com.onemap.apply.domain.yzt;
+
+/**
+ * 兴趣点查询参数实体
+ */
+public class PoiSearchDTO {
+    private String name ;
+    private Integer limit;
+    private Integer offset ;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public void setLimit(Integer limit) {
+        this.limit = limit;
+    }
+
+    public Integer getOffset() {
+        return offset;
+    }
+
+    public void setOffset(Integer offset) {
+        this.offset = offset;
+    }
+}

+ 28 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/yzt/ZymlTreeDataDTO.java

@@ -15,11 +15,38 @@ public class ZymlTreeDataDTO {
     private String title;
     private String type;
     private String url;
+    private String source;
+    private String favorite;
     private Boolean disabled = false;
+    private Boolean checked = false;
     private Boolean expand = false;
-    private Boolean contextmenu = true;
+    private Boolean contextmenu = false;
     private List<ZymlTreeDataDTO> children = new ArrayList<>();
 
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
+    public Boolean getChecked() {
+        return checked;
+    }
+
+    public void setChecked(Boolean checked) {
+        this.checked = checked;
+    }
+
+    public String getFavorite() {
+        return favorite;
+    }
+
+    public void setFavorite(String favorite) {
+        this.favorite = favorite;
+    }
+
     public Boolean getExpand() {
         return expand;
     }

+ 19 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/yzt/SearchMapper.java

@@ -0,0 +1,19 @@
+package com.onemap.apply.mapper.yzt;
+
+import com.onemap.apply.domain.yzt.*;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 资源目录 数据层
+ *
+ * @author onemap
+ */
+@Mapper
+public interface SearchMapper {
+    List<PoiDTO> poi(@Param("name") String name, @Param("limit") Integer limit, @Param("offset") Integer offset);
+
+    Integer poicount(@Param("name") String name);
+}

+ 41 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/yzt/SearchServiceImpl.java

@@ -0,0 +1,41 @@
+package com.onemap.apply.service.impl.yzt;
+
+import com.onemap.apply.domain.yzt.*;
+import com.onemap.apply.mapper.yzt.SearchMapper;
+import com.onemap.apply.mapper.yzt.ZymlMapper;
+import com.onemap.apply.service.yzt.ISearchService;
+import com.onemap.apply.service.yzt.IZymlService;
+import com.onemap.common.core.utils.StringUtils;
+import com.onemap.common.core.web.domain.RequestResult;
+import com.onemap.common.datasource.annotation.Slave;
+import com.onemap.common.security.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+@Service
+public class SearchServiceImpl implements ISearchService {
+
+    @Autowired
+    private SearchMapper searchMapper;
+
+
+    @Override
+    @Slave
+    public RequestResult poi(PoiSearchDTO poiSearchDTO) {
+        try {
+            Map data = new HashMap();
+            List<PoiDTO> res = searchMapper.poi(poiSearchDTO.getName(), poiSearchDTO.getLimit(), poiSearchDTO.getOffset());
+            data.put("data", res);
+            Integer count = searchMapper.poicount(poiSearchDTO.getName());
+            data.put("count", count);
+            return RequestResult.success("查询成功!", data);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return RequestResult.error("查询成功!");
+    }
+}

+ 29 - 9
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/yzt/ZymlServiceImpl.java

@@ -71,7 +71,7 @@ public class ZymlServiceImpl implements IZymlService {
         try {
             List<ZymlDTO> res = new ArrayList<>();
             if (StringUtils.isEmpty(SecurityUtils.getUsername())) {
-                res = zymlMapper.GetList("", param, "");
+                res = zymlMapper.GetList("admin", param, "");
             } else {
                 String resources = SecurityUtils.getLoginUser().getSysUser().getDept().getResources();
                 String username = SecurityUtils.getUsername();
@@ -105,6 +105,8 @@ public class ZymlServiceImpl implements IZymlService {
                 c.setTitle(cur.getName());
                 c.setType(cur.getType());
                 c.setUrl(cur.getUrl());
+                c.setSource(cur.getSde());
+                c.setFavorite(cur.getMy());
                 treedata.add(c);
             }
             List<ZymlTreeDataDTO> data = buildDeptTree2(treedata);
@@ -183,16 +185,33 @@ public class ZymlServiceImpl implements IZymlService {
         try {
             String username = SecurityUtils.getUsername();
             if ("".equals(username)) {
-                return RequestResult.error("登录信息获取失败", null);
+                username = "admin";
+                //return RequestResult.error("登录信息获取失败", null);
             }
-            String userXzqdm = SecurityUtils.getLoginUserXzq();
+//            String userXzqdm = SecurityUtils.getLoginUserXzq();
             List<ZymlDTO> res = new ArrayList<>();
-            if (StringUtils.isXzqhQuery(userXzqdm)) {
-                res = zymlMapper.GetMyCollect4XZQH(username, userXzqdm);
-            } else {
-                res = zymlMapper.GetMyCollect(username);
+            res = zymlMapper.GetMyCollect(username);
+//            if (StringUtils.isXzqhQuery(userXzqdm)) {
+//                res = zymlMapper.GetMyCollect4XZQH(username, userXzqdm);
+//            } else {
+//                res = zymlMapper.GetMyCollect(username);
+//            }
+            List<ZymlTreeDataDTO> treedata = new ArrayList<>();
+            for (int i = 0; i < res.size(); i++) {
+                ZymlDTO cur = res.get(i);
+                ZymlTreeDataDTO c = new ZymlTreeDataDTO();
+//                c.setDisabled((cur.getParent() == 1));
+                c.setId(cur.getBsm());
+                c.setPid(cur.getPbsm());
+                c.setLabel(cur.getName());
+                c.setTitle(cur.getName());
+                c.setType(cur.getType());
+                c.setSource(cur.getSde());
+                c.setFavorite(cur.getMy());
+                c.setUrl(cur.getUrl());
+                treedata.add(c);
             }
-            return RequestResult.success("成功", res);
+            return RequestResult.success("成功", treedata);
         } catch (Exception e) {
             e.printStackTrace();
             return RequestResult.error("失败", null);
@@ -226,7 +245,8 @@ public class ZymlServiceImpl implements IZymlService {
             }
             String username = SecurityUtils.getUsername();
             if ("".equals(username)) {
-                return RequestResult.error("登录信息获取失败", null);
+                username = "admin";
+//                return RequestResult.error("登录信息获取失败", null);
             }
             ZymlBsmDTO zymlBsmDTO = new ZymlBsmDTO();
             zymlBsmDTO.setBsm(bsm);

+ 11 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/yzt/ISearchService.java

@@ -0,0 +1,11 @@
+package com.onemap.apply.service.yzt;
+
+import com.onemap.apply.domain.yzt.PoiSearchDTO;
+import com.onemap.common.core.web.domain.RequestResult;
+
+import java.util.Map;
+
+public interface ISearchService {
+
+    RequestResult poi(PoiSearchDTO poiSearchDTO);
+}

+ 25 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/yzt/SearchMapper.xml

@@ -0,0 +1,25 @@
+<?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.yzt.SearchMapper">
+
+
+    <select id="poi" parameterType="java.lang.String" resultType="com.onemap.apply.domain.yzt.PoiDTO">
+        SELECT t.name,t.adress,st_x ( t.geom ) x,st_y ( t.geom ) y
+FROM
+	 poi t
+WHERE
+	t.name LIKE '%'|| #{name} || '%'
+	LIMIT ${limit} OFFSET  ${offset}
+    </select>
+
+    <select id="poicount" parameterType="java.lang.String" resultType="java.lang.Integer">
+        SELECT count(1)
+FROM
+	 poi t
+WHERE
+	t.name LIKE '%'|| #{name} || '%'
+    </select>
+
+</mapper>

+ 10 - 17
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/yzt/ZymlMapper.xml

@@ -40,12 +40,8 @@
         t.sjly as "sjly",
         t.legend as "legend",
         t.ywlx as "ywlx",
-        (select distinct(uhbm) from t_yzt_zyml_my my where my.zy_bsm = t.bsm and my.uhbm = #{username}) as "my",
-        to_char(res.datetime ,'yyyy-MM-dd hh24:mi:ss') as "datetime",
-        (select usertable.nick_name from sys_user usertable where usertable.user_name = res.createperson) as
-        "createperson"
-        from t_yzt_zyml t left join t_yzt_db_layer dblayer on dblayer.id = t.sde
-        left join tb_resourcehooktb res on res.name = replace(dblayer.source, 'SDE.','')
+        (select distinct(uhbm) from t_yzt_zyml_my my where my.zy_bsm = t.bsm and my.uhbm = #{username}) as "my"
+        from t_yzt_zyml t
         where 1 = 1
         <if test="param != null and param != ''">
             and t.bsm in (WITH RECURSIVE a AS (
@@ -117,7 +113,7 @@
           null as "url",
           t.state as "state",
           case when t.parent = 0 then 1 else 0 end  as "type"
-       from t_yzt_zyml t left join t_yzt_db_layer dblayer on dblayer.id = t.sde  order by t.lev,t.pbsm , t.sort
+       from t_yzt_zyml t  order by t.lev,t.pbsm , t.sort
     </select>
 
     <select id="GetMyCollect" parameterType="java.lang.String" resultType="com.onemap.apply.domain.yzt.ZymlDTO">
@@ -125,10 +121,10 @@
           0 as "count",
            t.bsm as "bsm",
           t.name as "name",
-           case when t.sde is null then t.type else to_char(dblayer.servicetype) end as "type",
+          t.type as "type",
           t.pbsm as "pbsm",
           t.icon as "icon",
-          case when t.sde is null then t.url else to_char(dblayer.address) end as "url",
+          t.url as "url",
           t.lev as "lev",
           t.sort as "sort",
           t.state as "state",
@@ -148,11 +144,8 @@
           t.legend as "legend",
         t.ywlx as "ywlx",
         #{username} as "my",
-          null as "fzbsm",
-          to_char(res.datetime ,'yyyy-MM-dd hh24:mi:ss') as "datetime",
-        (select usertable.nick_name from sys_user usertable where usertable.user_name = res.createperson) as "createperson"
-       from T_YZT_ZYML t  left join t_yzt_db_layer dblayer on dblayer.id = t.sde
-       left join tb_resourcehooktb res on res.name = replace(dblayer.source, 'SDE.','')
+        #{username} as "favorite"
+       from T_YZT_ZYML t
        where t.bsm in ((select distinct(my.zy_bsm) from T_YZT_ZYML_MY my where my.uhbm = #{username})) order by t.bsm
     </select>
     <select id="GetMyCollect4XZQH" parameterType="java.lang.String" resultType="com.onemap.apply.domain.yzt.ZymlDTO">
@@ -196,10 +189,10 @@
         0 as "count",
         t.bsm as "bsm",
         t.name as "name",
-        case when t.sde is null then t.type else to_char(dblayer.servicetype) end as "type",
+        t.type as "type",
         t.pbsm as "pbsm",
         t.icon as "icon",
-        case when t.sde is null then t.url else to_char(dblayer.address) end as "url",
+       t.url as "url",
         t.lev as "lev",
         t.sort as "sort",
         t.state as "state",
@@ -220,7 +213,7 @@
         t.ywlx as "ywlx",
         null as "my",
         null as "fzbsm"
-        from T_YZT_ZYML t left join t_yzt_db_layer dblayer on dblayer.id = t.sde where t.bsm in
+        from T_YZT_ZYML t where t.bsm in
         <foreach collection="array" item="bsm" open="(" separator="," close=")">
             #{bsm}
         </foreach>

+ 4 - 4
onemap-modules/onemap-system/src/main/resources/mapper/postgresql/system/SysMenuMapper.xml

@@ -157,8 +157,8 @@
             <if test="path != null and path != ''">path = #{path},</if>
             <if test="component != null">component = #{component},</if>
             <if test="query != null">query = #{query},</if>
-            <if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
-            <if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
+            <if test="isFrame != null and isFrame != ''">is_frame = CAST (#{isFrame} as numeric),</if>
+            <if test="isCache != null and isCache != ''">is_cache = CAST (#{isCache} as numeric),</if>
             <if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
             <if test="visible != null">visible = #{visible},</if>
             <if test="status != null">status = #{status},</if>
@@ -205,8 +205,8 @@
         <if test="path != null and path != ''">#{path},</if>
         <if test="component != null and component != ''">#{component},</if>
         <if test="query != null and query != ''">#{query},</if>
-        <if test="isFrame != null and isFrame != ''">#{isFrame},</if>
-        <if test="isCache != null and isCache != ''">#{isCache},</if>
+        <if test="isFrame != null and isFrame != ''">CAST (#{isFrame} as numeric),</if>
+        <if test="isCache != null and isCache != ''">CAST (#{isCache} as numeric),</if>
         <if test="menuType != null and menuType != ''">#{menuType},</if>
         <if test="visible != null">#{visible},</if>
         <if test="status != null">#{status},</if>

+ 4 - 4
onemap-modules/onemap-system/src/main/resources/mapper/postgresql/system/SysRoleMapper.xml

@@ -113,10 +113,10 @@
         (select CASE WHEN max(role_id) is null THEN 1 ELSE max(role_id) + 1 END from sys_role),
         <if test="roleName != null and roleName != ''">#{roleName},</if>
         <if test="roleKey != null and roleKey != ''">#{roleKey},</if>
-        <if test="roleSort != null and roleSort != ''">#{roleSort},</if>
+        <if test="roleSort != null and roleSort != ''">CAST (#{roleSort} as numeric),</if>
         <if test="dataScope != null and dataScope != ''">#{dataScope},</if>
-        <if test="menuCheckStrictly != null">#{menuCheckStrictly},</if>
-        <if test="deptCheckStrictly != null">#{deptCheckStrictly},</if>
+        <if test="menuCheckStrictly != null">boolean_to_numeric(#{menuCheckStrictly}),</if>
+        <if test="deptCheckStrictly != null">boolean_to_numeric(#{deptCheckStrictly}),</if>
         <if test="status != null and status != ''">#{status},</if>
         <if test="remark != null and remark != ''">#{remark},</if>
         <if test="createBy != null and createBy != ''">#{createBy},</if>
@@ -132,7 +132,7 @@
             <if test="roleSort != null and roleSort != ''">role_sort = CAST (#{roleSort} as numeric),</if>
             <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
             <if test="menuCheckStrictly != null">menu_check_strictly = boolean_to_numeric(#{menuCheckStrictly}),</if>
-            <if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if>
+            <if test="deptCheckStrictly != null">dept_check_strictly = boolean_to_numeric(#{deptCheckStrictly}),</if>
             <if test="status != null and status != ''">status = #{status},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>