Explorar el Código

新增地图查询接口,增加地图枚举类,新增地图纠错管理接口

吴瑞豪 hace 2 años
padre
commit
d0fbbec5a2

+ 100 - 12
nngkxxdp/src/main/java/com/example/nngkxxdp/controller/MapDataController.java

@@ -6,6 +6,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.alibaba.fastjson.JSONArray;
+import com.example.nngkxxdp.enums.DictEnum;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpRequest;
 import org.springframework.web.bind.annotation.*;
@@ -91,6 +92,29 @@ public class MapDataController {
     }
 
     /**
+     * 通过当前页码和条数分页查询办理事项
+     *
+     * @param page
+     * @param limit
+     * @param type
+     * @param itemName
+     * @param matterDept
+     * @return
+     */
+    @GetMapping("/getHandMatterPage")
+    public Map<String, Object> getHandMatterPage(int page, int limit, int type, String itemName, String matterDept) {
+        try {
+            if (Blank.isNotEmpty(page) && Blank.isNotEmpty(limit) && Blank.isNotEmpty(type) && page > 0 && limit > 0) {
+                return mapDataService.getHandMatterPage(page, limit, type, itemName, matterDept);
+            }
+            return SendUtil.send(true, null, "page和limit不能为空,且要大于0");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return SendUtil.send(false, ConstStr.DATA_NOT_FOUND);
+    }
+
+    /**
      * 提交纠错信息
      */
     @PostMapping("/saveErrorLog")
@@ -114,20 +138,48 @@ public class MapDataController {
     }
 
     /**
-     * 通过当前页码和条数分页查询办理事项
-     *
-     * @param page
-     * @param limit
-     * @param type
-     * @param itemName
-     * @param matterDept
-     * @return
+     * 编辑纠错信息
      */
-    @GetMapping("/getHandMatterPage")
-    public Map<String, Object> getHandMatterPage(int page, int limit, int type, String itemName, String matterDept) {
+    @PostMapping("/updateErrorLog")
+    public Map<String, Object> updateErrorLog(HttpServletRequest request) {
+        Map<String, Object> mapErrorLog = new HashMap<>();
+        mapErrorLog.put("id", request.getParameter("id"));
+        mapErrorLog.put("newAddress", request.getParameter("newAddress"));
+        mapErrorLog.put("newLongitude", request.getParameter("newLongitude"));
+        mapErrorLog.put("newLatitude", request.getParameter("newLatitude"));
+        mapErrorLog.put("errorState", request.getParameter("errorState"));
         try {
-            if (Blank.isNotEmpty(page) && Blank.isNotEmpty(limit) && Blank.isNotEmpty(type) && page > 0 && limit > 0) {
-                return mapDataService.getHandMatterPage(page, limit, type, itemName, matterDept);
+            return mapDataService.updateErrorLog(mapErrorLog);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return SendUtil.send(false, ConstStr.UPDATEUSER_FAILED);
+    }
+
+    /**
+     * 删除纠错信息
+     */
+    @PostMapping("/deleteErrorLog")
+    public Map<String, Object> deleteErrorLog(Integer id) {
+        try {
+            if (Blank.notBlank(id)) {
+                return mapDataService.deleteErrorLog(id);
+            }
+            return SendUtil.send(false, "", "id为空");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return SendUtil.send(false, ConstStr.DELETEUSER_FAILED);
+    }
+
+    /**
+     * 通过当前页码和条数分页查询地图纠错列表
+     */
+    @GetMapping("/getMapErrorPage")
+    public Map<String, Object> getMapErrorPage(int page, int limit) {
+        try {
+            if (Blank.isNotEmpty(page) && Blank.isNotEmpty(limit) && page > 0 && limit > 0) {
+                return mapDataService.getMapErrorPage(page, limit);
             }
             return SendUtil.send(true, null, "page和limit不能为空,且要大于0");
         } catch (Exception e) {
@@ -136,4 +188,40 @@ public class MapDataController {
         return SendUtil.send(false, ConstStr.DATA_NOT_FOUND);
     }
 
+    /**
+     * 根据ID查询地图纠错详细
+     */
+    @GetMapping("/getMapErrorDetail")
+    public Map<String, Object> getMapErrorDetail(Integer id) {
+        try {
+            if (Blank.notBlank(id)) {
+                return mapDataService.getMapErrorDetail(id);
+            }
+            return SendUtil.send(false, "", "id为空");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return SendUtil.send(false, ConstStr.DATA_NOT_FOUND);
+    }
+
+    /**
+     * 根据地址或类型模糊查询地图
+     */
+    @GetMapping("/queryMap")
+    public Map<String, Object> queryMap(String name, String dictType) {
+        try {
+            if (Blank.isNotEmpty(name) || Blank.isNotEmpty(dictType)) {
+                String type = DictEnum.getName(dictType);
+                if (!"小学".equals(dictType) && !"中学".equals(dictType) && !"特殊教育学校".equals(dictType)) {
+                    dictType = null;
+                }
+                return mapDataService.queryMap(name, type, dictType);
+            }
+            return SendUtil.send(false, "", "查询条件为空");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return SendUtil.send(false, ConstStr.DATA_NOT_FOUND);
+    }
+
 }

+ 12 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/dao/MapDataDao.java

@@ -69,4 +69,16 @@ public interface MapDataDao {
 	List<Map<String, Object>> getHandMatterPage(int startRows, int rows, int type, String itemName, String matterDept);
 
 	Integer longitudeLatitude(Object map);
+
+	Integer getMapErrorCount();
+
+	List<Map<String, Object>> getMapErrorPage(int startRows, int rows);
+
+	List<Map<String, Object>> getMapErrorDetail(Integer id);
+
+	Integer updateErrorLog(Map<String, Object> mapErrorLog);
+
+	Integer deleteErrorLog(Integer id);
+
+	List<Map<String, Object>> queryMap(String name, String type, String dictType);
 }

+ 135 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/enums/DictEnum.java

@@ -0,0 +1,135 @@
+package com.example.nngkxxdp.enums;
+
+public enum DictEnum {
+
+    XXS("小学", "XXS"),
+    DXS("大学", "DXS"),
+    ZYYXS("职业院校", "ZYYXS"),
+    YEYS("幼儿园", "YEYS"),
+    GGFWZXS("公共服务中心", "GGFWZXS"),
+    BMFWZXS("便民服务中心", "BMFWZXS"),
+    DQFWZXS("党群服务中心", "DQFWZXS"),
+    BMS("部门", "BMS"),
+    JZS("街镇", "JZS"),
+    CYCSBMS("查阅场所部门", "CYCSBMS"),
+    CYYS("产业园", "CYYS"),
+    BYFWJGS("殡仪服务机构", "BYFWJGS"),
+    CWSSS("村卫生室", "CWSSS"),
+    SQWSFWZS("社区卫生服务站", "SQWSFWZS"),
+    EKZLFWJGS("儿科诊疗服务机构", "EKZLFWJGS"),
+    KQBPSFCZMZS("狂犬病、破伤风处置门诊", "KQBPSFCZMZS"),
+    MYGHYFJZMZS("免疫规划预防接种门诊", "MYGHYFJZMZS"),
+    EJYLJGS("二级医疗机构", "EJYLJGS"),
+    SJYLJGS("三级医疗机构", "SJYLJGS"),
+    SQWSFWJGS("社区卫生服务机构", "SQWSFWJGS"),
+    ZYBZDJGS("职业病诊断机构", "ZYBZDJGS"),
+    GYS("公园", "GYS"),
+    TCS("停车", "TCS"),
+    GCS("公厕", "GCS"),
+    BDCDJZXBSDTS("不动产登记中心办事大厅", "BDCDJZXBSDTS"),
+    BSFWTS("办税服务厅", "BSFWTS"),
+    SCJDGLJS("市场监督管理局", "SCJDGLJS"),
+    XZFWZXS("行政服务中心", "XZFWZXS"),
+    YBS("医疗保障事务中心", "YBS"),
+    JYKSZXS("教育考试中心", "JYKSZXS"),
+    DKBLDS("贷款办理点", "DKBLDS"),
+    GZCS("公证处", "GZCS"),
+    JZZXS("矫正中心", "JZZXS"),
+    FLYZZXS("法律援助机构", "FLYZZXS"),
+    JYHRCZXS("就业和人才中心", "JYHRCZXS"),
+    SHBXSWZXS("社会保险事务中心", "SHBXSWZXS"),
+    JCFWFWSS("基层司法所", "JCFWFWSS"),
+    SFJDJGS("司法鉴定机构", "SFJDJGS"),
+    HYDJCS("婚姻登记机构", "HYDJCS"),
+    YLFWJGS("养老机构", "YLFWJGS"),
+    CJRFWZXS("残疾人服务中心", "CJRFWZXS"),
+    QTCJRFWZXS("定点残疾人服务机构", "QTCJRFWZXS"),
+    DAGS("档案馆", "DAGS"),
+    ZCYLJG("助产医疗机构", "ZCYLJG"),
+    CKMZFWJGS("产科门诊服务机构", "CKMZFWJGS"),
+    FWGLZXS("房屋管理中心", "FWGLZXS"),
+    CGSS("车管所", "CGSS"),
+    CRJYWBLJGS("出入境业务办理机构", "CRJYWBLJGS"),
+    CJGSHFWZS("车驾管社会服务站", "CJGSHFWZS"),
+    JDCJCCSS("机动车检测场所", "JDCJCCSS"),
+    JSRTJZS("驾驶人体检医院", "JSRTJZS"),
+    JTSGCLJGS("交通事故处理机构", "JTSGCLJGS"),
+    JTWFCLJGS("交通违法处理机构", "JTWFCLJGS"),
+    JTXLJCDDS("交通支大队", "JTXLJCDDS"),
+    PCSS("派出所", "PCSS"),
+    SQS("商圈", "SQS"),
+    GWZXS("购物中心", "GWZXS"),
+    TSGS("图书馆", "TSGS"),
+    WHGS("文化馆", "WHGS"),
+    WGSS("文管所", "WGSS"),
+    GGTYS("公共体育馆", "GGTYS"),
+    JQS("旅游景点", "JQS"),
+    FYS("文化馆", "FYS"),
+    GJJS("公积金", "GJJS"),
+    HSCYDS("核酸采样点", "HSCYDS"),
+    SLCSJZS("查阅场所街镇", "SLCSJZS"),
+    JDS("酒店", "JDS");
+
+    private String value;
+
+    private String name;
+
+    /**
+     * @param name
+     * @param value
+     */
+    private DictEnum(String value, String name) {
+        this.value = value;
+        this.name = name;
+    }
+
+
+    // 普通方法
+    public static String getName(String value) {
+        for (DictEnum c : DictEnum.values()) {
+            if (c.getValue().equals(value)) {
+                return c.name.toLowerCase();
+            }
+        }
+        return "";
+    }
+
+    // 普通方法
+    public static String getValue(String name) {
+        for (DictEnum c : DictEnum.values()) {
+            if (c.getName().equalsIgnoreCase(name)) {
+                return c.value;
+            }
+        }
+        return "";
+    }
+
+    /**
+     * @return the value
+     */
+    public String getValue() {
+        return value;
+    }
+
+    /**
+     * @param value the value to set
+     */
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

+ 10 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/service/MapDataService.java

@@ -53,4 +53,14 @@ public interface MapDataService {
     Map<String, Object> getHandMatterPage(int page, int limit, int type, String itemName, String matterDept);
 
 	Map<String, Object> longitudeLatitude(JSONArray mapList);
+
+	Map<String, Object> getMapErrorPage(int page, int limit);
+
+	Map<String, Object> getMapErrorDetail(Integer id);
+
+	Map<String, Object> updateErrorLog(Map<String, Object> mapErrorLog);
+
+	Map<String, Object> deleteErrorLog(Integer id);
+
+	Map<String, Object> queryMap(String name, String type, String dictType);
 }

+ 48 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/service/impl/MapDataServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.example.nngkxxdp.dao.MapDataDao;
 import com.example.nngkxxdp.entity.MapData;
+import com.example.nngkxxdp.enums.DictEnum;
 import com.example.nngkxxdp.service.MapDataService;
 import com.example.nngkxxdp.util.Blank;
 
@@ -133,4 +134,51 @@ public class MapDataServiceImpl implements MapDataService {
         }
         return SendUtil.send(true, ConstStr.UPDATEUSER_SUCCESS, "");
     }
+
+    @Override
+    public Map<String, Object> getMapErrorPage(int page, int limit) {
+        int startRows = (page - 1) * limit;
+        int count = mapDataDao.getMapErrorCount();
+        if (count > 0) {
+            return SendUtil.layuiTable(count, mapDataDao.getMapErrorPage(startRows, limit));
+        }
+        return SendUtil.layuiTable(0, null);
+    }
+
+    @Override
+    public Map<String, Object> getMapErrorDetail(Integer id) {
+        return SendUtil.send(true, null, mapDataDao.getMapErrorDetail(id));
+    }
+
+    @Override
+    public Map<String, Object> updateErrorLog(Map<String, Object> mapErrorLog) {
+        if (Blank.isEmpty(mapErrorLog.get("id"))) {
+            return SendUtil.send(false, ConstStr.UPDATEUSER_FAILED, "id为空");
+        }
+        mapErrorLog.put("updateTime", DateUtil.parse(sdf.format(new Date()), "yyyy-MM-dd HH:mm:ss"));
+        if (mapDataDao.updateErrorLog(mapErrorLog) <= 0) {
+            return SendUtil.send(false, ConstStr.UPDATEUSER_FAILED, "");
+        }
+        return SendUtil.send(true, ConstStr.UPDATEUSER_SUCCESS, "");
+    }
+
+    @Override
+    public Map<String, Object> deleteErrorLog(Integer id) {
+        if (mapDataDao.deleteErrorLog(id) <= 0) {
+            return SendUtil.send(false, ConstStr.DELETEUSER_FAILED, "");
+        }
+        return SendUtil.send(true, ConstStr.DELETEUSER_SUCCESS, "");
+    }
+
+    @Override
+    public Map<String, Object> queryMap(String name, String type, String dictType) {
+        List<Map<String, Object>> list = mapDataDao.queryMap(name, type, dictType);
+        for (Map<String, Object> map: list) {
+            String value = DictEnum.getValue(String.valueOf(map.get("dictType")));
+            if (Blank.isNotEmpty(value)) {
+                map.replace("dictType", value);
+            }
+        }
+        return SendUtil.send(true, "查询成功", list);
+    }
 }

+ 94 - 0
nngkxxdp/src/main/resources/mapper/MapDataDao.xml

@@ -29,6 +29,11 @@
         TRUNCATE TABLE s_map
     </update>
 
+    <!-- 删除对应ID的地图纠错信息-->
+    <delete id="deleteErrorLog">
+        delete from s_map_errorlog where id = #{id}
+    </delete>
+
     <!-- 根据数据字典类型获取地图数据 -->
     <select id="getMapDataByDictType"
             resultType="com.example.nngkxxdp.entity.MapData">
@@ -90,10 +95,99 @@
         limit #{startRows},#{rows}
     </select>
 
+    <select id="getMapErrorCount" resultType="java.lang.Integer">
+        select count(*)
+        from s_map_errorlog
+    </select>
+
+    <select id="getMapErrorPage" resultType="java.util.Map">
+        SELECT id,
+               s_map_id,
+               address_name,
+               original_address,
+               original_longitude,
+               original_latitude,
+               new_address,
+               new_longitude,
+               new_latitude,
+               error_state,
+               create_time,
+               update_time
+        FROM s_map_errorlog
+        order by id DESC
+        limit #{startRows},#{rows}
+    </select>
+
+    <select id="getMapErrorDetail" resultType="java.util.Map">
+        SELECT sme.id,
+               sme.s_map_id,
+               sme.address_name,
+               sme.original_address,
+               sme.original_longitude,
+               sme.original_latitude,
+               sme.new_address,
+               sme.new_longitude,
+               sme.new_latitude,
+               sme.error_state,
+               sme.create_time,
+               sme.update_time,
+               sm.dict_type,
+               sm.address,
+               sm.content,
+               sm.dep,
+               sm.img,
+               sm.gzh,
+               sm.sptype,
+               sm.tel,
+               sm.time,
+               sm.url,
+               sm.type,
+               sm.tag,
+               sm.tag2,
+               sm.tag3,
+               sm.specialtype,
+               sm.create_time mapCreateTime,
+               sm.update_time mapUpdateTime
+        FROM s_map_errorlog sme
+                 left join s_map sm on sm.id = sme.s_map_id
+        where sme.id = #{id}
+    </select>
+
+    <select id="queryMap" resultType="java.util.Map">
+        select address,
+               ifnull(longitude, '') longitude,
+               ifnull(latitude, '') latitude,
+               dep name,
+               IF(dict_type = 'xxs', type, dict_type) dictType
+        from s_map
+        <where>
+            <if test="null != name and '' != name">
+                and dep LIKE CONCAT('%', #{name}, '%')
+            </if>
+            <if test="null != type and '' != type">
+                and dict_type = #{type}
+            </if>
+            <if test="null != dictType and '' != dictType">
+                and type = #{dictType}
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
     <update id="longitudeLatitude">
         UPDATE s_map
         SET longitude = #{longitude},
             latitude  = #{latitude}
         WHERE id = #{id};
     </update>
+
+    <update id="updateErrorLog">
+        UPDATE s_map_errorlog
+        SET new_address = #{newAddress},
+            new_longitude = #{newLongitude},
+            new_latitude = #{newLatitude},
+            error_state = #{errorState},
+            update_time = #{updateTime}
+        WHERE id = #{id};
+    </update>
 </mapper>

+ 0 - 8
nngkxxdp/src/main/resources/mapper/YxnaDao.xml

@@ -77,12 +77,8 @@
             <if test="examineState == null and pictureType == null and isAlbum == null and uploadTime ==null and updateTime == null">
                 examine_state ASC,
             </if>
-            <if test="uploadTime == null">
                 upload_time DESC,
-            </if>
-            <if test="updateTime == null">
                 update_time DESC
-            </if>
         </where>
         limit #{startRows},#{rows}
     </select>
@@ -273,12 +269,8 @@
             <if test="examineState == null and pictureType == null and uploadTime == null and updateTime == null">
                 i.examine_state ASC,
             </if>
-            <if test="uploadTime == null">
                 i.upload_time DESC,
-            </if>
-            <if test="updateTime == null">
                 i.update_time DESC
-            </if>
         </where>
         limit #{startRows},#{rows}
     </select>