ソースを参照

巡视计划管理:添加编辑巡视计划、巡视计划列表、巡视计划详情、巡视任务列表

zhj 2 年 前
コミット
c545fc83c0
25 ファイル変更1042 行追加0 行削除
  1. 6 0
      pom.xml
  2. 3 0
      src/main/java/com/welampiot/common/InterfaceResultEnum.java
  3. 250 0
      src/main/java/com/welampiot/controller/PatrolManageController.java
  4. 28 0
      src/main/java/com/welampiot/dao/PatrolManageDao.java
  5. 25 0
      src/main/java/com/welampiot/dao/PatrolSpotDao.java
  6. 21 0
      src/main/java/com/welampiot/dao/PatrolTaskDao.java
  7. 19 0
      src/main/java/com/welampiot/dao/PatrolTaskSpotDao.java
  8. 42 0
      src/main/java/com/welampiot/dto/PatrolManageDTO.java
  9. 29 0
      src/main/java/com/welampiot/dto/PatrolSpotDTO.java
  10. 62 0
      src/main/java/com/welampiot/dto/PatrolTaskDTO.java
  11. 33 0
      src/main/java/com/welampiot/dto/PatrolTaskSpotDTO.java
  12. 27 0
      src/main/java/com/welampiot/service/PatrolManageService.java
  13. 24 0
      src/main/java/com/welampiot/service/PatrolSpotService.java
  14. 21 0
      src/main/java/com/welampiot/service/PatrolTaskService.java
  15. 18 0
      src/main/java/com/welampiot/service/PatrolTaskSpotService.java
  16. 50 0
      src/main/java/com/welampiot/service/impl/PatrolManageServiceImpl.java
  17. 44 0
      src/main/java/com/welampiot/service/impl/PatrolSpotServiceImpl.java
  18. 35 0
      src/main/java/com/welampiot/service/impl/PatrolTaskServiceImpl.java
  19. 29 0
      src/main/java/com/welampiot/service/impl/PatrolTaskSpotServiceImpl.java
  20. 41 0
      src/main/java/com/welampiot/vo/PatrolManageVO.java
  21. 45 0
      src/main/java/com/welampiot/vo/PatrolTaskVO.java
  22. 70 0
      src/main/resources/mapper/PatrolManageMapper.xml
  23. 31 0
      src/main/resources/mapper/PatrolSpotMapper.xml
  24. 78 0
      src/main/resources/mapper/PatrolTaskMapper.xml
  25. 11 0
      src/main/resources/mapper/PatrolTaskSpotMapper.xml

+ 6 - 0
pom.xml

@@ -134,6 +134,12 @@
             <version>3.4</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.json</groupId>
+            <artifactId>json</artifactId>
+            <version>20230227</version>
+        </dependency>
+
     </dependencies>
 
     <repositories>  <!-- 配置阿里云镜像仓库 -->

+ 3 - 0
src/main/java/com/welampiot/common/InterfaceResultEnum.java

@@ -104,6 +104,9 @@ public enum InterfaceResultEnum {
     LACK_OPEN_TIME_ERROR("0297","发生时间不能为空","The occurrence time cannot be empty","Время не может быть пустым"),
     LACK_LEVEL_ERROR("0298","请选择严重程度","Please select Severity","Пожалуйста, выберите степень серьезности"),
     LACK_SCRIPT_ERROR("0299","请填写工单描述","Please fill in the description of the work order","Пожалуйста, заполните список работников"),
+    LACK_PATROL_TIME_ERROR("0300","巡视计划时间不能为空","Patrol plan time can't be empty","Время обхода не должно быть пустым"),
+    LACK_PATROL_SPOT_NAME_ERROR("0301","巡视点名称不能为空","The patrol point name cannot be empty","Название места обхода не может быть пустым"),
+    TIME_EXCEPTION_ERROR("0302","开始时间不能大于结束时间","The start time cannot be later than the end time","Время начала не может быть больше времени конца"),
     ;
     private String code;
     private String msgCn;

+ 250 - 0
src/main/java/com/welampiot/controller/PatrolManageController.java

@@ -0,0 +1,250 @@
+package com.welampiot.controller;
+
+import com.welampiot.common.BaseResult;
+import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.dto.PatrolManageDTO;
+import com.welampiot.dto.PatrolSpotDTO;
+import com.welampiot.dto.PatrolTaskDTO;
+import com.welampiot.dto.PatrolTaskSpotDTO;
+import com.welampiot.service.*;
+import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.PatrolManageVO;
+import com.welampiot.vo.PatrolTaskVO;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * ClassName: PatrolManageController
+ * Package: com.welampiot.controller
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/29 - 16:54
+ * @Version: v1.0
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/patrolManage")
+public class PatrolManageController {
+    @Autowired
+    private ToolUtils toolUtils;
+
+    @Autowired
+    private PatrolManageService patrolManageService;
+
+    @Autowired
+    private PatrolSpotService patrolSpotService;
+
+    @Autowired
+    private RepairPersonnelService repairPersonnelService;
+
+    @Autowired
+    private PatrolTaskService patrolTaskService;
+
+    @Autowired
+    private PatrolTaskSpotService patrolTaskSpotService;
+
+    /**
+     * 巡视计划列表
+     * @param request 分页、路段筛选、关键字搜索
+     * @return 巡视计划列表
+     */
+    @RequestMapping(value = "/patrolManageList", method = RequestMethod.POST)
+    public BaseResult<?> patrolManageList(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
+        Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
+        Integer provinceId = (Integer) toolUtils.getRequestContent(request,"provinceId",1);
+        Integer cityId = (Integer) toolUtils.getRequestContent(request,"cityId",1);
+        String keyword = (String) toolUtils.getRequestContent(request,"keyword",2);
+        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));
+        int count = request.getParameter("count") == null ? 16 : Integer.parseInt(request.getParameter("count"));
+
+        PatrolManageVO vo = new PatrolManageVO();
+        vo.setPage(count * (page - 1));
+        vo.setCount(count);
+        vo.setSectionId(sectionId);
+        vo.setAreaId(areaId);
+        vo.setCityId(cityId);
+        vo.setProvinceId(provinceId);
+        vo.setKeyword(keyword);
+        vo.setSectionList(toolUtils.getSectionList(request));
+        List<PatrolManageDTO> patrolManageList = patrolManageService.getPatrolManageList(vo);
+        List<PatrolManageDTO> list = new ArrayList<>();
+        patrolManageList.forEach(patrolManageDTO -> {
+            if (patrolManageDTO.getId() != null) {
+                List<PatrolSpotDTO> spotList = patrolSpotService.getPatrolSpotList(patrolManageDTO.getId());
+                patrolManageDTO.setSpotList(spotList);
+            }
+            list.add(patrolManageDTO);
+        });
+        PatrolManageVO patrolManageVO = new PatrolManageVO();
+        patrolManageVO.setList(list);
+        patrolManageVO.setTotal(patrolManageService.getPatrolManageCount(vo));
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,patrolManageVO);
+    }
+
+    /**
+     * 巡视计划下拉列表
+     * @param request 用户名
+     * @return 巡视计划下拉列表
+     */
+    @RequestMapping(value = "/patrolManageNav", method = RequestMethod.POST)
+    public BaseResult<?> patrolManageNav(HttpServletRequest request) {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        String username = (String) toolUtils.getRequestContent(request,"username",2);
+        if (username == null) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        Integer userid = repairPersonnelService.getUserIdByUsername(username);
+        List<PatrolManageDTO> patrolDownList = patrolManageService.getPatrolDownList(userid);
+        PatrolManageVO patrolManageVO = new PatrolManageVO();
+        patrolManageVO.setList(patrolDownList);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,patrolManageVO);
+    }
+
+    /**
+     * 添加编辑巡视计划
+     * @param request 要添加编辑的巡视属性
+     * @return 更新巡视计划数据
+     */
+    @RequestMapping(value = "/savePatrolManage", method = RequestMethod.POST)
+    public BaseResult<?> savePatrolManage(HttpServletRequest request) throws ParseException {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
+        Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
+        Integer count = (Integer) toolUtils.getRequestContent(request,"count",1);
+        String planStartTime = (String) toolUtils.getRequestContent(request,"planStartTime",2);
+        String planEndTime = (String) toolUtils.getRequestContent(request,"planEndTime",2);
+        String username = (String) toolUtils.getRequestContent(request,"username",2);
+        String spotList = (String) toolUtils.getRequestContent(request,"spotList",2);
+
+        if (sectionId == 0) return toolUtils.response(InterfaceResultEnum.LACK_SECTION_ERROR,version);
+        if (planStartTime.length() == 0 || planEndTime.length() == 0)
+            return toolUtils.response(InterfaceResultEnum.LACK_PATROL_TIME_ERROR,version);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        long startTime = simpleDateFormat.parse(planStartTime).getTime();
+        long endTime = simpleDateFormat.parse(planEndTime).getTime();
+        if (startTime > endTime)
+            return toolUtils.response(InterfaceResultEnum.TIME_EXCEPTION_ERROR,version);
+        if (spotList.length() == 0)
+            return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        JSONArray spotArray = new JSONArray(spotList);
+
+        PatrolManageDTO patrolManageDTO = new PatrolManageDTO();
+        patrolManageDTO.setSectionId(sectionId);
+        patrolManageDTO.setCount(count);
+        patrolManageDTO.setPlanStartTime(planStartTime);
+        patrolManageDTO.setPlanEndTime(planEndTime);
+        if (id == 0) { // 添加
+            Integer userid = repairPersonnelService.getUserIdByUsername(username);
+            patrolManageDTO.setUserid(userid);
+            long l = System.currentTimeMillis();
+            String format = simpleDateFormat.format(l);
+            patrolManageDTO.setCreateTime(format);
+            patrolManageService.addPatrolManageData(patrolManageDTO);
+            Integer dtoId = patrolManageDTO.getId();
+            for (int i = 0; i < spotArray.length(); i ++) {
+                JSONObject spotObject = spotArray.getJSONObject(i);
+                String longitude = spotObject.getString("longitude");
+                String latitude = spotObject.getString("latitude");
+                String name = spotObject.getString("name");
+                if (longitude.length() == 0 || latitude.length() == 0)
+                    return toolUtils.response(InterfaceResultEnum.LACK_LOCATION_ERROR,version);
+                if (name.length() == 0)
+                    return toolUtils.response(InterfaceResultEnum.LACK_PATROL_SPOT_NAME_ERROR,version);
+                PatrolSpotDTO patrolSpotDTO = new PatrolSpotDTO();
+                patrolSpotDTO.setLatitude(latitude);
+                patrolSpotDTO.setLongitude(longitude);
+                patrolSpotDTO.setName(name);
+                patrolSpotDTO.setPatrolManageId(dtoId);
+                patrolSpotService.addPatrolSpotData(patrolSpotDTO);
+            }
+        } else { // 编辑
+            patrolManageDTO.setId(id);
+            patrolManageService.updatePatrolManageData(patrolManageDTO);
+            // 删除之前的数据,重新添加新数据
+            patrolSpotService.deletePatrolSpotIdByManageId(id);
+            PatrolSpotDTO spotDTO = new PatrolSpotDTO();
+            spotDTO.setPatrolManageId(id);
+            for (int i = 0; i < spotArray.length(); i ++) {
+                JSONObject spotObject = spotArray.getJSONObject(i);
+                String longitude = spotObject.getString("longitude");
+                String latitude = spotObject.getString("latitude");
+                String name = spotObject.getString("name");
+                if (longitude.length() == 0 || latitude.length() == 0)
+                    return toolUtils.response(InterfaceResultEnum.LACK_LOCATION_ERROR,version);
+                if (name.length() == 0)
+                    return toolUtils.response(InterfaceResultEnum.LACK_PATROL_SPOT_NAME_ERROR,version);
+                spotDTO.setName(name);
+                spotDTO.setLatitude(latitude);
+                spotDTO.setLongitude(longitude);
+                patrolSpotService.addPatrolSpotData(spotDTO);
+            }
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
+
+    /**
+     * 巡视任务列表
+     * @param request 分页,路段筛选
+     * @return 巡视任务列表
+     */
+    @RequestMapping(value = "/patrolTaskList", method = RequestMethod.POST)
+    public BaseResult<?> patrolTaskList(HttpServletRequest request) throws ParseException {
+        Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
+        Integer page = (Integer) toolUtils.getRequestContent(request,"page",1);
+        Integer count = (Integer) toolUtils.getRequestContent(request,"count",1);
+        Integer status = (Integer) toolUtils.getRequestContent(request,"status",1);
+        Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
+        Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
+        Integer provinceId = (Integer) toolUtils.getRequestContent(request,"provinceId",1);
+        Integer cityId = (Integer) toolUtils.getRequestContent(request,"cityId",1);
+        String username = (String) toolUtils.getRequestContent(request,"username",2);
+        String keyword = (String) toolUtils.getRequestContent(request,"keyword",2);
+        String date = (String) toolUtils.getRequestContent(request,"date",2);
+        if (username == null) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        String startDate = "", endDate = "";
+        if (date.length() != 0) {
+            List<String> strings = Arrays.asList(date.split("/"));
+            startDate = strings.get(0) + " 00:00:00";
+            endDate = strings.get(1) + " 23:59:59";
+        }
+
+        PatrolTaskVO patrolTaskVO = new PatrolTaskVO();
+        patrolTaskVO.setPage(page);
+        patrolTaskVO.setCount(count);
+        patrolTaskVO.setStatus(status);
+        patrolTaskVO.setAreaId(areaId);
+        patrolTaskVO.setSectionId(sectionId);
+        patrolTaskVO.setProvinceId(provinceId);
+        patrolTaskVO.setCityId(cityId);
+        patrolTaskVO.setKeyword(keyword);
+        patrolTaskVO.setStartDate(startDate);
+        patrolTaskVO.setEndDate(endDate);
+
+        List<PatrolTaskDTO> patrolTaskList = patrolTaskService.getPatrolTaskList(patrolTaskVO);
+        List<PatrolTaskDTO> list = new ArrayList<>();
+        patrolTaskList.forEach(dto -> {
+            if (dto.getId() != null) {
+                List<PatrolTaskSpotDTO> patrolTaskSpotList = patrolTaskSpotService.getPatrolTaskSpotList(dto.getId());
+                dto.setSpotList(patrolTaskSpotList);
+            }
+            list.add(dto);
+        });
+        PatrolTaskVO vo = new PatrolTaskVO();
+        vo.setList(list);
+        vo.setTotal(patrolTaskService.getPatrolTaskTotal(patrolTaskVO));
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
+    }
+}

+ 28 - 0
src/main/java/com/welampiot/dao/PatrolManageDao.java

@@ -0,0 +1,28 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.PatrolManageDTO;
+import com.welampiot.vo.PatrolManageVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolManageDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/29 - 16:43
+ * @Version: v1.0
+ */
+public interface PatrolManageDao {
+    List<PatrolManageDTO> getPatrolManageList(PatrolManageVO vo);
+
+    Integer getPatrolManageCount(PatrolManageVO vo);
+
+    List<PatrolManageDTO> getPatrolDownList(@Param("userid") Integer userid);
+
+    void addPatrolManageData(PatrolManageDTO dto);
+
+    void updatePatrolManageData(PatrolManageDTO dto);
+}

+ 25 - 0
src/main/java/com/welampiot/dao/PatrolSpotDao.java

@@ -0,0 +1,25 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.PatrolSpotDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolSpotDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/29 - 16:49
+ * @Version: v1.0
+ */
+public interface PatrolSpotDao {
+    List<PatrolSpotDTO> getPatrolSpotList(@Param("id") Integer id);
+
+    void addPatrolSpotData(PatrolSpotDTO dto);
+
+    void updatePatrolSpotData(PatrolSpotDTO dto);
+
+    void deletePatrolSpotIdByManageId(@Param("id") Integer id);
+}

+ 21 - 0
src/main/java/com/welampiot/dao/PatrolTaskDao.java

@@ -0,0 +1,21 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.PatrolTaskDTO;
+import com.welampiot.vo.PatrolTaskVO;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolTaskDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/30 - 18:27
+ * @Version: v1.0
+ */
+public interface PatrolTaskDao {
+    List<PatrolTaskDTO> getPatrolTaskList(PatrolTaskVO vo);
+
+    Integer getPatrolTaskTotal(PatrolTaskVO vo);
+}

+ 19 - 0
src/main/java/com/welampiot/dao/PatrolTaskSpotDao.java

@@ -0,0 +1,19 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.PatrolTaskSpotDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolTaskSpotDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/30 - 19:01
+ * @Version: v1.0
+ */
+public interface PatrolTaskSpotDao {
+    List<PatrolTaskSpotDTO> getPatrolTaskSpotList(@Param("id") Integer id);
+}

+ 42 - 0
src/main/java/com/welampiot/dto/PatrolManageDTO.java

@@ -0,0 +1,42 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: PatrolManageDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/29 - 14:37
+ * @Version: v1.0
+ */
+@Data
+public class PatrolManageDTO implements Serializable {
+    private Integer id;
+
+    private Integer userid;
+
+    private String createTime;
+
+    private String name; // 任务名称
+
+    private String number; // 巡视编号
+
+    private String task; // 任务描述
+
+    private Integer sectionId;
+
+    private String planStartTime; // 计划开始时间
+
+    private String planEndTime; // 计划结束时间
+
+    private Integer count; // 巡视计划次数
+
+    private List<PatrolSpotDTO> spotList;
+
+    private static final long serialVersionUID = 1L;
+}

+ 29 - 0
src/main/java/com/welampiot/dto/PatrolSpotDTO.java

@@ -0,0 +1,29 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: PatrolSpotDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/29 - 16:12
+ * @Version: v1.0
+ */
+@Data
+public class PatrolSpotDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+
+    private Integer patrolManageId;
+
+    private String name;
+
+    private String longitude;
+
+    private String latitude;
+}

+ 62 - 0
src/main/java/com/welampiot/dto/PatrolTaskDTO.java

@@ -0,0 +1,62 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: PatrolTaskDTO
+ * Package: com.welampiot.dto
+ * Description: 巡视任务
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/30 - 17:40
+ * @Version: v1.0
+ */
+@Data
+public class PatrolTaskDTO implements Serializable {
+    private Integer id;
+
+    private Integer userid;
+
+    private String createTime;
+
+    private String name; // 任务名称
+
+    private String number; // 巡视编号
+
+    private String task; // 任务描述
+
+    private Integer workId; // 巡视人id
+
+    private String time; // 巡视时间
+
+    private String workName; // 巡视人名称
+
+    private String patrolObject; // 巡检对象
+
+    private Integer status; // 任务状态(0 未开始,1 巡视中,2 巡视结束,3 结案归档,4 延期)
+
+    private Integer sectionId;
+
+    private Integer type; // 计划类型(0 常规巡检,1 紧急巡检)
+
+    private String planEndTime; // 计划结束时间
+
+    private Integer patrolManageId; // 巡检计划id
+
+    private String lastTime; // 上一次的执行时间
+
+    private Integer checkStatus; // 抽查状态(0 为抽查,1 计划抽查,2 已抽查)
+
+    private String checkBeginTime; // 计划抽查开始时间
+
+    private String checkEndTime; // 计划抽查结束时间
+
+    private String checkTime; // 抽查结束时间
+
+    private List<PatrolTaskSpotDTO> spotList;
+
+    private static final long serialVersionUID = 1L;
+}

+ 33 - 0
src/main/java/com/welampiot/dto/PatrolTaskSpotDTO.java

@@ -0,0 +1,33 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: PatrolTaskSpotDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/30 - 18:54
+ * @Version: v1.0
+ */
+@Data
+public class PatrolTaskSpotDTO implements Serializable {
+    private Integer id;
+
+    private Integer patrolTaskId; // 巡视任务
+
+    private String name; //巡视点名称
+
+    private String longitude;
+
+    private String latitude;
+
+    private Integer isClock; // 是否打卡(0 否,1 是)
+
+    private String image; // 巡视点图片
+
+    private static final long serialVersionUID = 1L;
+}

+ 27 - 0
src/main/java/com/welampiot/service/PatrolManageService.java

@@ -0,0 +1,27 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.PatrolManageDTO;
+import com.welampiot.vo.PatrolManageVO;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolManageService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/29 - 16:45
+ * @Version: v1.0
+ */
+public interface PatrolManageService {
+    List<PatrolManageDTO> getPatrolManageList(PatrolManageVO vo);
+
+    Integer getPatrolManageCount(PatrolManageVO vo);
+
+    List<PatrolManageDTO> getPatrolDownList(Integer userid);
+
+    void addPatrolManageData(PatrolManageDTO dto);
+
+    void updatePatrolManageData(PatrolManageDTO dto);
+}

+ 24 - 0
src/main/java/com/welampiot/service/PatrolSpotService.java

@@ -0,0 +1,24 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.PatrolSpotDTO;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolSpotService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/29 - 16:50
+ * @Version: v1.0
+ */
+public interface PatrolSpotService {
+    List<PatrolSpotDTO> getPatrolSpotList(Integer id);
+
+    void addPatrolSpotData(PatrolSpotDTO dto);
+
+    void updatePatrolSpotData(PatrolSpotDTO dto);
+
+    void deletePatrolSpotIdByManageId(Integer id);
+}

+ 21 - 0
src/main/java/com/welampiot/service/PatrolTaskService.java

@@ -0,0 +1,21 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.PatrolTaskDTO;
+import com.welampiot.vo.PatrolTaskVO;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolTaskService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/30 - 18:33
+ * @Version: v1.0
+ */
+public interface PatrolTaskService {
+    List<PatrolTaskDTO> getPatrolTaskList(PatrolTaskVO vo);
+
+    Integer getPatrolTaskTotal(PatrolTaskVO vo);
+}

+ 18 - 0
src/main/java/com/welampiot/service/PatrolTaskSpotService.java

@@ -0,0 +1,18 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.PatrolTaskSpotDTO;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolTaskSpotService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/30 - 19:02
+ * @Version: v1.0
+ */
+public interface PatrolTaskSpotService {
+    List<PatrolTaskSpotDTO> getPatrolTaskSpotList(Integer id);
+}

+ 50 - 0
src/main/java/com/welampiot/service/impl/PatrolManageServiceImpl.java

@@ -0,0 +1,50 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.PatrolManageDao;
+import com.welampiot.dto.PatrolManageDTO;
+import com.welampiot.service.PatrolManageService;
+import com.welampiot.vo.PatrolManageVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolManageServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/29 - 16:45
+ * @Version: v1.0
+ */
+@Service
+public class PatrolManageServiceImpl implements PatrolManageService {
+    @Autowired
+    private PatrolManageDao patrolManageDao;
+
+    @Override
+    public List<PatrolManageDTO> getPatrolManageList(PatrolManageVO vo) {
+        return patrolManageDao.getPatrolManageList(vo);
+    }
+
+    @Override
+    public Integer getPatrolManageCount(PatrolManageVO vo) {
+        return patrolManageDao.getPatrolManageCount(vo);
+    }
+
+    @Override
+    public List<PatrolManageDTO> getPatrolDownList(Integer userid) {
+        return patrolManageDao.getPatrolDownList(userid);
+    }
+
+    @Override
+    public void addPatrolManageData(PatrolManageDTO dto) {
+        patrolManageDao.addPatrolManageData(dto);
+    }
+
+    @Override
+    public void updatePatrolManageData(PatrolManageDTO dto) {
+        patrolManageDao.updatePatrolManageData(dto);
+    }
+}

+ 44 - 0
src/main/java/com/welampiot/service/impl/PatrolSpotServiceImpl.java

@@ -0,0 +1,44 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.PatrolSpotDao;
+import com.welampiot.dto.PatrolSpotDTO;
+import com.welampiot.service.PatrolSpotService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolSpotServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/29 - 16:51
+ * @Version: v1.0
+ */
+@Service
+public class PatrolSpotServiceImpl implements PatrolSpotService {
+    @Autowired
+    private PatrolSpotDao patrolSpotDao;
+
+    @Override
+    public List<PatrolSpotDTO> getPatrolSpotList(Integer id) {
+        return patrolSpotDao.getPatrolSpotList(id);
+    }
+
+    @Override
+    public void addPatrolSpotData(PatrolSpotDTO dto) {
+        patrolSpotDao.addPatrolSpotData(dto);
+    }
+
+    @Override
+    public void updatePatrolSpotData(PatrolSpotDTO dto) {
+        patrolSpotDao.updatePatrolSpotData(dto);
+    }
+
+    @Override
+    public void deletePatrolSpotIdByManageId(Integer id) {
+        patrolSpotDao.deletePatrolSpotIdByManageId(id);
+    }
+}

+ 35 - 0
src/main/java/com/welampiot/service/impl/PatrolTaskServiceImpl.java

@@ -0,0 +1,35 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.PatrolTaskDao;
+import com.welampiot.dto.PatrolTaskDTO;
+import com.welampiot.service.PatrolTaskService;
+import com.welampiot.vo.PatrolTaskVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolTaskServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/30 - 18:34
+ * @Version: v1.0
+ */
+@Service
+public class PatrolTaskServiceImpl implements PatrolTaskService {
+    @Autowired
+    private PatrolTaskDao patrolTaskDao;
+
+    @Override
+    public List<PatrolTaskDTO> getPatrolTaskList(PatrolTaskVO vo) {
+        return patrolTaskDao.getPatrolTaskList(vo);
+    }
+
+    @Override
+    public Integer getPatrolTaskTotal(PatrolTaskVO vo) {
+        return patrolTaskDao.getPatrolTaskTotal(vo);
+    }
+}

+ 29 - 0
src/main/java/com/welampiot/service/impl/PatrolTaskSpotServiceImpl.java

@@ -0,0 +1,29 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.PatrolTaskSpotDao;
+import com.welampiot.dto.PatrolTaskSpotDTO;
+import com.welampiot.service.PatrolTaskSpotService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: PatrolTaskSpotServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/30 - 19:02
+ * @Version: v1.0
+ */
+@Service
+public class PatrolTaskSpotServiceImpl implements PatrolTaskSpotService {
+    @Autowired
+    private PatrolTaskSpotDao patrolTaskSpotDao;
+
+    @Override
+    public List<PatrolTaskSpotDTO> getPatrolTaskSpotList(Integer id) {
+        return patrolTaskSpotDao.getPatrolTaskSpotList(id);
+    }
+}

+ 41 - 0
src/main/java/com/welampiot/vo/PatrolManageVO.java

@@ -0,0 +1,41 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.PatrolManageDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: PatrolManageVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/29 - 16:39
+ * @Version: v1.0
+ */
+@Data
+public class PatrolManageVO implements Serializable {
+    private Integer page;
+
+    private Integer count;
+
+    private String keyword;
+
+    private Integer areaId;
+
+    private Integer sectionId;
+
+    private Integer provinceId;
+
+    private Integer cityId;
+
+    private Integer total;
+
+    private List<Integer> sectionList;
+
+    private List<PatrolManageDTO> list;
+
+    private static final long serialVersionUID = 1L;
+}

+ 45 - 0
src/main/java/com/welampiot/vo/PatrolTaskVO.java

@@ -0,0 +1,45 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.PatrolTaskDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: PatrolTaskVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/6/30 - 18:28
+ * @Version: v1.0
+ */
+@Data
+public class PatrolTaskVO implements Serializable {
+    private Integer page;
+
+    private Integer count;
+
+    private Integer status;
+
+    private String keyword;
+
+    private String startDate;
+
+    private String endDate;
+
+    private Integer areaId;
+
+    private Integer cityId;
+
+    private Integer sectionId;
+
+    private Integer provinceId;
+
+    private Integer total;
+
+    private List<PatrolTaskDTO> list;
+
+    private List<Integer> sectionList;
+}

+ 70 - 0
src/main/resources/mapper/PatrolManageMapper.xml

@@ -0,0 +1,70 @@
+<?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.welampiot.dao.PatrolManageDao">
+
+    <select id="getPatrolManageList" resultType="PatrolManageDTO">
+        select p.number,p.count,p.id
+        from patrol_manage p
+        left join section s on p.sectionId = s.id
+        left join global_location gl on s.pid = gl.id
+        left join global_location gl1 on gl.pid = gl1.id
+        left join global_location gl2 on gl1.pid = gl2.id
+        where 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and p.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            and p.id = #{sectionId}
+        </if>
+        <if test="areaId != null and areaId != 0">
+            and gl.id = #{areaId}
+        </if>
+        <if test="cityId != null and cityId != 0">
+            and gl1.id = #{cityId}
+        </if>
+        <if test="provinceId != null and provinceId != 0">
+            and gl2.id = #{provinceId}
+        </if>
+        <if test="keyword != null and keyword != ''">
+            and p.number like '%${keyword}%'
+        </if>
+        <if test="page >= 0 and count > 0">
+            limit #{page},#{count}
+        </if>
+    </select>
+
+    <select id="getPatrolManageCount" resultType="Integer">
+        select count(p.id) as total
+        from patrol_manage p
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            where p.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="getPatrolDownList" resultType="PatrolManageDTO">
+        select p.id,p.number
+        from patrol_manage p
+        where p.user_id = #{userid}
+    </select>
+    
+    <insert id="addPatrolManageData" parameterType="PatrolManageDTO" useGeneratedKeys="true" keyProperty="id">
+        insert into patrol_manage(sectionId,`count`,plan_start_time,plan_end_time,user_id,create_time)
+        values (#{sectionId},#{count},#{planStartTime},#{planEndTime},#{userid},#{createTime})
+    </insert>
+
+    <update id="updatePatrolManageData" parameterType="PatrolManageDTO">
+        update patrol_manage p
+        set p.sectionId = #{sectionId},
+            p.`count` = #{count},
+            p.plan_start_time = #{planStartTime},
+            p.plan_end_time = #{planEndTime}
+        where p.id = #{id}
+    </update>
+
+</mapper>

+ 31 - 0
src/main/resources/mapper/PatrolSpotMapper.xml

@@ -0,0 +1,31 @@
+<?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.welampiot.dao.PatrolSpotDao">
+    
+    <select id="getPatrolSpotList" resultType="PatrolSpotDTO">
+        select p.name,p.longitude,p.latitude
+        from patrol_spot p
+        where p.patrol_manage_id = #{id}
+    </select>
+
+    <insert id="addPatrolSpotData" parameterType="PatrolSpotDTO" keyProperty="id" useGeneratedKeys="true">
+        insert into patrol_spot(`name`,patrol_manage_id,longitude,latitude)
+        values (#{name},#{patrolManageId},#{longitude},#{latitude})
+    </insert>
+
+    <update id="updatePatrolSpotData" parameterType="PatrolSpotDTO">
+        update patrol_spot p
+        set
+            p.name = #{name},
+            p.patrol_manage_id = #{patrolManageId},
+            p.longitude = #{longitude},
+            p.latitude = #{latitude}
+        where p.id = #{id}
+    </update>
+
+    <delete id="deletePatrolSpotIdByManageId">
+        delete
+        from patrol_spot
+        where patrol_manage_id = #{id};
+    </delete>
+</mapper>

+ 78 - 0
src/main/resources/mapper/PatrolTaskMapper.xml

@@ -0,0 +1,78 @@
+<?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.welampiot.dao.PatrolTaskDao">
+    
+    <select id="getPatrolTaskList" resultType="PatrolTaskDTO">
+        select p.id,p.number,p.time,p.work_name workName,p.status,p.plan_end_time planEndTime,
+               p.type,p.patrol_object patrolObject,p.lates_time as lastTime,p.check_status checkStatus,
+               p.check_begin_time checkBeginTime,p.check_end_time checkEndTime,chect_time as checkTime
+        from patrol_task p
+        left join section s on p.sectionId = s.id
+        left join global_location gl on s.pid = gl.id
+        left join global_location gl1 on gl.pid = gl1.id
+        left join global_location gl2 on gl1.pid = gl2.id
+        where 1=1
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            and p.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="keyword != null and keyword != ''">
+            and p.number like '%${keyword}%'
+        </if>
+        <if test="areaId != null and areaId != 0">
+            and gl.id = #{areaId}
+        </if>
+        <if test="sectionId != null and sectionId != 0">
+            and p.sectionId = #{sectionId}
+        </if>
+        <if test="cityId != null and cityId != 0">
+            and gl1.id = #{cityId}
+        </if>
+        <if test="provinceId != null and provinceId != 0">
+            and gl2.id = #{provinceId}
+        </if>
+        <choose>
+            <when test="status == 0">
+                and p.status = 0
+            </when>
+            <when test="status == 1">
+                and p.status = 1
+            </when>
+            <when test="status == 2">
+                and p.status = 2
+            </when>
+            <when test="status == 3">
+                and p.status = 3
+            </when>
+            <when test="status == 4">
+                and p.status = 4
+            </when>
+            <when test="status == 5">
+                and p.status = 5
+            </when>
+        </choose>
+        <if test="startDate != null and startDate != ''">
+            and p.create_time <![CDATA[ >= ]]> #{startDate}
+        </if>
+        <if test="endDate != null and endDate != ''">
+            and p.create_time <![CDATA[ <= ]]> #{endDate}
+        </if>
+        <if test="page >= 0 and count > 0">
+            limit #{page},#{count}
+        </if>
+    </select>
+
+    <select id="getPatrolTaskTotal" resultType="Integer">
+        select count(p.id)
+        from patrol_task p
+        <if test="sectionList != null and !sectionList.isEmpty()">
+            where p.sectionId in
+            <foreach collection="sectionList" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+</mapper>

+ 11 - 0
src/main/resources/mapper/PatrolTaskSpotMapper.xml

@@ -0,0 +1,11 @@
+<?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.welampiot.dao.PatrolTaskSpotDao">
+
+    <select id="getPatrolTaskSpotList" resultType="PatrolTaskSpotDTO">
+        select p.id,p.name,p.longitude,p.latitude,p.is_clock isClock
+        from patrol_task_spot p
+        where p.patrol_task_id = #{id}
+    </select>
+
+</mapper>