src/main/java/com/yssh/service/XlsReportService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/yssh/utils/DateUtils.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/application-file.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/yssh/service/XlsReportService.java
@@ -3,6 +3,7 @@ import com.yssh.entity.xls.DayExcel; import com.yssh.entity.xls.MonthExcel; import com.yssh.entity.xls.WeekExcel; import com.yssh.mapper.XlsReportMapper; import com.yssh.utils.DateUtils; import com.yssh.utils.ExcelUtils; import org.slf4j.Logger; @@ -11,6 +12,7 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.File; import java.io.IOException; import java.util.*; @@ -24,10 +26,37 @@ public class XlsReportService { protected final Logger logger = LoggerFactory.getLogger(this.getClass()); @Resource XlsReportMapper mapper; /** * 报告路径 */ @Value("${report.path}") private String reportPath; /** * 预警值 */ @Value("${report.yjz}") private double yjz; /** * 报警值 */ @Value("${report.bjz}") private double bjz; /** * Excel是否已存在 */ private boolean xlsExists(String type, String name) { int rows = mapper.xlsExists(type, name); return rows > 0; } /** * 获取导出路径 */ private String getExpPath(String type) { src/main/java/com/yssh/utils/DateUtils.java
@@ -212,9 +212,6 @@ return times; } /** * */ public static Map<Date, Date> segmentationDateByTimeQuantum(Date startDate, Date endDate, int timeQuantum, int dateType) { LinkedHashMap<Date, Date> result = new LinkedHashMap<Date, Date>(); long startTimeMillisecond = startDate.getTime(); @@ -245,9 +242,17 @@ } /** * 剪除日期的时间部分 */ public static Date trimTime(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); return dateTime(YYYY_MM_DD_HH_MM_SS, parseDateToStr(YYYY_MM_DD, cal.getTime()) + " 00:00:00"); } /** * 获取本月第一天 * * @return String **/ public static Date getMonthStart(Date date) { Calendar cal = Calendar.getInstance(); @@ -259,8 +264,6 @@ /** * 获取本月最后一天 * * @return String **/ public static Date getMonthEnd(Date date) { Calendar cal = Calendar.getInstance(); src/main/resources/application-file.yml
@@ -9,3 +9,5 @@ #日/周/月报路径 report: path: D:\2022\XlsReport yjz: 1 bjz: 2