Преглед на файлове

Merge remote-tracking branch 'origin/v1.1-dev' into v1.1-dev

zhangchenm преди 2 седмици
родител
ревизия
b285926478
променени са 21 файла, в които са добавени 235 реда и са изтрити 34 реда
  1. 8 0
      trade-client/src/main/java/com/trade/client/enterprise/customer/constant/CustConstant.java
  2. 33 1
      trade-client/src/main/java/com/trade/client/enterprise/customer/service/impl/EnterpriseServiceImpl.java
  3. 0 9
      trade-client/src/main/java/com/trade/client/trade/exportrebate/dto/ExportTaxRebateDetailsDto.java
  4. 0 13
      trade-client/src/main/java/com/trade/client/trade/exportrebate/service/impl/ExportTaxRebateServiceImpl.java
  5. 7 0
      trade-common/pom.xml
  6. 9 5
      trade-common/src/main/java/com/trade/common/config/mybatis/plugin/I18nSqlProcessInterceptor.java
  7. 73 0
      trade-common/src/main/java/com/trade/common/utils/ChinesePinYinUtil.java
  8. 4 0
      trade-common/src/main/java/com/trade/common/utils/ConstantUtil.java
  9. 5 1
      trade-service/pom.xml
  10. 2 0
      trade-service/src/main/java/com/trade/service/business/payableaccounts/dto/ServiceFeeDto.java
  11. 12 0
      trade-service/src/main/java/com/trade/service/enterprise/customer/domain/Enterprise.java
  12. 12 0
      trade-service/src/main/java/com/trade/service/enterprise/customer/domain/EnterpriseChangeRecord.java
  13. 13 0
      trade-service/src/main/java/com/trade/service/enterprise/customer/dto/EnterpriseDto.java
  14. 1 2
      trade-service/src/main/java/com/trade/service/enterprise/customer/service/EnterpriseChangeRecordBaseService.java
  15. 8 0
      trade-service/src/main/java/com/trade/service/serialNum/service/SerialNumberGenerator.java
  16. 9 0
      trade-service/src/main/java/com/trade/service/serialNum/service/impl/SerialNumberGeneratorImpl.java
  17. 6 0
      trade-service/src/main/resources/data.init/v1.1/20241022.sql
  18. 3 1
      trade-service/src/main/resources/mapper/enterprise/customer/EnterpriseChangeRecordMapper.xml
  19. 3 1
      trade-service/src/main/resources/mapper/enterprise/customer/EnterpriseMapper.xml
  20. 5 1
      trade-service/src/main/resources/mapper/trade/exportrebate/TaxRebateExportDetailsMapper.xml
  21. 22 0
      trade-service/src/main/resources/templates/mail/TaxRebateServiceFeePayNotifyEmail.html

+ 8 - 0
trade-client/src/main/java/com/trade/client/enterprise/customer/constant/CustConstant.java

@@ -30,4 +30,12 @@ public class CustConstant {
      * 用户认证邮箱验证码模板名称
      */
     public static final String USER_CERTIFICATION_TEMPLATE = "UserCertification";
+    /**
+     * 出口退税服务费支付通知主题
+     */
+    public static final String TAX_REBATE_SERVICE_FEE_PAY_NOTIFY_SUBJECT = "【温馨提醒】你的出口退税服务费支付通知";
+    /**
+     * 出口退税服务费支付通知模板名称
+     */
+    public static final String TAX_REBATE_SERVICE_FEE_PAY_NOTIFY_TEMPLATE = "TaxRebateServiceFeePayNotifyEmail";
 }

+ 33 - 1
trade-client/src/main/java/com/trade/client/enterprise/customer/service/impl/EnterpriseServiceImpl.java

@@ -42,6 +42,8 @@ import com.trade.service.enterprise.customer.service.EnterpriseBaseService;
 import com.trade.service.enterprise.customer.service.EnterpriseChangeRecordBaseService;
 import com.trade.service.enterprise.customer.service.EnterpriseRelatedPersonBaseService;
 import com.trade.service.enterprise.customer.service.impl.EnterpriseDataConverter;
+import com.trade.service.message.EmailTemplate;
+import com.trade.service.serialNum.service.SerialNumberGenerator;
 import com.trade.service.thirdparty.sop.dto.*;
 import com.trade.service.thirdparty.sop.service.SOPService;
 import com.trade.service.thirdparty.xiaotu.configuration.XiaotuConfiguration;
@@ -57,7 +59,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
-import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -78,6 +79,10 @@ public class EnterpriseServiceImpl implements EnterpriseService {
     private BigDecimal taxRebateServiceFeeAmount;
     @Value("${taxRebate.serviceFee.payeeName:上海银颗科技服务有限公司}")
     private String taxRebateServiceFeePayeeName;
+    @Value("${taxRebate.serviceFee.payeeName:635973777}")
+    private String taxRebateServiceFeePayeeAccountNo;
+    @Value("${taxRebate.serviceFee.payeeName:中国民生银行股份有限公司上海曹杨支行}")
+    private String taxRebateServiceFeePayeeBankName;
     @Resource
     private CustomerMessageService customerMessageService;
     @Resource
@@ -106,6 +111,10 @@ public class EnterpriseServiceImpl implements EnterpriseService {
     private PayableAccountsService payableAccountsService;
     @Resource
     private SOPService sopService;
+    @Resource
+    private SerialNumberGenerator serialNumberGenerator;
+    @Resource
+    private EmailTemplate emailTemplate;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -414,10 +423,13 @@ public class EnterpriseServiceImpl implements EnterpriseService {
         contractFile.setSignFlowId(contractSignOutput.getFlowId());
         contractFileService.save(contractFile);
         // 更新退税服务协议签署状态:签署中
+        String taxRebateAgreementNo = serialNumberGenerator.generateTaxRebateAgreementNo(enterprise.getName());
         enterpriseBaseService.lambdaUpdate().eq(Enterprise::getId, enterprise.getId())
+                .set(Enterprise::getTaxRebateAgreementNo, taxRebateAgreementNo)
                 .set(Enterprise::getTaxRebateAgreementSignStatus, DictConstants.CONTRACT_STATUS_SIGNING).update();
         enterpriseChangeRecordBaseService.lambdaUpdate()
                 .eq(EnterpriseChangeRecord::getId, enterprise.getChangeRecordId())
+                .set(EnterpriseChangeRecord::getTaxRebateAgreementNo, taxRebateAgreementNo)
                 .set(EnterpriseChangeRecord::getTaxRebateAgreementSignStatus, DictConstants.CONTRACT_STATUS_SIGNING)
                 .update();
     }
@@ -501,6 +513,8 @@ public class EnterpriseServiceImpl implements EnterpriseService {
             contractFile.setSignedFileStorageId(signedFile2Biz.getFileId());
             contractFileService.updateById(contractFile);
             businessRelateFileBaseService.addBusinessRelateFiles(Collections.singletonList(businessRelateFile));
+            // 发送退税服务费支付通知邮件
+            sendTaxRebateServiceFeePayNotifyEmail(enterprise);
             // 生成“待支付退税服务费”记录
             ServiceFeeDto serviceFeeDto = new ServiceFeeDto();
             serviceFeeDto.setCustomerUserId(customerUser.getId());
@@ -508,6 +522,7 @@ public class EnterpriseServiceImpl implements EnterpriseService {
             serviceFeeDto.setPaymentCurrency("CNY");
             serviceFeeDto.setPaymentDeadline(bizData.getSignTime().plusHours(72));
             serviceFeeDto.setPayeeName(taxRebateServiceFeePayeeName);
+            serviceFeeDto.setContactFileId(signedFile2Biz.getFileId());
             payableAccountsService.saveTaxRefundServiceFee(serviceFeeDto);
         }
         // 更新授权书签署状态:status
@@ -524,6 +539,23 @@ public class EnterpriseServiceImpl implements EnterpriseService {
                 .update();
     }
 
+    void sendTaxRebateServiceFeePayNotifyEmail(Enterprise enterprise) {
+        Map<String, Object> variables = new HashMap<>();
+        variables.put("enterpriseName", enterprise.getName());
+        variables.put("payeeName", taxRebateServiceFeePayeeName);
+        variables.put("payeeAccountNo", taxRebateServiceFeePayeeAccountNo);
+        variables.put("payeeBankName", taxRebateServiceFeePayeeBankName);
+        variables.put("taxRebateAgreementNo", enterprise.getTaxRebateAgreementNo());
+        // 发送邮件
+        EnterpriseRelatedPerson contactPerson = enterpriseRelatedPersonBaseService
+                .getContactByChangeRecordId(enterprise.getChangeRecordId());
+        emailTemplate.sendMailTemplate(CustConstant.TAX_REBATE_SERVICE_FEE_PAY_NOTIFY_SUBJECT,
+                CustConstant.TAX_REBATE_SERVICE_FEE_PAY_NOTIFY_TEMPLATE, null, null, variables, null, null,
+                new String[] {
+                        contactPerson.getEmail()
+                });
+    }
+
     /**
      * 当前认证中&&暂存 或者 当前已认证&&提交,不插入变更记录、直接更新上次记录 (减少变更表记录)
      * 

+ 0 - 9
trade-client/src/main/java/com/trade/client/trade/exportrebate/dto/ExportTaxRebateDetailsDto.java

@@ -40,14 +40,6 @@ public class ExportTaxRebateDetailsDto {
      * 海关报关单号(18位)
      */
     private FileAbstractDto customsDeclarationFile;
-    /**
-     * 代理公司统一社会信用代码/注册号
-     */
-    private String agencyCertNo;
-    /**
-     * 代理公司名称
-     */
-    private String agencyName;
     /**
      * 进口商统一社会信用代码/注册号
      */
@@ -116,7 +108,6 @@ public class ExportTaxRebateDetailsDto {
         this.declarationBatch = taxRebateExportDetailsList.get(0).getDeclarationBatch();
         this.declarationSerialNo = taxRebateExportDetailsList.get(0).getDeclarationSerialNo();
         this.customsDeclarationNo = taxRebateExportDetailsList.get(0).getCustomsDeclarationNo();
-        this.agencyCertNo = taxRebateExportDetailsList.get(0).getAgencyCertNo();
         this.importerCertNo = taxRebateExportDetailsList.get(0).getImporterCertNo();
         this.salesOrderNo = taxRebateExportDetailsList.get(0).getSalesOrderNo();
         this.salesContractId = taxRebateExportDetailsList.get(0).getSalesContractId();

+ 0 - 13
trade-client/src/main/java/com/trade/client/trade/exportrebate/service/impl/ExportTaxRebateServiceImpl.java

@@ -3,7 +3,6 @@ package com.trade.client.trade.exportrebate.service.impl;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.trade.client.enterprise.customer.domain.CustomerUser;
-import com.trade.client.enterprise.customer.service.CustomerUserService;
 import com.trade.client.security.utils.UserUtils;
 import com.trade.client.trade.exportrebate.dto.ExportDetailDto;
 import com.trade.client.trade.exportrebate.dto.ExportTaxRebateDetailsDto;
@@ -29,8 +28,6 @@ import com.trade.service.trade.exportrebate.service.TaxRebateExportDetailsBaseSe
 import com.trade.service.trade.exportrebate.service.TaxRebatePurchaseDetailsBaseService;
 import com.trade.service.trade.salesorder.domain.CustomsDeclarationFile;
 import com.trade.service.trade.salesorder.service.ICustomsDeclarationFileService;
-import com.trade.service.tradingplatform.domain.TradingPlatform;
-import com.trade.service.tradingplatform.service.TradingPlatformBaseService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -57,10 +54,6 @@ public class ExportTaxRebateServiceImpl implements ExportTaxRebateService {
     @Resource
     private XiaotuRequestService xiaotuRequestService;
     @Autowired
-    private CustomerUserService customerUserService;
-    @Autowired
-    private TradingPlatformBaseService tradingPlatformBaseService;
-    @Autowired
     private IImporterEntityService importerEntityService;
     @Autowired
     private ICustomsDeclarationFileService customsDeclarationFileService;
@@ -117,12 +110,6 @@ public class ExportTaxRebateServiceImpl implements ExportTaxRebateService {
             throw new ServiceException("未查询到相关退税详情信息", HttpStatus.BAD_REQUEST);
         }
         ExportTaxRebateDetailsDto exportTaxRebateDetailsDto = new ExportTaxRebateDetailsDto(taxRebateExportDetailsList);
-        // 补充贸易平台名称
-        if (StrUtil.isNotEmpty(exportTaxRebateDetailsDto.getAgencyCertNo())) {
-            TradingPlatform tradingPlatform = tradingPlatformBaseService
-                    .findByCertNo(exportTaxRebateDetailsDto.getAgencyCertNo());
-            exportTaxRebateDetailsDto.setAgencyName(tradingPlatform == null ? "" : tradingPlatform.getPlatformName());
-        }
         // 补充进口商名称
         if (StrUtil.isNotEmpty(exportTaxRebateDetailsDto.getImporterCertNo())) {
             ImporterEntity importerEntity = importerEntityService

+ 7 - 0
trade-common/pom.xml

@@ -142,6 +142,13 @@
             <artifactId>core</artifactId>
             <version>3.5.3</version>
         </dependency>
+        <!-- 中文转Pinyin -->
+        <dependency>
+            <groupId>com.belerweb</groupId>
+            <artifactId>pinyin4j</artifactId>
+            <version>2.5.1</version>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
 
 

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

@@ -136,7 +136,7 @@ public class I18nSqlProcessInterceptor implements Interceptor {
                             Object entity = ((AbstractWrapper) entityWrapper).getEntity();
                             Map<String, String> paramValuePairs = ((AbstractWrapper) entityWrapper)
                                     .getParamNameValuePairs();
-                            List<Long> idList;
+                            List<Long> idList = new ArrayList<>();
                             List<Object> valueList = new ArrayList<>();
                             // 针对ew使用姿势不同,做的两种区分
                             if (entity != null) {
@@ -154,10 +154,14 @@ public class I18nSqlProcessInterceptor implements Interceptor {
                                 Map<String, String> sortedMap = MapUtil.sortMapByAlphaNumKey(paramValuePairs);
                                 valueList.addAll(new ArrayList<>(sortedMap.values()));
                             }
-                            String conditionStr = getSqlFromBaseSql(tableInfo, boundSql.getSql(), SqlCommandType.UPDATE,
-                                    null, null, null);
-                            String selectIdSb = "SELECT id FROM " + tableInfo.getTableName() + " " + conditionStr + ";";
-                            idList = SqlExecutionUtil.executeForIdsWithParameters(connection, valueList, selectIdSb);
+                            if (CollUtil.isNotEmpty(valueList)) {
+                                String conditionStr = getSqlFromBaseSql(tableInfo, boundSql.getSql(),
+                                        SqlCommandType.UPDATE, null, null, null);
+                                String selectIdSb = "SELECT id FROM " + tableInfo.getTableName() + " " + conditionStr
+                                        + ";";
+                                idList = SqlExecutionUtil.executeForIdsWithParameters(connection, valueList,
+                                        selectIdSb);
+                            }
                             if (CollectionUtils.isNotEmpty(idList)) {
                                 // insertOrUpdate 根据传入的i18n元数据插入i18n表
                                 Object baseEntity = parameterMap.get("et");

+ 73 - 0
trade-common/src/main/java/com/trade/common/utils/ChinesePinYinUtil.java

@@ -0,0 +1,73 @@
+package com.trade.common.utils;
+
+import cn.hutool.core.util.StrUtil;
+import net.sourceforge.pinyin4j.PinyinHelper;
+import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
+import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
+import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
+import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
+
+/**
+ * @description: 中文汉字转拼音工具类
+ * @author: wanxiangZhou
+ * @e-mail: jframe@163.com
+ * @date: Created in 2019-09-25 15:13
+ */
+public class ChinesePinYinUtil {
+
+    /**
+     * 将汉字转换为全拼
+     * 
+     * @param string 字符串
+     * @return Pinyin
+     */
+    public static String getPinYin(String string) {
+        if (string == null || string.isEmpty()) {
+            return "";
+        }
+        HanyuPinyinOutputFormat outputFormat = new HanyuPinyinOutputFormat();
+        outputFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
+        outputFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
+        StringBuilder sb = new StringBuilder();
+        try {
+            for (char c : string.toCharArray()) {
+                // 如果包含有中文标点除号,需要使用正则表达式
+                if (Character.toString(c).matches("[\\u4E00-\\u9FA5]+")) {
+                    sb.append(PinyinHelper.toHanyuPinyinStringArray(c, outputFormat)[0]);
+                } else {
+                    sb.append(Character.toString(c));
+                }
+            }
+        } catch (BadHanyuPinyinOutputFormatCombination e) {
+            e.printStackTrace();
+        }
+        String fullPinYin = sb.toString();
+        if (StrUtil.isNotEmpty(fullPinYin) && fullPinYin.length() > 45) {
+            fullPinYin = fullPinYin.substring(0, 45);
+        }
+        return fullPinYin;
+    }
+
+    /**
+     * 提取每个汉字的首字母
+     */
+    public static String getPinYinFirstChar(String str) {
+        if (str == null || str.isEmpty()) {
+            return "";
+        }
+        StringBuilder sb = new StringBuilder();
+        for (char c : str.toCharArray()) {
+            String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c);
+            if (pinyinArray != null) {
+                sb.append(pinyinArray[0].charAt(0));
+            } else {
+                sb.append(c);
+            }
+        }
+        String simplePinYin = sb.toString();
+        if (StrUtil.isNotEmpty(simplePinYin) && simplePinYin.length() > 25) {
+            simplePinYin = simplePinYin.substring(0, 25);
+        }
+        return simplePinYin;
+    }
+}

+ 4 - 0
trade-common/src/main/java/com/trade/common/utils/ConstantUtil.java

@@ -78,4 +78,8 @@ public class ConstantUtil {
      * 采购订单
      */
     public static final String PURCHASE_ORDER_NO_PREFIX = "PO";
+    /**
+     * 退税服务协议
+     */
+    public static final String TAX_REBATE_AGREEMENT_NO_PREFIX = "SS";
 }

+ 5 - 1
trade-service/pom.xml

@@ -185,7 +185,11 @@
             <groupId>org.springframework</groupId>
             <artifactId>spring-test</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>com.belerweb</groupId>
+            <artifactId>pinyin4j</artifactId>
+            <version>2.5.1</version>
+        </dependency>
     </dependencies>
 
 

+ 2 - 0
trade-service/src/main/java/com/trade/service/business/payableaccounts/dto/ServiceFeeDto.java

@@ -25,4 +25,6 @@ public class ServiceFeeDto {
     private LocalDateTime paymentDeadline;
     @ApiModelProperty(name = "payeeName", value = "收款方名称")
     private String payeeName;
+    @ApiModelProperty(name = "contactFileId", value = "合同文件id")
+    private Long contactFileId;
 }

+ 12 - 0
trade-service/src/main/java/com/trade/service/enterprise/customer/domain/Enterprise.java

@@ -115,6 +115,10 @@ public class Enterprise extends BaseI18nEntity<Enterprise> {
      * 退税服务协议签署日期
      */
     private Date taxRebateAgreementSignDate;
+    /**
+     * 退税服务协议合同编号
+     */
+    private String taxRebateAgreementNo;
     /**
      * 退税服务协议生效时间(含)
      */
@@ -320,6 +324,14 @@ public class Enterprise extends BaseI18nEntity<Enterprise> {
         this.taxRebateAgreementSignDate = taxRebateAgreementSignDate;
     }
 
+    public String getTaxRebateAgreementNo() {
+        return taxRebateAgreementNo;
+    }
+
+    public void setTaxRebateAgreementNo(String taxRebateAgreementNo) {
+        this.taxRebateAgreementNo = taxRebateAgreementNo;
+    }
+
     public Date getTaxRebateEffectiveStart() {
         return taxRebateEffectiveStart;
     }

+ 12 - 0
trade-service/src/main/java/com/trade/service/enterprise/customer/domain/EnterpriseChangeRecord.java

@@ -107,6 +107,10 @@ public class EnterpriseChangeRecord extends BaseI18nEntity<EnterpriseChangeRecor
      * 退税服务协议签署状态,枚举:sys_sign_status
      */
     private String taxRebateAgreementSignStatus;
+    /**
+     * 退税服务协议合同编号
+     */
+    private String taxRebateAgreementNo;
     /**
      * 退税服务协议签署日期
      */
@@ -302,6 +306,14 @@ public class EnterpriseChangeRecord extends BaseI18nEntity<EnterpriseChangeRecor
         this.taxRebateAgreementSignStatus = taxRebateAgreementSignStatus;
     }
 
+    public String getTaxRebateAgreementNo() {
+        return taxRebateAgreementNo;
+    }
+
+    public void setTaxRebateAgreementNo(String taxRebateAgreementNo) {
+        this.taxRebateAgreementNo = taxRebateAgreementNo;
+    }
+
     public Date getTaxRebateAgreementSignDate() {
         return taxRebateAgreementSignDate;
     }

+ 13 - 0
trade-service/src/main/java/com/trade/service/enterprise/customer/dto/EnterpriseDto.java

@@ -198,6 +198,10 @@ public class EnterpriseDto extends BaseI18nDto {
      * 退税服务协议id
      */
     private FileAbstractDto taxRebateAgreement;
+    /**
+     * 退税服务协议合同编号
+     */
+    private String taxRebateAgreementNo;
     /**
      * 退税服务协议签署日期 yyyy-MM-dd HH:mm:ss
      */
@@ -215,6 +219,7 @@ public class EnterpriseDto extends BaseI18nDto {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date taxRebateEffectiveEnd;
+
     public Long getId() {
         return id;
     }
@@ -487,6 +492,14 @@ public class EnterpriseDto extends BaseI18nDto {
         this.taxRebateAgreement = taxRebateAgreement;
     }
 
+    public String getTaxRebateAgreementNo() {
+        return taxRebateAgreementNo;
+    }
+
+    public void setTaxRebateAgreementNo(String taxRebateAgreementNo) {
+        this.taxRebateAgreementNo = taxRebateAgreementNo;
+    }
+
     public Date getTaxRebateAgreementSignDate() {
         return taxRebateAgreementSignDate;
     }

+ 1 - 2
trade-service/src/main/java/com/trade/service/enterprise/customer/service/EnterpriseChangeRecordBaseService.java

@@ -14,9 +14,8 @@ public interface EnterpriseChangeRecordBaseService extends IService<EnterpriseCh
     /**
      * 获取最新一条变更记录
      *
-     * @param customerId          客户ID
+     * @param customerId 客户ID
      * @param certificationStatus 认证状态
      */
     EnterpriseChangeRecord getLatestRecord(Long customerId, String certificationStatus);
 }
-

+ 8 - 0
trade-service/src/main/java/com/trade/service/serialNum/service/SerialNumberGenerator.java

@@ -24,4 +24,12 @@ public interface SerialNumberGenerator {
      * @return
      */
     String nextValue(String prefixType, String extend);
+
+    /**
+     * 生成退税服务协议编号
+     * 
+     * @param enterpriseName
+     * @return
+     */
+    String generateTaxRebateAgreementNo(String enterpriseName);
 }

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

@@ -1,6 +1,7 @@
 package com.trade.service.serialNum.service.impl;
 
 import cn.hutool.core.util.StrUtil;
+import com.trade.common.utils.ChinesePinYinUtil;
 import com.trade.common.utils.ConstantUtil;
 import com.trade.common.utils.DateUtils;
 import com.trade.service.trade.salesorder.constant.SaleOrderConstant;
@@ -161,4 +162,12 @@ public class SerialNumberGeneratorImpl implements SerialNumberGenerator {
         }
         return "";
     }
+
+    @Override
+    public String generateTaxRebateAgreementNo(String enterpriseName) {
+        String pinYinFirstChar = ChinesePinYinUtil.getPinYinFirstChar(enterpriseName);
+        String enterpriseCode = StrUtil.fillAfter(pinYinFirstChar, 'X', 5).substring(0, 5);
+        return ConstantUtil.TAX_REBATE_AGREEMENT_NO_PREFIX + "-" + enterpriseCode + "-"
+                + DateUtils.dateTimeNow(DateUtils.YYYYMMDD);
+    }
 }

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

@@ -19,6 +19,12 @@ MODIFY COLUMN `tax_authority_area` varchar(32) CHARACTER SET utf8mb4 COLLATE utf
 ADD COLUMN `tax_rebate_effective_end` datetime(0) NULL COMMENT '退税服务协议失效时间(含)' AFTER `tax_rebate_agreement_sign_date`,
 ADD COLUMN `tax_rebate_effective_start` datetime(0) NULL COMMENT '退税服务协议生效时间(含)' AFTER `tax_rebate_effective_end`;
 
+ALTER TABLE `enterprise_change_record`
+ADD COLUMN `tax_rebate_agreement_no` varchar(32) NULL COMMENT '退税服务协议合同编号' AFTER `tax_rebate_agreement_sign_date`;
+
+ALTER TABLE `enterprise`
+ADD COLUMN `tax_rebate_agreement_no` varchar(32) NULL COMMENT '退税服务协议合同编号' AFTER `tax_rebate_agreement_sign_date`;
+
 CREATE TABLE `tax_rebate_export_details`
 (
     `id`                                 bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',

+ 3 - 1
trade-service/src/main/resources/mapper/enterprise/customer/EnterpriseChangeRecordMapper.xml

@@ -25,6 +25,7 @@
         <result property="proxyDistrictCode" column="proxy_district_code"/>
         <result property="businessProduct" column="business_product"/>
         <result property="taxRebateAgreementSignStatus" column="tax_rebate_agreement_sign_status"/>
+        <result property="taxRebateAgreementNo" column="tax_rebate_agreement_no"/>
         <result property="taxRebateAgreementSignDate" column="tax_rebate_agreement_sign_date"/>
         <result property="taxRebateEffectiveStart" column="tax_rebate_effective_start"/>
         <result property="taxRebateEffectiveEnd" column="tax_rebate_effective_end"/>
@@ -43,7 +44,8 @@
         `register_address`, `business_address`, `proxy_district_code`,`certification_status`,
         `same_register_and_business_address`,`export_type`, `authorization_file`,  `business_product`, remark`,
         `deleted`, `create_by`,`update_by`, `gmt_create`, `gmt_modified`.`tax_authority_area`,
-        `tax_rebate_agreement_sign_status`,`tax_rebate_agreement_sign_date`, `tax_rebate_effective_start`, `tax_rebate_effective_end`
+        `tax_rebate_agreement_sign_status`,`tax_rebate_agreement_sign_date`, `tax_rebate_effective_start`, `tax_rebate_effective_end`,
+        `tax_rebate_agreement_no`
      </sql>
 
 </mapper>

+ 3 - 1
trade-service/src/main/resources/mapper/enterprise/customer/EnterpriseMapper.xml

@@ -26,6 +26,7 @@
         <result property="businessProduct" column="business_product"/>
         <result property="changeRecordId" column="change_record_id"/>
         <result property="taxRebateAgreementSignStatus" column="tax_rebate_agreement_sign_status"/>
+        <result property="taxRebateAgreementNo" column="tax_rebate_agreement_no"/>
         <result property="taxRebateAgreementSignDate" column="tax_rebate_agreement_sign_date"/>
         <result property="taxRebateEffectiveStart" column="tax_rebate_effective_start"/>
         <result property="taxRebateEffectiveEnd" column="tax_rebate_effective_end"/>
@@ -43,7 +44,8 @@
         `establish_date`, `register_capital`, `register_address`, `business_address`,`same_register_and_business_address`,
         `certification_status`, `export_type`, `business_product`, `proxy_district_code`, `authorization_file`,`authorization_file_signed`,
         `change_record_id`, `remark`, `deleted`, `create_by`, `update_by`, `gmt_create`, `gmt_modified`,`tax_authority_area`,
-        `tax_rebate_agreement_sign_status`,`tax_rebate_agreement_sign_date`, `tax_rebate_effective_start`, `tax_rebate_effective_end`
+        `tax_rebate_agreement_sign_status`,`tax_rebate_agreement_sign_date`, `tax_rebate_effective_start`, `tax_rebate_effective_end`,
+        `tax_rebate_agreement_no`
     </sql>
 
     <resultMap type="com.trade.service.enterprise.customer.dto.EnterpriseBaseInfoDto" id="enterpriseBaseInfoResultMap">

+ 5 - 1
trade-service/src/main/resources/mapper/trade/exportrebate/TaxRebateExportDetailsMapper.xml

@@ -187,6 +187,7 @@
         <result property="importerName" column="importer_name"/>
         <result property="salesOrderNo" column="sales_order_no"/>
         <result property="salesContractId" column="sales_contract_id"/>
+        <result property="salesContractNo" column="sales_contract_no"/>
         <result property="declarationMonthYear" column="declaration_month_year"/>
         <result property="declarationBatch" column="declaration_batch"/>
         <result property="declarationSerialNo" column="declaration_serial_no"/>
@@ -219,6 +220,7 @@
         i.entity_name AS importer_name,
         d.sales_order_no,
         d.sales_contract_id,
+        d.sales_contract_no,
         d.declaration_month_year,
         d.declaration_batch,
         d.declaration_serial_no,
@@ -274,6 +276,7 @@
         <result property="importerCertNo" column="importer_cert_no"/>
         <result property="salesOrderNo" column="sales_order_no"/>
         <result property="salesContractId" column="sales_contract_id"/>
+        <result property="salesContractNo" column="sales_contract_co"/>
         <result property="declarationMonthYear" column="declaration_month_year"/>
         <result property="declarationBatch" column="declaration_batch"/>
         <result property="declarationSerialNo" column="declaration_serial_no"/>
@@ -305,6 +308,7 @@
             d.importer_cert_no,
             d.sales_order_no,
             d.sales_contract_id,
+            d.sales_contract_no,
             d.declaration_month_year,
             d.declaration_batch,
             d.declaration_serial_no,
@@ -338,10 +342,10 @@
         SELECT
             d.id,
             d.customer_user_id,
-            d.agency_cert_no,
             d.importer_cert_no,
             d.sales_order_no,
             d.sales_contract_id,
+            d.sales_contract_no,
             d.declaration_month_year,
             d.declaration_batch,
             d.declaration_serial_no,

Файловите разлики са ограничени, защото са твърде много
+ 22 - 0
trade-service/src/main/resources/templates/mail/TaxRebateServiceFeePayNotifyEmail.html