Browse Source

device、location

459242451@qq.com 3 years ago
parent
commit
e6caa363db

+ 1 - 1
pom.xml

@@ -201,7 +201,7 @@
             <dependency>
                 <groupId>cn.hutool</groupId>
                 <artifactId>hutool-all</artifactId>
-                <version>5.7.21</version>
+                <version>5.7.11</version>
             </dependency>
 
         </dependencies>

+ 22 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlAreaController.java

@@ -1,7 +1,14 @@
 package com.ruoyi.web.controller.qdtl;
 
 import java.util.List;
+import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.oracle.tools.packager.mac.MacAppBundler;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.qdtl.service.ITlInspectionDeviceService;
+import com.ruoyi.qdtl.service.ITlInspectionLocationService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -33,6 +40,10 @@ public class TlAreaController extends BaseController
 {
     @Autowired
     private ITlAreaService tlAreaService;
+    @Autowired
+    private ITlInspectionDeviceService tlInspectionDeviceService;
+    @Autowired
+    private ITlInspectionLocationService tlInspectionLocationService;
 
     /**
      * 查询区域管理列表
@@ -43,6 +54,17 @@ public class TlAreaController extends BaseController
     {
         startPage();
         List<TlArea> list = tlAreaService.selectTlAreaList(tlArea);
+        if (list.size() > 0) {
+            // 查询设备数和巡检点数量
+            Map<String,Integer> deviceArea = tlInspectionDeviceService.queryDeviceByArea();
+            Map<String,Integer> locationArea = tlInspectionLocationService.queryLocationByArea();
+            for (TlArea area : list) {
+                if ("1".equals(area.getAreaType())) {
+                    area.setDeviceCount(Convert.toInt(deviceArea.get(Convert.toStr(area.getId())),0));
+                    area.setLocationCount(Convert.toInt(locationArea.get(Convert.toStr(area.getId())),0));
+                }
+            }
+        }
         return getDataTable(list);
     }
 

+ 104 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlInspectionDeviceController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.web.controller.qdtl;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.qdtl.domain.TlInspectionDevice;
+import com.ruoyi.qdtl.service.ITlInspectionDeviceService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 巡检设备管理Controller
+ * 
+ * @author ruoyi
+ * @date 2022-02-22
+ */
+@RestController
+@RequestMapping("/qdtl/device")
+public class TlInspectionDeviceController extends BaseController
+{
+    @Autowired
+    private ITlInspectionDeviceService tlInspectionDeviceService;
+
+    /**
+     * 查询巡检设备管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:device:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TlInspectionDevice tlInspectionDevice)
+    {
+        startPage();
+        List<TlInspectionDevice> list = tlInspectionDeviceService.selectTlInspectionDeviceList(tlInspectionDevice);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出巡检设备管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:device:export')")
+    @Log(title = "巡检设备管理", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, TlInspectionDevice tlInspectionDevice)
+    {
+        List<TlInspectionDevice> list = tlInspectionDeviceService.selectTlInspectionDeviceList(tlInspectionDevice);
+        ExcelUtil<TlInspectionDevice> util = new ExcelUtil<TlInspectionDevice>(TlInspectionDevice.class);
+        util.exportExcel(response, list, "巡检设备管理数据");
+    }
+
+    /**
+     * 获取巡检设备管理详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:device:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(tlInspectionDeviceService.selectTlInspectionDeviceById(id));
+    }
+
+    /**
+     * 新增巡检设备管理
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:device:add')")
+    @Log(title = "巡检设备管理", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TlInspectionDevice tlInspectionDevice)
+    {
+        return toAjax(tlInspectionDeviceService.insertTlInspectionDevice(tlInspectionDevice));
+    }
+
+    /**
+     * 修改巡检设备管理
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:device:edit')")
+    @Log(title = "巡检设备管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TlInspectionDevice tlInspectionDevice)
+    {
+        return toAjax(tlInspectionDeviceService.updateTlInspectionDevice(tlInspectionDevice));
+    }
+
+    /**
+     * 删除巡检设备管理
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:device:remove')")
+    @Log(title = "巡检设备管理", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(tlInspectionDeviceService.deleteTlInspectionDeviceByIds(ids));
+    }
+}

+ 104 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlInspectionLocationController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.web.controller.qdtl;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.qdtl.domain.TlInspectionLocation;
+import com.ruoyi.qdtl.service.ITlInspectionLocationService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 巡检点管理Controller
+ * 
+ * @author ruoyi
+ * @date 2022-02-22
+ */
+@RestController
+@RequestMapping("/qdtl/location")
+public class TlInspectionLocationController extends BaseController
+{
+    @Autowired
+    private ITlInspectionLocationService tlInspectionLocationService;
+
+    /**
+     * 查询巡检点管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:location:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TlInspectionLocation tlInspectionLocation)
+    {
+        startPage();
+        List<TlInspectionLocation> list = tlInspectionLocationService.selectTlInspectionLocationList(tlInspectionLocation);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出巡检点管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:location:export')")
+    @Log(title = "巡检点管理", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, TlInspectionLocation tlInspectionLocation)
+    {
+        List<TlInspectionLocation> list = tlInspectionLocationService.selectTlInspectionLocationList(tlInspectionLocation);
+        ExcelUtil<TlInspectionLocation> util = new ExcelUtil<TlInspectionLocation>(TlInspectionLocation.class);
+        util.exportExcel(response, list, "巡检点管理数据");
+    }
+
+    /**
+     * 获取巡检点管理详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:location:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(tlInspectionLocationService.selectTlInspectionLocationById(id));
+    }
+
+    /**
+     * 新增巡检点管理
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:location:add')")
+    @Log(title = "巡检点管理", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TlInspectionLocation tlInspectionLocation)
+    {
+        return toAjax(tlInspectionLocationService.insertTlInspectionLocation(tlInspectionLocation));
+    }
+
+    /**
+     * 修改巡检点管理
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:location:edit')")
+    @Log(title = "巡检点管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TlInspectionLocation tlInspectionLocation)
+    {
+        return toAjax(tlInspectionLocationService.updateTlInspectionLocation(tlInspectionLocation));
+    }
+
+    /**
+     * 删除巡检点管理
+     */
+    @PreAuthorize("@ss.hasPermi('qdtl:location:remove')")
+    @Log(title = "巡检点管理", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(tlInspectionLocationService.deleteTlInspectionLocationByIds(ids));
+    }
+}

+ 5 - 0
ruoyi-common/pom.xml

@@ -125,6 +125,11 @@
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 20 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlArea.java

@@ -43,6 +43,10 @@ public class TlArea extends BaseEntity
     /** 经纬度 */
     private String lnglat;
 
+    private Integer deviceCount;
+
+    private Integer locationCount;
+
     /** 删除标志(0代表存在 2代表删除) */
     private String delFlag;
 
@@ -147,4 +151,20 @@ public class TlArea extends BaseEntity
             .append("updateTime", getUpdateTime())
             .toString();
     }
+
+    public Integer getDeviceCount() {
+        return deviceCount;
+    }
+
+    public void setDeviceCount(Integer deviceCount) {
+        this.deviceCount = deviceCount;
+    }
+
+    public Integer getLocationCount() {
+        return locationCount;
+    }
+
+    public void setLocationCount(Integer locationCount) {
+        this.locationCount = locationCount;
+    }
 }

+ 125 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlInspectionDevice.java

@@ -0,0 +1,125 @@
+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
+ * 
+ * @author ruoyi
+ * @date 2022-02-22
+ */
+public class TlInspectionDevice extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private Long id;
+
+    /** 设备编号 */
+    @Excel(name = "设备编号")
+    private String deviceCode;
+
+    /** 设备名称 */
+    @Excel(name = "设备名称")
+    private String deviceName;
+
+    /** 设备类型 */
+    @Excel(name = "设备类型")
+    private String deviceType;
+
+    /** 经纬度 */
+    @Excel(name = "经纬度")
+    private String lnglat;
+
+    /** 所属区域 */
+    @Excel(name = "所属区域")
+    private Long areaId;
+
+    /** 删除标志(0代表存在 2代表删除) */
+    private String delFlag;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setDeviceCode(String deviceCode) 
+    {
+        this.deviceCode = deviceCode;
+    }
+
+    public String getDeviceCode() 
+    {
+        return deviceCode;
+    }
+    public void setDeviceName(String deviceName) 
+    {
+        this.deviceName = deviceName;
+    }
+
+    public String getDeviceName() 
+    {
+        return deviceName;
+    }
+    public void setDeviceType(String deviceType) 
+    {
+        this.deviceType = deviceType;
+    }
+
+    public String getDeviceType() 
+    {
+        return deviceType;
+    }
+    public void setLnglat(String lnglat) 
+    {
+        this.lnglat = lnglat;
+    }
+
+    public String getLnglat() 
+    {
+        return lnglat;
+    }
+    public void setAreaId(Long areaId) 
+    {
+        this.areaId = areaId;
+    }
+
+    public Long getAreaId() 
+    {
+        return areaId;
+    }
+    public void setDelFlag(String delFlag) 
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("deviceCode", getDeviceCode())
+            .append("deviceName", getDeviceName())
+            .append("deviceType", getDeviceType())
+            .append("lnglat", getLnglat())
+            .append("areaId", getAreaId())
+            .append("remark", getRemark())
+            .append("delFlag", getDelFlag())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 138 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlInspectionLocation.java

@@ -0,0 +1,138 @@
+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_location
+ * 
+ * @author ruoyi
+ * @date 2022-02-22
+ */
+public class TlInspectionLocation extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private Long id;
+
+    /** 编号 */
+    @Excel(name = "编号")
+    private String locationCode;
+
+    /** 名称 */
+    @Excel(name = "名称")
+    private String locationName;
+
+    /** 描述 */
+    @Excel(name = "描述")
+    private String detail;
+
+    /** 巡检设备 */
+    @Excel(name = "巡检设备")
+    private String deviceIds;
+
+    /** 所属区域 */
+    @Excel(name = "所属区域")
+    private Long areaId;
+
+    /** 经纬度 */
+    private String lnglat;
+
+    /** 删除标志(0代表存在 2代表删除) */
+    private String delFlag;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setLocationCode(String locationCode) 
+    {
+        this.locationCode = locationCode;
+    }
+
+    public String getLocationCode() 
+    {
+        return locationCode;
+    }
+    public void setLocationName(String locationName) 
+    {
+        this.locationName = locationName;
+    }
+
+    public String getLocationName() 
+    {
+        return locationName;
+    }
+    public void setDetail(String detail) 
+    {
+        this.detail = detail;
+    }
+
+    public String getDetail() 
+    {
+        return detail;
+    }
+    public void setDeviceIds(String deviceIds) 
+    {
+        this.deviceIds = deviceIds;
+    }
+
+    public String getDeviceIds() 
+    {
+        return deviceIds;
+    }
+    public void setAreaId(Long areaId) 
+    {
+        this.areaId = areaId;
+    }
+
+    public Long getAreaId() 
+    {
+        return areaId;
+    }
+    public void setLnglat(String lnglat) 
+    {
+        this.lnglat = lnglat;
+    }
+
+    public String getLnglat() 
+    {
+        return lnglat;
+    }
+    public void setDelFlag(String delFlag) 
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("locationCode", getLocationCode())
+            .append("locationName", getLocationName())
+            .append("detail", getDetail())
+            .append("deviceIds", getDeviceIds())
+            .append("areaId", getAreaId())
+            .append("lnglat", getLnglat())
+            .append("remark", getRemark())
+            .append("delFlag", getDelFlag())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 69 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlInspectionDeviceMapper.java

@@ -0,0 +1,69 @@
+package com.ruoyi.qdtl.mapper;
+
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.qdtl.domain.TlInspectionDevice;
+import org.apache.ibatis.annotations.MapKey;
+
+/**
+ * 巡检设备管理Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2022-02-22
+ */
+public interface TlInspectionDeviceMapper 
+{
+    /**
+     * 查询巡检设备管理
+     * 
+     * @param id 巡检设备管理主键
+     * @return 巡检设备管理
+     */
+    public TlInspectionDevice selectTlInspectionDeviceById(Long id);
+
+    /**
+     * 查询巡检设备管理列表
+     * 
+     * @param tlInspectionDevice 巡检设备管理
+     * @return 巡检设备管理集合
+     */
+    public List<TlInspectionDevice> selectTlInspectionDeviceList(TlInspectionDevice tlInspectionDevice);
+
+    /**
+     * 新增巡检设备管理
+     * 
+     * @param tlInspectionDevice 巡检设备管理
+     * @return 结果
+     */
+    public int insertTlInspectionDevice(TlInspectionDevice tlInspectionDevice);
+
+    /**
+     * 修改巡检设备管理
+     * 
+     * @param tlInspectionDevice 巡检设备管理
+     * @return 结果
+     */
+    public int updateTlInspectionDevice(TlInspectionDevice tlInspectionDevice);
+
+    /**
+     * 删除巡检设备管理
+     * 
+     * @param id 巡检设备管理主键
+     * @return 结果
+     */
+    public int deleteTlInspectionDeviceById(Long id);
+
+    /**
+     * 批量删除巡检设备管理
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTlInspectionDeviceByIds(Long[] ids);
+
+    int selectExist(TlInspectionDevice tlInspectionDevice);
+
+    List<JSONObject> queryDeviceByArea();
+}

+ 67 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlInspectionLocationMapper.java

@@ -0,0 +1,67 @@
+package com.ruoyi.qdtl.mapper;
+
+import java.util.List;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.qdtl.domain.TlInspectionLocation;
+
+/**
+ * 巡检点管理Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2022-02-22
+ */
+public interface TlInspectionLocationMapper 
+{
+    /**
+     * 查询巡检点管理
+     * 
+     * @param id 巡检点管理主键
+     * @return 巡检点管理
+     */
+    public TlInspectionLocation selectTlInspectionLocationById(Long id);
+
+    /**
+     * 查询巡检点管理列表
+     * 
+     * @param tlInspectionLocation 巡检点管理
+     * @return 巡检点管理集合
+     */
+    public List<TlInspectionLocation> selectTlInspectionLocationList(TlInspectionLocation tlInspectionLocation);
+
+    /**
+     * 新增巡检点管理
+     * 
+     * @param tlInspectionLocation 巡检点管理
+     * @return 结果
+     */
+    public int insertTlInspectionLocation(TlInspectionLocation tlInspectionLocation);
+
+    /**
+     * 修改巡检点管理
+     * 
+     * @param tlInspectionLocation 巡检点管理
+     * @return 结果
+     */
+    public int updateTlInspectionLocation(TlInspectionLocation tlInspectionLocation);
+
+    /**
+     * 删除巡检点管理
+     * 
+     * @param id 巡检点管理主键
+     * @return 结果
+     */
+    public int deleteTlInspectionLocationById(Long id);
+
+    /**
+     * 批量删除巡检点管理
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTlInspectionLocationByIds(Long[] ids);
+
+    int selectExist(TlInspectionLocation tlInspectionLocation);
+
+    List<JSONObject> queryLocationByArea();
+}

+ 66 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlInspectionDeviceService.java

@@ -0,0 +1,66 @@
+package com.ruoyi.qdtl.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.qdtl.domain.TlInspectionDevice;
+
+/**
+ * 巡检设备管理Service接口
+ * 
+ * @author ruoyi
+ * @date 2022-02-22
+ */
+public interface ITlInspectionDeviceService 
+{
+    /**
+     * 查询巡检设备管理
+     * 
+     * @param id 巡检设备管理主键
+     * @return 巡检设备管理
+     */
+    public TlInspectionDevice selectTlInspectionDeviceById(Long id);
+
+    /**
+     * 查询巡检设备管理列表
+     * 
+     * @param tlInspectionDevice 巡检设备管理
+     * @return 巡检设备管理集合
+     */
+    public List<TlInspectionDevice> selectTlInspectionDeviceList(TlInspectionDevice tlInspectionDevice);
+
+    /**
+     * 新增巡检设备管理
+     * 
+     * @param tlInspectionDevice 巡检设备管理
+     * @return 结果
+     */
+    public int insertTlInspectionDevice(TlInspectionDevice tlInspectionDevice);
+
+    /**
+     * 修改巡检设备管理
+     * 
+     * @param tlInspectionDevice 巡检设备管理
+     * @return 结果
+     */
+    public int updateTlInspectionDevice(TlInspectionDevice tlInspectionDevice);
+
+    /**
+     * 批量删除巡检设备管理
+     * 
+     * @param ids 需要删除的巡检设备管理主键集合
+     * @return 结果
+     */
+    public int deleteTlInspectionDeviceByIds(Long[] ids);
+
+    /**
+     * 删除巡检设备管理信息
+     * 
+     * @param id 巡检设备管理主键
+     * @return 结果
+     */
+    public int deleteTlInspectionDeviceById(Long id);
+
+    Map<String,Integer> queryDeviceByArea();
+}

+ 65 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlInspectionLocationService.java

@@ -0,0 +1,65 @@
+package com.ruoyi.qdtl.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.ruoyi.qdtl.domain.TlInspectionLocation;
+
+/**
+ * 巡检点管理Service接口
+ * 
+ * @author ruoyi
+ * @date 2022-02-22
+ */
+public interface ITlInspectionLocationService 
+{
+    /**
+     * 查询巡检点管理
+     * 
+     * @param id 巡检点管理主键
+     * @return 巡检点管理
+     */
+    public TlInspectionLocation selectTlInspectionLocationById(Long id);
+
+    /**
+     * 查询巡检点管理列表
+     * 
+     * @param tlInspectionLocation 巡检点管理
+     * @return 巡检点管理集合
+     */
+    public List<TlInspectionLocation> selectTlInspectionLocationList(TlInspectionLocation tlInspectionLocation);
+
+    /**
+     * 新增巡检点管理
+     * 
+     * @param tlInspectionLocation 巡检点管理
+     * @return 结果
+     */
+    public int insertTlInspectionLocation(TlInspectionLocation tlInspectionLocation);
+
+    /**
+     * 修改巡检点管理
+     * 
+     * @param tlInspectionLocation 巡检点管理
+     * @return 结果
+     */
+    public int updateTlInspectionLocation(TlInspectionLocation tlInspectionLocation);
+
+    /**
+     * 批量删除巡检点管理
+     * 
+     * @param ids 需要删除的巡检点管理主键集合
+     * @return 结果
+     */
+    public int deleteTlInspectionLocationByIds(Long[] ids);
+
+    /**
+     * 删除巡检点管理信息
+     * 
+     * @param id 巡检点管理主键
+     * @return 结果
+     */
+    public int deleteTlInspectionLocationById(Long id);
+
+    Map<String, Integer> queryLocationByArea();
+}

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

@@ -0,0 +1,135 @@
+package com.ruoyi.qdtl.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.qdtl.domain.TlArea;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.qdtl.mapper.TlInspectionDeviceMapper;
+import com.ruoyi.qdtl.domain.TlInspectionDevice;
+import com.ruoyi.qdtl.service.ITlInspectionDeviceService;
+
+/**
+ * 巡检设备管理Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2022-02-22
+ */
+@Service
+public class TlInspectionDeviceServiceImpl implements ITlInspectionDeviceService 
+{
+    @Autowired
+    private TlInspectionDeviceMapper tlInspectionDeviceMapper;
+
+    /**
+     * 查询巡检设备管理
+     * 
+     * @param id 巡检设备管理主键
+     * @return 巡检设备管理
+     */
+    @Override
+    public TlInspectionDevice selectTlInspectionDeviceById(Long id)
+    {
+        return tlInspectionDeviceMapper.selectTlInspectionDeviceById(id);
+    }
+
+    /**
+     * 查询巡检设备管理列表
+     * 
+     * @param tlInspectionDevice 巡检设备管理
+     * @return 巡检设备管理
+     */
+    @Override
+    public List<TlInspectionDevice> selectTlInspectionDeviceList(TlInspectionDevice tlInspectionDevice)
+    {
+        return tlInspectionDeviceMapper.selectTlInspectionDeviceList(tlInspectionDevice);
+    }
+
+    /**
+     * 新增巡检设备管理
+     * 
+     * @param tlInspectionDevice 巡检设备管理
+     * @return 结果
+     */
+    @Override
+    public int insertTlInspectionDevice(TlInspectionDevice tlInspectionDevice)
+    {
+        tlInspectionDevice.setCreateTime(DateUtils.getNowDate());
+        // 控制编号和名称不能重复
+        int count = tlInspectionDeviceMapper.selectExist(tlInspectionDevice);
+        if (count > 0) {
+            throw new ServiceException("编号或名称已存在,请更换");
+        }
+        return tlInspectionDeviceMapper.insertTlInspectionDevice(tlInspectionDevice);
+    }
+
+    /**
+     * 修改巡检设备管理
+     * 
+     * @param tlInspectionDevice 巡检设备管理
+     * @return 结果
+     */
+    @Override
+    public int updateTlInspectionDevice(TlInspectionDevice tlInspectionDevice)
+    {
+        tlInspectionDevice.setUpdateTime(DateUtils.getNowDate());
+        // 查询原有的数据
+        TlInspectionDevice old = selectTlInspectionDeviceById(tlInspectionDevice.getId());
+        if (old != null) {
+            if (!old.getDeviceCode().equals(tlInspectionDevice.getDeviceCode())) {
+                // 校验是否重复
+                TlInspectionDevice check = new TlInspectionDevice();
+                check.setDeviceCode(tlInspectionDevice.getDeviceCode());
+                List<TlInspectionDevice> tlInspectionDevices = tlInspectionDeviceMapper.selectTlInspectionDeviceList(check);
+                if (tlInspectionDevices.size() > 0) {
+                    throw new ServiceException("编号已存在,请更换");
+                }
+            }
+            if (!old.getDeviceName().equals(tlInspectionDevice.getDeviceName())) {
+                // 校验是否重复
+                TlInspectionDevice check = new TlInspectionDevice();
+                check.setDeviceName(tlInspectionDevice.getDeviceName());
+                List<TlInspectionDevice> tlInspectionDevices = tlInspectionDeviceMapper.selectTlInspectionDeviceList(check);
+                if (tlInspectionDevices.size() > 0) {
+                    throw new ServiceException("名称已存在,请更换");
+                }
+            }
+        }
+        return tlInspectionDeviceMapper.updateTlInspectionDevice(tlInspectionDevice);
+    }
+
+    /**
+     * 批量删除巡检设备管理
+     * 
+     * @param ids 需要删除的巡检设备管理主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTlInspectionDeviceByIds(Long[] ids)
+    {
+        return tlInspectionDeviceMapper.deleteTlInspectionDeviceByIds(ids);
+    }
+
+    /**
+     * 删除巡检设备管理信息
+     * 
+     * @param id 巡检设备管理主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTlInspectionDeviceById(Long id)
+    {
+        return tlInspectionDeviceMapper.deleteTlInspectionDeviceById(id);
+    }
+
+    @Override
+    public Map<String,Integer> queryDeviceByArea() {
+        List<JSONObject> jsonObjects = tlInspectionDeviceMapper.queryDeviceByArea();
+        return jsonObjects.stream().collect(Collectors.toMap(a -> a.getString("areaId"), b -> b.getInteger("cnt")));
+    }
+}

+ 134 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlInspectionLocationServiceImpl.java

@@ -0,0 +1,134 @@
+package com.ruoyi.qdtl.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.qdtl.mapper.TlInspectionLocationMapper;
+import com.ruoyi.qdtl.domain.TlInspectionLocation;
+import com.ruoyi.qdtl.service.ITlInspectionLocationService;
+
+/**
+ * 巡检点管理Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2022-02-22
+ */
+@Service
+public class TlInspectionLocationServiceImpl implements ITlInspectionLocationService 
+{
+    @Autowired
+    private TlInspectionLocationMapper tlInspectionLocationMapper;
+
+    /**
+     * 查询巡检点管理
+     * 
+     * @param id 巡检点管理主键
+     * @return 巡检点管理
+     */
+    @Override
+    public TlInspectionLocation selectTlInspectionLocationById(Long id)
+    {
+        return tlInspectionLocationMapper.selectTlInspectionLocationById(id);
+    }
+
+    /**
+     * 查询巡检点管理列表
+     * 
+     * @param tlInspectionLocation 巡检点管理
+     * @return 巡检点管理
+     */
+    @Override
+    public List<TlInspectionLocation> selectTlInspectionLocationList(TlInspectionLocation tlInspectionLocation)
+    {
+        return tlInspectionLocationMapper.selectTlInspectionLocationList(tlInspectionLocation);
+    }
+
+    /**
+     * 新增巡检点管理
+     * 
+     * @param tlInspectionLocation 巡检点管理
+     * @return 结果
+     */
+    @Override
+    public int insertTlInspectionLocation(TlInspectionLocation tlInspectionLocation)
+    {
+        tlInspectionLocation.setCreateTime(DateUtils.getNowDate());
+        // 控制编号和名称不能重复
+        int count = tlInspectionLocationMapper.selectExist(tlInspectionLocation);
+        if (count > 0) {
+            throw new ServiceException("编号或名称已存在,请更换");
+        }
+        return tlInspectionLocationMapper.insertTlInspectionLocation(tlInspectionLocation);
+    }
+
+    /**
+     * 修改巡检点管理
+     * 
+     * @param tlInspectionLocation 巡检点管理
+     * @return 结果
+     */
+    @Override
+    public int updateTlInspectionLocation(TlInspectionLocation tlInspectionLocation)
+    {
+        tlInspectionLocation.setUpdateTime(DateUtils.getNowDate());
+        // 查询原有的数据
+        TlInspectionLocation old = selectTlInspectionLocationById(tlInspectionLocation.getId());
+        if (old != null) {
+            if (!old.getLocationCode().equals(tlInspectionLocation.getLocationCode())) {
+                // 校验是否重复
+                TlInspectionLocation check = new TlInspectionLocation();
+                check.setLocationCode(tlInspectionLocation.getLocationCode());
+                List<TlInspectionLocation> tlInspectionLocations = tlInspectionLocationMapper.selectTlInspectionLocationList(check);
+                if (tlInspectionLocations.size() > 0) {
+                    throw new ServiceException("编号已存在,请更换");
+                }
+            }
+            if (!old.getLocationName().equals(tlInspectionLocation.getLocationName())) {
+                // 校验是否重复
+                TlInspectionLocation check = new TlInspectionLocation();
+                check.setLocationName(tlInspectionLocation.getLocationName());
+                List<TlInspectionLocation> tlInspectionLocations = tlInspectionLocationMapper.selectTlInspectionLocationList(check);
+                if (tlInspectionLocations.size() > 0) {
+                    throw new ServiceException("名称已存在,请更换");
+                }
+            }
+        }
+        return tlInspectionLocationMapper.updateTlInspectionLocation(tlInspectionLocation);
+    }
+
+    /**
+     * 批量删除巡检点管理
+     * 
+     * @param ids 需要删除的巡检点管理主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTlInspectionLocationByIds(Long[] ids)
+    {
+        return tlInspectionLocationMapper.deleteTlInspectionLocationByIds(ids);
+    }
+
+    /**
+     * 删除巡检点管理信息
+     * 
+     * @param id 巡检点管理主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTlInspectionLocationById(Long id)
+    {
+        return tlInspectionLocationMapper.deleteTlInspectionLocationById(id);
+    }
+
+    @Override
+    public Map<String, Integer> queryLocationByArea() {
+        List<JSONObject> jsonObjects = tlInspectionLocationMapper.queryLocationByArea();
+        return jsonObjects.stream().collect(Collectors.toMap(a -> a.getString("areaId"), b -> b.getInteger("cnt")));
+    }
+}

+ 115 - 0
ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionDeviceMapper.xml

@@ -0,0 +1,115 @@
+<?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.TlInspectionDeviceMapper">
+    
+    <resultMap type="TlInspectionDevice" id="TlInspectionDeviceResult">
+        <result property="id"    column="id"    />
+        <result property="deviceCode"    column="device_code"    />
+        <result property="deviceName"    column="device_name"    />
+        <result property="deviceType"    column="device_type"    />
+        <result property="lnglat"    column="lnglat"    />
+        <result property="areaId"    column="area_id"    />
+        <result property="remark"    column="remark"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectTlInspectionDeviceVo">
+        select id, device_code, device_name, device_type, lnglat, area_id, remark, del_flag, create_by, create_time, update_by, update_time from tl_inspection_device
+    </sql>
+
+    <select id="selectTlInspectionDeviceList" parameterType="TlInspectionDevice" resultMap="TlInspectionDeviceResult">
+        <include refid="selectTlInspectionDeviceVo"/>
+        <where>  
+            <if test="deviceCode != null  and deviceCode != ''"> and device_code like concat('%', #{deviceCode}, '%')</if>
+            <if test="deviceName != null  and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
+            <if test="deviceType != null  and deviceType != ''"> and device_type = #{deviceType}</if>
+            <if test="areaId != null "> and area_id = #{areaId}</if>
+             and del_flag = '0'
+        </where>
+    </select>
+    
+    <select id="selectTlInspectionDeviceById" parameterType="Long" resultMap="TlInspectionDeviceResult">
+        <include refid="selectTlInspectionDeviceVo"/>
+        where id = #{id}
+        and del_flag = '0'
+    </select>
+
+    <select id="selectExist" resultType="java.lang.Integer">
+        select count(1) from tl_inspection_device
+        where (device_code = #{deviceCode}
+            or device_name = #{deviceName})
+          and del_flag = '0'
+    </select>
+
+    <select id="queryDeviceByArea" resultType="com.alibaba.fastjson.JSONObject">
+        select area_id as areaId, count(1) as cnt
+        from tl_inspection_device
+        where del_flag = 0
+        group by area_id
+    </select>
+
+    <insert id="insertTlInspectionDevice" parameterType="TlInspectionDevice" useGeneratedKeys="true" keyProperty="id">
+        insert into tl_inspection_device
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="deviceCode != null and deviceCode != ''">device_code,</if>
+            <if test="deviceName != null and deviceName != ''">device_name,</if>
+            <if test="deviceType != null and deviceType != ''">device_type,</if>
+            <if test="lnglat != null">lnglat,</if>
+            <if test="areaId != null">area_id,</if>
+            <if test="remark != null">remark,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
+            <if test="deviceName != null and deviceName != ''">#{deviceName},</if>
+            <if test="deviceType != null and deviceType != ''">#{deviceType},</if>
+            <if test="lnglat != null">#{lnglat},</if>
+            <if test="areaId != null">#{areaId},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTlInspectionDevice" parameterType="TlInspectionDevice">
+        update tl_inspection_device
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
+            <if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
+            <if test="deviceType != null and deviceType != ''">device_type = #{deviceType},</if>
+            <if test="lnglat != null">lnglat = #{lnglat},</if>
+            <if test="areaId != null">area_id = #{areaId},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteTlInspectionDeviceById" parameterType="Long">
+        delete from tl_inspection_device where id = #{id}
+    </delete>
+
+    <delete id="deleteTlInspectionDeviceByIds" parameterType="String">
+        delete from tl_inspection_device where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 116 - 0
ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionLocationMapper.xml

@@ -0,0 +1,116 @@
+<?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.TlInspectionLocationMapper">
+    
+    <resultMap type="TlInspectionLocation" id="TlInspectionLocationResult">
+        <result property="id"    column="id"    />
+        <result property="locationCode"    column="location_code"    />
+        <result property="locationName"    column="location_name"    />
+        <result property="detail"    column="detail"    />
+        <result property="deviceIds"    column="device_ids"    />
+        <result property="areaId"    column="area_id"    />
+        <result property="lnglat"    column="lnglat"    />
+        <result property="remark"    column="remark"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectTlInspectionLocationVo">
+        select id, location_code, location_name, detail, device_ids, area_id, lnglat, remark, del_flag, create_by, create_time, update_by, update_time from tl_inspection_location
+    </sql>
+
+    <select id="selectTlInspectionLocationList" parameterType="TlInspectionLocation" resultMap="TlInspectionLocationResult">
+        <include refid="selectTlInspectionLocationVo"/>
+        <where>  
+            <if test="locationCode != null  and locationCode != ''"> and location_code like concat('%', #{locationCode}, '%')</if>
+            <if test="locationName != null  and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
+            <if test="areaId != null "> and area_id = #{areaId}</if>
+        </where>
+    </select>
+    
+    <select id="selectTlInspectionLocationById" parameterType="Long" resultMap="TlInspectionLocationResult">
+        <include refid="selectTlInspectionLocationVo"/>
+        where id = #{id}
+    </select>
+
+    <select id="selectExist" resultType="java.lang.Integer">
+        select count(1) from tl_inspection_location
+        where (location_code = #{locationCode}
+            or location_name = #{locationName})
+          and del_flag = '0'
+    </select>
+
+    <select id="queryLocationByArea" resultType="com.alibaba.fastjson.JSONObject">
+        select area_id as areaId, count(1) as cnt
+        from tl_inspection_location
+        where del_flag = 0
+        group by area_id
+    </select>
+
+    <insert id="insertTlInspectionLocation" parameterType="TlInspectionLocation" useGeneratedKeys="true" keyProperty="id">
+        insert into tl_inspection_location
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="locationCode != null">location_code,</if>
+            <if test="locationName != null">location_name,</if>
+            <if test="detail != null">detail,</if>
+            <if test="deviceIds != null">device_ids,</if>
+            <if test="areaId != null">area_id,</if>
+            <if test="lnglat != null">lnglat,</if>
+            <if test="remark != null">remark,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="locationCode != null">#{locationCode},</if>
+            <if test="locationName != null">#{locationName},</if>
+            <if test="detail != null">#{detail},</if>
+            <if test="deviceIds != null">#{deviceIds},</if>
+            <if test="areaId != null">#{areaId},</if>
+            <if test="lnglat != null">#{lnglat},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTlInspectionLocation" parameterType="TlInspectionLocation">
+        update tl_inspection_location
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="locationCode != null">location_code = #{locationCode},</if>
+            <if test="locationName != null">location_name = #{locationName},</if>
+            <if test="detail != null">detail = #{detail},</if>
+            <if test="deviceIds != null">device_ids = #{deviceIds},</if>
+            <if test="areaId != null">area_id = #{areaId},</if>
+            <if test="lnglat != null">lnglat = #{lnglat},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteTlInspectionLocationById" parameterType="Long">
+        delete from tl_inspection_location where id = #{id}
+    </delete>
+
+    <delete id="deleteTlInspectionLocationByIds" parameterType="String">
+        delete from tl_inspection_location where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>