
23 changed files with 306 additions and 13 deletions
@ -0,0 +1,28 @@ |
|||||
|
package com.yxt.anrui.riskcenter.api.loanfundday; |
||||
|
|
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2023/12/19 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class LoanFundDay extends BaseEntity { |
||||
|
private static final long serialVersionUID = 8336958436247857388L; |
||||
|
|
||||
|
@ApiModelProperty("还款计划明细表sid") |
||||
|
private String busSid; |
||||
|
@ApiModelProperty("日期") |
||||
|
private String createDate; |
||||
|
|
||||
|
@ApiModelProperty("公司垫款金额") |
||||
|
private BigDecimal paymentMoney; |
||||
|
|
||||
|
@ApiModelProperty("当日资金占用费") |
||||
|
private BigDecimal fund; |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package com.yxt.anrui.riskcenter.api.loanfundday; |
||||
|
|
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2023/12/19 |
||||
|
**/ |
||||
|
@FeignClient( |
||||
|
contextId = "anrui-riskcenter-LoanFundDay", |
||||
|
name = "anrui-riskcenter", |
||||
|
path = "v1/LoanFundDay", |
||||
|
fallback = LoanFundDayFeignFallback.class) |
||||
|
public interface LoanFundDayFeign { |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.yxt.anrui.riskcenter.api.loanfundday; |
||||
|
|
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2023/12/19 |
||||
|
**/ |
||||
|
@Component |
||||
|
public class LoanFundDayFeignFallback { |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.yxt.anrui.riskcenter.biz.loanfundday; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.yxt.anrui.riskcenter.api.loanfundday.LoanFundDay; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2023/12/19 |
||||
|
**/ |
||||
|
@Mapper |
||||
|
public interface LoanFundDayMapper extends BaseMapper<LoanFundDay> { |
||||
|
} |
@ -0,0 +1,4 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.anrui.riskcenter.biz.loanfundday.LoanFundDayMapper"> |
||||
|
</mapper> |
@ -0,0 +1,15 @@ |
|||||
|
package com.yxt.anrui.riskcenter.biz.loanfundday; |
||||
|
|
||||
|
import com.yxt.anrui.riskcenter.api.loanfundday.LoanFundDayFeign; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2023/12/19 |
||||
|
**/ |
||||
|
@RestController |
||||
|
@RequestMapping("v1/LoanFundDay") |
||||
|
public class LoanFundDayRest implements LoanFundDayFeign { |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.yxt.anrui.riskcenter.biz.loanfundday; |
||||
|
|
||||
|
import com.yxt.anrui.riskcenter.api.loanfundday.LoanFundDay; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2023/12/19 |
||||
|
**/ |
||||
|
@Service |
||||
|
public class LoanFundDayService extends MybatisBaseService<LoanFundDayMapper, LoanFundDay> { |
||||
|
} |
@ -0,0 +1,67 @@ |
|||||
|
package com.yxt.anrui.riskcenter.biz.loanfundday; |
||||
|
|
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import com.yxt.anrui.fin.api.finselectedreceivablesdetailed.FinSelectedReceivablesDetailedVo; |
||||
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailedjr.FinUncollectedReceivablesDetailedJR; |
||||
|
import com.yxt.anrui.fin.api.finuncollectedreceivablesdetailedjr.FinUncollectedReceivablesDetailedJRFeign; |
||||
|
import com.yxt.anrui.riskcenter.api.loanfundday.LoanFundDay; |
||||
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetails; |
||||
|
import com.yxt.anrui.riskcenter.biz.loanrepaymentplandetails.LoanRepaymentPlanDetailsService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Collections; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2023/12/19 |
||||
|
**/ |
||||
|
@Component |
||||
|
public class ScheduledLoanFundDayService { |
||||
|
|
||||
|
@Autowired |
||||
|
private LoanRepaymentPlanDetailsService loanRepaymentPlanDetailsService; |
||||
|
@Autowired |
||||
|
private LoanFundDayService loanFundDayService; |
||||
|
@Autowired |
||||
|
private FinUncollectedReceivablesDetailedJRFeign finUncollectedReceivablesDetailedJRFeign; |
||||
|
|
||||
|
|
||||
|
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
|
public void loanFundDayScheduled() { |
||||
|
/** |
||||
|
* 每天晚上12点遍历还款计划表中的公司垫款余额,按照以下规则计算: |
||||
|
* 每笔垫款的累计资金占用费用A(金融应收未收表中): |
||||
|
* 截止到当天垫款余额(在还款计划表中):T 当天新增的资金占用费B |
||||
|
* A=A+B,B =T*7/10000。 |
||||
|
* 需要建立每日资金占用费记录表(还款计划明细表sid,日期、当日垫款余额,当日资金占用费) |
||||
|
*/ |
||||
|
//查询
|
||||
|
List<LoanRepaymentPlanDetails> list = loanRepaymentPlanDetailsService.planList(); |
||||
|
list.removeAll(Collections.singleton(null)); |
||||
|
if (list.size() > 0) { |
||||
|
//截止到当天垫款余额T
|
||||
|
BigDecimal paymentMoneyAll = list.stream().map(LoanRepaymentPlanDetails::getPaymentMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
||||
|
//当天资金占用费B
|
||||
|
BigDecimal fundDay = paymentMoneyAll.multiply(new BigDecimal(7)).divide(new BigDecimal(10000), BigDecimal.ROUND_CEILING); |
||||
|
for (int i = 0; i < list.size(); i++) { |
||||
|
LoanRepaymentPlanDetails loanRepaymentPlanDetails = list.get(i); |
||||
|
LoanFundDay loanFundDay = new LoanFundDay(); |
||||
|
loanFundDay.setBusSid(loanRepaymentPlanDetails.getSid()); |
||||
|
loanFundDay.setCreateDate(DateUtil.today()); |
||||
|
loanFundDay.setPaymentMoney(paymentMoneyAll); |
||||
|
loanFundDay.setFund(fundDay); |
||||
|
loanFundDayService.insert(loanFundDay); |
||||
|
//更新资金占用A
|
||||
|
finUncollectedReceivablesDetailedJRFeign.updateAll(loanRepaymentPlanDetails.getSid(), "资金占用费", fundDay); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue