| | |
| | | Integer intLastSun = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, lastSun) + "23"); // 2023072323 |
| | | Integer intLastYear1 = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, lastYear1) + "00"); // 2022072400 |
| | | Integer intLastYear7 = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, lastYear7) + "23"); // 2022073023 |
| | | String yyyy = DateUtils.parseDateToStr(DateUtils.YYYY, sun); // 2023 |
| | | Integer yearStart = Integer.parseInt(yyyy + "010100"); // 2023010100 |
| | | String year = DateUtils.parseDateToStr(DateUtils.YYYY, sun); // 2023 |
| | | Integer yearStart = Integer.parseInt(year + "010100"); // 2023010100 |
| | | String lastYear = DateUtils.parseDateToStr(DateUtils.YYYY, DateUtils.lastYear(sun)); // 2022 |
| | | int weekOfYear = DateUtils.getWeekOfYear(sun); // 31 |
| | | Date lastYearSun = DateUtils.getWeekOfYearForSun(Integer.parseInt(lastYear), weekOfYear); // 2022-07-24 |
| | |
| | | |
| | | double lj = mapper.selectAccumulate(yearStart, intSun, name); // 累计 |
| | | |
| | | double ljjz = mapper.selectYearAccumulate(yyyy + "%", name); // 今年累计均值 |
| | | double ljjz = mapper.selectYearAccumulate(year + "%", name); // 今年累计均值 |
| | | double qnLjjz = mapper.selectYearAccumulate(lastYear + "%", name); // 去年累计均值 |
| | | String ljtb = 0 == qnLjjz ? "--" : CalculateUtils.round2((ljjz - qnLjjz) / qnLjjz * 100) + "%"; // 累计同比 |
| | | |
| | |
| | | */ |
| | | public void createMonthReport(Date date) { |
| | | try { |
| | | Date yesterday = DateUtils.getAPeriodOfTime(date, -1, Calendar.DATE); |
| | | Date start = DateUtils.getMonthStart(yesterday); |
| | | Date end = DateUtils.getMonthEnd(yesterday); |
| | | Date yesterday = DateUtils.getAPeriodOfTime(date, -1, Calendar.DATE); // 2023-07-31 |
| | | Date monthStart = DateUtils.getMonthStart(yesterday); // 2023-07-01 |
| | | Date monthEnd = DateUtils.getMonthEnd(yesterday); // 2023-07-31 |
| | | int intMonthStart = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, monthStart) + "00"); // 2023070100 |
| | | int intMonthEnd = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, monthEnd) + "23"); // 2023073123 |
| | | Date lastMonth = DateUtils.getAPeriodOfTime(yesterday, -1, Calendar.MONTH); // 2023-06-30 |
| | | Date lastMonthStart = DateUtils.getMonthStart(lastMonth); // 2023-06-01 |
| | | Date lastMonthEnd = DateUtils.getMonthEnd(lastMonth); // 2023-06-30 |
| | | int intLastMonthStart = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, lastMonthStart) + "00"); // 2023060100 |
| | | int intLastMonthEnd = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, lastMonthEnd) + "23"); // 2023063023 |
| | | int lastYearMonthStart = intMonthStart - 1000000; // 2023070100 |
| | | int lastYearMonthEnd = intMonthEnd - 1000000; // 2023073123 |
| | | String year = DateUtils.parseDateToStr(DateUtils.YYYY, yesterday); // 2023 |
| | | Integer yearStart = Integer.parseInt(year + "010100"); // 2023010100 |
| | | Date lastDay = DateUtils.lastYear(yesterday); // 2022-07-31 |
| | | String lastYear = DateUtils.parseDateToStr(DateUtils.YYYY, lastDay); // 2022 |
| | | |
| | | List<MonthExcel> list = new ArrayList<>(); |
| | | for (int i = 1; i < 47; i++) { |
| | | String name = "AI-" + (i < 10 ? "0" : "") + i; |
| | | // |
| | | double sy = mapper.selectAccumulate(intMonthStart, intMonthEnd, name); // 上月 |
| | | |
| | | list.add(new MonthExcel()); |
| | | double ssy = mapper.selectAccumulate(intLastMonthStart, intLastMonthEnd, name); // 上上月 |
| | | String yhb = 0 == ssy ? "--" : CalculateUtils.round2((sy - ssy) / ssy * 100) + "%"; // 月环比 |
| | | |
| | | double qntq = mapper.selectAccumulate(lastYearMonthStart, lastYearMonthEnd, name); // 去年同期 |
| | | String ytq = 0 == qntq ? "--" : CalculateUtils.round2((sy - qntq) / qntq * 100) + "%"; // 月同期 |
| | | |
| | | String ytb = ""; // 月同比 |
| | | |
| | | double lj = mapper.selectAccumulate(yearStart, intMonthEnd, name); // 累计 |
| | | |
| | | double ljjz = mapper.selectYearAccumulate(year + "%", name); // 今年累计均值 |
| | | double qnLjjz = mapper.selectYearAccumulate(lastYear + "%", name); // 去年累计均值 |
| | | String ljtb = 0 == qnLjjz ? "--" : CalculateUtils.round2((ljjz - qnLjjz) / qnLjjz * 100) + "%"; // 累计同比 |
| | | |
| | | String qyn = 0 == qnLjjz ? "--" : CalculateUtils.round2((ljjz - qnLjjz) / qnLjjz * 100) + "%"; // 较上一年度变化幅度 |
| | | |
| | | MonitorPointPosition point = commonService.select3dCheckPointByName(name); |
| | | String id = point.getId().substring(0, point.getId().lastIndexOf("_") + 1) + "0"; |
| | | List<SuYuan700> suList = mapper.selectSuYuanByStartAndEnd(id, name, yjz, intMonthStart, intMonthEnd); |
| | | String ys = getYs(suList); // 受影响因素及原因 |
| | | |
| | | list.add(new MonthExcel("" + sy, yhb, ytq, ytb, "" + lj, ljtb, qyn, ys, "", "", "")); |
| | | } |
| | | saveResult("month", end, list); |
| | | //saveResult("month", end, list); |
| | | } catch (Exception ex) { |
| | | logger.error(ex.getMessage(), ex); |
| | | } |