|
@@ -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) {
|