|
|
@ -7,8 +7,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
|
|
|
import jnpf.config.ConfigValueUtil;
|
|
|
|
import jnpf.mobilePort.entity.PurchaseOrderVO;
|
|
|
|
import jnpf.mobilePort.entity.PurchaseOrderVO;
|
|
|
|
import jnpf.mobilePort.utils.ExportPdf;
|
|
|
|
import jnpf.mobilePort.utils.ExportPdf;
|
|
|
|
|
|
|
|
import jnpf.mobilePort.utils.MultipartFileDto;
|
|
|
|
import jnpf.permission.model.authorize.AuthorizeConditionModel;
|
|
|
|
import jnpf.permission.model.authorize.AuthorizeConditionModel;
|
|
|
|
import jnpf.permission.service.AuthorizeService;
|
|
|
|
import jnpf.permission.service.AuthorizeService;
|
|
|
|
import jnpf.purchaseorder.entity.*;
|
|
|
|
import jnpf.purchaseorder.entity.*;
|
|
|
@ -19,15 +21,16 @@ import jnpf.purchaseorder.service.*;
|
|
|
|
import jnpf.util.ServletUtil;
|
|
|
|
import jnpf.util.ServletUtil;
|
|
|
|
import jnpf.util.StringUtil;
|
|
|
|
import jnpf.util.StringUtil;
|
|
|
|
import jnpf.util.UserProvider;
|
|
|
|
import jnpf.util.UserProvider;
|
|
|
|
|
|
|
|
import org.apache.http.entity.ContentType;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.net.URLEncoder;
|
|
|
@ -73,6 +76,8 @@ public class PurchaseorderitemServiceImpl extends ServiceImpl<PurchaseorderitemM
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private PurchaseorderitemMapper purchaseorderitemMapper;
|
|
|
|
private PurchaseorderitemMapper purchaseorderitemMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ConfigValueUtil configValueUtil;
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ResponseEntity<byte[]> getPdfInfo(){
|
|
|
|
public ResponseEntity<byte[]> getPdfInfo(){
|
|
|
|
PurchaseorderPagination pagination = new PurchaseorderPagination();
|
|
|
|
PurchaseorderPagination pagination = new PurchaseorderPagination();
|
|
|
@ -93,7 +98,7 @@ if (pMap!=null&&pMap.size()>0){
|
|
|
|
map.put("contractNo", pVO.getContractNo());
|
|
|
|
map.put("contractNo", pVO.getContractNo());
|
|
|
|
map.put("contractCode",pVO.getContractCode());
|
|
|
|
map.put("contractCode",pVO.getContractCode());
|
|
|
|
map.put("supplierName", pVO.getSupplierName());
|
|
|
|
map.put("supplierName", pVO.getSupplierName());
|
|
|
|
|
|
|
|
map.put("documentNo",pVO.getDocumentNo());
|
|
|
|
List<Purchaseorder_item0Model> list = pVO.getPurchaseorder_item0List();
|
|
|
|
List<Purchaseorder_item0Model> list = pVO.getPurchaseorder_item0List();
|
|
|
|
Integer settlement=0;
|
|
|
|
Integer settlement=0;
|
|
|
|
BigDecimal settlementSum = new BigDecimal(settlement);
|
|
|
|
BigDecimal settlementSum = new BigDecimal(settlement);
|
|
|
@ -116,13 +121,29 @@ if (pMap!=null&&pMap.size()>0){
|
|
|
|
System.out.println("AAAAAAAAAAAAAAAAAAAAAA ");
|
|
|
|
System.out.println("AAAAAAAAAAAAAAAAAAAAAA ");
|
|
|
|
//repotData自己加测试数据
|
|
|
|
//repotData自己加测试数据
|
|
|
|
|
|
|
|
|
|
|
|
out= exportPdf.createPdf(map, "test.ftl", "/templates/export");
|
|
|
|
out = exportPdf.createPdf(map, "test.ftl", "/templates/export");
|
|
|
|
bytes = out.toByteArray();
|
|
|
|
bytes = out.toByteArray();
|
|
|
|
String fileName="测试.pdf";
|
|
|
|
String fileName="废钢采购订单("+map.get("supplierName")+")("+map.get("creatorTime")+").pdf";
|
|
|
|
fileName = URLEncoder.encode(fileName, "utf-8");
|
|
|
|
fileName = URLEncoder.encode(fileName, "utf-8");
|
|
|
|
headers = new HttpHeaders();
|
|
|
|
headers = new HttpHeaders();
|
|
|
|
headers.add("Content-Disposition",
|
|
|
|
headers.add("Content-Disposition",
|
|
|
|
"attachment; filename=" + fileName);
|
|
|
|
"attachment; filename=" + fileName);
|
|
|
|
|
|
|
|
// 存在本地文件中
|
|
|
|
|
|
|
|
InputStream inputStream = new ByteArrayInputStream(bytes);
|
|
|
|
|
|
|
|
MultipartFile file = new MultipartFileDto(ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String templateFilePath = configValueUtil.getTemplateFilePath();
|
|
|
|
|
|
|
|
// FileUtil.upFile(file, templateFilePath+"/wc/", fileName);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
File f = new File(templateFilePath+"/wc/", fileName);
|
|
|
|
|
|
|
|
//将上传的文件存储到指定位置
|
|
|
|
|
|
|
|
file.transferTo(f);
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//"attachment; filename=" + new String(fileName.getBytes("gbk"), StandardCharsets.ISO_8859_1));
|
|
|
|
//"attachment; filename=" + new String(fileName.getBytes("gbk"), StandardCharsets.ISO_8859_1));
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
log.error("导出pdf失败:{}", e);
|
|
|
|
log.error("导出pdf失败:{}", e);
|
|
|
|