|
|
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.Constants;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
+import com.xunmei.common.core.domain.iot.domain.IotDevice;
|
|
|
+import com.xunmei.common.core.domain.iot.domain.IotDvrChannel;
|
|
|
import com.xunmei.common.core.domain.mediator.domain.MediatorAlarmCode;
|
|
|
import com.xunmei.common.core.domain.mediator.domain.MediatorCategory;
|
|
|
import com.xunmei.common.core.domain.video.MediatorVideoDiagnosisRecord;
|
|
|
@@ -13,6 +15,8 @@ import com.xunmei.common.core.utils.IDHelper;
|
|
|
import com.xunmei.mediator.api.mapper.MediatorAlarmCodeMapper;
|
|
|
import com.xunmei.mediator.api.mapper.MediatorCategoryMapper;
|
|
|
import com.xunmei.mediator.api.mapper.VideoDiagnosisRecordMapper;
|
|
|
+import com.xunmei.mediator.api.service.IIotDeviceService;
|
|
|
+import com.xunmei.mediator.api.service.IIotDvrChannelService;
|
|
|
import com.xunmei.mediator.api.service.IVideoDiagnosisLogService;
|
|
|
import com.xunmei.mediator.api.service.IVideoDiagnosisRecordService;
|
|
|
import com.xunmei.system.api.dto.protection.ReceiveErrorDto;
|
|
|
@@ -51,7 +55,9 @@ public class VideoDiagnosisRecordServiceImpl extends ServiceImpl<VideoDiagnosisR
|
|
|
@Resource
|
|
|
MediatorCategoryMapper categoryMapper;
|
|
|
@Resource
|
|
|
- RemoteDeviceService deviceService;
|
|
|
+ IIotDeviceService iIotDeviceService;
|
|
|
+ @Resource
|
|
|
+ IIotDvrChannelService dvrChannelService;
|
|
|
@Resource
|
|
|
MediatorAlarmCodeMapper alarmCodeMapper;
|
|
|
@Override
|
|
|
@@ -69,9 +75,9 @@ public class VideoDiagnosisRecordServiceImpl extends ServiceImpl<VideoDiagnosisR
|
|
|
//参数验证通过
|
|
|
if (error.getSuccess()) {
|
|
|
SysOrg org = (SysOrg) map.get("org");
|
|
|
- SysDevice device = (SysDevice) map.get("device");
|
|
|
- MediatorCategory category = (MediatorCategory) map.get("category");
|
|
|
- Map<String, Object> objectMap = this.buildEntityDto(videoDiagnosisDto, org, device, category);
|
|
|
+ IotDvrChannel device = (IotDvrChannel) map.get("device");
|
|
|
+ // MediatorCategory category = (MediatorCategory) map.get("category");
|
|
|
+ Map<String, Object> objectMap = this.buildEntityDto(videoDiagnosisDto, org, device);
|
|
|
this.saveDataInfo(objectMap, videoDiagnosisDto, device);
|
|
|
}
|
|
|
return error;
|
|
|
@@ -103,24 +109,23 @@ public class VideoDiagnosisRecordServiceImpl extends ServiceImpl<VideoDiagnosisR
|
|
|
map.put("error", error);
|
|
|
return map;
|
|
|
}
|
|
|
- //Device device = deviceService.findResult(videoDiagnosisDto.getChannelCode(), videoDiagnosisDto.getEquipmentCode(), org.getId());
|
|
|
- SysDevice device = new SysDevice();
|
|
|
- if (ObjectUtil.isNull(device)) {
|
|
|
+ final IotDvrChannel channel = dvrChannelService.findChannel(videoDiagnosisDto.getChannelCode(), videoDiagnosisDto.getEquipmentCode(), org.getId());
|
|
|
+ if (ObjectUtil.isNull(channel)) {
|
|
|
error.setSuccess(false);
|
|
|
error.setErrorMsg("通道/设备不存在!");
|
|
|
map.put("error", error);
|
|
|
return map;
|
|
|
}
|
|
|
- MediatorCategory category = categoryMapper.selectById(device.getCategoryId());
|
|
|
+ /*MediatorCategory category = categoryMapper.selectById(channel.getCategoryId());
|
|
|
if (ObjectUtil.isNull(category)) {
|
|
|
error.setSuccess(false);
|
|
|
error.setErrorMsg("设备类型不存在");
|
|
|
map.put("error", error);
|
|
|
return map;
|
|
|
- }
|
|
|
- map.put("device", device);
|
|
|
+ }*/
|
|
|
+ map.put("device", channel);
|
|
|
map.put("org", org);
|
|
|
- map.put("category", category);
|
|
|
+ // map.put("category", category);
|
|
|
map.put("error", error);
|
|
|
return map;
|
|
|
} else {
|
|
|
@@ -173,7 +178,7 @@ public class VideoDiagnosisRecordServiceImpl extends ServiceImpl<VideoDiagnosisR
|
|
|
|
|
|
}
|
|
|
|
|
|
- private Map<String, Object> buildEntityDto(VideoDiagnosisDto videoDiagnosisDto, SysOrg org, SysDevice device, MediatorCategory category) throws ParseException {
|
|
|
+ private Map<String, Object> buildEntityDto(VideoDiagnosisDto videoDiagnosisDto, SysOrg org, IotDvrChannel channel) {
|
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
|
MediatorVideoDiagnosisRecord videoDiagnosis = new MediatorVideoDiagnosisRecord();
|
|
|
videoDiagnosis.setId(IDHelper.id());
|
|
|
@@ -205,12 +210,12 @@ public class VideoDiagnosisRecordServiceImpl extends ServiceImpl<VideoDiagnosisR
|
|
|
videoDiagnosis.setOrgId(org.getId());
|
|
|
videoDiagnosis.setOrgName(org.getName());
|
|
|
videoDiagnosis.setOrgPath(org.getPath());
|
|
|
- SysDevice hostDevice = deviceService.findByHostCode(videoDiagnosis.getEquipmentCode(),SecurityConstants.INNER);
|
|
|
+ IotDevice hostDevice = iIotDeviceService.findByHostCode(videoDiagnosis.getEquipmentCode(),org.getId());
|
|
|
if (hostDevice != null) {
|
|
|
- videoDiagnosis.setEquipmentName(hostDevice.getDeviceName());
|
|
|
+ videoDiagnosis.setEquipmentName(hostDevice.getEquipmentName());
|
|
|
}
|
|
|
- videoDiagnosis.setDeviceName(device.getDeviceName());
|
|
|
- videoDiagnosis.setDeviceId(String.valueOf(device.getId()));
|
|
|
+ videoDiagnosis.setDeviceName(channel.getChannelName());
|
|
|
+ videoDiagnosis.setDeviceId(String.valueOf(channel.getId()));
|
|
|
this.dealDetailInfo(videoDiagnosis);
|
|
|
objectMap.put("videoDiagnosis", videoDiagnosis);
|
|
|
|
|
|
@@ -314,7 +319,7 @@ public class VideoDiagnosisRecordServiceImpl extends ServiceImpl<VideoDiagnosisR
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public void saveDataInfo(Map<String, Object> objectMap, VideoDiagnosisDto videoDiagnosisDto, SysDevice device) {
|
|
|
+ public void saveDataInfo(Map<String, Object> objectMap, VideoDiagnosisDto videoDiagnosisDto, IotDvrChannel device) {
|
|
|
MediatorVideoDiagnosisRecord videoDiagnosis = (MediatorVideoDiagnosisRecord) objectMap.get("videoDiagnosis");
|
|
|
/* List<HostAlarmRecord> alarmRecordsInsert = (List<HostAlarmRecord>) objectMap.get("alarmRecordsInsert");
|
|
|
List<HostAlarmRecord> alarmRecordsUpdate = (List<HostAlarmRecord>) objectMap.get("alarmRecordsUpdate");*/
|