| | |
| | | import com.yssh.mapper.QxshMapper; |
| | | import com.yssh.mapper.SuYuanMapper; |
| | | import com.yssh.mapper.WarningDetailMapper; |
| | | import com.yssh.utils.CacheUtils; |
| | | import com.yssh.utils.CalculateUtils; |
| | | import com.yssh.utils.DateUtils; |
| | | import com.yssh.utils.StringUtils; |
| | |
| | | Integer start = Integer.parseInt(DateUtils.getYyyyMmDdHh(startDate)); |
| | | |
| | | // List<String> times = DateUtils.get3Hours(); |
| | | List<Qxsh> list = qxshMapper.select3Hours(start, end); |
| | | if (null == list || list.isEmpty()) { |
| | | return null; |
| | | //List<Qxsh> list = qxshMapper.select3Hours(start, end); |
| | | //if (null == list || list.isEmpty()) { |
| | | // return null; |
| | | //} |
| | | |
| | | String key = "qxshMapper.select3Hours." + start + "." + end; |
| | | List<Qxsh> list = CacheUtils.getListByKey(key); |
| | | if (null == list) { |
| | | list = qxshMapper.select3Hours(start, end); |
| | | CacheUtils.putListByKey(key, list); |
| | | } |
| | | |
| | | /* Map<String, List<Double>> map = new LinkedHashMap<>(); |
| | |
| | | */ |
| | | public List<Qxsh> selectMonthTop10() { |
| | | String time = DateUtils.getYyyyMm(new Date()); |
| | | List<Qxsh> list = qxshMapper.selectMonthTop10(time + "%"); |
| | | //List<Qxsh> list = qxshMapper.selectMonthTop10(time + "%"); |
| | | |
| | | String key = "qxshMapper.selectMonthTop10." + time; |
| | | List<Qxsh> list = CacheUtils.getListByKey(key); |
| | | if (null == list) { |
| | | list = qxshMapper.selectMonthTop10(time + "%"); |
| | | CacheUtils.putListByKey(key, list); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | |
| | | Integer intMon = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, mon) + "00"); // 2023080700 |
| | | Integer intSun = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, sun) + "23"); // 2023081323 |
| | | |
| | | List<Qxsh> list = qxshMapper.selectWeekTop10(intMon, intSun); |
| | | //List<Qxsh> list = qxshMapper.selectWeekTop10(intMon, intSun); |
| | | String key = "qxshMapper.selectWeekTop10." + intMon + "." + intSun; |
| | | List<Qxsh> list = CacheUtils.getListByKey(key); |
| | | if (null == list) { |
| | | list = qxshMapper.selectWeekTop10(intMon, intSun); |
| | | CacheUtils.putListByKey(key, list); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | |
| | | */ |
| | | public List<Qxsh> selectDayTop10() { |
| | | String time = DateUtils.getYyyyMmDd(new Date()); |
| | | List<Qxsh> list = qxshMapper.selectDayTop10(time + "%"); |
| | | //List<Qxsh> list = qxshMapper.selectDayTop10(time + "%"); |
| | | |
| | | String key = "qxshMapper.selectDayTop10." + time; |
| | | List<Qxsh> list = CacheUtils.getListByKey(key); |
| | | if (null == list) { |
| | | list = qxshMapper.selectDayTop10(time + "%"); |
| | | CacheUtils.putListByKey(key, list); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | int isSuYuan = hasSuYuan(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"; |
| | | |
| | | Integer isSuYuan = qxshMapper.hasSuYuan(suYuanId, createTime); |
| | | qxsh.setIsSuYuan(isSuYuan); |
| | | |
| | | Integer isFast = qxshMapper.countFastSuYuan(suYuanId, createTime); |
| | | qxsh.setIsFast(isFast); |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | } |