diff --git a/intc-modules/intc-invest/src/main/java/com/intc/invest/service/impl/InstallmentHistoryDetailServiceImpl.java b/intc-modules/intc-invest/src/main/java/com/intc/invest/service/impl/InstallmentHistoryDetailServiceImpl.java index aaf9a6c..2e5229e 100644 --- a/intc-modules/intc-invest/src/main/java/com/intc/invest/service/impl/InstallmentHistoryDetailServiceImpl.java +++ b/intc-modules/intc-invest/src/main/java/com/intc/invest/service/impl/InstallmentHistoryDetailServiceImpl.java @@ -184,7 +184,7 @@ public class InstallmentHistoryDetailServiceImpl implements IInstallmentHistoryD transferRecord.setAmount(installmentHistoryDetail.getPrincipal()); transferRecord.setCommission(installmentHistoryDetail.getInterest()); transferRecord.setId(IdWorker.getId()); - transferRecord.setCreateTime(new Date()); + transferRecord.setCreateTime(installmentHistoryDetail.getRepaymentDate()); //借贷 transferRecord.setType("5"); //还款 diff --git a/intc-modules/intc-invest/src/main/java/com/intc/invest/service/impl/InstallmentHistoryServiceImpl.java b/intc-modules/intc-invest/src/main/java/com/intc/invest/service/impl/InstallmentHistoryServiceImpl.java index b5df2f6..ccbbb73 100644 --- a/intc-modules/intc-invest/src/main/java/com/intc/invest/service/impl/InstallmentHistoryServiceImpl.java +++ b/intc-modules/intc-invest/src/main/java/com/intc/invest/service/impl/InstallmentHistoryServiceImpl.java @@ -53,7 +53,39 @@ public class InstallmentHistoryServiceImpl implements IInstallmentHistoryService @Override public InstallmentHistoryVo selectInstallmentHistoryById(Long id) { - return installmentHistoryMapper.selectInstallmentHistoryById(id); + InstallmentHistoryVo installmentHistory=installmentHistoryMapper.selectInstallmentHistoryById(id); + DecimalFormat decimalFormat = new DecimalFormat("#.##"); + String daysBetween=""; + if(installmentHistory.getCloseDate()!=null){ + daysBetween = DateUtils.timeDistance(installmentHistory.getCloseDate(),installmentHistory.getInstallmentDate()); + }else { + daysBetween = DateUtils.timeDistance(new Date(),installmentHistory.getInstallmentDate()); + } + installmentHistory.setLoanDays(daysBetween); + if(installmentHistory.getBankCode()!=null){ + installmentHistory.setBankNameCode(installmentHistory.getBankName()+"("+ StringUtils.getLastNumberChars(4,installmentHistory.getBankCode()+")")); + }else { + installmentHistory.setBankNameCode(installmentHistory.getBankName()); + } + double interest=installmentHistory.getTotalInterest(); + double interestRate=0; + if(interest>0){ + interestRate=interest/installmentHistory.getInstallmentAmount(); + if(installmentHistory.getPeriod()!=null){ + interestRate=interestRate*12/installmentHistory.getPeriod(); + } + } + + if(installmentHistory.getReceivingAccountCode()!=null){ + installmentHistory.setReceivingAccountNameCode(installmentHistory.getReceivingAccountName()+"("+ StringUtils.getLastNumberChars(4,installmentHistory.getReceivingAccountCode()+")")); + }else { + installmentHistory.setReceivingAccountNameCode(installmentHistory.getReceivingAccountName()); + } + + interestRate=interestRate*100; + String calculateInterestRate= decimalFormat.format(interestRate)+"%"; + installmentHistory.setCalculateInterestRate(calculateInterestRate); + return installmentHistory; } /**