| | |
| | | .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); |
| | | } |
| | | |
| | | |
| | | |
| | | |