|
@@ -31,7 +31,6 @@ import com.sunxung.factoring.entity.smb.FinancingFromInvestorsPerson;
|
|
|
import com.sunxung.factoring.entity.supplier.SupplierInfo;
|
|
|
import com.sunxung.factoring.entity.sys.Dictionary;
|
|
|
import com.sunxung.factoring.entity.sys.FileStorage;
|
|
|
-import com.sunxung.factoring.entity.sys.FileStorageDO;
|
|
|
import com.sunxung.factoring.mapper.financing.review.ReviewQuotaDisburseMapper;
|
|
|
import com.sunxung.factoring.service.creditresolution.ICreditResolutionService;
|
|
|
import com.sunxung.factoring.service.entprise.IEnterpriseService;
|
|
@@ -49,7 +48,6 @@ import com.sunxung.factoring.service.smbApi.api.SMBApiService;
|
|
|
import com.sunxung.factoring.service.smbApi.resp.RepayPlanTrialResp;
|
|
|
import com.sunxung.factoring.service.supplier.ISupplierInfoService;
|
|
|
import com.sunxung.factoring.service.sys.DictionaryService;
|
|
|
-import com.sunxung.factoring.service.sys.FileService;
|
|
|
import com.sunxung.factoring.service.sys.FileStorageService;
|
|
|
import com.sunxung.factoring.service.sys.SerialNumberGenerator;
|
|
|
import com.sunxung.factoring.service.sys.flowable.FlowableService;
|
|
@@ -191,8 +189,6 @@ public class ReviewQuotaDisburseServiceImpl extends ServiceImpl<ReviewQuotaDisbu
|
|
|
private IFinancingFromInvestorsPersonService financingFromInvestorsPersonService;
|
|
|
@Autowired
|
|
|
private SMBApiService smbApiService;
|
|
|
- @Autowired
|
|
|
- private FileService fileService;
|
|
|
|
|
|
@Override
|
|
|
public List<ReviewIncomeExpenditurePlan> generateIncomeExpenditurePlan(ReviewFinancingInfo reviewFinancingInfo) {
|
|
@@ -206,14 +202,11 @@ public class ReviewQuotaDisburseServiceImpl extends ServiceImpl<ReviewQuotaDisbu
|
|
|
|
|
|
//回款方式为前收息或者后收息、20240626 add 苏商银行逻辑
|
|
|
List<ReviewIncomeExpenditurePlan> planList = new ArrayList<>();
|
|
|
-
|
|
|
- preOrAfterInterest(reviewFinancingInfo, planList, dict);
|
|
|
-
|
|
|
-// if (ConstantUtil.JIANGSU_SUSHANG_BANK.equals(reviewFinancingInfo.getInstitutionName())) {
|
|
|
-// generateSMBPlan(reviewFinancingInfo, planList);
|
|
|
-// } else {
|
|
|
-// preOrAfterInterest(reviewFinancingInfo, planList, dict);
|
|
|
-// }
|
|
|
+ if (ConstantUtil.JIANGSU_SUSHANG_BANK.equals(reviewFinancingInfo.getInstitutionName())) {
|
|
|
+ generateSMBPlan(reviewFinancingInfo, planList);
|
|
|
+ } else {
|
|
|
+ preOrAfterInterest(reviewFinancingInfo, planList, dict);
|
|
|
+ }
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(planList)) {
|
|
|
planList.sort(Comparator.comparing(ReviewIncomeExpenditurePlan::getIncomeExpenditureDate));
|
|
@@ -1879,16 +1872,14 @@ public class ReviewQuotaDisburseServiceImpl extends ServiceImpl<ReviewQuotaDisbu
|
|
|
if (reviewFinancingInfo.getFinancingInterest() != null && reviewFinancingInfo.getFinancingInterest().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
ReviewIncomeExpenditurePlan plan = new ReviewIncomeExpenditurePlan();
|
|
|
plan.setReceivables(reviewFinancingInfo.getFinancingInterest());
|
|
|
-// if (dict.getCode().equals("paymentMethodForInterestManagementFee_A")) {
|
|
|
-// //如果是前收息
|
|
|
-// plan.setIncomeExpenditureDate(reviewFinancingInfo.getStartingDate());
|
|
|
-// } else if (dict.getCode().equals("paymentMethodForInterestManagementFee_B")
|
|
|
-// || dict.getCode().equals("paymentMethodForInterestManagementFee_C")) {
|
|
|
-// //如果是后收息或者是管理费前收利息后收
|
|
|
-// plan.setIncomeExpenditureDate(endDate);
|
|
|
-// }
|
|
|
- plan.setIncomeExpenditureDate(endDate);
|
|
|
-
|
|
|
+ if (dict.getCode().equals("paymentMethodForInterestManagementFee_A")) {
|
|
|
+ //如果是前收息
|
|
|
+ plan.setIncomeExpenditureDate(reviewFinancingInfo.getStartingDate());
|
|
|
+ } else if (dict.getCode().equals("paymentMethodForInterestManagementFee_B")
|
|
|
+ || dict.getCode().equals("paymentMethodForInterestManagementFee_C")) {
|
|
|
+ //如果是后收息或者是管理费前收利息后收
|
|
|
+ plan.setIncomeExpenditureDate(endDate);
|
|
|
+ }
|
|
|
plan.setIncomeExpenditureType(IncomeExpenditureTypeDict.ChildEnum.INTEREST.getCode());
|
|
|
plan.setFinalCashFlow(reviewFinancingInfo.getFinancingInterest());
|
|
|
//收款主体默认为债权人
|
|
@@ -1900,15 +1891,13 @@ public class ReviewQuotaDisburseServiceImpl extends ServiceImpl<ReviewQuotaDisbu
|
|
|
if (reviewFinancingInfo.getManagementFeeAmount() != null && reviewFinancingInfo.getManagementFeeAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
ReviewIncomeExpenditurePlan plan = new ReviewIncomeExpenditurePlan();
|
|
|
plan.setReceivables(reviewFinancingInfo.getManagementFeeAmount());
|
|
|
-// if (dict.getCode().equals("paymentMethodForInterestManagementFee_A") || dict.getCode().equals("paymentMethodForInterestManagementFee_C")) {
|
|
|
-// //如果是前收息或者是管理费前收利息后收
|
|
|
-// plan.setIncomeExpenditureDate(reviewFinancingInfo.getStartingDate());
|
|
|
-// } else if (dict.getCode().equals("paymentMethodForInterestManagementFee_B")) {
|
|
|
-// //如果是后收息
|
|
|
-// plan.setIncomeExpenditureDate(endDate);
|
|
|
-// }
|
|
|
- plan.setIncomeExpenditureDate(endDate);
|
|
|
-
|
|
|
+ if (dict.getCode().equals("paymentMethodForInterestManagementFee_A") || dict.getCode().equals("paymentMethodForInterestManagementFee_C")) {
|
|
|
+ //如果是前收息或者是管理费前收利息后收
|
|
|
+ plan.setIncomeExpenditureDate(reviewFinancingInfo.getStartingDate());
|
|
|
+ } else if (dict.getCode().equals("paymentMethodForInterestManagementFee_B")) {
|
|
|
+ //如果是后收息
|
|
|
+ plan.setIncomeExpenditureDate(endDate);
|
|
|
+ }
|
|
|
plan.setIncomeExpenditureType(IncomeExpenditureTypeDict.ChildEnum.MANAGEMENT_FEE.getCode());
|
|
|
plan.setFinalCashFlow(reviewFinancingInfo.getManagementFeeAmount());
|
|
|
//收款主体默认为债权人
|
|
@@ -2097,9 +2086,34 @@ public class ReviewQuotaDisburseServiceImpl extends ServiceImpl<ReviewQuotaDisbu
|
|
|
repayPlanTrial.setMatuDate(matuDateStr);
|
|
|
//还款方式
|
|
|
repayPlanTrial.setRepayMtd("2");
|
|
|
- //todo 查询授信完成后客户的openId
|
|
|
- String openId = "";
|
|
|
+ //查询授信完成后客户的openId
|
|
|
+ FinancingFromInvestors financingFromInvestors = getFinancingFromInvestors(reviewFinancingInfo);
|
|
|
+ if (financingFromInvestors == null || financingFromInvestors.getOpenId() == null) {
|
|
|
+ throw new BusinessException(CodeUtil.FAIL, "获取不到对应的openId");
|
|
|
+ }
|
|
|
+ String openId = financingFromInvestors.getOpenId();
|
|
|
RepayPlanTrialResp repayPlanTrialResp = smbApiService.repayPlanTrial(repayPlanTrial, openId);
|
|
|
return repayPlanTrialResp;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取资方融资信息
|
|
|
+ *
|
|
|
+ * @param reviewFinancingInfo
|
|
|
+ */
|
|
|
+ private FinancingFromInvestors getFinancingFromInvestors(ReviewFinancingInfo reviewFinancingInfo) {
|
|
|
+ ReviewQuotaDisburse reviewQuotaDisburse = getById(reviewFinancingInfo.getReviewQuotaDisburseId());
|
|
|
+ if (reviewQuotaDisburse != null && reviewQuotaDisburse.getFinancingBasicInfoId() != null) {
|
|
|
+ CFinancingBasicInfo financingBasicInfo = financingBasicInfoService.getById(reviewQuotaDisburse.getFinancingBasicInfoId());
|
|
|
+ if (financingBasicInfo != null) {
|
|
|
+ SupplierInfo supplierInfo = supplierInfoService.getByEnterpriseId(financingBasicInfo.getMainEnterpriseId());
|
|
|
+ if (supplierInfo != null) {
|
|
|
+ FinancingFromInvestors financingFromInvestors = financingFromInvestorsService.lambdaQuery().eq(FinancingFromInvestors::getSupplierInfoId, supplierInfo.getId())
|
|
|
+ .orderByDesc(FinancingFromInvestors::getId).list().get(0);
|
|
|
+ return financingFromInvestors;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|