瀏覽代碼

销售合同

wanglang 4 天之前
父節點
當前提交
3ae09c5962

+ 20 - 9
trade-client/src/main/java/com/trade/client/trade/salescontract/service/impl/SalesServiceImpl.java

@@ -733,7 +733,8 @@ public class SalesServiceImpl implements SalesService {
             ImporterEntity importerEntity = IImporterEntityService.getByCertNo(salesContract.getImporterCertNo());
             if (importerEntity != null) {
                 contractTemplateDto.setBuyer(importerEntity.getEntityName());
-                contractTemplateDto.setBuyerEn(getEnValues(importerEntity.getI18n(), "entityName"));
+                contractTemplateDto.setBuyerEn(importerEntity.getEntityName());
+                // contractTemplateDto.setBuyerEn(getEnValues(importerEntity.getI18n(), "entityName"));
             }
             EnterpriseDto enterpriseDto = enterpriseService.queryMyEnterprise();
             if (DictConstants.EXPORT_TYPE_PROXY.equals(enterpriseDto.getExportType())) {
@@ -788,9 +789,11 @@ public class SalesServiceImpl implements SalesService {
             contractTemplateDto.setRemark(contractTerms.getRemark());
             contractTemplateDto.setRemarkEn(getEnValues(contractTerms.getI18n(), "remark"));
             contractTemplateDto.setPortDeparture(salesContract.getPortDeparture());
-            contractTemplateDto.setPortDepartureEn(getEnValues(salesContract.getI18n(), "portDeparture"));
+            // contractTemplateDto.setPortDepartureEn(getEnValues(salesContract.getI18n(), "portDeparture"));
+            contractTemplateDto.setPortDepartureEn(salesContract.getPortDeparture());
             contractTemplateDto.setPortDestination(salesContract.getPortDestination());
-            contractTemplateDto.setPortDestinationEn(getEnValues(salesContract.getI18n(), "portDestination"));
+            contractTemplateDto.setPortDestinationEn(salesContract.getPortDestination());
+            // contractTemplateDto.setPortDestinationEn(getEnValues(salesContract.getI18n(), "portDestination"));
             contractTemplateDto.setTradeTerms(salesContract.getTradeTerms());
             StringBuffer paymentInfo = new StringBuffer();
             StringBuffer paymentInfoEn = new StringBuffer();
@@ -821,9 +824,11 @@ public class SalesServiceImpl implements SalesService {
             contractTemplateDto.setOpeningBankEn(getEnValues(contractTerms.getI18n(), "openingBank"));
             if (importerEntity != null) {
                 contractTemplateDto.setBuyerContact(importerEntity.getContactName());
-                contractTemplateDto.setBuyerContactEn(getEnValues(importerEntity.getI18n(), "contactName"));
+                contractTemplateDto.setBuyerContactEn(importerEntity.getContactName());
+                // contractTemplateDto.setBuyerContactEn(getEnValues(importerEntity.getI18n(), "contactName"));
                 contractTemplateDto.setBuyerAddress(importerEntity.getBusinessAddress());
-                contractTemplateDto.setBuyerAddressEn(getEnValues(importerEntity.getI18n(), "businessAddress"));
+                contractTemplateDto.setBuyerAddressEn(importerEntity.getBusinessAddress());
+                // contractTemplateDto.setBuyerAddressEn(getEnValues(importerEntity.getI18n(), "businessAddress"));
                 contractTemplateDto.setBuyerEmail(importerEntity.getContactEmail());
             }
             if (CollectionUtil.isEmpty(titleInfos)) {
@@ -833,7 +838,7 @@ public class SalesServiceImpl implements SalesService {
                 if (titleInfos.size() == 1) {
                     ContractTermsExtend titleInfo = titleInfos.get(0);
                     contractTemplateDto
-                            .setTitleInfo("    " + titleInfo.getTermTitle() + "," + titleInfo.getContent() + "。");
+                            .setTitleInfo("     " + titleInfo.getTermTitle() + "," + titleInfo.getContent() + "。");
                     String titleInfoEn = getEnValues(titleInfo.getI18n(), "titleInfo");
                     String contentEn = getEnValues(titleInfo.getI18n(), "titleInfo");
                     contractTemplateDto.setTitleInfoEn("\n    " + titleInfoEn + "," + contentEn + ".");
@@ -845,7 +850,7 @@ public class SalesServiceImpl implements SalesService {
                         String titleInfoEn = getEnValues(titleInfo.getI18n(), "termTitle");
                         String contentEn = getEnValues(titleInfo.getI18n(), "content");
                         title.append("\n");
-                        title.append("   (").append(i + 1).append(")").append(titleInfo.getTermTitle()).append(",")
+                        title.append("    (").append(i + 1).append(")").append(titleInfo.getTermTitle()).append(",")
                                 .append(titleInfo.getContent()).append(";").append("\n");
                         titleEn.append("\n");
                         titleEn.append(" (").append(i + 1).append(")").append(titleInfoEn).append(",").append(contentEn)
@@ -992,8 +997,14 @@ public class SalesServiceImpl implements SalesService {
 
     private String getEnValues(Map<String, List<Map<String, String>>> i18n, String fieldName) {
         if (CollectionUtil.isNotEmpty(i18n) && CollectionUtil.isNotEmpty(i18n.get(fieldName))) {
-            Map<String, String> measurementUnit = i18n.get(fieldName).get(0);
-            return measurementUnit.get("value");
+            List<Map<String, String>> measurementUnits = i18n.get(fieldName);
+            if (CollectionUtil.isNotEmpty(measurementUnits)) {
+                Map<String, String> measurementUnit = measurementUnits.stream()
+                        .filter(m -> "en".equals(m.get("language"))).findFirst().orElse(null);
+                if (measurementUnit != null) {
+                    return measurementUnit.get("value");
+                }
+            }
         }
         return "";
     }