| | |
| | | package com.yssh.service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.CountDownLatch; |
| | | |
| | |
| | | protected final Logger logger = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | @Resource |
| | | private WarningDetailMapper warningDetailMapper; |
| | | WarningDetailMapper warningDetailMapper; |
| | | |
| | | @Resource |
| | | private CommonService commonService; |
| | | CommonService commonService; |
| | | |
| | | @Resource |
| | | private SuYuanMapper suYuanMapper; |
| | | SuYuanMapper suYuanMapper; |
| | | |
| | | @Resource |
| | | private DictRecordMapper dictRecordMapper; |
| | | DictRecordMapper dictRecordMapper; |
| | | |
| | | @Resource |
| | | private AsyncService asyncService; |
| | | AsyncService asyncService; |
| | | |
| | | @Resource |
| | | private QxshMapper qxshMapper; |
| | | QxshMapper qxshMapper; |
| | | |
| | | @Resource |
| | | private VocValsService vocValsService; |
| | | VocValsService vocValsService; |
| | | |
| | | @Resource |
| | | SuYuanService suYuanService; |
| | | |
| | | private static HashMap<String, String> filterMap = new HashMap<>(); |
| | | |
| | |
| | | * 获取实时报警 |
| | | */ |
| | | public List<Qxsh> getRunTimeAlarmAnalyse(Integer start, Integer end) { |
| | | return qxshMapper.selectAlarmByBeginAndEnd(start, end); |
| | | List<Qxsh> list = qxshMapper.selectAlarmByBeginAndEnd(start, end); |
| | | |
| | | return copeHasSuYuan(list); |
| | | } |
| | | |
| | | /** |
| | | * 获取实时预警 |
| | | */ |
| | | public List<Qxsh> getRunTimeWarningAnalyse(Integer start, Integer end) { |
| | | return qxshMapper.selectWarnByBeginAndEnd(start, end); |
| | | List<Qxsh> list = qxshMapper.selectWarnByBeginAndEnd(start, end); |
| | | |
| | | return copeHasSuYuan(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 处理是否含有溯源信息 |
| | | */ |
| | | private List<Qxsh> copeHasSuYuan(List<Qxsh> list) { |
| | | if (null == list || list.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | Map<String, Integer> tabs = new HashMap<>(); |
| | | for (Qxsh qxsh : list) { |
| | | String tab = "su_yuan_" + qxsh.getTime(); |
| | | if (!tabs.containsKey(tab)) { |
| | | tabs.put(tab, suYuanMapper.isTableExists(tab)); |
| | | } |
| | | |
| | | int rows = tabs.get(tab); |
| | | if (0 == rows) { |
| | | continue; |
| | | } |
| | | |
| | | int isSuYuan = hasSuYuan(qxsh); |
| | | qxsh.setIsSuYuan(isSuYuan); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 查询溯源 |
| | | */ |
| | | private Integer hasSuYuan(Qxsh qxsh) { |
| | | String suYuanId = suYuanService.selectSuYuanIdByName(qxsh.getName()); |
| | | String createTime = qxsh.getTime().substring(0, 4) + "-" + qxsh.getTime().substring(4, 6) + "-" + qxsh.getTime().substring(6, 8) + " " + qxsh.getTime().substring(8, 10) + ":00:00"; |
| | | |
| | | return qxshMapper.hasSuYuan(suYuanId, createTime); |
| | | } |
| | | } |