server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -1526,6 +1526,13 @@ ALARM_TEST(10002, "【钥匙柜】酒精测试异常",0), GRID_TIME_OUT_INFO(10003, "【钥匙柜】开门超时未关闭",0), KEY_TIME_OUT_BACK(10004, "【钥匙柜】钥匙超时未归还",0), AF_QYRQ(131588, "【安防事件】区域入侵",1), AF_QUPD(131592, "【安防事件】区域跑动",1), AF_RYLG(131603, "【安防事件】人员离岗",1), AF_KYSCX(131585, "【安防事件】跨越生产线",1), XF_SYBJ(253956, "【消防事件】水压报警",1), XF_HZBJ(253999, "【消防事件】火灾报警",1), XF_YWBJ(254047, "【消防事件】液位报警",1), ; // 成员变量 private int key; @@ -1540,6 +1547,16 @@ } public static WarningConfig getConfig(int index) { for (WarningConfig c : WarningConfig.values()) { if (c.getKey() == index) { return c; } } return null; } public int getKey() { return key; } server/system_timer/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@ spring: profiles: active: pro active: test application: name: systemTimer # 安全配置 server/visits/admin_timer/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@ spring: profiles: active: pro active: test application: name: visitsTimer # 安全配置 server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/HkSyncCloudController.java
@@ -11,6 +11,7 @@ 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.EventAcsRequest; import com.doumee.core.haikang.model.param.request.event.base.EventBaseRequest; import com.doumee.core.haikang.model.param.request.event.parks.EventParkRequest; import com.doumee.core.haikang.model.param.request.event.parks.EventPlatformCarsRequest; import com.doumee.core.haikang.model.param.request.event.parks.EventPlatformRequest; @@ -19,6 +20,7 @@ import com.doumee.core.haikang.model.param.respose.PageRegionInfoResponse; import com.doumee.core.haikang.service.HKService; import com.doumee.dao.web.response.platformReport.CarmeraListVO; import com.doumee.service.business.impl.JkCabinetGridServiceImpl; import com.doumee.service.business.third.BoardService; import com.doumee.service.business.third.model.ApiResponse; import com.doumee.service.business.third.model.LoginUserInfo; @@ -78,6 +80,8 @@ @Autowired private DeviceService deviceService; @Autowired private JkCabinetGridServiceImpl impl; @Autowired private RedisTemplate<String,Object> redisTemplate; @@ -172,14 +176,16 @@ String result = hkSyncPushService.dealVisitEvent(param,response); return ApiResponse.success(result); } @ApiOperation("【海康】其他订阅事件订阅推送对接处理接口") @PostMapping("/push/notice") @LoginNoRequired public ApiResponse pushNotice(@RequestBody EventVisitRequest param, HttpServletResponse response){ String result = hkSyncPushService.dealVisitEvent(param,response); public ApiResponse pushNotice(@RequestBody EventBaseRequest param, HttpServletResponse response){ String result = hkSyncPushService.dealSecurityEvent(param,response,impl); return ApiResponse.success(result); } @ApiOperation("【海康】访客ICCM事件订阅推送对接处理接口") @PostMapping("/push/visitIccm") @LoginNoRequired server/visits/dmvisit_admin/src/main/java/com/doumee/service/impl/HkSyncEventServiceImpl.java
@@ -1,5 +1,6 @@ package com.doumee.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.core.haikang.model.HKConstants; import com.doumee.core.haikang.model.HKTools; @@ -8,9 +9,12 @@ import com.doumee.core.haikang.model.param.respose.OrgInfoResponse; import com.doumee.core.haikang.service.HKService; import com.doumee.core.utils.Constants; import com.doumee.dao.business.WarningMapper; import com.doumee.dao.business.model.Warning; import com.doumee.dao.system.model.SystemDictData; import com.doumee.service.business.InterfaceLogService; import com.doumee.service.business.impl.hksync.HkSyncBaseServiceImpl; import com.github.xiaoymin.knife4j.core.util.CollectionUtils; import com.hikvision.artemis.sdk.config.ArtemisConfig; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -18,6 +22,8 @@ import javax.annotation.PostConstruct; import java.util.Date; import java.util.List; import java.util.stream.Collectors; /** * 海康事件订阅表Service实现 @@ -31,6 +37,8 @@ private SystemDictDataBiz systemDictDataBiz; @Autowired private InterfaceLogService interfaceLogService; @Autowired private WarningMapper warningMapper; @PostConstruct public int initHkConfig(){ @@ -111,11 +119,28 @@ HKService.cancelEventSub(param);//先取消 // HKService.eventSub(param);//月台工作状态事件 try{ List<Warning> warningList = warningMapper.selectList(new QueryWrapper<Warning>().lambda() .eq(Warning::getIsdeleted,Constants.ZERO) .eq(Warning::getStatus,Constants.ONE) .in(Warning::getType,Constants.ZERO,Constants.ONE) .isNotNull(Warning::getCode) ); if(CollectionUtils.isNotEmpty(warningList)){ List<String> codeList = warningList.stream().map(i->i.getCode()).collect(Collectors.toList()); if(CollectionUtils.isNotEmpty(codeList)){ param.setEventDest(path+"/notice"); param.setEventTypes(codeList.stream().map(i->Integer.valueOf(i)).toArray(Integer[]::new)); HKService.cancelEventSub(param);//先取消 HKService.eventSub(param);//安防事件 } } }catch (Exception e){ param.setEventDest(path+"/platform/carstatus"); param.setEventTypes(new Integer[]{HKConstants.EventTypes.PLATFORM_CAR_STATUS.getKey()}); HKService.cancelEventSub(param);//先取消 HKService.eventSub(param);//月台车辆状态事件 } } /** server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/HKConstants.java
@@ -611,7 +611,9 @@ DOOR_FACE_AUTH_FAIL(197163, "人脸认证失败" ), DOOR_FACE_AUTH_SUCCESS(196893, "人脸认证通过" ), PLATFORM_WORKSTATUS(483329, "月台工作状态事件" ), PLATFORM_CAR_STATUS(487425, "月台车辆状态事件" ) PLATFORM_CAR_STATUS(487425, "月台车辆状态事件" ), //todo 暂未提供 SECURITY_STATUS(111111, "安防事件" ) ; // 成员变量 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/ext/HkSyncService.java
@@ -2,9 +2,11 @@ import com.doumee.core.haikang.model.param.request.*; import com.doumee.core.haikang.model.param.request.event.acs.EventAcsRequest; 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.EventVisitIccmRequest; import com.doumee.core.haikang.model.param.request.event.visit.EventVisitRequest; import com.doumee.service.business.impl.JkCabinetGridServiceImpl; import com.doumee.service.business.third.model.LoginUserInfo; import com.doumee.dao.business.model.Device; import com.doumee.dao.business.model.ParkBook; @@ -53,6 +55,8 @@ String dealVisitEvent(EventVisitRequest param, HttpServletResponse response); String dealSecurityEvent(EventBaseRequest param, HttpServletResponse response, JkCabinetGridServiceImpl impl); String dealParkEvent(EventParkRequest param, HttpServletResponse response); String downHKImgs(int type); void startDealPlatformEventImg(); server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetLogServiceImpl.java
@@ -216,70 +216,68 @@ .orderByDesc(JkCabinetLog::getCreateDate); List<JkCabinetLog> jkCabinetLogs = jkCabinetLogMapper.selectJoinList(JkCabinetLog.class,wrapper); if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(jkCabinetLogs)){ List<Integer> ruleIdList = impl.processWarnFront(warningConfig); if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ruleIdList)){ return; } if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ruleIdList)){ return; } for (Integer ruleId:ruleIdList) { WarningRule warningRule = warningRuleMapper.selectById(ruleId); if (Objects.isNull(warningRule)) { continue; } List<Member> memberList = impl.getWarningRuleMemberList(warningRule); if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(memberList)) { return; } for (JkCabinetLog jkCabinetLog:jkCabinetLogs) { String content = "【车辆-"+jkCabinetLog.getCarCode()+"钥匙】由+"+(StringUtils.isNotBlank(jkCabinetLog.getMemberName())?jkCabinetLog.getMemberName():"未知人员")+"借出,超时未归还"; for (JkCabinetLog jkCabinetLog:jkCabinetLogs) { String content = "【车辆-"+jkCabinetLog.getCarCode()+"钥匙】由+"+(StringUtils.isNotBlank(jkCabinetLog.getMemberName())?jkCabinetLog.getMemberName():"未知人员")+"借出,超时未归还"; //存储报警异常记录 WarningEvent warningEvent = new WarningEvent(); warningEvent.setCreateDate(new Date()); warningEvent.setWarningId(warning.getId()); warningEvent.setTitle(warningConfig.getInfo()); warningEvent.setContent(content ); warningEvent.setStatus(Constants.ZERO); warningEvent.setRegion( StringUtils.isNotBlank(jkCabinetLog.getLocation())?jkCabinetLog.getLocation():"未知位置"); warningEventMapper.insert(warningEvent); Boolean falg = false; if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ruleIdList)){ for (Integer ruleId:ruleIdList) { WarningRule warningRule = warningRuleMapper.selectById(ruleId); if (Objects.isNull(warningRule)) { continue; } List<Member> memberList = impl.getWarningRuleMemberList(warningRule); if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(memberList)) { continue; } try { WarningPush warningPush = new WarningPush(); warningPush.setCreateDate(new Date()); warningPush.setIsdeleted(Constants.ZERO); warningPush.setWarningId(warning.getId()); warningPush.setTitle(warningConfig.getInfo()); //存储报警异常记录 WarningEvent warningEvent = new WarningEvent(); warningEvent.setCreateDate(new Date()); warningEvent.setWarningId(warning.getId()); warningEvent.setTitle(warningConfig.getInfo()); warningEvent.setContent(content ); warningEvent.setStatus(Constants.ZERO); warningEvent.setRegion( StringUtils.isNotBlank(jkCabinetLog.getLocation())?jkCabinetLog.getLocation():"未知位置"); warningEventMapper.insert(warningEvent); try { WarningPush warningPush = new WarningPush(); warningPush.setCreateDate(new Date()); warningPush.setIsdeleted(Constants.ZERO); warningPush.setWarningId(warning.getId()); warningPush.setTitle(warningConfig.getInfo()); warningPush.setContent(content); warningPush.setStatus(Constants.ZERO); warningPush.setPushType(Constants.ZERO); warningPush.setRegion(StringUtils.isNotBlank(jkCabinetLog.getLocation()) ? jkCabinetLog.getLocation() : "未知位置"); warningPush.setMemberIds( StringUtils.join(memberList.stream().map(i -> i.getId()).collect(Collectors.toList()), ",") ); 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()), ",") ); //todo 暂时关闭 钉钉通知 // 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(),content)); // warningPush.setStatus(noticeFlag?Constants.ONE:Constants.TWO); warningPushMapper.insert(warningPush); warningEvent.setStatus(Constants.ONE); warningEventMapper.updateById(warningEvent); }catch (Exception e){ warningEvent.setStatus(Constants.TWO); warningEventMapper.updateById(warningEvent); warningPush.setContent(content); warningPush.setStatus(Constants.ZERO); warningPush.setPushType(Constants.ZERO); warningPush.setRegion(StringUtils.isNotBlank(jkCabinetLog.getLocation()) ? jkCabinetLog.getLocation() : "未知位置"); warningPush.setMemberIds( StringUtils.join(memberList.stream().map(i -> i.getId()).collect(Collectors.toList()), ",") ); 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()), ",") ); // todo 暂时关闭 钉钉通知 // 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(),content)); // warningPush.setStatus(noticeFlag?Constants.ONE:Constants.TWO); warningPushMapper.insert(warningPush); falg = true; }catch (Exception e){ warningEvent.setStatus(Constants.TWO); warningEventMapper.updateById(warningEvent); } } } if(falg){ warningEvent.setStatus(Constants.ONE); warningEventMapper.updateById(warningEvent); } server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/WarningServiceImpl.java
@@ -7,6 +7,8 @@ import com.doumee.core.constants.ResponseStatus; import com.doumee.core.dingTalk.DingTalk; import com.doumee.core.exception.BusinessException; import com.doumee.core.haikang.model.param.request.EventSubRequest; import com.doumee.core.haikang.service.HKService; import com.doumee.core.utils.Constants; import com.doumee.core.utils.DateUtil; import com.doumee.core.utils.WeatherUtil; @@ -75,6 +77,23 @@ .eq(Warning::getName,warning.getName()) )>0){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,事件类型已存在,请返回刷新页面查看!"); } if(StringUtils.isNotBlank(warning.getCode())&&Constants.equalsInteger(warning.getType(),Constants.ZERO)||Constants.equalsInteger(warning.getType(),Constants.ONE)){ EventSubRequest eventParam = new EventSubRequest(); String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode(); eventParam.setEventDest(path+"/notice"); try { eventParam.setEventTypes(new Integer[]{Integer.valueOf(warning.getCode())}); }catch (Exception e){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"事件编码错误!"); } HKService.cancelEventSub(eventParam);//先取消 if(Constants.equalsInteger(warning.getStatus(),Constants.ONE)){ HKService.eventSub(eventParam);//安防事件 } } warning.setStatus(Constants.formatIntegerNum(warning.getStatus())); warning.setIsdeleted(Constants.ZERO); warning.setCreator(warning.getLoginUserInfo().getId()); @@ -89,6 +108,23 @@ @Override public void deleteById(Integer id, LoginUserInfo user) { Warning warning = warningMapper.selectById(id); if(Objects.isNull(warning)){ throw new BusinessException(ResponseStatus.DATA_EMPTY); } if(StringUtils.isNotBlank(warning.getCode())&&Constants.equalsInteger(warning.getType(),Constants.ZERO)||Constants.equalsInteger(warning.getType(),Constants.ONE)){ EventSubRequest eventParam = new EventSubRequest(); String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode(); eventParam.setEventDest(path+"/notice"); try { eventParam.setEventTypes(new Integer[]{Integer.valueOf(warning.getCode())}); }catch (Exception e){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"事件编码错误!"); } HKService.cancelEventSub(eventParam);//先取消 } warningMapper.update(null,new UpdateWrapper<Warning>().lambda() .set(Warning::getIsdeleted,Constants.ONE) .set(Warning::getEditor,user.getId()) @@ -124,6 +160,22 @@ .eq(Warning::getName,warning.getName()) )>0){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,事件类型已存在,请返回刷新页面查看!"); } if(StringUtils.isNotBlank(warning.getCode())&&Constants.equalsInteger(warning.getType(),Constants.ZERO)||Constants.equalsInteger(warning.getType(),Constants.ONE)){ EventSubRequest eventParam = new EventSubRequest(); String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode(); eventParam.setEventDest(path+"/notice"); try { eventParam.setEventTypes(new Integer[]{Integer.valueOf(warning.getCode())}); }catch (Exception e){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"事件编码错误!"); } HKService.cancelEventSub(eventParam);//先取消 if(Constants.equalsInteger(warning.getStatus(),Constants.ONE)){ HKService.eventSub(eventParam);//安防事件 } } warning.setEditDate(warning.getCreateDate()); warning.setEditor(warning.getCreator()); warningMapper.updateById(warning); @@ -242,6 +294,22 @@ if(Constants.equalsInteger(model.getStatus(),param.getStatus())){ return; } if(StringUtils.isNotBlank(param.getCode())&&Constants.equalsInteger(model.getType(),Constants.ZERO)||Constants.equalsInteger(model.getType(),Constants.ONE)){ EventSubRequest eventParam = new EventSubRequest(); String path =systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_PUSH_URL).getCode(); eventParam.setEventDest(path+"/notice"); try { eventParam.setEventTypes(new Integer[]{Integer.valueOf(model.getCode())}); }catch (Exception e){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"事件编码错误!"); } HKService.cancelEventSub(eventParam);//先取消 if(Constants.equalsInteger(param.getStatus(),Constants.ONE)){ HKService.eventSub(eventParam);//安防事件 } } model.setStatus(param.getStatus()); model.setEditDate(new Date()); model.setEditor(param.getLoginUserInfo().getId()); @@ -346,9 +414,6 @@ }catch (Exception e){ } } server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncBaseServiceImpl.java
@@ -6,11 +6,13 @@ 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.EventAcsRequest; 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.EventVisitIccmRequest; import com.doumee.core.haikang.model.param.request.event.visit.EventVisitRequest; import com.doumee.core.haikang.model.param.respose.TaskAdditionResponse; import com.doumee.core.haikang.service.HKService; import com.doumee.service.business.impl.JkCabinetGridServiceImpl; import com.doumee.service.business.third.model.LoginUserInfo; import com.doumee.dao.business.model.Device; import com.doumee.dao.business.model.ParkBook; @@ -119,6 +121,11 @@ } @Override public String dealSecurityEvent(EventBaseRequest param, HttpServletResponse response, JkCabinetGridServiceImpl impl){ return null; } @Override public String dealParkEvent(EventParkRequest param, HttpServletResponse response){ return null; } server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java
@@ -11,6 +11,8 @@ 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.service.HKService; @@ -25,6 +27,7 @@ import com.doumee.dao.business.model.Member; import com.doumee.dao.web.reqeust.SavePlatformWarnEventDTO; 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.request.TmsOrderInfoRequest; @@ -101,6 +104,14 @@ private PlatformLogMapper platformLogMapper; @Autowired private PlatformWarnEventServiceImpl platformWarnEventService; @Autowired private WarningMapper warningMapper; @Autowired private WarningEventMapper warningEventMapper; @Autowired private WarningRuleMapper warningRuleMapper; @Autowired private WarningPushMapper warningPushMapper; @@ -339,7 +350,7 @@ 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()); @@ -447,6 +458,122 @@ log.error("【海康访客事件推送】========失败=======:\n"+e.getMessage()); } saveInterfaceLog(param,"/business/hksync/push/visit",result,true); 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){ Warning warning = warningMapper.selectOne(new QueryWrapper<Warning>().lambda() .eq(Warning::getIsdeleted,Constants.ZERO) .eq(Warning::getCode, request.getSrcType()).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()); warningEvent.setJsonContent(request.getData().toJSONString()); warningEvent.setSrcIndex(request.getSrcIndex()); warningEvent.setSrcType(request.getSrcType()); warningEvent.setSrcName(request.getSrcName()); warningEventMapper.insert(warningEvent); if(Objects.nonNull(warningConfig)){ List<Integer> ruleIdList = impl.processWarnFront(warningConfig); Boolean falg = false; if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ruleIdList)){ for (Integer ruleId:ruleIdList) { WarningRule warningRule = warningRuleMapper.selectById(ruleId); if (Objects.isNull(warningRule)) { break; } List<Member> memberList = impl.getWarningRuleMemberList(warningRule); if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(memberList)) { break; } 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); //TODO 根据具体数据对比获取 warningPush.setRegion( "未知位置"); warningPush.setMemberIds( StringUtils.join(memberList.stream().map(i -> i.getId()).collect(Collectors.toList()), ",") ); 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()), ",") ); // todo 暂时关闭 钉钉通知 // 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(),content)); // warningPush.setStatus(noticeFlag?Constants.ONE:Constants.TWO); warningPushMapper.insert(warningPush); falg = true; }catch (Exception e){ 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; } @@ -1717,46 +1844,46 @@ 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); // } /** * 处理车辆进入错误月台业务逻辑