whycxzp
2025-05-29 c7e295d1dfdfeb8b092e757b68b374912705ef15
算法识别告警更新
7个文件已修改
2个文件已添加
99 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/IdentifyAlarmController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/IdentifyAlarmHisController.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_fire_robot/Environment.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_fire_robot/EnvironmentThreshold.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_fire_robot/IdentifyAlarm.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_fire_robot/IdentifyAlarmHis.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_fire_robot/RobotAlarm.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_fire_robot/RobotStatus.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/IdentifyAlarmService.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/IdentifyAlarmController.java
New file
@@ -0,0 +1,24 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.service.IdentifyAlarmService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.InvocationTargetException;
@RestController
@RequestMapping("identifyAlarm")
@Api("算法识别报警")
public class IdentifyAlarmController {
    @Autowired
    private IdentifyAlarmService identifyAlarmService;
    @PostMapping("confirm")
    public Response confirm(@RequestParam int id) throws InvocationTargetException, IllegalAccessException {
        return identifyAlarmService.confirm(id);
    }
}
src/main/java/com/whyc/controller/IdentifyAlarmHisController.java
New file
@@ -0,0 +1,27 @@
package com.whyc.controller;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.pojo.db_fire_robot.IdentifyAlarmHis;
import com.whyc.service.IdentifyAlarmHisService;
import com.whyc.service.IdentifyAlarmService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.InvocationTargetException;
@RestController
@RequestMapping("identifyAlarmHis")
@Api("算法识别报警")
public class IdentifyAlarmHisController {
    @Autowired
    private IdentifyAlarmHisService service;
    @GetMapping("getPage")
    public Response<PageInfo<IdentifyAlarmHis>> getPage(@RequestParam int pageNum, @RequestParam int pageSize){
        return service.getPage(pageNum, pageSize);
    }
}
src/main/java/com/whyc/pojo/db_fire_robot/Environment.java
@@ -25,7 +25,7 @@
public class Environment {
    @TableId(value = "id",type = IdType.AUTO)
    private int id;
    private Long id;
    @ApiModelProperty(value = "温度")
    private float temperature;
    @ApiModelProperty(value = "湿度")
src/main/java/com/whyc/pojo/db_fire_robot/EnvironmentThreshold.java
@@ -25,7 +25,7 @@
public class EnvironmentThreshold {
    @TableId(value = "id",type = IdType.AUTO)
    private int id;
    private Long id;
    @ApiModelProperty(value = "温度")
    private float temperature;
    @ApiModelProperty(value = "湿度")
src/main/java/com/whyc/pojo/db_fire_robot/IdentifyAlarm.java
@@ -34,7 +34,7 @@
public class IdentifyAlarm {
    @TableId(value = "id",type = IdType.AUTO)
    private int id;
    private Long id;
    @ApiModelProperty(value = "采集时间")
    private Date  gatherTime;
    @ApiModelProperty(value = "位置")
src/main/java/com/whyc/pojo/db_fire_robot/IdentifyAlarmHis.java
@@ -34,7 +34,7 @@
public class IdentifyAlarmHis {
    @TableId(value = "id",type = IdType.AUTO)
    private int id;
    private Long id;
    @ApiModelProperty(value = "采集时间")
    private Date  gatherTime;
    @ApiModelProperty(value = "位置")
src/main/java/com/whyc/pojo/db_fire_robot/RobotAlarm.java
@@ -30,7 +30,7 @@
public class RobotAlarm {
    @TableId(value = "id",type = IdType.AUTO)
    private int id;
    private Long id;
    @ApiModelProperty(value = "推送时间")
    private Date pushTime;
    @ApiModelProperty(value = "单片机连接状态")
src/main/java/com/whyc/pojo/db_fire_robot/RobotStatus.java
@@ -25,7 +25,7 @@
public class RobotStatus {
    @TableId(value = "id",type = IdType.AUTO)
    private int id;
    private Long id;
    @ApiModelProperty(value = "当前巡检模式: 1-遥控、2-手动、3-自动 4 自动返回 5 指定点 6 温湿度表计")
    private int mode;
src/main/java/com/whyc/service/IdentifyAlarmService.java
@@ -1,11 +1,24 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.whyc.dto.Response;
import com.whyc.hik.Commom.CommonUtil;
import com.whyc.mapper.EnvironmentMapper;
import com.whyc.mapper.IdentifyAlarmMapper;
import com.whyc.pojo.db_fire_robot.IdentifyAlarm;
import com.whyc.pojo.db_fire_robot.IdentifyAlarmHis;
import com.whyc.util.ActionUtil;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import java.util.List;
@Service
public class IdentifyAlarmService {
@@ -13,7 +26,30 @@
    @Resource
    private IdentifyAlarmMapper mapper;
    @Autowired
    private IdentifyAlarmHisService hisService;
    public void add(IdentifyAlarm alarm) {
        mapper.insert(alarm);
    }
    public Response getList() {
        List<IdentifyAlarm> list = mapper.selectList((Wrapper<IdentifyAlarm>) ActionUtil.objeNull);
        return new Response<>().set(1, list);
    }
    @Transactional
    public Response confirm(int id) throws InvocationTargetException, IllegalAccessException {
        IdentifyAlarm alarm = mapper.selectById(id);
        //加入到告警历史表
        IdentifyAlarmHis his = new IdentifyAlarmHis();
        BeanUtils.copyProperties(his,alarm);
        his.setId(null);
        his.setConfirmTime(new Date());
        hisService.add(his);
        //删除告警记录
        mapper.deleteById(id);
        return new Response().setII(1,"确认完成");
    }
}