| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.AlarmDaoFactory; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.PwrDevAlarmVerifyMapper; |
| | | import com.whyc.pojo.BattAlarmDataVerify; |
| | | import com.whyc.pojo.PwrDevAlarmVerify; |
| | | import com.whyc.pojo.PwrdevAlarm; |
| | | import com.whyc.pojo.WorkflowMain; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private PwrDevAlarmVerifyMapper mapper; |
| | | |
| | | public Response<Object> getPage(int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | QueryWrapper<PwrDevAlarmVerify> query = Wrappers.query(); |
| | | query.orderByDesc("num"); |
| | | List<PwrDevAlarmVerify> list = mapper.selectList(query); |
| | | @Autowired |
| | | @Lazy |
| | | private AlarmManualClearService clearService; |
| | | |
| | | public Response<Object> getPage(PwrdevAlarm param) { |
| | | List<Integer> allMainIds = clearService.getAllMainIds(); |
| | | //int userId = ActionUtil.getUser().getUId().intValue(); |
| | | List<PwrDevAlarmVerify> list = mapper.getList(param); |
| | | list.stream().forEach(data -> { |
| | | data.setAlarmName(AlarmDaoFactory.getAllAlarmName(data.getAlmType())); |
| | | WorkflowMain main = data.getMain(); |
| | | if (main != null && allMainIds.contains(main.getId())){ |
| | | main.setFaultUploadDone(true); |
| | | } |
| | | }); |
| | | PageInfo<PwrDevAlarmVerify> pageInfo = new PageInfo<>(list); |
| | | return new Response<>().set(1,pageInfo); |
| | | } |
| | | |
| | | public PwrDevAlarmVerify getById(Integer num) { |
| | | return mapper.selectById(num); |
| | | } |
| | | |
| | | public void delete(Integer num) { |
| | | mapper.deleteById(num); |
| | | } |
| | | |
| | | public Response getPageOfWebSocket(PwrdevAlarm param) { |
| | | try { |
| | | PageHelper.startPage(param.getPage().getPageCurr(), param.getPage().getPageSize()); |
| | | List<PwrDevAlarmVerify> list = mapper.getList(param); |
| | | list.stream().forEach(data -> { |
| | | data.setAlarmName(AlarmDaoFactory.getAllAlarmName(data.getAlmType())); |
| | | }); |
| | | PageInfo<PwrDevAlarmVerify> pageInfo = new PageInfo<>(list); |
| | | return new Response<>().set(1, pageInfo); |
| | | }catch (Exception e){ |
| | | return new Response().setII(0,"接口发生异常:"+e.getCause()); |
| | | } |
| | | } |
| | | } |