whyclxw
2025-05-26 64aecb9f17cf2e82a788e6a9dff354e4401f39c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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.Real.AlmDto;
import com.whyc.dto.Response;
import com.whyc.mapper.PwrdevAlarmMapper;
import com.whyc.pojo.db_alarm.DevalarmData;
import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm;
import com.whyc.util.ActionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
 
@Service
public class PwrdevAlarmService {
    @Autowired(required = false)
    private PwrdevAlarmMapper mapper;
    //获取电源实时告警信息
    public Response getPwrAlmReal(AlmDto almDto) {
        PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize());
        List<PwrdevAlarm> list=mapper.getPwrAlmReal(almDto);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list!=null,pageInfo,"获取电源实时告警信息");
    }
    //确认电源告警
    public Response updatePwrConfrim(Integer num) {
        UpdateWrapper wrapper = new UpdateWrapper<>();
        wrapper.set("alm_is_confirmed",1);
        wrapper.set("alm_confirmed_time",new SimpleDateFormat(ActionUtil.time_yyyyMMddHHmmss).format(new Date()));
        // 通过num修改
        wrapper.eq("num",num);
        int flag=mapper.update((PwrdevAlarm) ActionUtil.objeNull,wrapper);
        return  new Response().set(1,flag>0,flag>0?"确认成功":"确认失败");
    }
}