Browse Source

根据供应商获取资方授信信息接口优化

liuj 2 months ago
parent
commit
86686df659

+ 17 - 21
src/main/java/com/sunxung/factoring/service/financing/review/impl/ReviewQuotaDisburseServiceImpl.java

@@ -24,6 +24,8 @@ import com.sunxung.factoring.entity.financing.apply.CFinancingBasicInfo;
 import com.sunxung.factoring.entity.financing.apply.CFinancingGoodsInfo;
 import com.sunxung.factoring.entity.financing.review.*;
 import com.sunxung.factoring.entity.project.ProjectInformation;
+import com.sunxung.factoring.entity.smb.FinancingFromInvestors;
+import com.sunxung.factoring.entity.smb.FinancingFromInvestorsHistory;
 import com.sunxung.factoring.entity.smb.FinancingFromInvestorsNotice;
 import com.sunxung.factoring.entity.smb.FinancingFromInvestorsPerson;
 import com.sunxung.factoring.entity.supplier.SupplierInfo;
@@ -373,27 +375,21 @@ public class ReviewQuotaDisburseServiceImpl extends ServiceImpl<ReviewQuotaDisbu
         if (financingBasicInfo != null) {
 
             SupplierInfo supplierInfo = supplierInfoService.getByEnterpriseId(financingBasicInfo.getMainEnterpriseId());
-            FinancingFromInvestorsNotice notice = new FinancingFromInvestorsNotice();
-            notice.setApprovedInterestRate(new BigDecimal("0.1"));
-
-            return notice;
-
-//            if (supplierInfo != null) {
-//                //todo 添加按状态筛选
-//                FinancingFromInvestors financingFromInvestors = financingFromInvestorsService.lambdaQuery().eq(FinancingFromInvestors::getSupplierInfoId, supplierInfo.getId()).one();
-//                if (financingFromInvestors != null) {
-//                    List<FinancingFromInvestorsHistory> list = financingFromInvestorsHistoryService.lambdaQuery().eq(FinancingFromInvestorsHistory::getFinancingFromInvestorsId, financingFromInvestors.getId())
-//                            .orderByDesc(FinancingFromInvestorsHistory::getId).list();
-//                    if (CollectionUtil.isNotEmpty(list)) {
-//                        FinancingFromInvestorsHistory fromInvestorsHistory = list.get(0);
-//                        FinancingFromInvestorsNotice notice = financingFromInvestorsNoticeService.lambdaQuery().eq(FinancingFromInvestorsNotice::getFinancingFromInvestorsHistoryId, fromInvestorsHistory.getId()).one();
-//                        if (notice != null) {
-//                            //todo 判断notice状态
-//                            return notice;
-//                        }
-//                    }
-//                }
-//            }
+            if (supplierInfo != null) {
+                FinancingFromInvestors financingFromInvestors = financingFromInvestorsService.lambdaQuery().eq(FinancingFromInvestors::getSupplierInfoId, supplierInfo.getId())
+                        .orderByDesc(FinancingFromInvestors::getId).list().get(0);
+                if (financingFromInvestors != null && financingFromInvestors.getCreditStatus().equals("审批通过")) {
+                    List<FinancingFromInvestorsHistory> list = financingFromInvestorsHistoryService.lambdaQuery().eq(FinancingFromInvestorsHistory::getFinancingFromInvestorsId, financingFromInvestors.getId())
+                            .orderByDesc(FinancingFromInvestorsHistory::getId).list();
+                    if (CollectionUtil.isNotEmpty(list)) {
+                        FinancingFromInvestorsHistory fromInvestorsHistory = list.get(0);
+                        FinancingFromInvestorsNotice notice = financingFromInvestorsNoticeService.lambdaQuery().eq(FinancingFromInvestorsNotice::getFinancingFromInvestorsHistoryId, fromInvestorsHistory.getId()).one();
+                        if (notice != null && notice.getApplyStatus().equals("审批通过")) {
+                            return notice;
+                        }
+                    }
+                }
+            }
         }
         return null;
     }