|
@@ -214,7 +214,7 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
|
|
|
SFileTemplate fileTemplate = fileTemplateService.selectByFileType(FileTypeEnum.PROFORMA_INVOICE.getCode());
|
|
|
try {
|
|
|
Map<String, Object> titleData = initTemplateParams(salesOrder, invoiceNo);
|
|
|
- List<GoodsInfo4TL> goodsList = transStruct.transOrder2GoodsInfo4TLList(salesOrderGoodsList);
|
|
|
+ List<GoodsInfo4TL> goodsList = handleGoodsList(salesOrderGoodsList);
|
|
|
// 写入Excel文件
|
|
|
try (ExcelWriter excelWriter = EasyExcel.write(transientFileName).withTemplate(fileTemplate.getSrcPath())
|
|
|
.build()) {
|
|
@@ -243,6 +243,16 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
|
|
|
return fileStorage.getId();
|
|
|
}
|
|
|
|
|
|
+ private List<GoodsInfo4TL> handleGoodsList(List<SalesOrderGoods> salesOrderGoodsList) {
|
|
|
+ // 存在优化点
|
|
|
+ for (SalesOrderGoods salesOrderGoods : salesOrderGoodsList) {
|
|
|
+ SalesCommodity salesCommodity = salesCommodityService.getById(salesOrderGoods.getSalesCommodityId());
|
|
|
+ salesOrderGoods.setDeclarationName(salesCommodity.getI18nValue("declarationName", "en"));
|
|
|
+ salesOrderGoods.setUnit(salesCommodity.getI18nValue("measurementUnit", "en"));
|
|
|
+ }
|
|
|
+ return transStruct.transOrder2GoodsInfo4TLList(salesOrderGoodsList);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 初始化模板参数
|
|
|
*
|
|
@@ -259,20 +269,21 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
|
|
|
Enterprise enterprise = enterpriseBaseService.getEnterpriseByCustomerId(salesOrder.getCustomerUserId());
|
|
|
EnterpriseRelatedPerson contact = relatedPersonBaseService
|
|
|
.getContactByChangeRecordId(enterprise.getChangeRecordId());
|
|
|
- String customerName = enterprise.getName();
|
|
|
- String customerAddress = StringUtils.isEmpty(enterprise.getBusinessAddress()) ? enterprise.getRegisterAddress()
|
|
|
- : enterprise.getBusinessAddress();
|
|
|
+ String customerName = enterprise.getEnValue("name");
|
|
|
+ String customerAddress = StringUtils.isEmpty(enterprise.getEnValue("businessAddress"))
|
|
|
+ ? enterprise.getEnValue("registerAddress")
|
|
|
+ : enterprise.getEnValue("businessAddress");
|
|
|
String contractTel = contact.getMobile();
|
|
|
String email = contact.getEmail();
|
|
|
- String contactName = contact.getName();
|
|
|
+ String contactName = contact.getEnValue("name");
|
|
|
if (DictConstants.EXPORT_TYPE_PROXY.equals(enterprise.getExportType())) {
|
|
|
TradingPlatform tradingPlatform = tradingPlatformBaseService.lambdaQuery()
|
|
|
.eq(TradingPlatform::getCertNo, salesContract.getAgencyCertNo()).one();
|
|
|
- customerName = tradingPlatform.getPlatformName();
|
|
|
- customerAddress = tradingPlatform.getBusinessAddress();
|
|
|
+ customerName = tradingPlatform.getEnValue("platformName");
|
|
|
+ customerAddress = tradingPlatform.getEnValue("businessAddress");
|
|
|
contractTel = tradingPlatform.getContactMobile();
|
|
|
email = tradingPlatform.getContactEmail();
|
|
|
- contactName = tradingPlatform.getContactName();
|
|
|
+ contactName = tradingPlatform.getEnValue("contactName");
|
|
|
}
|
|
|
// 支付方式 页面选其他,后台取不到值,默认"" PS: The final interpretation rights belong to the product manager who will never make
|
|
|
// a mistake
|
|
@@ -292,14 +303,15 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
|
|
|
params.put("incoTerms", salesContract.getTradeTerms());
|
|
|
params.put("payWay", paymentWay);
|
|
|
params.put("importerName", importer.getEntityName());
|
|
|
- params.put("importerAddress", importer.getBusinessAddress());
|
|
|
+ params.put("importerAddress", StringUtils.joinWith(",", importer.getBusinessAddress(),
|
|
|
+ importer.getBusinessCity(), importer.getBusinessProvince(), importer.getBusinessPostCode()));
|
|
|
params.put("importerContactName", importer.getContactName());
|
|
|
params.put("importerContactEmail", importer.getContactEmail());
|
|
|
params.put("importerContactPhone", importer.getContactMobile());
|
|
|
params.put("currency", contractTerms.getPaymentCurrency());
|
|
|
params.put("cardNo", contractTerms.getAccountNumber());
|
|
|
- params.put("openBank", contractTerms.getOpeningBank());
|
|
|
- params.put("accountName", contractTerms.getAccountName());
|
|
|
+ params.put("openBank", contractTerms.getEnValue("openingBank"));
|
|
|
+ params.put("accountName", contractTerms.getEnValue("accountName"));
|
|
|
params.put("swiftCode", contractTerms.getSwiftCode());
|
|
|
params.put("orderTotal", salesOrder.getAmount());
|
|
|
params.put("shippingMethod", orderLogistics.getShippingMethod());
|