diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApply.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApply.java index d791ecb11b..cd3a26b11f 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApply.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApply.java @@ -45,5 +45,7 @@ public class LoanBuckleApply extends BaseEntity { private String taskId; // taskId @ApiModelProperty("申请人组织路径") private String orgSidPath; // 申请人组织路径 + @ApiModelProperty("办结日期") + private Date closingDate; } diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyDto.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyDto.java index 1816001c55..a2a54dfee6 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyDto.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyDto.java @@ -23,6 +23,6 @@ public class LoanBuckleApplyDto implements Dto { private String applyDate; private String remarks; private String orgPath; - private List files = new ArrayList<>(); + private List files = new ArrayList<>(); private List records = new ArrayList<>(); } diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyFeign.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyFeign.java index 1a4dc042c9..9edff5fcb4 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyFeign.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyFeign.java @@ -36,7 +36,7 @@ public interface LoanBuckleApplyFeign { public ResultBean> listPage(@RequestBody PagerQuery pq); @ApiOperation("新增初始化") - @GetMapping("/buckleInit") + @PostMapping("/buckleInit") @ResponseBody public ResultBean buckleInit(@RequestBody String[] sids); diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyInit.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyInit.java index 24d09501f2..88d0729353 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyInit.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleApplyInit.java @@ -1,5 +1,6 @@ package com.yxt.anrui.riskcenter.api.loanbuckleapply; +import com.yxt.anrui.buscenter.api.bussolutionschange.BusSolutionsChangeFiles; import com.yxt.common.core.vo.Vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -27,7 +28,7 @@ public class LoanBuckleApplyInit implements Vo { private String taskId; @ApiModelProperty("实例id") private String instanceId; - private List files = new ArrayList<>(); + private List files = new ArrayList<>(); private List records = new ArrayList<>(); } diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleFile.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleFile.java new file mode 100644 index 0000000000..c5bafd6148 --- /dev/null +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleFile.java @@ -0,0 +1,18 @@ +package com.yxt.anrui.riskcenter.api.loanbuckleapply; + +import lombok.Data; + +/** + * @author Administrator + * @description + * @date 2023/11/17 9:18 + */ +@Data +public class LoanBuckleFile { + private String filePath; + private String name; + private String size; + private String status; + private String uid; + private String url; +} diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleHistoryRecord.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleHistoryRecord.java index 7166f09f7a..40bfd03ded 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleHistoryRecord.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/LoanBuckleHistoryRecord.java @@ -29,14 +29,14 @@ public class LoanBuckleHistoryRecord { private String returnWay; @ApiModelProperty("期数") private String period; - @ApiModelProperty("应还日期") - private String dueDate; - @ApiModelProperty("应还金额") - private String dueMoney; +// @ApiModelProperty("应还日期") +// private String dueDate; +// @ApiModelProperty("应还金额") +// private String dueMoney; @ApiModelProperty("实还金额") private String actualMoney; - @ApiModelProperty("本期未还金额") - private String outstandingMoney; +// @ApiModelProperty("本期未还金额") +// private String outstandingMoney; @ApiModelProperty("实还日期") private String actualDate; diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/app/AppRecordVo.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/app/AppRecordVo.java index 2a92f8ac3a..739ac1fe17 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/app/AppRecordVo.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanbuckleapply/app/AppRecordVo.java @@ -17,7 +17,7 @@ public class AppRecordVo { private String zfNo; private String cusName; private String loanName; - private String repaymentDate; + // private String repaymentDate; private String info1; private String info2; } diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistory.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistory.java index fdeae5f8ed..b3aa6bd9e9 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistory.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistory.java @@ -28,8 +28,8 @@ public class LoanRepaymentHistory extends BaseEntity { private Date dataTime; @ApiModelProperty("实还金额") private BigDecimal actualMoney; - @ApiModelProperty("本期未还金额") - private BigDecimal outstandingMoney; +// @ApiModelProperty("本期未还金额") +// private BigDecimal outstandingMoney; @ApiModelProperty("划扣状态key") private String buckleKey; @ApiModelProperty("划扣状态") @@ -38,4 +38,6 @@ public class LoanRepaymentHistory extends BaseEntity { private String returnWay; @ApiModelProperty("还款方式key") private String returnWayKey; + @ApiModelProperty("办结日期") + private Date closingDate; } diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryDto.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryDto.java index 68a5083500..a5fee0193f 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryDto.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryDto.java @@ -25,8 +25,8 @@ public class LoanRepaymentHistoryDto implements Dto { private String dataTime; @ApiModelProperty("实还金额") private String actualMoney; - @ApiModelProperty("本期未还金额") - private String outstandingMoney; +// @ApiModelProperty("本期未还金额") +// private String outstandingMoney; @ApiModelProperty("划扣状态key") private String buckleKey; @ApiModelProperty("划扣状态") diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryFeign.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryFeign.java index 5477dfe31f..1d6cd02865 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryFeign.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryFeign.java @@ -68,6 +68,11 @@ public interface LoanRepaymentHistoryFeign { @ResponseBody public ResultBean saveRecords(@RequestBody List dto); + @ApiOperation("批量删除") + @DeleteMapping("/deleteBySids") + @ResponseBody + public ResultBean deleteBySids(@RequestBody String[] sids); + @ApiOperation(value = "下载模板") @PostMapping("/downloadExcel") diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryFeignFallback.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryFeignFallback.java index 078cfab674..e8dd78bc7f 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryFeignFallback.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryFeignFallback.java @@ -60,6 +60,11 @@ public class LoanRepaymentHistoryFeignFallback implements LoanRepaymentHistoryFe return null; } + @Override + public ResultBean deleteBySids(String[] sids) { + return null; + } + @Override public void downloadExcel() { diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryUpdate.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryUpdate.java index 3859309095..ee3dd2cb93 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryUpdate.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryUpdate.java @@ -32,5 +32,5 @@ public class LoanRepaymentHistoryUpdate { private String actualMoney; @ApiModelProperty("还款方式key") private String returnWayKey; - + private String planDetailSid; } diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryVo.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryVo.java index 17c58e7b52..b4eba3a5ed 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryVo.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymenthistory/LoanRepaymentHistoryVo.java @@ -46,6 +46,6 @@ public class LoanRepaymentHistoryVo implements Vo { private String buckle; @ApiModelProperty("还款方式") private String returnWay; - + private String planDetailSid; } diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateSchedulePdfVo.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateSchedulePdfVo.java index e1a4ad897b..ce3d18359f 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateSchedulePdfVo.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateSchedulePdfVo.java @@ -57,7 +57,8 @@ public class LoanCreateSchedulePdfVo implements Vo { private String otherLastRepay; @ApiModelProperty("是否有其他融 0没有1有") private String isOtherPolicy; - + @ApiModelProperty("资方是否相同 0否1是") + private String sameBank; private LoanSolutionsDetailsssVo solutionsDetailsssVo; - + private String otherBankNo; } diff --git a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentSchedule.java b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentSchedule.java index bf98c52aaf..526c56660a 100644 --- a/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentSchedule.java +++ b/anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentSchedule.java @@ -66,5 +66,12 @@ public class LoanRepaymentSchedule extends BaseEntity { private String isOtherPolicy; @ApiModelProperty("还款计划单下载地址") private String schedulePath; + @ApiModelProperty("资方是否相同 0否1是") + private String sameBank; + @ApiModelProperty("资方合同号") + private String bankContractNo; + @ApiModelProperty("其他融资方合同号") + private String otherBankNo; + } diff --git a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanbuckleapply/LoanBuckleApplyService.java b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanbuckleapply/LoanBuckleApplyService.java index 8e749e1a38..ec89dbb8da 100644 --- a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanbuckleapply/LoanBuckleApplyService.java +++ b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanbuckleapply/LoanBuckleApplyService.java @@ -1,6 +1,7 @@ package com.yxt.anrui.riskcenter.biz.loanbuckleapply; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateTime; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -8,6 +9,9 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.yxt.anrui.base.common.enums.BillTypeEnum; import com.yxt.anrui.base.common.utils.Rule; import com.yxt.anrui.base.common.utils.domain.BillNo; +import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFile; +import com.yxt.anrui.buscenter.api.buscenterfile.BuscenterFileEnum; +import com.yxt.anrui.buscenter.api.bussolutionschange.BusSolutionsChangeFiles; import com.yxt.anrui.flowable.api.flow.FlowableFeign; import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; import com.yxt.anrui.flowable.api.flow2.FlowDelegateQuery; @@ -30,15 +34,11 @@ import com.yxt.anrui.riskcenter.api.loanbuckleapply.flow.*; import com.yxt.anrui.riskcenter.api.loanbuckleapplyrecord.LoanBuckleApplyRecord; import com.yxt.anrui.riskcenter.api.loanfile.LoanFile; import com.yxt.anrui.riskcenter.api.loanfile.LoanFileEnum; -import com.yxt.anrui.riskcenter.api.loanfinotherPolicy.LoanFinOtherPolicy; -import com.yxt.anrui.riskcenter.api.loanfinpolicy.LoanFinPolicy; -import com.yxt.anrui.riskcenter.api.loanfinpolicyrecordapply.LoanFinPolicyRecordApply; import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.LoanRepaymentHistory; import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.LoanRepaymentHistoryRecordVo; import com.yxt.anrui.riskcenter.biz.loanbuckleapplyrecord.LoanBuckleApplyRecordService; import com.yxt.anrui.riskcenter.biz.loanfile.LoanFileService; import com.yxt.anrui.riskcenter.biz.loanrepaymenthistory.LoanRepaymentHistoryService; -import com.yxt.common.base.config.component.DocPdfComponent; import com.yxt.common.base.config.component.FileUploadComponent; import com.yxt.common.base.service.MybatisBaseService; import com.yxt.common.base.utils.PagerUtil; @@ -159,6 +159,8 @@ public class LoanBuckleApplyService extends MybatisBaseService buckleInit(String[] sids) { ResultBean rb = ResultBean.fireFail(); LoanBuckleApplyInit vo = new LoanBuckleApplyInit(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + vo.setApplyDate(sdf.format(new Date())); List historyRecords = new ArrayList<>(); for (String sid : sids) { LoanBuckleHistoryRecord record = new LoanBuckleHistoryRecord(); @@ -173,7 +175,7 @@ public class LoanBuckleApplyService extends MybatisBaseService files = dto.getFiles(); - if (!files.isEmpty()) { + List filess = dto.getFiles(); + if (!filess.isEmpty()) { + List files = new ArrayList<>(); + for (LoanBuckleFile file : filess) { + files.add(file.getUrl()); + } loanFileService.saveAll(sid, files, LoanFileEnum.BUCKLE_APPLY.getAttachType()); } List records = dto.getRecords(); @@ -255,8 +261,14 @@ public class LoanBuckleApplyService extends MybatisBaseService files = dto.getFiles(); - if (!files.isEmpty()) { + //删除附件表中关于该linkSid的文件 + loanFileService.deleteByLinkSid(sid); + List filess = dto.getFiles(); + if (!filess.isEmpty()) { + List files = new ArrayList<>(); + for (LoanBuckleFile file : filess) { + files.add(file.getUrl()); + } loanFileService.saveAll(sid, files, LoanFileEnum.BUCKLE_APPLY.getAttachType()); } } @@ -283,7 +295,13 @@ public class LoanBuckleApplyService extends MybatisBaseService files = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). collect(Collectors.toList()); - initVo.setFiles(files); + List loanBuckleFiles = new ArrayList<>(); + for (String file : files) { + LoanBuckleFile loanBuckleFile = new LoanBuckleFile(); + loanBuckleFile.setUrl(file); + loanBuckleFiles.add(loanBuckleFile); + } + initVo.setFiles(loanBuckleFiles); } List records = loanBuckleApplyRecordService.selByMainSid(sid); List recordList = new ArrayList<>(); @@ -509,6 +527,9 @@ public class LoanBuckleApplyService extends MybatisBaseService applyRecords = loanBuckleApplyRecordService.selByMainSid(businessSid); if (!applyRecords.isEmpty()) { for (LoanBuckleApplyRecord applyRecord : applyRecords) { @@ -516,11 +537,11 @@ public class LoanBuckleApplyService extends MybatisBaseService selByBankNoAndActDate(@Param("bankContractNo") String bankContractNo, @Param("realReturnTime") String realReturnTime); LoanRepaymentHistoryRecordVo buckleInfo(String sid); + + List selByPlanSid(@Param("planSid") String planDetailSid); } diff --git a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryMapper.xml b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryMapper.xml index 866dc7b672..750cbf1cea 100644 --- a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryMapper.xml +++ b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryMapper.xml @@ -5,19 +5,19 @@ + \ No newline at end of file diff --git a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryRest.java b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryRest.java index 81e467cda5..43330b3361 100644 --- a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryRest.java +++ b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryRest.java @@ -81,6 +81,11 @@ public class LoanRepaymentHistoryRest implements LoanRepaymentHistoryFeign { return loanRepaymentHistoryService.saveRecords(dto); } + @Override + public ResultBean deleteBySids(String[] sids) { + return loanRepaymentHistoryService.deleteBySids(sids); + } + @Override public void downloadExcel() { try { diff --git a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryService.java b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryService.java index 014d6bbce6..1e1190c4e6 100644 --- a/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryService.java +++ b/anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymenthistory/LoanRepaymentHistoryService.java @@ -350,28 +350,44 @@ public class LoanRepaymentHistoryService extends MybatisBaseService histories = baseMapper.selHistoryByPlanSid(repaymentHistory.getPlanDetailSid()); +// List histories = baseMapper.selHistoryByPlanSid(repaymentHistory.getPlanDetailSid()); +// BigDecimal returned = new BigDecimal(0); +// if (!histories.isEmpty()) { +// for (LoanRepaymentHistory history : histories) { +// returned = history.getActualMoney().add(returned); +// } +// } +// LoanRepaymentPlanDetails loanRepaymentPlanDetails = loanRepaymentPlanDetailsService.fetchBySid(repaymentHistory.getPlanDetailSid()); +// if (null != loanRepaymentPlanDetails) { +// BigDecimal decimal = returned.add(realMoney); +// BigDecimal dueMoney = loanRepaymentPlanDetails.getDueMoney(); +// BigDecimal subtract = dueMoney.subtract(decimal); +// // repaymentHistory.setOutstandingMoney(subtract); +// } + } + baseMapper.updateById(repaymentHistory); + return rb.success(); + } + + public ResultBean updateRecordInfo(String sid) { + ResultBean rb = ResultBean.fireFail(); + LoanRepaymentHistoryUpdate vo = baseMapper.updateRecordInfo(sid); + if (null != vo) { + String planDetailSid = vo.getPlanDetailSid(); + List histories = baseMapper.selByPlanSid(planDetailSid); BigDecimal returned = new BigDecimal(0); if (!histories.isEmpty()) { for (LoanRepaymentHistory history : histories) { returned = history.getActualMoney().add(returned); } } - LoanRepaymentPlanDetails loanRepaymentPlanDetails = loanRepaymentPlanDetailsService.fetchBySid(repaymentHistory.getPlanDetailSid()); + LoanRepaymentPlanDetails loanRepaymentPlanDetails = loanRepaymentPlanDetailsService.fetchBySid(planDetailSid); if (null != loanRepaymentPlanDetails) { - BigDecimal decimal = returned.add(realMoney); BigDecimal dueMoney = loanRepaymentPlanDetails.getDueMoney(); - BigDecimal subtract = dueMoney.subtract(decimal); - repaymentHistory.setOutstandingMoney(subtract); + BigDecimal subtract = dueMoney.subtract(returned); + vo.setOutstandingMoney(String.valueOf(subtract)); } } - baseMapper.updateById(repaymentHistory); - return rb.success(); - } - - public ResultBean updateRecordInfo(String sid) { - ResultBean rb = ResultBean.fireFail(); - LoanRepaymentHistoryUpdate vo = baseMapper.updateRecordInfo(sid); return rb.success().setData(vo); } @@ -468,7 +484,7 @@ public class LoanRepaymentHistoryService extends MybatisBaseService pagging = baseMapper.monthListPage(page, qw); + List records = pagging.getRecords(); + records.removeAll(Collections.singleton(null)); + if (!records.isEmpty()) { + for (LoanRepaymentHistoryVo record : records) { + String planDetailSid = record.getPlanDetailSid(); + List histories = baseMapper.selByPlanSid(planDetailSid); + BigDecimal returned = new BigDecimal(0); + if (!histories.isEmpty()) { + for (LoanRepaymentHistory history : histories) { + returned = history.getActualMoney().add(returned); + } + } + LoanRepaymentPlanDetails loanRepaymentPlanDetails = loanRepaymentPlanDetailsService.fetchBySid(record.getPlanDetailSid()); + if (null != loanRepaymentPlanDetails) { + BigDecimal dueMoney = loanRepaymentPlanDetails.getDueMoney(); + BigDecimal subtract = dueMoney.subtract(returned); + record.setOutstandingMoney(String.valueOf(subtract)); + } + } + } PagerVo p = PagerUtil.pageToVo(pagging, null); return p; } @@ -584,6 +620,8 @@ public class LoanRepaymentHistoryService extends MybatisBaseService histories = baseMapper.selHistoryByPlanSid(planDetail.getSid()); - BigDecimal returned = new BigDecimal(0); - if (!histories.isEmpty()) { - for (LoanRepaymentHistory history : histories) { - returned = history.getActualMoney().add(returned); - } - } - BigDecimal decimal = returned.add(divide); - BigDecimal dueMoney = planDetail.getDueMoney(); - BigDecimal subtract = dueMoney.subtract(decimal); - repaymentHistory.setOutstandingMoney(subtract); +// List histories = baseMapper.selHistoryByPlanSid(planDetail.getSid()); +// BigDecimal returned = new BigDecimal(0); +// if (!histories.isEmpty()) { +// for (LoanRepaymentHistory history : histories) { +// returned = history.getActualMoney().add(returned); +// } +// } +// BigDecimal decimal = returned.add(divide); +// BigDecimal dueMoney = planDetail.getDueMoney(); +// BigDecimal subtract = dueMoney.subtract(decimal); +// repaymentHistory.setOutstandingMoney(subtract); baseMapper.insert(repaymentHistory); } } @@ -617,4 +655,13 @@ public class LoanRepaymentHistoryService extends MybatisBaseService mainDays = returnRepayDate(mainDate, scheduleDetails.getMainPeriod()); - List otherDays = new ArrayList<>(); - String mainFirstRepay = String.valueOf(scheduleDetails.getMainFirstRepay()); - String mainMidRepay = String.valueOf(scheduleDetails.getMainMidRepay()); - String mainLastRepay = String.valueOf(scheduleDetails.getMainLastRepay()); - String otherPeriod = ""; - String otherDate = ""; - String otherFirstPay = ""; - String otherMidPay = ""; - String otherLastPay = ""; - String deptSid = ""; - String dept = ""; - String useOrgName = ""; - String useOrgSid = ""; - String orgSidPath = ""; - String bankContractNo = ""; - String customer = ""; - String customerSid = ""; - if (scheduleDetails.getIsOtherPolicy().equals("1")) { - otherPeriod = scheduleDetails.getOtherPeriod(); - otherDate = sdf.format(scheduleDetails.getOtherRepayDate()); - otherFirstPay = String.valueOf(scheduleDetails.getOtherFirstRepay()); - otherMidPay = String.valueOf(scheduleDetails.getOtherMidRepay()); - otherLastPay = String.valueOf(scheduleDetails.getOtherLastRepay()); - otherDays = returnRepayDate(otherDate, otherPeriod); - } - if (null != busSalesOrder) { - if (StringUtils.isNotBlank(busSalesOrder.getCustomerName())) { - customer = busSalesOrder.getCustomerName(); + if (scheduleDetails.getSameBank().equals("0")) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String createBySid = scheduleDetails.getCreateBySid(); + String staffSid = scheduleDetails.getStaffSid(); + String bankName = scheduleDetails.getBankName(); + String borrowerSid = scheduleDetails.getBorrowerSid(); + String borrowerName = scheduleDetails.getBorrowerName(); + String staffName = scheduleDetails.getStaffName(); + String salesOrderSid = scheduleDetails.getSalesOrderSid(); + String policyName = scheduleDetails.getPolicyName(); + String loanContractSid = scheduleDetails.getLoanContractSid(); + String loanContractNo = scheduleDetails.getLoanContractNo(); + int mainPeriod = Integer.parseInt(scheduleDetails.getMainPeriod()); + String mainDate = sdf.format(scheduleDetails.getMainRepayDate()); + List mainDays = returnRepayDate(mainDate, scheduleDetails.getMainPeriod()); + List otherDays = new ArrayList<>(); + String mainFirstRepay = String.valueOf(scheduleDetails.getMainFirstRepay()); + String mainMidRepay = String.valueOf(scheduleDetails.getMainMidRepay()); + String mainLastRepay = String.valueOf(scheduleDetails.getMainLastRepay()); + String otherPeriod = ""; + String otherDate = ""; + String otherFirstPay = ""; + String otherMidPay = ""; + String otherLastPay = ""; + String deptSid = ""; + String dept = ""; + String useOrgName = ""; + String useOrgSid = ""; + String orgSidPath = ""; + String bankContractNo = ""; + String customer = ""; + String customerSid = ""; + if (scheduleDetails.getIsOtherPolicy().equals("1")) { + otherPeriod = scheduleDetails.getOtherPeriod(); + otherDate = sdf.format(scheduleDetails.getOtherRepayDate()); + otherFirstPay = String.valueOf(scheduleDetails.getOtherFirstRepay()); + otherMidPay = String.valueOf(scheduleDetails.getOtherMidRepay()); + otherLastPay = String.valueOf(scheduleDetails.getOtherLastRepay()); + otherDays = returnRepayDate(otherDate, otherPeriod); } - if (StringUtils.isNotBlank(busSalesOrder.getCustomerSid())) { - customerSid = busSalesOrder.getCustomerSid(); + if (null != busSalesOrder) { + if (StringUtils.isNotBlank(busSalesOrder.getCustomerName())) { + customer = busSalesOrder.getCustomerName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getCustomerSid())) { + customerSid = busSalesOrder.getCustomerSid(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgSid())) { + deptSid = busSalesOrder.getOrgSid(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgName())) { + dept = busSalesOrder.getOrgName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgSidPath())) { + orgSidPath = busSalesOrder.getOrgSidPath(); + } + if (StringUtils.isNotBlank(busSalesOrder.getUseOrgName())) { + useOrgName = busSalesOrder.getUseOrgName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getUseOrgSid())) { + useOrgSid = busSalesOrder.getUseOrgSid(); + } } - if (StringUtils.isNotBlank(busSalesOrder.getOrgSid())) { - deptSid = busSalesOrder.getOrgSid(); + BusSalesOrderLoancontractDetailsVo loancontractVo = busSalesOrderLoancontractFeign.fetchDetailsBySid(dto.getSalesOrderSid()).getData(); + if (null != loancontractVo) { + if (StringUtils.isNotBlank(loancontractVo.getBankContractNo())) { + bankContractNo = loancontractVo.getBankContractNo(); + } } - if (StringUtils.isNotBlank(busSalesOrder.getOrgName())) { - dept = busSalesOrder.getOrgName(); + String otherBankNo = ""; + if (StringUtils.isNotBlank(scheduleDetails.getOtherBankNo())) { + otherBankNo = scheduleDetails.getOtherBankNo(); } - if (StringUtils.isNotBlank(busSalesOrder.getOrgSidPath())) { - orgSidPath = busSalesOrder.getOrgSidPath(); + List vehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); + if (!vehicles.isEmpty()) { + for (BusSalesOrderVehicle vehicle : vehicles) { + String linkNo = vehicle.getLinkNo(); + String busVinSid = vehicle.getSid(); + //主方案 + for (int i = 0; i < mainPeriod; i++) { + LoanRepaymentPlanDetailsDto mainDto = new LoanRepaymentPlanDetailsDto(); + mainDto.setSalesOrderSid(salesOrderSid); + mainDto.setLoanContractNo(loanContractNo); + mainDto.setLoanContractSid(loanContractSid); + mainDto.setPolicyName(policyName); + mainDto.setBankContractNo(bankContractNo); + mainDto.setCreateBySid(createBySid); + mainDto.setCustomer(customer); + mainDto.setCustomerSid(customerSid); + mainDto.setBorrowerSid(borrowerSid); + mainDto.setBorrowerName(borrowerName); + mainDto.setPeriod(String.valueOf(i + 1)); + mainDto.setScheduleSid(scheduleDetails.getSid()); + mainDto.setBankName(bankName); + mainDto.setDept(dept); + mainDto.setDeptSid(deptSid); + mainDto.setUseOrgSid(useOrgSid); + mainDto.setUseOrgName(useOrgName); + mainDto.setOrgSidPath(orgSidPath); + mainDto.setBusVinSid(busVinSid); + mainDto.setVinNo(linkNo); + mainDto.setSalesUserSid(staffSid); + mainDto.setStaffName(staffName); + mainDto.setPolicyOrOther("0"); + if (i == 0) { + mainDto.setDueMoney(mainFirstRepay); + } else if (i == mainPeriod - 1) { + mainDto.setDueMoney(mainLastRepay); + } else { + mainDto.setDueMoney(mainMidRepay); + } + if (!mainDays.isEmpty()) { + mainDto.setDueDate(mainDays.get(i)); + } + loanRepaymentPlanDetailsService.savePlanDetails(mainDto); + } + //其他融 + if (scheduleDetails.getIsOtherPolicy().equals("1")) { + for (int i = 0; i < Integer.parseInt(otherPeriod); i++) { + LoanRepaymentPlanDetailsDto otherDto = new LoanRepaymentPlanDetailsDto(); + otherDto.setSalesOrderSid(salesOrderSid); + otherDto.setLoanContractNo(loanContractNo); + otherDto.setLoanContractSid(loanContractSid); + otherDto.setPolicyName(policyName); + otherDto.setBankContractNo(otherBankNo); + otherDto.setCreateBySid(createBySid); + otherDto.setCustomer(customer); + otherDto.setCustomerSid(customerSid); + otherDto.setBorrowerSid(borrowerSid); + otherDto.setBorrowerName(borrowerName); + otherDto.setPeriod(String.valueOf(i + 1)); + otherDto.setScheduleSid(scheduleDetails.getSid()); + otherDto.setBankName(bankName); + otherDto.setDept(dept); + otherDto.setDeptSid(deptSid); + otherDto.setUseOrgSid(useOrgSid); + otherDto.setUseOrgName(useOrgName); + otherDto.setOrgSidPath(orgSidPath); + otherDto.setBusVinSid(busVinSid); + otherDto.setVinNo(linkNo); + otherDto.setSalesUserSid(staffSid); + otherDto.setStaffName(staffName); + otherDto.setPolicyOrOther("1"); + if (i == 0) { + otherDto.setDueMoney(otherFirstPay); + } else if (i == Integer.parseInt(otherPeriod) - 1) { + otherDto.setDueMoney(otherLastPay); + } else { + otherDto.setDueMoney(otherMidPay); + } + if (!otherDays.isEmpty()) { + otherDto.setDueDate(otherDays.get(i)); + } + loanRepaymentPlanDetailsService.savePlanDetails(otherDto); + } + } + + } } - if (StringUtils.isNotBlank(busSalesOrder.getUseOrgName())) { - useOrgName = busSalesOrder.getUseOrgName(); + } + if (scheduleDetails.getSameBank().equals("1")) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String createBySid = scheduleDetails.getCreateBySid(); + String staffSid = scheduleDetails.getStaffSid(); + String bankName = scheduleDetails.getBankName(); + String borrowerSid = scheduleDetails.getBorrowerSid(); + String borrowerName = scheduleDetails.getBorrowerName(); + String staffName = scheduleDetails.getStaffName(); + String salesOrderSid = scheduleDetails.getSalesOrderSid(); + String policyName = scheduleDetails.getPolicyName(); + String loanContractSid = scheduleDetails.getLoanContractSid(); + String loanContractNo = scheduleDetails.getLoanContractNo(); + int mainPeriod = Integer.parseInt(scheduleDetails.getMainPeriod()); + String mainDate = sdf.format(scheduleDetails.getMainRepayDate()); + List mainDays = returnRepayDate(mainDate, scheduleDetails.getMainPeriod()); + String mainFirstRepay = String.valueOf(scheduleDetails.getMainFirstRepay()); + String mainMidRepay = String.valueOf(scheduleDetails.getMainMidRepay()); + String mainLastRepay = String.valueOf(scheduleDetails.getMainLastRepay()); + String otherPeriod = ""; + String otherDate = ""; + String otherFirstPay = ""; + String otherMidPay = ""; + String otherLastPay = ""; + String deptSid = ""; + String dept = ""; + String useOrgName = ""; + String useOrgSid = ""; + String orgSidPath = ""; + String bankContractNo = ""; + String customer = ""; + String customerSid = ""; + if (scheduleDetails.getIsOtherPolicy().equals("1")) { + otherPeriod = scheduleDetails.getOtherPeriod(); + otherDate = sdf.format(scheduleDetails.getOtherRepayDate()); + otherFirstPay = String.valueOf(scheduleDetails.getOtherFirstRepay()); + otherMidPay = String.valueOf(scheduleDetails.getOtherMidRepay()); + otherLastPay = String.valueOf(scheduleDetails.getOtherLastRepay()); } - if (StringUtils.isNotBlank(busSalesOrder.getUseOrgSid())) { - useOrgSid = busSalesOrder.getUseOrgSid(); + if (null != busSalesOrder) { + if (StringUtils.isNotBlank(busSalesOrder.getCustomerName())) { + customer = busSalesOrder.getCustomerName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getCustomerSid())) { + customerSid = busSalesOrder.getCustomerSid(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgSid())) { + deptSid = busSalesOrder.getOrgSid(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgName())) { + dept = busSalesOrder.getOrgName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgSidPath())) { + orgSidPath = busSalesOrder.getOrgSidPath(); + } + if (StringUtils.isNotBlank(busSalesOrder.getUseOrgName())) { + useOrgName = busSalesOrder.getUseOrgName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getUseOrgSid())) { + useOrgSid = busSalesOrder.getUseOrgSid(); + } } - } - BusSalesOrderLoancontractDetailsVo loancontractVo = busSalesOrderLoancontractFeign.fetchDetailsBySid(dto.getSalesOrderSid()).getData(); - if (null != loancontractVo) { - if (StringUtils.isNotBlank(loancontractVo.getBankContractNo())) { - bankContractNo = loancontractVo.getBankContractNo(); + BusSalesOrderLoancontractDetailsVo loancontractVo = busSalesOrderLoancontractFeign.fetchDetailsBySid(dto.getSalesOrderSid()).getData(); + if (null != loancontractVo) { + if (StringUtils.isNotBlank(loancontractVo.getBankContractNo())) { + bankContractNo = loancontractVo.getBankContractNo(); + } } - } - List vehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); - if (!vehicles.isEmpty()) { - for (BusSalesOrderVehicle vehicle : vehicles) { - String linkNo = vehicle.getLinkNo(); - String busVinSid = vehicle.getSid(); - //主方案 - for (int i = 0; i < mainPeriod; i++) { - LoanRepaymentPlanDetailsDto mainDto = new LoanRepaymentPlanDetailsDto(); - mainDto.setSalesOrderSid(salesOrderSid); - mainDto.setLoanContractNo(loanContractNo); - mainDto.setLoanContractSid(loanContractSid); - mainDto.setPolicyName(policyName); - mainDto.setBankContractNo(bankContractNo); - mainDto.setCreateBySid(createBySid); - mainDto.setCustomer(customer); - mainDto.setCustomerSid(customerSid); - mainDto.setBorrowerSid(borrowerSid); - mainDto.setBorrowerName(borrowerName); - mainDto.setPeriod(String.valueOf(i + 1)); - mainDto.setScheduleSid(scheduleDetails.getSid()); - mainDto.setBankName(bankName); - mainDto.setDept(dept); - mainDto.setDeptSid(deptSid); - mainDto.setUseOrgSid(useOrgSid); - mainDto.setUseOrgName(useOrgName); - mainDto.setOrgSidPath(orgSidPath); - mainDto.setBusVinSid(busVinSid); - mainDto.setVinNo(linkNo); - mainDto.setSalesUserSid(staffSid); - mainDto.setStaffName(staffName); - mainDto.setPolicyOrOther("0"); - if (i == 0) { - mainDto.setDueMoney(mainFirstRepay); - } else if (i == mainPeriod - 1) { - mainDto.setDueMoney(mainLastRepay); - } else { - mainDto.setDueMoney(mainMidRepay); - } - if (!mainDays.isEmpty()) { - mainDto.setDueDate(mainDays.get(i)); - } - loanRepaymentPlanDetailsService.savePlanDetails(mainDto); - } - //其他融 - if (scheduleDetails.getIsOtherPolicy().equals("1")) { - for (int i = 0; i < Integer.parseInt(otherPeriod); i++) { - LoanRepaymentPlanDetailsDto otherDto = new LoanRepaymentPlanDetailsDto(); - otherDto.setSalesOrderSid(salesOrderSid); - otherDto.setLoanContractNo(loanContractNo); - otherDto.setLoanContractSid(loanContractSid); - otherDto.setPolicyName(policyName); - otherDto.setBankContractNo(bankContractNo); - otherDto.setCreateBySid(createBySid); - otherDto.setCustomer(customer); - otherDto.setCustomerSid(customerSid); - otherDto.setBorrowerSid(borrowerSid); - otherDto.setBorrowerName(borrowerName); - otherDto.setPeriod(String.valueOf(i + 1)); - otherDto.setScheduleSid(scheduleDetails.getSid()); - otherDto.setBankName(bankName); - otherDto.setDept(dept); - otherDto.setDeptSid(deptSid); - otherDto.setUseOrgSid(useOrgSid); - otherDto.setUseOrgName(useOrgName); - otherDto.setOrgSidPath(orgSidPath); - otherDto.setBusVinSid(busVinSid); - otherDto.setVinNo(linkNo); - otherDto.setSalesUserSid(staffSid); - otherDto.setStaffName(staffName); - otherDto.setPolicyOrOther("1"); + List vehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); + if (!vehicles.isEmpty()) { + for (BusSalesOrderVehicle vehicle : vehicles) { + String linkNo = vehicle.getLinkNo(); + String busVinSid = vehicle.getSid(); + //主方案 + for (int i = 0; i < mainPeriod; i++) { + LoanRepaymentPlanDetailsDto mainDto = new LoanRepaymentPlanDetailsDto(); + mainDto.setSalesOrderSid(salesOrderSid); + mainDto.setLoanContractNo(loanContractNo); + mainDto.setLoanContractSid(loanContractSid); + mainDto.setPolicyName(policyName); + mainDto.setBankContractNo(bankContractNo); + mainDto.setCreateBySid(createBySid); + mainDto.setCustomer(customer); + mainDto.setCustomerSid(customerSid); + mainDto.setBorrowerSid(borrowerSid); + mainDto.setBorrowerName(borrowerName); + mainDto.setPeriod(String.valueOf(i + 1)); + mainDto.setScheduleSid(scheduleDetails.getSid()); + mainDto.setBankName(bankName); + mainDto.setDept(dept); + mainDto.setDeptSid(deptSid); + mainDto.setUseOrgSid(useOrgSid); + mainDto.setUseOrgName(useOrgName); + mainDto.setOrgSidPath(orgSidPath); + mainDto.setBusVinSid(busVinSid); + mainDto.setVinNo(linkNo); + mainDto.setSalesUserSid(staffSid); + mainDto.setStaffName(staffName); + mainDto.setPolicyOrOther("1"); + BigDecimal otherRepay = new BigDecimal(0); if (i == 0) { - otherDto.setDueMoney(otherFirstPay); + otherRepay = new BigDecimal(otherFirstPay); } else if (i == Integer.parseInt(otherPeriod) - 1) { - otherDto.setDueMoney(otherLastPay); + otherRepay = new BigDecimal(otherLastPay); + } else { + otherRepay = new BigDecimal(otherLastPay); + } + if (i == 0) { + BigDecimal mainF = new BigDecimal(mainFirstRepay); + BigDecimal add = mainF.add(otherRepay); + mainDto.setDueMoney(String.valueOf(add)); + } else if (i == mainPeriod - 1) { + BigDecimal mainL = new BigDecimal(mainLastRepay); + BigDecimal add = mainL.add(otherRepay); + mainDto.setDueMoney(String.valueOf(add)); } else { - otherDto.setDueMoney(otherMidPay); + BigDecimal mainM = new BigDecimal(mainMidRepay); + BigDecimal add = mainM.add(otherRepay); + mainDto.setDueMoney(String.valueOf(add)); } - if (!otherDays.isEmpty()) { - otherDto.setDueDate(otherDays.get(i)); + if (!mainDays.isEmpty()) { + mainDto.setDueDate(mainDays.get(i)); } - loanRepaymentPlanDetailsService.savePlanDetails(otherDto); + loanRepaymentPlanDetailsService.savePlanDetails(mainDto); } } - } } } @@ -450,6 +625,9 @@ public class LoanRepaymentScheduleService extends MybatisBaseService mainDays = returnRepayDate(mainDate, scheduleDetails.getMainPeriod()); - List otherDays = new ArrayList<>(); - String mainFirstRepay = String.valueOf(scheduleDetails.getMainFirstRepay()); - String mainMidRepay = String.valueOf(scheduleDetails.getMainMidRepay()); - String mainLastRepay = String.valueOf(scheduleDetails.getMainLastRepay()); - String otherPeriod = ""; - String otherDate = ""; - String otherFirstPay = ""; - String otherMidPay = ""; - String otherLastPay = ""; - String deptSid = ""; - String dept = ""; - String useOrgName = ""; - String useOrgSid = ""; - String orgSidPath = ""; - String bankContractNo = ""; - String customer = ""; - String customerSid = ""; - if (scheduleDetails.getIsOtherPolicy().equals("1")) { - otherPeriod = scheduleDetails.getOtherPeriod(); - otherDate = sdf.format(scheduleDetails.getOtherRepayDate()); - otherFirstPay = String.valueOf(scheduleDetails.getOtherFirstRepay()); - otherMidPay = String.valueOf(scheduleDetails.getOtherMidRepay()); - otherLastPay = String.valueOf(scheduleDetails.getOtherLastRepay()); - otherDays = returnRepayDate(otherDate, otherPeriod); - } - if (null != busSalesOrder) { - if (StringUtils.isNotBlank(busSalesOrder.getCustomerName())) { - customer = busSalesOrder.getCustomerName(); + if (scheduleDetails.getSameBank().equals("0")) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String createBySid = scheduleDetails.getCreateBySid(); + String staffSid = scheduleDetails.getStaffSid(); + String bankName = scheduleDetails.getBankName(); + String borrowerSid = scheduleDetails.getBorrowerSid(); + String borrowerName = scheduleDetails.getBorrowerName(); + String staffName = scheduleDetails.getStaffName(); + String salesOrderSid = scheduleDetails.getSalesOrderSid(); + String policyName = scheduleDetails.getPolicyName(); + String loanContractSid = scheduleDetails.getLoanContractSid(); + String loanContractNo = scheduleDetails.getLoanContractNo(); + int mainPeriod = Integer.parseInt(scheduleDetails.getMainPeriod()); + String mainDate = sdf.format(scheduleDetails.getMainRepayDate()); + List mainDays = returnRepayDate(mainDate, scheduleDetails.getMainPeriod()); + List otherDays = new ArrayList<>(); + String mainFirstRepay = String.valueOf(scheduleDetails.getMainFirstRepay()); + String mainMidRepay = String.valueOf(scheduleDetails.getMainMidRepay()); + String mainLastRepay = String.valueOf(scheduleDetails.getMainLastRepay()); + String otherPeriod = ""; + String otherDate = ""; + String otherFirstPay = ""; + String otherMidPay = ""; + String otherLastPay = ""; + String deptSid = ""; + String dept = ""; + String useOrgName = ""; + String useOrgSid = ""; + String orgSidPath = ""; + String bankContractNo = ""; + String customer = ""; + String customerSid = ""; + if (scheduleDetails.getIsOtherPolicy().equals("1")) { + otherPeriod = scheduleDetails.getOtherPeriod(); + otherDate = sdf.format(scheduleDetails.getOtherRepayDate()); + otherFirstPay = String.valueOf(scheduleDetails.getOtherFirstRepay()); + otherMidPay = String.valueOf(scheduleDetails.getOtherMidRepay()); + otherLastPay = String.valueOf(scheduleDetails.getOtherLastRepay()); + otherDays = returnRepayDate(otherDate, otherPeriod); } - if (StringUtils.isNotBlank(busSalesOrder.getCustomerSid())) { - customerSid = busSalesOrder.getCustomerSid(); + if (null != busSalesOrder) { + if (StringUtils.isNotBlank(busSalesOrder.getCustomerName())) { + customer = busSalesOrder.getCustomerName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getCustomerSid())) { + customerSid = busSalesOrder.getCustomerSid(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgSid())) { + deptSid = busSalesOrder.getOrgSid(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgName())) { + dept = busSalesOrder.getOrgName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgSidPath())) { + orgSidPath = busSalesOrder.getOrgSidPath(); + } + if (StringUtils.isNotBlank(busSalesOrder.getUseOrgName())) { + useOrgName = busSalesOrder.getUseOrgName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getUseOrgSid())) { + useOrgSid = busSalesOrder.getUseOrgSid(); + } } - if (StringUtils.isNotBlank(busSalesOrder.getOrgSid())) { - deptSid = busSalesOrder.getOrgSid(); + if (null != loancontractVo) { + if (StringUtils.isNotBlank(loancontractVo.getBankContractNo())) { + bankContractNo = loancontractVo.getBankContractNo(); + } } - if (StringUtils.isNotBlank(busSalesOrder.getOrgName())) { - dept = busSalesOrder.getOrgName(); + String otherBankNo = ""; + if (StringUtils.isNotBlank(scheduleDetails.getOtherBankNo())) { + otherBankNo = scheduleDetails.getOtherBankNo(); } - if (StringUtils.isNotBlank(busSalesOrder.getOrgSidPath())) { - orgSidPath = busSalesOrder.getOrgSidPath(); + List vehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); + if (!vehicles.isEmpty()) { + for (BusSalesOrderVehicle vehicle : vehicles) { + String linkNo = vehicle.getLinkNo(); + String busVinSid = vehicle.getSid(); + //主方案 + for (int i = 0; i < mainPeriod; i++) { + LoanRepaymentPlanDetailsDto mainDto = new LoanRepaymentPlanDetailsDto(); + mainDto.setSalesOrderSid(salesOrderSid); + mainDto.setLoanContractNo(loanContractNo); + mainDto.setLoanContractSid(loanContractSid); + mainDto.setPolicyName(policyName); + mainDto.setBankContractNo(bankContractNo); + mainDto.setCreateBySid(createBySid); + mainDto.setCustomer(customer); + mainDto.setCustomerSid(customerSid); + mainDto.setBorrowerSid(borrowerSid); + mainDto.setBorrowerName(borrowerName); + mainDto.setPeriod(String.valueOf(i + 1)); + mainDto.setScheduleSid(entity.getSid()); + mainDto.setBankName(bankName); + mainDto.setDept(dept); + mainDto.setDeptSid(deptSid); + mainDto.setUseOrgSid(useOrgSid); + mainDto.setUseOrgName(useOrgName); + mainDto.setOrgSidPath(orgSidPath); + mainDto.setBusVinSid(busVinSid); + mainDto.setVinNo(linkNo); + mainDto.setSalesUserSid(staffSid); + mainDto.setStaffName(staffName); + mainDto.setPolicyOrOther("0"); + if (i == 0) { + mainDto.setDueMoney(mainFirstRepay); + } else if (i == mainPeriod - 1) { + mainDto.setDueMoney(mainLastRepay); + } else { + mainDto.setDueMoney(mainMidRepay); + } + if (!mainDays.isEmpty()) { + mainDto.setDueDate(mainDays.get(i)); + } + loanRepaymentPlanDetailsService.savePlanDetails(mainDto); + } + //其他融 + if (scheduleDetails.getIsOtherPolicy().equals("1")) { + for (int i = 0; i < Integer.parseInt(otherPeriod); i++) { + LoanRepaymentPlanDetailsDto otherDto = new LoanRepaymentPlanDetailsDto(); + otherDto.setSalesOrderSid(salesOrderSid); + otherDto.setLoanContractNo(loanContractNo); + otherDto.setLoanContractSid(loanContractSid); + otherDto.setPolicyName(policyName); + otherDto.setBankContractNo(otherBankNo); + otherDto.setCreateBySid(createBySid); + otherDto.setCustomer(customer); + otherDto.setCustomerSid(customerSid); + otherDto.setBorrowerSid(borrowerSid); + otherDto.setBorrowerName(borrowerName); + otherDto.setPeriod(String.valueOf(i + 1)); + otherDto.setScheduleSid(entity.getSid()); + otherDto.setBankName(bankName); + otherDto.setDept(dept); + otherDto.setDeptSid(deptSid); + otherDto.setUseOrgSid(useOrgSid); + otherDto.setUseOrgName(useOrgName); + otherDto.setOrgSidPath(orgSidPath); + otherDto.setBusVinSid(busVinSid); + otherDto.setVinNo(linkNo); + otherDto.setSalesUserSid(staffSid); + otherDto.setStaffName(staffName); + otherDto.setPolicyOrOther("1"); + if (i == 0) { + otherDto.setDueMoney(otherFirstPay); + } else if (i == Integer.parseInt(otherPeriod) - 1) { + otherDto.setDueMoney(otherLastPay); + } else { + otherDto.setDueMoney(otherMidPay); + } + if (!otherDays.isEmpty()) { + otherDto.setDueDate(otherDays.get(i)); + } + loanRepaymentPlanDetailsService.savePlanDetails(otherDto); + } + } + + } } - if (StringUtils.isNotBlank(busSalesOrder.getUseOrgName())) { - useOrgName = busSalesOrder.getUseOrgName(); + } + if (scheduleDetails.getSameBank().equals("1")) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String createBySid = scheduleDetails.getCreateBySid(); + String staffSid = scheduleDetails.getStaffSid(); + String bankName = scheduleDetails.getBankName(); + String borrowerSid = scheduleDetails.getBorrowerSid(); + String borrowerName = scheduleDetails.getBorrowerName(); + String staffName = scheduleDetails.getStaffName(); + String salesOrderSid = scheduleDetails.getSalesOrderSid(); + String policyName = scheduleDetails.getPolicyName(); + String loanContractSid = scheduleDetails.getLoanContractSid(); + String loanContractNo = scheduleDetails.getLoanContractNo(); + int mainPeriod = Integer.parseInt(scheduleDetails.getMainPeriod()); + String mainDate = sdf.format(scheduleDetails.getMainRepayDate()); + List mainDays = returnRepayDate(mainDate, scheduleDetails.getMainPeriod()); + String mainFirstRepay = String.valueOf(scheduleDetails.getMainFirstRepay()); + String mainMidRepay = String.valueOf(scheduleDetails.getMainMidRepay()); + String mainLastRepay = String.valueOf(scheduleDetails.getMainLastRepay()); + String otherPeriod = ""; + String otherDate = ""; + String otherFirstPay = ""; + String otherMidPay = ""; + String otherLastPay = ""; + String deptSid = ""; + String dept = ""; + String useOrgName = ""; + String useOrgSid = ""; + String orgSidPath = ""; + String bankContractNo = ""; + String customer = ""; + String customerSid = ""; + if (scheduleDetails.getIsOtherPolicy().equals("1")) { + otherPeriod = scheduleDetails.getOtherPeriod(); + otherDate = sdf.format(scheduleDetails.getOtherRepayDate()); + otherFirstPay = String.valueOf(scheduleDetails.getOtherFirstRepay()); + otherMidPay = String.valueOf(scheduleDetails.getOtherMidRepay()); + otherLastPay = String.valueOf(scheduleDetails.getOtherLastRepay()); } - if (StringUtils.isNotBlank(busSalesOrder.getUseOrgSid())) { - useOrgSid = busSalesOrder.getUseOrgSid(); + if (null != busSalesOrder) { + if (StringUtils.isNotBlank(busSalesOrder.getCustomerName())) { + customer = busSalesOrder.getCustomerName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getCustomerSid())) { + customerSid = busSalesOrder.getCustomerSid(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgSid())) { + deptSid = busSalesOrder.getOrgSid(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgName())) { + dept = busSalesOrder.getOrgName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getOrgSidPath())) { + orgSidPath = busSalesOrder.getOrgSidPath(); + } + if (StringUtils.isNotBlank(busSalesOrder.getUseOrgName())) { + useOrgName = busSalesOrder.getUseOrgName(); + } + if (StringUtils.isNotBlank(busSalesOrder.getUseOrgSid())) { + useOrgSid = busSalesOrder.getUseOrgSid(); + } } - } - if (null != loancontractVo) { - if (StringUtils.isNotBlank(loancontractVo.getBankContractNo())) { - bankContractNo = loancontractVo.getBankContractNo(); + if (null != loancontractVo) { + if (StringUtils.isNotBlank(loancontractVo.getBankContractNo())) { + bankContractNo = loancontractVo.getBankContractNo(); + } } - } - List vehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); - if (!vehicles.isEmpty()) { - for (BusSalesOrderVehicle vehicle : vehicles) { - String linkNo = vehicle.getLinkNo(); - String busVinSid = vehicle.getSid(); - //主方案 - for (int i = 0; i < mainPeriod; i++) { - LoanRepaymentPlanDetailsDto mainDto = new LoanRepaymentPlanDetailsDto(); - mainDto.setSalesOrderSid(salesOrderSid); - mainDto.setLoanContractNo(loanContractNo); - mainDto.setLoanContractSid(loanContractSid); - mainDto.setPolicyName(policyName); - mainDto.setBankContractNo(bankContractNo); - mainDto.setCreateBySid(createBySid); - mainDto.setCustomer(customer); - mainDto.setCustomerSid(customerSid); - mainDto.setBorrowerSid(borrowerSid); - mainDto.setBorrowerName(borrowerName); - mainDto.setPeriod(String.valueOf(i + 1)); - mainDto.setScheduleSid(entity.getSid()); - mainDto.setBankName(bankName); - mainDto.setDept(dept); - mainDto.setDeptSid(deptSid); - mainDto.setUseOrgSid(useOrgSid); - mainDto.setUseOrgName(useOrgName); - mainDto.setOrgSidPath(orgSidPath); - mainDto.setBusVinSid(busVinSid); - mainDto.setVinNo(linkNo); - mainDto.setSalesUserSid(staffSid); - mainDto.setStaffName(staffName); - mainDto.setPolicyOrOther("0"); - if (i == 0) { - mainDto.setDueMoney(mainFirstRepay); - } else if (i == mainPeriod - 1) { - mainDto.setDueMoney(mainLastRepay); - } else { - mainDto.setDueMoney(mainMidRepay); - } - if (!mainDays.isEmpty()) { - mainDto.setDueDate(mainDays.get(i)); - } - loanRepaymentPlanDetailsService.savePlanDetails(mainDto); - } - //其他融 - if (scheduleDetails.getIsOtherPolicy().equals("1")) { - for (int i = 0; i < Integer.parseInt(otherPeriod); i++) { - LoanRepaymentPlanDetailsDto otherDto = new LoanRepaymentPlanDetailsDto(); - otherDto.setSalesOrderSid(salesOrderSid); - otherDto.setLoanContractNo(loanContractNo); - otherDto.setLoanContractSid(loanContractSid); - otherDto.setPolicyName(policyName); - otherDto.setBankContractNo(bankContractNo); - otherDto.setCreateBySid(createBySid); - otherDto.setCustomer(customer); - otherDto.setCustomerSid(customerSid); - otherDto.setBorrowerSid(borrowerSid); - otherDto.setBorrowerName(borrowerName); - otherDto.setPeriod(String.valueOf(i + 1)); - otherDto.setScheduleSid(entity.getSid()); - otherDto.setBankName(bankName); - otherDto.setDept(dept); - otherDto.setDeptSid(deptSid); - otherDto.setUseOrgSid(useOrgSid); - otherDto.setUseOrgName(useOrgName); - otherDto.setOrgSidPath(orgSidPath); - otherDto.setBusVinSid(busVinSid); - otherDto.setVinNo(linkNo); - otherDto.setSalesUserSid(staffSid); - otherDto.setStaffName(staffName); - otherDto.setPolicyOrOther("1"); + List vehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); + if (!vehicles.isEmpty()) { + for (BusSalesOrderVehicle vehicle : vehicles) { + String linkNo = vehicle.getLinkNo(); + String busVinSid = vehicle.getSid(); + //主方案 + for (int i = 0; i < mainPeriod; i++) { + LoanRepaymentPlanDetailsDto mainDto = new LoanRepaymentPlanDetailsDto(); + mainDto.setSalesOrderSid(salesOrderSid); + mainDto.setLoanContractNo(loanContractNo); + mainDto.setLoanContractSid(loanContractSid); + mainDto.setPolicyName(policyName); + mainDto.setBankContractNo(bankContractNo); + mainDto.setCreateBySid(createBySid); + mainDto.setCustomer(customer); + mainDto.setCustomerSid(customerSid); + mainDto.setBorrowerSid(borrowerSid); + mainDto.setBorrowerName(borrowerName); + mainDto.setPeriod(String.valueOf(i + 1)); + mainDto.setScheduleSid(entity.getSid()); + mainDto.setBankName(bankName); + mainDto.setDept(dept); + mainDto.setDeptSid(deptSid); + mainDto.setUseOrgSid(useOrgSid); + mainDto.setUseOrgName(useOrgName); + mainDto.setOrgSidPath(orgSidPath); + mainDto.setBusVinSid(busVinSid); + mainDto.setVinNo(linkNo); + mainDto.setSalesUserSid(staffSid); + mainDto.setStaffName(staffName); + mainDto.setPolicyOrOther("1"); + BigDecimal otherRepay = new BigDecimal(0); if (i == 0) { - otherDto.setDueMoney(otherFirstPay); + otherRepay = new BigDecimal(otherFirstPay); } else if (i == Integer.parseInt(otherPeriod) - 1) { - otherDto.setDueMoney(otherLastPay); + otherRepay = new BigDecimal(otherLastPay); + } else { + otherRepay = new BigDecimal(otherLastPay); + } + if (i == 0) { + BigDecimal mainF = new BigDecimal(mainFirstRepay); + BigDecimal add = mainF.add(otherRepay); + mainDto.setDueMoney(String.valueOf(add)); + } else if (i == mainPeriod - 1) { + BigDecimal mainL = new BigDecimal(mainLastRepay); + BigDecimal add = mainL.add(otherRepay); + mainDto.setDueMoney(String.valueOf(add)); } else { - otherDto.setDueMoney(otherMidPay); + BigDecimal mainM = new BigDecimal(mainMidRepay); + BigDecimal add = mainM.add(otherRepay); + mainDto.setDueMoney(String.valueOf(add)); } - if (!otherDays.isEmpty()) { - otherDto.setDueDate(otherDays.get(i)); + if (!mainDays.isEmpty()) { + mainDto.setDueDate(mainDays.get(i)); } - loanRepaymentPlanDetailsService.savePlanDetails(otherDto); + loanRepaymentPlanDetailsService.savePlanDetails(mainDto); } } - } } } @@ -935,147 +1248,266 @@ public class LoanRepaymentScheduleService extends MybatisBaseService= 10) { - vo.setMainRepayDate(day); - } else { - vo.setMainRepayDate(day.replace("0", "")); + if (schedule.getSameBank().equals("0")) { + BeanUtil.copyProperties(schedule, vo); + if (null != schedule.getMainRepayDate()) { + mainDate = sdf.format(schedule.getMainRepayDate()); } - } - //其他融月还日 - if (StringUtils.isNotBlank(otherDate)) { - String[] splitOtherDate = otherDate.split("-"); - String day = splitOtherDate[2]; - if (day.length() == 2 && Integer.parseInt(day) >= 10) { - vo.setOtherRepayDate(day); - } else { - vo.setOtherRepayDate(day.replace("0", "")); + if (null != schedule.getOtherRepayDate()) { + otherDate = sdf.format(schedule.getOtherRepayDate()); } - } - //月还金额 - if (null != schedule.getMainFirstRepay()) { - mainF = schedule.getMainFirstRepay(); - } - if (null != schedule.getMainMidRepay()) { - mainM = schedule.getMainMidRepay(); - } - if (null != schedule.getMainLastRepay()) { - mainL = schedule.getMainLastRepay(); - } - if (null != schedule.getOtherFirstRepay()) { - otherF = schedule.getOtherFirstRepay(); - } - if (null != schedule.getOtherMidRepay()) { - otherM = schedule.getOtherMidRepay(); - } - if (null != schedule.getOtherLastRepay()) { - otherL = schedule.getOtherLastRepay(); - } - //-----还款计划表列表信息------- - List scheduleVins = new ArrayList<>(); - if (StringUtils.isNotBlank(schedule.getMainPeriod())) { - int mainPeriod = Integer.parseInt(schedule.getMainPeriod()); - if (StringUtils.isNotBlank(schedule.getIsOtherPolicy())) { - isOther = schedule.getIsOtherPolicy(); - } - String otherPer = ""; - if (StringUtils.isNotBlank(schedule.getOtherPeriod())) { - otherPer = schedule.getOtherPeriod(); - } - int otherMidPer = 0; - int otherLastPer = 0; - String month = ""; - String year = ""; - String moth = ""; - String otherMoth = ""; - String otherFDate = ""; - String otherMonth = ""; + //主产品月还日 if (StringUtils.isNotBlank(mainDate)) { - String[] splitMain = mainDate.split("-"); - year = splitMain[0]; - moth = splitMain[1]; - if (moth.length() == 2 && Integer.parseInt(moth) >= 10) { - month = moth; + String[] splitMainDate = mainDate.split("-"); + String day = splitMainDate[2]; + if (day.length() == 2 && Integer.parseInt(day) >= 10) { + vo.setMainRepayDate(day); } else { - month = moth.replace("0", ""); + vo.setMainRepayDate(day.replace("0", "")); } } + //其他融月还日 if (StringUtils.isNotBlank(otherDate)) { - String[] splitOther = otherDate.split("-"); - - otherMoth = splitOther[1]; - if (otherMoth.length() == 2 && Integer.parseInt(otherMoth) >= 10) { - otherMonth = otherMoth; + String[] splitOtherDate = otherDate.split("-"); + String day = splitOtherDate[2]; + if (day.length() == 2 && Integer.parseInt(day) >= 10) { + vo.setOtherRepayDate(day); } else { - otherMonth = otherMoth.replace("0", ""); + vo.setOtherRepayDate(day.replace("0", "")); } - otherFDate = splitOther[0] + otherMonth; - } - for (int i = 1; i <= mainPeriod; i++) { - String yearMonth = year + month; - LoanCreateScheduleVinsListVo scheduleVo = new LoanCreateScheduleVinsListVo(); - scheduleVo.setRepayMonth(year + "年" + month + "月"); - scheduleVo.setPeriod(String.valueOf(i)); - int m = Integer.parseInt(month); - month = String.valueOf(++m); - if (Integer.parseInt(month) > 12) { - int y = Integer.parseInt(year); - year = String.valueOf(++y); - month = "1"; + } + //月还金额 + if (null != schedule.getMainFirstRepay()) { + mainF = schedule.getMainFirstRepay(); + } + if (null != schedule.getMainMidRepay()) { + mainM = schedule.getMainMidRepay(); + } + if (null != schedule.getMainLastRepay()) { + mainL = schedule.getMainLastRepay(); + } + if (null != schedule.getOtherFirstRepay()) { + otherF = schedule.getOtherFirstRepay(); + } + if (null != schedule.getOtherMidRepay()) { + otherM = schedule.getOtherMidRepay(); + } + if (null != schedule.getOtherLastRepay()) { + otherL = schedule.getOtherLastRepay(); + } + //-----还款计划表列表信息------- + List scheduleVins = new ArrayList<>(); + if (StringUtils.isNotBlank(schedule.getMainPeriod())) { + int mainPeriod = Integer.parseInt(schedule.getMainPeriod()); + if (StringUtils.isNotBlank(schedule.getIsOtherPolicy())) { + isOther = schedule.getIsOtherPolicy(); + } + String otherPer = ""; + if (StringUtils.isNotBlank(schedule.getOtherPeriod())) { + otherPer = schedule.getOtherPeriod(); } - if (isOther.equals("1")) { - //首期 - if (i == 1) { - scheduleVo.setMainRepay(mainF.toString()); - } else if (i == mainPeriod) { - scheduleVo.setMainRepay(mainL.toString()); + int otherMidPer = 0; + int otherLastPer = 0; + String month = ""; + String year = ""; + String moth = ""; + String otherMoth = ""; + String otherFDate = ""; + String otherMonth = ""; + if (StringUtils.isNotBlank(mainDate)) { + String[] splitMain = mainDate.split("-"); + year = splitMain[0]; + moth = splitMain[1]; + if (moth.length() == 2 && Integer.parseInt(moth) >= 10) { + month = moth; } else { - scheduleVo.setMainRepay(mainM.toString()); - } - if ((yearMonth.equals(otherFDate))) { - scheduleVo.setOtherRepay(otherF.toString()); - scheduleVo.setAmount((new BigDecimal(scheduleVo.getMainRepay()).add(otherF)).toString()); - otherMidPer = (i + Integer.parseInt(otherPer)) - 2; - otherLastPer = (i + Integer.parseInt(otherPer)) - 1; - } else if (i <= otherMidPer && otherMidPer != 0) { - scheduleVo.setOtherRepay(otherM.toString()); - scheduleVo.setAmount((new BigDecimal(scheduleVo.getMainRepay()).add(otherM)).toString()); - } else if (i == otherLastPer && otherLastPer != 0) { - scheduleVo.setOtherRepay(otherL.toString()); - scheduleVo.setAmount((new BigDecimal(scheduleVo.getMainRepay()).add(otherL)).toString()); - } else if (scheduleVo.getOtherRepay() == null || "".equals(scheduleVo.getOtherRepay())) { - scheduleVo.setAmount(scheduleVo.getMainRepay()); - scheduleVo.setOtherRepay(""); - } - } else if (isOther.equals("0")) { - //首期 - if (i == 1) { - scheduleVo.setMainRepay(mainF.toString()); - } else if (i == mainPeriod) { - scheduleVo.setMainRepay(mainL.toString()); + month = moth.replace("0", ""); + } + } + if (StringUtils.isNotBlank(otherDate)) { + String[] splitOther = otherDate.split("-"); + + otherMoth = splitOther[1]; + if (otherMoth.length() == 2 && Integer.parseInt(otherMoth) >= 10) { + otherMonth = otherMoth; } else { - scheduleVo.setMainRepay(mainM.toString()); + otherMonth = otherMoth.replace("0", ""); } - if (scheduleVo.getOtherRepay() == null || "".equals(scheduleVo.getOtherRepay())) { - scheduleVo.setAmount(scheduleVo.getMainRepay()); - scheduleVo.setOtherRepay(""); + otherFDate = splitOther[0] + otherMonth; + } + for (int i = 1; i <= mainPeriod; i++) { + String yearMonth = year + month; + LoanCreateScheduleVinsListVo scheduleVo = new LoanCreateScheduleVinsListVo(); + scheduleVo.setRepayMonth(year + "年" + month + "月"); + scheduleVo.setPeriod(String.valueOf(i)); + int m = Integer.parseInt(month); + month = String.valueOf(++m); + if (Integer.parseInt(month) > 12) { + int y = Integer.parseInt(year); + year = String.valueOf(++y); + month = "1"; + } + if (isOther.equals("1")) { + //首期 + if (i == 1) { + scheduleVo.setMainRepay(mainF.toString()); + } else if (i == mainPeriod) { + scheduleVo.setMainRepay(mainL.toString()); + } else { + scheduleVo.setMainRepay(mainM.toString()); + } + if ((yearMonth.equals(otherFDate))) { + scheduleVo.setOtherRepay(otherF.toString()); + scheduleVo.setAmount((new BigDecimal(scheduleVo.getMainRepay()).add(otherF)).toString()); + otherMidPer = (i + Integer.parseInt(otherPer)) - 2; + otherLastPer = (i + Integer.parseInt(otherPer)) - 1; + } else if (i <= otherMidPer && otherMidPer != 0) { + scheduleVo.setOtherRepay(otherM.toString()); + scheduleVo.setAmount((new BigDecimal(scheduleVo.getMainRepay()).add(otherM)).toString()); + } else if (i == otherLastPer && otherLastPer != 0) { + scheduleVo.setOtherRepay(otherL.toString()); + scheduleVo.setAmount((new BigDecimal(scheduleVo.getMainRepay()).add(otherL)).toString()); + } else if (scheduleVo.getOtherRepay() == null || "".equals(scheduleVo.getOtherRepay())) { + scheduleVo.setAmount(scheduleVo.getMainRepay()); + scheduleVo.setOtherRepay(""); + } + } else if (isOther.equals("0")) { + //首期 + if (i == 1) { + scheduleVo.setMainRepay(mainF.toString()); + } else if (i == mainPeriod) { + scheduleVo.setMainRepay(mainL.toString()); + } else { + scheduleVo.setMainRepay(mainM.toString()); + } + if (scheduleVo.getOtherRepay() == null || "".equals(scheduleVo.getOtherRepay())) { + scheduleVo.setAmount(scheduleVo.getMainRepay()); + scheduleVo.setOtherRepay(""); + } } + scheduleVins.add(scheduleVo); + } + if (!scheduleVins.isEmpty()) { + vo.setScheduleVins(scheduleVins); + } + } + } + if (schedule.getSameBank().equals("1")) { + if (null != schedule.getMainRepayDate()) { + mainDate = sdf.format(schedule.getMainRepayDate()); + } + if (null != schedule.getOtherRepayDate()) { + otherDate = sdf.format(schedule.getOtherRepayDate()); + } + //主产品月还日 + if (StringUtils.isNotBlank(mainDate)) { + String[] splitMainDate = mainDate.split("-"); + String day = splitMainDate[2]; + if (day.length() == 2 && Integer.parseInt(day) >= 10) { + vo.setMainRepayDate(day); + } else { + vo.setMainRepayDate(day.replace("0", "")); } - scheduleVins.add(scheduleVo); } - if (!scheduleVins.isEmpty()) { - vo.setScheduleVins(scheduleVins); + //月还金额 + if (null != schedule.getMainFirstRepay()) { + mainF = schedule.getMainFirstRepay(); + } + if (null != schedule.getMainMidRepay()) { + mainM = schedule.getMainMidRepay(); + } + if (null != schedule.getMainLastRepay()) { + mainL = schedule.getMainLastRepay(); + } + if (null != schedule.getOtherFirstRepay()) { + otherF = schedule.getOtherFirstRepay(); + } + if (null != schedule.getOtherMidRepay()) { + otherM = schedule.getOtherMidRepay(); + } + if (null != schedule.getOtherLastRepay()) { + otherL = schedule.getOtherLastRepay(); + } + //-----还款计划表列表信息------- + List scheduleVins = new ArrayList<>(); + if (StringUtils.isNotBlank(schedule.getMainPeriod())) { + int mainPeriod = Integer.parseInt(schedule.getMainPeriod()); + if (StringUtils.isNotBlank(schedule.getIsOtherPolicy())) { + isOther = schedule.getIsOtherPolicy(); + } + String otherPer = ""; + if (StringUtils.isNotBlank(schedule.getOtherPeriod())) { + otherPer = schedule.getOtherPeriod(); + } + int otherMidPer = 0; + int otherLastPer = 0; + String month = ""; + String year = ""; + String moth = ""; + String otherMoth = ""; + String otherFDate = ""; + String otherMonth = ""; + if (StringUtils.isNotBlank(mainDate)) { + String[] splitMain = mainDate.split("-"); + year = splitMain[0]; + moth = splitMain[1]; + if (moth.length() == 2 && Integer.parseInt(moth) >= 10) { + month = moth; + } else { + month = moth.replace("0", ""); + } + } + if (StringUtils.isNotBlank(otherDate)) { + String[] splitOther = otherDate.split("-"); + + otherMoth = splitOther[1]; + if (otherMoth.length() == 2 && Integer.parseInt(otherMoth) >= 10) { + otherMonth = otherMoth; + } else { + otherMonth = otherMoth.replace("0", ""); + } + otherFDate = splitOther[0] + otherMonth; + } + for (int i = 1; i <= mainPeriod; i++) { + String yearMonth = year + month; + LoanCreateScheduleVinsListVo scheduleVo = new LoanCreateScheduleVinsListVo(); + scheduleVo.setRepayMonth(year + "年" + month + "月"); + scheduleVo.setPeriod(String.valueOf(i)); + int m = Integer.parseInt(month); + month = String.valueOf(++m); + if (Integer.parseInt(month) > 12) { + int y = Integer.parseInt(year); + year = String.valueOf(++y); + month = "1"; + } + if (isOther.equals("1")) { + BigDecimal otherRepay = new BigDecimal(0); + if (i == 1) { + otherRepay = otherF; + } else if (i == Integer.parseInt(otherPer)) { + otherRepay = otherL; + } else { + otherRepay = otherM; + } + //首期 + if (i == 1) { + BigDecimal add = mainF.add(otherRepay); + scheduleVo.setMainRepay(add.toString()); + } else if (i == mainPeriod) { + BigDecimal add = mainL.add(otherRepay); + scheduleVo.setMainRepay(add.toString()); + } else { + BigDecimal add = mainM.add(otherRepay); + scheduleVo.setMainRepay(add.toString()); + } + } + scheduleVins.add(scheduleVo); + } + if (!scheduleVins.isEmpty()) { + vo.setScheduleVins(scheduleVins); + } } + vo.setIsOtherPolicy("0"); } } vo.setSalesOrderSid(salesOrderSid); @@ -1219,172 +1651,329 @@ public class LoanRepaymentScheduleService extends MybatisBaseService stringList = Arrays.asList(schedule.getVinNo().split(",")); - vo.setVinNo(stringList); - } - if (StringUtils.isNotBlank(schedule.getBankName())) { - vo.setManagement(schedule.getBankName()); - } - if (StringUtils.isNotBlank(schedule.getPolicyName())) { - vo.setFinancial(schedule.getPolicyName()); - } - if (StringUtils.isNotBlank(schedule.getStaffName())) { - vo.setSalesName(schedule.getStaffName()); - } - if (null != schedule.getMainRepayDate()) { - mainDate = sdf.format(schedule.getMainRepayDate()); - } - if (null != schedule.getOtherRepayDate()) { - otherDate = sdf.format(schedule.getOtherRepayDate()); - } - String mainRepayDate = ""; - String otherRepayDate = ""; - //主产品月还日 - if (StringUtils.isNotBlank(mainDate)) { - String[] splitMainDate = mainDate.split("-"); - String day = splitMainDate[2]; - if (day.length() == 2 && Integer.parseInt(day) >= 10) { - mainRepayDate = day; - } else { - mainRepayDate = day.replace("0", ""); + if (schedule.getSameBank().equals("0")) { + vo.setSid(sid); + if (StringUtils.isNotBlank(schedule.getLoanContractNo())) { + vo.setContractId(schedule.getLoanContractNo()); } - } - //其他融月还日 - if (StringUtils.isNotBlank(otherDate)) { - String[] splitOtherDate = otherDate.split("-"); - String day = splitOtherDate[2]; - if (day.length() == 2 && Integer.parseInt(day) >= 10) { - otherRepayDate = day; - } else { - otherRepayDate = day.replace("0", ""); + if (StringUtils.isNotBlank(schedule.getBorrowerName())) { + vo.setLenderName(schedule.getBorrowerName()); } - } - //月还金额 - if (null != schedule.getMainFirstRepay()) { - mainF = schedule.getMainFirstRepay(); - } - if (null != schedule.getMainMidRepay()) { - mainM = schedule.getMainMidRepay(); - } - if (null != schedule.getMainLastRepay()) { - mainL = schedule.getMainLastRepay(); - } - if (null != schedule.getOtherFirstRepay()) { - otherF = schedule.getOtherFirstRepay(); - } - if (null != schedule.getOtherMidRepay()) { - otherM = schedule.getOtherMidRepay(); - } - if (null != schedule.getOtherLastRepay()) { - otherL = schedule.getOtherLastRepay(); - } - //-----还款计划表列表信息------- - List scheduleVins = new ArrayList<>(); - if (StringUtils.isNotBlank(schedule.getMainPeriod())) { - int mainPeriod = Integer.parseInt(schedule.getMainPeriod()); - if (StringUtils.isNotBlank(schedule.getIsOtherPolicy())) { - isOther = schedule.getIsOtherPolicy(); - } - String otherPer = ""; - if (StringUtils.isNotBlank(schedule.getOtherPeriod())) { - otherPer = schedule.getOtherPeriod(); - } - int otherMidPer = 0; - int otherLastPer = 0; - String month = ""; - String year = ""; - String moth = ""; - String otherMoth = ""; - String otherFDate = ""; - String otherMonth = ""; + if (StringUtils.isNotBlank(schedule.getVehCount())) { + vo.setCarNumber(schedule.getVehCount()); + } + if (StringUtils.isNotBlank(schedule.getVinNo())) { + List stringList = Arrays.asList(schedule.getVinNo().split(",")); + vo.setVinNo(stringList); + } + if (StringUtils.isNotBlank(schedule.getBankName())) { + vo.setManagement(schedule.getBankName()); + } + if (StringUtils.isNotBlank(schedule.getPolicyName())) { + vo.setFinancial(schedule.getPolicyName()); + } + if (StringUtils.isNotBlank(schedule.getStaffName())) { + vo.setSalesName(schedule.getStaffName()); + } + if (null != schedule.getMainRepayDate()) { + mainDate = sdf.format(schedule.getMainRepayDate()); + } + if (null != schedule.getOtherRepayDate()) { + otherDate = sdf.format(schedule.getOtherRepayDate()); + } + String mainRepayDate = ""; + String otherRepayDate = ""; + //主产品月还日 if (StringUtils.isNotBlank(mainDate)) { - String[] splitMain = mainDate.split("-"); - year = splitMain[0]; - moth = splitMain[1]; - if (moth.length() == 2 && Integer.parseInt(moth) >= 10) { - month = moth; + String[] splitMainDate = mainDate.split("-"); + String day = splitMainDate[2]; + if (day.length() == 2 && Integer.parseInt(day) >= 10) { + mainRepayDate = day; } else { - month = moth.replace("0", ""); + mainRepayDate = day.replace("0", ""); } } + //其他融月还日 if (StringUtils.isNotBlank(otherDate)) { - String[] splitOther = otherDate.split("-"); - - otherMoth = splitOther[1]; - if (otherMoth.length() == 2 && Integer.parseInt(otherMoth) >= 10) { - otherMonth = otherMoth; + String[] splitOtherDate = otherDate.split("-"); + String day = splitOtherDate[2]; + if (day.length() == 2 && Integer.parseInt(day) >= 10) { + otherRepayDate = day; } else { - otherMonth = otherMoth.replace("0", ""); + otherRepayDate = day.replace("0", ""); + } + } + //月还金额 + if (null != schedule.getMainFirstRepay()) { + mainF = schedule.getMainFirstRepay(); + } + if (null != schedule.getMainMidRepay()) { + mainM = schedule.getMainMidRepay(); + } + if (null != schedule.getMainLastRepay()) { + mainL = schedule.getMainLastRepay(); + } + if (null != schedule.getOtherFirstRepay()) { + otherF = schedule.getOtherFirstRepay(); + } + if (null != schedule.getOtherMidRepay()) { + otherM = schedule.getOtherMidRepay(); + } + if (null != schedule.getOtherLastRepay()) { + otherL = schedule.getOtherLastRepay(); + } + //-----还款计划表列表信息------- + List scheduleVins = new ArrayList<>(); + if (StringUtils.isNotBlank(schedule.getMainPeriod())) { + int mainPeriod = Integer.parseInt(schedule.getMainPeriod()); + if (StringUtils.isNotBlank(schedule.getIsOtherPolicy())) { + isOther = schedule.getIsOtherPolicy(); } - otherFDate = splitOther[0] + otherMonth; - } - for (int i = 1; i <= mainPeriod; i++) { - String yearMonth = year + month; - AppRepaymentPlanListDetailsVo scheduleVo = new AppRepaymentPlanListDetailsVo(); - scheduleVo.setTimes(mainRepayDate); - scheduleVo.setOtherTimes(otherRepayDate); - scheduleVo.setMonth(year + "年" + month + "月"); - scheduleVo.setNumber(String.valueOf(i)); - int m = Integer.parseInt(month); - month = String.valueOf(++m); - if (Integer.parseInt(month) > 12) { - int y = Integer.parseInt(year); - year = String.valueOf(++y); - month = "1"; + String otherPer = ""; + if (StringUtils.isNotBlank(schedule.getOtherPeriod())) { + otherPer = schedule.getOtherPeriod(); } - if (isOther.equals("1")) { - //首期 - if (i == 1) { - scheduleVo.setMonthlyPayment(mainF.toString()); - } else if (i == mainPeriod) { - scheduleVo.setMonthlyPayment(mainL.toString()); + int otherMidPer = 0; + int otherLastPer = 0; + String month = ""; + String year = ""; + String moth = ""; + String otherMoth = ""; + String otherFDate = ""; + String otherMonth = ""; + if (StringUtils.isNotBlank(mainDate)) { + String[] splitMain = mainDate.split("-"); + year = splitMain[0]; + moth = splitMain[1]; + if (moth.length() == 2 && Integer.parseInt(moth) >= 10) { + month = moth; } else { - scheduleVo.setMonthlyPayment(mainM.toString()); - } - if ((yearMonth.equals(otherFDate))) { - scheduleVo.setOtherMonthlyPayment(otherF.toString()); - scheduleVo.setTotal((new BigDecimal(scheduleVo.getMonthlyPayment()).add(otherF)).toString()); - otherMidPer = (i + Integer.parseInt(otherPer)) - 2; - otherLastPer = (i + Integer.parseInt(otherPer)) - 1; - } else if (i <= otherMidPer && otherMidPer != 0) { - scheduleVo.setOtherMonthlyPayment(otherM.toString()); - scheduleVo.setTotal((new BigDecimal(scheduleVo.getMonthlyPayment()).add(otherM)).toString()); - } else if (i == otherLastPer && otherLastPer != 0) { - scheduleVo.setOtherMonthlyPayment(otherL.toString()); - scheduleVo.setTotal((new BigDecimal(scheduleVo.getMonthlyPayment()).add(otherL)).toString()); - } else if (scheduleVo.getOtherMonthlyPayment() == null || "".equals(scheduleVo.getOtherMonthlyPayment())) { - scheduleVo.setTotal(scheduleVo.getMonthlyPayment()); - scheduleVo.setOtherMonthlyPayment(""); - } - } else if (isOther.equals("0")) { - //首期 - if (i == 1) { - scheduleVo.setMonthlyPayment(mainF.toString()); - } else if (i == mainPeriod) { - scheduleVo.setMonthlyPayment(mainL.toString()); + month = moth.replace("0", ""); + } + } + if (StringUtils.isNotBlank(otherDate)) { + String[] splitOther = otherDate.split("-"); + + otherMoth = splitOther[1]; + if (otherMoth.length() == 2 && Integer.parseInt(otherMoth) >= 10) { + otherMonth = otherMoth; } else { - scheduleVo.setMonthlyPayment(mainM.toString()); + otherMonth = otherMoth.replace("0", ""); } - if (scheduleVo.getOtherMonthlyPayment() == null || "".equals(scheduleVo.getOtherMonthlyPayment())) { - scheduleVo.setTotal(scheduleVo.getMonthlyPayment()); - scheduleVo.setOtherMonthlyPayment(""); + otherFDate = splitOther[0] + otherMonth; + } + for (int i = 1; i <= mainPeriod; i++) { + String yearMonth = year + month; + AppRepaymentPlanListDetailsVo scheduleVo = new AppRepaymentPlanListDetailsVo(); + scheduleVo.setTimes(mainRepayDate); + scheduleVo.setOtherTimes(otherRepayDate); + scheduleVo.setMonth(year + "年" + month + "月"); + scheduleVo.setNumber(String.valueOf(i)); + int m = Integer.parseInt(month); + month = String.valueOf(++m); + if (Integer.parseInt(month) > 12) { + int y = Integer.parseInt(year); + year = String.valueOf(++y); + month = "1"; } + if (isOther.equals("1")) { + //首期 + if (i == 1) { + scheduleVo.setMonthlyPayment(mainF.toString()); + } else if (i == mainPeriod) { + scheduleVo.setMonthlyPayment(mainL.toString()); + } else { + scheduleVo.setMonthlyPayment(mainM.toString()); + } + if ((yearMonth.equals(otherFDate))) { + scheduleVo.setOtherMonthlyPayment(otherF.toString()); + scheduleVo.setTotal((new BigDecimal(scheduleVo.getMonthlyPayment()).add(otherF)).toString()); + otherMidPer = (i + Integer.parseInt(otherPer)) - 2; + otherLastPer = (i + Integer.parseInt(otherPer)) - 1; + } else if (i <= otherMidPer && otherMidPer != 0) { + scheduleVo.setOtherMonthlyPayment(otherM.toString()); + scheduleVo.setTotal((new BigDecimal(scheduleVo.getMonthlyPayment()).add(otherM)).toString()); + } else if (i == otherLastPer && otherLastPer != 0) { + scheduleVo.setOtherMonthlyPayment(otherL.toString()); + scheduleVo.setTotal((new BigDecimal(scheduleVo.getMonthlyPayment()).add(otherL)).toString()); + } else if (scheduleVo.getOtherMonthlyPayment() == null || "".equals(scheduleVo.getOtherMonthlyPayment())) { + scheduleVo.setTotal(scheduleVo.getMonthlyPayment()); + scheduleVo.setOtherMonthlyPayment(""); + } + } else if (isOther.equals("0")) { + //首期 + if (i == 1) { + scheduleVo.setMonthlyPayment(mainF.toString()); + } else if (i == mainPeriod) { + scheduleVo.setMonthlyPayment(mainL.toString()); + } else { + scheduleVo.setMonthlyPayment(mainM.toString()); + } + if (scheduleVo.getOtherMonthlyPayment() == null || "".equals(scheduleVo.getOtherMonthlyPayment())) { + scheduleVo.setTotal(scheduleVo.getMonthlyPayment()); + scheduleVo.setOtherMonthlyPayment(""); + } + } + scheduleVins.add(scheduleVo); + } + if (!scheduleVins.isEmpty()) { + vo.setRecords(scheduleVins); + } + } + } + if (schedule.getSameBank().equals("1")) { + vo.setSid(sid); + if (StringUtils.isNotBlank(schedule.getLoanContractNo())) { + vo.setContractId(schedule.getLoanContractNo()); + } + if (StringUtils.isNotBlank(schedule.getBorrowerName())) { + vo.setLenderName(schedule.getBorrowerName()); + } + if (StringUtils.isNotBlank(schedule.getVehCount())) { + vo.setCarNumber(schedule.getVehCount()); + } + if (StringUtils.isNotBlank(schedule.getVinNo())) { + List stringList = Arrays.asList(schedule.getVinNo().split(",")); + vo.setVinNo(stringList); + } + if (StringUtils.isNotBlank(schedule.getBankName())) { + vo.setManagement(schedule.getBankName()); + } + if (StringUtils.isNotBlank(schedule.getPolicyName())) { + vo.setFinancial(schedule.getPolicyName()); + } + if (StringUtils.isNotBlank(schedule.getStaffName())) { + vo.setSalesName(schedule.getStaffName()); + } + if (null != schedule.getMainRepayDate()) { + mainDate = sdf.format(schedule.getMainRepayDate()); + } + if (null != schedule.getOtherRepayDate()) { + otherDate = sdf.format(schedule.getOtherRepayDate()); + } + String mainRepayDate = ""; + String otherRepayDate = ""; + //主产品月还日 + if (StringUtils.isNotBlank(mainDate)) { + String[] splitMainDate = mainDate.split("-"); + String day = splitMainDate[2]; + if (day.length() == 2 && Integer.parseInt(day) >= 10) { + mainRepayDate = day; + } else { + mainRepayDate = day.replace("0", ""); + } + } + //其他融月还日 + if (StringUtils.isNotBlank(otherDate)) { + String[] splitOtherDate = otherDate.split("-"); + String day = splitOtherDate[2]; + if (day.length() == 2 && Integer.parseInt(day) >= 10) { + otherRepayDate = day; + } else { + otherRepayDate = day.replace("0", ""); } - scheduleVins.add(scheduleVo); } - if (!scheduleVins.isEmpty()) { - vo.setRecords(scheduleVins); + //月还金额 + if (null != schedule.getMainFirstRepay()) { + mainF = schedule.getMainFirstRepay(); + } + if (null != schedule.getMainMidRepay()) { + mainM = schedule.getMainMidRepay(); + } + if (null != schedule.getMainLastRepay()) { + mainL = schedule.getMainLastRepay(); + } + if (null != schedule.getOtherFirstRepay()) { + otherF = schedule.getOtherFirstRepay(); + } + if (null != schedule.getOtherMidRepay()) { + otherM = schedule.getOtherMidRepay(); + } + if (null != schedule.getOtherLastRepay()) { + otherL = schedule.getOtherLastRepay(); + } + //-----还款计划表列表信息------- + List scheduleVins = new ArrayList<>(); + if (StringUtils.isNotBlank(schedule.getMainPeriod())) { + int mainPeriod = Integer.parseInt(schedule.getMainPeriod()); + if (StringUtils.isNotBlank(schedule.getIsOtherPolicy())) { + isOther = schedule.getIsOtherPolicy(); + } + String otherPer = ""; + if (StringUtils.isNotBlank(schedule.getOtherPeriod())) { + otherPer = schedule.getOtherPeriod(); + } + int otherMidPer = 0; + int otherLastPer = 0; + String month = ""; + String year = ""; + String moth = ""; + String otherMoth = ""; + String otherFDate = ""; + String otherMonth = ""; + if (StringUtils.isNotBlank(mainDate)) { + String[] splitMain = mainDate.split("-"); + year = splitMain[0]; + moth = splitMain[1]; + if (moth.length() == 2 && Integer.parseInt(moth) >= 10) { + month = moth; + } else { + month = moth.replace("0", ""); + } + } + if (StringUtils.isNotBlank(otherDate)) { + String[] splitOther = otherDate.split("-"); + + otherMoth = splitOther[1]; + if (otherMoth.length() == 2 && Integer.parseInt(otherMoth) >= 10) { + otherMonth = otherMoth; + } else { + otherMonth = otherMoth.replace("0", ""); + } + otherFDate = splitOther[0] + otherMonth; + } + for (int i = 1; i <= mainPeriod; i++) { + String yearMonth = year + month; + AppRepaymentPlanListDetailsVo scheduleVo = new AppRepaymentPlanListDetailsVo(); + scheduleVo.setTimes(mainRepayDate); + scheduleVo.setMonth(year + "年" + month + "月"); + scheduleVo.setNumber(String.valueOf(i)); + int m = Integer.parseInt(month); + month = String.valueOf(++m); + if (Integer.parseInt(month) > 12) { + int y = Integer.parseInt(year); + year = String.valueOf(++y); + month = "1"; + } + if (isOther.equals("1")) { + BigDecimal otherRepay = new BigDecimal(0); + if (i == 1) { + otherRepay = otherF; + } else if (i == Integer.parseInt(otherPer)) { + otherRepay = otherL; + } else { + otherRepay = otherM; + } + //首期 + if (i == 1) { + BigDecimal add = mainF.add(otherRepay); + scheduleVo.setMonthlyPayment(add.toString()); + scheduleVo.setTotal(add.toString()); + } else if (i == mainPeriod) { + BigDecimal add = mainL.add(otherRepay); + scheduleVo.setMonthlyPayment(add.toString()); + scheduleVo.setTotal(add.toString()); + } else { + BigDecimal add = mainM.add(otherRepay); + scheduleVo.setMonthlyPayment(add.toString()); + scheduleVo.setTotal(add.toString()); + } + } + scheduleVins.add(scheduleVo); + } + if (!scheduleVins.isEmpty()) { + vo.setRecords(scheduleVins); + } } } } diff --git a/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/BuckleFeign.java b/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/BuckleFeign.java index d987b6e21c..dcaf91b209 100644 --- a/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/BuckleFeign.java +++ b/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/BuckleFeign.java @@ -1,6 +1,7 @@ package com.yxt.anrui.terminal.api.risk.buckle; +import com.yxt.anrui.terminal.api.risk.buckle.flow.AppBuckleDelegateQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.AppBuckleTaskQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.BuckleFlowableQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.CompleteBuckleDto; @@ -64,8 +65,8 @@ public interface BuckleFeign { @ResponseBody ResultBean getFlowOperateTitle(@Valid @SpringQueryMap BuckleFlowableQuery query); -// @ApiOperation(value = "加签") -// @PutMapping(value = "/delegate") -// @ResponseBody -// public ResultBean delegate(@RequestBody AppCustomerRecordDelegateQuery delegateQuery); + @ApiOperation(value = "加签") + @PutMapping(value = "/delegate") + @ResponseBody + public ResultBean delegate(@RequestBody AppBuckleDelegateQuery delegateQuery); } diff --git a/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/BuckleFeignFallback.java b/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/BuckleFeignFallback.java index c332c09702..770ef96f69 100644 --- a/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/BuckleFeignFallback.java +++ b/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/BuckleFeignFallback.java @@ -1,5 +1,6 @@ package com.yxt.anrui.terminal.api.risk.buckle; +import com.yxt.anrui.terminal.api.risk.buckle.flow.AppBuckleDelegateQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.AppBuckleTaskQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.BuckleFlowableQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.CompleteBuckleDto; @@ -49,4 +50,9 @@ public class BuckleFeignFallback implements BuckleFeign { public ResultBean getFlowOperateTitle(BuckleFlowableQuery query) { return null; } + + @Override + public ResultBean delegate(AppBuckleDelegateQuery delegateQuery) { + return null; + } } diff --git a/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/RecordVo.java b/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/RecordVo.java index 72b6052ced..ba9f65a58e 100644 --- a/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/RecordVo.java +++ b/anrui-terminal/anrui-terminal-api/src/main/java/com/yxt/anrui/terminal/api/risk/buckle/RecordVo.java @@ -17,7 +17,7 @@ public class RecordVo { private String zfNo; private String cusName; private String loanName; - private String repaymentDate; + // private String repaymentDate; private String info1; private String info2; } diff --git a/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/risk/buckle/BuckleRest.java b/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/risk/buckle/BuckleRest.java index f31cbbe243..4c501f4da9 100644 --- a/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/risk/buckle/BuckleRest.java +++ b/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/risk/buckle/BuckleRest.java @@ -3,6 +3,7 @@ package com.yxt.anrui.terminal.biz.risk.buckle; import com.yxt.anrui.terminal.api.risk.buckle.BuckleDetailsVo; import com.yxt.anrui.terminal.api.risk.buckle.BuckleFeign; +import com.yxt.anrui.terminal.api.risk.buckle.flow.AppBuckleDelegateQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.AppBuckleTaskQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.BuckleFlowableQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.CompleteBuckleDto; @@ -59,4 +60,9 @@ public class BuckleRest implements BuckleFeign { public ResultBean getFlowOperateTitle(BuckleFlowableQuery query) { return buckleService.getFlowOperateTitle(query); } + + @Override + public ResultBean delegate(AppBuckleDelegateQuery delegateQuery) { + return buckleService.delegate(delegateQuery); + } } diff --git a/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/risk/buckle/BuckleService.java b/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/risk/buckle/BuckleService.java index 16b5f0bec9..8056deea90 100644 --- a/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/risk/buckle/BuckleService.java +++ b/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/risk/buckle/BuckleService.java @@ -8,16 +8,14 @@ import com.yxt.anrui.portal.api.sysuser.SysUserFeign; import com.yxt.anrui.portal.api.sysuser.SysUserVo; import com.yxt.anrui.riskcenter.api.loanbuckleapply.LoanBuckleApplyFeign; import com.yxt.anrui.riskcenter.api.loanbuckleapply.app.AppBuckleDetailsVo; -import com.yxt.anrui.riskcenter.api.loanbuckleapply.flow.BuckleCompleteDto; -import com.yxt.anrui.riskcenter.api.loanbuckleapply.flow.BuckleGetNodeQuery; -import com.yxt.anrui.riskcenter.api.loanbuckleapply.flow.BuckleGetNodeVo; -import com.yxt.anrui.riskcenter.api.loanbuckleapply.flow.BuckleTaskQuery; +import com.yxt.anrui.riskcenter.api.loanbuckleapply.flow.*; import com.yxt.anrui.riskcenter.api.loancustomerrecord.LoanCustomerRecordFeign; import com.yxt.anrui.riskcenter.api.loancustomerrecord.app.*; import com.yxt.anrui.riskcenter.api.loancustomerrecord.flow.CustomerRecordCompleteDto; import com.yxt.anrui.riskcenter.api.loancustomerrecord.flow.CustomerRecordDelegateQuery; import com.yxt.anrui.riskcenter.api.loancustomerrecord.flow.CustomerRecordTaskQuery; import com.yxt.anrui.terminal.api.risk.buckle.BuckleDetailsVo; +import com.yxt.anrui.terminal.api.risk.buckle.flow.AppBuckleDelegateQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.AppBuckleTaskQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.BuckleFlowableQuery; import com.yxt.anrui.terminal.api.risk.buckle.flow.CompleteBuckleDto; @@ -149,15 +147,13 @@ public class BuckleService { } return rb.success().setData(data); } -// -// public ResultBean delegate(AppCustomerRecordDelegateQuery delegateQuery) { -// ResultBean rb = ResultBean.fireFail(); -// CustomerRecordDelegateQuery delegateQuery1 = new -// CustomerRecordDelegateQuery(); -// BeanUtil.copyProperties(delegateQuery, delegateQuery1); -// ResultBean delegate = loanCustomerRecordFeign.delegate(delegateQuery1); -// return rb.success(); -// } - + public ResultBean delegate(AppBuckleDelegateQuery delegateQuery) { + ResultBean rb = ResultBean.fireFail(); + BuckleDelegateQuery delegateQuery1 = new + BuckleDelegateQuery(); + BeanUtil.copyProperties(delegateQuery, delegateQuery1); + ResultBean delegate = loanBuckleApplyFeign.delegate(delegateQuery1); + return rb.success(); + } }