fix: 首页功能优化完善。

This commit is contained in:
tianyongbao
2024-07-24 14:45:39 +08:00
parent 2c901b5d5b
commit 3cac9b3064
5 changed files with 488 additions and 234 deletions

View File

@@ -1,5 +1,6 @@
package com.ruoyi.invest.controller;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.invest.domain.dto.AnalysisDto;
import com.ruoyi.invest.service.IStatisticAnalysisService;
@@ -19,42 +20,55 @@ import java.util.Map;
@Api(tags = "统计分析")
@RestController
@RequestMapping("/analysis")
public class StatisticAnalysisController {
public class StatisticAnalysisController extends BaseController {
@Autowired
private IStatisticAnalysisService iStatisticAnalysisService;
@ApiOperation("账户总览-基础信息")
@GetMapping("/accountAnalysis/getIncomeInfo")
public Map<String,Object> getIncomeInfo(){
Map<String, Object> resultMap = iStatisticAnalysisService.getIncomeInfo();
@ApiOperation("账户总览-POS机信息")
@GetMapping("/getPosAccountsInfo")
public Map<String,Object> getPosAccountsInfo(){
Map<String, Object> resultMap = iStatisticAnalysisService.getPosAccountsInfo();
return AjaxResult.success(resultMap);
}
@ApiOperation("账户总览-基础信息")
@GetMapping("/accountAnalysis/getBaseAccountInfo")
public Map<String,Object> getBaseAccountInfo(){
Map<String, Object> resultMap = iStatisticAnalysisService.getBaseAccountInfo();
return AjaxResult.success(resultMap);
}
@ApiOperation("账户总览-负债信息")
@GetMapping("/accountAnalysis/getDebetInfo")
public Map<String,Object> getDebetInfo(){
Map<String, Object> resultMap = iStatisticAnalysisService.getDebetInfo();
return AjaxResult.success(resultMap);
}
@ApiOperation("账户总览-信用卡信息")
@GetMapping("/accountAnalysis/getCreditInfo")
public Map<String,Object> getCreditInfo(){
Map<String, Object> resultMap = iStatisticAnalysisService.getCreditInfo();
@GetMapping("/getCreditAccountsInfo")
public Map<String,Object> getCreditAccountsInfo(){
Map<String, Object> resultMap = iStatisticAnalysisService.getCreditAccountsInfo();
return AjaxResult.success(resultMap);
}
@ApiOperation("账户总览-储蓄账户信息")
@GetMapping("/getDebitAccountsInfo")
public Map<String,Object> getDebitAccountsInfo(){
Map<String, Object> resultMap = iStatisticAnalysisService.getDebitAccountsInfo();
return AjaxResult.success(resultMap);
}
@ApiOperation("账户总览-投资账户信息")
@GetMapping("/getInvestAccountsInfo")
public Map<String,Object> getInvestAccountsInfo(){
Map<String, Object> resultMap = iStatisticAnalysisService.getInvestAccountsInfo();
return AjaxResult.success(resultMap);
}
@ApiOperation("账户总览-借贷账户信息")
@GetMapping("/getLendAccountsInfo")
public Map<String,Object> getLendAccountsInfo(){
Map<String, Object> resultMap = iStatisticAnalysisService.getLendAccountsInfo();
return AjaxResult.success(resultMap);
}
@ApiOperation("账户总览-征信报告信息")
@GetMapping("/getCreditReportInfo")
public AjaxResult getCreditReportInfo(){
return success(iStatisticAnalysisService.getCreditReportInfo());
}
@ApiOperation("信用卡统计分析")
@GetMapping("/creditAnalysis")

View File

@@ -38,4 +38,8 @@ public class AccountsDto extends BaseEntity implements Serializable
@ApiModelProperty(value="账户状态")
private String status;
/** 储蓄卡类型 */
@ApiModelProperty(value="储蓄卡类型")
private String debitType;
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.invest.service;
import com.ruoyi.invest.domain.dto.AnalysisDto;
import com.ruoyi.invest.domain.vo.CreditReportAnalysisVO;
import java.util.Map;
@@ -8,15 +9,18 @@ import java.util.Map;
* @author 22077662
*/
public interface IStatisticAnalysisService {
public Map<String, Object> getPosAccountsInfo();
public Map<String, Object> getIncomeInfo();
public Map<String, Object> getCreditAccountsInfo();
public Map<String, Object> getBaseAccountInfo();
public Map<String, Object> getDebitAccountsInfo();
public Map<String, Object> getDebetInfo();
public Map<String, Object> getInvestAccountsInfo();
public Map<String, Object> getLendAccountsInfo();
public CreditReportAnalysisVO getCreditReportInfo();
public Map<String, Object> getCreditInfo();
public Map<String, Object> getCreditAnalysis(AnalysisDto analysisDto);

View File

@@ -55,42 +55,8 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
@Resource
private AccountsDealRecordMapper accountsDealRecordMapper;
@Override
public Map<String, Object> getIncomeInfo() {
//返回数据
HashMap<String, Object> map = new HashMap<>();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
//期货收益
FutureStocksBillDto futureStocksBillDto=new FutureStocksBillDto();
futureStocksBillDto.setType("1");
List<FutureStocksBillVo> futureStocksBillList=futureStocksBillMapper.selectFutureStocksBillList(futureStocksBillDto);
double futuresIncome = futureStocksBillList.stream().mapToDouble(FutureStocksBillVo::getBillAmount).sum();
map.put("futuresIncome",decimalFormat.format(futuresIncome));
//股票收益
futureStocksBillDto.setType("2");
futureStocksBillList=futureStocksBillMapper.selectFutureStocksBillList(futureStocksBillDto);
double stocksIncome = futureStocksBillList.stream().mapToDouble(FutureStocksBillVo::getBillAmount).sum();
map.put("stocksIncome",decimalFormat.format(stocksIncome));
AccountsDto dto=new AccountsDto();
dto.setState("1");
//投资账户余额
dto.setType("5");
List<AccountsVo> accountsList=accountsMapper.selectAccountsList(dto);
double investBalance =0;
if(accountsList.size()>0){
investBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
}
map.put("investBalance",decimalFormat.format(investBalance));
//总收益
map.put("totalIncome",decimalFormat.format(futuresIncome+stocksIncome));
return map;
}
@Override
public Map<String, Object> getBaseAccountInfo() {
public Map<String, Object> getPosAccountsInfo() {
//返回数据
HashMap<String, Object> map = new HashMap<>();
//Pos机
@@ -98,194 +64,79 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
//状态为正常使用
posMachineDto.setStatus("1");
map.put("posCount",posMachineMapper.selectPosMachineList(posMachineDto).size());
BankCardLendDto bankCardLendDto=new BankCardLendDto();
//状态为正常使用
bankCardLendDto.setStatus("1");
bankCardLendDto.setType("2");
//信用卡
map.put("creditCount",bankCardLendMapper.selectBankCardLendList(bankCardLendDto).size());
bankCardLendDto.setType("1");
//储蓄卡
map.put("debitCount",bankCardLendMapper.selectBankCardLendList(bankCardLendDto).size());
bankCardLendDto.setType("1");
bankCardLendDto.setDebitType("1");
//I类储蓄卡
map.put("debitICount",bankCardLendMapper.selectBankCardLendList(bankCardLendDto).size());
bankCardLendDto.setDebitType("2");
//II类储蓄卡
map.put("debitIICount",bankCardLendMapper.selectBankCardLendList(bankCardLendDto).size());
bankCardLendDto.setDebitType("");
bankCardLendDto.setType("3");
bankCardLendDto.setLendType("1");
//网贷
map.put("onlineLendCount",bankCardLendMapper.selectBankCardLendList(bankCardLendDto).size());
//人情
bankCardLendDto.setLendType("2");
map.put("peopleLendCount",bankCardLendMapper.selectBankCardLendList(bankCardLendDto).size());
FutureStocksDto futureStocksDto=new FutureStocksDto();
//状态为正常使用
futureStocksDto.setStatus("1");
futureStocksDto.setType("1");
//期货
map.put("futuresCount",futureStocksMapper.selectFutureStocksList(futureStocksDto).size());
//股票
futureStocksDto.setType("2");
map.put("stocksCount",futureStocksMapper.selectFutureStocksList(futureStocksDto).size());
return map;
}
@Override
public Map<String, Object> getDebetInfo() {
//返回数据
HashMap<String, Object> map = new HashMap<>();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
AccountsDto dto=new AccountsDto();
//状态正常,不隐藏
dto.setStatus("1");
dto.setState("1");
//储蓄卡
AccountsTransferRecordDto dto=new AccountsTransferRecordDto();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//当前日期
Date queryDate=DateUtils.getNowDate();
Calendar calendarStart = Calendar.getInstance();
calendarStart.add(Calendar.MONTH, 0);
calendarStart.set(Calendar.DAY_OF_MONTH, 1);//1:本月第一天
//获取数据
dto.setEndTime(dateFormat.format(queryDate));
dto.setStartTime(dateFormat.format(calendarStart.getTime()));
dto.setType("1");
List<AccountsVo> accountsList=accountsMapper.selectAccountsList(dto);
double debetBalance =0;
if(accountsList.size()>0){
debetBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
List<AccountsTransferRecordVo> transferList=accountsTransferRecordMapper.selectAccountsTransferRecordList(dto);
double currentMonthAmount =0;
double currentMonthCommission =0;
int currentMonthCount =0;
double actualAmount =0;
if(transferList.size()>0){
currentMonthCommission=transferList.stream().mapToDouble(AccountsTransferRecordVo::getCommission).sum();
currentMonthAmount=transferList.stream().mapToDouble(AccountsTransferRecordVo::getAmount).sum();
}
map.put("debetBalance",decimalFormat.format(debetBalance));
currentMonthCount=transferList.size();
map.put("currentMonthAmount",decimalFormat.format(currentMonthAmount));
map.put("currentMonthCommission",decimalFormat.format(currentMonthCommission));
map.put("currentMonthCount",currentMonthCount);
calendarStart= Calendar.getInstance();
calendarStart.set(Calendar.DAY_OF_YEAR, 1);//本年的第一天
dto.setStartTime(dateFormat.format(calendarStart.getTime()));
transferList=accountsTransferRecordMapper.selectAccountsTransferRecordList(dto);
//信用卡
dto.setType("2");
accountsList=accountsMapper.selectAccountsList(dto);
double creditBalance =0;
if(accountsList.size()>0){
creditBalance=accountsList.stream().mapToDouble(AccountsVo::getBalance).sum()*(-1);
double currentYearAmount =0;
double currentYearCommission =0;
int currentYearCount =0;
if(transferList.size()>0){
currentYearCommission=transferList.stream().mapToDouble(AccountsTransferRecordVo::getCommission).sum();
currentYearAmount=transferList.stream().mapToDouble(AccountsTransferRecordVo::getAmount).sum();
}
map.put("creditBalance",decimalFormat.format(creditBalance));
dto.setState("1");
//投资账户余额
dto.setType("5");
accountsList=accountsMapper.selectAccountsList(dto);
double investBalance =0;
if(accountsList.size()>0){
investBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
currentYearCount=transferList.size();
map.put("currentYearAmount",decimalFormat.format(currentYearAmount));
map.put("currentYearCommission",decimalFormat.format(currentYearCommission));
map.put("currentYearCount",currentYearCount);
dto.setStartTime("");
transferList=accountsTransferRecordMapper.selectAccountsTransferRecordList(dto);
double accumulateAmount =0;
double accumulateCommission =0;
int accumulateCount =0;
if(transferList.size()>0){
accumulateCommission=transferList.stream().mapToDouble(AccountsTransferRecordVo::getCommission).sum();
accumulateAmount=transferList.stream().mapToDouble(AccountsTransferRecordVo::getAmount).sum();
}
map.put("investBalance",decimalFormat.format(investBalance));
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat formatterMonth = new SimpleDateFormat("yyyy-MM");
//未结清网贷数据
InstallmentHistoryDto installmentHistoryDto=new InstallmentHistoryDto();
InstallmentHistoryDetailDto detailDto=new InstallmentHistoryDetailDto();
detailDto.setType("3");
detailDto.setState("0");
List<InstallmentHistoryDetailVo> detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
double unClearedOnlineDebt = 0;
double unClearedOnlineDebtPrinciple = 0;
double unClearedOnlineDebtInterest = 0;
if(detailList.size()>0){
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");
detailDto.setState("0");
detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
double creditInstallmentHistory =0;
if(detailList.size()>0){
creditInstallmentHistory = detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getCurrentAmount).sum();
}
map.put("creditInstallmentHistory",decimalFormat.format(creditInstallmentHistory));
//人情
installmentHistoryDto.setType("4");
installmentHistoryDto.setState("0");
List<InstallmentHistoryVo> installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
double peopleLendHistory =0;
if(installmentHistoryList.size()>0){
peopleLendHistory = installmentHistoryList.stream().mapToDouble(InstallmentHistoryVo::getInstallmentAmount).sum();
}
map.put("peopleLendHistory",decimalFormat.format(peopleLendHistory));
//总负债
map.put("totalDebt",decimalFormat.format(unClearedOnlineDebt+creditBalance+peopleLendHistory));
//净资产
map.put("netAsset",decimalFormat.format(investBalance+debetBalance-unClearedOnlineDebt-creditBalance-peopleLendHistory));
//未结清账户数
installmentHistoryDto.setState("0");
installmentHistoryDto.setType("3");
installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
int unclearedOnlineDebtCount = installmentHistoryList.size();
map.put("unclearedOnlineDebtCount",unclearedOnlineDebtCount);
//已结清账户数
installmentHistoryDto.setState("1");
installmentHistoryDto.setType("3");
installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
int clearedOnlineDebtCount = installmentHistoryList.size();
map.put("clearedOnlineDebtCount",clearedOnlineDebtCount);
//已结清网贷数据
installmentHistoryDto.setState("1");
installmentHistoryDto.setType("3");
installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
double clearedOnlineDebt =0;
double clearedOnlineDebtPrinciple =0;
double clearedOnlineDebtInterest =0;
if(installmentHistoryList.size()>0){
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()));
detailDto.setState("");
detailDto.setType("3");
detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
double dueOnlineDebt =0;
if(detailList.size()>0){
dueOnlineDebt = detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getCurrentAmount).sum();
}
map.put("dueOnlineDebt",decimalFormat.format(dueOnlineDebt));
//网贷当月已还款
detailDto.setState("1");
detailDto.setRepaymentMonth(formatterMonth.format(new Date()));
detailDto.setType("3");
detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
double repaidOnlineDebt =0;
if(detailList.size()>0){
repaidOnlineDebt = detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getCurrentAmount).sum();
}
map.put("repaidOnlineDebt",decimalFormat.format(repaidOnlineDebt));
//网贷剩余还款
map.put("leftOnlineDebt",decimalFormat.format(dueOnlineDebt-repaidOnlineDebt));
accumulateCount=transferList.size();
map.put("accumulateAmount",decimalFormat.format(accumulateAmount));
map.put("accumulateCommission",decimalFormat.format(accumulateCommission));
map.put("accumulateCount",accumulateCount);
return map;
}
@Override
public Map<String, Object> getCreditInfo() {
public Map<String, Object> getCreditAccountsInfo() {
//返回数据
HashMap<String, Object> map = new HashMap<>();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
SimpleDateFormat formatterMonth = new SimpleDateFormat("yyyy-MM");
//当月信用卡账单
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月账单");
CreditCardBillDto creditCardBillDto=new CreditCardBillDto();
@@ -347,11 +198,16 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
//信用卡额度
BankCardLendDto bankCardLendDto=new BankCardLendDto();
//状态为正常使用
bankCardLendDto.setStatus("1");
bankCardLendDto.setType("2");
List<BankCardLendVo> bankCardLendVoList=statisticAnalysisMapper.selectBankCardLendList(bankCardLendDto);
List<BankCardLendVo> bankCardLendVoList=bankCardLendMapper.selectBankCardLendList(bankCardLendDto);
//信用卡
map.put("creditCount",bankCardLendVoList.size());
int creditLimit = bankCardLendVoList.stream().mapToInt(BankCardLendVo::getCreditLimit).sum();
map.put("creditLimit",creditLimit);
AccountsDto dto=new AccountsDto();
//正常使用
dto.setStatus("1");
@@ -408,6 +264,381 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
}
@Override
public Map<String, Object> getDebitAccountsInfo() {
//返回数据
HashMap<String, Object> map = new HashMap<>();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
AccountsDto dto=new AccountsDto();
//状态正常,不隐藏
dto.setStatus("1");
//储蓄卡
dto.setType("1");
//I类储蓄卡
dto.setDebitType("1");
List<AccountsVo> accountsList=accountsMapper.selectAccountsList(dto);
double debitIBalance =0;
Integer debitICount =0;
if(accountsList.size()>0){
debitIBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
}
//I类储蓄卡数量
debitICount=accountsList.size();
map.put("debitICount",debitICount);
//I类储蓄卡余额
map.put("debitIBalance",decimalFormat.format(debitIBalance));
//II类储蓄卡
dto.setDebitType("2");
accountsList=accountsMapper.selectAccountsList(dto);
double debitIIBalance =0;
Integer debitIICount =0;
if(accountsList.size()>0){
debitIIBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
}
//II类储蓄卡余额
map.put("debitIIBalance",decimalFormat.format(debitIIBalance));
//II类储蓄卡数量
debitIICount=accountsList.size();
map.put("debitICount",debitICount);
map.put("debitIICount",debitIICount);
//储蓄卡数量
map.put("debitCount",debitICount+debitIICount);
//储蓄卡余额=I类储蓄卡余额+II类储蓄卡余额
map.put("debitBalance",decimalFormat.format(debitIBalance+debitIIBalance));
//网络账户余额
dto.setDebitType("3");
accountsList=accountsMapper.selectAccountsList(dto);
double debitOnlineBalance =0;
if(accountsList.size()>0){
debitOnlineBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
}
map.put("debitOnlineBalance",decimalFormat.format(debitOnlineBalance));
map.put("debitOnlineCount",accountsList.size());
//储值卡余额
dto.setDebitType("4");
accountsList=accountsMapper.selectAccountsList(dto);
double storedValueCardBalance =0;
if(accountsList.size()>0){
storedValueCardBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
}
//储值卡总数
map.put("storedValueCardCount",accountsList.size());
//储值卡余额
map.put("storedValueCardBalance",decimalFormat.format(storedValueCardBalance));
//住房公积金余额
dto.setDebitType("5");
accountsList=accountsMapper.selectAccountsList(dto);
double housingFundBalance =0;
if(accountsList.size()>0){
housingFundBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
}
map.put("housingFundBalance",decimalFormat.format(housingFundBalance));
//职工医保余额
dto.setDebitType("6");
accountsList=accountsMapper.selectAccountsList(dto);
double medicalBalance =0;
if(accountsList.size()>0){
medicalBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
}
map.put("medicalBalance",decimalFormat.format(medicalBalance));
//个人养老金余额
dto.setDebitType("7");
accountsList=accountsMapper.selectAccountsList(dto);
double personalPensionBalance =0;
if(accountsList.size()>0){
personalPensionBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
}
map.put("personalPensionBalance",decimalFormat.format(personalPensionBalance));
//其他余额
dto.setDebitType("8");
accountsList=accountsMapper.selectAccountsList(dto);
double otherDebitBalance =0;
if(accountsList.size()>0){
otherDebitBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
}
map.put("otherDebitBalance",decimalFormat.format(otherDebitBalance));
map.put("otherDebitCount",accountsList.size());
//储蓄账户总余额
map.put("debitTotalBalance",decimalFormat.format(debitIBalance+debitIIBalance+debitOnlineBalance+housingFundBalance+storedValueCardBalance+medicalBalance+personalPensionBalance+otherDebitBalance));
return map;
}
@Override
public Map<String, Object> getInvestAccountsInfo() {
//返回数据
HashMap<String, Object> map = new HashMap<>();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
//期货收益
FutureStocksBillDto futureStocksBillDto=new FutureStocksBillDto();
futureStocksBillDto.setType("1");
List<FutureStocksBillVo> futureStocksBillList=futureStocksBillMapper.selectFutureStocksBillList(futureStocksBillDto);
double futuresIncome = futureStocksBillList.stream().mapToDouble(FutureStocksBillVo::getBillAmount).sum();
map.put("futuresIncome",decimalFormat.format(futuresIncome));
//股票收益
futureStocksBillDto.setType("2");
futureStocksBillList=futureStocksBillMapper.selectFutureStocksBillList(futureStocksBillDto);
double stocksIncome = futureStocksBillList.stream().mapToDouble(FutureStocksBillVo::getBillAmount).sum();
map.put("stocksIncome",decimalFormat.format(stocksIncome));
AccountsDto dto=new AccountsDto();
dto.setState("1");
//投资账户余额
dto.setType("5");
List<AccountsVo> accountsList=accountsMapper.selectAccountsList(dto);
double investBalance =0;
if(accountsList.size()>0){
investBalance=accountsList.stream().mapToDouble(AccountsVo::getAvailableLimit).sum();
}
map.put("investBalance",decimalFormat.format(investBalance));
//总收益
map.put("totalIncome",decimalFormat.format(futuresIncome+stocksIncome));
FutureStocksDto futureStocksDto=new FutureStocksDto();
//状态为正常使用
futureStocksDto.setStatus("1");
futureStocksDto.setType("1");
//期货
map.put("futuresCount",futureStocksMapper.selectFutureStocksList(futureStocksDto).size());
//股票
futureStocksDto.setType("2");
map.put("stocksCount",futureStocksMapper.selectFutureStocksList(futureStocksDto).size());
AccountsDealRecordDto dealDto=new AccountsDealRecordDto();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//当前日期
Date queryDate=DateUtils.getNowDate();
Calendar calendarStart = Calendar.getInstance();
calendarStart.add(Calendar.MONTH, 0);
calendarStart.set(Calendar.DAY_OF_MONTH, 1);//1:本月第一天
//获取数据
dealDto.setEndTime(dateFormat.format(queryDate));
dealDto.setStartTime(dateFormat.format(calendarStart.getTime()));
dealDto.setType("5");
dealDto.setDealCategory("2");
List<AccountsDealRecordVo> accountsDealRecordVoList=accountsDealRecordMapper.selectAccountsDealRecordList(dealDto);
double income =0;
double expenses =0;
for (AccountsDealRecordVo vo:accountsDealRecordVoList
) {
if(vo.getDealType().equals("1")){
income+=vo.getAmount();
}
//支出
if(vo.getDealType().equals("2")){
expenses+=vo.getAmount();
}
}
//交易金额
map.put("currentMonthInvest",decimalFormat.format(income-expenses));
//收入
map.put("currentMonthIncome",decimalFormat.format(income));
//支出
map.put("currentMonthExpenses",decimalFormat.format(expenses));
return map;
}
@Override
public Map<String, Object> getLendAccountsInfo() {
//返回数据
HashMap<String, Object> map = new HashMap<>();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
BankCardLendDto bankCardLendDto=new BankCardLendDto();
//状态为正常使用
bankCardLendDto.setStatus("1");
bankCardLendDto.setType("3");
bankCardLendDto.setLendType("1");
//网贷
map.put("onlineLendCount",bankCardLendMapper.selectBankCardLendList(bankCardLendDto).size());
//人情
bankCardLendDto.setLendType("2");
map.put("peopleLendCount",bankCardLendMapper.selectBankCardLendList(bankCardLendDto).size());
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat formatterMonth = new SimpleDateFormat("yyyy-MM");
//未结清网贷数据
InstallmentHistoryDto installmentHistoryDto=new InstallmentHistoryDto();
InstallmentHistoryDetailDto detailDto=new InstallmentHistoryDetailDto();
detailDto.setType("3");
detailDto.setState("0");
List<InstallmentHistoryDetailVo> detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
double unClearedOnlineDebt = 0;
double unClearedOnlineDebtPrinciple = 0;
double unClearedOnlineDebtInterest = 0;
if(detailList.size()>0){
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");
detailDto.setState("0");
detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
double creditInstallmentHistory =0;
if(detailList.size()>0){
creditInstallmentHistory = detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getCurrentAmount).sum();
}
map.put("creditInstallmentHistory",decimalFormat.format(creditInstallmentHistory));
//人情
installmentHistoryDto.setType("4");
installmentHistoryDto.setState("0");
List<InstallmentHistoryVo> installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
double peopleLendHistory =0;
if(installmentHistoryList.size()>0){
peopleLendHistory = installmentHistoryList.stream().mapToDouble(InstallmentHistoryVo::getInstallmentAmount).sum();
}
map.put("peopleLendHistory",decimalFormat.format(peopleLendHistory));
//未结清账户数
installmentHistoryDto.setState("0");
installmentHistoryDto.setType("3");
installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
int unclearedOnlineDebtCount = installmentHistoryList.size();
map.put("unclearedOnlineDebtCount",unclearedOnlineDebtCount);
//已结清账户数
installmentHistoryDto.setState("1");
installmentHistoryDto.setType("3");
installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
int clearedOnlineDebtCount = installmentHistoryList.size();
map.put("clearedOnlineDebtCount",clearedOnlineDebtCount);
//已结清网贷数据
installmentHistoryDto.setState("1");
installmentHistoryDto.setType("3");
installmentHistoryList=installmentHistoryMapper.selectInstallmentHistoryList(installmentHistoryDto);
double clearedOnlineDebt =0;
double clearedOnlineDebtPrinciple =0;
double clearedOnlineDebtInterest =0;
if(installmentHistoryList.size()>0){
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()));
detailDto.setState("");
detailDto.setType("3");
detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
double dueOnlineDebt =0;
if(detailList.size()>0){
dueOnlineDebt = detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getCurrentAmount).sum();
}
map.put("dueOnlineDebt",decimalFormat.format(dueOnlineDebt));
//网贷当月已还款
detailDto.setState("1");
detailDto.setRepaymentMonth(formatterMonth.format(new Date()));
detailDto.setType("3");
detailList=installmentHistoryDetailMapper.selectInstallmentHistoryDetailList(detailDto);
double repaidOnlineDebt =0;
if(detailList.size()>0){
repaidOnlineDebt = detailList.stream().mapToDouble(InstallmentHistoryDetailVo::getCurrentAmount).sum();
}
map.put("repaidOnlineDebt",decimalFormat.format(repaidOnlineDebt));
//网贷剩余还款
map.put("leftOnlineDebt",decimalFormat.format(dueOnlineDebt-repaidOnlineDebt));
return map;
}
@Override
public CreditReportAnalysisVO getCreditReportInfo() {
CreditReportQueryRecordDto dto =new CreditReportQueryRecordDto();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date queryDate=DateUtils.getNowDate();
if(dto.getQueryDateStart()!=null){
try {
queryDate=formatter.parse(dto.getQueryDateStart());
dto.setQueryDateEnd(dto.getQueryDateStart());
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
CreditReportAnalysisVO analysisVO=new CreditReportAnalysisVO();
dto.setQueryType("1");
Calendar calendarStart = Calendar.getInstance();
calendarStart.setTime(queryDate);
calendarStart.add(Calendar.MONTH, -1);
dto.setQueryDateStart(formatter.format(calendarStart.getTime()));
analysisVO.setLastOneMonths(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
calendarStart.setTime(queryDate);
calendarStart.add(Calendar.MONTH, -2);
dto.setQueryDateStart(formatter.format(calendarStart.getTime()));
analysisVO.setLastTwoMonths(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
calendarStart.setTime(queryDate);
calendarStart.add(Calendar.MONTH, -3);
dto.setQueryDateStart(formatter.format(calendarStart.getTime()));
analysisVO.setLastThreeMonths(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
calendarStart.setTime(queryDate);
calendarStart.add(Calendar.MONTH, -6);
dto.setQueryDateStart(formatter.format(calendarStart.getTime()));
analysisVO.setLastSixMonths(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
calendarStart.setTime(queryDate);
calendarStart.add(Calendar.MONTH, -12);
dto.setQueryDateStart(formatter.format(calendarStart.getTime()));
analysisVO.setLastOneYears(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
calendarStart.setTime(queryDate);
calendarStart.add(Calendar.MONTH, -24);
dto.setQueryDateStart(formatter.format(calendarStart.getTime()));
analysisVO.setLastTwoYears(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
dto.setQueryDateStart("");
analysisVO.setLastAllYears(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
calendarStart.setTime(queryDate);
calendarStart.add(Calendar.MONTH, -6);
dto.setQueryDateStart(formatter.format(calendarStart.getTime()));
dto.setType("5");
dto.setQueryType("2");
analysisVO.setLastSixMonthQueryCount(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
calendarStart.setTime(queryDate);
calendarStart.add(Calendar.MONTH, -6);
dto.setQueryDateStart(formatter.format(calendarStart.getTime()));
dto.setType("4");
analysisVO.setLastSixMonthsAfterLoan(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
calendarStart.setTime(queryDate);
calendarStart.add(Calendar.MONTH, -24);
dto.setQueryDateStart(formatter.format(calendarStart.getTime()));
dto.setType("4");
analysisVO.setLastTwoYearsAfterLoan(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
dto.setQueryDateStart("");
dto.setType("4");
analysisVO.setTotalAfterLoan(creditReportQueryRecordMapper.selectCreditReportQueryRecordList(dto).size()+"");
return analysisVO;
}
@Override
public Map<String, Object> getCreditAnalysis(AnalysisDto analysisDto) {

View File

@@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.del_flag='0'
<if test="name != null and name != ''"> and a.name like '%'|| #{name}||'%'</if>
<if test="type != null and type != ''"> and a.type = #{type}</if>
<if test="debitType != null and debitType != ''"> and bcl.debit_type = #{debitType}</if>
<if test="state != null and state != ''"> and a.state = #{state}</if>
<if test="status != null and status != ''"> and a.status = #{status}</if>
<if test="accountId != null and accountId != ''"> and a.account_id = #{accountId}</if>