|
|
@ -455,7 +455,73 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService { |
|
|
|
* */ |
|
|
|
@Override |
|
|
|
public void exportCustomerQuoteTwo(String supplierCode, HttpServletResponse response) { |
|
|
|
String fileName = "客户报价1.xlsx"; |
|
|
|
String fileName = "客户报价2.xlsx"; |
|
|
|
|
|
|
|
FileDownloadUtils fileDownloadUtils = new FileDownloadUtils(); |
|
|
|
try { |
|
|
|
|
|
|
|
String fileRelativePath = fileDownloadUtils.getFileRelativePath(fileName); |
|
|
|
|
|
|
|
String realFileName = supplierCode +"-" + fileName.substring(0, fileName.indexOf(".")) + ".xlsx"; |
|
|
|
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8")); |
|
|
|
response.setContentType("application/octet-stream"); |
|
|
|
|
|
|
|
//to
|
|
|
|
SysCustomerQuote sysCustomerQuote = sysCustomerQuoteMapper.selectSysCustomerBySupplierCode(supplierCode); |
|
|
|
if(sysCustomerQuote==null){ |
|
|
|
log.warn("客户报价信息不存在:{}", supplierCode); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<SysCustomerQuoteChild> sysCustomerQuoteChildren = sysCustomerQuoteChildMapper.selectSysCustomerQuoteChildByQuoteId(sysCustomerQuote.getSupplierCode()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String customerCode = sysCustomerQuote.getCustomerCode(); |
|
|
|
SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerByEnterpriseCode(customerCode); |
|
|
|
|
|
|
|
|
|
|
|
List<SysCompanyInformation> companyInformations = companyInformationMapper.selectSysCompanyInformationAllList(); |
|
|
|
|
|
|
|
HashMap<String, Object> map = new HashMap<>(); |
|
|
|
String pricingDate = sysCustomerQuote.getPricingDate(); |
|
|
|
|
|
|
|
map.put("supplierCode", sysCustomerQuote.getSupplierCode()); |
|
|
|
map.put("pricingDate", pricingDate); |
|
|
|
map.put("customerContact", sysCustomerVo.getCustomerContact()); |
|
|
|
map.put("contactNumberTo", sysCustomerVo.getContactNumber()); |
|
|
|
map.put("customerEmail", sysCustomerVo.getCustomerEmail()); |
|
|
|
|
|
|
|
List<ExportCustomerQuoteChildVo> exportCustomerQuoteChildVos = new ArrayList<>(); |
|
|
|
for (SysCustomerQuoteChild sysCustomerQuoteChild : sysCustomerQuoteChildren) { |
|
|
|
ExportCustomerQuoteChildVo exportCustomerQuoteChildVo = new ExportCustomerQuoteChildVo(); |
|
|
|
exportCustomerQuoteChildVo.setDescribe(sysCustomerQuoteChild.getDescribe()); |
|
|
|
exportCustomerQuoteChildVo.setMaterialNum(sysCustomerQuoteChild.getMaterialNum()); |
|
|
|
//区分币种
|
|
|
|
setMaterialPrice(exportCustomerQuoteChildVo, sysCustomerVo, sysCustomerQuoteChild); |
|
|
|
exportCustomerQuoteChildVos.add(exportCustomerQuoteChildVo); |
|
|
|
} |
|
|
|
|
|
|
|
ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileRelativePath).build(); |
|
|
|
WriteSheet sheet = EasyExcel.writerSheet().build(); |
|
|
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build(); |
|
|
|
workBook.fill(map, sheet); |
|
|
|
workBook.fill(exportCustomerQuoteChildVos, fillConfig, sheet); |
|
|
|
workBook.finish(); |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
throw new RuntimeException("文件处理失败",e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 导出客户报价模板3 |
|
|
|
* */ |
|
|
|
@Override |
|
|
|
public void exportCustomerQuoteThree(String supplierCode, HttpServletResponse response) { |
|
|
|
String fileName = "客户报价3.xlsx"; |
|
|
|
|
|
|
|
FileDownloadUtils fileDownloadUtils = new FileDownloadUtils(); |
|
|
|
try { |
|
|
@ -491,6 +557,9 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService { |
|
|
|
|
|
|
|
map.put("supplierCode", sysCustomerQuote.getSupplierCode()); |
|
|
|
map.put("pricingDate", pricingDate); |
|
|
|
map.put("contacts", sysCompanyInformation.getContacts()); |
|
|
|
map.put("contactNumberFrom", sysCompanyInformation.getContactNumber()); |
|
|
|
map.put("companyEmail", sysCompanyInformation.getCompanyEmail()); |
|
|
|
map.put("customerContact", sysCustomerVo.getCustomerContact()); |
|
|
|
map.put("contactNumberTo", sysCustomerVo.getContactNumber()); |
|
|
|
map.put("customerEmail", sysCustomerVo.getCustomerEmail()); |
|
|
|