|
|
@ -75,10 +75,13 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.util.*; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
@ -116,6 +119,8 @@ public class AsOldpartreturnApplyService extends MybatisBaseService<AsOldpartret |
|
|
|
private MessageFeign messageFeign; |
|
|
|
@Autowired |
|
|
|
private AsOldpartreturnService asOldpartreturnService; |
|
|
|
@Autowired |
|
|
|
private HttpServletResponse response; |
|
|
|
|
|
|
|
public PagerVo<AsOldpartreturnApplyVo> listPageVo(PagerQuery<AsOldpartreturnApplyQuery> pq) { |
|
|
|
AsOldpartreturnApplyQuery query = pq.getParams(); |
|
|
@ -807,4 +812,29 @@ public class AsOldpartreturnApplyService extends MybatisBaseService<AsOldpartret |
|
|
|
} |
|
|
|
return obj; |
|
|
|
} |
|
|
|
|
|
|
|
public void downloadExcel() { |
|
|
|
try { |
|
|
|
InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("static/旧件返厂商品列表.xls"); |
|
|
|
//获取要下载的模板名称
|
|
|
|
String fileName = "旧件返厂商品列表.xls"; |
|
|
|
response.setHeader("content-type", "application/octet-stream"); |
|
|
|
response.setContentType("application/octet-stream"); |
|
|
|
// 下载文件能正常显示中文
|
|
|
|
fileName = URLEncoder.encode(fileName, "UTF-8"); |
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
|
|
|
response.setHeader("fileName", fileName); |
|
|
|
response.setHeader("Access-Control-Expose-Headers", "filename"); |
|
|
|
OutputStream out = response.getOutputStream(); |
|
|
|
byte[] b = new byte[2048]; |
|
|
|
int len; |
|
|
|
while ((len = resourceAsStream.read(b)) != -1) { |
|
|
|
out.write(b, 0, len); |
|
|
|
} |
|
|
|
out.close(); |
|
|
|
resourceAsStream.close(); |
|
|
|
} catch (Exception ex) { |
|
|
|
ex.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |