采购开票文件名字修改

product
chuang 2 years ago
parent 217aba12f4
commit 1ded097a61

@ -49,9 +49,9 @@ public interface PurchaseorderitemService extends IService<PurchaseorderitemEnti
List<PurchasebackitemEntity> GetPurchasebackitemList(String id);
List<CollectionpoEntity> GetCollectionitemList(String id);
void getVehicle(List<HashMap<String, Object>> vehicleInfo, String templateFilePath) throws Exception;
void getVehicle(List<HashMap<String, Object>> vehicleInfo, String templateFilePath,String settlements) throws Exception;
void getZIP(String templateFilePath, HttpServletResponse response) throws Exception;
void getZIP(String templateFilePath, HttpServletResponse response,String settlements) throws Exception;
Map<String, Object> importPreview(List<PurchaseorderDTO> purchaseorderList);

@ -149,9 +149,9 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
@Autowired
private Receiptin_item0Service receiptin_item0Service;
public void getExcel(List<HashMap<String, Object>> list, String templateFilePath) throws Exception {
public void getExcel(List<HashMap<String, Object>> list, String templateFilePath,String settlements) throws Exception {
//声明要创建的文件名
String filename = templateFilePath + "\\废钢收货明细表.xls";
String filename = templateFilePath + "\\废钢收货明细表("+settlements+"吨).xls";
//创建 HSSFWorkbook 类的实例
HSSFWorkbook workbook = new HSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream(filename);
@ -430,7 +430,7 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
* @param templateFilePath
* @throws Exception
*/
public void getPdf(LambdaQueryWrapper<PurchaseorderitemEntity> wrapper, String templateFilePath) throws Exception {
public void getPdf(LambdaQueryWrapper<PurchaseorderitemEntity> wrapper, String templateFilePath,String settlements) throws Exception {
for (HashMap<String, Object> orderMap : purchaseorderitemMapper.getPdfInfo(wrapper)) {
byte[] bytes = null;
HttpHeaders headers = null;
@ -460,7 +460,7 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
// word模板
out = exportPdf.createPdf(map, "test.ftl", "/templates/export");
bytes = out.toByteArray();
String fileName = "废钢采购订单(" + map.get("supplierName") + ").pdf";
String fileName = "废钢采购订单(" + map.get("supplierName") + settlements+").pdf";
// fileName = URLEncoder.encode(fileName, "utf-8");
// 存在本地文件中
@ -509,7 +509,7 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
* @throws Exception
* @TODO word
*/
public void getWord(List<HashMap<String, Object>> list, String templateFilePath) throws Exception {
public void getWord(List<HashMap<String, Object>> list, String templateFilePath,String settlements) throws Exception {
// 创建一个新的word文件
Document document = new Document();
Section section = document.addSection();
@ -579,7 +579,7 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
}
}
//生成word文档
document.saveToFile(templateFilePath + "废钢收获榜单照片(" + titleStr + ").docx", FileFormat.Docx_2013);
document.saveToFile(templateFilePath + "废钢收获榜单照片(" + titleStr +settlements+"吨).docx", FileFormat.Docx_2013);
document.close();
log.warn("word文档生成成功");
}
@ -599,11 +599,11 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
List<HashMap<String, Object>> vehicleInfo = purchaseorderitemMapper.getVehicleInfo(wrapper);
List<HashMap<String, Object>> titleInfo = purchaseorderitemMapper.getTitleInfo(wrapper);
String settlement = String.valueOf(titleInfo.get(0).get("settlement"));
this.getPdf(wrapper, templateFilePath);
this.getWord(info, templateFilePath);
this.getExcel(info, templateFilePath);
this.getVehicle(vehicleInfo, templateFilePath);
this.getZIP(templateFilePath, response);
this.getPdf(wrapper, templateFilePath,settlement);
this.getWord(info, templateFilePath,settlement);
this.getExcel(info, templateFilePath,settlement);
this.getVehicle(vehicleInfo, templateFilePath,settlement);
this.getZIP(templateFilePath, response,settlement);
} else {
log.error("采购订单号出错!查不到该采购订单!");
}
@ -1245,7 +1245,7 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
}
@Override
public void getVehicle(List<HashMap<String, Object>> vehicleInfo, String templateFilePath) throws Exception {
public void getVehicle(List<HashMap<String, Object>> vehicleInfo, String templateFilePath,String settlements) throws Exception {
// BufferedInputStream input = null;
// BufferedOutputStream out = null;
if (vehicleInfo != null && vehicleInfo.size() > 0) {
@ -1264,14 +1264,14 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
String s1 = (i+1) + "-" + s2 + s3 + s4;
File outImg = new File(templateFilePath + "vehicle\\" + s1 + "\\" + UUID.randomUUID().toString().replaceAll("-", "") + ".png");
File outImg = new File(templateFilePath + "车辆信息照片"+settlements+"吨\\" + s1 + "\\" + UUID.randomUUID().toString().replaceAll("-", "") + ".png");
File parentFile = outImg.getParentFile();
if (!parentFile.exists()) {
parentFile.mkdirs();
}
// log.warn(templateFilePath+s1+"\\"+"vehicle\\"+ UUID.randomUUID().toString().replaceAll("-", "")+".png");
//
FileCopy.copyFile(vehicleImg, templateFilePath + "vehicle\\" + s1 + "\\");
FileCopy.copyFile(vehicleImg, templateFilePath + "车辆信息照片"+settlements+"吨\\" + s1 + "\\");
// input = new BufferedInputStream(new FileInputStream(vehicleImg));
// out = new BufferedOutputStream(new FileOutputStream(outImg));
// byte[] bys = new byte[1024];
@ -1290,7 +1290,7 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
}
@Override
public void getZIP(String templateFilePath, HttpServletResponse response) throws Exception {
public void getZIP(String templateFilePath, HttpServletResponse response,String settlements) throws Exception {
OutputStream toClient = null;
String s = null;
File file1 = null;
@ -1312,7 +1312,7 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
fis.read(buffer);
fis.close();
response.reset();
String excelTitle = "历史数据";
String excelTitle = settlements+"吨收货资料";
String fileName = URLEncoder.encode(excelTitle, "UTF-8").replaceAll("\\+", "%20");
// 设置response的Header
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".zip");

Loading…
Cancel
Save