|
|
@@ -2,7 +2,6 @@ package com.xunmei.mediator.api.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.CacheConstants;
|
|
|
@@ -29,7 +28,6 @@ import com.xunmei.system.api.dto.DataPageDto;
|
|
|
import com.xunmei.system.api.dto.protection.DefenceAreaDto;
|
|
|
import com.xunmei.system.api.dto.protection.ProtectionEditDto;
|
|
|
import com.xunmei.system.api.dto.protection.ReceiveErrorDto;
|
|
|
-import com.xunmei.system.api.dto.protection.SensorDto;
|
|
|
import com.xunmei.system.api.enums.DataType;
|
|
|
import com.xunmei.system.api.enums.ProtectionStatus;
|
|
|
import com.xunmei.system.api.util.LogUtils;
|
|
|
@@ -283,9 +281,10 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
return ReceiveErrorDto.success();
|
|
|
}
|
|
|
|
|
|
- public ReceiveErrorDto saveAndUpdate(List<DefenceAreaDto> defenceareaList, String msgId) {
|
|
|
+ public void saveAndUpdate(List<DefenceAreaDto> defenceareaList, String msgId) {
|
|
|
if (CollectionUtils.isEmpty(defenceareaList)) {
|
|
|
- return ReceiveErrorDto.error("报警主机子系统及防区信息为空");
|
|
|
+ ReceiveErrorDto.error("报警主机子系统及防区信息为空");
|
|
|
+ return;
|
|
|
}
|
|
|
List<NorthError> errors = new ArrayList<>();
|
|
|
List<IotAlarmSubsystem> protectionList = new ArrayList<>();
|
|
|
@@ -298,7 +297,6 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
//查询报警主机主机设备列表
|
|
|
List<IotDevice> devices = iotDeviceService.findByCategory(CategoryDataEnum.ALARM_HOST_DEVICE.getId());
|
|
|
checkParam(defenceareaList, msgId, errors, orgList, categorys, devices, deviceList, protectionList, sensorList);
|
|
|
- return ReceiveErrorDto.success();
|
|
|
}
|
|
|
|
|
|
private void checkParam(List<DefenceAreaDto> defenceareaList, String msgId, List<NorthError> errors, List<SysOrgVO> orgList, List<MediatorCategory> categorys, List<IotDevice> devices, List<IotAlarmSubsystem> deviceList, List<IotAlarmSubsystem> protectionList, List<IotAlarmDefenceArea> sensorList) {
|
|
|
@@ -343,7 +341,7 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if (dto.getSensorArray() == null || dto.getSensorArray().size() == 0) {
|
|
|
+ /*if (dto.getSensorArray() == null || dto.getSensorArray().size() == 0) {
|
|
|
error = new NorthError(msgId, "/api/data/defenceareaList"
|
|
|
, dto, "参数非法:未传sensorArray");
|
|
|
errors.add(error);
|
|
|
@@ -389,7 +387,7 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
errors.add(error);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
SysOrgVO finalOrg = org;
|
|
|
List<IotDevice> devicesa = devices.stream().filter(r -> r.getEquipmentCode().equals(dto.getAlarmHostCode()) && r.getOrgId().equals(finalOrg.getId())).collect(Collectors.toList());
|
|
|
if (devicesa.size() == 0) {
|
|
|
@@ -400,17 +398,18 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
}
|
|
|
Map<String, Object> map = this.protectionBuild(dto, org);
|
|
|
protectionList.add((IotAlarmSubsystem) map.get("protection"));
|
|
|
- List<IotAlarmDefenceArea> list = (List<IotAlarmDefenceArea>) map.get("sensorList");
|
|
|
+ /*List<IotAlarmDefenceArea> list = (List<IotAlarmDefenceArea>) map.get("sensorList");
|
|
|
if (ObjectUtil.isNotEmpty(list)) {
|
|
|
sensorList.addAll(list);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
}
|
|
|
- defenceAreaMapper.delete(new LambdaQueryWrapper<>());
|
|
|
+
|
|
|
northErrorService.saveErrorData(errors);
|
|
|
baseMapper.updateAllDelete();
|
|
|
this.saveOrUpdateBatch(protectionList);
|
|
|
- defenceAreService.saveOrUpdateBatch(sensorList);
|
|
|
+ /*defenceAreaMapper.delete(new LambdaQueryWrapper<>());
|
|
|
+ defenceAreService.saveOrUpdateBatch(sensorList);*/
|
|
|
this.northStatisticsSyncService.saveOrUpdateBaseCountByDataType(DataType.protectionCount.getIndex(), defenceareaList.size(), true);
|
|
|
}
|
|
|
|
|
|
@@ -438,7 +437,7 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
map.put("protection", protection);
|
|
|
|
|
|
|
|
|
- List<SensorDto> sensorArray = dto.getSensorArray();
|
|
|
+ /* List<SensorDto> sensorArray = dto.getSensorArray();
|
|
|
if (sensorArray != null && sensorArray.size() > 0) {
|
|
|
List<IotAlarmDefenceArea> list = new ArrayList<>();
|
|
|
List<IotAlarmDefenceArea> list1 = new ArrayList<>();
|
|
|
@@ -481,7 +480,7 @@ public class IotAlarmSubSystemServiceImpl extends ServiceImpl<IotAlarmSubsystemM
|
|
|
|
|
|
map.put("sensorList", list);
|
|
|
map.put("deviceList", list1);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
return map;
|
|
|
}
|