ソースを参照

C端退税服务协议开通流程调整

liangbo.huang 2 週間 前
コミット
82cd9b304a

+ 5 - 0
trade-admin/src/main/java/com/trade/admin/system/controller/TestController.java

@@ -37,6 +37,11 @@ public class TestController {
         exportTaxRebateSchedule.pullTaxRebateRecordsJob();
     }
 
+    @RequestMapping("/generateTaxRebatePaymentInfoForSelfExportUser")
+    public void generateTaxRebatePaymentInfoForSelfExportUser() {
+        exportTaxRebateSchedule.generateTaxRebatePaymentInfoForSelfExportUserJob();
+    }
+
     /**
      * 下载海关申报文件
      */

+ 1 - 0
trade-client/src/main/java/com/trade/client/enterprise/customer/service/EnterpriseService.java

@@ -42,6 +42,7 @@ public interface EnterpriseService extends SignedBizProcessor {
 
     /**
      * 申请出口退税权限
+     * 
      * @return
      */
     Boolean applyTaxRebatePermission();

+ 51 - 18
trade-client/src/main/java/com/trade/client/enterprise/customer/service/impl/EnterpriseServiceImpl.java

@@ -23,6 +23,8 @@ import com.trade.common.utils.bean.Builder;
 import com.trade.common.validate.ValidatorGroup;
 import com.trade.common.validate.ValidatorUtil;
 import com.trade.service.DictConstants;
+import com.trade.service.business.payableaccounts.dto.ServiceFeeDto;
+import com.trade.service.business.payableaccounts.service.PayableAccountsService;
 import com.trade.service.contract.constant.ContractConstant;
 import com.trade.service.contract.dto.*;
 import com.trade.service.contract.service.ContractService;
@@ -55,6 +57,7 @@ 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;
@@ -71,6 +74,10 @@ public class EnterpriseServiceImpl implements EnterpriseService {
     private static final Logger log = LoggerUtil.logger(LoggerUtil.LogFileNameEnum.SERVICES_LOG);
     @Value("${trade.website}")
     private String website;
+    @Value("${taxRebate.serviceFee.amount:0.00}")
+    private BigDecimal taxRebateServiceFeeAmount;
+    @Value("${taxRebate.serviceFee.payeeName:上海银颗科技服务有限公司}")
+    private String taxRebateServiceFeePayeeName;
     @Resource
     private CustomerMessageService customerMessageService;
     @Resource
@@ -96,9 +103,12 @@ public class EnterpriseServiceImpl implements EnterpriseService {
     @Resource
     private ContractFileService contractFileService;
     @Resource
+    private PayableAccountsService payableAccountsService;
+    @Resource
     private SOPService sopService;
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public EnterpriseStatusDto queryCertificationStatus() {
         EnterpriseStatusDto enterpriseStatusDto = new EnterpriseStatusDto();
         enterpriseStatusDto.setCertificationStatus(DictConstants.CERTIFICATION_STATUS_UNSUBMITTED);
@@ -111,9 +121,12 @@ public class EnterpriseServiceImpl implements EnterpriseService {
         Enterprise enterprise = enterpriseBaseService.getEnterpriseByCustomerId(customerUserId);
         enterpriseStatusDto.setShowAllFunctions(enterprise != null
                 && DictConstants.CERTIFICATION_STATUS_PASSED.equals(enterprise.getCertificationStatus()));
+        boolean validityPeriod = judgeTaxRebateServiceValidityPeriod(enterprise);
         enterpriseStatusDto.setShowTaxRebateApplyMenu(enterprise != null && getShowTaxRebateApplyMenu(enterprise));
-        enterpriseStatusDto.setShowApplyTaxRebateBtn(enterprise != null && getShowApplyTaxRebateBtn(enterprise));
-        enterpriseStatusDto.setShowTaxRebateBtn(enterprise != null && getShowTaxRebateBtn(enterprise));
+        enterpriseStatusDto.setShowApplyTaxRebateBtn(
+                enterprise != null && !validityPeriod && getShowApplyTaxRebateBtn(enterprise));
+        enterpriseStatusDto
+                .setShowTaxRebateBtn(enterprise != null && validityPeriod && getShowTaxRebateBtn(enterprise));
         return enterpriseStatusDto;
     }
 
@@ -140,6 +153,32 @@ public class EnterpriseServiceImpl implements EnterpriseService {
                 && DictConstants.EXPORT_TYPE_SELF.equals(enterprise.getExportType());
     }
 
+    private boolean judgeTaxRebateServiceValidityPeriod(Enterprise enterprise) {
+        if (enterprise == null) {
+            return false;
+        }
+        // 退税服务有效期为1年
+        if (enterprise.getTaxRebateEffectiveStart() == null || enterprise.getTaxRebateEffectiveEnd() == null) {
+            return false;
+        }
+        Date now = new Date();
+        if (now.after(enterprise.getTaxRebateEffectiveStart()) && now.before(enterprise.getTaxRebateEffectiveEnd())) {
+            return true;
+        } else {
+            // 更新清空有效期和签署状态
+            enterprise.setTaxRebateEffectiveStart(null);
+            enterprise.setTaxRebateEffectiveEnd(null);
+            enterprise.setTaxRebateAgreementSignStatus(null);
+            enterprise.setChangeRecordId(null);
+            EnterpriseDto enterpriseDto = enterpriseDataConverter.EnterpriseDomainToDto(enterprise);
+            // 更新变更记录
+            long recordId = saveEnterpriseChangeRecord(enterpriseDto);
+            enterprise.setChangeRecordId(recordId);
+            enterpriseBaseService.updateById(enterprise);
+            return false;
+        }
+    }
+
     @Override
     public EnterpriseDto queryForUpdate() {
         Long customerUserId = UserUtils.getCustomerUserId();
@@ -462,9 +501,17 @@ public class EnterpriseServiceImpl implements EnterpriseService {
             contractFile.setSignedFileStorageId(signedFile2Biz.getFileId());
             contractFileService.updateById(contractFile);
             businessRelateFileBaseService.addBusinessRelateFiles(Collections.singletonList(businessRelateFile));
+            // 生成“待支付退税服务费”记录
+            ServiceFeeDto serviceFeeDto = new ServiceFeeDto();
+            serviceFeeDto.setCustomerUserId(customerUser.getId());
+            serviceFeeDto.setPaymentAmount(taxRebateServiceFeeAmount);
+            serviceFeeDto.setPaymentCurrency("CNY");
+            serviceFeeDto.setPaymentDeadline(bizData.getSignTime().plusHours(72));
+            serviceFeeDto.setPayeeName(taxRebateServiceFeePayeeName);
+            payableAccountsService.saveTaxRefundServiceFee(serviceFeeDto);
         }
         // 更新授权书签署状态:status
-        enterpriseBaseService.lambdaUpdate().eq(Enterprise::getChangeRecordId, changeRecordId)
+        enterpriseBaseService.lambdaUpdate().eq(Enterprise::getId, enterprise.getId())
                 .set(Enterprise::getTaxRebateAgreementSignStatus, status)
                 .set(status.equals(DictConstants.CONTRACT_STATUS_DONE), Enterprise::getTaxRebateAgreementSignDate,
                         DateUtils.parseLocalDateTime2Date(bizData.getSignTime()))
@@ -475,20 +522,6 @@ public class EnterpriseServiceImpl implements EnterpriseService {
                         EnterpriseChangeRecord::getTaxRebateAgreementSignDate,
                         DateUtils.parseLocalDateTime2Date(bizData.getSignTime()))
                 .update();
-        // 更新小图企业信息
-        if (DictConstants.CONTRACT_STATUS_DONE.equals(status)) {
-            UpdateEnterpriseRequest updateEnterpriseRequest = new UpdateEnterpriseRequest();
-            updateEnterpriseRequest.setSbqyuuid(enterprise.getXtEid());
-            updateEnterpriseRequest.setHgqyDm(enterprise.getCustomsEnterpriseCode());
-            updateEnterpriseRequest.setNsrmc(enterprise.getName());
-            updateEnterpriseRequest.setNsrsbh(enterprise.getTaxNo());
-            updateEnterpriseRequest.setDqcode(enterprise.getTaxAuthorityArea());
-            updateEnterpriseRequest.setCktsqylxDm(enterprise.getEnterpriseType());
-            updateEnterpriseRequest.setYhuuid1(customerUser.getXtUid());
-            updateEnterpriseRequest.setHstqysqbz(DictConstants.SYS_YES);
-            updateEnterpriseRequest.setTsfwxybz(DictConstants.SYS_YES);
-            xiaotuRequestService.updateEnterprise(updateEnterpriseRequest);
-        }
     }
 
     /**
@@ -665,7 +698,7 @@ public class EnterpriseServiceImpl implements EnterpriseService {
 
     /**
      * 企业经营异常检查
-     * 
+     *
      * @param riskInvestigation 企查查信息
      */
     private void accessCheck4BizException(EnterpriseDto enterpriseDto, SOPRiskInvestigation riskInvestigation) {

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

@@ -3,8 +3,10 @@ package com.trade.service.enterprise.customer.domain;
 import java.math.BigDecimal;
 import java.util.Date;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.trade.common.annotation.I18nField;
 import com.trade.common.core.domain.BaseI18nEntity;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * 企业信息表实体类
@@ -113,6 +115,18 @@ public class Enterprise extends BaseI18nEntity<Enterprise> {
      * 退税服务协议签署日期
      */
     private Date taxRebateAgreementSignDate;
+    /**
+     * 退税服务协议生效时间(含)
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date taxRebateEffectiveStart;
+    /**
+     * 退税服务协议失效时间(含)
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date taxRebateEffectiveEnd;
 
     public Long getCustomerId() {
         return customerId;
@@ -305,4 +319,20 @@ public class Enterprise extends BaseI18nEntity<Enterprise> {
     public void setTaxRebateAgreementSignDate(Date taxRebateAgreementSignDate) {
         this.taxRebateAgreementSignDate = taxRebateAgreementSignDate;
     }
+
+    public Date getTaxRebateEffectiveStart() {
+        return taxRebateEffectiveStart;
+    }
+
+    public void setTaxRebateEffectiveStart(Date taxRebateEffectiveStart) {
+        this.taxRebateEffectiveStart = taxRebateEffectiveStart;
+    }
+
+    public Date getTaxRebateEffectiveEnd() {
+        return taxRebateEffectiveEnd;
+    }
+
+    public void setTaxRebateEffectiveEnd(Date taxRebateEffectiveEnd) {
+        this.taxRebateEffectiveEnd = taxRebateEffectiveEnd;
+    }
 }

+ 33 - 1
trade-service/src/main/java/com/trade/service/enterprise/customer/domain/EnterpriseChangeRecord.java

@@ -3,9 +3,10 @@ package com.trade.service.enterprise.customer.domain;
 import java.math.BigDecimal;
 import java.util.Date;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.trade.common.annotation.I18nField;
-import com.trade.common.core.domain.BaseEntity;
 import com.trade.common.core.domain.BaseI18nEntity;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * 企业信息变更记录表实体类
@@ -109,7 +110,22 @@ public class EnterpriseChangeRecord extends BaseI18nEntity<EnterpriseChangeRecor
     /**
      * 退税服务协议签署日期
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date taxRebateAgreementSignDate;
+    /**
+     * 退税服务协议生效时间(含)
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date taxRebateEffectiveStart;
+    /**
+     * 退税服务协议失效时间(含)
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date taxRebateEffectiveEnd;
+
     public Long getCustomerId() {
         return customerId;
     }
@@ -293,4 +309,20 @@ public class EnterpriseChangeRecord extends BaseI18nEntity<EnterpriseChangeRecor
     public void setTaxRebateAgreementSignDate(Date taxRebateAgreementSignDate) {
         this.taxRebateAgreementSignDate = taxRebateAgreementSignDate;
     }
+
+    public Date getTaxRebateEffectiveStart() {
+        return taxRebateEffectiveStart;
+    }
+
+    public void setTaxRebateEffectiveStart(Date taxRebateEffectiveStart) {
+        this.taxRebateEffectiveStart = taxRebateEffectiveStart;
+    }
+
+    public Date getTaxRebateEffectiveEnd() {
+        return taxRebateEffectiveEnd;
+    }
+
+    public void setTaxRebateEffectiveEnd(Date taxRebateEffectiveEnd) {
+        this.taxRebateEffectiveEnd = taxRebateEffectiveEnd;
+    }
 }

+ 29 - 1
trade-service/src/main/java/com/trade/service/enterprise/customer/dto/EnterpriseDto.java

@@ -5,6 +5,7 @@ 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;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
@@ -202,7 +203,18 @@ public class EnterpriseDto extends BaseI18nDto {
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date taxRebateAgreementSignDate;
-
+    /**
+     * 退税服务协议生效时间(含)
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date taxRebateEffectiveStart;
+    /**
+     * 退税服务协议失效时间(含)
+     */
+    @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;
     }
@@ -494,4 +506,20 @@ public class EnterpriseDto extends BaseI18nDto {
     public String getBusinessAddressEn() {
         return getI18nValue("businessAddress", "en");
     }
+
+    public Date getTaxRebateEffectiveStart() {
+        return taxRebateEffectiveStart;
+    }
+
+    public void setTaxRebateEffectiveStart(Date taxRebateEffectiveStart) {
+        this.taxRebateEffectiveStart = taxRebateEffectiveStart;
+    }
+
+    public Date getTaxRebateEffectiveEnd() {
+        return taxRebateEffectiveEnd;
+    }
+
+    public void setTaxRebateEffectiveEnd(Date taxRebateEffectiveEnd) {
+        this.taxRebateEffectiveEnd = taxRebateEffectiveEnd;
+    }
 }

+ 10 - 0
trade-service/src/main/java/com/trade/service/enterprise/customer/service/EnterpriseBaseService.java

@@ -7,6 +7,7 @@ import com.trade.service.enterprise.customer.dto.EnterpriseSearchDto;
 import com.trade.service.enterprise.customer.domain.Enterprise;
 import com.trade.service.enterprise.customer.dto.EnterpriseXtIdsDto;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -71,4 +72,13 @@ public interface EnterpriseBaseService extends IService<Enterprise> {
      * @return 小图系统id
      */
     EnterpriseXtIdsDto getEnterpriseXtIdsDto(String certNo);
+
+
+    /**
+     * 企业缴纳出口退税服务费并入账确认
+     * @param customerUserId
+     * @param paymentDate
+     * @return
+     */
+    Boolean taxRebateServiceFeePayment(Long customerUserId, String xtUid, Date paymentDate);
 }

+ 43 - 0
trade-service/src/main/java/com/trade/service/enterprise/customer/service/impl/EnterpriseBaseServiceImpl.java

@@ -1,6 +1,11 @@
 package com.trade.service.enterprise.customer.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.trade.common.constant.HttpStatus;
+import com.trade.common.exception.ServiceException;
+import com.trade.common.utils.DateUtils;
+import com.trade.service.DictConstants;
+import com.trade.service.enterprise.customer.domain.EnterpriseChangeRecord;
 import com.trade.service.enterprise.customer.dto.EnterpriseBaseInfoDto;
 import com.trade.service.enterprise.customer.dto.EnterpriseDictVO;
 import com.trade.service.enterprise.customer.dto.EnterpriseSearchDto;
@@ -8,9 +13,13 @@ import com.trade.service.enterprise.customer.dto.EnterpriseXtIdsDto;
 import com.trade.service.enterprise.customer.mapper.EnterpriseMapper;
 import com.trade.service.enterprise.customer.domain.Enterprise;
 import com.trade.service.enterprise.customer.service.EnterpriseBaseService;
+import com.trade.service.enterprise.customer.service.EnterpriseChangeRecordBaseService;
+import com.trade.service.thirdparty.xiaotu.dto.UpdateEnterpriseRequest;
+import com.trade.service.thirdparty.xiaotu.service.XiaotuRequestService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -24,6 +33,10 @@ public class EnterpriseBaseServiceImpl extends ServiceImpl<EnterpriseMapper, Ent
 
     @Resource
     private EnterpriseMapper enterpriseMapper;
+    @Resource
+    private XiaotuRequestService xiaotuRequestService;
+    @Resource
+    private EnterpriseChangeRecordBaseService enterpriseChangeRecordBaseService;
 
     @Override
     public Enterprise getEnterpriseByCustomerId(Long customerId) {
@@ -61,4 +74,34 @@ public class EnterpriseBaseServiceImpl extends ServiceImpl<EnterpriseMapper, Ent
     public EnterpriseXtIdsDto getEnterpriseXtIdsDto(String certNo) {
         return enterpriseMapper.getEnterpriseXtIdsDto(certNo);
     }
+
+    @Override
+    public Boolean taxRebateServiceFeePayment(Long customerUserId, String xtUid, Date paymentDate) {
+        Enterprise enterprise = this.getEnterpriseByCustomerId(customerUserId);
+        if (enterprise == null) {
+            throw new ServiceException("未找到企业信息", HttpStatus.BAD_REQUEST);
+        }
+        UpdateEnterpriseRequest updateEnterpriseRequest = new UpdateEnterpriseRequest();
+        updateEnterpriseRequest.setSbqyuuid(enterprise.getXtEid());
+        updateEnterpriseRequest.setHgqyDm(enterprise.getCustomsEnterpriseCode());
+        updateEnterpriseRequest.setNsrmc(enterprise.getName());
+        updateEnterpriseRequest.setNsrsbh(enterprise.getTaxNo());
+        updateEnterpriseRequest.setDqcode(enterprise.getTaxAuthorityArea());
+        updateEnterpriseRequest.setCktsqylxDm(enterprise.getEnterpriseType());
+        updateEnterpriseRequest.setYhuuid1(xtUid);
+        updateEnterpriseRequest.setHstqysqbz(DictConstants.SYS_YES);
+        updateEnterpriseRequest.setTsfwxybz(DictConstants.SYS_YES);
+        xiaotuRequestService.updateEnterprise(updateEnterpriseRequest);
+        // 更新更新退税服务协议有效起讫时间
+        Date startDate = DateUtils.atStartOfDay(paymentDate);
+        Date endDate = DateUtils.atEndOfDay(DateUtils.plusYear(startDate, 1));
+        this.lambdaUpdate().eq(Enterprise::getId, enterprise.getId())
+                .set(Enterprise::getTaxRebateEffectiveStart, startDate)
+                .set(Enterprise::getTaxRebateEffectiveEnd, endDate).update();
+        enterpriseChangeRecordBaseService.lambdaUpdate()
+                .eq(EnterpriseChangeRecord::getId, enterprise.getChangeRecordId())
+                .set(EnterpriseChangeRecord::getTaxRebateEffectiveStart, startDate)
+                .set(EnterpriseChangeRecord::getTaxRebateEffectiveEnd, endDate).update();
+        return true;
+    }
 }

+ 4 - 5
trade-service/src/main/java/com/trade/service/trade/exportrebate/domain/TaxRebateExportDetails.java

@@ -6,7 +6,6 @@ import java.util.Date;
 import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.trade.common.core.domain.BaseEntity;
-import com.trade.common.utils.DateUtils;
 import com.trade.service.DictConstants;
 import com.trade.service.thirdparty.xiaotu.dto.ProduceExportDetailsResponse;
 import com.trade.service.thirdparty.xiaotu.dto.TradeExportAndPurchaseDetailsResponse;
@@ -562,8 +561,8 @@ public class TaxRebateExportDetails extends BaseEntity<TaxRebateExportDetails> {
         this.taxRefundAmount = response.getTse();
         this.exportDate = response.getCkrq() == null ? null : new Date(response.getCkrq());
         this.hsCode = goodsBelongs == null ? null : goodsBelongs.getHgckspDm();
-        this.exportCommodityCode = response.getSbspDm();
-        this.exportCommodityName = response.getSbspmc();
+        this.exportCommodityCode = response.getCkspDm();
+        this.exportCommodityName = response.getSbhgspmc();
         this.measurementUnit = response.getHgjldwmc();
         this.declarationCommodityCode = response.getSbspDm();
         this.declarationCommodityName = response.getSbspmc();
@@ -613,8 +612,8 @@ public class TaxRebateExportDetails extends BaseEntity<TaxRebateExportDetails> {
         this.taxRefundAmount = response.getMdtse();
         this.exportDate = response.getCkrq() == null ? null : new Date(response.getCkrq());
         this.hsCode = goodsBelongs == null ? null : goodsBelongs.getHgckspDm();
-        this.exportCommodityCode = response.getSbspDm();
-        this.exportCommodityName = response.getSbspmc();
+        this.exportCommodityCode = response.getCkspDm();
+        this.exportCommodityName = response.getSbhgspmc();
         this.measurementUnit = response.getHgjldwmc();
         this.declarationCommodityCode = response.getSbspDm();
         this.declarationCommodityName = response.getSbspmc();

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

@@ -10,6 +10,15 @@ ADD COLUMN `tax_rebate_agreement_sign_status` varchar(4) NULL COMMENT '退税服
 ALTER TABLE `enterprise_change_record`
 ADD COLUMN `tax_rebate_agreement_sign_date` datetime(0) NULL COMMENT '退税服务协议签署日期' AFTER `tax_rebate_agreement_sign_status`;
 
+ALTER TABLE `enterprise`
+ADD COLUMN `tax_rebate_effective_start` datetime NULL COMMENT '退税服务协议生效时间(含)' AFTER `tax_rebate_agreement_sign_date`,
+ADD COLUMN `tax_rebate_effective_end` datetime NULL COMMENT '退税服务协议失效时间(含)' AFTER `tax_rebate_effective_start`;
+
+ALTER TABLE `enterprise_change_record`
+MODIFY COLUMN `tax_authority_area` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主管税务机关,枚举:tax_authority_area' AFTER `tax_rebate_agreement_sign_status`,
+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`;
+
 CREATE TABLE `tax_rebate_export_details`
 (
     `id`                                 bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
@@ -133,7 +142,7 @@ VALUES (1, '审核中', '1', 'rebate_payment_status', NULL, 'default', 'N', '0',
 INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`)
 VALUES (2, '已到账', '2', 'rebate_payment_status', NULL, 'default', 'N', '0', 'admin', '', NULL);
 
-ALTER TABLE `trade`.`customs_declaration_goods`
+ALTER TABLE `customs_declaration_goods`
 ADD COLUMN `tsjltbbs` tinyint(4) NULL DEFAULT 0 COMMENT '退税记录是否已同步' AFTER `sbsl1`;
 
 ALTER TABLE `sales_contract`

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

@@ -26,6 +26,8 @@
         <result property="businessProduct" column="business_product"/>
         <result property="taxRebateAgreementSignStatus" column="tax_rebate_agreement_sign_status"/>
         <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"/>
         <result property="remark" column="remark"/>
         <result property="deleted" column="deleted"/>
         <result property="createBy" column="create_by"/>
@@ -41,7 +43,7 @@
         `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_agreement_sign_status`,`tax_rebate_agreement_sign_date`, `tax_rebate_effective_start`, `tax_rebate_effective_end`
      </sql>
 
 </mapper>

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

@@ -27,6 +27,8 @@
         <result property="changeRecordId" column="change_record_id"/>
         <result property="taxRebateAgreementSignStatus" column="tax_rebate_agreement_sign_status"/>
         <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"/>
         <result property="remark" column="remark"/>
         <result property="deleted" column="deleted"/>
         <result property="createBy" column="create_by"/>
@@ -41,7 +43,7 @@
         `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_agreement_sign_status`,`tax_rebate_agreement_sign_date`, `tax_rebate_effective_start`, `tax_rebate_effective_end`
     </sql>
 
     <resultMap type="com.trade.service.enterprise.customer.dto.EnterpriseBaseInfoDto" id="enterpriseBaseInfoResultMap">

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

@@ -327,7 +327,7 @@
             d.gmt_modified
         FROM tax_rebate_export_details d
         WHERE d.deleted = 0
-          AND status = '0'
+          AND d.status = '0'
           AND d.payment_status = '0'
           AND (d.agency_cert_no = '' OR d.agency_cert_no IS NULL)
     </select>