| | |
| | | } |
| | | |
| | | @ApiOperation("查询电池组历史时间告警") |
| | | @GetMapping("getHisAlatm") |
| | | public Response getHisAlatm(@RequestParam int binfId,@RequestParam String startTime,@RequestParam String endTime |
| | | @GetMapping("getHisAlarm") |
| | | public Response getHisAlarm(@RequestParam int binfId,@RequestParam String startTime,@RequestParam String endTime |
| | | , @RequestParam int pageNum, @RequestParam int pageSize) throws ParseException, InterruptedException { |
| | | Response res=hisService.getHisAlatm(binfId,startTime,endTime,pageNum,pageSize); |
| | | Response res=hisService.getHisAlarm(binfId,startTime,endTime,pageNum,pageSize); |
| | | return res; |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.service.PowerAlarmHistoryService; |
| | | import com.whyc.service.PowerAlarmService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.ParseException; |
| | | |
| | | @RestController |
| | | @Api(tags = "电源实时告警") |
| | | @RequestMapping("poweralarm") |
| | | public class PowerAlarmController { |
| | | |
| | | @Autowired |
| | | private PowerAlarmService service; |
| | | |
| | | @Autowired |
| | | private PowerAlarmHistoryService hisService; |
| | | |
| | | @ApiOperation("查询电源告警") |
| | | @GetMapping("getPowerAlarm") |
| | | public Response getPowerAlarm(@RequestParam(required = false) int almLevel, @RequestParam String startTime, @RequestParam String endTime |
| | | , @RequestParam int pageNum, @RequestParam int pageSize){ |
| | | Response res=service.getPowerAlarm(almLevel,startTime,endTime,pageNum,pageSize); |
| | | return res; |
| | | } |
| | | |
| | | @ApiOperation("确认告警") |
| | | @GetMapping("confirmAlarm") |
| | | public Response confirmAlarm(@RequestParam int num){ |
| | | Response res=service.confirmAlarm(num); |
| | | return res; |
| | | } |
| | | @ApiOperation("取消告警") |
| | | @GetMapping("cancleAlarm") |
| | | public Response cancleAlarm(@RequestParam int num){ |
| | | Response res=service.cancleAlarm(num); |
| | | return res; |
| | | } |
| | | |
| | | @ApiOperation("查询电源历史时间告警") |
| | | @GetMapping("getHisAlarm") |
| | | public Response getHisAlarm(@RequestParam int pinfId,@RequestParam String startTime,@RequestParam String endTime |
| | | , @RequestParam int pageNum, @RequestParam int pageSize) throws ParseException, InterruptedException { |
| | | Response res=hisService.getHisAlarm(pinfId,startTime,endTime,pageNum,pageSize); |
| | | return res; |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_alarm.BattAlarm; |
| | | import com.whyc.pojo.db_power_alarm.PowerAlarm; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface PowerAlarmMapper extends CustomMapper<PowerAlarm>{ |
| | | //查询电源告警 |
| | | List<PowerAlarm> getPowerAlarm(int almLevel, Date parse, Date parse1); |
| | | |
| | | //在用电源实时推送告警信息 |
| | | List<PowerAlarm> getResPowerAlm(int pinfId); |
| | | } |
| | |
| | | @TableField("alm_level") |
| | | @ApiModelProperty("告警等级[1-紧急 2-重大 -3-一般]") |
| | | private Integer almLevel; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("电源名称") |
| | | private String powerName; |
| | | } |
| | |
| | | private SubTablePageInfoUtil util; |
| | | |
| | | //查询电池组历史时间告警 |
| | | public Response getHisAlatm(int binfId, String startTime, String endTime,int pageNum,int pageSize)throws ParseException, InterruptedException { |
| | | public Response getHisAlarm(int binfId, String startTime, String endTime,int pageNum,int pageSize)throws ParseException, InterruptedException { |
| | | BattAlarmHistory his=new BattAlarmHistory(); |
| | | his.setBinfId(binfId); |
| | | PageInfo pageInfo=util.getPageInfoByMonthTable(pageNum,pageSize, ThreadLocalUtil.parse(startTime,1),ThreadLocalUtil.parse(endTime,1) |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class PowerAlarmHistoryService { |
| | | |
| | | //查询电源历史时间告警 |
| | | public Response getHisAlarm(int pinfId, String startTime, String endTime, int pageNum, int pageSize) { |
| | | return new Response().set(1); |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.PowerAlarmMapper; |
| | | import com.whyc.pojo.db_alarm.BattAlarm; |
| | | import com.whyc.pojo.db_power_alarm.PowerAlarm; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PowerAlarmService { |
| | | |
| | | @Autowired(required = false) |
| | | private PowerAlarmMapper mapper; |
| | | |
| | | /* |
| | | 在用电源实时推送告警信息 |
| | | **/ |
| | | public Response getResPowerAlm(int pinfId) { |
| | | List<PowerAlarm> list=mapper.getResPowerAlm(pinfId); |
| | | return new Response().setII(1,list!=null,list,"在用电源实时推送告警信息"); |
| | | } |
| | | //查询电源告警 |
| | | public Response getPowerAlarm(int almLevel, String startTime, String endTime ,int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<PowerAlarm> list=mapper.getPowerAlarm(almLevel, ThreadLocalUtil.parse(startTime,1),ThreadLocalUtil.parse(endTime,1)); |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,pageInfo,"查询电源告警"); |
| | | } |
| | | //确认告警 |
| | | public Response confirmAlarm(int num) { |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("num",num); |
| | | wrapper.set("alm_confirm",1); |
| | | int flag=mapper.update((PowerAlarm) ActionUtil.objeNull,wrapper); |
| | | return new Response().set(1,flag>0); |
| | | } |
| | | //取消告警 |
| | | public Response cancleAlarm(int num) { |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("num",num); |
| | | wrapper.set("alm_confirm",0); |
| | | int flag=mapper.update((PowerAlarm) ActionUtil.objeNull,wrapper); |
| | | return new Response().set(1,flag>0); |
| | | } |
| | | } |
| | |
| | | <mapper namespace="com.whyc.mapper.BattAlarmMapper"> |
| | | |
| | | <select id="getBattAlarm" resultType="com.whyc.pojo.db_alarm.BattAlarm"> |
| | | select batt_alarm.*,batt_inf.binf_name from db_alarm.batt_alarm,db_batt.batt_inf |
| | | select batt_alarm.*,batt_inf.binf_name from db_alarm.batt_alarm,db_batt.power_inf |
| | | <where> |
| | | batt_alarm.binf_id=batt_inf.binf_id |
| | | batt_alarm.binf_id=power_inf.binf_id |
| | | and batt_alarm.alm_start_time>=#{startTime} |
| | | and batt_alarm.alm_start_time<=#{endTime} |
| | | <if test="almLevel!=null"> |
| | | and batt_alarm.alm_level=#{almLevel} |
| | | </if> |
| | | order by batt_alarm.alm_start_time asc |
| | | order by batt_alarm.alm_start_time desc |
| | | </where> |
| | | </select> |
| | | <select id="getResBattAlm" resultType="com.whyc.pojo.db_alarm.BattAlarm"> |
| | | select batt_alarm.*,power_inf.binf_name from db_alarm.batt_alarm,db_batt.power_inf |
| | | <where> |
| | | batt_alarm.binf_id=power_inf.binf_id |
| | | and batt_alarm.binf_id>=#{binfId} |
| | | order by batt_alarm.alm_start_time asc |
| | | and batt_alarm.binf_id=#{binfId} |
| | | order by batt_alarm.alm_start_time desc |
| | | </where> |
| | | </select> |
| | | <select id="getAlm2" resultType="com.whyc.pojo.db_alarm.BattAlarm"> |
| | |
| | | from db_alarm.tb_battalarm_data |
| | | <where> |
| | | BattGroupId=#{battGroupId} |
| | | and alm_signal_id in(13) |
| | | and alm_severity=1 |
| | | and alm_type=1 |
| | | and alm_level=1 |
| | | </where> |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?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.whyc.mapper.PowerAlarmMapper"> |
| | | |
| | | <select id="getPowerAlarm" resultType="com.whyc.pojo.db_power_alarm.PowerAlarm"> |
| | | select power_alarm.*,batt_inf.power_name from db_power_alarm.power_alarm,db_batt.power_inf |
| | | <where> |
| | | power_alarm.power_id=power_inf.power_id |
| | | and power_alarm.alm_start_time>=#{startTime} |
| | | and power_alarm.alm_start_time<=#{endTime} |
| | | <if test="almLevel!=null"> |
| | | and power_alarm.alm_level=#{almLevel} |
| | | </if> |
| | | order by power_alarm.alm_start_time desc |
| | | </where> |
| | | </select> |
| | | <select id="getResPowerAlm" resultType="com.whyc.pojo.db_power_alarm.PowerAlarm"> |
| | | select power_alarm.*,power_inf.power_name from db_power_alarm.power_alarm,db_batt.power_inf |
| | | <where> |
| | | power_alarm.power_id=power_inf.power_id |
| | | and power_alarm.power_id=#{pinfId} |
| | | order by power_alarm.alm_start_time desc |
| | | </where> |
| | | </select> |
| | | </mapper> |