File was renamed from src/main/java/com/whyc/service/DevAlarmDataService.java |
| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.constant.DevAlmEnum; |
| | | import com.whyc.dto.DalmDto; |
| | | import com.whyc.dto.DevA200AlarmDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.DevAlarmDataMapper; |
| | | import com.whyc.pojo.db_alarm.DevAlarmData; |
| | | import com.whyc.mapper.DevLithiumAlarmDataMapper; |
| | | import com.whyc.pojo.db_alarm.DevLithiumAlarmData; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.SubTablePageInfoUtil; |
| | |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class DevAlarmDataService { |
| | | public class DevLithiumAlarmDataService { |
| | | |
| | | @Autowired(required = false) |
| | | private DevAlarmDataMapper mapper; |
| | | private DevLithiumAlarmDataMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private SubTablePageInfoUtil service; |
| | |
| | | private UserInfService uerInfService; |
| | | |
| | | //获取设备告警信息 |
| | | public Response getDevAlmInf(int uid, DalmDto dto) { |
| | | public Response getPage(int uid, DevA200AlarmDto dto) { |
| | | PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); |
| | | dto.setUid(uid); |
| | | List<DevAlarmData> list=mapper.getDevAlmInf(dto); |
| | | for (DevAlarmData data:list) { |
| | | List<DevLithiumAlarmData> list=mapper.getDevAlmInf(dto); |
| | | for (DevLithiumAlarmData data:list) { |
| | | UserInf uinf=uerInfService.getUinfByUId(data.getConfirmedUid()); |
| | | data.setConfirmedUname(uinf!=null?uinf.getUname():""); |
| | | int almId=data.getAlmId(); |
| | | data.setAlmName(DevAlmEnum.getValue(almId)); |
| | | } |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,pageInfo,"获取设备告警信息"); |
| | | return new Response().setII(1,list!=null,pageInfo,null); |
| | | } |
| | | //获取历史告警 |
| | | public Response getDevAlmHis(DalmDto dto) throws ParseException { |
| | | public Response getPage(DevA200AlarmDto dto) throws ParseException { |
| | | UserInf uinf= ActionUtil.getUser(); |
| | | dto.setUid(uinf.getUid()); |
| | | if(dto.getStartTime()==null){ |
| | |
| | | } |
| | | PageInfo pageInfo=service.getPageInfo(dto.getPageNum(),dto.getPageSize(),dto.getStartTime(),dto.getEndTime() |
| | | ,"db_alarm", "tb_devalarm_data", dto); |
| | | return new Response().setII(1,pageInfo!=null,pageInfo,"获取设备告警信息"); |
| | | return new Response().setII(1,pageInfo!=null,pageInfo,null); |
| | | } |
| | | //确认实时告警 |
| | | public Response confirmAlm(int num) { |
| | | public Response confirm(int num) { |
| | | UserInf uinf= ActionUtil.getUser(); |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.set("alm_is_confirmed",1); |
| | | wrapper.set("confirmed_uid",uinf.getUid()); |
| | | wrapper.set("confirmed_time",new Date()); |
| | | wrapper.eq("num",num); |
| | | int flag=mapper.update((DevAlarmData) ActionUtil.objeNull,wrapper); |
| | | return new Response().set(1,flag>0,"确认实时告警"); |
| | | int flag=mapper.update((DevLithiumAlarmData) ActionUtil.objeNull,wrapper); |
| | | return new Response().set(1,flag>0,null); |
| | | } |
| | | //获取所有的告警类型 |
| | | public Response getAllAlmName() { |
| | | Map<Integer,String> map=DevAlmEnum.getOpInfo(); |
| | | return new Response().setII(1,true,map,"获取所有的告警类型"); |
| | | return new Response().setII(1,true,map,null); |
| | | } |
| | | //弹窗告警 |
| | | public Response getDevAlmPopUp(Integer uid) { |
| | | List<DevAlarmData> list=mapper.getDevAlmPopUp(uid); |
| | | for (DevAlarmData data:list) { |
| | | public Response getPopup(Integer uid) { |
| | | List<DevLithiumAlarmData> list=mapper.getPopup(uid); |
| | | for (DevLithiumAlarmData data:list) { |
| | | int almId=data.getAlmId(); |
| | | data.setAlmName(DevAlmEnum.getValue(almId)); |
| | | } |
| | | return new Response().setII(1,list!=null,list,"弹窗告警"); |
| | | return new Response().setII(1,list!=null,list,null); |
| | | } |
| | | } |