diff --git a/project.7z b/project.7z new file mode 100644 index 0000000..f652565 Binary files /dev/null and b/project.7z differ diff --git a/project/jiaqingjiayi/src/main/java/com/cj/jiaqingjiayi/utils/ExcelUtils.java b/project/jiaqingjiayi/src/main/java/com/cj/jiaqingjiayi/utils/ExcelUtils.java new file mode 100644 index 0000000..132e75a --- /dev/null +++ b/project/jiaqingjiayi/src/main/java/com/cj/jiaqingjiayi/utils/ExcelUtils.java @@ -0,0 +1,85 @@ +package com.cj.jiaqingjiayi.utils; + + + + + + +import com.cj.jiaqingjiayi.common.ErrorCode; +import com.cj.jiaqingjiayi.exception.BusinessException; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * Excel工具类 + * + * @author bsz + * */ +@SuppressWarnings("all") +public class ExcelUtils { + + /** + * 获取路径 + * + * @return 当前路径 + */ + public static String getPath() { + return ExcelUtils.class.getResource("/").getPath(); + } + + /** + * 创建新文件 + * + * @param pathName 文件名 + * @return 文件 + */ + public static File createNewFile(String pathName) { + File file = new File(getPath() + pathName); + if (file.exists()) { + file.delete(); + } else { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + } + return file; + } + + /** + * 设置响应结果 + * + * @param response 响应结果对象 + * @param rawFileName 文件名 + */ + public static void setExcelResponseProp(HttpServletResponse response, String rawFileName) throws IOException { + //设置内容类型 + response.setContentType("application/vnd.vnd.ms-excel"); + //设置编码格式 + response.setCharacterEncoding("utf-8"); + //设置导出文件名称(避免乱码) + String fileName = URLEncoder.encode(rawFileName.concat(".xlsx"), "UTF-8"); + // 设置响应头 + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName); + } + + /** + * Date转String + * + * @param date 日期 + * @return 字符串 + */ + public static String dateToString(Date date) { + if (date == null) { + throw new BusinessException(ErrorCode.NOT_FOUND_ERROR); + } + // Date转换为String + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-hh:mm"); + return sdf.format(date); + } + +} diff --git a/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/LoginUserDTO.class b/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/LoginUserDTO.class new file mode 100644 index 0000000..d3e5c62 Binary files /dev/null and b/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/LoginUserDTO.class differ diff --git a/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/request/BusinessDTO.class b/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/request/BusinessDTO.class new file mode 100644 index 0000000..e44c65b Binary files /dev/null and b/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/request/BusinessDTO.class differ diff --git a/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/request/UserDTO.class b/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/request/UserDTO.class new file mode 100644 index 0000000..19a7be5 Binary files /dev/null and b/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/request/UserDTO.class differ diff --git a/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/vo/OrdersExcelVO.class b/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/vo/OrdersExcelVO.class new file mode 100644 index 0000000..ade5a74 Binary files /dev/null and b/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/model/vo/OrdersExcelVO.class differ diff --git a/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/utils/ExcelUtils.class b/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/utils/ExcelUtils.class new file mode 100644 index 0000000..a2a67f9 Binary files /dev/null and b/project/jiaqingjiayi/target/classes/com/cj/jiaqingjiayi/utils/ExcelUtils.class differ