From f2ca598d3cf73968085d5acf5d2e0488a24577e0 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 08 八月 2023 20:48:26 +0800 Subject: [PATCH] 1 --- src/main/resources/templates/month.xlsx | 0 src/main/java/com/yssh/entity/xls/DayExcel.java | 102 ++++++++++++ src/main/java/com/yssh/entity/xls/ExcelHead.java | 2 src/main/java/com/yssh/entity/xls/WeekExcel.java | 167 ++++++++++++++++++++ src/main/resources/templates/week.xlsx | 0 src/main/java/com/yssh/entity/xls/MonthExcel.java | 167 ++++++++++++++++++++ src/main/resources/templates/day.xlsx | 0 src/main/java/com/yssh/service/XlsExportService.java | 24 +++ src/main/java/com/yssh/utils/ExcelUtils.java | 2 9 files changed, 462 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/yssh/entity/xls/DayExcel.java b/src/main/java/com/yssh/entity/xls/DayExcel.java new file mode 100644 index 0000000..fac400e --- /dev/null +++ b/src/main/java/com/yssh/entity/xls/DayExcel.java @@ -0,0 +1,102 @@ +package com.yssh.entity.xls; + +/** + * 鏃ユ姤Excel + * @author WWW + * @date 2023-08-08 + */ +public class DayExcel { + /** + * 鏃ュ潎鍊� + */ + private String rjz; + + /** + * 绱 + */ + private String lj; + + /** + * 绱鍚屾瘮 + */ + private String ljtb; + + /** + * 鍙楀奖鍝嶅洜绱犲強鍘熷洜 + */ + private String ys; + + /** + * 椋庨�� + */ + private String fs; + + /** + * 椋庡悜 + */ + private String fx; + + /** + * 娓╁害 + */ + private String wd; + + public DayExcel() { + } + + public String getRjz() { + return rjz; + } + + public void setRjz(String rjz) { + this.rjz = rjz; + } + + public String getLj() { + return lj; + } + + public void setLj(String lj) { + this.lj = lj; + } + + public String getLjtb() { + return ljtb; + } + + public void setLjtb(String ljtb) { + this.ljtb = ljtb; + } + + public String getYs() { + return ys; + } + + public void setYs(String ys) { + this.ys = ys; + } + + public String getFs() { + return fs; + } + + public void setFs(String fs) { + this.fs = fs; + } + + public String getFx() { + return fx; + } + + public void setFx(String fx) { + this.fx = fx; + } + + public String getWd() { + return wd; + } + + public void setWd(String wd) { + this.wd = wd; + } +} diff --git a/src/main/java/com/yssh/entity/ExcelHead.java b/src/main/java/com/yssh/entity/xls/ExcelHead.java similarity index 94% rename from src/main/java/com/yssh/entity/ExcelHead.java rename to src/main/java/com/yssh/entity/xls/ExcelHead.java index ced1ca5..9d5b392 100644 --- a/src/main/java/com/yssh/entity/ExcelHead.java +++ b/src/main/java/com/yssh/entity/xls/ExcelHead.java @@ -1,4 +1,4 @@ -package com.yssh.entity; +package com.yssh.entity.xls; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/com/yssh/entity/xls/MonthExcel.java b/src/main/java/com/yssh/entity/xls/MonthExcel.java new file mode 100644 index 0000000..1b2de1f --- /dev/null +++ b/src/main/java/com/yssh/entity/xls/MonthExcel.java @@ -0,0 +1,167 @@ +package com.yssh.entity.xls; + +/** + * 鏈堟姤Excel + * @author WWW + * @date 2023-08-08 + */ +public class MonthExcel { + /** + * 涓婃湀 + */ + private String sy; + + /** + * 鏈堢幆姣� + */ + private String yhb; + + /** + * 鏈堝悓鏈� + */ + private String ytq; + + /** + * 鏈堝悓姣� + */ + private String ytb; + + /** + * 鏈堢幆姣�2 + */ + private String yhb2; + + /** + * 绱 + */ + private String lj; + + /** + * 绱鍚屾瘮 + */ + private String ljtb; + + /** + * 杈冨墠涓�骞村潎鍊煎彉鍖栧箙搴� + */ + private String qyn; + + /** + * 鍙楀奖鍝嶅洜绱犲強鍘熷洜 + */ + private String ys; + + /** + * 椋庨�� + */ + private String fs; + + /** + * 椋庡悜 + */ + private String fx; + + /** + * 娓╁害 + */ + private String wd; + + public MonthExcel() { + } + + public String getSy() { + return sy; + } + + public void setSy(String sy) { + this.sy = sy; + } + + public String getYhb() { + return yhb; + } + + public void setYhb(String yhb) { + this.yhb = yhb; + } + + public String getYtq() { + return ytq; + } + + public void setYtq(String ytq) { + this.ytq = ytq; + } + + public String getYtb() { + return ytb; + } + + public void setYtb(String ytb) { + this.ytb = ytb; + } + + public String getYhb2() { + return yhb2; + } + + public void setYhb2(String yhb2) { + this.yhb2 = yhb2; + } + + public String getLj() { + return lj; + } + + public void setLj(String lj) { + this.lj = lj; + } + + public String getLjtb() { + return ljtb; + } + + public void setLjtb(String ljtb) { + this.ljtb = ljtb; + } + + public String getQyn() { + return qyn; + } + + public void setQyn(String qyn) { + this.qyn = qyn; + } + + public String getYs() { + return ys; + } + + public void setYs(String ys) { + this.ys = ys; + } + + public String getFs() { + return fs; + } + + public void setFs(String fs) { + this.fs = fs; + } + + public String getFx() { + return fx; + } + + public void setFx(String fx) { + this.fx = fx; + } + + public String getWd() { + return wd; + } + + public void setWd(String wd) { + this.wd = wd; + } +} diff --git a/src/main/java/com/yssh/entity/xls/WeekExcel.java b/src/main/java/com/yssh/entity/xls/WeekExcel.java new file mode 100644 index 0000000..7d8f400 --- /dev/null +++ b/src/main/java/com/yssh/entity/xls/WeekExcel.java @@ -0,0 +1,167 @@ +package com.yssh.entity.xls; + +/** + * 鍛ㄦ姤Excel + * @author WWW + * @date 2023-08-08 + */ +public class WeekExcel { + /** + * 涓婂懆 + */ + private String sz; + + /** + * 鍛ㄧ幆姣� + */ + private String zhb; + + /** + * 鍛ㄥ悓鏈� + */ + private String ztq; + + /** + * 鍛ㄥ悓姣� + */ + private String ztb; + + /** + * 鍛ㄧ幆姣�2 + */ + private String zhb2; + + /** + * 绱 + */ + private String lj; + + /** + * 绱鍚屾瘮 + */ + private String ljtb; + + /** + * 杈冧笂涓�骞村害鍙樺寲骞呭害 + */ + private String syn; + + /** + * 鍙楀奖鍝嶅洜绱犲強鍘熷洜 + */ + private String ys; + + /** + * 椋庨�� + */ + private String fs; + + /** + * 椋庡悜 + */ + private String fx; + + /** + * 娓╁害 + */ + private String wd; + + public WeekExcel() { + } + + public String getSz() { + return sz; + } + + public void setSz(String sz) { + this.sz = sz; + } + + public String getZhb() { + return zhb; + } + + public void setZhb(String zhb) { + this.zhb = zhb; + } + + public String getZtq() { + return ztq; + } + + public void setZtq(String ztq) { + this.ztq = ztq; + } + + public String getZtb() { + return ztb; + } + + public void setZtb(String ztb) { + this.ztb = ztb; + } + + public String getZhb2() { + return zhb2; + } + + public void setZhb2(String zhb2) { + this.zhb2 = zhb2; + } + + public String getLj() { + return lj; + } + + public void setLj(String lj) { + this.lj = lj; + } + + public String getLjtb() { + return ljtb; + } + + public void setLjtb(String ljtb) { + this.ljtb = ljtb; + } + + public String getSyn() { + return syn; + } + + public void setSyn(String syn) { + this.syn = syn; + } + + public String getYs() { + return ys; + } + + public void setYs(String ys) { + this.ys = ys; + } + + public String getFs() { + return fs; + } + + public void setFs(String fs) { + this.fs = fs; + } + + public String getFx() { + return fx; + } + + public void setFx(String fx) { + this.fx = fx; + } + + public String getWd() { + return wd; + } + + public void setWd(String wd) { + this.wd = wd; + } +} diff --git a/src/main/java/com/yssh/service/XlsExportService.java b/src/main/java/com/yssh/service/XlsExportService.java new file mode 100644 index 0000000..57556f1 --- /dev/null +++ b/src/main/java/com/yssh/service/XlsExportService.java @@ -0,0 +1,24 @@ +package com.yssh.service; + +import org.springframework.core.io.ClassPathResource; +import org.springframework.stereotype.Service; + +import java.io.IOException; + +/** + * Excel瀵煎嚭鏈嶅姟绫� + * @author WWW + * @author 2023-08-05 + */ +@Service +public class XlsExportService { + /** + * 鑾峰彇Excel妯℃澘 + */ + private String getXslTemplate(String type) throws IOException { + ClassPathResource resource = new ClassPathResource(String.format("templates/%s.xlsx", type)); + + return resource.exists() ? resource.getFile().getPath() : null; + } + +} diff --git a/src/main/java/com/yssh/utils/ExcelUtils.java b/src/main/java/com/yssh/utils/ExcelUtils.java index c3b81ba..b7cac0a 100644 --- a/src/main/java/com/yssh/utils/ExcelUtils.java +++ b/src/main/java/com/yssh/utils/ExcelUtils.java @@ -10,7 +10,7 @@ import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.fill.FillConfig; import com.alibaba.excel.write.metadata.fill.FillWrapper; -import com.yssh.entity.ExcelHead; +import com.yssh.entity.xls.ExcelHead; import java.util.*; diff --git a/src/main/resources/templates/day.xlsx b/src/main/resources/templates/day.xlsx index 49a5786..e7afc3f 100644 --- a/src/main/resources/templates/day.xlsx +++ b/src/main/resources/templates/day.xlsx Binary files differ diff --git a/src/main/resources/templates/month.xlsx b/src/main/resources/templates/month.xlsx index c40e52f..7529646 100644 --- a/src/main/resources/templates/month.xlsx +++ b/src/main/resources/templates/month.xlsx Binary files differ diff --git a/src/main/resources/templates/week.xlsx b/src/main/resources/templates/week.xlsx index f35f229..5d61b7a 100644 --- a/src/main/resources/templates/week.xlsx +++ b/src/main/resources/templates/week.xlsx Binary files differ -- Gitblit v1.9.3