Explorar o código

巡检管理-巡检设备相关接口上传

jichaobo %!s(int64=3) %!d(string=hai) anos
pai
achega
4c22e46f45

+ 60 - 0
fiveep-controller/src/main/java/com/bizmatics/controller/web/PatrolInspectionDeviceController.java

@@ -0,0 +1,60 @@
+package com.bizmatics.controller.web;
+
+
+import com.bizmatics.common.core.bean.ApiResult;
+import com.bizmatics.model.PatrolInspectionDevice;
+import com.bizmatics.model.vo.PatrolInspectionDeviceVo;
+import com.bizmatics.service.PatrolInspectionDeviceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+@RestController
+@RequestMapping("/patrolInspectionDevice")
+public class PatrolInspectionDeviceController {
+
+    @Autowired
+    private PatrolInspectionDeviceService patrolInspectionDeviceService;
+
+    @GetMapping("patrolInspectionDeviceAdd")
+    public ApiResult<Void> patrolInspectionDeviceAdd(@RequestParam String inspectionDeviceName,
+                                                     @RequestParam Integer siteId,
+                                                     @RequestParam Integer deviceTypeId
+    ) {
+        patrolInspectionDeviceService.patrolInspectionDeviceAdd(inspectionDeviceName, siteId, deviceTypeId);
+        return ApiResult.success();
+    }
+
+    @GetMapping("patrolInspectionDeviceUpdate")
+    public ApiResult<Void> patrolInspectionDeviceUpdate(@RequestBody PatrolInspectionDevice patrolInspectionDevice
+    ) {
+        patrolInspectionDeviceService.patrolInspectionDeviceUpdate(patrolInspectionDevice);
+        return ApiResult.success();
+    }
+
+    @GetMapping("patrolInspectionDeviceDel")
+    public ApiResult<Void> patrolInspectionDeviceDel(@RequestParam Integer id
+    ) {
+        patrolInspectionDeviceService.patrolInspectionDeviceDel(id);
+        return ApiResult.success();
+    }
+
+    @GetMapping("patrolInspectionDeviceList")
+    public ApiResult<List<PatrolInspectionDeviceVo>> patrolInspectionDeviceList(@RequestParam(value = "id", required = false, defaultValue = "0") Integer id,
+                                                                                @RequestParam(value = "siteId", required = false, defaultValue = "0") Integer siteId,
+                                                                                @RequestParam(required = false) String inspectionDeviceName
+    ) {
+        return ApiResult.success(patrolInspectionDeviceService.patrolInspectionDeviceList(inspectionDeviceName, siteId, id));
+    }
+
+}
+

+ 21 - 0
fiveep-controller/src/main/java/com/bizmatics/controller/web/PatrolManufacturerController.java

@@ -0,0 +1,21 @@
+package com.bizmatics.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+@Controller
+@RequestMapping("/patrolManufacturer")
+public class PatrolManufacturerController {
+
+}
+

+ 106 - 0
fiveep-model/src/main/java/com/bizmatics/model/PatrolInspectionDevice.java

@@ -0,0 +1,106 @@
+package com.bizmatics.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.time.LocalDate;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionDevice implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检设备id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 巡检设备名称
+     */
+    private String inspectionDeviceName;
+
+    /**
+     * 所属站点id
+     */
+    private Integer siteId;
+
+    /**
+     * 设备类型id
+     */
+    private Integer deviceTypeId;
+
+    /**
+     * 厂家id
+     */
+    private Integer manufacturerId;
+
+    /**
+     * 巡检周期
+     */
+    private Integer inspectionPeriod;
+
+    /**
+     * 保养周期
+     */
+    private Integer maintenancePeriod;
+
+    /**
+     * 安装时间
+     */
+    private Date installDate;
+
+    /**
+     * 投运日期
+     */
+    private Date operationDate;
+
+    /**
+     * 二维码地址
+     */
+    private String qrCodeAddress;
+
+    /**
+     * 设备图片地址
+     */
+    private String devicePictureAddress;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 启用状态(0 未启用,1 启用)
+     */
+    private Integer status;
+
+
+}

+ 73 - 0
fiveep-model/src/main/java/com/bizmatics/model/PatrolManufacturer.java

@@ -0,0 +1,73 @@
+package com.bizmatics.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolManufacturer implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 厂家id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 厂家名称
+     */
+    private String manufacturerName;
+
+    /**
+     * 设备型号
+     */
+    private String deviceModel;
+
+    /**
+     * 厂家联系人
+     */
+    private String manufacturerContact;
+
+    /**
+     * 厂家联系方式
+     */
+    private String manufacturerPhone;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 启用状态(0 未启用,1 启用)
+     */
+    private Integer status;
+
+
+}

+ 130 - 0
fiveep-model/src/main/java/com/bizmatics/model/vo/PatrolInspectionDeviceVo.java

@@ -0,0 +1,130 @@
+package com.bizmatics.model.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class PatrolInspectionDeviceVo implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 巡检设备id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 巡检设备名称
+     */
+    private String inspectionDeviceName;
+
+    /**
+     * 所属站点id
+     */
+    private Integer siteId;
+
+    /**
+     * 设备类型id
+     */
+    private Integer deviceTypeId;
+
+    /**
+     * 厂家id
+     */
+    private Integer manufacturerId;
+
+    /**
+     * 巡检周期
+     */
+    private Integer inspectionPeriod;
+
+    /**
+     * 保养周期
+     */
+    private Integer maintenancePeriod;
+
+    /**
+     * 安装时间
+     */
+    private Date installDate;
+
+    /**
+     * 投运日期
+     */
+    private Date operationDate;
+
+    /**
+     * 二维码地址
+     */
+    private String qrCodeAddress;
+
+    /**
+     * 设备图片地址
+     */
+    private String devicePictureAddress;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 创建人
+     */
+    private String creator;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 启用状态(0 未启用,1 启用)
+     */
+    private Integer status;
+
+    /**
+     *设备类型名称
+     */
+    private String deviceTypeName;
+
+    /**
+     *厂家名称
+     */
+    private String manufacturerName;
+
+    /**
+     *设备型号
+     */
+    private String deviceModel;
+
+    /**
+     *厂家联系人
+     */
+    private String manufacturerContact;
+
+    /**
+     * 厂家联系方式
+     */
+    private String manufacturerPhone;
+
+
+}

+ 24 - 0
fiveep-persistence/src/main/java/com/bizmatics/persistence/mapper/PatrolInspectionDeviceMapper.java

@@ -0,0 +1,24 @@
+package com.bizmatics.persistence.mapper;
+
+import com.bizmatics.model.PatrolInspectionDevice;
+import com.bizmatics.common.mvc.base.CrudMapper;
+import com.bizmatics.model.vo.PatrolDeviceListVO;
+import com.bizmatics.model.vo.PatrolInspectionDeviceVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+public interface PatrolInspectionDeviceMapper extends CrudMapper<PatrolInspectionDevice> {
+
+    List<PatrolInspectionDeviceVo> patrolInspectionDeviceList(@Param("inspectionDeviceName") String inspectionDeviceName,
+                                                              @Param("siteId") Integer siteId,
+                                                              @Param("id") Integer id);
+}

+ 16 - 0
fiveep-persistence/src/main/java/com/bizmatics/persistence/mapper/PatrolManufacturerMapper.java

@@ -0,0 +1,16 @@
+package com.bizmatics.persistence.mapper;
+
+import com.bizmatics.model.PatrolManufacturer;
+import com.bizmatics.common.mvc.base.CrudMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+public interface PatrolManufacturerMapper extends CrudMapper<PatrolManufacturer> {
+
+}

+ 51 - 0
fiveep-persistence/src/main/resources/mapper/mysql/PatrolInspectionDeviceMapper.xml

@@ -0,0 +1,51 @@
+<?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.bizmatics.persistence.mapper.PatrolInspectionDeviceMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.bizmatics.model.PatrolInspectionDevice">
+        <id column="id" property="id" />
+        <result column="inspection_device_name" property="inspectionDeviceName" />
+        <result column="site_id" property="siteId" />
+        <result column="device_type_id" property="deviceTypeId" />
+        <result column="manufacturer_id" property="manufacturerId" />
+        <result column="inspection_period" property="inspectionPeriod" />
+        <result column="maintenance_period" property="maintenancePeriod" />
+        <result column="install_date" property="installDate" />
+        <result column="operation_date" property="operationDate" />
+        <result column="qr_code_address" property="qrCodeAddress" />
+        <result column="device_picture_address" property="devicePictureAddress" />
+        <result column="remark" property="remark" />
+        <result column="creator" property="creator" />
+        <result column="create_time" property="createTime" />
+        <result column="status" property="status" />
+    </resultMap>
+
+    <select id="patrolInspectionDeviceList" resultType="com.bizmatics.model.vo.PatrolInspectionDeviceVo">
+        SELECT
+        a.*,
+        b.device_type_name,
+        c.manufacturer_name,
+        c.device_model,
+        c.manufacturer_contact,
+        c.manufacturer_phone
+        FROM
+        patrol_inspection_device AS a
+        LEFT JOIN patrol_device_type AS b ON a.device_type_id = b.id
+        LEFT JOIN patrol_manufacturer AS c ON a.manufacturer_id = c.id
+        <where>
+            a.status =1
+            <if test="inspectionDeviceName != null and inspectionDeviceName !=''">
+                and a.inspection_device_name LIKE CONCAT(CONCAT('%', #{inspectionDeviceName}), '%')
+            </if>
+            <if test="siteId != null and siteId !=0">
+                AND a.site_id = #{siteId}
+            </if>
+            <if test="id != null and id !=0">
+                and a.id = #{id}
+            </if>
+        </where>
+        order by a.id desc
+    </select>
+
+</mapper>

+ 18 - 0
fiveep-persistence/src/main/resources/mapper/mysql/PatrolManufacturerMapper.xml

@@ -0,0 +1,18 @@
+<?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.bizmatics.persistence.mapper.PatrolManufacturerMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.bizmatics.model.PatrolManufacturer">
+        <id column="id" property="id" />
+        <result column="manufacturer_name" property="manufacturerName" />
+        <result column="device_model" property="deviceModel" />
+        <result column="manufacturer_contact" property="manufacturerContact" />
+        <result column="manufacturer_phone" property="manufacturerPhone" />
+        <result column="remark" property="remark" />
+        <result column="creator" property="creator" />
+        <result column="create_time" property="createTime" />
+        <result column="status" property="status" />
+    </resultMap>
+
+</mapper>

+ 27 - 0
fiveep-service/src/main/java/com/bizmatics/service/PatrolInspectionDeviceService.java

@@ -0,0 +1,27 @@
+package com.bizmatics.service;
+
+import com.bizmatics.model.PatrolInspectionDevice;
+import com.bizmatics.common.mvc.base.CrudService;
+import com.bizmatics.model.vo.PatrolInspectionDeviceVo;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+public interface PatrolInspectionDeviceService extends CrudService<PatrolInspectionDevice> {
+
+    void patrolInspectionDeviceAdd(String inspectionDeviceName, Integer siteId, Integer deviceTypeId);
+
+    void patrolInspectionDeviceUpdate(PatrolInspectionDevice patrolInspectionDevice);
+
+    void patrolInspectionDeviceDel(Integer id);
+
+    List<PatrolInspectionDeviceVo> patrolInspectionDeviceList(String inspectionDeviceName, Integer siteId, Integer id);
+
+}

+ 16 - 0
fiveep-service/src/main/java/com/bizmatics/service/PatrolManufacturerService.java

@@ -0,0 +1,16 @@
+package com.bizmatics.service;
+
+import com.bizmatics.model.PatrolManufacturer;
+import com.bizmatics.common.mvc.base.CrudService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+public interface PatrolManufacturerService extends CrudService<PatrolManufacturer> {
+
+}

+ 60 - 0
fiveep-service/src/main/java/com/bizmatics/service/impl/PatrolInspectionDeviceServiceImpl.java

@@ -0,0 +1,60 @@
+package com.bizmatics.service.impl;
+
+import com.bizmatics.model.PatrolInspectionDevice;
+import com.bizmatics.model.system.SysUser;
+import com.bizmatics.model.vo.PatrolInspectionDeviceVo;
+import com.bizmatics.persistence.mapper.PatrolInspectionDeviceMapper;
+import com.bizmatics.service.PatrolInspectionDeviceService;
+import com.bizmatics.common.mvc.base.AbstractCrudService;
+import com.bizmatics.service.util.SecurityUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+@Service
+public class PatrolInspectionDeviceServiceImpl extends AbstractCrudService<PatrolInspectionDeviceMapper, PatrolInspectionDevice> implements PatrolInspectionDeviceService {
+
+    @Override
+    public void patrolInspectionDeviceAdd(String inspectionDeviceName,Integer siteId,Integer deviceTypeId){
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        PatrolInspectionDevice patrolInspectionDevice = new PatrolInspectionDevice();
+        patrolInspectionDevice.setInspectionDeviceName(inspectionDeviceName);
+        patrolInspectionDevice.setSiteId(siteId);
+        patrolInspectionDevice.setDeviceTypeId(deviceTypeId);
+        patrolInspectionDevice.setCreator(user.getUserName());
+        patrolInspectionDevice.setCreateTime(new Date());
+        patrolInspectionDevice.setStatus(1);
+        patrolInspectionDevice.setQrCodeAddress(UUID.randomUUID().toString());
+        this.save(patrolInspectionDevice);
+    }
+
+    @Override
+    public void patrolInspectionDeviceUpdate(PatrolInspectionDevice patrolInspectionDevice){
+        this.updateById(patrolInspectionDevice);
+    }
+
+    @Override
+    public void patrolInspectionDeviceDel(Integer id){
+        PatrolInspectionDevice patrolInspectionDevice = new PatrolInspectionDevice();
+        patrolInspectionDevice.setId(id);
+        patrolInspectionDevice.setStatus(0);
+        this.updateById(patrolInspectionDevice);
+    }
+
+    @Override
+    public List<PatrolInspectionDeviceVo> patrolInspectionDeviceList(String inspectionDeviceName,Integer siteId,Integer id){
+        List<PatrolInspectionDeviceVo> patrolInspectionDeviceList = baseMapper.patrolInspectionDeviceList(inspectionDeviceName,siteId,id);
+        return patrolInspectionDeviceList;
+    }
+
+}

+ 20 - 0
fiveep-service/src/main/java/com/bizmatics/service/impl/PatrolManufacturerServiceImpl.java

@@ -0,0 +1,20 @@
+package com.bizmatics.service.impl;
+
+import com.bizmatics.model.PatrolManufacturer;
+import com.bizmatics.persistence.mapper.PatrolManufacturerMapper;
+import com.bizmatics.service.PatrolManufacturerService;
+import com.bizmatics.common.mvc.base.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author ya
+ * @since 2021-10-15
+ */
+@Service
+public class PatrolManufacturerServiceImpl extends AbstractCrudService<PatrolManufacturerMapper, PatrolManufacturer> implements PatrolManufacturerService {
+
+}