ソースを参照

多语言插件更新场景bug修复

liangbo.huang 2 週間 前
コミット
458374057c

+ 1 - 1
trade-common/src/main/java/com/trade/common/config/mybatis/plugin/I18nSqlProcessInterceptor.java

@@ -176,7 +176,7 @@ public class I18nSqlProcessInterceptor implements Interceptor {
                                     execInsertOrUpdateList(metaDataMap, finalTableInfo.getTableName(), connection, id);
                                 });
                             }
-                        } else if (parameterMap.containsKey("et")
+                        } else if (parameterMap.containsKey("et") && parameterMap.get("et") != null
                                 && BaseI18nEntity.class.isAssignableFrom(parameterMap.get("et").getClass())) {
                                     // updateById,updateAllColumnsById method
                                     Object baseEntity = parameterMap.get("et");

+ 7 - 2
trade-service/src/main/java/com/trade/service/enterprise/customer/domain/EnterpriseRelatedPerson.java

@@ -2,7 +2,8 @@ package com.trade.service.enterprise.customer.domain;
 
 import java.util.Date;
 
-import com.trade.common.core.domain.BaseEntity;
+import com.trade.common.annotation.I18nField;
+import com.trade.common.core.domain.BaseI18nEntity;
 
 /**
  * 企业相关人员表实体类
@@ -10,7 +11,7 @@ import com.trade.common.core.domain.BaseEntity;
  * @author hlb
  * @since 2024-05-29 15:07:42
  */
-public class EnterpriseRelatedPerson extends BaseEntity<EnterpriseRelatedPerson> {
+public class EnterpriseRelatedPerson extends BaseI18nEntity<EnterpriseRelatedPerson> {
     /**
      * 企业变更记录ID
      */
@@ -30,6 +31,7 @@ public class EnterpriseRelatedPerson extends BaseEntity<EnterpriseRelatedPerson>
     /**
      * 人员姓名
      */
+    @I18nField
     private String name;
     /**
      * 人员联系电话
@@ -265,5 +267,8 @@ public class EnterpriseRelatedPerson extends BaseEntity<EnterpriseRelatedPerson>
         this.gmtCreate = gmtCreate;
     }
 
+    public String getNameEn() {
+        return getI18nValue("name", "en");
+    }
 }
 

+ 6 - 2
trade-service/src/main/java/com/trade/service/enterprise/customer/dto/EnterpriseRelatedPersonDto.java

@@ -1,7 +1,7 @@
 package com.trade.service.enterprise.customer.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.trade.common.core.dto.BaseDTO;
+import com.trade.common.core.dto.BaseI18nDto;
 import com.trade.common.validate.ValidatorGroup;
 import com.trade.service.filestorage.dto.FileAbstractDto;
 
@@ -15,7 +15,7 @@ import java.util.Date;
  * @author hlb
  * @since 2024-05-29 15:07:43
  */
-public class EnterpriseRelatedPersonDto extends BaseDTO {
+public class EnterpriseRelatedPersonDto extends BaseI18nDto {
 
     /**
      * 主键id
@@ -374,4 +374,8 @@ public class EnterpriseRelatedPersonDto extends BaseDTO {
     public void setGmtModified(Date gmtModified) {
         this.gmtModified = gmtModified;
     }
+
+    public String getNameEn() {
+        return getI18nValue("name", "en");
+    }
 }

+ 1 - 1
trade-service/src/main/java/com/trade/service/serialNum/service/impl/SerialNumberGeneratorImpl.java

@@ -165,7 +165,7 @@ public class SerialNumberGeneratorImpl implements SerialNumberGenerator {
 
     @Override
     public String generateTaxRebateAgreementNo(String enterpriseName) {
-        String pinYinFirstChar = ChinesePinYinUtil.getPinYinFirstChar(enterpriseName);
+        String pinYinFirstChar = ChinesePinYinUtil.getPinYinFirstChar(enterpriseName).toUpperCase();
         String enterpriseCode = StrUtil.fillAfter(pinYinFirstChar, 'X', 5).substring(0, 5);
         return ConstantUtil.TAX_REBATE_AGREEMENT_NO_PREFIX + "-" + enterpriseCode + "-"
                 + DateUtils.dateTimeNow(DateUtils.YYYYMMDD);

+ 11 - 0
trade-service/src/main/resources/data.init/v1.1/20241022.sql

@@ -200,3 +200,14 @@ CREATE TABLE `trading_platform_i18n`
 INSERT INTO `s_file_template` (`template_code`, `file_type`, `default_name`, `src_path`, `dest_dir`, `deleted`)
 VALUES ('taxRebateAgreement', 'taxRebateAgreement', '技术服务合同(退税服务)',
         '/data/contract_template/技术服务合同(退税服务).docx', 'trade-user_document', 0);
+
+CREATE TABLE `enterprise_related_person_i18`
+(
+    `id`       bigint(20)   NOT NULL,
+    `language` varchar(255) NOT NULL,
+    `name`     varchar(255) DEFAULT NULL,
+    PRIMARY KEY (`id`, `language`)
+) ENGINE = InnoDB
+  DEFAULT CHARSET = utf8mb4
+  COLLATE = utf8mb4_general_ci
+  ROW_FORMAT = Dynamic;