server/meeting/meeting_admin/src/main/resources/bootstrap-dev.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos config: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: wuhu_visit_dev # namespace: dev_renkang username: nacos @@ -23,7 +23,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dev_renkang namespace: dmvisit username: nacos server/meeting/meeting_admin/src/main/resources/bootstrap-pro.yml
@@ -14,7 +14,7 @@ username: nacos password: Atwl@2024 # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos server/meeting/meeting_admin/src/main/resources/bootstrap-self.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos config: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: wuhu_visit_dev # namespace: dev_renkang username: nacos @@ -23,7 +23,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: wuhu_visit_dev namespace: dmvisit_dev username: nacos server/meeting/meeting_admin/src/main/resources/bootstrap-test.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos config: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: wuhu_visit_test username: nacos password: nacos @@ -22,7 +22,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: wuhu_visit_test username: nacos password: nacos server/system_gateway/src/main/resources/bootstrap-dev.yml
@@ -1,11 +1,11 @@ spring: cloud: nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit namespace: wuhu_visit_dev1 username: nacos server/system_gateway/src/main/resources/bootstrap-self.yml
@@ -1,11 +1,11 @@ spring: cloud: nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit namespace: wuhu_visit_dev username: nacos server/system_gateway/src/main/resources/bootstrap-test.yml
@@ -1,11 +1,11 @@ spring: cloud: nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit namespace: wuhu_visit_test username: nacos server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -1523,18 +1523,20 @@ public enum WarningConfig { ALARM_TEST(10002, "【钥匙柜】酒精测试异常"), GRID_TIME_OUT_INFO(10003, "【钥匙柜】开门超时未关闭"), KEY_TIME_OUT_BACK(10004, "【钥匙柜】钥匙超时未归还"), ALARM_TEST(10002, "【钥匙柜】酒精测试异常",0), GRID_TIME_OUT_INFO(10003, "【钥匙柜】开门超时未关闭",0), KEY_TIME_OUT_BACK(10004, "【钥匙柜】钥匙超时未归还",0), ; // 成员变量 private int key; private String info; private int processArea; // 构造方法 WarningConfig(int key,String info) { WarningConfig(int key,String info,int processArea) { this.key = key; this.info = info; this.processArea = processArea; } @@ -1554,6 +1556,15 @@ this.info = info; } public int getProcessArea() { return processArea; } public void setProcessArea(int processArea) { this.processArea = processArea; } } server/system_timer/src/main/resources/bootstrap-dev.yml
@@ -12,11 +12,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos @@ -24,7 +24,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: wuhu_visit_dev username: nacos password: nacos server/system_timer/src/main/resources/bootstrap-pro.yml
@@ -16,7 +16,7 @@ username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos server/system_timer/src/main/resources/bootstrap-self.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos @@ -22,7 +22,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: wuhu_visit_dev username: nacos password: nacos server/system_timer/src/main/resources/bootstrap-test.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos @@ -22,7 +22,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: wuhu_visit_test username: nacos password: nacos server/visits/admin_timer/src/main/resources/bootstrap-dev.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos @@ -22,7 +22,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: wuhu_visit_dev username: nacos password: nacos server/visits/admin_timer/src/main/resources/bootstrap-pro.yml
@@ -14,7 +14,7 @@ username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos server/visits/admin_timer/src/main/resources/bootstrap-self.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos @@ -22,7 +22,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: dmvisit username: nacos password: nacos server/visits/admin_timer/src/main/resources/bootstrap-test.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos @@ -22,7 +22,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: wuhu_visit_test username: nacos password: nacos server/visits/dmvisit_admin/src/main/resources/bootstrap-dev.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit namespace: wuhu_visit_dev1 username: nacos server/visits/dmvisit_admin/src/main/resources/bootstrap-pro.yml
@@ -14,7 +14,7 @@ username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos server/visits/dmvisit_admin/src/main/resources/bootstrap-self.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos @@ -22,7 +22,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit namespace: wuhu_visit_dev username: nacos server/visits/dmvisit_admin/src/main/resources/bootstrap-test.yml
@@ -10,11 +10,11 @@ # 暂时关闭缓存 enabled: false nacos: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 username: nacos password: nacos # config: # server-addr: http://192.168.0.212:8848 #配置Nacos地址 # server-addr: http://192.168.0.7:8848 #配置Nacos地址 # namespace: dmvisit # username: nacos # password: nacos @@ -22,7 +22,7 @@ # group: dev # data-id: com.doumee.meeting.admin discovery: server-addr: http://192.168.0.212:8848 #配置Nacos地址 server-addr: http://192.168.0.7:8848 #配置Nacos地址 namespace: wuhu_visit_test username: nacos password: nacos server/visits/dmvisit_admin/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@ spring: profiles: active: test active: dev application: name: visitsAdmin # 安全配置 server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/WarningEvent.java
@@ -72,6 +72,9 @@ @ExcelColumn(name="所在位置",width=10,index = 5) private String region; @ApiModelProperty(value = "位置主键") private String regionId; @ApiModelProperty(value = "唯一标识") //@ExcelColumn(name="唯一标识") private String eventId; server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/WarningRuleDetail.java
@@ -1,5 +1,6 @@ package com.doumee.dao.business.model; import com.baomidou.mybatisplus.annotation.TableField; import com.doumee.core.annotation.excel.ExcelColumn; import com.doumee.service.business.third.model.LoginUserModel; import io.swagger.annotations.ApiModel; @@ -76,4 +77,11 @@ @ExcelColumn(name="区域主键") private String regionId; @ApiModelProperty(value = "告警类型编码") @TableField(exist = false) private String code; } server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetGridServiceImpl.java
@@ -26,6 +26,7 @@ import com.doumee.service.business.third.model.PageWrap; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.hikvision.artemis.sdk.config.ArtemisConfig; import io.swagger.models.auth.In; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -59,6 +60,8 @@ @Autowired private JkCabinetLogMapper jkCabinetLogMapper; @Autowired private WarningEventMapper warningEventMapper; @Autowired private MemberMapper memberMapper; @@ -67,6 +70,9 @@ private WarningMapper warningMapper; @Autowired private WarningRuleMapper warningRuleMapper; @Autowired private WarningRuleDetailMapper warningRuleDetailMapper; @Autowired private WarningPushMapper warningPushMapper; @@ -632,27 +638,53 @@ .eq(JkCabinetGrid::getId,dto.getGridId()) .last(" limit 1 ") ); if(Objects.nonNull(jkCabinetGrid)){ log.error("柜格开门超时未关闭告警信息:{}"+JSONObject.toJSONString(jkCabinetGrid)); //规则类型 Constants.WarningConfig warningConfig = Constants.WarningConfig.GRID_TIME_OUT_INFO; Warning warning = warningMapper.selectOne(new QueryWrapper<Warning>().lambda() .eq(Warning::getType,Constants.THREE).eq(Warning::getCode,warningConfig.getKey()).eq(Warning::getIsdeleted,Constants.ZERO).last("limt 1")); .eq(Warning::getIsdeleted,Constants.ZERO) .eq(Warning::getStatus,Constants.ONE) .eq(Warning::getCode,warningConfig.getKey()) .last("limit 1") ); if(Objects.isNull(warning)){ return; } List<Member> memberList = this.getWarningList(warning); List<Integer> ruleIdList = this.processWarnFront(warningConfig); if(CollectionUtils.isEmpty(ruleIdList)){ return; } for (Integer ruleId:ruleIdList) { WarningRule warningRule = warningRuleMapper.selectById(ruleId); if(Objects.isNull(warningRule)){ continue; } List<Member> memberList = this.getWarningRuleMemberList(warningRule); if(CollectionUtils.isEmpty(memberList)){ return; } String content = "【钥匙柜-"+jkCabinetGrid.getCabinetName()+"】下【柜格-"+jkCabinetGrid.getCode()+"】超时未关闭"; JkCabinet jkCabinet = jkCabinetMapper.selectById(dto.getCabinetId()); // 存储异常日志 //存储报警异常记录 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(Objects.nonNull(jkCabinet)&&StringUtils.isNotBlank(jkCabinet.getLocation())?jkCabinet.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()); String content = "【钥匙柜-"+jkCabinetGrid.getCabinetName()+"】下【柜格-"+jkCabinetGrid.getCode()+"】超时未关闭"; warningPush.setContent(content); warningPush.setStatus(Constants.ZERO); warningPush.setPushType(Constants.ZERO); @@ -672,40 +704,129 @@ // 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); } } } } } public List<Member> getWarningList(Warning warning){ if(Constants.equalsInteger(warning.getStatus(),Constants.ZERO)){ return null; } //查询通知人员 List<WarningRule> warningRuleList = warningRuleMapper.selectList(new QueryWrapper<WarningRule>().lambda() .eq(WarningRule::getIsdeleted,Constants.ZERO) .apply(" id in ( select w.RULE_ID from warning_rule_detail w where w.WARNING_ID = '"+warning.getId()+"' and w.ISDELETED = 0 ) ") public List<Integer> processWarnFront(Constants.WarningConfig warningConfig){ List<WarningRuleDetail> warningRuleDetailList = warningRuleDetailMapper.selectJoinList(WarningRuleDetail.class,new MPJLambdaWrapper<WarningRuleDetail>() .selectAll(WarningRuleDetail.class) .leftJoin(Warning.class,Warning::getId,WarningRuleDetail::getWarningId) .eq(WarningRuleDetail::getIsdeleted,Constants.ZERO) .eq(Warning::getIsdeleted,Constants.ZERO) .eq(Warning::getStatus,Constants.ONE) .eq(Warning::getCode,warningConfig.getKey()) ); List<Member> memberList = new ArrayList<>(); if(org.apache.commons.collections.CollectionUtils.isNotEmpty(warningRuleList)){ List<String> memberIdStr = warningRuleList.stream().map(i->i.getMemberIds()).collect(Collectors.toList()); if(org.apache.commons.collections.CollectionUtils.isNotEmpty(memberIdStr)){ List<String> memberIdList = new ArrayList<>(); for (String s:memberIdStr) { memberIdList.addAll( Arrays.asList(s.split(",")) if(CollectionUtils.isEmpty(warningRuleDetailList)){ return new ArrayList<>(); } //所有报警规则配置信息 List<Integer> ruleIdList = warningRuleDetailList.stream().map(i->i.getRuleId()).collect(Collectors.toList());; Set<Integer> ruleIdSet = new HashSet<>(ruleIdList); if(CollectionUtils.isNotEmpty(ruleIdSet)){ List<Integer> resultList = new ArrayList<>(); for (Integer ruleId:ruleIdSet) { WarningRule warningRule = warningRuleMapper.selectById(ruleId); //查询其他规则信息 List<WarningRuleDetail> warningRuleDetails = warningRuleDetailMapper.selectJoinList(WarningRuleDetail.class,new MPJLambdaWrapper<WarningRuleDetail>() .selectAll(WarningRuleDetail.class) .selectAs(Warning::getCode,WarningRuleDetail::getCode) .leftJoin(Warning.class,Warning::getId,WarningRuleDetail::getWarningId) .eq(WarningRuleDetail::getIsdeleted,Constants.ZERO) .eq(Warning::getIsdeleted,Constants.ZERO) .eq(Warning::getStatus,Constants.ONE) .eq(WarningRuleDetail::getRuleId,ruleId) .in(Warning::getCode,Constants.WarningConfig.ALARM_TEST.getKey(), Constants.WarningConfig.GRID_TIME_OUT_INFO.getKey(), Constants.WarningConfig.KEY_TIME_OUT_BACK.getKey() ) ); } memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda().eq(Member::getIsdeleted,Constants.ZERO) .notIn(Member::getErpId) .in(Member::getId,memberIdList) //无任何规则 直接跳过 if(CollectionUtils.isEmpty(warningRuleDetails)){ return resultList; }else if(!Constants.equalsInteger(warningRuleDetails.stream().filter(i->!i.getCode().equals(warningConfig.getKey())).collect(Collectors.toList()).size(),Constants.ZERO)){ List<WarningRuleDetail> wList = warningRuleDetails.stream().filter(i->!i.getCode().equals(warningConfig.getKey())).collect(Collectors.toList()); //获取所有其他所有事件主键信息 List<Integer> warningIdList = wList.stream().map(i->i.getWarningId()).collect(Collectors.toList()); Set<Integer> setWarningIdList = new HashSet<>(warningIdList); //获取时间内所有事件信息 List<WarningEvent> warningEventList = warningEventMapper.selectList(new QueryWrapper<WarningEvent>().lambda() .eq(WarningEvent::getIsdeleted,Constants.ZERO) .in(WarningEvent::getWarningId,setWarningIdList) .apply(" DATE_ADD(CREATE_DATE , INTERVAL "+warningRule.getIntervalSec()+" SECOND) > now() ") ); if(this.processWarnFlag(wList,warningEventList)){ resultList.add(ruleId); }; }else{ List<WarningRuleDetail> wList = warningRuleDetails.stream().filter(i->i.getCode().equals(warningConfig.getKey())).collect(Collectors.toList()); //获取本次事件主键信息 List<Integer> warningIdList = wList.stream().map(i->i.getWarningId()).collect(Collectors.toList()); Set<Integer> setWarningIdList = new HashSet<>(warningIdList); //获取时间内所有事件信息 List<WarningEvent> warningEventList = warningEventMapper.selectList(new QueryWrapper<WarningEvent>().lambda() .eq(WarningEvent::getIsdeleted,Constants.ZERO) .in(WarningEvent::getWarningId,setWarningIdList) .apply(" DATE_ADD(CREATE_DATE , INTERVAL "+warningRule.getIntervalSec()+" SECOND) > now() ") ); if(this.processWarnFlag(wList,warningEventList)){ resultList.add(ruleId); } } } return resultList; } return new ArrayList<>(); } /** * 判断处理是否可以发送通知 当前告警配置的数据列表是否满足 * @param warningRuleDetails * @return */ public boolean processWarnFlag(List<WarningRuleDetail> warningRuleDetails,List<WarningEvent> warningEventList){ if(CollectionUtils.isEmpty(warningEventList)){ return false; } for (WarningRuleDetail warningRuleDetail:warningRuleDetails) { if(Objects.nonNull(warningRuleDetail.getRegionId())){ if(warningEventList.stream().filter(i->Constants.equalsInteger(i.getWarningId(),warningRuleDetail.getWarningId()) && StringUtils.isNotBlank(i.getRegionId()) && i.getRegionId().equals(warningRuleDetail.getRegionId()) ).collect(Collectors.toList()).size()<=Constants.ZERO){ return false; } }else{ if(warningEventList.stream().filter(i->Constants.equalsInteger(i.getWarningId(),warningRuleDetail.getWarningId()) ).collect(Collectors.toList()).size()<=Constants.ZERO){ return false; } } } return true; } public List<Member> getWarningRuleMemberList(WarningRule warningRule){ List<Member> memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda().eq(Member::getIsdeleted,Constants.ZERO) .isNotNull(Member::getErpId) .in(Member::getId,Arrays.asList(warningRule.getMemberIds().split(","))) ); return memberList; } @Override @@ -722,20 +843,28 @@ JkCabinet jkCabinet = jkCabinetMapper.selectById(dto.getCabinetId()); Constants.WarningConfig warningConfig = Constants.WarningConfig.ALARM_TEST; Warning warning = warningMapper.selectOne(new QueryWrapper<Warning>().lambda() .eq(Warning::getType,Constants.THREE).eq(Warning::getCode,warningConfig.getKey()).eq(Warning::getIsdeleted,Constants.ZERO).last("limt 1")); .eq(Warning::getIsdeleted,Constants.ZERO) .eq(Warning::getStatus,Constants.ONE) .eq(Warning::getCode,warningConfig.getKey()) .last("limit 1") ); if(Objects.isNull(warning)){ return; } List<Member> memberList = this.getWarningList(warning); if(CollectionUtils.isEmpty(memberList)){ List<Integer> ruleIdList = this.processWarnFront(warningConfig); if(CollectionUtils.isEmpty(ruleIdList)){ return; } // 存储异常日志 WarningPush warningPush = new WarningPush(); warningPush.setCreateDate(new Date()); warningPush.setIsdeleted(Constants.ZERO); warningPush.setWarningId(warning.getId()); warningPush.setTitle(warningConfig.getInfo()); if(CollectionUtils.isEmpty(ruleIdList)){ return; } for (Integer ruleId:ruleIdList) { WarningRule warningRule = warningRuleMapper.selectById(ruleId); if (Objects.isNull(warningRule)) { continue; } List<Member> memberList = this.getWarningRuleMemberList(warningRule); String content = ""; if(Objects.nonNull(systemUser.getRealname())){ content = content + systemUser.getRealname(); @@ -744,10 +873,26 @@ content = content + "于"+jkCabinet.getName()+"钥匙柜"; } content = content + "酒精检测异常"; warningPush.setContent(content + "酒精检测异常,酒精度数【"+dto.getAlcoholNum()+"°】"); if(Objects.nonNull(dto.getAlcoholNum())){ content = content + ",酒精度数【"+dto.getAlcoholNum()+"°】"; } //存储报警异常记录 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(Objects.nonNull(jkCabinet)&&StringUtils.isNotBlank(jkCabinet.getLocation())?jkCabinet.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); @@ -762,16 +907,25 @@ 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(),warningConfig.getInfo())); // 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); } //存储异常日志 if(Objects.nonNull(systemUser)){ log.error("司机酒精检测,超出酒精值告警信息:{}"+JSONObject.toJSONString(systemUser)); } } } } server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkCabinetLogServiceImpl.java
@@ -3,16 +3,13 @@ import cn.hutool.core.bean.BeanUtil; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.core.utils.Constants; import com.doumee.dao.business.WarningMapper; import com.doumee.dao.business.WarningPushMapper; import com.doumee.dao.business.WarningRuleMapper; import com.doumee.dao.business.*; import com.doumee.dao.business.dto.TelecomCabinetLogDTO; import com.doumee.dao.business.model.*; import com.doumee.dao.business.vo.TelecomJkCabinetLogVO; import com.doumee.service.business.third.model.PageData; import com.doumee.service.business.third.model.PageWrap; import com.doumee.core.utils.Utils; import com.doumee.dao.business.JkCabinetLogMapper; import com.doumee.service.business.JkCabinetLogService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; @@ -49,6 +46,8 @@ @Autowired private WarningPushMapper warningPushMapper; @Autowired private WarningEventMapper warningEventMapper; @Autowired private SystemDictDataBiz systemDictDataBiz; @Override @@ -192,7 +191,11 @@ public void timeOutUnBackAlarm(JkCabinetGridServiceImpl impl){ Constants.WarningConfig warningConfig = Constants.WarningConfig.KEY_TIME_OUT_BACK; Warning warning = warningMapper.selectOne(new QueryWrapper<Warning>().lambda() .eq(Warning::getType,Constants.THREE).eq(Warning::getCode,warningConfig.getKey()).eq(Warning::getIsdeleted,Constants.ZERO).last("limt 1")); .eq(Warning::getIsdeleted,Constants.ZERO) .eq(Warning::getStatus,Constants.ONE) .eq(Warning::getCode,warningConfig.getKey()) .last("limit 1") ); if(Objects.isNull(warning)){ return; } @@ -213,16 +216,44 @@ .orderByDesc(JkCabinetLog::getCreateDate); List<JkCabinetLog> jkCabinetLogs = jkCabinetLogMapper.selectJoinList(JkCabinetLog.class,wrapper); if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(jkCabinetLogs)){ List<Member> memberList = impl.getWarningList(warning); if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(memberList)){ 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():"未知人员")+"借出,超时未归还"; //存储报警异常记录 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()); String content = "【车辆-"+jkCabinetLog.getCarCode()+"钥匙】由+"+(StringUtils.isNotBlank(jkCabinetLog.getMemberName())?jkCabinetLog.getMemberName():"未知人员")+"借出,超时未归还"; warningPush.setContent(content); warningPush.setStatus(Constants.ZERO); warningPush.setPushType(Constants.ZERO); @@ -242,9 +273,17 @@ // 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); } } } } server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/JkSketchServiceImpl.java
@@ -1323,7 +1323,7 @@ .leftJoin(Category.class,Category::getId,JkLine::getCategoryId ) .leftJoin(Cars.class,Cars::getId,JkLine::getCarId) .and(StringUtils.isNotBlank(telecomLineInfoDTO.getSearchInfo()),i->i.like(Cars::getCode,telecomLineInfoDTO.getSearchInfo()).or().like(JkLine::getName,telecomLineInfoDTO.getSearchInfo())) .eq(StringUtils.isNotBlank(telecomLineInfoDTO.getDateInfo()),JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo()) .like(StringUtils.isNotBlank(telecomLineInfoDTO.getDateInfo()),JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo()) .eq(Objects.nonNull(telecomLineInfoDTO.getCategoryId()),JkLine::getCategoryId, telecomLineInfoDTO.getCategoryId()) .eq(Objects.nonNull(telecomLineInfoDTO.getLineId()),JkLine::getId, telecomLineInfoDTO.getLineId()); @@ -1370,7 +1370,7 @@ .select(" ifnull((select count(1) from jk_sketch_customer jc where jc.ISDELETED= 0 and jc.SKETCH_ID = t.id),0)" ,JkSketch::getCustomerNum) .select(" ifnull((select count(1) from jk_sketch_line jc where jc.TYPE = 0 and jc.SKETCH_ID = t.id),0)" ,JkSketch::getBeforeLineNum) .leftJoin(Category.class,Category::getId,JkSketch::getCategoryId ) .eq(JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo()); .like(JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo()); List<JkSketch> sketchList = jkSketchMapper.selectJoinList(JkSketch.class,sketchMPJLambdaWrapper); if(CollectionUtils.isEmpty(sketchList)){ return telecomLineCountVO; @@ -1439,7 +1439,7 @@ MPJLambdaWrapper<JkSketch> sketchMPJLambdaWrapper = new MPJLambdaWrapper<JkSketch>().selectAll(JkSketch.class ) .selectAs(Category::getName,JkSketch::getCategoryName) .leftJoin(Category.class,Category::getId,JkSketch::getCategoryId ) .eq(JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo()); .like(JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo()); List<JkSketch> sketchList = jkSketchMapper.selectJoinList(JkSketch.class,sketchMPJLambdaWrapper); if(CollectionUtils.isEmpty(sketchList)){ return new ArrayList<TelecomCategoryDataVO>(); @@ -1503,7 +1503,7 @@ .eq(Objects.nonNull(telecomLineInfoDTO.getCategoryId()),JkSketchLine::getCategoryId,telecomLineInfoDTO.getCategoryId()) .eq(Objects.nonNull(telecomLineInfoDTO.getLineId()),JkSketchLine::getLineId,telecomLineInfoDTO.getLineId()) .apply(" ( t.TYPE = t1.OPT_STATUS ) ") .eq(JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo()); .like(JkSketch::getDateInfo, telecomLineInfoDTO.getDateInfo()); List<JkSketchLine> returnLineList = jkSketchLineMapper.selectJoinList(JkSketchLine.class,queryWrapper); // //优化前数据