xuxiaofei пре 3 година
родитељ
комит
ca8c51dc27

+ 2 - 0
zd-model/src/main/java/com/zd/model/constant/MqttConstants.java

@@ -77,4 +77,6 @@ public interface MqttConstants {
 
     // 柜锁操作成功topic  lab/cabinetLock/{subId}/{lockId}
     String TOPIC_CABINET_LOCK = "lab/cabinetLock/";
+
+    String TOPIC_FIRE_DEVICE = "lab/fireDevice/";
 }

+ 6 - 0
zd-model/src/main/java/com/zd/model/domain/per/PerPrefix.java

@@ -758,4 +758,10 @@ public class PerPrefix {
 
     /*****************************智能门锁******************************/
     public static final String SMARTLOCK_OPENDOORAPPLY = "smartlock:openDoorApply:";
+
+
+    /**
+     * 实验室项目:灭火设备
+     */
+    public static final String LABORATORY_FIREDEVICE = "laboratory:firedevice:";
 }

+ 111 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/labFireDeviceController.java

@@ -0,0 +1,111 @@
+package com.zd.laboratory.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.zd.common.core.annotation.Log;
+import com.zd.common.core.annotation.PreAuthorize;
+import com.zd.common.core.exception.ServiceException;
+import com.zd.common.core.log.BusinessType;
+import com.zd.common.core.web.controller.BaseController;
+import com.zd.laboratory.domain.LabFireDevice;
+import com.zd.laboratory.domain.LabMold;
+import com.zd.laboratory.domain.vo.LabFireDeviceVO;
+import com.zd.laboratory.service.ILabExitLineService;
+import com.zd.laboratory.service.ILabFireDeviceService;
+import com.zd.laboratory.utils.FireLaborUtil;
+import com.zd.model.domain.AjaxResult;
+import com.zd.model.domain.ResultData;
+import com.zd.model.domain.per.PerFun;
+import com.zd.model.domain.per.PerPrefix;
+import com.zd.model.page.TableDataInfo;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 灭火装置
+ *
+ * @Author: xxf
+ * @Date: 2022/11/18/16:29
+ * @Description:
+ */
+@RestController
+@RequestMapping("/firedevice")
+public class labFireDeviceController extends BaseController {
+
+    @Autowired
+    private ILabFireDeviceService labFireDeviceService;
+
+    /**
+     * 获取主机状态
+     *
+     * @return
+     */
+    @GetMapping(value = "/status")
+    public AjaxResult getStatus() {
+        //根据主机地址-位获取主机状态指令
+        String activeCode = FireLaborUtil.getFireActiveOrder(2);
+        //根据状态指令获取主机状态
+        JSONObject jsonObject = FireLaborUtil.getFireStatus("0");
+        System.out.println(jsonObject.toJSONString());
+        return AjaxResult.success();
+    }
+
+    /**
+     * 查询实验室灭火设备列表
+     */
+    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_FIREDEVICE + PerFun.LIST)
+    @GetMapping("/list")
+    @ApiOperation(value = "查询实验室灭火设备列表", notes = "权限字符:" + PerPrefix.LABORATORY_FIREDEVICE + PerFun.LIST)
+    public TableDataInfo<LabFireDeviceVO> list(LabFireDeviceVO labFireDeviceVO) {
+        startPage();
+        List<LabFireDeviceVO> list = labFireDeviceService.selectLabFireDeviceList(labFireDeviceVO);
+        return getDataTable(list);
+    }
+
+
+    /**
+     * 获取实验室灭火设备详细信息
+     */
+    @ApiOperation(value = "获取实验室灭火设备详细信息", notes = "权限字符:" + PerPrefix.LABORATORY_FIREDEVICE + PerFun.QUERY)
+    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_FIREDEVICE + PerFun.QUERY)
+    @GetMapping(value = "/{id}")
+    public ResultData<LabFireDeviceVO> getInfo(@PathVariable("id") Long id) {
+        return ResultData.success(labFireDeviceService.selectLabFireDeviceById(id));
+    }
+
+    /**
+     * 新增实验室灭火设备
+     */
+    @ApiOperation(value = "新增实验室灭火设备", notes = "权限字符:" + PerPrefix.LABORATORY_FIREDEVICE + PerFun.ADD)
+    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_FIREDEVICE + PerFun.ADD)
+    @Log(title = "灭火设备", businessType = BusinessType.INSERT)
+    @PostMapping
+    public ResultData add(@RequestBody LabFireDevice labFireDevice) {
+        return ResultData.result(labFireDeviceService.insertLabFireDevice(labFireDevice));
+    }
+
+    /**
+     * 修改实验室灭火设备
+     */
+    @ApiOperation(value = "修改实验室灭火设备", notes = "权限字符:" + PerPrefix.LABORATORY_FIREDEVICE + PerFun.EDIT)
+    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_FIREDEVICE + PerFun.EDIT)
+    @Log(title = "灭火设备", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public ResultData edit(@RequestBody LabFireDevice labFireDevice) {
+        return ResultData.result(labFireDeviceService.updateLabFireDevice(labFireDevice));
+    }
+
+    /**
+     * 删除实验室灭火设备
+     */
+    @ApiOperation(value = "删除实验室灭火设备", notes = "权限字符:" + PerPrefix.LABORATORY_CLASSTYPE + PerFun.REMOVE)
+    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_CLASSTYPE + PerFun.REMOVE)
+    @Log(title = "灭火设备", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public ResultData remove(@PathVariable Long[] ids) {
+        return ResultData.result(labFireDeviceService.deleteLabFireDeviceByIds(ids));
+    }
+}

+ 194 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/LabFireDevice.java

@@ -0,0 +1,194 @@
+package com.zd.laboratory.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.zd.laboratory.interfaces.HazardTypeInterface;
+import com.zd.model.annotation.Excel;
+import com.zd.model.entity.BaseEntity;
+import com.zd.model.enums.HazardTypeEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import javax.validation.constraints.NotBlank;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 灭火设备 lab_fire_device
+ *
+ * @author  xxf
+ * @date 2022-11-24
+ */
+@ApiModel("灭火设备表")
+public class LabFireDevice extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @ApiModelProperty(value = "${comment}")
+    private Long id;
+
+    /**
+     * 设备名称
+     */
+    @ApiModelProperty("设备名称")
+    @Excel(name = "设备名称")
+    private String deviceName;
+
+    /**
+     * 设备编号
+     */
+    @ApiModelProperty("设备编号")
+    @Excel(name = "设备编号")
+    private String deviceCode;
+
+    /**
+     * 设备地址
+     */
+    @ApiModelProperty("设备地址")
+    @Excel(name = "设备地址")
+    private String deviceUrl;
+
+    /**
+     * 倒计时时间
+     */
+    @ApiModelProperty("倒计时时间(秒)")
+    @Excel(name = "倒计时时间(秒)")
+    private Integer deviceCountDown;
+
+    /**
+     * 设备状态 1离线 2在线  3异常
+     */
+    @ApiModelProperty("设备状态")
+    @Excel(name = "设备状态")
+    private Integer deviceStatus;
+
+    @ApiModelProperty("用户id")
+    private Long userId;
+
+    @ApiModelProperty("创建人")
+    private String createBy;
+
+    @ApiModelProperty("创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    @ApiModelProperty("部门名称")
+    private String deptName;
+
+    @ApiModelProperty("部门id")
+    private Long deptId;
+
+    /**
+     * 实验室id
+     */
+    @ApiModelProperty("实验室id")
+    private Long subjectId;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getDeviceName() {
+        return deviceName;
+    }
+
+    public void setDeviceName(String deviceName) {
+        this.deviceName = deviceName;
+    }
+
+    public String getDeviceCode() {
+        return deviceCode;
+    }
+
+    public void setDeviceCode(String deviceCode) {
+        this.deviceCode = deviceCode;
+    }
+
+    public String getDeviceUrl() {
+        return deviceUrl;
+    }
+
+    public void setDeviceUrl(String deviceUrl) {
+        this.deviceUrl = deviceUrl;
+    }
+
+    public Integer getDeviceCountDown() {
+        return deviceCountDown;
+    }
+
+    public void setDeviceCountDown(Integer deviceCountDown) {
+        this.deviceCountDown = deviceCountDown;
+    }
+
+    public Integer getDeviceStatus() {
+        return deviceStatus;
+    }
+
+    public void setDeviceStatus(Integer deviceStatus) {
+        this.deviceStatus = deviceStatus;
+    }
+
+    public Long getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Long subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    @Override
+    public Long getUserId() {
+        return userId;
+    }
+
+    @Override
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    @Override
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    @Override
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
+    }
+
+    @Override
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    @Override
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    @Override
+    public String getDeptName() {
+        return deptName;
+    }
+
+    @Override
+    public void setDeptName(String deptName) {
+        this.deptName = deptName;
+    }
+
+    @Override
+    public Long getDeptId() {
+        return deptId;
+    }
+
+    @Override
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
+    }
+}

+ 144 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/LabFireDeviceLog.java

@@ -0,0 +1,144 @@
+package com.zd.laboratory.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zd.model.annotation.Excel;
+import com.zd.model.entity.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+/**
+ * 灭火设备日志 lab_fire_device_log
+ *
+ * @author  xxf
+ * @date 2022-11-24
+ */
+@ApiModel("灭火设备日志表")
+public class LabFireDeviceLog extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @ApiModelProperty(value = "${comment}")
+    private Long id;
+
+    /**
+     * 灭火装置表id
+     */
+    @ApiModelProperty("灭火装置表id")
+    @Excel(name = "灭火装置表id")
+    private Long fireDeviceId;
+
+    /**
+     * 灭火类型 1自动 2手动
+     */
+    @ApiModelProperty("灭火类型")
+    private Integer runType;
+
+    /**
+     * 执行结果
+     */
+    @ApiModelProperty("执行结果")
+    @Excel(name = "执行结果")
+    private String runResult;
+
+    @ApiModelProperty("用户id")
+    private Long userId;
+
+    @ApiModelProperty("创建人")
+    private String createBy;
+
+    @ApiModelProperty("创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    @ApiModelProperty("部门名称")
+    private String deptName;
+
+    @ApiModelProperty("部门id")
+    private Long deptId;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getFireDeviceId() {
+        return fireDeviceId;
+    }
+
+    public void setFireDeviceId(Long fireDeviceId) {
+        this.fireDeviceId = fireDeviceId;
+    }
+
+    public Integer getRunType() {
+        return runType;
+    }
+
+    public void setRunType(Integer runType) {
+        this.runType = runType;
+    }
+
+    public String getRunResult() {
+        return runResult;
+    }
+
+    public void setRunResult(String runResult) {
+        this.runResult = runResult;
+    }
+
+    @Override
+    public Long getUserId() {
+        return userId;
+    }
+
+    @Override
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    @Override
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    @Override
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
+    }
+
+    @Override
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    @Override
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    @Override
+    public String getDeptName() {
+        return deptName;
+    }
+
+    @Override
+    public void setDeptName(String deptName) {
+        this.deptName = deptName;
+    }
+
+    @Override
+    public Long getDeptId() {
+        return deptId;
+    }
+
+    @Override
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
+    }
+}

+ 63 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/vo/LabFireDeviceVO.java

@@ -0,0 +1,63 @@
+package com.zd.laboratory.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zd.laboratory.domain.LabFireDevice;
+import com.zd.model.annotation.Excel;
+import com.zd.model.entity.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+/**
+ * 灭火设备 lab_fire_device
+ *
+ * @author  xxf
+ * @date 2022-11-24
+ */
+@ApiModel("灭火设备表")
+public class LabFireDeviceVO extends LabFireDevice {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 楼栋
+     */
+    @ApiModelProperty(value = "楼栋")
+    private String buildName;
+
+    /**
+     * 实验室名称
+     */
+    @ApiModelProperty(value = "实验室名称")
+    private String subjectName;
+
+    /**
+     * 房间号
+     */
+    @ApiModelProperty(value = "房间号")
+    private String room;
+
+    public String getBuildName() {
+        return buildName;
+    }
+
+    public void setBuildName(String buildName) {
+        this.buildName = buildName;
+    }
+
+    public String getSubjectName() {
+        return subjectName;
+    }
+
+    public void setSubjectName(String subjectName) {
+        this.subjectName = subjectName;
+    }
+
+    public String getRoom() {
+        return room;
+    }
+
+    public void setRoom(String room) {
+        this.room = room;
+    }
+}

+ 65 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabFireDeviceLogMapper.java

@@ -0,0 +1,65 @@
+package com.zd.laboratory.mapper;
+
+import com.zd.laboratory.domain.LabFireDevice;
+import com.zd.laboratory.domain.LabFireDeviceLog;
+import com.zd.laboratory.domain.vo.LabFireDeviceVO;
+
+import java.util.List;
+
+
+/**
+ * 灭火设备日志 Mapper接口
+ *
+ * @author xxf
+ * @date 2022-11-24
+ */
+public interface LabFireDeviceLogMapper
+{
+    /**
+     * 查询实验室灭火设备日志
+     *
+     * @param labFireDeviceLog 灭火设备日志
+     * @return 灭火设备日志
+     */
+    public List<LabFireDeviceLog> selectLabFireDeviceLogList(LabFireDeviceLog labFireDeviceLog);
+
+
+    /****
+     *根据id查询
+     * @param id
+     * @return
+     */
+    public LabFireDeviceLog selectLabFireDeviceLogById(Long id);
+
+    /**
+     * 新增灭火设备日志
+     *
+     * @param labFireDeviceLog 灭火设备日志
+     * @return 结果
+     */
+    public int insertLabFireDeviceLog(LabFireDeviceLog labFireDeviceLog);
+
+    /**
+     * 修改灭火设备日志
+     *
+     * @param labFireDeviceLog 灭火设备日志
+     * @return 结果
+     */
+    public int updateLabFireDeviceLog(LabFireDeviceLog labFireDeviceLog);
+
+    /**
+     * 删除灭火设备日志
+     *
+     * @param id 灭火设备日志主键
+     * @return 结果
+     */
+    public int deleteLabFireDeviceLogById(Long id);
+
+    /**
+     * 批量删除灭火设备日志
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteLabFireDeviceLogByIds(Long[] ids);
+}

+ 65 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabFireDeviceMapper.java

@@ -0,0 +1,65 @@
+package com.zd.laboratory.mapper;
+
+import com.zd.laboratory.domain.LabFireDevice;
+import com.zd.laboratory.domain.LabMold;
+import com.zd.laboratory.domain.vo.LabFireDeviceVO;
+
+import java.util.List;
+
+
+/**
+ * 灭火设备 Mapper接口
+ *
+ * @author xxf
+ * @date 2022-11-24
+ */
+public interface LabFireDeviceMapper
+{
+    /**
+     * 查询实验室灭火设备
+     *
+     * @param labFireDeviceVO 灭火设备
+     * @return 灭火设备
+     */
+    public List<LabFireDeviceVO> selectLabFireDeviceList(LabFireDeviceVO labFireDeviceVO);
+
+
+    /****
+     *根据id查询
+     * @param id
+     * @return
+     */
+    public LabFireDeviceVO selectLabFireDeviceById(Long id);
+
+    /**
+     * 新增灭火设备
+     *
+     * @param labFireDevice 灭火设备
+     * @return 结果
+     */
+    public int insertLabFireDevice(LabFireDevice labFireDevice);
+
+    /**
+     * 修改灭火设备
+     *
+     * @param labFireDevice 灭火设备
+     * @return 结果
+     */
+    public int updateLabFireDevice(LabFireDevice labFireDevice);
+
+    /**
+     * 删除灭火设备
+     *
+     * @param id 灭火设备主键
+     * @return 结果
+     */
+    public int deleteLabFireDeviceById(Long id);
+
+    /**
+     * 批量删除灭火设备
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteLabFireDeviceByIds(Long[] ids);
+}

+ 63 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/ILabFireDeviceService.java

@@ -0,0 +1,63 @@
+package com.zd.laboratory.service;
+
+import com.zd.laboratory.domain.LabFireDevice;
+import com.zd.laboratory.domain.vo.LabFireDeviceVO;
+
+import java.util.List;
+
+/**
+ * 灭火设备Service接口
+ *
+ * @author xxf
+ * @date 2022-11-24
+ */
+public interface ILabFireDeviceService
+{
+    /**
+     * 查询实验室灭火设备
+     *
+     * @param labFireDeviceVO 灭火设备
+     * @return 灭火设备
+     */
+    public List<LabFireDeviceVO> selectLabFireDeviceList(LabFireDeviceVO labFireDeviceVO);
+
+
+    /****
+     *根据id查询
+     * @param id
+     * @return
+     */
+    public LabFireDeviceVO selectLabFireDeviceById(Long id);
+
+    /**
+     * 新增灭火设备
+     *
+     * @param labFireDevice 灭火设备
+     * @return 结果
+     */
+    public int insertLabFireDevice(LabFireDevice labFireDevice);
+
+    /**
+     * 修改灭火设备
+     *
+     * @param labFireDevice 灭火设备
+     * @return 结果
+     */
+    public int updateLabFireDevice(LabFireDevice labFireDevice);
+
+    /**
+     * 删除灭火设备
+     *
+     * @param id 灭火设备主键
+     * @return 结果
+     */
+    public int deleteLabFireDeviceById(Long id);
+
+    /**
+     * 批量删除灭火设备
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteLabFireDeviceByIds(Long[] ids);
+}

+ 105 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabFireDeviceServiceImpl.java

@@ -0,0 +1,105 @@
+package com.zd.laboratory.service.impl;
+
+
+import com.zd.common.core.exception.ServiceException;
+import com.zd.common.core.security.TokenService;
+import com.zd.common.core.utils.SaveUtil;
+import com.zd.laboratory.domain.LabFireDevice;
+import com.zd.laboratory.domain.vo.LabFireDeviceVO;
+import com.zd.laboratory.mapper.LabFireDeviceMapper;
+import com.zd.laboratory.service.ILabFireDeviceService;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 灭火设备Service业务层处理
+ *
+ * @author xxf
+ * @date 2022-11-24
+ */
+@Service
+public class LabFireDeviceServiceImpl implements ILabFireDeviceService {
+
+    @Autowired
+    private LabFireDeviceMapper labFireDeviceMapper;
+
+    @Autowired
+    private TokenService tokenService;
+
+    /**
+     * 查询实验室灭火设备
+     *
+     * @param labFireDeviceVO 灭火设备
+     * @return 灭火设备
+     */
+    @Override
+    public List<LabFireDeviceVO> selectLabFireDeviceList(LabFireDeviceVO labFireDeviceVO) {
+        return labFireDeviceMapper.selectLabFireDeviceList(labFireDeviceVO);
+    }
+
+    /****
+     *根据id查询
+     * @param id
+     * @return
+     */
+    @Override
+    public LabFireDeviceVO selectLabFireDeviceById(Long id) {
+        return labFireDeviceMapper.selectLabFireDeviceById(id);
+    }
+
+    /**
+     * 新增灭火设备
+     *
+     * @param labFireDevice 灭火设备
+     * @return 结果
+     */
+    @Override
+    public int insertLabFireDevice(LabFireDevice labFireDevice) {
+        LabFireDeviceVO vo = new LabFireDeviceVO();
+        vo.setDeviceCode(labFireDevice.getDeviceCode());
+        //BeanUtils.copyProperties(labFireDevice, vo);
+        List<LabFireDeviceVO> list = labFireDeviceMapper.selectLabFireDeviceList(vo);
+        if (list.size() > 0) {
+            throw new ServiceException("该灭火设备编号已经存在!");
+        }
+        //设置其他公共字段
+        SaveUtil.setCommonAttr(labFireDevice);
+        return labFireDeviceMapper.insertLabFireDevice(labFireDevice);
+    }
+
+    /**
+     * 修改灭火设备
+     *
+     * @param labFireDevice 灭火设备
+     * @return 结果
+     */
+    @Override
+    public int updateLabFireDevice(LabFireDevice labFireDevice) {
+        return labFireDeviceMapper.updateLabFireDevice(labFireDevice);
+    }
+
+    /**
+     * 删除灭火设备
+     *
+     * @param id 灭火设备主键
+     * @return 结果
+     */
+    @Override
+    public int deleteLabFireDeviceById(Long id) {
+        return labFireDeviceMapper.deleteLabFireDeviceById(id);
+    }
+
+    /**
+     * 批量删除灭火设备
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    @Override
+    public int deleteLabFireDeviceByIds(Long[] ids) {
+        return labFireDeviceMapper.deleteLabFireDeviceByIds(ids);
+    }
+}

+ 49 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/utils/FireDeviceStatusTask.java

@@ -0,0 +1,49 @@
+package com.zd.laboratory.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.zd.laboratory.domain.vo.LabFireDeviceVO;
+import com.zd.laboratory.mqtt.entiy.MessageBody;
+import com.zd.laboratory.mqtt.enums.SendMode;
+import com.zd.laboratory.mqtt.service.impl.CommonSend;
+import com.zd.laboratory.service.ILabFireDeviceService;
+import com.zd.model.constant.MqttConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Author: xxf 定时更新灭火器状态
+ * @Date: 2022/11/25/14:58
+ * @Description:
+ */
+@Component
+public class FireDeviceStatusTask {
+
+    private static final Logger logger = LoggerFactory.getLogger(FireDeviceStatusTask.class);
+
+    @Autowired
+    private ILabFireDeviceService labFireDeviceService;
+    @Autowired
+    private CommonSend commonSend;
+
+
+    /**
+     *
+     * 定时更新灭火装置状态
+     */
+    public void getFireDeviceStatus(){
+        LabFireDeviceVO fdvo = new LabFireDeviceVO();
+        List<LabFireDeviceVO> list = labFireDeviceService.selectLabFireDeviceList(fdvo);
+        for (LabFireDeviceVO vo: list) {
+            //根据主机地址-位获取主机状态指令
+            String activeCode = FireLaborUtil.getFireActiveOrder(2);
+            //根据状态指令获取主机状态
+            JSONObject jsonObject = FireLaborUtil.getFireStatus("0");
+            //向mqtt发送状态信息
+            commonSend.send(MqttConstants.TOPIC_FIRE_DEVICE+vo.getSubjectId(),jsonObject.toJSONString());
+        }
+    }
+}

+ 107 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabFireDeviceLogMapper.xml

@@ -0,0 +1,107 @@
+<?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.zd.laboratory.mapper.LabFireDeviceLogMapper">
+
+    <resultMap type="com.zd.laboratory.domain.LabFireDeviceLog" id="LabFireDeviceLogResult">
+        <result property="id" column="id"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="userId" column="user_id"/>
+        <result property="createBy" column="create_by"/>
+
+        <result property="fireDeviceId" column="fire_device_id"/>
+        <result property="runType" column="run_type"/>
+        <result property="runResult" column="run_result"/>
+    </resultMap>
+
+    <sql id="selectFireDeviceLog">
+        select id,
+               fire_device_id,
+               run_type,
+               run_result,
+               user_id,
+               create_by,
+               dept_id,
+               dept_name,
+               create_time
+        from lab_fire_device_log
+    </sql>
+
+    <select id="selectLabFireDeviceLogList" parameterType="com.zd.laboratory.domain.vo.LabFireDeviceVO"
+            resultMap="LabFireDeviceLogResult">
+        <include refid="selectFireDeviceLog"/>
+        <where>
+            <if test="fireDeviceId != null ">and fire_device_id = #{fireDeviceId}</if>
+            <if test="runType != null ">and run_type = #{runType}</if>
+            <if test="runResult != null ">and run_result =#{runResult}</if>
+            <if test="userId != null ">and user_id = #{userId}</if>
+            <if test="createBy != null ">and create_by = #{createBy}</if>
+            <if test="deptId != null ">and dept_id = #{deptId}</if>
+            <if test="deptName != null ">and dept_name = #{deptName}</if>
+            <if test="createTime != null ">and create_time = #{createTime}</if>
+            ${params.dataScope}
+        </where>
+        order by create_time desc
+    </select>
+
+    <select id="selectLabFireDeviceLogById" parameterType="Long" resultMap="LabFireDeviceLogResult">
+        <include refid="selectFireDeviceLog"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertLabFireDeviceLog" parameterType="com.zd.laboratory.domain.LabFireDeviceLog" useGeneratedKeys="true"
+            keyProperty="id">
+        insert into lab_fire_device_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="deptName != null">dept_name,</if>
+            <if test="deptId != null">dept_id,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="fireDeviceId != null">fire_device_id,</if>
+            <if test="runType != null">run_type,</if>
+            <if test="runResult != null">run_result,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="deptName != null">#{deptName},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="fireDeviceId != null">#{fireDeviceId},</if>
+            <if test="runType != null">#{runType},</if>
+            <if test="runResult != null">#{runResult},</if>
+        </trim>
+    </insert>
+
+    <update id="updateLabFireDeviceLog" parameterType="com.zd.laboratory.domain.LabMold">
+        update lab_fire_device_log
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="deptName != null">dept_name = #{deptName},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="fireDeviceId != null">fire_device_id = #{fireDeviceId},</if>
+            <if test="runType != null">run_type = #{runType},</if>
+            <if test="runResult != null">run_result = #{runResult},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteLabFireDeviceLogById" parameterType="Long">
+        delete
+        from lab_fire_device_log
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteLabFireDeviceLogByIds" parameterType="String">
+        delete from lab_fire_device_log where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 129 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabFireDeviceMapper.xml

@@ -0,0 +1,129 @@
+<?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.zd.laboratory.mapper.LabFireDeviceMapper">
+
+    <resultMap type="com.zd.laboratory.domain.vo.LabFireDeviceVO" id="LabFireDeviceResult">
+        <result property="id" column="id"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="userId" column="user_id"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="deviceName" column="device_name"/>
+        <result property="deviceCode" column="device_code"/>
+        <result property="deviceUrl" column="device_url"/>
+        <result property="deviceCountDown" column="device_count_down"/>
+        <result property="deviceStatus" column="device_status"/>
+        <result property="subjectId" column="subject_id"/>
+    </resultMap>
+
+    <sql id="selectFireDeviceVo">
+        select fd.id,
+               fd.device_name,
+               fd.device_code,
+               fd.device_url,
+               fd.device_count_down,
+               fd.device_status,
+               fd.subject_id,
+               fd.dept_id,
+               fd.dept_name,
+               fd.user_id,
+               fd.create_by,
+               fd.create_time,
+               ls.name      subjectName,
+               lsl.room,
+               sd.dept_name buildName
+        from lab_fire_device fd
+                 LEFT JOIN lab_subject ls on fd.subject_id = ls.id
+                 LEFT JOIN lab_subject_layout lsl on lsl.floor_id = ls.layout_id and ls.id = fd.subject_id
+                 LEFT JOIN sys_dept sd on ls.build_id = sd.dept_id and ls.id = fd.subject_id
+    </sql>
+
+    <select id="selectLabFireDeviceList" parameterType="com.zd.laboratory.domain.vo.LabFireDeviceVO"
+            resultMap="LabFireDeviceResult">
+        <include refid="selectFireDeviceVo"/>
+        <where>
+            <if test="searchValue != null  and searchValue != ''">
+                and (fd.device_name like concat('%', #{searchValue}, '%') or
+                ls.`nick_name` like concat('%', #{searchValue}, '%') )
+            </if>
+            <if test="deviceName != null  and deviceName != ''">and fd.device_name like concat('%', #{deviceName}, '%')</if>
+            <if test="deviceCode != null and deviceCode != ''">and fd.device_code = #{deviceCode}</if>
+            <if test="deviceUrl != null and deviceUrl != ''">and fd.device_url = #{deviceUrl}</if>
+            <if test="deviceCountDown != null ">and fd.device_count_down =#{deviceCountDown}</if>
+            <if test="deviceStatus != null ">and fd.device_status = #{deviceStatus}</if>
+            ${params.dataScope}
+        </where>
+        order by fd.create_time desc
+    </select>
+
+    <select id="selectLabFireDeviceById" parameterType="Long" resultMap="LabFireDeviceResult">
+        <include refid="selectFireDeviceVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertLabFireDevice" parameterType="com.zd.laboratory.domain.LabFireDevice" useGeneratedKeys="true"
+            keyProperty="id">
+        insert into lab_fire_device
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="deptName != null">dept_name,</if>
+            <if test="deptId != null">dept_id,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="deviceName != null">device_name,</if>
+            <if test="deviceCode != null">device_code,</if>
+            <if test="deviceUrl != null">device_url,</if>
+            <if test="deviceCountDown != null">device_count_down,</if>
+            <if test="deviceStatus != null">device_status,</if>
+            <if test="subjectId != null">subject_id,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="deptName != null">#{deptName},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="deviceName != null">#{deviceName},</if>
+            <if test="deviceCode != null">#{deviceCode},</if>
+            <if test="deviceUrl != null">#{deviceUrl},</if>
+            <if test="deviceCountDown != null">#{deviceCountDown},</if>
+            <if test="deviceStatus != null">#{deviceStatus},</if>
+            <if test="subjectId != null">#{subjectId},</if>
+        </trim>
+    </insert>
+
+    <update id="updateLabFireDevice" parameterType="com.zd.laboratory.domain.LabMold">
+        update lab_fire_device
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="deptName != null">dept_name = #{deptName},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="deviceName != null">device_name = #{deviceName},</if>
+            <if test="deviceCode != null">device_code = #{deviceCode},</if>
+            <if test="deviceUrl != null">device_url = #{deviceUrl},</if>
+            <if test="deviceCountDown != null">device_count_down = #{deviceCountDown},</if>
+            <if test="deviceStatus != null">device_status = #{deviceStatus},</if>
+            <if test="subjectId != null">subject_id = #{subjectId},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteLabFireDeviceById" parameterType="Long">
+        delete
+        from lab_fire_device
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteLabFireDeviceByIds" parameterType="String">
+        delete from lab_fire_device where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>