|
|
@@ -24,6 +24,7 @@ import com.xunmei.mediator.domain.dto.videoIntegrityCheck.VideoIntegrityCheckDto
|
|
|
import com.xunmei.mediator.util.RedisUtil;
|
|
|
import com.xunmei.system.api.RemoteOrgService;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
+import com.xunmei.system.api.util.LogUtils;
|
|
|
import io.netty.util.internal.StringUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -77,7 +78,7 @@ public class VideoIntegrityCheckServiceImpl extends ServiceImpl<VideoIntegrityCh
|
|
|
}
|
|
|
//与上次接收到的数据进行比较,如果相同则不进行处理
|
|
|
if (redisUtil.compareWithCache(videoIntegrityCheckDto)) {
|
|
|
- return ReceiveErrorDto.error(RedisKey.REPORT_DATA_REFUSE_MSG);
|
|
|
+ return ReceiveErrorDto.error(RedisKey.REPORT_DATA_REFUSE_MSG);
|
|
|
}
|
|
|
|
|
|
String organizationGuid = videoIntegrityCheckDto.getOrganizationGuid();
|
|
|
@@ -98,8 +99,13 @@ public class VideoIntegrityCheckServiceImpl extends ServiceImpl<VideoIntegrityCh
|
|
|
|
|
|
MediatorVideoIntegrityCheck old = this.findByOrgIdAndEquipmentCodeAndAndChannelCodeAndRecordDate(org.getId(), videoIntegrityCheckDto.getEquipmentCode(), videoIntegrityCheckDto.getChannelCode());
|
|
|
MediatorVideoIntegrityCheck videoIntegrityCheck = new MediatorVideoIntegrityCheck();
|
|
|
+ boolean isCompensate = false;
|
|
|
if (old != null) {
|
|
|
videoIntegrityCheck = old;
|
|
|
+ if (LocalDate.parse(videoIntegrityCheckDto.getRecordDate(), DateTimeFormatter.ISO_DATE).isBefore(old.getRecordDate())) {
|
|
|
+ isCompensate = true;
|
|
|
+ LogUtils.STATUS_INFO_VIDEO_COMPLETE.info("接收到录像完整性补录数据,仅修改日志消息,消息内容:{}", JSON.toJSONString(videoIntegrityCheckDto));
|
|
|
+ }
|
|
|
} else {
|
|
|
videoIntegrityCheck.setCreateTime(new Date());
|
|
|
}
|
|
|
@@ -135,7 +141,10 @@ public class VideoIntegrityCheckServiceImpl extends ServiceImpl<VideoIntegrityCh
|
|
|
videoIntegrityCheck.setOrgPath(org.getPath());
|
|
|
videoIntegrityCheck.setStatus(getStatus(videoIntegrityCheckDto));
|
|
|
videoIntegrityCheck.setLoseDuration(calculateLoseMinute(videoIntegrityCheck.getLoseSpan()));
|
|
|
- this.saveOrUpdate(videoIntegrityCheck);
|
|
|
+ if (!isCompensate) {
|
|
|
+ //不是补录才进行保存数据
|
|
|
+ this.saveOrUpdate(videoIntegrityCheck);
|
|
|
+ }
|
|
|
saveLog(videoIntegrityCheck);
|
|
|
|
|
|
return ReceiveErrorDto.success();
|
|
|
@@ -144,13 +153,12 @@ public class VideoIntegrityCheckServiceImpl extends ServiceImpl<VideoIntegrityCh
|
|
|
private void saveLog(MediatorVideoIntegrityCheck videoIntegrityCheck) {
|
|
|
MediatorVideoIntegrityCheckLog newLog = new MediatorVideoIntegrityCheckLog();
|
|
|
MediatorVideoIntegrityCheckLog logData = integrityCheckLogService.findByOrgIdAndEquipmentCodeAndChannelCode(videoIntegrityCheck.getOrgId(), videoIntegrityCheck.getEquipmentCode(), videoIntegrityCheck.getChannelCode(), videoIntegrityCheck.getRecordDate());
|
|
|
-
|
|
|
if (logData != null) {
|
|
|
- BeanUtils.copyProperties(videoIntegrityCheck,logData,"id");
|
|
|
+ BeanUtils.copyProperties(videoIntegrityCheck, logData, "id");
|
|
|
integrityCheckLogService.updateById(logData);
|
|
|
return;
|
|
|
}
|
|
|
- BeanUtils.copyProperties(videoIntegrityCheck,newLog);
|
|
|
+ BeanUtils.copyProperties(videoIntegrityCheck, newLog);
|
|
|
newLog.setId(IdWorker.getId());
|
|
|
newLog.setVideoIntegrityCheckId(videoIntegrityCheck.getId());
|
|
|
integrityCheckLogService.save(newLog);
|