Przeglądaj źródła

Merge remote-tracking branch 'origin/v1.0' into v1.0

zhangc 6 miesięcy temu
rodzic
commit
c2dca4bbb7

+ 15 - 0
src/main/java/com/inkasso/factoring/financingmanagement/dao/ReviewFinancingInfoMapper.java

@@ -0,0 +1,15 @@
+package com.inkasso.factoring.financingmanagement.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.inkasso.factoring.financingmanagement.entity.ReviewFinancingInfo;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Description : 额度支用-融资信息Mapper
+ * @Author : L.Jia
+ * @Date: 2023-12-15 19:17
+ */
+
+@Mapper
+public interface ReviewFinancingInfoMapper extends BaseMapper<ReviewFinancingInfo> {
+}

+ 466 - 0
src/main/java/com/inkasso/factoring/financingmanagement/entity/ReviewFinancingInfo.java

@@ -0,0 +1,466 @@
+package com.inkasso.factoring.financingmanagement.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.inkasso.adapter.bean.BaseBean;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description : 额度支用-融资信息
+ * @Author : L.Jia
+ * @Date: 2023-12-12 20:27
+ */
+public class ReviewFinancingInfo extends BaseBean {
+
+    /**
+     * 对应额度支用信息Id
+     */
+    private Long reviewQuotaDisburseId;
+
+    /**
+     * 融资金额
+     **/
+    private BigDecimal financingAmount;
+    /**
+     * 融资利率(年化)
+     **/
+    private BigDecimal financingRate;
+
+    /**
+     * 融资比例
+     **/
+    private BigDecimal financingRatio;
+
+    /**
+     * 融资期限
+     **/
+    private Integer financingPeriod;
+    /**
+     * 起算日类别:自保理融资款实际投放之日(plan_day),明确日期(clear_day) 。详情查看ConstantConversionUtil定义的常量
+     **/
+    private String startingDateType;
+    /**
+     * 起算日
+     **/
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date startingDate;
+    /**
+     * 对外综合报价
+     **/
+    private BigDecimal comprehensiveQuotation;
+    /**
+     * 逾期利率
+     **/
+    private BigDecimal overdueInterestRate;
+    /**
+     * 管理费率(年化):手动输入0%到100%
+     **/
+    private BigDecimal managementFeeRatio;
+    /**
+     * 保证金比例
+     **/
+    private BigDecimal marginRatio;
+    /**
+     * 回款方式
+     **/
+    private String repaymentMethod;
+    /**
+     * 融资利息
+     **/
+    private BigDecimal financingInterest;
+    /**
+     * 管理费金额
+     **/
+    private BigDecimal managementFeeAmount;
+    /**
+     * 保证金金额
+     **/
+    private BigDecimal marginAmount;
+    /**
+     * 其他费用金额
+     **/
+    private BigDecimal otherFeeAmount;
+    /** 转让通知方式:字典项 TransferNoticeMethodDict.java **/
+    /** 服务范围:字典项 FactoringServiceScope.java **/
+    /**
+     * 转让通知方式,多选
+     **/
+    private String transferNoticeMethod;
+
+    /**
+     * 转让通知方式集合
+     */
+    @TableField(exist = false)
+    private List<String> transferNoticeMethodList;
+
+    /**
+     * 服务范围,多选
+     **/
+    private String serviceScope;
+
+    /**
+     * 服务范围集合
+     */
+    @TableField(exist = false)
+    private List<String> serviceScopeList;
+
+    /**
+     * 是否占用公司金额 1:是,0:否
+     */
+    @TableField("is_occupation")
+    private Integer occupation;
+
+    /**
+     * 是否公司承险 1:是,0:否
+     */
+    @TableField("is_risk")
+    private Integer risk;
+
+    /**
+     * 还款期限调整方式
+     */
+    private String repaymentAdjustment;
+
+    /**
+     * 还款方式
+     */
+    private String payBackMethod;
+
+    /**
+     * 出资方名称
+     */
+    private String institutionName;
+
+    /**
+     * 提前回款利息计算方式
+     */
+    private String prepaymentInterestCalculate;
+
+    /**
+     * 利息是否计算投放日,1:是,0:否
+     */
+    @TableField("is_interest_calculate")
+    private Integer interestCalculate;
+    /**
+     * 币种
+     */
+    private String currencyCode;
+    /**
+     * 汇率
+     */
+    private BigDecimal exchangeRate;
+    /**
+     * 坏账担保比例
+     */
+    private BigDecimal badDebtGuaranteeRate;
+
+    /**
+     * 坏账担保比例字符串(不保存数据库)
+     */
+    @TableField(exist = false)
+    private String badDebtGuaranteeRateStr;
+
+    /**
+     * 业务类型
+     */
+    private Integer businessType;
+
+    /**
+     * 账号名称
+     */
+    private String accountName;
+
+    /**
+     * 支用到期日
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date disburseExpiryDate;
+
+    /**
+     * 资方ID
+     */
+    private Long refinancingManagementId;
+
+    public Long getReviewQuotaDisburseId() {
+        return reviewQuotaDisburseId;
+    }
+
+    public void setReviewQuotaDisburseId(Long reviewQuotaDisburseId) {
+        this.reviewQuotaDisburseId = reviewQuotaDisburseId;
+    }
+
+    public BigDecimal getFinancingAmount() {
+        return financingAmount;
+    }
+
+    public void setFinancingAmount(BigDecimal financingAmount) {
+        this.financingAmount = financingAmount;
+    }
+
+    public BigDecimal getFinancingRate() {
+        return financingRate;
+    }
+
+    public void setFinancingRate(BigDecimal financingRate) {
+        this.financingRate = financingRate;
+    }
+
+    public BigDecimal getFinancingRatio() {
+        return financingRatio;
+    }
+
+    public void setFinancingRatio(BigDecimal financingRatio) {
+        this.financingRatio = financingRatio;
+    }
+
+    public Integer getFinancingPeriod() {
+        return financingPeriod;
+    }
+
+    public void setFinancingPeriod(Integer financingPeriod) {
+        this.financingPeriod = financingPeriod;
+    }
+
+    public String getStartingDateType() {
+        return startingDateType;
+    }
+
+    public void setStartingDateType(String startingDateType) {
+        this.startingDateType = startingDateType;
+    }
+
+    public Date getStartingDate() {
+        return startingDate;
+    }
+
+    public void setStartingDate(Date startingDate) {
+        this.startingDate = startingDate;
+    }
+
+    public BigDecimal getComprehensiveQuotation() {
+        return comprehensiveQuotation;
+    }
+
+    public void setComprehensiveQuotation(BigDecimal comprehensiveQuotation) {
+        this.comprehensiveQuotation = comprehensiveQuotation;
+    }
+
+    public BigDecimal getOverdueInterestRate() {
+        return overdueInterestRate;
+    }
+
+    public void setOverdueInterestRate(BigDecimal overdueInterestRate) {
+        this.overdueInterestRate = overdueInterestRate;
+    }
+
+    public BigDecimal getManagementFeeRatio() {
+        return managementFeeRatio;
+    }
+
+    public void setManagementFeeRatio(BigDecimal managementFeeRatio) {
+        this.managementFeeRatio = managementFeeRatio;
+    }
+
+    public BigDecimal getMarginRatio() {
+        return marginRatio;
+    }
+
+    public void setMarginRatio(BigDecimal marginRatio) {
+        this.marginRatio = marginRatio;
+    }
+
+    public String getRepaymentMethod() {
+        return repaymentMethod;
+    }
+
+    public void setRepaymentMethod(String repaymentMethod) {
+        this.repaymentMethod = repaymentMethod;
+    }
+
+    public BigDecimal getFinancingInterest() {
+        return financingInterest;
+    }
+
+    public void setFinancingInterest(BigDecimal financingInterest) {
+        this.financingInterest = financingInterest;
+    }
+
+    public BigDecimal getManagementFeeAmount() {
+        return managementFeeAmount;
+    }
+
+    public void setManagementFeeAmount(BigDecimal managementFeeAmount) {
+        this.managementFeeAmount = managementFeeAmount;
+    }
+
+    public BigDecimal getMarginAmount() {
+        return marginAmount;
+    }
+
+    public void setMarginAmount(BigDecimal marginAmount) {
+        this.marginAmount = marginAmount;
+    }
+
+    public BigDecimal getOtherFeeAmount() {
+        return otherFeeAmount;
+    }
+
+    public void setOtherFeeAmount(BigDecimal otherFeeAmount) {
+        this.otherFeeAmount = otherFeeAmount;
+    }
+
+    public String getTransferNoticeMethod() {
+        return transferNoticeMethod;
+    }
+
+    public void setTransferNoticeMethod(String transferNoticeMethod) {
+        this.transferNoticeMethod = transferNoticeMethod;
+    }
+
+    public List<String> getTransferNoticeMethodList() {
+        return transferNoticeMethodList;
+    }
+
+    public void setTransferNoticeMethodList(List<String> transferNoticeMethodList) {
+        this.transferNoticeMethodList = transferNoticeMethodList;
+    }
+
+    public String getServiceScope() {
+        return serviceScope;
+    }
+
+    public void setServiceScope(String serviceScope) {
+        this.serviceScope = serviceScope;
+    }
+
+    public List<String> getServiceScopeList() {
+        return serviceScopeList;
+    }
+
+    public void setServiceScopeList(List<String> serviceScopeList) {
+        this.serviceScopeList = serviceScopeList;
+    }
+
+    public Integer getOccupation() {
+        return occupation;
+    }
+
+    public void setOccupation(Integer occupation) {
+        this.occupation = occupation;
+    }
+
+    public Integer getRisk() {
+        return risk;
+    }
+
+    public void setRisk(Integer risk) {
+        this.risk = risk;
+    }
+
+    public String getRepaymentAdjustment() {
+        return repaymentAdjustment;
+    }
+
+    public void setRepaymentAdjustment(String repaymentAdjustment) {
+        this.repaymentAdjustment = repaymentAdjustment;
+    }
+
+    public String getPayBackMethod() {
+        return payBackMethod;
+    }
+
+    public void setPayBackMethod(String payBackMethod) {
+        this.payBackMethod = payBackMethod;
+    }
+
+    public String getPrepaymentInterestCalculate() {
+        return prepaymentInterestCalculate;
+    }
+
+    public Integer getInterestCalculate() {
+        return interestCalculate;
+    }
+
+    public void setInterestCalculate(Integer interestCalculate) {
+        this.interestCalculate = interestCalculate;
+    }
+
+    public void setPrepaymentInterestCalculate(String prepaymentInterestCalculate) {
+        this.prepaymentInterestCalculate = prepaymentInterestCalculate;
+    }
+
+    public String getCurrencyCode() {
+        return currencyCode;
+    }
+
+    public void setCurrencyCode(String currencyCode) {
+        this.currencyCode = currencyCode;
+    }
+
+    public Integer getBusinessType() {
+        return businessType;
+    }
+
+    public void setBusinessType(Integer businessType) {
+        this.businessType = businessType;
+    }
+
+    public BigDecimal getExchangeRate() {
+        return exchangeRate;
+    }
+
+    public void setExchangeRate(BigDecimal exchangeRate) {
+        this.exchangeRate = exchangeRate;
+    }
+
+    public BigDecimal getBadDebtGuaranteeRate() {
+        return badDebtGuaranteeRate;
+    }
+
+    public void setBadDebtGuaranteeRate(BigDecimal badDebtGuaranteeRate) {
+        this.badDebtGuaranteeRate = badDebtGuaranteeRate;
+    }
+
+    public String getBadDebtGuaranteeRateStr() {
+        return badDebtGuaranteeRateStr;
+    }
+
+    public void setBadDebtGuaranteeRateStr(String badDebtGuaranteeRateStr) {
+        this.badDebtGuaranteeRateStr = badDebtGuaranteeRateStr;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public void setAccountName(String accountName) {
+        this.accountName = accountName;
+    }
+
+    public Date getDisburseExpiryDate() {
+        return disburseExpiryDate;
+    }
+
+    public void setDisburseExpiryDate(Date disburseExpiryDate) {
+        this.disburseExpiryDate = disburseExpiryDate;
+    }
+
+    public String getInstitutionName() {
+        return institutionName;
+    }
+
+    public void setInstitutionName(String institutionName) {
+        this.institutionName = institutionName;
+    }
+
+    public Long getRefinancingManagementId() {
+        return refinancingManagementId;
+    }
+
+    public void setRefinancingManagementId(Long refinancingManagementId) {
+        this.refinancingManagementId = refinancingManagementId;
+    }
+}

+ 12 - 0
src/main/java/com/inkasso/factoring/financingmanagement/service/ReviewFinancingInfoService.java

@@ -0,0 +1,12 @@
+package com.inkasso.factoring.financingmanagement.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.inkasso.factoring.financingmanagement.entity.ReviewFinancingInfo;
+
+/**
+ * @Description : 额度支用-融资信息Service
+ * @Author : L.Jia
+ * @Date: 2023-12-15 16:17
+ */
+public interface ReviewFinancingInfoService extends IService<ReviewFinancingInfo> {
+}

+ 61 - 0
src/main/java/com/inkasso/factoring/financingmanagement/service/impl/FinancingApplyServiceImpl.java

@@ -135,6 +135,12 @@ public class FinancingApplyServiceImpl implements FinancingApplyService {
     private ITradingPlatformService platformService;
     @Autowired
     private IProjectInformationService projectInformationService;
+    @Autowired
+    private ReviewQuotaDisburseService reviewQuotaDisburseService;
+    @Autowired
+    private ReviewFinancingInfoService reviewFinancingInfoService;
+    @Value("${sop.getReturnedPrincipalByBusinessNo}")
+    private String getReturnedPrincipalByBusinessNo;
 
     @Override
     public GridPage<FinancingApplyListVo> list(FinancingSearch search) {
@@ -344,6 +350,8 @@ public class FinancingApplyServiceImpl implements FinancingApplyService {
         if (visible) {
             //校验验收单货物是否已经融资
             checkAcceptanceGoods(financingGoodsInfoList);
+            //校验-验收单为非电子签署时,在途金额>=500万元时,只能选择已结算过的验收单
+            checkSignConfirmAcceptance(financingBasicInfo, financingGoodsInfoList);
             //校验供应商五级分类是否正常用户
             checkEnterpriseGrade(financingBasicInfo.getMainEnterpriseId());
             //校验供应商名下是否存在豁免事项跟进未完成的数据
@@ -428,6 +436,59 @@ public class FinancingApplyServiceImpl implements FinancingApplyService {
         }
     }
 
+    /**
+     * 验收单为非电子签署时,在途金额>=500万元时,只能选择已结算过的验收单
+     *
+     * @param financingGoodsInfoList
+     */
+    private void checkSignConfirmAcceptance(CFinancingBasicInfo financingBasicInfo, List<CFinancingGoodsInfo> financingGoodsInfoList) {
+        //获取供应商下的在途金额
+        List<CFinancingBasicInfo> financingBasicInfoList = financingBasicInfoService.list(new QueryWrapper<CFinancingBasicInfo>().eq("supplier_id", financingBasicInfo.getMainEnterpriseId()));
+
+        BigDecimal inTransitAmountTotal = BigDecimal.ZERO;
+        if (CollectionUtil.isNotEmpty(financingBasicInfoList)) {
+            for (CFinancingBasicInfo cFinancingBasicInfo : financingBasicInfoList) {
+                ReviewQuotaDisburse reviewQuotaDisburse = reviewQuotaDisburseService.getOne(new QueryWrapper<ReviewQuotaDisburse>()
+                        .eq("c_financing_basic_info_id", cFinancingBasicInfo.getId())
+                        .eq("visible", true)
+                        .eq("approval_conclusion", "pass"));
+                if (reviewQuotaDisburse != null) {
+                    ReviewFinancingInfo reviewFinancingInfo = reviewFinancingInfoService.getOne(new QueryWrapper<ReviewFinancingInfo>()
+                            .eq("review_quota_disburse_id", reviewQuotaDisburse.getId()));
+                    BigDecimal inTransitAmount = reviewFinancingInfo.getFinancingAmount();
+                    //调用sop查询对应业务编号下已回款本金
+                    String getReturnedPrincipalByBusinessNoUrl = getReturnedPrincipalByBusinessNo + "?businessNumber=" + cFinancingBasicInfo.getBusinessNumber();
+                    ResponseEntity<String> responseEntity = restTemplate.getForEntity(getReturnedPrincipalByBusinessNoUrl, String.class);
+                    JSONObject jsonObject = JSONUtil.toBean(responseEntity.getBody(), JSONObject.class);
+                    if (responseEntity.getStatusCode().value() != HttpStatus.OK.value() || !jsonObject.getBool("success")) {
+                        throw new BusinessException(CodeUtil.FAIL, "查询sop对应的业务编号失败:" + jsonObject.getStr("msg"));
+                    }
+                    BigDecimal returnedPrincipal = jsonObject.getBigDecimal("data");
+                    inTransitAmount = inTransitAmount.subtract(returnedPrincipal);
+                    inTransitAmountTotal = inTransitAmountTotal.add(inTransitAmount);
+                }
+            }
+        }
+        if (inTransitAmountTotal.compareTo(new BigDecimal("5000000")) >= 0) {
+            if (CollectionUtil.isNotEmpty(financingGoodsInfoList)) {
+                List<Long> acceptanceBasicInfoIds = financingGoodsInfoList.stream().map(CFinancingGoodsInfo::getcAcceptanceBasicInfoId).distinct()
+                        .collect(Collectors.toList());
+                if (CollectionUtil.isNotEmpty(acceptanceBasicInfoIds)) {
+                    for (Long acceptanceBasicInfoId : acceptanceBasicInfoIds) {
+                        CAcceptanceBasicInfo acceptanceBasicInfo = acceptanceBasicInfoService.getById(acceptanceBasicInfoId);
+                        if (acceptanceBasicInfo != null && acceptanceBasicInfo.getSignConfirm() != null && acceptanceBasicInfo.getSignConfirm().equals(0)) {
+                            //非电子签署时
+                            if (acceptanceBasicInfo.getSettlement() != null && !acceptanceBasicInfo.getSettlement()) {
+                                //未结算过
+                                throw new BusinessException(CodeUtil.FAIL, "在途金额>=500万元且验收单为非电子签署时,只能选择已结算过的验收单");
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     /**
      * 校验是否存在已逾期的融资申请
      *

+ 18 - 0
src/main/java/com/inkasso/factoring/financingmanagement/service/impl/ReviewFinancingInfoServiceImpl.java

@@ -0,0 +1,18 @@
+package com.inkasso.factoring.financingmanagement.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.inkasso.factoring.financingmanagement.dao.ReviewFinancingInfoMapper;
+import com.inkasso.factoring.financingmanagement.entity.ReviewFinancingInfo;
+import com.inkasso.factoring.financingmanagement.service.ReviewFinancingInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Description :
+ * @Author : L.Jia
+ * @Date: 2023-12-15 19:44
+ */
+
+@Service
+public class ReviewFinancingInfoServiceImpl extends ServiceImpl<ReviewFinancingInfoMapper, ReviewFinancingInfo>
+        implements ReviewFinancingInfoService {
+}

+ 1 - 1
src/main/java/com/inkasso/factoring/settlement/service/Impl/GoodsCalculateServiceImpl.java

@@ -71,7 +71,7 @@ public class GoodsCalculateServiceImpl implements GoodsCalculateService {
         if (goodsInfoList != null && goodsInfoList.size() > 0) {
             List<SettlementGoodsInfo> goodsList = goodsInfoList.stream().map(goodsInfo -> {
                 // 计算货物销售总价、销售质保金、采购总价、采购质保金信息
-                goodsInfo.setSalesPrice(goodsInfo.getReferencePrice().add(goodsInfo.getFloatingPrice()));
+                goodsInfo.setSalesPrice(goodsInfo.getReferencePrice() == null?BigDecimal.ZERO:goodsInfo.getReferencePrice().add(goodsInfo.getFloatingPrice() == null?BigDecimal.ZERO:goodsInfo.getFloatingPrice()));
                 SettlementGoodsInfo baseGoods = calculate(businessNumber, supplierId,
                         goodsInfo.getSalesPrice(), goodsInfo.getGoodsQuantity());
                 baseGoods.setAcceptanceGoodsInfoId(goodsInfo.getId());

+ 2 - 1
src/main/java/com/inkasso/factoring/settlement/service/Impl/SettlementManagementServiceImpl.java

@@ -308,8 +308,9 @@ public class SettlementManagementServiceImpl extends ServiceImpl<SettlementBasic
         CAcceptanceBasicInfo basicInfo = new CAcceptanceBasicInfo();
         basicInfo.setBusinessNumber(businessNumber);
         basicInfo.setAcceptanceStatus(ProjectInitiationStatusEnum.COMPLETED.getCode());
+        basicInfo.setSettlement(false);
         List<CAcceptanceBasicInfo> acceptanceBasicInfos = icAcceptanceBasicInfoService.findByCondition(basicInfo, null);
-        acceptanceBasicInfos = acceptanceBasicInfos.stream().filter(r -> !CollectionUtil.isNotEmpty(settlementGoodsInfoService.list(new QueryWrapper<SettlementGoodsInfo>().eq("acceptance_goods_number", r.getAcceptanceGoodsNumber())))).collect(Collectors.toList());
+//        acceptanceBasicInfos = acceptanceBasicInfos.stream().filter(r -> !CollectionUtil.isNotEmpty(settlementGoodsInfoService.list(new QueryWrapper<SettlementGoodsInfo>().eq("acceptance_goods_number", r.getAcceptanceGoodsNumber())))).collect(Collectors.toList());
         //验收单货物做过底层的话价格信息从底层取
         if (CollectionUtil.isNotEmpty(acceptanceBasicInfos)) {
             for (CAcceptanceBasicInfo acceptanceBasicInfo : acceptanceBasicInfos) {

+ 1 - 0
src/main/resources/application-dev.yml

@@ -163,6 +163,7 @@ sop:
   getEnterpriseAreaUrl: http://192.168.3.6:8868/api/trade/getEnterpriseArea
   viewLatestPlanUrl: http://192.168.3.6:8868/api/payColl/viewLatestPlan
   judgeCustomerGradeUrl: http://192.168.3.6:8868/api/judgeCustomerGrade
+  getReturnedPrincipalByBusinessNo: http://192.168.3.6:8868/api/trade/getReturnedPrincipalByBusinessNo
 
 trade:
   biddingManagementStartProcessUrl: http://localhost:8888/api/biddingManagement/startProcess

+ 1 - 0
src/main/resources/application-prod.yml

@@ -168,6 +168,7 @@ sop:
   getEnterpriseAreaUrl: http://222.90.211.174:10526/api/trade/getEnterpriseArea
   viewLatestPlanUrl: http://222.90.211.174:10526/api/payColl/viewLatestPlan
   judgeCustomerGradeUrl: http://222.90.211.174:10526/api/judgeCustomerGrade
+  getReturnedPrincipalByBusinessNo: http://222.90.211.174:10526/api/trade/getReturnedPrincipalByBusinessNo
 
 trade:
   biddingManagementStartProcessUrl: http://139.224.194.150:8868/tradeV4-backend/api/biddingManagement/startProcess

+ 3 - 0
src/main/resources/mapping/acceptanceManagement/CAcceptanceBasicInfoMapper.xml

@@ -149,6 +149,9 @@
             <if test="basicInfo.receivables != null">
                 AND t2.is_receivables = #{basicInfo.receivables}
             </if>
+            <if test="basicInfo.settlement != null">
+                AND t2.is_settlement = #{basicInfo.settlement}
+            </if>
         </where>
         GROUP BY t1.acceptance_goods_number
     </select>