fix: 账户统计功能优化。
This commit is contained in:
@@ -39,6 +39,10 @@ public class AccountsVo extends Accounts
|
||||
@ApiModelProperty(value="储蓄卡类型,1:I类卡,2:II类卡")
|
||||
private String debitType;
|
||||
|
||||
/** 类型,1期货,2股票 */
|
||||
@ApiModelProperty(value="投资类型,1期货,2股票 */")
|
||||
private String investType;
|
||||
|
||||
@ApiModelProperty(value="名称卡号可用额度")
|
||||
private String nameCodeAvailableLimit;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
@@ -1665,14 +1666,37 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
//储蓄卡
|
||||
dto.setType("1");
|
||||
//只计算储蓄卡账户的余额
|
||||
dto.setRepayFlag("1");
|
||||
dto.setRepayFlag("");
|
||||
double debitAllBalance =0;
|
||||
List<AccountsVo> accountsList=accountsMapper.selectAccountsList(dto);
|
||||
double debetBalance =0;
|
||||
if(accountsList.size()>0){
|
||||
debetBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
|
||||
debitAllBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
|
||||
}
|
||||
map.put("debitBalance",decimalFormat.format(debetBalance));
|
||||
map.put("debitAllBalance",decimalFormat.format(debitAllBalance));
|
||||
|
||||
//只计算储蓄卡账户的余额
|
||||
dto.setRepayFlag("1");
|
||||
accountsList=accountsMapper.selectAccountsList(dto);
|
||||
List<AccountsVo> IaccountsList=accountsList.stream().filter(x -> x.getDebitType().equals("1")).collect(Collectors.toList());
|
||||
List<AccountsVo> IIaccountsList=accountsList.stream().filter(x -> x.getDebitType().equals("2")).collect(Collectors.toList());
|
||||
double debitBalance =0;
|
||||
double idebitBalance =0;
|
||||
double iidebitBalance =0;
|
||||
if(accountsList.size()>0){
|
||||
debitBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
|
||||
}
|
||||
if(IaccountsList.size()>0){
|
||||
idebitBalance=IaccountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
|
||||
}
|
||||
if(IIaccountsList.size()>0){
|
||||
iidebitBalance=IIaccountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
|
||||
}
|
||||
map.put("debitBalance",decimalFormat.format(debitBalance));
|
||||
map.put("idebitBalance",decimalFormat.format(idebitBalance));
|
||||
map.put("iidebitBalance",decimalFormat.format(iidebitBalance));
|
||||
|
||||
|
||||
map.put("debitBalance",decimalFormat.format(debitBalance));
|
||||
//信用卡
|
||||
dto.setType("2");
|
||||
dto.setRepayFlag("");
|
||||
@@ -1689,11 +1713,23 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
|
||||
//投资账户
|
||||
dto.setType("5");
|
||||
accountsList=accountsMapper.selectAccountsList(dto);
|
||||
List<AccountsVo> stocksList=accountsList.stream().filter(x -> x.getInvestType().equals("2")).collect(Collectors.toList());
|
||||
List<AccountsVo> futuresList=accountsList.stream().filter(x -> x.getInvestType().equals("1")).collect(Collectors.toList());
|
||||
double investBalance =0;
|
||||
double stocksBalance =0;
|
||||
double futuresBalance =0;
|
||||
if(accountsList.size()>0){
|
||||
investBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
|
||||
}
|
||||
if(stocksList.size()>0){
|
||||
stocksBalance=stocksList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
|
||||
}
|
||||
if(futuresList.size()>0){
|
||||
futuresBalance=futuresList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
|
||||
}
|
||||
map.put("investBalance",decimalFormat.format(investBalance));
|
||||
map.put("stocksBalance",decimalFormat.format(stocksBalance));
|
||||
map.put("futuresBalance",decimalFormat.format(futuresBalance));
|
||||
|
||||
//借贷账户
|
||||
dto.setType("3");
|
||||
|
||||
@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="payDate" column="pay_date" />
|
||||
<result property="creditLimit" column="credit_limit" />
|
||||
<result property="debitType" column="debit_type" />
|
||||
<result property="investType" column="invest_type" />
|
||||
<result property="lendType" column="lend_type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="recentDealTime" column="recent_deal_time" />
|
||||
@@ -52,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
bcl.pay_date ,
|
||||
bcl.credit_limit ,
|
||||
bcl.debit_type,
|
||||
invest.type as invest_type,
|
||||
bcl.lend_type,
|
||||
(select create_time from accounts_deal_record adr where adr.account_id=a.account_id
|
||||
order by adr.create_time desc
|
||||
@@ -59,8 +61,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
) as recent_deal_time
|
||||
from
|
||||
accounts a
|
||||
left join bank_card_lend bcl on
|
||||
bcl.id = a.id
|
||||
left join bank_card_lend bcl on bcl.id = a.id
|
||||
left join future_stocks invest on invest.id = a.id
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="selectAccountsList" parameterType="AccountsDto" resultMap="AccountsResult">
|
||||
|
||||
Reference in New Issue
Block a user