燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-08-09 9b65b461bafa7368796a7b02fd8c0bf5794675a6
1
已修改1个文件
33 ■■■■■ 文件已修改
src/main/java/com/yssh/service/XlsExportService.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/XlsExportService.java
@@ -61,24 +61,30 @@
    }
    /**
     * 创建Excel
     */
    private <T> void createExcel(String type, Date date, List<T> list) throws Exception {
        String source = getXslTemplate(type);
        String strData = DateUtils.parseDateToStr("month".equals(type) ? DateUtils.YYYYMM : DateUtils.YYYYMMDD, date);
        String target = String.format("%s\\%s.xlsx", getExpPath(type), strData);
        createExcel(source, target, list);
    }
    /**
     * 创建日报
     */
    public void createDayReport(Date date) {
        try {
            Date yesterday = DateUtils.getAPeriodOfTime(date, -1, Calendar.DATE);
            String type = "day";
            List<DayExcel> list = new ArrayList<>();
            for (int i = 1; i < 47; i++) {
                DayExcel day = new DayExcel("AI-" + (i < 10 ? "0" : "") + i, "lj", "ljtb", "ys", "3m/s", "东南", "°c");
                list.add(day);
            }
            String source = getXslTemplate(type);
            String strData = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, yesterday);
            String target = String.format("%s\\%s.xlsx", getExpPath(type), strData);
            createExcel(source, target, list);
            createExcel("day", yesterday, list);
        } catch (Exception ex) {
            logger.error(ex.getMessage(), ex);
        }
@@ -92,18 +98,13 @@
            Date start = DateUtils.getAPeriodOfTime(date, -7, Calendar.DATE);
            Date end = DateUtils.getAPeriodOfTime(date, -1, Calendar.DATE);
            String type = "week";
            List<WeekExcel> list = new ArrayList<>();
            for (int i = 1; i < 47; i++) {
                WeekExcel day = new WeekExcel("AI-" + (i < 10 ? "0" : "") + i, "zhb", "ztq", "ztb", "zhb2", "lj", "ljtb", "syn", "ys", "fs", "fx", "°c");
                list.add(day);
            }
            String source = getXslTemplate(type);
            String strData = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, end);
            String target = String.format("%s\\%s.xlsx", getExpPath(type), strData);
            createExcel(source, target, list);
            createExcel("week", end, list);
        } catch (Exception ex) {
            logger.error(ex.getMessage(), ex);
        }
@@ -118,19 +119,13 @@
            Date start = DateUtils.getMonthStart(yesterday);
            Date end = DateUtils.getMonthEnd(yesterday);
            String type = "month";
            List<MonthExcel> list = new ArrayList<>();
            for (int i = 1; i < 47; i++) {
                MonthExcel day = new MonthExcel("AI-" + (i < 10 ? "0" : "") + i, "yhb", "ytq", "ytb", "yhb2", "lj", "ljtb", "qyn", "ys", "fs", "fx", "°c");
                list.add(day);
            }
            String source = getXslTemplate(type);
            String strData = DateUtils.parseDateToStr(DateUtils.YYYYMM, end);
            String target = String.format("%s\\%s.xlsx", getExpPath(type), strData);
            createExcel(source, target, list);
            createExcel("month", end, list);
        } catch (Exception ex) {
            logger.error(ex.getMessage(), ex);
        }