| | |
| | | package com.doumee.service.business.impl.hksync; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.config.DataSyncConfig; |
| | | import com.doumee.core.erp.model.openapi.response.erp.ERPApiResponse; |
| | | import com.doumee.core.erp.model.openapi.response.erp.ErpUserListResponse; |
| | | import com.doumee.core.haikang.model.HKConstants; |
| | | import com.doumee.core.haikang.model.param.BaseResponse; |
| | | import com.doumee.core.haikang.model.param.request.*; |
| | | import com.doumee.core.haikang.model.param.request.event.acs.EventAcsInfoRequest; |
| | | import com.doumee.core.haikang.model.param.request.event.acs.EventAcsRequest; |
| | | import com.doumee.core.haikang.model.param.request.event.acs.EventDeviceDataRequest; |
| | | import com.doumee.core.haikang.model.param.request.event.base.EventBaseInfoRequest; |
| | | import com.doumee.core.haikang.model.param.request.event.base.EventBaseRequest; |
| | | import com.doumee.core.haikang.model.param.request.event.parks.*; |
| | | import com.doumee.core.haikang.model.param.request.event.visit.*; |
| | | import com.doumee.core.haikang.model.param.respose.AuthResultPageDetailResponse; |
| | | import com.doumee.core.haikang.model.param.respose.AuthResultPageResponse; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DESUtil; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.core.utils.*; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.dao.MemberMapper; |
| | | import com.doumee.dao.business.join.VisitsJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.web.reqeust.SavePlatformWarnEventDTO; |
| | | import com.doumee.dao.web.response.platformReport.CarmeraListVO; |
| | | import com.doumee.service.business.VisitsService; |
| | | import com.doumee.service.business.impl.JkCabinetGridServiceImpl; |
| | | import com.doumee.service.business.impl.PlatformWarnEventServiceImpl; |
| | | import com.doumee.service.business.third.TmsService; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.request.TmsOrderInfoRequest; |
| | | import com.doumee.service.business.third.model.response.TmsOrderInfoResponse; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | import java.util.Date; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private PlatformLogMapper platformLogMapper; |
| | | @Autowired |
| | | private PlatformWarnEventServiceImpl platformWarnEventService; |
| | | @Autowired |
| | | private WarningMapper warningMapper; |
| | | @Autowired |
| | | private WarningEventMapper warningEventMapper; |
| | | @Autowired |
| | | private WarningRuleMapper warningRuleMapper; |
| | | @Autowired |
| | | private WarningPushMapper warningPushMapper; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | if(delRetentionLis.size()>0){ |
| | | //先删除原有的在场人员(内部人员) |
| | | //@ApiModelProperty(value = "类型 0劳务访客 1普通访客 2内部员工 3车辆信息 4相关方人员 5货运司机 ") |
| | | retentionMapper.delete(new UpdateWrapper<Retention>().lambda() |
| | | .eq(Retention::getType,Constants.memberType.internal) |
| | | .ne(Retention::getType,Constants.THREE) |
| | | .in(Retention::getMemberId,delRetentionLis)); |
| | | } |
| | | if(retentionList.size()>0){ |
| | |
| | | delRetentionLis.add(member.getId()); |
| | | if( Constants.formatIntegerNum(request.getData().getExtEventInOut()) == Constants.ONE){ |
| | | //如果是进门,录入人员的在场数据记录 |
| | | retentionList.add(getRetentionModelByRequest(member,request)); |
| | | if(Constants.equalsInteger(member.getCompanyType(),Constants.ONE)){ |
| | | record.setMemberType(Constants.RetentionMemberType.internalMember); |
| | | inoutDayCount.setInSelfMemberNum(Constants.formatIntegerNum(inoutDayCount.getInSelfMemberNum())+1);//内部人员入场人次 |
| | |
| | | record.setMemberType(Constants.RetentionMemberType.relMember); |
| | | inoutDayCount.setInOtherMemberNum(Constants.formatIntegerNum(inoutDayCount.getInOtherMemberNum())+1);//相关方入场人次 |
| | | } |
| | | retentionList.add(getRetentionModelByRequest(member,request,record.getMemberType())); |
| | | }else{ |
| | | if(Constants.equalsInteger(member.getCompanyType(),Constants.ONE)){ |
| | | record.setMemberType(Constants.RetentionMemberType.internalMember); |
| | |
| | | event.setExtEventAlarmOutID(request.getData().getExtEventAlarmOutID()); |
| | | event.setExtEventAlarmInID(request.getData().getExtEventAlarmInID()); |
| | | event.setExtAccessChannel(request.getData().getExtAccessChannel()); |
| | | //通道事件信息 |
| | | //通道事件信息` |
| | | if(request.getData().getExtEventCustomerNumInfo() !=null){ |
| | | event.setTotalTimes(request.getData().getExtEventCustomerNumInfo().getTotalTimes()); |
| | | event.setEntryTimes(request.getData().getExtEventCustomerNumInfo().getEntryTimes()); |
| | |
| | | * @param request |
| | | * @return |
| | | */ |
| | | private Retention getRetentionModelByRequest(Member member, EventAcsInfoRequest request) { |
| | | private Retention getRetentionModelByRequest(Member member, EventAcsInfoRequest request,int memberType) { |
| | | Retention retention = new Retention(); |
| | | retention.setIsdeleted(Constants.ZERO); |
| | | retention.setCreateDate(DateUtil.getISO8601DateByStr(request.getHappenTime())); |
| | |
| | | retention.setIdcardDecode(member.getIdcardDecode()); |
| | | retention.setName(member.getName()); |
| | | retention.setBirthday(member.getBirthday()); |
| | | retention.setType(member.getType()); |
| | | retention.setType(memberType); |
| | | retention.setCompanyId(member.getCompanyId()); |
| | | retention.setCompanyName(member.getCompanyName()); |
| | | retention.setEventCode(request.getData().getExtEventCode()+""); |
| | |
| | | return null; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 海康事件推送 |
| | | * @param param |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String dealSecurityEvent(EventBaseRequest param, HttpServletResponse response, JkCabinetGridServiceImpl impl){ |
| | | log.info("【海康通用事件推送】==========开始=======:\n"+JSONObject.toJSONString(param)); |
| | | String result = null; |
| | | try { |
| | | if(param == null || param.getParams() == null || param.getParams().getEvents()==null){ |
| | | return null; |
| | | } |
| | | //门禁事件集合 |
| | | List<EventBaseInfoRequest> events = param.getParams().getEvents(); |
| | | for(EventBaseInfoRequest request : events){ |
| | | if( request.getEventType() == null){ |
| | | continue; |
| | | } |
| | | Warning warning = warningMapper.selectOne(new QueryWrapper<Warning>().lambda() |
| | | .eq(Warning::getIsdeleted,Constants.ZERO) |
| | | .eq(Warning::getCode, request.getEventType()).last("limit 1")); |
| | | Constants.WarningConfig warningConfig = Constants.WarningConfig.getConfig(request.getEventType()); |
| | | if(Objects.nonNull(warning)){ |
| | | WarningEvent warningEvent = new WarningEvent(); |
| | | warningEvent.setCreateDate(new Date()); |
| | | warningEvent.setEditDate(warningEvent.getCreateDate()); |
| | | warningEvent.setIsdeleted(Constants.ZERO); |
| | | warningEvent.setTitle(warning.getName()); |
| | | warningEvent.setContent(warning.getName() +"-"+ request.getSrcName()); |
| | | warningEvent.setStatus(Constants.ZERO); |
| | | warningEvent.setEventId(request.getEventId()); |
| | | warningEvent.setEventType(request.getEventType().toString()); |
| | | warningEvent.setHappenTime(request.getHappenTime()); |
| | | if(Objects.nonNull(request.getData())){ |
| | | warningEvent.setJsonContent(JSONObject.toJSONString(request)); |
| | | } |
| | | warningEvent.setSrcIndex(request.getSrcIndex()); |
| | | warningEvent.setSrcType(request.getSrcType()); |
| | | warningEvent.setSrcName(request.getSrcName()); |
| | | warningEvent.setWarningId(warning.getId()); |
| | | warningEvent.setDeviceId(request.getSrcIndex()); |
| | | warningEvent.setRegion(this.getRegionsName(warningEvent.getSrcIndex(),warning.getType())); |
| | | warningEventMapper.insert(warningEvent); |
| | | |
| | | if(Objects.nonNull(warningConfig)){ |
| | | List<WarningEvent> warningEventList = new ArrayList<>();//时间间隔内的全部事件记录 |
| | | List<Integer> ruleIdList = impl.processWarnFrontWithEvent(warningConfig,warningEventList); |
| | | Boolean falg = true; |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ruleIdList)){ |
| | | Set<Integer> ruleIdSet = new HashSet<>(ruleIdList); |
| | | for (Integer ruleId:ruleIdSet) { |
| | | WarningRule warningRule = warningRuleMapper.selectById(ruleId); |
| | | if (Objects.isNull(warningRule)) { |
| | | break; |
| | | } |
| | | List<Member> memberList = impl.getWarningRuleMemberList(warningRule); |
| | | try { |
| | | WarningPush warningPush = new WarningPush(); |
| | | warningPush.setCreateDate(new Date()); |
| | | warningPush.setIsdeleted(Constants.ZERO); |
| | | warningPush.setWarningId(warning.getId()); |
| | | warningPush.setTitle(warningConfig.getInfo()); |
| | | String content = warningEvent.getContent(); |
| | | warningPush.setContent(content); |
| | | warningPush.setStatus(Constants.ZERO); |
| | | warningPush.setPushType(Constants.ZERO); |
| | | warningPush.setRegion( warningEvent.getRegion()); |
| | | if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(memberList)) { |
| | | warningPush.setMemberIds( |
| | | StringUtils.join(memberList.stream().map(i -> i.getId()).collect(Collectors.toList()), ",") |
| | | ); |
| | | warningPush.setMemberNames(StringUtils.join(memberList.stream().map(i -> i.getName()).collect(Collectors.toList()), ",") |
| | | ); |
| | | } |
| | | if(Constants.equalsInteger(warningRule.getMemberNotice(),Constants.ONE)){ |
| | | // Boolean noticeFlag = dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), |
| | | // StringUtils.join(memberList.stream().filter(i->StringUtils.isNotBlank(i.getDdId())).map(i->i.getDdId()).collect(Collectors.toList()),","), |
| | | // dingTalk.getAlarmNoticeMsg(warningPush.getRegion(),DateUtil.getCurrDateTime(),warningConfig.getInfo())); |
| | | // warningPush.setStatus(noticeFlag?Constants.ONE:Constants.TWO); |
| | | } |
| | | impl.sendDeviceNotice(warningRule); |
| | | warningPushMapper.insert(warningPush); |
| | | if(Constants.equalsInteger( request.getEventType(),Constants.WarningConfig.AF_RYLG.getKey())){ |
| | | //如果是人员离岗事件 |
| | | dealNoticeTelecomEvent(param,request,warningEventList); |
| | | } |
| | | }catch (Exception e){ |
| | | falg = false; |
| | | warningEvent.setStatus(Constants.TWO); |
| | | warningEventMapper.updateById(warningEvent); |
| | | } |
| | | } |
| | | } |
| | | if(!falg){ |
| | | warningEvent.setStatus(Constants.ONE); |
| | | warningEventMapper.updateById(warningEvent); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | log.info("【海康通用事件推送】========成功======="); |
| | | }catch (Exception e){ |
| | | |
| | | log.error("【海康通用事件推送】========失败=======:\n"+e.getMessage()); |
| | | } |
| | | saveInterfaceLog(param,"/business/hksync/push/notice",result,true); |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 通知电信接口(离岗事件) |
| | | * @param list |
| | | */ |
| | | private void dealNoticeTelecomEvent(EventBaseRequest param,EventBaseInfoRequest request ,List<WarningEvent> list) { |
| | | try { |
| | | log.error("========通知其他三方地址离岗事件开始:"+list.size()); |
| | | Thread t1=new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | //定制key |
| | | param.getParams().setEvents(new ArrayList<>()); |
| | | int key = Constants.WarningConfig.AF_RYLG_CUSTOM.getKey(); |
| | | List<EventBaseInfoRequest> noticeList = new ArrayList<>(); |
| | | TypeReference typeReference = |
| | | new TypeReference<EventBaseInfoRequest>(){}; |
| | | request.setEventType(key);//更换事件类型 |
| | | noticeList.add(request); |
| | | for(WarningEvent c : list){ |
| | | if(StringUtils.equals( c.getEventType(),Constants.WarningConfig.AF_RYLG.getKey()+"")) { |
| | | if(StringUtils.isNotBlank(c.getJsonContent())){ |
| | | EventBaseInfoRequest infoRequest =JSONObject.parseObject(c.getJsonContent(),typeReference.getType()); |
| | | noticeList.add(infoRequest); |
| | | } |
| | | } |
| | | } |
| | | for(EventBaseInfoRequest t : noticeList){ |
| | | if(t.getData() == null){ |
| | | t.setData(new JSONObject()); |
| | | } |
| | | JSONObject at = t.getData().getJSONObject("AIOPResultData"); |
| | | if(at == null){ |
| | | at = new JSONObject(); |
| | | t.getData().put("AIOPResultData",at); |
| | | } |
| | | if(StringUtils.isBlank(at.getString("imageUrl"))){ |
| | | t.getData().getJSONObject("AIOPResultData").put("imageUrl",""); |
| | | } |
| | | if(StringUtils.isBlank(at.getString("imageUrl"))){ |
| | | t.getData().getJSONObject("AIOPResultData").put("imageUrl",""); |
| | | } |
| | | if(StringUtils.equals(t.getEventId(),request.getEventId())){ |
| | | continue; |
| | | } |
| | | request.setSrcIndex(StringUtils.defaultString(request.getSrcIndex(),"")+","+StringUtils.defaultString(t.getSrcIndex(),"")); |
| | | request.setSrcName(StringUtils.defaultString(request.getSrcName(),"")+","+StringUtils.defaultString(t.getSrcName(),"")); |
| | | request.getData().getJSONObject("AIOPResultData").put("imageUrl",StringUtils.defaultString( request.getData().getJSONObject("AIOPResultData").getString("imageUrl"),"") |
| | | +","+StringUtils.defaultString( t.getData().getJSONObject("AIOPResultData").getString("imageUrl"),"")); |
| | | } |
| | | param.getParams().getEvents().add(request); |
| | | String thirdpath =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_THIRD_URL).getCode(); |
| | | if(StringUtils.isNotBlank(thirdpath)){ |
| | | String[] ss = thirdpath.split(";"); |
| | | for(String s : ss){ |
| | | String response = HttpsUtil.postJson(s,JSONObject.toJSONString(param)); |
| | | log.error("========通知其他三方地址离岗事件已推送,结果:"+response); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | t1.start(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | //定制key |
| | | EventBaseRequest param = JSONObject.parseObject( "{\n" + |
| | | " \"method\": \"OnEventNotify\",\n" + |
| | | " \"params\": {\n" + |
| | | " \"ability\": \"event_ai_open_platform\",\n" + |
| | | " \"events\": [\n" + |
| | | " {\n" + |
| | | " \"data\": {\n" + |
| | | " \"AIOPResultData\": {\n" + |
| | | " \"height\": \"1440\",\n" + |
| | | " \"imageUrl\": \"http://10.49.39.17:6120/pic?8dc0=1c00=2b-0ipf1ao620d404*-o7=5221*5l3=2062023786t6=910p*==217**=s153*4b4d47e2970d391*6-17odf2-l20a2300=df*&iTk=MmQwODU4YjM4YmMxM2RmMzlhYmRiMDNhMTRhZjEzMGIxZmUzYjdmYTgxMjY3ZjkxMDI2OWE1ZWIwY2ZiNDI5MDp7ImFrIjoiMjU4NjgyODIifQ==\",\n" + |
| | | " \"nodeId\": 4,\n" + |
| | | " \"rect\": null,\n" + |
| | | " \"ruleId\": 1,\n" + |
| | | " \"ruleName\": [\n" + |
| | | " \"新增规则\"\n" + |
| | | " ],\n" + |
| | | " \"targetAttrs\": {\n" + |
| | | " \"IACPicUp\": \"@1766038022325@1766038022331@2@\",\n" + |
| | | " \"aimmsModelId\": \"H930_MODEL_IPS_COORDINATION\",\n" + |
| | | " \"cameraIndexCode\": \"34a23fe1367b4e138e4ccde4c0b51038\",\n" + |
| | | " \"deviceIndexCode\": \"e330681016434de6975ed9400f834986\",\n" + |
| | | " \"imageServerCode\": \"0803dbe0-c007-4dcf-abef-424da37d58f9\",\n" + |
| | | " \"picServerIndexCode\": \"0803dbe0-c007-4dcf-abef-424da37d58f9\",\n" + |
| | | " \"recognitionSign\": 1\n" + |
| | | " },\n" + |
| | | " \"taskID\": \"50230c815af14c54bbc3c6891fab0113\",\n" + |
| | | " \"taskType\": \"AIOP_Video\",\n" + |
| | | " \"triggerType\": 1073758209,\n" + |
| | | " \"unionTargets\": {\n" + |
| | | " \"childTargets\": [\n" + |
| | | "\n" + |
| | | " ],\n" + |
| | | " \"confidence\": 0,\n" + |
| | | " \"id\": 0,\n" + |
| | | " \"region\": {\n" + |
| | | " \"rect\": {\n" + |
| | | " \"h\": \"0.980469\",\n" + |
| | | " \"w\": \"0.980469\",\n" + |
| | | " \"x\": \"0.007812\",\n" + |
| | | " \"y\": \"0.007812\"\n" + |
| | | " }\n" + |
| | | " },\n" + |
| | | " \"type\": 0\n" + |
| | | " },\n" + |
| | | " \"url\": null,\n" + |
| | | " \"width\": \"2560\"\n" + |
| | | " },\n" + |
| | | " \"aiopMsgType\": 2,\n" + |
| | | " \"channelID\": 5,\n" + |
| | | " \"channelName\": \"消防控制室\",\n" + |
| | | " \"dataProcInterval\": \"14\",\n" + |
| | | " \"dataType\": \"AIOPDetection\",\n" + |
| | | " \"dateTime\": \"2025-12-18T14:07:00.000+08:00\",\n" + |
| | | " \"eventDescription\": \"AI Open Platform Video Detection\",\n" + |
| | | " \"eventType\": \"AIOPResultData\",\n" + |
| | | " \"ipAddress\": \"192.168.15.224\",\n" + |
| | | " \"picUploadInterval\": \"6\",\n" + |
| | | " \"portNo\": 8000,\n" + |
| | | " \"presetIndex\": 0,\n" + |
| | | " \"recvTime\": \"2025-12-18T14:07:02.320+08:00\",\n" + |
| | | " \"sendTime\": \"2025-12-18T14:07:02.334+08:00\",\n" + |
| | | " \"targetAttrs\": {\n" + |
| | | " \"IACPicUp\": \"@1766038022325@1766038022331@2@\",\n" + |
| | | " \"cameraIndexCode\": \"34a23fe1367b4e138e4ccde4c0b51038\",\n" + |
| | | " \"deviceIndexCode\": \"e330681016434de6975ed9400f834986\",\n" + |
| | | " \"imageServerCode\": \"0803dbe0-c007-4dcf-abef-424da37d58f9\",\n" + |
| | | " \"picServerIndexCode\": \"0803dbe0-c007-4dcf-abef-424da37d58f9\",\n" + |
| | | " \"recognitionSign\": 1\n" + |
| | | " },\n" + |
| | | " \"taskID\": \"50230c815af14c54bbc3c6891fab0113\",\n" + |
| | | " \"url\": \"http://10.49.39.17:6120/pic?8dc0=1c00=2b-0ipf1ao620d404*-o7=5221*5l3=2062023786t6=910p*==217**=s153*4b4d47e2970d391*6-17odf2-l20a2300=df*&iTk=MmQwODU4YjM4YmMxM2RmMzlhYmRiMDNhMTRhZjEzMGIxZmUzYjdmYTgxMjY3ZjkxMDI2OWE1ZWIwY2ZiNDI5MDp7ImFrIjoiMjU4NjgyODIifQ==\"\n" + |
| | | " },\n" + |
| | | " \"eventId\": \"20C92544-6F9B-B74C-963B-93C6C6BB6FCF\",\n" + |
| | | " \"eventType\": 422000001,\n" + |
| | | " \"happenTime\": \"2025-12-18T14:07:00.000+08:00\",\n" + |
| | | " \"srcIndex\": \"34a23fe1367b4e138e4ccde4c0b51038\",\n" + |
| | | " \"srcName\": \"消防控制室\",\n" + |
| | | " \"srcParentIndex\": \"e330681016434de6975ed9400f834986\",\n" + |
| | | " \"srcType\": \"camera\",\n" + |
| | | " \"status\": 0,\n" + |
| | | " \"timeout\": 0\n" + |
| | | " } \n" + |
| | | " ],\n" + |
| | | " \"quids\": [\n" + |
| | | " \"admin\"\n" + |
| | | " ],\n" + |
| | | " \"sendTime\": \"2025-12-18T14:07:02.335+08:00\"\n" + |
| | | " }\n" + |
| | | "}", EventBaseRequest.class); |
| | | EventBaseInfoRequest request = param.getParams().getEvents().get(0); |
| | | List<WarningEvent> list = new ArrayList<>(); |
| | | WarningEvent request1 = new WarningEvent(); |
| | | BeanUtils.copyProperties(request,request1); |
| | | request1.setSrcName("房间1"); |
| | | request1.setEventType(request.getEventType().toString()); |
| | | request1.setSrcIndex("2"); |
| | | request1.setJsonContent("{\n" + |
| | | " \"data\": {\n" + |
| | | " \"AIOPResultData\": {\n" + |
| | | " \"height\": \"1440\",\n" + |
| | | " \"imageUrl\": \"http://10.49.39.17:6120/pic?2.png\",\n" + |
| | | " \"nodeId\": 4,\n" + |
| | | " \"rect\": null,\n" + |
| | | " \"ruleId\": 1,\n" + |
| | | " \"ruleName\": [\n" + |
| | | " \"新增规则\"\n" + |
| | | " ],\n" + |
| | | " \"targetAttrs\": {\n" + |
| | | " \"IACPicUp\": \"@1766038022325@1766038022331@2@\",\n" + |
| | | " \"aimmsModelId\": \"H930_MODEL_IPS_COORDINATION\",\n" + |
| | | " \"cameraIndexCode\": \"34a23fe1367b4e138e4ccde4c0b51038\",\n" + |
| | | " \"deviceIndexCode\": \"e330681016434de6975ed9400f834986\",\n" + |
| | | " \"imageServerCode\": \"0803dbe0-c007-4dcf-abef-424da37d58f9\",\n" + |
| | | " \"picServerIndexCode\": \"0803dbe0-c007-4dcf-abef-424da37d58f9\",\n" + |
| | | " \"recognitionSign\": 1\n" + |
| | | " },\n" + |
| | | " \"taskID\": \"50230c815af14c54bbc3c6891fab0113\",\n" + |
| | | " \"taskType\": \"AIOP_Video\",\n" + |
| | | " \"triggerType\": 1073758209,\n" + |
| | | " \"unionTargets\": {\n" + |
| | | " \"childTargets\": [\n" + |
| | | "\n" + |
| | | " ],\n" + |
| | | " \"confidence\": 0,\n" + |
| | | " \"id\": 0,\n" + |
| | | " \"region\": {\n" + |
| | | " \"rect\": {\n" + |
| | | " \"h\": \"0.980469\",\n" + |
| | | " \"w\": \"0.980469\",\n" + |
| | | " \"x\": \"0.007812\",\n" + |
| | | " \"y\": \"0.007812\"\n" + |
| | | " }\n" + |
| | | " },\n" + |
| | | " \"type\": 0\n" + |
| | | " },\n" + |
| | | " \"url\": null,\n" + |
| | | " \"width\": \"2560\"\n" + |
| | | " },\n" + |
| | | " \"aiopMsgType\": 2,\n" + |
| | | " \"channelID\": 5,\n" + |
| | | " \"channelName\": \"消防控制室\",\n" + |
| | | " \"dataProcInterval\": \"14\",\n" + |
| | | " \"dataType\": \"AIOPDetection\",\n" + |
| | | " \"dateTime\": \"2025-12-18T14:07:00.000+08:00\",\n" + |
| | | " \"eventDescription\": \"AI Open Platform Video Detection\",\n" + |
| | | " \"eventType\": \"AIOPResultData\",\n" + |
| | | " \"ipAddress\": \"192.168.15.224\",\n" + |
| | | " \"picUploadInterval\": \"6\",\n" + |
| | | " \"portNo\": 8000,\n" + |
| | | " \"presetIndex\": 0,\n" + |
| | | " \"recvTime\": \"2025-12-18T14:07:02.320+08:00\",\n" + |
| | | " \"sendTime\": \"2025-12-18T14:07:02.334+08:00\",\n" + |
| | | " \"targetAttrs\": {\n" + |
| | | " \"IACPicUp\": \"@1766038022325@1766038022331@2@\",\n" + |
| | | " \"cameraIndexCode\": \"34a23fe1367b4e138e4ccde4c0b51038\",\n" + |
| | | " \"deviceIndexCode\": \"e330681016434de6975ed9400f834986\",\n" + |
| | | " \"imageServerCode\": \"0803dbe0-c007-4dcf-abef-424da37d58f9\",\n" + |
| | | " \"picServerIndexCode\": \"0803dbe0-c007-4dcf-abef-424da37d58f9\",\n" + |
| | | " \"recognitionSign\": 1\n" + |
| | | " },\n" + |
| | | " \"taskID\": \"50230c815af14c54bbc3c6891fab0113\",\n" + |
| | | " \"url\": \"http://10.49.39.17:6120/pic?8dc0=1c00=2b-0ipf1ao620d404*-o7=5221*5l3=2062023786t6=910p*==217**=s153*4b4d47e2970d391*6-17odf2-l20a2300=df*&iTk=MmQwODU4YjM4YmMxM2RmMzlhYmRiMDNhMTRhZjEzMGIxZmUzYjdmYTgxMjY3ZjkxMDI2OWE1ZWIwY2ZiNDI5MDp7ImFrIjoiMjU4NjgyODIifQ==\"\n" + |
| | | " },\n" + |
| | | " \"eventId\": \"20C92544-6F9B-B7-93C6C6BB6FCF\",\n" + |
| | | " \"eventType\": 422000001,\n" + |
| | | " \"happenTime\": \"2025-12-18T14:07:00.000+08:00\",\n" + |
| | | " \"srcIndex\": \"34a23fe1367b4e138e4ccde4c0b51038\",\n" + |
| | | " \"srcName\": \"消防控制室2\",\n" + |
| | | " \"srcParentIndex\": \"2\",\n" + |
| | | " \"srcType\": \"camera\",\n" + |
| | | " \"status\": 0,\n" + |
| | | " \"timeout\": 0\n" + |
| | | " }"); |
| | | list.add(request1); |
| | | request1 = new WarningEvent(); |
| | | BeanUtils.copyProperties(request,request1); |
| | | request1.setEventType(request.getEventType().toString()); |
| | | request1.setSrcName("房间2"); |
| | | request1.setSrcIndex("3"); |
| | | list.add(request1); |
| | | param.getParams().setEvents(new ArrayList<>()); |
| | | int key = Constants.WarningConfig.AF_RYLG_CUSTOM.getKey(); |
| | | List<EventBaseInfoRequest> noticeList = new ArrayList<>(); |
| | | TypeReference typeReference = |
| | | new TypeReference<EventBaseInfoRequest>(){}; |
| | | request.setEventType(key);//更换事件类型 |
| | | noticeList.add(request); |
| | | for(WarningEvent c : list){ |
| | | if(StringUtils.equals( c.getEventType(),Constants.WarningConfig.AF_RYLG.getKey()+"")) { |
| | | if(StringUtils.isNotBlank(c.getJsonContent())){ |
| | | EventBaseInfoRequest infoRequest =JSONObject.parseObject(c.getJsonContent(),typeReference.getType()); |
| | | noticeList.add(infoRequest); |
| | | } |
| | | } |
| | | } |
| | | for(EventBaseInfoRequest t : noticeList){ |
| | | if(t.getData() == null){ |
| | | t.setData(new JSONObject()); |
| | | } |
| | | JSONObject at = t.getData().getJSONObject("AIOPResultData"); |
| | | if(at == null){ |
| | | at = new JSONObject(); |
| | | t.getData().put("AIOPResultData",at); |
| | | } |
| | | if(StringUtils.isBlank(at.getString("imageUrl"))){ |
| | | t.getData().getJSONObject("AIOPResultData").put("imageUrl",""); |
| | | } |
| | | if(StringUtils.isBlank(at.getString("imageUrl"))){ |
| | | t.getData().getJSONObject("AIOPResultData").put("imageUrl",""); |
| | | } |
| | | if(StringUtils.equals(t.getEventId(),request.getEventId())){ |
| | | continue; |
| | | } |
| | | request.setSrcIndex(StringUtils.defaultString(request.getSrcIndex(),"")+","+StringUtils.defaultString(t.getSrcIndex(),"")); |
| | | request.setSrcName(StringUtils.defaultString(request.getSrcName(),"")+","+StringUtils.defaultString(t.getSrcName(),"")); |
| | | request.getData().getJSONObject("AIOPResultData").put("imageUrl",StringUtils.defaultString( request.getData().getJSONObject("AIOPResultData").getString("imageUrl"),"") |
| | | +","+StringUtils.defaultString( t.getData().getJSONObject("AIOPResultData").getString("imageUrl"),"")); |
| | | } |
| | | param.getParams().getEvents().add(request); |
| | | String thirdpath ="http://www.doumee.com"; |
| | | if(StringUtils.isNotBlank(thirdpath)){ |
| | | String[] ss = thirdpath.split(";"); |
| | | for(String s : ss){ |
| | | String t =JSONObject.toJSONString(param); |
| | | log.error("========通知其他三方地址离岗事件已推送,结果:"+t ); |
| | | String response = HttpsUtil.postJson(s,JSONObject.toJSONString(param)); |
| | | // log.error("========通知其他三方地址离岗事件已推送,结果:"+response); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String,Object> stringRedisTemplate; |
| | | |
| | | public String getRegionsName(String srcIndex,Integer warningType){ |
| | | log.error("【匹配设备与区域关系信息】========开始=======:"+srcIndex); |
| | | String regionName = "未知区域"; |
| | | if(StringUtils.isBlank(srcIndex)){ |
| | | return regionName; |
| | | } |
| | | try{ |
| | | if(Constants.equalsInteger(warningType,Constants.ZERO)){ |
| | | List<CarmeraListVO> carmeraListVOList = (List<CarmeraListVO>) stringRedisTemplate.opsForValue().get(Constants.RedisKeys.HK_CAMERAS);//所有监控点数据 |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(carmeraListVOList)){ |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(carmeraListVOList)){ |
| | | for (CarmeraListVO c:carmeraListVOList) { |
| | | if(c.getIndexCode().equals(srcIndex)){ |
| | | log.error("【监控区域匹配结果】===============:"+c.getRegionName()); |
| | | return c.getRegionName(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | List<CarmeraListVO> fireDeviceListVOList = (List<CarmeraListVO>) stringRedisTemplate.opsForValue().get(Constants.RedisKeys.HK_FIRE_DEVICE);//所有消防设备数据 |
| | | List<CarmeraListVO> sensorListVOList = (List<CarmeraListVO>) stringRedisTemplate.opsForValue().get(Constants.RedisKeys.HK_SENSOR);//所有传感器 |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(fireDeviceListVOList)){ |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(fireDeviceListVOList)){ |
| | | for (CarmeraListVO c:fireDeviceListVOList) { |
| | | if(c.getIndexCode().equals(srcIndex)){ |
| | | log.error("【消防区域匹配结果】===============:"+c.getRegionName()); |
| | | return c.getRegionName(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(sensorListVOList)){ |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(sensorListVOList)){ |
| | | for (CarmeraListVO c:sensorListVOList) { |
| | | if(c.getIndexCode().equals(srcIndex)){ |
| | | log.error("【传感器区域匹配结果】==============:"+c.getRegionName()); |
| | | return c.getRegionName(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | log.error("【匹配设备与区域关系信息】========结束=======:"+srcIndex); |
| | | return regionName; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 海康访客事件推送 |
| | |
| | | updateVistis.setOutInfo("访客正常签离"); |
| | | } |
| | | delRetentionLis.add(visits.getMemberId()); |
| | | }else{ |
| | | //如果人员信息存在,切是访客通行,则删除之前的所有进场数据(无论此次推送是进厂还是出场推送事件) |
| | | }else if(!(request.getData().getParamValues()!=null |
| | | && StringUtils.isNotBlank(request.getData().getParamValues().getPlateNos()) |
| | | && StringUtils.isNotBlank(request.getData().getParamValues().getParkIndex()))){ |
| | | //只处理访客门禁通行通行, |
| | | //如果人员信息存在,则删除之前的所有进场数据(无论此次推送是进厂还是出场推送事件) |
| | | delRetentionLis.add(visits.getMemberId()); |
| | | InoutRecord record = new InoutRecord(); |
| | | record.setDeviceName((request.getData()!=null &&request.getData().getParamValues()!=null)? |
| | |
| | | } |
| | | if( request.getData().getParamValues()!=null |
| | | && StringUtils.isNotBlank(request.getData().getParamValues().getPlateNos()) |
| | | && StringUtils.isNotBlank(request.getData().getParamValues().getParkIndex())){ |
| | | && StringUtils.isNotBlank(request.getData().getParamValues().getParkIndex())) { |
| | | //如果是停车场事件,记录车辆类型 |
| | | Category category = null; |
| | | record.setCarCode(request.getData().getParamValues().getPlateNos()); |
| | | if(StringUtils.isNotBlank(record.getCarCode())){ |
| | | if (StringUtils.isNotBlank(record.getCarCode())) { |
| | | category = categoryMapper.selectJoinOne(Category.class, new MPJLambdaWrapper<Category>() |
| | | .selectAll(Category.class) |
| | | .select("t4.name",Category::getParentName) |
| | | .select("t4.name", Category::getParentName) |
| | | .leftJoin("category t4 on t.parent_id=t4.id") |
| | | .eq(Category::getIsdeleted,Constants.ZERO) |
| | | .eq(Category::getBizType,Constants.RetentionCarType.fkCar) |
| | | .eq(Category::getIsdeleted, Constants.ZERO) |
| | | .eq(Category::getBizType, Constants.RetentionCarType.fkCar) |
| | | .last("limit 1")); |
| | | if(category ==null){ |
| | | if (category == null) { |
| | | category = new Category(); |
| | | category.setName("访客车辆"); |
| | | } |
| | | category.setParentName(StringUtils.defaultString(category.getParentName(),"访客车辆")); |
| | | category.setParentName(StringUtils.defaultString(category.getParentName(), "访客车辆")); |
| | | } |
| | | record.setCarBizType(Constants.RetentionCarType.fkCar); |
| | | record.setCategoryId(category.getId()); |
| | |
| | | record.setCategoryName(category.getName()); |
| | | record.setCategoryParentId(category.getParentId()); |
| | | record.setCategoryParentName(category.getParentName()); |
| | | if(Constants.equalsInteger(record.getInOrOut(),Constants.ONE)){ |
| | | if (Constants.equalsInteger(record.getInOrOut(), Constants.ONE)) { |
| | | record.setRemark("访客跟随车辆离园并自动签离"); |
| | | try { |
| | | //访客申请自动签离 |
| | | visitsService.visitLevelForCarOut(visits); |
| | | }catch (Exception e){ |
| | | log.error("访客跟随车辆出园自动签离失败:==========="+e.getMessage()); |
| | | } catch (Exception e) { |
| | | log.error("访客跟随车辆出园自动签离失败:===========" + e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | inoutRecordList.add(record); |
| | | inoutRecordList.add(record);//进出记录 |
| | | } |
| | | updateVistis.setEditDate(new Date()); |
| | | //更新访客来访或者签离时间信息 |
| | |
| | | String result = null; |
| | | log.info("【海康停车场事件推送】========开始=========:\n"+JSONObject.toJSONString(param)); |
| | | try { |
| | | if(param == null || param.getParams() == null || param.getParams().getEvents()==null){ |
| | | if(param == null |
| | | || param.getParams() == null |
| | | || param.getParams().getEvents()==null){ |
| | | return null; |
| | | } |
| | | //门禁事件集合 |
| | |
| | | carrecord.setCategoryParentId(category.getParentId()); |
| | | } |
| | | } |
| | | //处理自有车自动签到业务 |
| | | dealSelTruckAutoSignBiz(request,event); |
| | | if(Constants.formatIntegerNum(request.getEventType()) == HKConstants.EventTypes.PARK_PASS_IN.getKey()){ |
| | | //处理自有车自动签到业务 |
| | | dealSelTruckAutoSignBiz(request,event); |
| | | //如果是入厂放行 |
| | | delRetentionList.add(event.getPlateNos()); |
| | | Retention dm = new Retention(); |
| | |
| | | event.setCarType(Constants.RetentionCarType.fkCar); |
| | | int index =0; |
| | | carrecord.setCarBizType(Constants.RetentionCarType.fkCar); |
| | | if(1==2){ |
| | | Category category =findCategoryByBizType(Constants.RetentionCarType.fkCar,"访客车辆","访客车辆",categoryList); |
| | | carrecord.setCategoryId(category.getId()); |
| | | carrecord.setCategoryName(StringUtils.defaultString(category.getName(),"访客车辆")); |
| | | carrecord.setCategoryParentName(StringUtils.defaultString(category.getParentName(),"访客车辆")); |
| | | carrecord.setCategoryParentId(category.getParentId()); |
| | | for(Visits v :visitsList){ |
| | | Category category =findCategoryByBizType(Constants.RetentionCarType.fkCar,"访客车辆","访客车辆",categoryList); |
| | | carrecord.setCategoryId(category.getId()); |
| | | carrecord.setCategoryName(StringUtils.defaultString(category.getName(),"访客车辆")); |
| | | carrecord.setCategoryParentName(StringUtils.defaultString(category.getParentName(),"访客车辆")); |
| | | carrecord.setCategoryParentId(category.getParentId()); |
| | | for(Visits v :visitsList){ |
| | | // if(v.getEndtime()!=null && v.getEndtime().getTime() < System.currentTimeMillis()){ |
| | | Retention dm = new Retention(); |
| | | dm.setMemberId(event.getMemberId()); |
| | | dm.setPhone(carrecord.getMemberPhone()); |
| | |
| | | inoutDayCount.setInVisitorNum(Constants.formatIntegerNum(inoutDayCount.getInVisitorNum())+1); |
| | | } |
| | | } |
| | | } |
| | | // } |
| | | } |
| | | } |
| | | if(isCarInOrOutEvent(request) && event.getCarType() !=null && !event.getCarType().equals(Constants.RetentionCarType.fkCar)){ |
| | |
| | | Category category = new Category(); |
| | | category.setName(tempname); |
| | | category.setParentName(pName); |
| | | return null; |
| | | return category; |
| | | } |
| | | |
| | | private void dealSelTruckAutoSignBiz(EventParkInfoRequest request, CarEvent event) { |
| | |
| | | .in(PlatformJob::getStatus, |
| | | Constants.PlatformJobStatus.IN_WAIT.getKey(), |
| | | Constants.PlatformJobStatus.CALLED.getKey(), |
| | | Constants.PlatformJobStatus.WAIT_CALL.getKey(), |
| | | Constants.PlatformJobStatus.WORKING.getKey(), |
| | | Constants.PlatformJobStatus.TRANSFERING.getKey(), |
| | | Constants.PlatformJobStatus.OVER_NUMBER.getKey(), |
| | | Constants.PlatformJobStatus.EXCEPTION.getKey() |
| | | ) |
| | | )==Constants.ZERO){//如果没进行中任务 |
| | |
| | | return model; |
| | | } |
| | | |
| | | /** |
| | | * 记录月台作业日志 |
| | | * @param job |
| | | * @param status |
| | | */ |
| | | @Transactional |
| | | private void dealPlatformJobLogBiz(PlatformJob job,EventPlatformCarsStatusInfoRequest status) { |
| | | platformJobMapper.updateById(job);//更新作业状态 |
| | | PlatformLog log = new PlatformLog(); |
| | | log.setIsdeleted(Constants.ZERO); |
| | | log.setCreateDate(new Date()); |
| | | log.setEditDate(log.getCreateDate()); |
| | | log.setJobId(job.getId()); |
| | | log.setObjId(job.getId()+""); |
| | | if(Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.DONE.getKey())){ |
| | | //如果是作业完成 |
| | | log.setObjType(Constants.PlatformJobLogType.DONE.getKey()); |
| | | log.setTitle(Constants.PlatformJobLogType.DONE.getName()); |
| | | log.setContent(Constants.PlatformJobLogType.DONE.getInfo()); |
| | | //查询最后一次开始作业的日志 |
| | | PlatformLog lastBeginPlatform = platformLogMapper.selectOne(new QueryWrapper<PlatformLog>().lambda() |
| | | .eq(PlatformLog::getIsdeleted,Constants.ZERO) |
| | | .eq(PlatformLog::getObjType,Constants.PlatformJobLogType.WORKING.getKey()) |
| | | .eq(PlatformLog::getJobId,job.getId()) |
| | | .orderByDesc(PlatformLog::getCreateDate) |
| | | .last(" limit 1")); |
| | | String v = Long.toString(job.getDoneDate().getTime() - lastBeginPlatform.getCreateDate().getTime() / 1000) ; |
| | | lastBeginPlatform.setRemark(job.getPlatformId().toString()); |
| | | lastBeginPlatform.setParam3(v); |
| | | lastBeginPlatform.setParam2(DateUtil.getDate(lastBeginPlatform.getCreateDate(),"yyyy-MM-dd HH:mm:ss")); |
| | | platformLogMapper.updateById(lastBeginPlatform);//更新上一次作业的完成时间和作业时长 |
| | | }else{ |
| | | //如果是作业中 |
| | | log.setObjType(Constants.PlatformJobLogType.WORKING.getKey()); |
| | | log.setTitle(Constants.PlatformJobLogType.WORKING.getName()); |
| | | log.setContent(Constants.PlatformJobLogType.WORKING.getInfo()); |
| | | log.setParam1(DateUtil.getDate(log.getCreateDate(),"yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | platformLogMapper.insert(log); |
| | | } |
| | | // /** |
| | | // * 记录月台作业日志 |
| | | // * @param job |
| | | // * @param status |
| | | // */ |
| | | // @Transactional |
| | | // private void dealPlatformJobLogBiz(PlatformJob job,EventPlatformCarsStatusInfoRequest status) { |
| | | // platformJobMapper.updateById(job);//更新作业状态 |
| | | // PlatformLog log = new PlatformLog(); |
| | | // log.setIsdeleted(Constants.ZERO); |
| | | // log.setCreateDate(new Date()); |
| | | // log.setEditDate(log.getCreateDate()); |
| | | // log.setJobId(job.getId()); |
| | | // log.setObjId(job.getId()+""); |
| | | // if(Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.DONE.getKey())){ |
| | | // //如果是作业完成 |
| | | // log.setObjType(Constants.PlatformJobLogType.DONE.getKey()); |
| | | // log.setTitle(Constants.PlatformJobLogType.DONE.getName()); |
| | | // log.setContent(Constants.PlatformJobLogType.DONE.getInfo()); |
| | | // //查询最后一次开始作业的日志 |
| | | // PlatformLog lastBeginPlatform = platformLogMapper.selectOne(new QueryWrapper<PlatformLog>().lambda() |
| | | // .eq(PlatformLog::getIsdeleted,Constants.ZERO) |
| | | // .eq(PlatformLog::getObjType,Constants.PlatformJobLogType.WORKING.getKey()) |
| | | // .eq(PlatformLog::getJobId,job.getId()) |
| | | // .orderByDesc(PlatformLog::getCreateDate) |
| | | // .last(" limit 1")); |
| | | // String v = Long.toString(job.getDoneDate().getTime() - lastBeginPlatform.getCreateDate().getTime() / 1000) ; |
| | | // lastBeginPlatform.setRemark(job.getPlatformId().toString()); |
| | | // lastBeginPlatform.setParam3(v); |
| | | // lastBeginPlatform.setParam2(DateUtil.getDate(lastBeginPlatform.getCreateDate(),"yyyy-MM-dd HH:mm:ss")); |
| | | // platformLogMapper.updateById(lastBeginPlatform);//更新上一次作业的完成时间和作业时长 |
| | | // }else{ |
| | | // //如果是作业中 |
| | | // log.setObjType(Constants.PlatformJobLogType.WORKING.getKey()); |
| | | // log.setTitle(Constants.PlatformJobLogType.WORKING.getName()); |
| | | // log.setContent(Constants.PlatformJobLogType.WORKING.getInfo()); |
| | | // log.setParam1(DateUtil.getDate(log.getCreateDate(),"yyyy-MM-dd HH:mm:ss")); |
| | | // } |
| | | // platformLogMapper.insert(log); |
| | | // } |
| | | |
| | | /** |
| | | * 处理车辆进入错误月台业务逻辑 |