| | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.PowerAlarmMapper; |
| | | import com.whyc.pojo.db_alarm.BattAlarm; |
| | | import com.whyc.pojo.db_param.BattAlarmCfg; |
| | | import com.whyc.pojo.db_power_alarm.PowerAlarm; |
| | | import com.whyc.pojo.db_power_alarm.PowerAlarmCfg; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired(required = false) |
| | | private PowerAlarmMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private PowerAlarmCfgService cfgService; |
| | | |
| | | /* |
| | | 在用电源实时推送告警信息 |
| | | **/ |
| | |
| | | return new Response().setII(1,list!=null,list,"在用电源实时推送告警信息"); |
| | | } |
| | | //查询电源告警 |
| | | public Response getPowerAlarm(int almLevel, String startTime, String endTime ,int pageNum, int pageSize) { |
| | | public Response getPage(Integer 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)); |
| | | List<PowerAlarm> list=mapper.getList(almLevel, ThreadLocalUtil.parse(startTime,1),ThreadLocalUtil.parse(endTime,1)); |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,pageInfo,"查询电源告警"); |
| | | List<PowerAlarmCfg> cfgList = cfgService.getList(); |
| | | list.stream().forEach(item->{ |
| | | Integer almId = item.getAlmId(); |
| | | for (int i = 0; i < cfgList.size(); i++) { |
| | | if(almId.intValue() == cfgList.get(i).getAlmId()){ |
| | | item.setAlmName(cfgList.get(i).getAlmName()); |
| | | break; |
| | | } |
| | | } |
| | | }); |
| | | return new Response().setII(1,list!=null,pageInfo,"查询-分页"); |
| | | } |
| | | //确认告警 |
| | | public Response confirmAlarm(int num) { |
| | |
| | | return new Response().set(1,flag>0); |
| | | } |
| | | //取消告警 |
| | | public Response cancleAlarm(int num) { |
| | | public Response cancelAlarm(int num) { |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("num",num); |
| | | wrapper.set("alm_confirm",0); |