|
@@ -4,21 +4,21 @@ package com.iden.bms.service;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
-import com.iden.common.entity.IdenFaceImage;
|
|
|
|
-import com.iden.common.entity.IdenWarningEvent;
|
|
|
|
-import com.iden.common.entity.IdenWarningPerson;
|
|
|
|
-import com.iden.common.entity.IdenWarningPersonTrace;
|
|
|
|
|
|
+import com.iden.common.entity.*;
|
|
import com.iden.common.enums.HandleWarningStatusEnum;
|
|
import com.iden.common.enums.HandleWarningStatusEnum;
|
|
|
|
+import com.iden.common.enums.WarningTypeEnum;
|
|
import com.iden.common.exception.BDException;
|
|
import com.iden.common.exception.BDException;
|
|
|
|
|
|
|
|
|
|
import com.iden.common.service.*;
|
|
import com.iden.common.service.*;
|
|
|
|
+import com.iden.common.util.DateUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -32,6 +32,10 @@ public class WarningService {
|
|
@Resource
|
|
@Resource
|
|
private IdenFaceImageService idenFaceImageService;
|
|
private IdenFaceImageService idenFaceImageService;
|
|
@Resource
|
|
@Resource
|
|
|
|
+ private IdenCameraService idenCameraService;
|
|
|
|
+ @Resource
|
|
|
|
+ private IdenCommunityService idenCommunityService;
|
|
|
|
+ @Resource
|
|
private IdenWarningEventService idenWarningEventService;
|
|
private IdenWarningEventService idenWarningEventService;
|
|
@Resource
|
|
@Resource
|
|
private IdenWarningPersonService idenWarningPersonService;
|
|
private IdenWarningPersonService idenWarningPersonService;
|
|
@@ -55,26 +59,61 @@ public class WarningService {
|
|
}
|
|
}
|
|
|
|
|
|
for (IdenFaceImage idenFaceImage : idenFaceImageList) {
|
|
for (IdenFaceImage idenFaceImage : idenFaceImageList) {
|
|
- //去除同一个摄像头下2分钟内同一个人的人脸图像
|
|
|
|
- if(true){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- //重点人员识别预警
|
|
|
|
|
|
+
|
|
String type = idenFaceImage.getType();
|
|
String type = idenFaceImage.getType();
|
|
- if (StringUtils.isNotEmpty(type) && type.indexOf("1") != -1) {
|
|
|
|
- IdenWarningPerson idenWarningPerson = new IdenWarningPerson();
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(type) && type.contains("0")) { //陌生人员
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ else if (StringUtils.isNotEmpty(type) && type.contains("1")) { //重点人员
|
|
|
|
+ IdenWarningPerson idenWarningPerson = new IdenWarningPerson();
|
|
|
|
+ idenWarningPerson.setImage(idenFaceImage.getImage());
|
|
|
|
+ idenWarningPerson.setDataDate(DateUtils.strToDate(DateUtils.formatToDateStr(idenFaceImage.getPhotographTime(),"yyyy-MM-dd"),"yyyy-MM-dd"));
|
|
|
|
+ Long cameraId = idenFaceImage.getCameraId();
|
|
|
|
+ if(cameraId != null) {
|
|
|
|
+ IdenCamera idenCamera = this.idenCameraService.getById(cameraId);
|
|
|
|
+ idenWarningPerson.setCommunityName(idenCamera.getDistrict());
|
|
|
|
+ idenWarningPerson.setSubdistrict(idenCamera.getSubdistrict());
|
|
|
|
+ }
|
|
|
|
+ Long communityId = idenFaceImage.getCommunityId();
|
|
|
|
+ if(communityId != null) {
|
|
|
|
+ IdenCommunity idenCommunity = this.idenCommunityService.getById(communityId);
|
|
|
|
+ if (idenCommunity != null) {
|
|
|
|
+ idenWarningPerson.setCommunityId(communityId);
|
|
|
|
+ idenWarningPerson.setCommunityCode(idenCommunity.getCode());
|
|
|
|
+ idenWarningPerson.setCommunityName(idenCommunity.getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ idenWarningPerson.setAppearFrequency(1);
|
|
|
|
+ idenWarningPerson.setEarliestAppearTime(idenFaceImage.getPhotographTime());
|
|
|
|
+ idenWarningPerson.setType(WarningTypeEnum.KEYNOTE.getValue());
|
|
|
|
+ idenWarningPerson.setPersonId(idenFaceImage.getPersonId());
|
|
|
|
+ idenWarningPerson.setCreateTime(idenFaceImage.getCreateTime());
|
|
this.idenWarningPersonService.save(idenWarningPerson);
|
|
this.idenWarningPersonService.save(idenWarningPerson);
|
|
|
|
|
|
IdenWarningEvent idenWarningEvent = new IdenWarningEvent();
|
|
IdenWarningEvent idenWarningEvent = new IdenWarningEvent();
|
|
idenWarningEvent.setWarningPersonId(idenWarningPerson.getId());
|
|
idenWarningEvent.setWarningPersonId(idenWarningPerson.getId());
|
|
|
|
+ idenWarningEvent.setDataTime(idenFaceImage.getPhotographTime());
|
|
|
|
+ idenWarningEvent.setImage(idenFaceImage.getImage());
|
|
|
|
+ idenWarningEvent.setCommunityId(idenWarningPerson.getCommunityId());
|
|
|
|
+ idenWarningEvent.setCommunityCode(idenWarningPerson.getCommunityCode());
|
|
|
|
+ idenWarningEvent.setCommunityName(idenWarningPerson.getCommunityName());
|
|
|
|
+ idenWarningEvent.setCommunityName(idenWarningPerson.getDistrict());
|
|
|
|
+ idenWarningEvent.setSubdistrict(idenWarningPerson.getSubdistrict());
|
|
|
|
+ idenWarningEvent.setAppearTime(idenFaceImage.getPhotographTime());
|
|
|
|
+ idenWarningEvent.setType(WarningTypeEnum.KEYNOTE.getValue());
|
|
|
|
+ idenWarningEvent.setPersonId(idenFaceImage.getPersonId());
|
|
|
|
+ idenWarningEvent.setCreateTime(idenFaceImage.getCreateTime());
|
|
this.idenWarningEventService.save(idenWarningEvent);
|
|
this.idenWarningEventService.save(idenWarningEvent);
|
|
|
|
|
|
IdenWarningPersonTrace idenWarningPersonTrace = new IdenWarningPersonTrace();
|
|
IdenWarningPersonTrace idenWarningPersonTrace = new IdenWarningPersonTrace();
|
|
- BeanUtil.copyProperties(idenFaceImage,idenWarningPersonTrace);
|
|
|
|
- idenWarningPersonTrace.setId(null);
|
|
|
|
|
|
+ BeanUtil.copyProperties(idenFaceImage,idenWarningPersonTrace,"id");
|
|
idenWarningPersonTrace.setWarningPersonId(idenWarningPerson.getId());
|
|
idenWarningPersonTrace.setWarningPersonId(idenWarningPerson.getId());
|
|
this.idenWarningPersonTraceService.save(idenWarningPersonTrace);
|
|
this.idenWarningPersonTraceService.save(idenWarningPersonTrace);
|
|
|
|
+ }
|
|
|
|
+ else if (StringUtils.isNotEmpty(type) && type.contains("2")) { //小区人员
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else if (StringUtils.isNotEmpty(type) && type.contains("3")) { //昼伏夜出人员
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|