Commit 51789065 authored by 赵啸非's avatar 赵啸非

修改消费海康回调函数

parent 5646614e
package com.mortals.xhx.busiz.web; package com.mortals.xhx.busiz.web;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.HexUtil; import cn.hutool.core.util.HexUtil;
...@@ -9,6 +10,10 @@ import com.alibaba.fastjson.JSON; ...@@ -9,6 +10,10 @@ import com.alibaba.fastjson.JSON;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.util.SecurityUtil; import com.mortals.framework.util.SecurityUtil;
import com.mortals.framework.utils.ServletUtils;
import com.mortals.xhx.common.code.HikEventTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.hik.face.model.req.img.ImgReq;
import com.mortals.xhx.module.hik.face.service.FacePlanService; import com.mortals.xhx.module.hik.face.service.FacePlanService;
import com.mortals.xhx.module.hik.door.model.req.door.DoorEventReq; import com.mortals.xhx.module.hik.door.model.req.door.DoorEventReq;
import com.mortals.xhx.module.hik.door.model.rsp.door.DoorEventDataInfo; import com.mortals.xhx.module.hik.door.model.rsp.door.DoorEventDataInfo;
...@@ -21,14 +26,22 @@ import com.mortals.xhx.module.hik.person.model.req.person.PersonReq; ...@@ -21,14 +26,22 @@ import com.mortals.xhx.module.hik.person.model.req.person.PersonReq;
import com.mortals.xhx.module.hik.person.model.rsp.org.OrgDataInfo; import com.mortals.xhx.module.hik.person.model.rsp.org.OrgDataInfo;
import com.mortals.xhx.module.hik.person.model.rsp.person.PersonDataInfo; import com.mortals.xhx.module.hik.person.model.rsp.person.PersonDataInfo;
import com.mortals.xhx.module.hik.person.service.IHikPersonService; import com.mortals.xhx.module.hik.person.service.IHikPersonService;
import com.mortals.xhx.module.realtime.model.RealtimeDataflowEntity;
import com.mortals.xhx.module.realtime.model.RealtimeDataflowStatEntity; import com.mortals.xhx.module.realtime.model.RealtimeDataflowStatEntity;
import com.mortals.xhx.module.realtime.service.RealtimeDataflowService;
import com.mortals.xhx.module.realtime.service.RealtimeDataflowStatService; import com.mortals.xhx.module.realtime.service.RealtimeDataflowStatService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 设备 * 设备
...@@ -51,6 +64,8 @@ public class TestController { ...@@ -51,6 +64,8 @@ public class TestController {
private FacePlanService facePlanService; private FacePlanService facePlanService;
@Autowired @Autowired
private RealtimeDataflowStatService realtimeDataflowStatService; private RealtimeDataflowStatService realtimeDataflowStatService;
@Autowired
private RealtimeDataflowService realtimeDataflowService;
@GetMapping("webservice") @GetMapping("webservice")
...@@ -158,6 +173,55 @@ public class TestController { ...@@ -158,6 +173,55 @@ public class TestController {
} }
@GetMapping("mockFlowData")
@UnAuth
public String mockFlowData() {
List<RealtimeDataflowEntity> flowEntities = new ArrayList<>();
//模拟构造过去人流数据
DateTime startDateTime = DateUtil.parseDate("2024-03-01");
DateTime endDateTime = DateUtil.date();
Integer subDay = Integer.parseInt(String.valueOf(DateUtil.betweenDay(startDateTime, endDateTime, false)));
for (int i = 0; i <= subDay; i++) {
DateTime date = DateUtil.offsetDay(startDateTime, i);
boolean weekend = DateUtil.isWeekend(date);
if (weekend) {
//周末 默认数据
for (int j = 0; j <= 23; j++) {
RealtimeDataflowStatEntity statEntity = new RealtimeDataflowStatEntity();
statEntity.initAttrValue();
statEntity.setSiteId(1L);
statEntity.setSiteName("宜宾市民中心");
RealtimeDataflowEntity realtimeDataflowEntity = new RealtimeDataflowEntity();
realtimeDataflowEntity.initAttrValue();
realtimeDataflowEntity.setSiteId(1L);
realtimeDataflowEntity.setSiteName("宜宾市民中心");
realtimeDataflowEntity.setDetectTime(DateUtil.offsetHour(date, j));
realtimeDataflowEntity.setDevice(RandomUtil.randomString(10));
realtimeDataflowEntity.setPicUri("");
realtimeDataflowEntity.setEventId(RandomUtil.randomString(10));
realtimeDataflowEntity.setEventType(HikEventTypeEnum.陌生人员识别事件.getValue().longValue());
realtimeDataflowEntity.setCreateUserId(1L);
realtimeDataflowEntity.setCreateTime(DateUtil.offsetHour(date, j));
realtimeDataflowEntity.setCreateUserName("system");
flowEntities.add(realtimeDataflowEntity);
}
}
}
log.info("新增数量:{}", flowEntities.size());
realtimeDataflowService.save(flowEntities);
return "ok";
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String str="admin"; String str="admin";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment