|
@ -450,7 +450,74 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 导出客户报价模板2 |
|
|
|
|
|
* */ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void exportCustomerQuoteTwo(String supplierCode, HttpServletResponse response) { |
|
|
|
|
|
String fileName = "客户报价1.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(); |
|
|
|
|
|
//from
|
|
|
|
|
|
SysCompanyInformation sysCompanyInformation = companyInformations.get(0); |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//区分不同币种的金额
|
|
|
private void setMaterialPrice(ExportCustomerQuoteChildVo vo, SysCustomerVo sysCustomerVo, SysCustomerQuoteChild child) { |
|
|
private void setMaterialPrice(ExportCustomerQuoteChildVo vo, SysCustomerVo sysCustomerVo, SysCustomerQuoteChild child) { |
|
|
if (RMB.equals(sysCustomerVo.getCommonCurrency())) { |
|
|
if (RMB.equals(sysCustomerVo.getCommonCurrency())) { |
|
|
// RMB
|
|
|
// RMB
|
|
|