Commit b53cc336 authored by hezhuozhi's avatar hezhuozhi

修改还款

parent 3fec433b
...@@ -23,6 +23,7 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.RepaymentMapper; ...@@ -23,6 +23,7 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.RepaymentMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IRepaymentService; import com.yeejoin.amos.boot.module.hygf.api.service.IRepaymentService;
import com.yeejoin.amos.boot.module.hygf.biz.vo.RepaymentExcelVO; import com.yeejoin.amos.boot.module.hygf.biz.vo.RepaymentExcelVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -135,8 +136,13 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R ...@@ -135,8 +136,13 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
/** /**
* 定时发送还款信息 15天发送、5天发送、当天发送 * 定时发送还款信息 15天发送、5天发送、当天发送
*/ */
@Scheduled(cron = "0 0 1 * * ?") @Scheduled(cron = "${repaymentCron}")
public void cronSendRepayMessage() { public void cronSendRepayMessage() {
execute();
}
@Async
private void execute() {
List<Repayment> repaymentList = list(); List<Repayment> repaymentList = list();
if (CollectionUtil.isNotEmpty(repaymentList)) { if (CollectionUtil.isNotEmpty(repaymentList)) {
for (Repayment repayment : repaymentList) { for (Repayment repayment : repaymentList) {
...@@ -193,17 +199,21 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R ...@@ -193,17 +199,21 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
throw new BadRequest(companyName + ",该用户没有权限"); throw new BadRequest(companyName + ",该用户没有权限");
} }
String period = (String) objects.get(1); String period = String.valueOf(objects.get(1));
String repayDate = (String) objects.get(2); String repayDate = String.valueOf(objects.get(2));
String rent = (String) objects.get(3); String rent = String.valueOf(objects.get(3));
String interest = (String) objects.get(4); String interest = String.valueOf(objects.get(4));
String principal = (String) objects.get(5); String principal = String.valueOf(objects.get(5));
String loanPeriod = (String) objects.get(6); String loanPeriod = String.valueOf(objects.get(6));
repayment.setMessageState(RepaymentMessageStateEnum.UN_CONFIRM.getCode()); repayment.setMessageState(RepaymentMessageStateEnum.UN_CONFIRM.getCode());
repayment.setCronSendState(RepaymentCronSendStateEnum.SEND.getCode()); repayment.setCronSendState(RepaymentCronSendStateEnum.SEND.getCode());
repayment.setRepayState(RepaymentRepayStateEnum.UN_REPAY.getCode()); repayment.setRepayState(RepaymentRepayStateEnum.UN_REPAY.getCode());
repayment.setPeriod(period); repayment.setPeriod(period);
repayment.setRepayDate(DateUtils.dateParse(repayDate).toInstant() Date date = DateUtils.dateParse(repayDate);
if (Objects.isNull(date)){
throw new BadRequest("还款日期格式不对");
}
repayment.setRepayDate(date.toInstant()
.atZone(ZoneId.systemDefault()) .atZone(ZoneId.systemDefault())
.toLocalDate()); .toLocalDate());
repayment.setRent(Double.valueOf(rent)); repayment.setRent(Double.valueOf(rent));
......
...@@ -20,16 +20,16 @@ import java.time.LocalDate; ...@@ -20,16 +20,16 @@ import java.time.LocalDate;
public class RepaymentExcelVO implements Serializable { public class RepaymentExcelVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "公司名称") @ApiModelProperty(value = "区域公司")
@Excel(name = "公司名称", width = 50, orderNum = "1") @Excel(name = "区域公司", width = 50, orderNum = "1")
private String companyName; private String companyName;
@ApiModelProperty(value = "期次") @ApiModelProperty(value = "期次")
@Excel(name = "期次", width = 30, orderNum = "2") @Excel(name = "期次", width = 30, orderNum = "2")
private String period; private String period;
@ApiModelProperty(value = "还款时间") @ApiModelProperty(value = "还款日期")
@Excel(name = "还款时间", width = 30, orderNum = "3") @Excel(name = "还款日期", width = 30, orderNum = "3")
private LocalDate repayDate; private LocalDate repayDate;
@ApiModelProperty(value = "租金") @ApiModelProperty(value = "租金")
......
...@@ -87,3 +87,4 @@ exception.debug=true ...@@ -87,3 +87,4 @@ exception.debug=true
feign.okhttp.enabled= true feign.okhttp.enabled= true
workflow.feign.name=AMOS-API-WORKFLOW-CZ workflow.feign.name=AMOS-API-WORKFLOW-CZ
repaymentCron=0 0 1 * * ?
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment