| | |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.BattAlarmHis; |
| | | import com.whyc.pojo.db_alarm.BattAlarm; |
| | | import com.whyc.pojo.db_alarm.BattAlarmHistory; |
| | | import com.whyc.pojo.db_param.BattAlarmCfg; |
| | | import com.whyc.util.SubTablePageInfoUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class BattAlarmHisService { |
| | | @Autowired |
| | | private SubTablePageInfoUtil util; |
| | | |
| | | @Autowired |
| | | private BattAlarmCfgService cfgService; |
| | | |
| | | //查询电池组历史时间告警 |
| | | public Response getHisAlatm(int binfId, String startTime, String endTime,int pageNum,int pageSize)throws ParseException, InterruptedException { |
| | | BattAlarmHis his=new BattAlarmHis(); |
| | | his.setBinfId(binfId); |
| | | PageInfo pageInfo=util.getPageInfoByMonthTable(pageNum,pageSize, ThreadLocalUtil.parse(startTime,1),ThreadLocalUtil.parse(endTime,1) |
| | | ,"db_alarm","batt_alarm",his); |
| | | return new Response().setII(1,pageInfo.getList()!=null,pageInfo,"查询电池组历史时间告警"); |
| | | public Response getHistoryPage(Integer almLevel, String startTime, String endTime,int pageNum,int pageSize)throws ParseException, InterruptedException { |
| | | BattAlarmHistory his=new BattAlarmHistory(); |
| | | his.setAlmLevel(almLevel); |
| | | PageInfo pageInfo=util.getPageInfo(pageNum,pageSize, ThreadLocalUtil.parse(startTime,1),ThreadLocalUtil.parse(endTime,1) |
| | | ,"db_alarm","batt_alarm_history",his); |
| | | List<BattAlarm> list = pageInfo.getList(); |
| | | List<BattAlarmCfg> 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,"查询电池告警历史-分页"); |
| | | } |
| | | } |