Переглянути джерело

增加销售订单商品英文保存

zhangchenm 1 день тому
батько
коміт
42c061c47e

+ 3 - 5
trade-client/src/main/java/com/trade/client/trade/salesorder/service/impl/SalesOrderCServiceImpl.java

@@ -244,11 +244,9 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
     }
 
     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"));
+            salesOrderGoods.setDeclarationName(salesOrderGoods.getEnValue("declarationName"));
+            salesOrderGoods.setUnit(salesOrderGoods.getEnValue("unit"));
         }
         return transStruct.transOrder2GoodsInfo4TLList(salesOrderGoodsList);
     }
@@ -310,7 +308,7 @@ public class SalesOrderCServiceImpl implements SalesOrderCService {
         params.put("importerContactPhone", importer.getContactMobile());
         params.put("currency", contractTerms.getPaymentCurrency());
         params.put("cardNo", contractTerms.getAccountNumber());
-        params.put("openBank", contractTerms.getEnValue("openingBank"));
+        params.put("bankName", contractTerms.getEnValue("bankName"));
         params.put("accountName", contractTerms.getEnValue("accountName"));
         params.put("swiftCode", contractTerms.getSwiftCode());
         params.put("orderTotal", salesOrder.getAmount());

+ 5 - 4
trade-service/src/main/java/com/trade/service/trade/salesorder/domain/SalesOrderGoods.java

@@ -1,11 +1,10 @@
 package com.trade.service.trade.salesorder.domain;
 
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.trade.common.core.domain.BizBaseEntity;
-import java.io.Serializable;
+import com.trade.common.annotation.I18nField;
 import java.math.BigDecimal;
-import java.time.LocalDateTime;
 
+import com.trade.common.core.domain.BizBaseI18nEntity;
 import com.trade.service.trade.salesorder.constant.SaleOrderConstant;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
@@ -24,7 +23,7 @@ import javax.validation.constraints.NotNull;
 @Getter
 @Setter
 @TableName("sales_order_goods")
-public class SalesOrderGoods extends BizBaseEntity {
+public class SalesOrderGoods extends BizBaseI18nEntity<SalesOrderGoods> {
 
     private static final long serialVersionUID = 1L;
     @ApiModelProperty(name = "saleOrderId", value = "销售订单ID")
@@ -38,12 +37,14 @@ public class SalesOrderGoods extends BizBaseEntity {
     @NotNull(message = "HS CODE不能为空")
     private String hsCode;
     @ApiModelProperty(name = "declarationName", value = "报关品名")
+    @I18nField
     private String declarationName;
     @ApiModelProperty(name = "name", value = "商品名称")
     @NotNull(message = "商品名称不能为空")
     private String name;
     @ApiModelProperty(name = "unit", value = "计量单位")
     @NotNull(message = "计量单位不能为空")
+    @I18nField
     private String unit;
     @ApiModelProperty(name = "packingSpecifications", value = "包装规格")
     @NotNull(message = "包装规格不能为空")

+ 15 - 0
trade-service/src/main/resources/data.init/v1.1/20241031_zhangchenming.sql

@@ -1,3 +1,18 @@
+-- 20241123
+DROP TABLE IF EXISTS `sales_order_goods_i18n`;
+CREATE TABLE `sales_order_goods_i18n`
+(
+    `id`               bigint(20) NOT NULL,
+    `language`         varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+    `declaration_name` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+    `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+    PRIMARY KEY (`id`, `language`) USING BTREE,
+    UNIQUE INDEX `id_idx` (`id`, `language`) USING BTREE
+) ENGINE = InnoDB
+  CHARACTER SET = utf8mb4
+  COLLATE = utf8mb4_general_ci
+  ROW_FORMAT = Dynamic;
+
 -- 20241022
 -- 进口商新增字段
 ALTER TABLE `importer_entity`