|
|
@@ -87,34 +87,34 @@ public class VideoDaysCheckServiceImpl extends ServiceImpl<VideoDaysCheckMapper,
|
|
|
String organizationGuid = videoDaysCheckDto.getOrganizationGuid();
|
|
|
SysOrg org = orgService.findByCode(organizationGuid, SecurityConstants.INNER);
|
|
|
if (org == null) {
|
|
|
- NorthError error = new NorthError(msgId,"/video/daysInfo"
|
|
|
- , videoDaysCheckDto, "参数非法:organizationGuid:" + organizationGuid + "不正确");
|
|
|
- northErrorService.saveError(error);
|
|
|
- return ReceiveErrorDto.success();
|
|
|
+ northErrorService.saveError(new NorthError(msgId, "/video/daysInfo", videoDaysCheckDto, "参数非法:organizationGuid:" + organizationGuid + "不正确"));
|
|
|
+ return ReceiveErrorDto.error("参数非法:organizationGuid:" + organizationGuid + "不正确");
|
|
|
}
|
|
|
- MediatorVideoDaysCheck videoDaysCheck = new MediatorVideoDaysCheck();
|
|
|
-
|
|
|
- //获取监控主机
|
|
|
IotDevice hostDevice = iIotDeviceService.findByHostCode(videoDaysCheckDto.getEquipmentCode(), org.getId());
|
|
|
- if (hostDevice != null) {
|
|
|
- videoDaysCheck.setEquipmentName(hostDevice.getEquipmentName());
|
|
|
+ if (ObjectUtil.isNull(hostDevice)) {
|
|
|
+ northErrorService.saveError(new NorthError(msgId, "/video/daysInfo", videoDaysCheckDto, "主机不存在!"));
|
|
|
+ return ReceiveErrorDto.error("主机不存在!");
|
|
|
}
|
|
|
-
|
|
|
- MediatorVideoDaysCheck old = this.findByOrgIdAndEquipmentCodeAndChannelCode(org.getId(), videoDaysCheckDto.getEquipmentCode(), videoDaysCheckDto.getChannelCode());
|
|
|
- if (old != null) {
|
|
|
- videoDaysCheck = old;
|
|
|
+ final IotDvrChannel channel = dvrChannelService.findChannel(videoDaysCheckDto.getChannelCode(), videoDaysCheckDto.getEquipmentCode(), org.getId());
|
|
|
+ if (ObjectUtil.isNull(channel)) {
|
|
|
+ northErrorService.saveError(new NorthError(msgId, "/video/daysInfo", videoDaysCheckDto, "通道/设备不存在!"));
|
|
|
+ return ReceiveErrorDto.error("通道/设备不存在!");
|
|
|
}
|
|
|
- if (old == null) {
|
|
|
+ MediatorVideoDaysCheck videoDaysCheck = this.findByOrgIdAndEquipmentCodeAndChannelCode(org.getId(), videoDaysCheckDto.getEquipmentCode(), videoDaysCheckDto.getChannelCode());
|
|
|
+ if (videoDaysCheck == null) {
|
|
|
+ videoDaysCheck = new MediatorVideoDaysCheck();
|
|
|
videoDaysCheck.setCreateTime(new Date());
|
|
|
}
|
|
|
+ //获取监控主机
|
|
|
+ videoDaysCheck.setEquipmentName(hostDevice.getEquipmentName());
|
|
|
+ videoDaysCheck.setEquipmentCode(videoDaysCheckDto.getEquipmentCode());
|
|
|
videoDaysCheck.setUpdateTime(new Date());
|
|
|
videoDaysCheck.setChannelCode(videoDaysCheckDto.getChannelCode());
|
|
|
videoDaysCheck.setChannelName(videoDaysCheckDto.getChannelName());
|
|
|
- if (ObjectUtil.isNotEmpty(videoDaysCheckDto.getCheckDate())){
|
|
|
+ if (ObjectUtil.isNotEmpty(videoDaysCheckDto.getCheckDate())) {
|
|
|
videoDaysCheck.setCheckDate(JSON.toJSONString(videoDaysCheckDto.getCheckDate()));
|
|
|
}
|
|
|
- videoDaysCheck.setEquipmentCode(videoDaysCheckDto.getEquipmentCode());
|
|
|
- if (ObjectUtil.isNotEmpty(videoDaysCheckDto.getLoseDate())){
|
|
|
+ if (ObjectUtil.isNotEmpty(videoDaysCheckDto.getLoseDate())) {
|
|
|
videoDaysCheck.setLoseDate(JSON.toJSONString(videoDaysCheckDto.getLoseDate()));
|
|
|
}
|
|
|
videoDaysCheck.setPlanDays(videoDaysCheckDto.getPlanDays());
|
|
|
@@ -122,32 +122,15 @@ public class VideoDaysCheckServiceImpl extends ServiceImpl<VideoDaysCheckMapper,
|
|
|
videoDaysCheck.setOrgId(org.getId());
|
|
|
videoDaysCheck.setOrgName(org.getShortName());
|
|
|
videoDaysCheck.setOrgPath(org.getPath());
|
|
|
- if(ObjectUtil.isNotEmpty(videoDaysCheckDto.getEarliestVideoTime())){
|
|
|
+ if (ObjectUtil.isNotEmpty(videoDaysCheckDto.getEarliestVideoTime())) {
|
|
|
videoDaysCheck.setEarliestVideoTime(LocalDateTime.parse(videoDaysCheckDto.getEarliestVideoTime(), DateTimeFormatter.ISO_DATE_TIME));
|
|
|
}
|
|
|
videoDaysCheck.setStatus(0);
|
|
|
if (ObjectUtil.isAllNotEmpty(videoDaysCheck.getCheckDate(), videoDaysCheck.getLoseDate()) && !"null".equals(videoDaysCheck.getLoseDate()) && !"null".equals(videoDaysCheck.getCheckDate()) && !"[]".equals(videoDaysCheck.getLoseDate()) && !"[]".equals(videoDaysCheck.getCheckDate())) {
|
|
|
final Map map = JSON.parseObject(videoDaysCheck.getCheckDate(), Map.class);
|
|
|
final List list = JSON.parseObject(videoDaysCheck.getLoseDate(), List.class);
|
|
|
- /*final String dateStr = (String) map.get("sd");
|
|
|
- final DateTime offsetDay1 = DateUtil.offsetDay(DateUtil.parse(dateStr), 1);
|
|
|
- final DateTime offsetDay2 = DateUtil.offsetDay(DateUtil.parse(dateStr), 2);
|
|
|
- final String dateStr1 = DateUtil.format(offsetDay1, "yyyy-MM-dd");
|
|
|
- final String dateStr2 = DateUtil.format(offsetDay2, "yyyy-MM-dd");*/
|
|
|
-
|
|
|
- //2023/1/17 v1.9.4版本需求,判断从三天改成一天
|
|
|
- //videoDaysCheck.setStatus(list.contains(dateStr1) && list.contains(dateStr2) && list.contains(map.get("sd")) ? 1 : 0);
|
|
|
videoDaysCheck.setStatus(list.contains(map.get("sd")) ? 1 : 0);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- final IotDvrChannel channel = dvrChannelService.findChannel(videoDaysCheckDto.getChannelCode(), videoDaysCheckDto.getEquipmentCode(), org.getId());
|
|
|
- if (ObjectUtil.isNull(channel)) {
|
|
|
- NorthError error = new NorthError(msgId,"/video/daysInfo"
|
|
|
- , videoDaysCheckDto, "通道/设备不存在!");
|
|
|
- northErrorService.saveError(error);
|
|
|
- return ReceiveErrorDto.success();
|
|
|
- }
|
|
|
this.saveOrUpdate(videoDaysCheck);
|
|
|
saveLog(videoDaysCheck);
|
|
|
return ReceiveErrorDto.success();
|