|
@@ -96,7 +96,7 @@ public class WarningService {
|
|
|
* @return
|
|
|
*/
|
|
|
public void handleDayWarning() throws BDException {
|
|
|
- //昼伏夜出识别预警
|
|
|
+ //常住人员识别预警
|
|
|
handleResident();
|
|
|
|
|
|
//查询昨天的人脸图像数据
|
|
@@ -112,9 +112,9 @@ public class WarningService {
|
|
|
|
|
|
if (StringUtils.isNotEmpty(type) && type.contains(PersonTypeEnum.STRANGER.getValue())) { //陌生人员
|
|
|
handleStranger(idenFaceImage);//陌生人员识别预警
|
|
|
- } else if (StringUtils.isNotEmpty(type) && type.contains(PersonTypeEnum.EVENING_COMMING.getValue())) { //昼伏夜出人员
|
|
|
- handleEveningComming(idenFaceImage);//昼伏夜出人员识别预警
|
|
|
}
|
|
|
+
|
|
|
+ handleEveningComming(idenFaceImage);//昼伏夜出人员识别预警
|
|
|
}
|
|
|
|
|
|
//按小区统昨天的数据
|
|
@@ -130,14 +130,17 @@ public class WarningService {
|
|
|
|
|
|
//查询此人1月内在该小区出现天次
|
|
|
QueryWrapper<IdenFaceImage> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.select("select distinct data_date dataDate ") ;
|
|
|
+ queryWrapper.select("distinct data_date dataDate ") ;
|
|
|
queryWrapper.lambda().eq(IdenFaceImage::getUid,idenFaceImage.getUid()).eq(IdenFaceImage::getCommunityId,communityId)
|
|
|
.orderByAsc(IdenFaceImage::getDataDate);
|
|
|
queryWrapper.apply(" data_date >= date_format(DATE_SUB(CURDATE(), INTERVAL 30 DAY),'%Y%m%d') and data_date <= date_format(DATE_SUB(CURDATE(), INTERVAL 1 DAY),'%Y%m%d')");
|
|
|
- int strangerDayFrequency = this.idenFaceImageService.count(queryWrapper);
|
|
|
|
|
|
+ int strangerDayFrequency = 0;
|
|
|
//1月内7天出现情况
|
|
|
List<IdenFaceImage> listDataDate = this.idenFaceImageService.list(queryWrapper);
|
|
|
+ if(listDataDate != null){
|
|
|
+ strangerDayFrequency = listDataDate.size();
|
|
|
+ }
|
|
|
|
|
|
QueryWrapper<IdenWarningRuleStranger> queryWrapper3 = new QueryWrapper<>();
|
|
|
IdenWarningRuleStranger idenWarningRuleStranger = idenWarningRuleStrangerService.getOne(queryWrapper3);
|
|
@@ -215,6 +218,7 @@ public class WarningService {
|
|
|
this.idenWarningPersonService.save(idenWarningPerson);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
IdenWarningPersonHis idenWarningPersonHis = new IdenWarningPersonHis();
|
|
|
BeanUtil.copyProperties(idenWarningPerson,idenWarningPersonHis,"id");
|
|
|
idenWarningPersonHisService.save(idenWarningPersonHis);
|
|
@@ -439,7 +443,7 @@ public class WarningService {
|
|
|
String yestoday = DateUtils.getYestodayYyyyMMddDate();
|
|
|
//查询此人长期晚上某时段出现(时间期间可设)且白天未出现,视为昼伏夜出人员,进行预警
|
|
|
QueryWrapper<IdenFaceImage> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.select("select distinct data_date dataDate ") ;
|
|
|
+ queryWrapper.select("distinct data_date dataDate ") ;
|
|
|
queryWrapper.lambda().eq(IdenFaceImage::getUid,idenFaceImage.getUid())
|
|
|
.eq(IdenFaceImage::getCommunityId,communityId)
|
|
|
.ge(IdenFaceImage::getDataDate,beforeDate)
|
|
@@ -448,18 +452,22 @@ public class WarningService {
|
|
|
for(IdenWarningRuleEveningComming idenWarningRuleEveningComming1 : idenWarningRuleEveningCommings) {
|
|
|
String startTime = idenWarningRuleEveningComming1.getStartTime();
|
|
|
String endTime = idenWarningRuleEveningComming1.getEndTime();
|
|
|
- Map<String, Date> map = DateUtils.convertDate(startTime,endTime);
|
|
|
- Date startDate = map.get("startDate");
|
|
|
- Date endDate = map.get("endDate");
|
|
|
+ Map<String, String> map = DateUtils.convertDate(startTime,endTime);
|
|
|
+ String startDate = map.get("startDate");
|
|
|
+ String endDate = map.get("endDate");
|
|
|
if (AppearStatusEnum.APPEAR.getValue().equals(idenWarningRuleEveningComming1.getStatus())) {
|
|
|
- queryWrapper.apply(" photograph_time > " + startDate + " and photograph_time < " + endDate + "");
|
|
|
+ queryWrapper.apply(" photograph_time > '" + startDate + "' and photograph_time < '" + endDate + "'");
|
|
|
} else if (AppearStatusEnum.DISAPPEAR.getValue().equals(idenWarningRuleEveningComming1.getStatus())) {
|
|
|
queryWrapper.apply(" not exists (select 1 from iden_face_image a where a.data_date = iden_face_image.data_date" +
|
|
|
- " and a.photograph_time > " + startDate + " and a.photograph_time < " + endDate + ") ");
|
|
|
+ " and a.photograph_time > '" + startDate + "' and a.photograph_time < '" + endDate + "') ");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- int count = this.idenFaceImageService.count(queryWrapper);
|
|
|
+ int count = 0;
|
|
|
+ List<IdenFaceImage> idenFaceImageList = this.idenFaceImageService.list(queryWrapper);
|
|
|
+ if(idenFaceImageList != null){
|
|
|
+ count = idenFaceImageList.size();
|
|
|
+ }
|
|
|
if (count >= continueDays) { //连续超过7天,满足预警
|
|
|
|
|
|
//查询是不是已经有预警人员数据了
|