| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class LockAlarmService { |
| | |
| | | |
| | | @Autowired(required = false) |
| | | private LockInfMapper linfMapper; |
| | | |
| | | @Autowired |
| | | private AreaInfService areaInfService; |
| | | //查询锁实时告警信息 |
| | | public Response getLockAlm(Integer lockId, String almIds,int pageNum, int pageSize) { |
| | | public Response getLockAlm(Integer areaId, String almIds,Integer confirmFlag,int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | if(lockId!=null){ |
| | | wrapper.eq("lock_id",lockId); |
| | | if(areaId!=null){ |
| | | List<Integer> areaList=new ArrayList(); |
| | | areaList.add(areaId); |
| | | areaInfService.getAllAreaId(areaId,areaList); |
| | | if(areaList!=null){ |
| | | QueryWrapper wrapper1=new QueryWrapper(); |
| | | wrapper1.in("area_id",areaList); |
| | | List<LockInf> lockInfList=linfMapper.selectList(wrapper1); |
| | | List<Integer> lockIdList = lockInfList.stream() |
| | | .map(LockInf::getLockId) // 提取id值 |
| | | .collect(Collectors.toList()); // 转换为列表*/ |
| | | wrapper.in("lock_id",lockIdList); |
| | | } |
| | | } |
| | | if(almIds!=null){ |
| | | String[] almId=almIds.split(","); |
| | | wrapper.in("alm_id",almId); |
| | | } |
| | | if(confirmFlag!=null){ |
| | | wrapper.eq("alm_is_confirmed",confirmFlag); |
| | | } |
| | | List<LockAlarm> list=mapper.selectList(wrapper); |
| | | for (LockAlarm alm:list) { |
| | | LockInf linf=linfMapper.getlinfBylockId(alm.getLockId()); |