fix: 智聪记账管理,新增结算卡统计、POS机统计功能。

This commit is contained in:
tianyongbao
2025-02-09 08:48:18 +08:00
parent aa398f5380
commit a1b43a0b10
6 changed files with 952 additions and 4 deletions

View File

@@ -155,6 +155,20 @@ public class StatisticAnalysisController extends BaseController {
return AjaxResult.success(resultMap);
}
@ApiOperation("结算卡统计分析")
@GetMapping("/debitCardAnalysis")
public Map<String,Object> getDebitCardAnalysis(AnalysisDto analysisDto){
Map<String, Object> resultMap = iStatisticAnalysisService.getDebitCardAnalysis(analysisDto);
return AjaxResult.success(resultMap);
}
@ApiOperation("pos机统计分析")
@GetMapping("/posStatics")
public Map<String,Object> getPosStatics(AnalysisDto analysisDto){
Map<String, Object> resultMap = iStatisticAnalysisService.getPosStatics(analysisDto);
return AjaxResult.success(resultMap);
}

View File

@@ -0,0 +1,154 @@
package com.intc.invest.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 吃奶记录Vo对象 health_milk_powder_record
*
* @author tianyongbao
* @date 2025-02-01
*/
@ApiModel("吃奶记录Vo对象")
@Data
public class AccountsDebitPosVo
{
/** 主键 */
private Long id;
/** 名称 */
@ApiModelProperty(value="名称)")
private String name;
/** 账号 */
@ApiModelProperty(value="账号)")
private String code;
@ApiModelProperty(value="名称卡号")
private String nameCode;
/** 支付公司 */
private String payCompany;
/** 商户名称 */
@ApiModelProperty(value="商户名称")
private String merchantName;
/** 今日次数 */
@ApiModelProperty(value="今日刷卡次数)")
private int todayCount;
/** 今日刷卡次数 */
@ApiModelProperty(value="今日金额)")
private double todayAmount;
/** 今日平均金额 */
@ApiModelProperty(value="今日平均金额)")
private double todayPerAmount;
/** 近7日次数 */
@ApiModelProperty(value="近7日次数)")
private int sevenDayCount;
/** 近7日金额 */
@ApiModelProperty(value="近7日金额)")
private double sevenDayAmount;
/** 近7日平均金额 */
@ApiModelProperty(value="近7日平均金额)")
private double sevenDayPerAmount;
/** 近1月次数 */
@ApiModelProperty(value="近1月次数)")
private int oneMonthCount;
/** 近1月金额 */
@ApiModelProperty(value="近1月金额)")
private double oneMonthAmount;
/** 近1月平均金额 */
@ApiModelProperty(value="近1月平均金额)")
private double oneMonthPerAmount;
/** 近3月次数 */
@ApiModelProperty(value="近3月次数)")
private int threeMonthCount;
/** 近3月金额 */
@ApiModelProperty(value="近3月金额)")
private double threeMonthAmount;
/** 近3月平均金额 */
@ApiModelProperty(value="近3月平均金额)")
private double threeMonthPerAmount;
/** 近6月次数 */
@ApiModelProperty(value="近6月次数)")
private int sixMonthCount;
/** 近6月金额 */
@ApiModelProperty(value="近6月金额)")
private double sixMonthAmount;
/** 近6月平均金额 */
@ApiModelProperty(value="近6月平均金额)")
private double sixMonthPerAmount;
/** 近1年次数 */
@ApiModelProperty(value="近1年次数)")
private int oneYearCount;
/** 近1年金额 */
@ApiModelProperty(value="近1年金额)")
private double oneYearAmount;
/** 近1年平均金额 */
@ApiModelProperty(value="近1年平均金额)")
private double oneYearPerAmount;
/** 近2年次数 */
@ApiModelProperty(value="近2年次数)")
private int twoYearCount;
/** 近2年金额 */
@ApiModelProperty(value="近2年金额)")
private double twoYearAmount;
/** 近2年平均金额 */
@ApiModelProperty(value="近2年平均金额)")
private double twoYearPerAmount;
/** 近5年次数 */
@ApiModelProperty(value="近5年次数)")
private int fiveYearCount;
/** 近5年金额 */
@ApiModelProperty(value="近5年金额)")
private double fiveYearAmount;
/** 近5年平均金额 */
@ApiModelProperty(value="近5年平均金额)")
private double fiveYearPerAmount;
/** 总次数 */
@ApiModelProperty(value="总次数)")
private int totalCount;
/** 总金额 */
@ApiModelProperty(value="总金额)")
private double totalAmount;
/** 总平均金额 */
@ApiModelProperty(value="总平均金额)")
private double totalPerAmount;
}

View File

@@ -2,11 +2,9 @@ package com.intc.invest.mapper;
import com.intc.common.datascope.annotation.DataScope;
import com.intc.invest.domain.dto.AccountsDealRecordDto;
import com.intc.invest.domain.dto.AccountsDto;
import com.intc.invest.domain.dto.BankCardLendDto;
import com.intc.invest.domain.vo.AccountCalendarVo;
import com.intc.invest.domain.vo.AccountsDealRecordVo;
import com.intc.invest.domain.vo.AccountsVo;
import com.intc.invest.domain.vo.BankCardLendVo;
import com.intc.invest.domain.vo.*;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@@ -76,4 +74,25 @@ public interface StatisticAnalysisMapper {
*/
@DataScope(businessAlias = "a")
public List<AccountsVo> selectCreditCardList(BankCardLendDto bankCardLendDto);
/**
* 查询储蓄卡pos收款统计数据
*
* @param accountsDto 银行卡信息
* @return 银行卡信息集合
*/
@DataScope(businessAlias = "t")
public List<AccountsDebitPosVo> selectDebitCardPosList(AccountsDto accountsDto);
/**
* 查询储蓄卡pos收款统计数据
*
* @param accountsDto 银行卡信息
* @return 银行卡信息集合
*/
@DataScope(businessAlias = "t")
public List<AccountsDebitPosVo> selectPosStaticList(AccountsDto accountsDto);
}

View File

@@ -48,4 +48,9 @@ public interface IStatisticAnalysisService {
public Map<String, Object> getDailyExpensesAnalysis(AnalysisDto analysisDto);
public Map<String, Object> getDebitCardAnalysis(AnalysisDto analysisDto);
public Map<String, Object> getPosStatics(AnalysisDto analysisDto);
}

View File

@@ -2992,4 +2992,242 @@ public class StatisticAnalysisImpl implements IStatisticAnalysisService {
}
return list;
}
@Override
public Map<String, Object> getDebitCardAnalysis(AnalysisDto analysisDto) {
//返回数据
HashMap<String, Object> map = new HashMap<>();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
AccountsDto dto=new AccountsDto();
List<AccountsDebitPosVo> debitCardList=statisticAnalysisMapper.selectDebitCardPosList(dto);
double todayCount =0;
double todayAmount =0;
double sevenDayCount =0;
double sevenDayAmount =0;
double oneMonthCount =0;
double oneMonthAmount =0;
double threeMonthCount =0;
double threeMonthAmount =0;
double sixMonthCount =0;
double sixMonthAmount =0;
double oneYearCount =0;
double oneYearAmount =0;
double twoYearCount =0;
double twoYearAmount =0;
double fiveYearCount =0;
double fiveYearAmount =0;
double totalCount =0;
double totalAmount =0;
if(debitCardList.size()>0){
todayCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTodayCount).sum();
todayAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTodayAmount).sum();
sevenDayCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getSevenDayCount).sum();
sevenDayAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getSevenDayAmount).sum();
oneMonthCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getOneMonthCount).sum();
oneMonthAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getOneMonthAmount).sum();
threeMonthCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getThreeMonthCount).sum();
threeMonthAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getThreeMonthAmount).sum();
sixMonthCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getSixMonthCount).sum();
sixMonthAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getSixMonthAmount).sum();
oneYearCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getOneYearCount).sum();
oneYearAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getOneYearAmount).sum();
twoYearCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTwoYearCount).sum();
twoYearAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTwoYearAmount).sum();
fiveYearCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getFiveYearCount).sum();
fiveYearAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getFiveYearAmount).sum();
totalCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTotalCount).sum();
totalAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTotalAmount).sum();
}
map.put("todayCount",todayCount);
map.put("todayAmount",decimalFormat.format(todayAmount));
map.put("sevenDayCount",sevenDayCount);
map.put("sevenDayAmount",decimalFormat.format(sevenDayAmount));
map.put("oneMonthCount",oneMonthCount);
map.put("oneMonthAmount",decimalFormat.format(oneMonthAmount));
map.put("threeMonthCount",threeMonthCount);
map.put("threeMonthAmount",decimalFormat.format(threeMonthAmount));
map.put("sixMonthCount",sixMonthCount);
map.put("sixMonthAmount",decimalFormat.format(sixMonthAmount));
map.put("oneYearCount",oneYearCount);
map.put("oneYearAmount",decimalFormat.format(oneYearAmount));
map.put("twoYearCount",twoYearCount);
map.put("twoYearAmount",decimalFormat.format(twoYearAmount));
map.put("fiveYearCount",fiveYearCount);
map.put("fiveYearAmount",decimalFormat.format(fiveYearAmount));
map.put("totalCount",totalCount);
map.put("totalAmount",decimalFormat.format(totalAmount));
//修改名称加卡号
for (AccountsDebitPosVo accounts : debitCardList) {
if(accounts.getCode()!=null){
accounts.setNameCode(accounts.getName()+""+ StringUtils.getLastNumberChars(4,accounts.getCode()+""));
}else {
accounts.setNameCode(accounts.getName());
}
}
ArrayList<Map<String, Object>> accountsOneYearList = new ArrayList<>();
for (AccountsDebitPosVo vo:debitCardList
) {
Map<String, Object> datamap = new HashMap<>();
datamap.put("debitCard", vo.getNameCode());
datamap.put("amount", vo.getSixMonthAmount());
accountsOneYearList.add(datamap);
}
//列表
map.put("debitCardList",accountsOneYearList);
//表格列表
map.put("debitCardTableList",debitCardList);
return map;
}
@Override
public Map<String, Object> getPosStatics(AnalysisDto analysisDto) {
//返回数据
HashMap<String, Object> map = new HashMap<>();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
AccountsDto dto=new AccountsDto();
List<AccountsDebitPosVo> debitCardList=statisticAnalysisMapper.selectPosStaticList(dto);
double todayCount =0;
double todayAmount =0;
double sevenDayCount =0;
double sevenDayAmount =0;
double oneMonthCount =0;
double oneMonthAmount =0;
double threeMonthCount =0;
double threeMonthAmount =0;
double sixMonthCount =0;
double sixMonthAmount =0;
double oneYearCount =0;
double oneYearAmount =0;
double twoYearCount =0;
double twoYearAmount =0;
double fiveYearCount =0;
double fiveYearAmount =0;
double totalCount =0;
double totalAmount =0;
if(debitCardList.size()>0){
todayCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTodayCount).sum();
todayAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTodayAmount).sum();
sevenDayCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getSevenDayCount).sum();
sevenDayAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getSevenDayAmount).sum();
oneMonthCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getOneMonthCount).sum();
oneMonthAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getOneMonthAmount).sum();
threeMonthCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getThreeMonthCount).sum();
threeMonthAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getThreeMonthAmount).sum();
sixMonthCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getSixMonthCount).sum();
sixMonthAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getSixMonthAmount).sum();
oneYearCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getOneYearCount).sum();
oneYearAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getOneYearAmount).sum();
twoYearCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTwoYearCount).sum();
twoYearAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTwoYearAmount).sum();
fiveYearCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getFiveYearCount).sum();
fiveYearAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getFiveYearAmount).sum();
totalCount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTotalCount).sum();
totalAmount=debitCardList.stream().mapToDouble(AccountsDebitPosVo::getTotalAmount).sum();
}
map.put("todayCount",todayCount);
map.put("todayAmount",decimalFormat.format(todayAmount));
map.put("sevenDayCount",sevenDayCount);
map.put("sevenDayAmount",decimalFormat.format(sevenDayAmount));
map.put("oneMonthCount",oneMonthCount);
map.put("oneMonthAmount",decimalFormat.format(oneMonthAmount));
map.put("threeMonthCount",threeMonthCount);
map.put("threeMonthAmount",decimalFormat.format(threeMonthAmount));
map.put("sixMonthCount",sixMonthCount);
map.put("sixMonthAmount",decimalFormat.format(sixMonthAmount));
map.put("oneYearCount",oneYearCount);
map.put("oneYearAmount",decimalFormat.format(oneYearAmount));
map.put("twoYearCount",twoYearCount);
map.put("twoYearAmount",decimalFormat.format(twoYearAmount));
map.put("fiveYearCount",fiveYearCount);
map.put("fiveYearAmount",decimalFormat.format(fiveYearAmount));
map.put("totalCount",totalCount);
map.put("totalAmount",decimalFormat.format(totalAmount));
//修改名称加卡号
for (AccountsDebitPosVo accounts : debitCardList) {
accounts.setNameCode(accounts.getName()+"-"+ accounts.getMerchantName());
}
ArrayList<Map<String, Object>> accountsOneYearList = new ArrayList<>();
for (AccountsDebitPosVo vo:debitCardList
) {
Map<String, Object> datamap = new HashMap<>();
datamap.put("pos", vo.getNameCode());
datamap.put("amount", vo.getSixMonthAmount());
accountsOneYearList.add(datamap);
}
//列表
map.put("posList",accountsOneYearList);
//表格列表
map.put("posTableList",debitCardList);
return map;
}
}

View File

@@ -281,4 +281,522 @@
group by a."name"
</select>
<select id="selectDebitCardPosList" parameterType="AccountsDto" resultType="com.intc.invest.domain.vo.AccountsDebitPosVo">
select
t.*
from
(
select
a.id ,
a."name" ,
a.code ,
a.create_by,
(
select
case
when sum(atr.actual_amount) is null then 0
else sum(atr.actual_amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and to_char( atr.create_time,
'yyyy-MM-dd') = to_char(CURRENT_DATE,
'yyyy-MM-dd')
) as oneDayAmount
,
(
select
count(atr.actual_amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and to_char( atr.create_time,
'yyyy-MM-dd') = to_char(CURRENT_DATE,
'yyyy-MM-dd')
) as oneDayCount,
(
select
case
when sum(atr.actual_amount) is null then 0
else sum(atr.actual_amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '7 days'
) as sevenDayAmount
,
(
select
count(atr.actual_amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '7 days'
) as sevenDayCount,
(
select
case
when sum(atr.actual_amount) is null then 0
else sum(atr.actual_amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '1 months'
) as oneMonthAmount
,
(
select
count(atr.actual_amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '1 months'
) as oneMonthCount,
(
select
case
when sum(atr.actual_amount) is null then 0
else sum(atr.actual_amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '3 months'
) as threeMonthAmount ,
(
select
count(atr.actual_amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '3 months'
) as threeMonthCount,
(
select
case
when sum(atr.actual_amount) is null then 0
else sum(atr.actual_amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '6 months'
) as sixMonthAmount,
(
select
count(atr.actual_amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '6 months'
) as sixMonthCount,
(
select
case
when sum(atr.actual_amount) is null then 0
else sum(atr.actual_amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '1 years'
) as oneYearAmount,
(
select
count(atr.actual_amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '1 years'
) as oneYearCount,
(
select
case
when sum(atr.actual_amount) is null then 0
else sum(atr.actual_amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '2 years'
) as twoYearAmount,
(
select
count(atr.actual_amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '2 years'
) as twoYearCount,
(
select
case
when sum(atr.actual_amount) is null then 0
else sum(atr.actual_amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '5 years'
) as fiveYearAmount,
(
select
count(atr.actual_amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
and atr.create_time >= CURRENT_DATE - interval '5 years'
) as fiveYearCount,
(
select
case
when sum(atr.actual_amount) is null then 0
else sum(atr.actual_amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
) as totalAmount,
(
select
count(atr.actual_amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.in_account_id = a.id
) as totalCount
from
accounts a
where
a.status = '1'
and a."type" = '1'
and a.del_flag = '0'
and a.account_id in
(
select
distinct adr.account_id
from
accounts_deal_record adr
where
adr.deal_category = '5'
and adr.del_flag = '0' )) t
where 0=0
<!-- 数据范围过滤 -->
${params.dataScope}
order by
t.oneMonthCount desc
</select>
<select id="selectPosStaticList" parameterType="AccountsDto" resultType="com.intc.invest.domain.vo.AccountsDebitPosVo">
select
t.*
from
(
select
a.id ,
a."name" ,
a.merchant_name as merchantName,
a.pay_company as payCompany,
a.create_by,
(
select
case
when sum(atr.amount) is null then 0
else sum(atr.amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and to_char( atr.create_time,
'yyyy-MM-dd') = to_char(CURRENT_DATE,
'yyyy-MM-dd')
) as oneDayAmount
,
(
select
count(atr.amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and to_char( atr.create_time,
'yyyy-MM-dd') = to_char(CURRENT_DATE,
'yyyy-MM-dd')
) as oneDayCount,
(
select
case
when sum(atr.amount) is null then 0
else sum(atr.amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '7 days'
) as sevenDayAmount
,
(
select
count(atr.amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '7 days'
) as sevenDayCount,
(
select
case
when sum(atr.amount) is null then 0
else sum(atr.amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '1 months'
) as oneMonthAmount
,
(
select
count(atr.amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '1 months'
) as oneMonthCount,
(
select
case
when sum(atr.amount) is null then 0
else sum(atr.amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '3 months'
) as threeMonthAmount ,
(
select
count(atr.amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '3 months'
) as threeMonthCount,
(
select
case
when sum(atr.amount) is null then 0
else sum(atr.amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '6 months'
) as sixMonthAmount,
(
select
count(atr.amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '6 months'
) as sixMonthCount,
(
select
case
when sum(atr.amount) is null then 0
else sum(atr.amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '1 years'
) as oneYearAmount,
(
select
count(atr.amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '1 years'
) as oneYearCount,
(
select
case
when sum(atr.amount) is null then 0
else sum(atr.amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '2 years'
) as twoYearAmount,
(
select
count(atr.amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '2 years'
) as twoYearCount,
(
select
case
when sum(atr.amount) is null then 0
else sum(atr.amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '5 years'
) as fiveYearAmount,
(
select
count(atr.amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
and atr.create_time >= CURRENT_DATE - interval '5 years'
) as fiveYearCount,
(
select
case
when sum(atr.amount) is null then 0
else sum(atr.amount)
end
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
) as totalAmount,
(
select
count(atr.amount)
from
accounts_transfer_record atr
where
atr.type = '1'
and atr.del_flag = '0'
and atr.pos_id = a.id
) as totalCount
from
pos_machine a
where
a.del_flag = '0'
) t
where 0=0
<!-- 数据范围过滤 -->
${params.dataScope}
order by
t.oneMonthCount desc
</select>
</mapper>