| | |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> alarmReminderByMonitorPointIds(Map<String, Object> parameters) { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | String monitorPointIds = parameters.get("monitorPointIds").toString(); |
| | | monitorPointIds.replace("[",""); |
| | | monitorPointIds.replace("]",""); |
| | | String[] monitorPointIdArray = monitorPointIds.split(","); |
| | | List<String> monitorPointIdList = new ArrayList<>(Arrays.asList(monitorPointIdArray)); |
| | | //声明一个list,存放设备id |
| | | List<Integer> deviceIdList = new ArrayList<>(); |
| | | //根据id查询所属设备 |
| | | QueryWrapper<Device> wrapper_device = new QueryWrapper<>(); |
| | | wrapper_device.eq("is_delete",Constants.NOT_DELETE); |
| | | wrapper_device.in("monitor_point_id",monitorPointIdList); |
| | | List<Device> devices = new ArrayList<>(); |
| | | devices = deviceMapper.selectList(wrapper_device); |
| | | if (devices.size()>0){ |
| | | for (Device device:devices) { |
| | | int deviceId = device.getId(); |
| | | deviceIdList.add(deviceId); |
| | | } |
| | | } |
| | | if (deviceIdList.size()>0){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("deviceIds",deviceIdList); |
| | | int size = Integer.parseInt(parameters.get("size").toString()); |
| | | map.put("size",size); |
| | | List<Map<String, Object>> resultList = alarmInfoMapper.selectNewestData(map); |
| | | SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (Map<String, Object> alarmInfo:resultList) { |
| | | String alarm_time = SDF.format(alarmInfo.get("alarm_time")); |
| | | alarmInfo.put("alarm_time",alarm_time); |
| | | } |
| | | resultMap.put("alarmInfors",resultList); |
| | | QueryWrapper<AlarmInfo> alarmInfoQueryWrapper = new QueryWrapper<>(); |
| | | alarmInfoQueryWrapper.in("device_id",deviceIdList); |
| | | Integer totalNumber = alarmInfoMapper.selectCount(alarmInfoQueryWrapper); |
| | | resultMap.put("totalNumber",totalNumber); |
| | | return resultMap; |
| | | } |
| | | return null; |
| | | } |
| | | } |