|
@@ -205,6 +205,7 @@ public class BaseAlarmServiceImpl extends AbstractCrudService<BaseAlarmMapper, B
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
IPage<BaseAlarm> page = new Page<>(baseAlarmListVO.getCurrent(), baseAlarmListVO.getSize());
|
|
IPage<BaseAlarm> page = new Page<>(baseAlarmListVO.getCurrent(), baseAlarmListVO.getSize());
|
|
|
|
|
+ List<BaseAlarm> records = new ArrayList<>();
|
|
|
if(CollectionUtils.isNotEmpty(devIdList)){
|
|
if(CollectionUtils.isNotEmpty(devIdList)){
|
|
|
LambdaQueryWrapper<BaseAlarm> queryWrapper = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<BaseAlarm> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.in(BaseAlarm::getDeviceId,devIdList)
|
|
queryWrapper.in(BaseAlarm::getDeviceId,devIdList)
|
|
@@ -227,65 +228,27 @@ public class BaseAlarmServiceImpl extends AbstractCrudService<BaseAlarmMapper, B
|
|
|
}else {
|
|
}else {
|
|
|
queryWrapper.orderByDesc(BaseAlarm::getId);
|
|
queryWrapper.orderByDesc(BaseAlarm::getId);
|
|
|
}
|
|
}
|
|
|
- page = this.page(page,queryWrapper);
|
|
|
|
|
-// List<BaseAlarm> records = this.list(queryWrapper);
|
|
|
|
|
- if(page.getRecords().size()>0){
|
|
|
|
|
- List<String> devList = new ArrayList<>();
|
|
|
|
|
- for(int i=0;i<page.getRecords().size();i++){
|
|
|
|
|
- devList.add(page.getRecords().get(i).getDeviceId());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(devList.size() > 0){
|
|
|
|
|
- LambdaQueryWrapper<BaseFacilityDevice> lambdaQuery1 = Wrappers.lambdaQuery();
|
|
|
|
|
- lambdaQuery1.in(BaseFacilityDevice::getDeviceId,devList);
|
|
|
|
|
- List<BaseFacilityDevice> records1 = baseFacilityDeviceService.list(lambdaQuery1);
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(deviceInfo)){
|
|
|
|
|
- for(int i=0;i<page.getRecords().size();i++){
|
|
|
|
|
- for(int j=0;j<deviceInfo.size();j++){
|
|
|
|
|
- if(page.getRecords().get(i).getDeviceId().equals(deviceInfo.get(j).getDeviceId())){
|
|
|
|
|
- page.getRecords().get(i).setDeviceName(deviceInfo.get(j).getDeviceName());
|
|
|
|
|
- page.getRecords().get(i).setDeviceType(deviceInfo.get(j).getDeviceType());
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- for(int k=0;k<records1.size();k++){
|
|
|
|
|
- if(page.getRecords().get(i).getDeviceId().equals(records1.get(k).getDeviceId())){
|
|
|
|
|
- page.getRecords().get(i).setFacilityId(records1.get(k).getFacilityId());
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- List<BaseAlarmType> alarmTypeList = baseMapper.getAlarmTypeList();
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(alarmTypeList)){
|
|
|
|
|
- for(int i=0;i<page.getRecords().size();i++){
|
|
|
|
|
- for(int j=0;j<alarmTypeList.size();j++){
|
|
|
|
|
- if(page.getRecords().get(i).getAlarmType().equals(alarmTypeList.get(j).getTypeCode())){
|
|
|
|
|
- page.getRecords().get(i).setTypeImg(alarmTypeList.get(j).getTypeImg());
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// page = this.page(page,queryWrapper);
|
|
|
|
|
+ records = this.list(queryWrapper);
|
|
|
|
|
+ if(records.size() == 0){
|
|
|
|
|
+ return new CommonPage<>(new ArrayList<>(),0,0,0);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(baseAlarmListVO.getDeviceName())){
|
|
if(StringUtils.isNotBlank(baseAlarmListVO.getDeviceName())){
|
|
|
- list = page.getRecords().stream().filter(e -> baseAlarmListVO.getDeviceName().equals(e.getDeviceName())).collect(Collectors.toList());
|
|
|
|
|
|
|
+ list = records.stream().filter(e -> baseAlarmListVO.getDeviceName().equals(e.getDeviceName())).collect(Collectors.toList());
|
|
|
}else {
|
|
}else {
|
|
|
- if(page.getRecords().size()>0){
|
|
|
|
|
- for(int k=0;k<page.getRecords().size();k++){
|
|
|
|
|
- list.add(page.getRecords().get(k));
|
|
|
|
|
|
|
+ if(records.size()>0){
|
|
|
|
|
+ for(int k=0;k<records.size();k++){
|
|
|
|
|
+ list.add(records.get(k));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- int total = 0;
|
|
|
|
|
|
|
+
|
|
|
if(list.size()>0){
|
|
if(list.size()>0){
|
|
|
- total = list.size();
|
|
|
|
|
|
|
+ page.setTotal(list.size());
|
|
|
}
|
|
}
|
|
|
int current = 0;
|
|
int current = 0;
|
|
|
Integer pageNum = baseAlarmListVO.getCurrent();
|
|
Integer pageNum = baseAlarmListVO.getCurrent();
|
|
@@ -297,6 +260,46 @@ public class BaseAlarmServiceImpl extends AbstractCrudService<BaseAlarmMapper, B
|
|
|
queryWrapper5.eq("tenant_id",SecurityUtils.getTenantId());
|
|
queryWrapper5.eq("tenant_id",SecurityUtils.getTenantId());
|
|
|
List<DmpDeviceType> deviceTypeList = dmpDeviceTypeMapper.selectList(queryWrapper5);
|
|
List<DmpDeviceType> deviceTypeList = dmpDeviceTypeMapper.selectList(queryWrapper5);
|
|
|
List<BaseAlarm> info = list.stream().sorted(Comparator.comparing(BaseAlarm::getId,Comparator.reverseOrder())).skip(current).limit(pageSize).collect(Collectors.toList());
|
|
List<BaseAlarm> info = list.stream().sorted(Comparator.comparing(BaseAlarm::getId,Comparator.reverseOrder())).skip(current).limit(pageSize).collect(Collectors.toList());
|
|
|
|
|
+ List<String> devList = new ArrayList<>();
|
|
|
|
|
+ for(int i=0;i<info.size();i++){
|
|
|
|
|
+ devList.add(info.get(i).getDeviceId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(devList.size() > 0){
|
|
|
|
|
+ LambdaQueryWrapper<BaseFacilityDevice> lambdaQuery1 = Wrappers.lambdaQuery();
|
|
|
|
|
+ lambdaQuery1.in(BaseFacilityDevice::getDeviceId,devList);
|
|
|
|
|
+ List<BaseFacilityDevice> records1 = baseFacilityDeviceService.list(lambdaQuery1);
|
|
|
|
|
+ if(CollectionUtils.isNotEmpty(deviceInfo)){
|
|
|
|
|
+ for(int i=0;i<info.size();i++){
|
|
|
|
|
+ for(int j=0;j<deviceInfo.size();j++){
|
|
|
|
|
+ if(info.get(i).getDeviceId().equals(deviceInfo.get(j).getDeviceId())){
|
|
|
|
|
+ info.get(i).setDeviceName(deviceInfo.get(j).getDeviceName());
|
|
|
|
|
+ info.get(i).setDeviceType(deviceInfo.get(j).getDeviceType());
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ for(int k=0;k<records1.size();k++){
|
|
|
|
|
+ if(info.get(i).getDeviceId().equals(records1.get(k).getDeviceId())){
|
|
|
|
|
+ info.get(i).setFacilityId(records1.get(k).getFacilityId());
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<BaseAlarmType> alarmTypeList = baseMapper.getAlarmTypeList();
|
|
|
|
|
+ if(CollectionUtils.isNotEmpty(alarmTypeList)){
|
|
|
|
|
+ for(int i=0;i<info.size();i++){
|
|
|
|
|
+ for(int j=0;j<alarmTypeList.size();j++){
|
|
|
|
|
+ if(info.get(i).getAlarmType().equals(alarmTypeList.get(j).getTypeCode())){
|
|
|
|
|
+ info.get(i).setTypeImg(alarmTypeList.get(j).getTypeImg());
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
LocalDateTime toDateTime = LocalDateTime.now();
|
|
LocalDateTime toDateTime = LocalDateTime.now();
|
|
|
for(int l=0;l<info.size();l++){
|
|
for(int l=0;l<info.size();l++){
|
|
|
LocalDateTime fromDateTime = info.get(l).getAlarmTime();
|
|
LocalDateTime fromDateTime = info.get(l).getAlarmTime();
|
|
@@ -318,8 +321,10 @@ public class BaseAlarmServiceImpl extends AbstractCrudService<BaseAlarmMapper, B
|
|
|
info.get(l).setDeviceTypeName(deviceTypeList.get(m).getTypeName());
|
|
info.get(l).setDeviceTypeName(deviceTypeList.get(m).getTypeName());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- return new CommonPage<BaseAlarm>(info,total,pageSize,pageNum);
|
|
|
|
|
|
|
+ page.setRecords(info);
|
|
|
|
|
+ return new CommonPage<BaseAlarm>(page.getRecords(),page.getTotal(),pageSize,pageNum);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|