Browse Source

fix:我也不知道

459242451@qq.com 3 years ago
parent
commit
875a0e2047
19 changed files with 414 additions and 811 deletions
  1. 4 7
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlCommonController.java
  2. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlDocumentController.java
  3. 0 98
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlInspectionDeviceTrailController.java
  4. 25 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlInspectionLocationLogController.java
  5. 13 19
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/XunTask.java
  6. 0 136
      ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlInspectionDeviceTrail.java
  7. 136 84
      ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlInspectionLocationLog.java
  8. 0 64
      ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlInspectionDeviceTrailMapper.java
  9. 5 0
      ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlInspectionLocationLogMapper.java
  10. 11 11
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlDocumentService.java
  11. 0 72
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlInspectionDeviceTrailService.java
  12. 15 1
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlInspectionLocationLogService.java
  13. 21 26
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlDocumentServiceImpl.java
  14. 0 135
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlInspectionDeviceTrailServiceImpl.java
  15. 53 0
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlInspectionLocationLogServiceImpl.java
  16. 46 46
      ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java
  17. 0 107
      ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionDeviceTrailMapper.xml
  18. 53 2
      ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionLocationLogMapper.xml
  19. 31 1
      sql/ry_20210908.sql

+ 4 - 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlCommonController.java

@@ -13,12 +13,10 @@ import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.qdtl.domain.MonitorStatic;
 import com.ruoyi.qdtl.domain.TlArea;
-import com.ruoyi.qdtl.domain.TlInspectionDeviceTrail;
 import com.ruoyi.qdtl.domain.TlInspectionLocation;
 import com.ruoyi.qdtl.domain.TlInspectionLocationLog;
 import com.ruoyi.qdtl.domain.UserCheckPoint;
 import com.ruoyi.qdtl.service.ITlAreaService;
-import com.ruoyi.qdtl.service.ITlInspectionDeviceTrailService;
 import com.ruoyi.qdtl.service.ITlInspectionLocationLogService;
 import com.ruoyi.qdtl.service.ITlInspectionLocationService;
 import com.ruoyi.qdtl.service.ITlMonitorService;
@@ -60,7 +58,6 @@ public class TlCommonController extends BaseController {
     private final ISysConfigService sysConfigService;
     private final ITlAreaService tlAreaService;
     private final ITlInspectionLocationService tlInspectionLocationService;
-    private final ITlInspectionDeviceTrailService tlInspectionDeviceTrailService;
     private final ITlInspectionLocationLogService tlInspectionLocationLogService;
     private final ITlMonitorService tlMonitorService;
     private final ITlPlanRecordService planRecordService;
@@ -125,9 +122,9 @@ public class TlCommonController extends BaseController {
         if (StrUtil.isBlank(date)) {
             date = DateUtil.today();
         }
-        List<TlInspectionDeviceTrail> deviceTrails = tlInspectionDeviceTrailService.selectListByDate(date);
+        List<TlInspectionLocationLog> deviceTrails = tlInspectionLocationLogService.selectListByDate(date);
         // 对轨迹按照设备编码分组
-        Map<String, List<TlInspectionDeviceTrail>> deviceTrail = deviceTrails.stream().collect(Collectors.groupingBy(TlInspectionDeviceTrail::getDeviceCode));
+        Map<String, List<TlInspectionLocationLog>> deviceTrail = deviceTrails.stream().collect(Collectors.groupingBy(TlInspectionLocationLog::getDeviceCode));
         map.put("deviceTrail", deviceTrail);
 
         // 铁路沿线
@@ -152,7 +149,7 @@ public class TlCommonController extends BaseController {
             date = DateUtil.today();
         }
         // 巡检里程
-        double xunTotalDistance = tlInspectionDeviceTrailService.queryDistance(date, "");
+        double xunTotalDistance = tlInspectionLocationLogService.queryDistance(date, "");
         map.put("xunTotalDistance", xunTotalDistance);
         // 巡检打卡数
         List<TlInspectionLocationLog> locationLogList = tlInspectionLocationLogService.queryByCondition(date, "", "");
@@ -201,7 +198,7 @@ public class TlCommonController extends BaseController {
             }
             data = url + p[p.length - 1] + "/playlist.m3u8";
         } catch (Exception e) {
-            
+
         }
         return AjaxResult.success(data);
     }

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlDocumentController.java

@@ -162,7 +162,7 @@ public class TlDocumentController extends BaseController {
         tlDocument.setBasicExample(JSONUtil.toJsonStr(tlDocument.getBasicExample()));
         tlDocument.setQuestion(JSONUtil.toJsonStr(tlDocument.getQuestion()));
         tlDocument.setAdvice(JSONUtil.toJsonStr(tlDocument.getAdvice()));
-        return toAjax(tlDocumentService.insertTlDocument(tlDocument));
+        return AjaxResult.success(tlDocumentService.insertTlDocument(tlDocument));
     }
 
     /**

+ 0 - 98
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlInspectionDeviceTrailController.java

@@ -1,98 +0,0 @@
-package com.ruoyi.web.controller.qdtl;
-
-import com.ruoyi.common.annotation.Log;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.qdtl.domain.TlInspectionDeviceTrail;
-import com.ruoyi.qdtl.service.ITlInspectionDeviceTrailService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- * 设备轨迹Controller
- *
- * @author ruoyi
- * @date 2022-03-12
- */
-@RestController
-@RequestMapping("/qdtl/trail")
-public class TlInspectionDeviceTrailController extends BaseController {
-    @Autowired
-    private ITlInspectionDeviceTrailService tlInspectionDeviceTrailService;
-
-    /**
-     * 查询设备轨迹列表
-     */
-    @PreAuthorize("@ss.hasPermi('qdtl:trail:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(TlInspectionDeviceTrail tlInspectionDeviceTrail) {
-        startPage();
-        List<TlInspectionDeviceTrail> list = tlInspectionDeviceTrailService.selectTlInspectionDeviceTrailList(tlInspectionDeviceTrail);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出设备轨迹列表
-     */
-    @PreAuthorize("@ss.hasPermi('qdtl:trail:export')")
-    @Log(title = "设备轨迹", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, TlInspectionDeviceTrail tlInspectionDeviceTrail) {
-        List<TlInspectionDeviceTrail> list = tlInspectionDeviceTrailService.selectTlInspectionDeviceTrailList(tlInspectionDeviceTrail);
-        ExcelUtil<TlInspectionDeviceTrail> util = new ExcelUtil<TlInspectionDeviceTrail>(TlInspectionDeviceTrail.class);
-        util.exportExcel(response, list, "设备轨迹数据");
-    }
-
-    /**
-     * 获取设备轨迹详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('qdtl:trail:query')")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return AjaxResult.success(tlInspectionDeviceTrailService.selectTlInspectionDeviceTrailById(id));
-    }
-
-    /**
-     * 新增设备轨迹
-     */
-    @PreAuthorize("@ss.hasPermi('qdtl:trail:add')")
-    @Log(title = "设备轨迹", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody TlInspectionDeviceTrail tlInspectionDeviceTrail) {
-        return toAjax(tlInspectionDeviceTrailService.insertTlInspectionDeviceTrail(tlInspectionDeviceTrail));
-    }
-
-    /**
-     * 修改设备轨迹
-     */
-    @PreAuthorize("@ss.hasPermi('qdtl:trail:edit')")
-    @Log(title = "设备轨迹", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody TlInspectionDeviceTrail tlInspectionDeviceTrail) {
-        return toAjax(tlInspectionDeviceTrailService.updateTlInspectionDeviceTrail(tlInspectionDeviceTrail));
-    }
-
-    /**
-     * 删除设备轨迹
-     */
-    @PreAuthorize("@ss.hasPermi('qdtl:trail:remove')")
-    @Log(title = "设备轨迹", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(tlInspectionDeviceTrailService.deleteTlInspectionDeviceTrailByIds(ids));
-    }
-}

+ 25 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlInspectionLocationLogController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.web.controller.qdtl;
 
+import cn.hutool.core.util.StrUtil;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -37,21 +38,44 @@ public class TlInspectionLocationLogController extends BaseController {
     /**
      * 查询巡检记录管理列表
      */
-    @PreAuthorize("@ss.hasPermi('qdtl:log:list')")
     @GetMapping("/list")
     public TableDataInfo list(TlInspectionLocationLog tlInspectionLocationLog) {
         startPage();
+        if (StrUtil.isNotBlank(tlInspectionLocationLog.getAreaId())) {
+            tlInspectionLocationLog.setAreaIds(StrUtil.split(tlInspectionLocationLog.getAreaId(), ','));
+            tlInspectionLocationLog.setAreaId("");
+        }
         List<TlInspectionLocationLog> list = tlInspectionLocationLogService.selectTlInspectionLocationLogList(tlInspectionLocationLog);
         return getDataTable(list);
     }
 
     /**
+     * 巡检轨迹
+     *
+     * @param tlInspectionLocationLog
+     * @return
+     */
+    @GetMapping("/trail/list")
+    public AjaxResult trailList(TlInspectionLocationLog tlInspectionLocationLog) {
+        if (StrUtil.isNotBlank(tlInspectionLocationLog.getAreaId())) {
+            tlInspectionLocationLog.setAreaIds(StrUtil.split(tlInspectionLocationLog.getAreaId(), ','));
+            tlInspectionLocationLog.setAreaId("");
+        }
+        List<TlInspectionLocationLog> list = tlInspectionLocationLogService.selectTlInspectionLocationLogTrailList(tlInspectionLocationLog);
+        return AjaxResult.success(list);
+    }
+
+    /**
      * 导出巡检记录管理列表
      */
     @PreAuthorize("@ss.hasPermi('qdtl:log:export')")
     @Log(title = "巡检记录管理", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, TlInspectionLocationLog tlInspectionLocationLog) {
+        if (StrUtil.isNotBlank(tlInspectionLocationLog.getAreaId())) {
+            tlInspectionLocationLog.setAreaIds(StrUtil.split(tlInspectionLocationLog.getAreaId(), ','));
+            tlInspectionLocationLog.setAreaId("");
+        }
         List<TlInspectionLocationLog> list = tlInspectionLocationLogService.selectTlInspectionLocationLogList(tlInspectionLocationLog);
         ExcelUtil<TlInspectionLocationLog> util = new ExcelUtil<TlInspectionLocationLog>(TlInspectionLocationLog.class);
         util.exportExcel(response, list, "巡检记录管理数据");

+ 13 - 19
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/XunTask.java

@@ -1,6 +1,5 @@
 package com.ruoyi.web.controller.task;
 
-import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
@@ -9,14 +8,12 @@ import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.ruoyi.qdtl.domain.TlInspectionDevice;
-import com.ruoyi.qdtl.domain.TlInspectionDeviceTrail;
 import com.ruoyi.qdtl.domain.TlInspectionLocation;
 import com.ruoyi.qdtl.domain.TlInspectionLocationLog;
 import com.ruoyi.qdtl.domain.TlPatrolman;
 import com.ruoyi.qdtl.domain.TlPlanRecord;
 import com.ruoyi.qdtl.service.IQdCommonService;
 import com.ruoyi.qdtl.service.ITlInspectionDeviceService;
-import com.ruoyi.qdtl.service.ITlInspectionDeviceTrailService;
 import com.ruoyi.qdtl.service.ITlInspectionLocationLogService;
 import com.ruoyi.qdtl.service.ITlInspectionLocationService;
 import com.ruoyi.qdtl.service.ITlPatrolmanService;
@@ -46,8 +43,6 @@ public class XunTask {
     @Autowired
     private ITlInspectionLocationLogService tlInspectionLocationLogService;
     @Autowired
-    private ITlInspectionDeviceTrailService tlInspectionDeviceTrailService;
-    @Autowired
     private ITlPatrolmanService tlPatrolmanService;
     @Autowired
     private ITlPlanRecordService planRecordService;
@@ -145,20 +140,15 @@ public class XunTask {
                 JSONObject jsonObject = JSONUtil.parseObj(checkpointLog);
                 TlInspectionLocationLog convert = Convert.convert(TlInspectionLocationLog.class, checkpointLog);
                 convert.setCreateTime(DateUtil.date(jsonObject.getLong("createTime")));
-                tlInspectionLocationLogService.insertTlInspectionLocationLog(convert);
-                // 由于巡检器不带GPS,则以巡检点的经纬度作为巡检轨迹
-                TlInspectionDeviceTrail deviceTrail = new TlInspectionDeviceTrail();
-                BeanUtil.copyProperties(convert, deviceTrail, "id", "fence");
                 // 查询该点位的经纬度
-                TlInspectionLocation tlInspectionLocation = tlInspectionLocationService.queryByThirdId(deviceTrail.getCheckpointId());
-                if (tlInspectionLocation == null) {
-                    log.error("没有通过CheckpointId找到相应的巡检点信息{}", deviceTrail.getCheckpointId());
-                    continue;
-                }
-                if (StrUtil.isNotBlank(tlInspectionLocation.getLnglat())) {
-                    deviceTrail.setFence(tlInspectionLocation.getLnglat());
-                    tlInspectionDeviceTrailService.insertTlInspectionDeviceTrail(deviceTrail);
+                TlInspectionLocation tlInspectionLocation = tlInspectionLocationService.queryByThirdId(convert.getCheckpointId());
+                if (tlInspectionLocation != null && StrUtil.isNotBlank(tlInspectionLocation.getLnglat())) {
+                    convert.setFence(tlInspectionLocation.getLnglat());
+                } else {
+                    log.error("没有通过CheckpointId找到相应的巡检点信息{}", convert.getCheckpointId());
                 }
+                tlInspectionLocationLogService.insertTlInspectionLocationLog(convert);
+
                 // 更新到计划中
                 if (StrUtil.isNotBlank(convert.getPatrolmanCard())) {
                     // 根据当前时间查询符合的计划数据
@@ -195,19 +185,23 @@ public class XunTask {
                 String thirdId = jsonObject.getStr("id");
                 String name = jsonObject.getStr("name");
                 String card = jsonObject.getStr("card");
-//                String areaId = jsonObject.getStr("areaId");
-//                String areaName = jsonObject.getStr("areaName");
+                String areaId = jsonObject.getStr("areaId");
+                String areaName = jsonObject.getStr("areaName");
                 // 根据thirdId查询是否存在
                 TlPatrolman tlPatrolman = tlPatrolmanService.queryByThirdId(thirdId);
                 if (tlPatrolman != null) {
                     tlPatrolman.setName(name);
                     tlPatrolman.setCard(card);
+                    tlPatrolman.setAreaId(areaId);
+                    tlPatrolman.setAreaName(areaName);
                     tlPatrolman.setVersion(version);
                     tlPatrolmanService.updateTlPatrolman(tlPatrolman);
                 } else {
                     tlPatrolman = new TlPatrolman();
                     tlPatrolman.setName(name);
                     tlPatrolman.setCard(card);
+                    tlPatrolman.setAreaId(areaId);
+                    tlPatrolman.setAreaName(areaName);
                     tlPatrolman.setVersion(version);
                     tlPatrolman.setThirdId(thirdId);
                     tlPatrolmanService.insertTlPatrolman(tlPatrolman);

+ 0 - 136
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlInspectionDeviceTrail.java

@@ -1,136 +0,0 @@
-package com.ruoyi.qdtl.domain;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import com.ruoyi.common.annotation.Excel;
-import com.ruoyi.common.core.domain.BaseEntity;
-
-/**
- * 设备轨迹对象 tl_inspection_device_trail
- * 
- * @author ruoyi
- * @date 2022-03-12
- */
-public class TlInspectionDeviceTrail extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** id */
-    private Long id;
-
-    /** 巡检器id */
-    @Excel(name = "巡检器id")
-    private String deviceId;
-
-    /** 巡检器名称 */
-    @Excel(name = "巡检器名称")
-    private String deviceName;
-
-    /** 巡检器卡号 */
-    @Excel(name = "巡检器卡号")
-    private String deviceCode;
-
-    /** 巡检点id */
-    @Excel(name = "巡检点id")
-    private String checkpointId;
-
-    /** 巡检点名称 */
-    @Excel(name = "巡检点名称")
-    private String checkpointName;
-
-    /** 巡检点卡号 */
-    @Excel(name = "巡检点卡号")
-    private String checkpointCard;
-
-    /** 经纬度 */
-    @Excel(name = "经纬度")
-    private String fence;
-
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setDeviceId(String deviceId) 
-    {
-        this.deviceId = deviceId;
-    }
-
-    public String getDeviceId() 
-    {
-        return deviceId;
-    }
-    public void setDeviceName(String deviceName) 
-    {
-        this.deviceName = deviceName;
-    }
-
-    public String getDeviceName() 
-    {
-        return deviceName;
-    }
-    public void setDeviceCode(String deviceCode) 
-    {
-        this.deviceCode = deviceCode;
-    }
-
-    public String getDeviceCode() 
-    {
-        return deviceCode;
-    }
-    public void setCheckpointId(String checkpointId) 
-    {
-        this.checkpointId = checkpointId;
-    }
-
-    public String getCheckpointId() 
-    {
-        return checkpointId;
-    }
-    public void setCheckpointName(String checkpointName) 
-    {
-        this.checkpointName = checkpointName;
-    }
-
-    public String getCheckpointName() 
-    {
-        return checkpointName;
-    }
-    public void setCheckpointCard(String checkpointCard) 
-    {
-        this.checkpointCard = checkpointCard;
-    }
-
-    public String getCheckpointCard() 
-    {
-        return checkpointCard;
-    }
-    public void setFence(String fence) 
-    {
-        this.fence = fence;
-    }
-
-    public String getFence() 
-    {
-        return fence;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("deviceId", getDeviceId())
-            .append("deviceName", getDeviceName())
-            .append("deviceCode", getDeviceCode())
-            .append("checkpointId", getCheckpointId())
-            .append("checkpointName", getCheckpointName())
-            .append("checkpointCard", getCheckpointCard())
-            .append("fence", getFence())
-            .append("createTime", getCreateTime())
-            .toString();
-    }
-}

+ 136 - 84
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlInspectionLocationLog.java

@@ -1,192 +1,244 @@
 package com.ruoyi.qdtl.domain;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.List;
 
 /**
  * 巡检记录管理对象 tl_inspection_location_log
- * 
+ *
  * @author ruoyi
  * @date 2022-03-10
  */
-public class TlInspectionLocationLog extends BaseEntity
-{
+public class TlInspectionLocationLog extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** id */
+    /**
+     * id
+     */
     private Long id;
 
-    /** 巡检点id */
-    @Excel(name = "巡检点id")
+    /**
+     * 巡检点id
+     */
     private String checkpointId;
 
-    /** 巡检点名称 */
+    /**
+     * 巡检点名称
+     */
     @Excel(name = "巡检点名称")
     private String checkpointName;
 
-    /** 巡检点卡号 */
+    /**
+     * 巡检点卡号
+     */
     @Excel(name = "巡检点卡号")
     private String checkpointCard;
 
-    /** 巡检员ID */
-    @Excel(name = "巡检员ID")
+    /**
+     * 巡检员ID
+     */
     private String patrolmanId;
 
-    /** 巡检员名称 */
+    /**
+     * 巡检员名称
+     */
     @Excel(name = "巡检员名称")
     private String patrolmanName;
 
-    /** 巡检员卡号 */
+    /**
+     * 巡检员卡号
+     */
     @Excel(name = "巡检员卡号")
     private String patrolmanCard;
 
-    /** 巡检器id */
-    @Excel(name = "巡检器id")
+    /**
+     * 巡检器id
+     */
     private String deviceId;
 
-    /** 巡检器名称 */
+    /**
+     * 巡检器名称
+     */
     @Excel(name = "巡检器名称")
     private String deviceName;
 
-    /** 巡检器卡号 */
+    /**
+     * 巡检器卡号
+     */
     @Excel(name = "巡检器卡号")
     private String deviceCode;
 
-    /** 组织ID(与巡检点所在的组织一致) */
-    @Excel(name = "组织ID(与巡检点所在的组织一致)")
+    /**
+     * 组织ID(与巡检点所在的组织一致)
+     */
     private String areaId;
 
-    /** 组织名称 */
+    private List<String> areaIds;
+
+    /**
+     * 组织名称
+     */
     @Excel(name = "组织名称")
     private String areaName;
 
-    public void setId(Long id) 
-    {
+    /**
+     * 经纬度
+     */
+    private String fence;
+
+    private String beginTime;
+
+    private String endTime;
+
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setCheckpointId(String checkpointId) 
-    {
+
+    public void setCheckpointId(String checkpointId) {
         this.checkpointId = checkpointId;
     }
 
-    public String getCheckpointId() 
-    {
+    public String getCheckpointId() {
         return checkpointId;
     }
-    public void setCheckpointName(String checkpointName) 
-    {
+
+    public void setCheckpointName(String checkpointName) {
         this.checkpointName = checkpointName;
     }
 
-    public String getCheckpointName() 
-    {
+    public String getCheckpointName() {
         return checkpointName;
     }
-    public void setCheckpointCard(String checkpointCard) 
-    {
+
+    public void setCheckpointCard(String checkpointCard) {
         this.checkpointCard = checkpointCard;
     }
 
-    public String getCheckpointCard() 
-    {
+    public String getCheckpointCard() {
         return checkpointCard;
     }
-    public void setPatrolmanId(String patrolmanId) 
-    {
+
+    public void setPatrolmanId(String patrolmanId) {
         this.patrolmanId = patrolmanId;
     }
 
-    public String getPatrolmanId() 
-    {
+    public String getPatrolmanId() {
         return patrolmanId;
     }
-    public void setPatrolmanName(String patrolmanName) 
-    {
+
+    public void setPatrolmanName(String patrolmanName) {
         this.patrolmanName = patrolmanName;
     }
 
-    public String getPatrolmanName() 
-    {
+    public String getPatrolmanName() {
         return patrolmanName;
     }
-    public void setPatrolmanCard(String patrolmanCard) 
-    {
+
+    public void setPatrolmanCard(String patrolmanCard) {
         this.patrolmanCard = patrolmanCard;
     }
 
-    public String getPatrolmanCard() 
-    {
+    public String getPatrolmanCard() {
         return patrolmanCard;
     }
-    public void setDeviceId(String deviceId) 
-    {
+
+    public void setDeviceId(String deviceId) {
         this.deviceId = deviceId;
     }
 
-    public String getDeviceId() 
-    {
+    public String getDeviceId() {
         return deviceId;
     }
-    public void setDeviceName(String deviceName) 
-    {
+
+    public void setDeviceName(String deviceName) {
         this.deviceName = deviceName;
     }
 
-    public String getDeviceName() 
-    {
+    public String getDeviceName() {
         return deviceName;
     }
-    public void setDeviceCode(String deviceCode) 
-    {
+
+    public void setDeviceCode(String deviceCode) {
         this.deviceCode = deviceCode;
     }
 
-    public String getDeviceCode() 
-    {
+    public String getDeviceCode() {
         return deviceCode;
     }
-    public void setAreaId(String areaId) 
-    {
+
+    public void setAreaId(String areaId) {
         this.areaId = areaId;
     }
 
-    public String getAreaId() 
-    {
+    public String getAreaId() {
         return areaId;
     }
-    public void setAreaName(String areaName) 
-    {
+
+    public void setAreaName(String areaName) {
         this.areaName = areaName;
     }
 
-    public String getAreaName() 
-    {
+    public String getAreaName() {
         return areaName;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("checkpointId", getCheckpointId())
-            .append("checkpointName", getCheckpointName())
-            .append("checkpointCard", getCheckpointCard())
-            .append("patrolmanId", getPatrolmanId())
-            .append("patrolmanName", getPatrolmanName())
-            .append("patrolmanCard", getPatrolmanCard())
-            .append("createTime", getCreateTime())
-            .append("deviceId", getDeviceId())
-            .append("deviceName", getDeviceName())
-            .append("deviceCode", getDeviceCode())
-            .append("areaId", getAreaId())
-            .append("areaName", getAreaName())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("checkpointId", getCheckpointId())
+                .append("checkpointName", getCheckpointName())
+                .append("checkpointCard", getCheckpointCard())
+                .append("patrolmanId", getPatrolmanId())
+                .append("patrolmanName", getPatrolmanName())
+                .append("patrolmanCard", getPatrolmanCard())
+                .append("createTime", getCreateTime())
+                .append("deviceId", getDeviceId())
+                .append("deviceName", getDeviceName())
+                .append("deviceCode", getDeviceCode())
+                .append("areaId", getAreaId())
+                .append("areaName", getAreaName())
+                .append("fence", getFence())
+                .toString();
+    }
+
+    public String getFence() {
+        return fence;
+    }
+
+    public void setFence(String fence) {
+        this.fence = fence;
+    }
+
+    public String getBeginTime() {
+        return beginTime;
+    }
+
+    public void setBeginTime(String beginTime) {
+        this.beginTime = beginTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public List<String> getAreaIds() {
+        return areaIds;
+    }
+
+    public void setAreaIds(List<String> areaIds) {
+        this.areaIds = areaIds;
     }
 }

+ 0 - 64
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlInspectionDeviceTrailMapper.java

@@ -1,64 +0,0 @@
-package com.ruoyi.qdtl.mapper;
-
-import com.ruoyi.qdtl.domain.TlInspectionDeviceTrail;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 设备轨迹Mapper接口
- *
- * @author ruoyi
- * @date 2022-03-12
- */
-public interface TlInspectionDeviceTrailMapper {
-    /**
-     * 查询设备轨迹
-     *
-     * @param id 设备轨迹主键
-     * @return 设备轨迹
-     */
-    public TlInspectionDeviceTrail selectTlInspectionDeviceTrailById(Long id);
-
-    /**
-     * 查询设备轨迹列表
-     *
-     * @param tlInspectionDeviceTrail 设备轨迹
-     * @return 设备轨迹集合
-     */
-    public List<TlInspectionDeviceTrail> selectTlInspectionDeviceTrailList(TlInspectionDeviceTrail tlInspectionDeviceTrail);
-
-    /**
-     * 新增设备轨迹
-     *
-     * @param tlInspectionDeviceTrail 设备轨迹
-     * @return 结果
-     */
-    public int insertTlInspectionDeviceTrail(TlInspectionDeviceTrail tlInspectionDeviceTrail);
-
-    /**
-     * 修改设备轨迹
-     *
-     * @param tlInspectionDeviceTrail 设备轨迹
-     * @return 结果
-     */
-    public int updateTlInspectionDeviceTrail(TlInspectionDeviceTrail tlInspectionDeviceTrail);
-
-    /**
-     * 删除设备轨迹
-     *
-     * @param id 设备轨迹主键
-     * @return 结果
-     */
-    public int deleteTlInspectionDeviceTrailById(Long id);
-
-    /**
-     * 批量删除设备轨迹
-     *
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-    public int deleteTlInspectionDeviceTrailByIds(Long[] ids);
-
-    List<TlInspectionDeviceTrail> selectListByDate(@Param("date") String date);
-}

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlInspectionLocationLogMapper.java

@@ -30,6 +30,8 @@ public interface TlInspectionLocationLogMapper {
      */
     public List<TlInspectionLocationLog> selectTlInspectionLocationLogList(TlInspectionLocationLog tlInspectionLocationLog);
 
+    List<TlInspectionLocationLog> selectTlInspectionLocationLogTrailList(TlInspectionLocationLog tlInspectionLocationLog);
+
     /**
      * 新增巡检记录管理
      *
@@ -67,4 +69,7 @@ public interface TlInspectionLocationLogMapper {
     List<TlInspectionLocationLog> queryByCondition(@Param("date") String date, @Param("checkpointCard") String checkpointCard, @Param("deviceId") String deviceId);
 
     List<UserCheckPoint> queryUserGroup();
+
+    List<TlInspectionLocationLog> selectListByDate(@Param("date") String date);
+
 }

+ 11 - 11
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlDocumentService.java

@@ -1,19 +1,19 @@
 package com.ruoyi.qdtl.service;
 
-import java.util.List;
 import com.ruoyi.qdtl.domain.TlDocument;
 
+import java.util.List;
+
 /**
  * 公文管理Service接口
- * 
+ *
  * @author ruoyi
  * @date 2022-05-06
  */
-public interface ITlDocumentService 
-{
+public interface ITlDocumentService {
     /**
      * 查询公文管理
-     * 
+     *
      * @param id 公文管理主键
      * @return 公文管理
      */
@@ -21,7 +21,7 @@ public interface ITlDocumentService
 
     /**
      * 查询公文管理列表
-     * 
+     *
      * @param tlDocument 公文管理
      * @return 公文管理集合
      */
@@ -29,15 +29,15 @@ public interface ITlDocumentService
 
     /**
      * 新增公文管理
-     * 
+     *
      * @param tlDocument 公文管理
      * @return 结果
      */
-    public int insertTlDocument(TlDocument tlDocument);
+    public Long insertTlDocument(TlDocument tlDocument);
 
     /**
      * 修改公文管理
-     * 
+     *
      * @param tlDocument 公文管理
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface ITlDocumentService
 
     /**
      * 批量删除公文管理
-     * 
+     *
      * @param ids 需要删除的公文管理主键集合
      * @return 结果
      */
@@ -53,7 +53,7 @@ public interface ITlDocumentService
 
     /**
      * 删除公文管理信息
-     * 
+     *
      * @param id 公文管理主键
      * @return 结果
      */

+ 0 - 72
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlInspectionDeviceTrailService.java

@@ -1,72 +0,0 @@
-package com.ruoyi.qdtl.service;
-
-import com.ruoyi.qdtl.domain.TlInspectionDeviceTrail;
-
-import java.util.List;
-
-/**
- * 设备轨迹Service接口
- *
- * @author ruoyi
- * @date 2022-03-12
- */
-public interface ITlInspectionDeviceTrailService {
-    /**
-     * 查询设备轨迹
-     *
-     * @param id 设备轨迹主键
-     * @return 设备轨迹
-     */
-    public TlInspectionDeviceTrail selectTlInspectionDeviceTrailById(Long id);
-
-    /**
-     * 查询设备轨迹列表
-     *
-     * @param tlInspectionDeviceTrail 设备轨迹
-     * @return 设备轨迹集合
-     */
-    public List<TlInspectionDeviceTrail> selectTlInspectionDeviceTrailList(TlInspectionDeviceTrail tlInspectionDeviceTrail);
-
-    /**
-     * 新增设备轨迹
-     *
-     * @param tlInspectionDeviceTrail 设备轨迹
-     * @return 结果
-     */
-    public int insertTlInspectionDeviceTrail(TlInspectionDeviceTrail tlInspectionDeviceTrail);
-
-    /**
-     * 修改设备轨迹
-     *
-     * @param tlInspectionDeviceTrail 设备轨迹
-     * @return 结果
-     */
-    public int updateTlInspectionDeviceTrail(TlInspectionDeviceTrail tlInspectionDeviceTrail);
-
-    /**
-     * 批量删除设备轨迹
-     *
-     * @param ids 需要删除的设备轨迹主键集合
-     * @return 结果
-     */
-    public int deleteTlInspectionDeviceTrailByIds(Long[] ids);
-
-    /**
-     * 删除设备轨迹信息
-     *
-     * @param id 设备轨迹主键
-     * @return 结果
-     */
-    public int deleteTlInspectionDeviceTrailById(Long id);
-
-    List<TlInspectionDeviceTrail> selectListByDate(String date);
-
-    /**
-     * 查询巡检里程数
-     *
-     * @param date     日期
-     * @param deviceId 设备id
-     * @return
-     */
-    double queryDistance(String date, String deviceId);
-}

+ 15 - 1
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlInspectionLocationLogService.java

@@ -27,7 +27,9 @@ public interface ITlInspectionLocationLogService {
      * @param tlInspectionLocationLog 巡检记录管理
      * @return 巡检记录管理集合
      */
-    public List<TlInspectionLocationLog> selectTlInspectionLocationLogList(TlInspectionLocationLog tlInspectionLocationLog);
+    List<TlInspectionLocationLog> selectTlInspectionLocationLogList(TlInspectionLocationLog tlInspectionLocationLog);
+
+    List<TlInspectionLocationLog> selectTlInspectionLocationLogTrailList(TlInspectionLocationLog tlInspectionLocationLog);
 
     /**
      * 新增巡检记录管理
@@ -66,4 +68,16 @@ public interface ITlInspectionLocationLogService {
     List<TlInspectionLocationLog> queryByCondition(String date, String checkpointCard, String deviceId);
 
     List<UserCheckPoint> queryUserGroup();
+
+    List<TlInspectionLocationLog> selectListByDate(String date);
+
+    /**
+     * 查询巡检里程数
+     *
+     * @param date     日期
+     * @param deviceId 设备id
+     * @return
+     */
+    double queryDistance(String date, String deviceId);
+
 }

+ 21 - 26
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlDocumentServiceImpl.java

@@ -1,95 +1,90 @@
 package com.ruoyi.qdtl.service.impl;
 
-import java.util.List;
 import com.ruoyi.common.utils.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.qdtl.mapper.TlDocumentMapper;
 import com.ruoyi.qdtl.domain.TlDocument;
+import com.ruoyi.qdtl.mapper.TlDocumentMapper;
 import com.ruoyi.qdtl.service.ITlDocumentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 /**
  * 公文管理Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2022-05-06
  */
 @Service
-public class TlDocumentServiceImpl implements ITlDocumentService 
-{
+public class TlDocumentServiceImpl implements ITlDocumentService {
     @Autowired
     private TlDocumentMapper tlDocumentMapper;
 
     /**
      * 查询公文管理
-     * 
+     *
      * @param id 公文管理主键
      * @return 公文管理
      */
     @Override
-    public TlDocument selectTlDocumentById(Long id)
-    {
+    public TlDocument selectTlDocumentById(Long id) {
         return tlDocumentMapper.selectTlDocumentById(id);
     }
 
     /**
      * 查询公文管理列表
-     * 
+     *
      * @param tlDocument 公文管理
      * @return 公文管理
      */
     @Override
-    public List<TlDocument> selectTlDocumentList(TlDocument tlDocument)
-    {
+    public List<TlDocument> selectTlDocumentList(TlDocument tlDocument) {
         return tlDocumentMapper.selectTlDocumentList(tlDocument);
     }
 
     /**
      * 新增公文管理
-     * 
+     *
      * @param tlDocument 公文管理
      * @return 结果
      */
     @Override
-    public int insertTlDocument(TlDocument tlDocument)
-    {
+    public Long insertTlDocument(TlDocument tlDocument) {
         tlDocument.setCreateTime(DateUtils.getNowDate());
-        return tlDocumentMapper.insertTlDocument(tlDocument);
+        tlDocumentMapper.insertTlDocument(tlDocument);
+        return tlDocument.getId();
     }
 
     /**
      * 修改公文管理
-     * 
+     *
      * @param tlDocument 公文管理
      * @return 结果
      */
     @Override
-    public int updateTlDocument(TlDocument tlDocument)
-    {
+    public int updateTlDocument(TlDocument tlDocument) {
         return tlDocumentMapper.updateTlDocument(tlDocument);
     }
 
     /**
      * 批量删除公文管理
-     * 
+     *
      * @param ids 需要删除的公文管理主键
      * @return 结果
      */
     @Override
-    public int deleteTlDocumentByIds(Long[] ids)
-    {
+    public int deleteTlDocumentByIds(Long[] ids) {
         return tlDocumentMapper.deleteTlDocumentByIds(ids);
     }
 
     /**
      * 删除公文管理信息
-     * 
+     *
      * @param id 公文管理主键
      * @return 结果
      */
     @Override
-    public int deleteTlDocumentById(Long id)
-    {
+    public int deleteTlDocumentById(Long id) {
         return tlDocumentMapper.deleteTlDocumentById(id);
     }
 }

+ 0 - 135
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlInspectionDeviceTrailServiceImpl.java

@@ -1,135 +0,0 @@
-package com.ruoyi.qdtl.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.convert.Convert;
-import cn.hutool.core.util.NumberUtil;
-import cn.hutool.core.util.ObjectUtil;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.qdtl.domain.TlInspectionDeviceTrail;
-import com.ruoyi.qdtl.mapper.TlInspectionDeviceTrailMapper;
-import com.ruoyi.qdtl.service.ITlInspectionDeviceTrailService;
-import org.gavaghan.geodesy.Ellipsoid;
-import org.gavaghan.geodesy.GeodeticCalculator;
-import org.gavaghan.geodesy.GlobalCoordinates;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * 设备轨迹Service业务层处理
- *
- * @author ruoyi
- * @date 2022-03-12
- */
-@Service
-public class TlInspectionDeviceTrailServiceImpl implements ITlInspectionDeviceTrailService {
-    @Autowired
-    private TlInspectionDeviceTrailMapper tlInspectionDeviceTrailMapper;
-
-    /**
-     * 查询设备轨迹
-     *
-     * @param id 设备轨迹主键
-     * @return 设备轨迹
-     */
-    @Override
-    public TlInspectionDeviceTrail selectTlInspectionDeviceTrailById(Long id) {
-        return tlInspectionDeviceTrailMapper.selectTlInspectionDeviceTrailById(id);
-    }
-
-    /**
-     * 查询设备轨迹列表
-     *
-     * @param tlInspectionDeviceTrail 设备轨迹
-     * @return 设备轨迹
-     */
-    @Override
-    public List<TlInspectionDeviceTrail> selectTlInspectionDeviceTrailList(TlInspectionDeviceTrail tlInspectionDeviceTrail) {
-        return tlInspectionDeviceTrailMapper.selectTlInspectionDeviceTrailList(tlInspectionDeviceTrail);
-    }
-
-    /**
-     * 新增设备轨迹
-     *
-     * @param tlInspectionDeviceTrail 设备轨迹
-     * @return 结果
-     */
-    @Override
-    public int insertTlInspectionDeviceTrail(TlInspectionDeviceTrail tlInspectionDeviceTrail) {
-        if (ObjectUtil.isNull(tlInspectionDeviceTrail.getCreateTime())) {
-            tlInspectionDeviceTrail.setCreateTime(DateUtils.getNowDate());
-        }
-        return tlInspectionDeviceTrailMapper.insertTlInspectionDeviceTrail(tlInspectionDeviceTrail);
-    }
-
-    /**
-     * 修改设备轨迹
-     *
-     * @param tlInspectionDeviceTrail 设备轨迹
-     * @return 结果
-     */
-    @Override
-    public int updateTlInspectionDeviceTrail(TlInspectionDeviceTrail tlInspectionDeviceTrail) {
-        return tlInspectionDeviceTrailMapper.updateTlInspectionDeviceTrail(tlInspectionDeviceTrail);
-    }
-
-    /**
-     * 批量删除设备轨迹
-     *
-     * @param ids 需要删除的设备轨迹主键
-     * @return 结果
-     */
-    @Override
-    public int deleteTlInspectionDeviceTrailByIds(Long[] ids) {
-        return tlInspectionDeviceTrailMapper.deleteTlInspectionDeviceTrailByIds(ids);
-    }
-
-    /**
-     * 删除设备轨迹信息
-     *
-     * @param id 设备轨迹主键
-     * @return 结果
-     */
-    @Override
-    public int deleteTlInspectionDeviceTrailById(Long id) {
-        return tlInspectionDeviceTrailMapper.deleteTlInspectionDeviceTrailById(id);
-    }
-
-    @Override
-    public List<TlInspectionDeviceTrail> selectListByDate(String date) {
-        return tlInspectionDeviceTrailMapper.selectListByDate(date);
-    }
-
-    @Override
-    public double queryDistance(String date, String deviceId) {
-        List<TlInspectionDeviceTrail> deviceTrails = this.selectListByDate(date);
-        // 对轨迹按照设备编码分组
-        Map<String, List<TlInspectionDeviceTrail>> deviceTrail = deviceTrails.stream().collect(Collectors.groupingBy(TlInspectionDeviceTrail::getDeviceCode));
-        // 对每一个设备循环累计里程
-        double distance = 0;
-        for (Map.Entry<String, List<TlInspectionDeviceTrail>> stringListEntry : deviceTrail.entrySet()) {
-            List<TlInspectionDeviceTrail> origin = stringListEntry.getValue();
-            if (origin.size() < 2) {
-                continue;
-            }
-            // 对原始list分成2组list,一个去掉头节点,一个去掉尾节点
-            List<TlInspectionDeviceTrail> subPre = CollUtil.sub(origin, 0, origin.size() - 1);
-            List<TlInspectionDeviceTrail> subAfter = CollUtil.sub(origin, 1, origin.size());
-            for (int i = 0; i < subPre.size(); i++) {
-                String fencePre = subPre.get(i).getFence();
-                String fenceAfter = subAfter.get(i).getFence();
-                // 计算2点之间距离
-                GlobalCoordinates source = new GlobalCoordinates(Convert.toDouble(fencePre.split(",")[1]), Convert.toDouble(fencePre.split(",")[0]));
-                GlobalCoordinates target = new GlobalCoordinates(Convert.toDouble(fenceAfter.split(",")[1]), Convert.toDouble(fenceAfter.split(",")[0]));
-                // 创建GeodeticCalculator,调用计算方法
-                double ellipsoidalDistance = new GeodeticCalculator().calculateGeodeticCurve(Ellipsoid.WGS84, source, target).getEllipsoidalDistance();
-                distance = NumberUtil.add(distance, ellipsoidalDistance);
-            }
-        }
-        return NumberUtil.div(distance, 1000, 3);
-    }
-    
-}

+ 53 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlInspectionLocationLogServiceImpl.java

@@ -1,16 +1,24 @@
 package com.ruoyi.qdtl.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.qdtl.domain.TlInspectionLocationLog;
 import com.ruoyi.qdtl.domain.UserCheckPoint;
 import com.ruoyi.qdtl.mapper.TlInspectionLocationLogMapper;
 import com.ruoyi.qdtl.service.ITlInspectionLocationLogService;
+import org.gavaghan.geodesy.Ellipsoid;
+import org.gavaghan.geodesy.GeodeticCalculator;
+import org.gavaghan.geodesy.GlobalCoordinates;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 巡检记录管理Service业务层处理
@@ -45,6 +53,11 @@ public class TlInspectionLocationLogServiceImpl implements ITlInspectionLocation
         return tlInspectionLocationLogMapper.selectTlInspectionLocationLogList(tlInspectionLocationLog);
     }
 
+    @Override
+    public List<TlInspectionLocationLog> selectTlInspectionLocationLogTrailList(TlInspectionLocationLog tlInspectionLocationLog) {
+        return tlInspectionLocationLogMapper.selectTlInspectionLocationLogTrailList(tlInspectionLocationLog);
+    }
+
     /**
      * 新增巡检记录管理
      *
@@ -111,4 +124,44 @@ public class TlInspectionLocationLogServiceImpl implements ITlInspectionLocation
     public List<UserCheckPoint> queryUserGroup() {
         return tlInspectionLocationLogMapper.queryUserGroup();
     }
+
+    /**
+     * 查询经纬度非空的轨迹list数据
+     *
+     * @param date
+     * @return
+     */
+    @Override
+    public List<TlInspectionLocationLog> selectListByDate(String date) {
+        return tlInspectionLocationLogMapper.selectListByDate(date);
+    }
+
+    @Override
+    public double queryDistance(String date, String deviceId) {
+        List<TlInspectionLocationLog> deviceTrails = this.selectListByDate(date);
+        // 对轨迹按照设备编码分组
+        Map<String, List<TlInspectionLocationLog>> deviceTrail = deviceTrails.stream().collect(Collectors.groupingBy(TlInspectionLocationLog::getDeviceCode));
+        // 对每一个设备循环累计里程
+        double distance = 0;
+        for (Map.Entry<String, List<TlInspectionLocationLog>> stringListEntry : deviceTrail.entrySet()) {
+            List<TlInspectionLocationLog> origin = stringListEntry.getValue();
+            if (origin.size() < 2) {
+                continue;
+            }
+            // 对原始list分成2组list,一个去掉头节点,一个去掉尾节点
+            List<TlInspectionLocationLog> subPre = CollUtil.sub(origin, 0, origin.size() - 1);
+            List<TlInspectionLocationLog> subAfter = CollUtil.sub(origin, 1, origin.size());
+            for (int i = 0; i < subPre.size(); i++) {
+                String fencePre = subPre.get(i).getFence();
+                String fenceAfter = subAfter.get(i).getFence();
+                // 计算2点之间距离
+                GlobalCoordinates source = new GlobalCoordinates(Convert.toDouble(fencePre.split(",")[1]), Convert.toDouble(fencePre.split(",")[0]));
+                GlobalCoordinates target = new GlobalCoordinates(Convert.toDouble(fenceAfter.split(",")[1]), Convert.toDouble(fenceAfter.split(",")[0]));
+                // 创建GeodeticCalculator,调用计算方法
+                double ellipsoidalDistance = new GeodeticCalculator().calculateGeodeticCurve(Ellipsoid.WGS84, source, target).getEllipsoidalDistance();
+                distance = NumberUtil.add(distance, ellipsoidalDistance);
+            }
+        }
+        return NumberUtil.div(distance, 1000, 3);
+    }
 }

+ 46 - 46
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java

@@ -1,111 +1,111 @@
 package com.ruoyi.system.domain;
 
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Size;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.annotation.Excel.ColumnType;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
 
 /**
  * 参数配置表 sys_config
- * 
+ *
  * @author ruoyi
  */
-public class SysConfig extends BaseEntity
-{
+public class SysConfig extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 参数主键 */
+    /**
+     * 参数主键
+     */
     @Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
     private Long configId;
 
-    /** 参数名称 */
+    /**
+     * 参数名称
+     */
     @Excel(name = "参数名称")
     private String configName;
 
-    /** 参数键名 */
+    /**
+     * 参数键名
+     */
     @Excel(name = "参数键名")
     private String configKey;
 
-    /** 参数键值 */
+    /**
+     * 参数键值
+     */
     @Excel(name = "参数键值")
     private String configValue;
 
-    /** 系统内置(Y是 N否) */
+    /**
+     * 系统内置(Y是 N否)
+     */
     @Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
     private String configType;
 
-    public Long getConfigId()
-    {
+    public Long getConfigId() {
         return configId;
     }
 
-    public void setConfigId(Long configId)
-    {
+    public void setConfigId(Long configId) {
         this.configId = configId;
     }
 
     @NotBlank(message = "参数名称不能为空")
     @Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
-    public String getConfigName()
-    {
+    public String getConfigName() {
         return configName;
     }
 
-    public void setConfigName(String configName)
-    {
+    public void setConfigName(String configName) {
         this.configName = configName;
     }
 
     @NotBlank(message = "参数键名长度不能为空")
     @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
-    public String getConfigKey()
-    {
+    public String getConfigKey() {
         return configKey;
     }
 
-    public void setConfigKey(String configKey)
-    {
+    public void setConfigKey(String configKey) {
         this.configKey = configKey;
     }
 
     @NotBlank(message = "参数键值不能为空")
-    @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
-    public String getConfigValue()
-    {
+//    @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
+    public String getConfigValue() {
         return configValue;
     }
 
-    public void setConfigValue(String configValue)
-    {
+    public void setConfigValue(String configValue) {
         this.configValue = configValue;
     }
 
-    public String getConfigType()
-    {
+    public String getConfigType() {
         return configType;
     }
 
-    public void setConfigType(String configType)
-    {
+    public void setConfigType(String configType) {
         this.configType = configType;
     }
-    
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("configId", getConfigId())
-            .append("configName", getConfigName())
-            .append("configKey", getConfigKey())
-            .append("configValue", getConfigValue())
-            .append("configType", getConfigType())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("configId", getConfigId())
+                .append("configName", getConfigName())
+                .append("configKey", getConfigKey())
+                .append("configValue", getConfigValue())
+                .append("configType", getConfigType())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .toString();
     }
 }

+ 0 - 107
ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionDeviceTrailMapper.xml

@@ -1,107 +0,0 @@
-<?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.ruoyi.qdtl.mapper.TlInspectionDeviceTrailMapper">
-
-    <resultMap type="TlInspectionDeviceTrail" id="TlInspectionDeviceTrailResult">
-        <result property="id" column="id"/>
-        <result property="deviceId" column="device_id"/>
-        <result property="deviceName" column="device_name"/>
-        <result property="deviceCode" column="device_code"/>
-        <result property="checkpointId" column="checkpoint_id"/>
-        <result property="checkpointName" column="checkpoint_name"/>
-        <result property="checkpointCard" column="checkpoint_card"/>
-        <result property="fence" column="fence"/>
-        <result property="createTime" column="create_time"/>
-    </resultMap>
-
-    <sql id="selectTlInspectionDeviceTrailVo">
-        select id,
-               device_id,
-               device_name,
-               device_code,
-               checkpoint_id,
-               checkpoint_name,
-               checkpoint_card,
-               fence,
-               create_time
-        from tl_inspection_device_trail
-    </sql>
-
-    <select id="selectTlInspectionDeviceTrailList" parameterType="TlInspectionDeviceTrail" resultMap="TlInspectionDeviceTrailResult">
-        <include refid="selectTlInspectionDeviceTrailVo"/>
-        <where>
-            <if test="deviceId != null  and deviceId != ''">and device_id = #{deviceId}</if>
-            <if test="deviceName != null  and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')</if>
-            <if test="deviceCode != null  and deviceCode != ''">and device_code = #{deviceCode}</if>
-            <if test="checkpointId != null  and checkpointId != ''">and checkpoint_id = #{checkpointId}</if>
-            <if test="checkpointName != null  and checkpointName != ''">and checkpoint_name like concat('%', #{checkpointName}, '%')</if>
-            <if test="checkpointCard != null  and checkpointCard != ''">and checkpoint_card = #{checkpointCard}</if>
-            <if test="fence != null  and fence != ''">and fence = #{fence}</if>
-        </where>
-    </select>
-
-    <select id="selectTlInspectionDeviceTrailById" parameterType="Long" resultMap="TlInspectionDeviceTrailResult">
-        <include refid="selectTlInspectionDeviceTrailVo"/>
-        where id = #{id}
-    </select>
-
-    <select id="selectListByDate" resultMap="TlInspectionDeviceTrailResult">
-        <include refid="selectTlInspectionDeviceTrailVo"/>
-        where date_format(create_time,'%Y-%m-%d') = #{date}
-        order by create_time asc
-    </select>
-
-    <insert id="insertTlInspectionDeviceTrail" parameterType="TlInspectionDeviceTrail" useGeneratedKeys="true" keyProperty="id">
-        insert into tl_inspection_device_trail
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="deviceId != null">device_id,</if>
-            <if test="deviceName != null">device_name,</if>
-            <if test="deviceCode != null">device_code,</if>
-            <if test="checkpointId != null">checkpoint_id,</if>
-            <if test="checkpointName != null">checkpoint_name,</if>
-            <if test="checkpointCard != null">checkpoint_card,</if>
-            <if test="fence != null">fence,</if>
-            <if test="createTime != null">create_time,</if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="deviceId != null">#{deviceId},</if>
-            <if test="deviceName != null">#{deviceName},</if>
-            <if test="deviceCode != null">#{deviceCode},</if>
-            <if test="checkpointId != null">#{checkpointId},</if>
-            <if test="checkpointName != null">#{checkpointName},</if>
-            <if test="checkpointCard != null">#{checkpointCard},</if>
-            <if test="fence != null">#{fence},</if>
-            <if test="createTime != null">#{createTime},</if>
-        </trim>
-    </insert>
-
-    <update id="updateTlInspectionDeviceTrail" parameterType="TlInspectionDeviceTrail">
-        update tl_inspection_device_trail
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="deviceId != null">device_id = #{deviceId},</if>
-            <if test="deviceName != null">device_name = #{deviceName},</if>
-            <if test="deviceCode != null">device_code = #{deviceCode},</if>
-            <if test="checkpointId != null">checkpoint_id = #{checkpointId},</if>
-            <if test="checkpointName != null">checkpoint_name = #{checkpointName},</if>
-            <if test="checkpointCard != null">checkpoint_card = #{checkpointCard},</if>
-            <if test="fence != null">fence = #{fence},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteTlInspectionDeviceTrailById" parameterType="Long">
-        delete
-        from tl_inspection_device_trail
-        where id = #{id}
-    </delete>
-
-    <delete id="deleteTlInspectionDeviceTrailByIds" parameterType="String">
-        delete from tl_inspection_device_trail where id in
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-</mapper>

+ 53 - 2
ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionLocationLogMapper.xml

@@ -18,6 +18,7 @@
         <result property="deviceCode" column="device_code"/>
         <result property="areaId" column="area_id"/>
         <result property="areaName" column="area_name"/>
+        <result property="fence" column="fence"/>
     </resultMap>
 
     <sql id="selectTlInspectionLocationLogVo">
@@ -33,7 +34,8 @@
                device_name,
                device_code,
                area_id,
-               area_name
+               area_name,
+               fence
         from tl_inspection_location_log
     </sql>
 
@@ -49,9 +51,20 @@
             <if test="deviceId != null  and deviceId != ''">and device_id = #{deviceId}</if>
             <if test="deviceName != null  and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')</if>
             <if test="deviceCode != null  and deviceCode != ''">and device_code = #{deviceCode}</if>
-            <if test="areaId != null  and areaId != ''">and area_id = #{areaId}</if>
+            <if test="areaIds != null">and area_id in
+                <foreach collection="areaIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
             <if test="areaName != null  and areaName != ''">and area_name like concat('%', #{areaName}, '%')</if>
+            <if test="beginTime != null and beginTime != ''">
+                AND create_time &gt;= #{beginTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND create_time &lt;= #{endTime}
+            </if>
         </where>
+        order by create_time desc
     </select>
 
     <select id="selectTlInspectionLocationLogById" parameterType="Long" resultMap="TlInspectionLocationLogResult">
@@ -91,6 +104,42 @@
         order by t2.checkCount desc
     </select>
 
+    <select id="selectListByDate" resultMap="TlInspectionLocationLogResult">
+        <include refid="selectTlInspectionLocationLogVo"/>
+        where date_format(create_time,'%Y-%m-%d') = #{date}
+        and fence != ''
+        order by create_time asc
+    </select>
+
+    <select id="selectTlInspectionLocationLogTrailList" parameterType="TlInspectionLocationLog" resultMap="TlInspectionLocationLogResult">
+        <include refid="selectTlInspectionLocationLogVo"/>
+        <where>
+            <if test="checkpointId != null  and checkpointId != ''">and checkpoint_id = #{checkpointId}</if>
+            <if test="checkpointName != null  and checkpointName != ''">and checkpoint_name like concat('%', #{checkpointName}, '%')</if>
+            <if test="checkpointCard != null  and checkpointCard != ''">and checkpoint_card = #{checkpointCard}</if>
+            <if test="patrolmanId != null  and patrolmanId != ''">and patrolman_id = #{patrolmanId}</if>
+            <if test="patrolmanName != null  and patrolmanName != ''">and patrolman_name like concat('%', #{patrolmanName}, '%')</if>
+            <if test="patrolmanCard != null  and patrolmanCard != ''">and patrolman_card = #{patrolmanCard}</if>
+            <if test="deviceId != null  and deviceId != ''">and device_id = #{deviceId}</if>
+            <if test="deviceName != null  and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')</if>
+            <if test="deviceCode != null  and deviceCode != ''">and device_code = #{deviceCode}</if>
+            <if test="areaIds != null">and area_id in
+                <foreach collection="areaIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="areaName != null  and areaName != ''">and area_name like concat('%', #{areaName}, '%')</if>
+            <if test="beginTime != null and beginTime != ''">
+                AND create_time &gt;= #{beginTime}
+            </if>
+            <if test="params.endTime != null and params.endTime != ''">
+                AND create_time &lt;= #{endTime}
+            </if>
+            and fence != ''
+        </where>
+        order by create_time asc
+    </select>
+
     <insert id="insertTlInspectionLocationLog" parameterType="TlInspectionLocationLog" useGeneratedKeys="true" keyProperty="id">
         insert into tl_inspection_location_log
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -106,6 +155,7 @@
             <if test="deviceCode != null">device_code,</if>
             <if test="areaId != null">area_id,</if>
             <if test="areaName != null">area_name,</if>
+            <if test="fence != null">fence,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="checkpointId != null">#{checkpointId},</if>
@@ -120,6 +170,7 @@
             <if test="deviceCode != null">#{deviceCode},</if>
             <if test="areaId != null">#{areaId},</if>
             <if test="areaName != null">#{areaName},</if>
+            <if test="fence != null">#{fence},</if>
         </trim>
     </insert>
 

+ 31 - 1
sql/ry_20210908.sql

@@ -1209,9 +1209,39 @@ alter table tl_plan_record
 alter table tl_plan_record
     add end_time varchar(20) default '' null comment '结束时刻';
 
--- 已同步
+alter table tl_inspection_location
+    add pic varchar(500) default '' null comment '图片地址';
 
 
+drop table if exists tl_document;
+create table tl_document
+(
+    id              bigint(20) not null auto_increment comment 'id',
+    wen_tou         varchar(100) comment '文头',
+    title           varchar(100) comment '标题',
+    periods         varchar(10) comment '期数',
+    second_title    varchar(100) comment '副标题',
+    publish_date    varchar(20) comment '发文日期',
+    center_news     varchar(1000) comment '指挥中心动态',
+    area_news       varchar(1000) comment '区镇动态',
+    basic_example   text comment '典型案例',
+    start_statistic varchar(20) comment '巡防统计周期起止',
+    end_statistic   varchar(20) comment '巡防统计周期终止',
+    question        text comment '存在问题',
+    advice          text comment '工作建议',
+    file_url        varchar(2000) default '' comment '附件地址',
+    bao_song        varchar(100)  default '' comment '报送机关',
+    chao_song       varchar(100)  default '' comment '抄送机关',
+    tong_gao        varchar(100)  default '' comment '统稿人',
+    shen_he         varchar(100)  default '' comment '审核人',
+    qian_fa         varchar(100)  default '' comment '签发人',
+    create_time     datetime comment '创建时间',
+    primary key (id)
+) engine = innodb
+  auto_increment = 100000 comment = '公文管理';
+
+
+-- 已同步