| | |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_power_alarm.PowerAlarm; |
| | | import com.whyc.pojo.db_power_alarm.PowerAlarmCfg; |
| | | import com.whyc.pojo.db_power_alarm.PowerAlarmHistory; |
| | | import com.whyc.util.SubTablePageInfoUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PowerAlarmHistoryService { |
| | | @Autowired |
| | | private SubTablePageInfoUtil util; |
| | | |
| | | @Autowired |
| | | private PowerAlarmCfgService cfgService; |
| | | |
| | | //查询电源历史时间告警 |
| | | public Response getHisAlarm(int pinfId, String startTime, String endTime, int pageNum, int pageSize) throws ParseException { |
| | | public Response getHisPage(Integer almLevel, String startTime, String endTime, int pageNum, int pageSize) throws ParseException { |
| | | PowerAlarmHistory his=new PowerAlarmHistory(); |
| | | his.setPowerId(pinfId); |
| | | his.setAlmLevel(almLevel); |
| | | PageInfo pageInfo=util.getPageInfo(pageNum,pageSize, ThreadLocalUtil.parse(startTime,1),ThreadLocalUtil.parse(endTime,1) |
| | | ,"db_power_alarm","power_alarm_history",his); |
| | | return new Response().setII(1,pageInfo.getList()!=null,pageInfo,"查询电源历史时间告警"); |
| | | List<PowerAlarm> list = pageInfo.getList(); |
| | | 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,"查询历史-分页"); |
| | | } |
| | | } |