fix: 账户总览新增接口。
This commit is contained in:
@@ -28,4 +28,11 @@ public class InstallmentHistoryVo extends InstallmentHistory
|
||||
|
||||
@ApiModelProperty(value="最近还款日)")
|
||||
private Date repaymentDate;
|
||||
|
||||
@ApiModelProperty(value="剩余本金)")
|
||||
private Double outstandingPrincipal;
|
||||
|
||||
@ApiModelProperty(value="剩余利息)")
|
||||
private Double outstandingInterest;
|
||||
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
|
||||
if(accountsTransferRecord.getDealType().equals("1")){
|
||||
debitAccount.setBalance(debitAccount.getBalance()+accountsTransferRecord.getActualAmount());
|
||||
}else if(accountsTransferRecord.getDealType().equals("2")){
|
||||
debitAccount.setBalance(debitAccount.getBalance()-accountsTransferRecord.getActualAmount());
|
||||
debitAccount.setBalance(debitAccount.getBalance()-accountsTransferRecord.getActualAmount()-accountsTransferRecord.getCommission());
|
||||
}
|
||||
debitAccount.setAvailableLimit(debitAccount.getBalance());
|
||||
debitAccount.setUpdateTime(accountsTransferRecord.getCreateTime());
|
||||
@@ -577,7 +577,7 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
|
||||
dealRecord.setAccountId(debitAccount.getAccountId());
|
||||
dealRecord.setId(IdWorker.getId());
|
||||
//支出金额
|
||||
dealRecord.setAmount(accountsTransferRecord.getAmount());
|
||||
dealRecord.setAmount(accountsTransferRecord.getAmount()+accountsTransferRecord.getCommission());
|
||||
//实时余额
|
||||
dealRecord.setCurrentBalance(debitAccount.getBalance());
|
||||
//1储蓄卡,2 信用卡,3 网贷,4 人情,5 投资账户
|
||||
@@ -586,16 +586,18 @@ public class AccountsTransferRecordServiceImpl implements IAccountsTransferRecor
|
||||
//1表示借款,2表示还款
|
||||
if(accountsTransferRecord.getDealType().equals("1")){
|
||||
dealRecord.setDealType("1");
|
||||
//储蓄卡转账至投资账户
|
||||
dealRecord.setRemark("借贷记账借款。");
|
||||
//投资账户账至储蓄卡转
|
||||
dealRecord.setName(lendVo.getName()+"("+StringUtils.getLastNumberChars(3,lendVo.getCode())+")借款至"+debitCardVo.getName()+"("+StringUtils.getLastNumberChars(3,debitCardVo.getCode())+")");
|
||||
}else if(accountsTransferRecord.getDealType().equals("2")){
|
||||
dealRecord.setDealType("2");
|
||||
//投资账户账至储蓄卡转
|
||||
dealRecord.setRemark("借贷记账还款,本息合计。");
|
||||
//储蓄卡还款至投资账户
|
||||
dealRecord.setName(debitCardVo.getName()+"("+StringUtils.getLastNumberChars(3,debitCardVo.getCode())+")还款至"+lendVo.getName()+"("+StringUtils.getLastNumberChars(3,lendVo.getCode())+")");
|
||||
}
|
||||
//投资账户转账
|
||||
dealRecord.setDealCategory("9");
|
||||
dealRecord.setRemark("借贷记账");
|
||||
|
||||
dealRecord.setCreateBy(SecurityUtils.getUsername());
|
||||
dealRecord.setCreateTime(accountsTransferRecord.getCreateTime());
|
||||
accountsDealRecordMapper.insertAccountsDealRecord(dealRecord);
|
||||
|
||||
@@ -147,10 +147,16 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
detailDto.setState("0");
|
||||
List<InstallmentHistoryDetailVo> detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
|
||||
double unClearedOnlineDebt = 0;
|
||||
double unClearedOnlineDebtPrinciple = 0;
|
||||
double unClearedOnlineDebtInterest = 0;
|
||||
if(detailList.size()>0){
|
||||
unClearedOnlineDebt=detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getCurrentAmount).sum();
|
||||
unClearedOnlineDebtPrinciple=detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getPrincipal).sum();
|
||||
unClearedOnlineDebtInterest=detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getInterest).sum();
|
||||
unClearedOnlineDebt=unClearedOnlineDebtPrinciple+unClearedOnlineDebtInterest;
|
||||
}
|
||||
map.put("unClearedOnlineDebt",decimalFormat.format(unClearedOnlineDebt));
|
||||
map.put("unClearedOnlineDebtPrinciple",decimalFormat.format(unClearedOnlineDebtPrinciple));
|
||||
map.put("unClearedOnlineDebtInterest",decimalFormat.format(unClearedOnlineDebtInterest));
|
||||
|
||||
//信用卡分期账单
|
||||
detailDto.setType("2");
|
||||
@@ -197,10 +203,16 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
installmentHistoryDto.setType("3");
|
||||
installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
|
||||
double clearedOnlineDebt =0;
|
||||
double clearedOnlineDebtPrinciple =0;
|
||||
double clearedOnlineDebtInterest =0;
|
||||
if(installmentHistoryList.size()>0){
|
||||
clearedOnlineDebt = installmentHistoryList.stream().mapToDouble(InstallmentHistoryVo::getInstallmentAmount).sum()+installmentHistoryList.stream().mapToDouble(InstallmentHistoryVo::getTotalInterest).sum();
|
||||
clearedOnlineDebtPrinciple = installmentHistoryList.stream().mapToDouble(InstallmentHistoryVo::getInstallmentAmount).sum();
|
||||
clearedOnlineDebtInterest = installmentHistoryList.stream().mapToDouble(InstallmentHistoryVo::getTotalInterest).sum();
|
||||
clearedOnlineDebt=clearedOnlineDebtPrinciple+clearedOnlineDebtInterest;
|
||||
}
|
||||
map.put("clearedOnlineDebt",decimalFormat.format(clearedOnlineDebt));
|
||||
map.put("clearedOnlineDebtPrinciple",decimalFormat.format(clearedOnlineDebtPrinciple));
|
||||
map.put("clearedOnlineDebtInterest",decimalFormat.format(clearedOnlineDebtInterest));
|
||||
//网贷当月应还款
|
||||
|
||||
detailDto.setRepaymentMonth(formatterMonth.format(new Date()));
|
||||
@@ -253,6 +265,49 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
double creditInstallment = detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getCurrentAmount).sum();
|
||||
map.put("creditInstallment",decimalFormat.format(creditInstallment));
|
||||
|
||||
detailDto.setState("0");
|
||||
detailDto.setRepaymentMonth("");
|
||||
detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
|
||||
double unclearedCreditInstallment = 0;
|
||||
double unclearedCreditInstallmentPrinciple = 0;
|
||||
double unclearedCreditInstallmentInterest = 0;
|
||||
if(detailList.size()>0){
|
||||
|
||||
unclearedCreditInstallmentPrinciple=detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getPrincipal).sum();
|
||||
unclearedCreditInstallmentInterest=detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getInterest).sum();
|
||||
unclearedCreditInstallment=unclearedCreditInstallmentPrinciple+unclearedCreditInstallmentInterest;
|
||||
}
|
||||
map.put("unclearedCreditInstallment",decimalFormat.format(unclearedCreditInstallment));
|
||||
map.put("unclearedCreditInstallmentPrinciple",decimalFormat.format(unclearedCreditInstallmentPrinciple));
|
||||
map.put("unclearedCreditInstallmentInterest",decimalFormat.format(unclearedCreditInstallmentInterest));
|
||||
|
||||
//已结清信用卡分期数据
|
||||
InstallmentHistoryDto installmentHistoryDto=new InstallmentHistoryDto();
|
||||
installmentHistoryDto.setState("1");
|
||||
installmentHistoryDto.setType("2");
|
||||
List<InstallmentHistoryVo> installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
|
||||
double clearedCreditInstallmentDebt =0;
|
||||
double clearedCreditInstallmentPrinciple =0;
|
||||
double clearedCreditInstallmentInterest =0;
|
||||
if(installmentHistoryList.size()>0){
|
||||
clearedCreditInstallmentPrinciple = installmentHistoryList.stream().mapToDouble(InstallmentHistoryVo::getInstallmentAmount).sum();
|
||||
clearedCreditInstallmentInterest = installmentHistoryList.stream().mapToDouble(InstallmentHistoryVo::getTotalInterest).sum();
|
||||
clearedCreditInstallmentDebt=clearedCreditInstallmentPrinciple+clearedCreditInstallmentInterest;
|
||||
}
|
||||
map.put("clearedCreditInstallmentDebt",decimalFormat.format(clearedCreditInstallmentDebt));
|
||||
map.put("clearedCreditInstallmentPrinciple",decimalFormat.format(clearedCreditInstallmentPrinciple));
|
||||
map.put("clearedCreditInstallmentInterest",decimalFormat.format(clearedCreditInstallmentInterest));
|
||||
|
||||
int clearedCreditInstallmentCount = installmentHistoryList.size();
|
||||
map.put("clearedCreditInstallmentCount",clearedCreditInstallmentCount);
|
||||
|
||||
installmentHistoryDto.setState("0");
|
||||
installmentHistoryDto.setType("2");
|
||||
installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
|
||||
int unclearedCreditInstallmentCount = installmentHistoryList.size();
|
||||
map.put("unclearedCreditInstallmentCount",unclearedCreditInstallmentCount);
|
||||
|
||||
|
||||
//信用卡额度
|
||||
BankCardLendDto bankCardLendDto=new BankCardLendDto();
|
||||
bankCardLendDto.setType("2");
|
||||
|
||||
@@ -30,6 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="bankCode" column="bank_code" />
|
||||
<result property="repaymentDate" column="repayment_date" />
|
||||
<result property="calculateInterestRate" column="calculate_interest_rate" />
|
||||
<result property="outstandingInterest" column="outstanding_interest" />
|
||||
<result property="outstandingPrincipal" column="outstanding_principal" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInstallmentHistoryVo">
|
||||
@@ -54,9 +56,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where
|
||||
ihd.installment_history_id = a.id
|
||||
and ihd.posting_state = '0'
|
||||
and ihd.del_flag='0'
|
||||
) as balance,
|
||||
(
|
||||
select
|
||||
CASE
|
||||
WHEN sum(ihd.interest) is null THEN 0
|
||||
ELSE sum(ihd.interest)
|
||||
END
|
||||
from
|
||||
installment_history_detail ihd
|
||||
where
|
||||
ihd.installment_history_id = a.id
|
||||
and ihd.posting_state = '0'
|
||||
and ihd.del_flag='0'
|
||||
) as outstanding_interest,
|
||||
(
|
||||
select
|
||||
CASE
|
||||
WHEN sum(ihd.principal) is null THEN 0
|
||||
ELSE sum(ihd.principal)
|
||||
END
|
||||
from
|
||||
installment_history_detail ihd
|
||||
where
|
||||
ihd.installment_history_id = a.id
|
||||
and ihd.posting_state = '0'
|
||||
and ihd.del_flag='0'
|
||||
) as outstanding_principal,
|
||||
(
|
||||
select
|
||||
min(d.repayment_date)
|
||||
from
|
||||
installment_history_detail d
|
||||
|
||||
Reference in New Issue
Block a user