diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OptionalEbomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OptionalEbomApi.java index 6f8a2bba..31ba319e 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OptionalEbomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OptionalEbomApi.java @@ -25,6 +25,7 @@ import com.nflg.product.bomnew.service.aggreg.PublishMaterialService; import io.swagger.annotations.ApiParam; import nflg.product.common.constant.STATE; import nflg.product.common.vo.ResultVO; +import org.springframework.core.io.ClassPathResource; import org.springframework.web.bind.annotation.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -32,10 +33,10 @@ import com.nflg.product.base.core.api.BaseApi; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.OutputStream; +import java.io.*; +import java.net.URLEncoder; import java.util.Date; import java.util.List; import java.util.Objects; @@ -387,24 +388,36 @@ public class OptionalEbomApi extends BaseApi { @GetMapping("downDeviceExcelTemplate") @ApiOperation("导入数据模版下载") public void downImportExcelTemplate(HttpServletResponse response ) throws Exception { + + + + try { //获取要下载的模板名称 - String fileName = "importDataTemplate.xlsx"; - EasyExcelUtil.setExportHeader(response,"移动破数据导入模版"); - //模板文件存放路径 - String filePath = getClass().getResource("/template/"+fileName).getPath(); - //IO流处理模板 - FileInputStream input = new FileInputStream(filePath); - OutputStream out = response.getOutputStream(); - byte[] b = new byte[2048]; - int len; + ClassPathResource resource = new ClassPathResource("template/importDataTemplate.xlsx"); + + InputStream input = resource.getInputStream(); + + EasyExcelUtil.setExportHeader(response,"移动破数据导入模版"); + + //IO流处理模板 + + OutputStream out = response.getOutputStream(); + byte[] b = new byte[1024]; + int len; + int size=0; while ((len = input.read(b)) != -1) { out.write(b,0,len); + size+=len; } + //返回请求访问的结果 - response.setHeader("Content-Length", String.valueOf(input.getChannel().size())); + response.setHeader("Content-Length", String.valueOf(size)); + out.close(); input.close(); + out.flush(); + } catch (Exception e) { } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/excel/ExportDeviceHelper.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/excel/ExportDeviceHelper.java index 31943fb9..63aff154 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/excel/ExportDeviceHelper.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/excel/ExportDeviceHelper.java @@ -53,6 +53,14 @@ public class ExportDeviceHelper { } + + + + + + + + public static class ColumnMergeStrategy implements CellWriteHandler { diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/query/OptionalMbomMaterialListQuery.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/query/OptionalMbomMaterialListQuery.java index 7782ea3e..e39a7811 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/query/OptionalMbomMaterialListQuery.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/query/OptionalMbomMaterialListQuery.java @@ -17,11 +17,11 @@ public class OptionalMbomMaterialListQuery extends BasePageQuery implements S @ApiModelProperty(value = "开始时间") - private Date startDate; + private String startDate; @ApiModelProperty(value = "结束时间") - private Date endDate; + private String endDate; /** * 物料编码 diff --git a/nflg_project_dev/nflg-bom-new/src/main/resources/template/importDataTemplate.xlsx b/nflg_project_dev/nflg-bom-new/src/main/resources/template/importDataTemplate.xlsx deleted file mode 100644 index 20102e60..00000000 Binary files a/nflg_project_dev/nflg-bom-new/src/main/resources/template/importDataTemplate.xlsx and /dev/null differ