package com.whyc.service;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.github.pagehelper.PageInfo;
|
import com.whyc.dto.AlarmDaoFactory;
|
import com.whyc.dto.Response;
|
import com.whyc.dto.UpsAlarmDTO;
|
import com.whyc.pojo.PwrdevAlarmHistory;
|
import com.whyc.pojo.UpspwrdevAlarm;
|
import com.whyc.pojo.UpspwrdevAlarmHistory;
|
import com.whyc.util.ActionUtil;
|
import com.whyc.util.SubTablePageInfoUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.text.ParseException;
|
import java.util.Date;
|
import java.util.List;
|
|
@Service
|
public class UpspwrdevAlarmHistoryService {
|
|
|
@Resource
|
private SubTablePageInfoUtils subTablePageInfoUtils;
|
|
@Autowired
|
private SubTablePageInfoService subService;
|
|
|
//ups历史告警数据
|
public Response getAlmHis(UpsAlarmDTO upsAlarmDTO) throws ParseException {
|
Integer pageNum = upsAlarmDTO.getPageNum();
|
Integer pageSize = upsAlarmDTO.getPageSize();
|
Date almStartTime = upsAlarmDTO.getAlmStartTime();
|
Date almEndTime = upsAlarmDTO.getAlmEndTime();
|
//recordId = 1 普通电源
|
//param.setRecordId(1L);
|
int uId = ActionUtil.getUser().getUId().intValue();
|
upsAlarmDTO.setUsrId(uId);
|
PageInfo<Object> pageInfo = subTablePageInfoUtils.getPageInfo(pageNum, pageSize, almStartTime, almEndTime,
|
"db_upspwrdev_alarm", "tb_upspwrdev_alarm_history", upsAlarmDTO);
|
List<Object> list = pageInfo.getList();
|
for (Object temp : list) {
|
UpspwrdevAlarmHistory p = (UpspwrdevAlarmHistory) temp;
|
p.setAlmTypeName(AlarmDaoFactory.getUpsAlarmName(p.getAlmType()));
|
}
|
return new Response<>().setII(1, pageInfo, null, "返回结果");
|
}
|
|
|
//ups历史告警确认
|
public Response setHisAlmIsConfirmed(int num,String year) {
|
int flag=subService.setHisAlmIsConfirmed(num,year);
|
return new Response().set(1,flag>0,"ups历史告警确认");
|
}
|
//ups历史告警取消
|
public Response cancleHisAlmIsConfirmed(int num,String year) {
|
int flag=subService.cancleHisAlmIsConfirmed(num,year);
|
return new Response().set(1,flag>0,"ups历史告警取消");
|
}
|
//ups历史告警删除
|
public Response delHisAlm(int num,String year) {
|
subService.delHisAlm(num,year);
|
return new Response().set(1,true,"ups历史告警删除");
|
}
|
}
|