feat:增加钱包类型搜索条件

This commit is contained in:
dzc committed 2026-07-13 16:08:51 +08:00
1 parent 67823d9644
commit 77d7700709
15 files changed
+128 -13

No files matched your search

@@ -13,6 +13,9 @@ public class HardDeptTotalDto implements BaseIsIncludeTreeInterface {
@Schema(description = "饭卡类型id")
private Long walletTypeId;
@Schema(description = "钱包类型idList")
private List<Long> walletTypeIdList;
@Schema(description = "饭卡类型id")
private LocalDateTime[] createTimeList;
@@ -95,4 +95,6 @@ public class HardOrderDto extends HardOrderEntity implements BaseIsIncludeTreeIn
*/
private Long walletTypeId;
private List<Long> walletTypeIdList;
}
@@ -25,6 +25,8 @@ public class HardOrderSumAndCountDto {
private Long walletTypeId;
private List<Long> walletTypeIdList;
private List<Long> mchIds;
/**
@@ -483,6 +483,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(dto.getDeptIds());
walletDto.setIsInclude(dto.getIsInclude());
walletDto.setWalletTypeIdList(dto.getWalletTypeIdList());
walletDto.setBizTypes(List.of(WalletBizEnum.BATCH.getCode()));
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -498,6 +499,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(dto.getDeptIds());
walletDto.setIsInclude(dto.getIsInclude());
walletDto.setWalletTypeIdList(dto.getWalletTypeIdList());
walletDto.setBizTypes(List.of(WalletBizEnum.BATCH.getCode()));
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_EXPENSE);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -513,6 +515,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(dto.getDeptIds());
walletDto.setIsInclude(dto.getIsInclude());
walletDto.setWalletTypeIdList(dto.getWalletTypeIdList());
walletDto.setBizTypes(List.of(WalletBizEnum.RETURN_CANTEEN.getCode()));
// walletDto.setType(WalletTransactionSumAndCountDto.TYPE_EXPENSE);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -528,6 +531,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(dto.getDeptIds());
walletDto.setIsInclude(dto.getIsInclude());
walletDto.setWalletTypeIdList(dto.getWalletTypeIdList());
walletDto.setBizTypes(List.of(WalletBizEnum.UPDATE.getCode(), WalletBizEnum.RECHARGE.getCode()));
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -543,6 +547,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(dto.getDeptIds());
walletDto.setIsInclude(dto.getIsInclude());
walletDto.setWalletTypeIdList(dto.getWalletTypeIdList());
walletDto.setBizTypes(List.of(WalletBizEnum.UPDATE.getCode(), WalletBizEnum.RECHARGE.getCode()));
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_EXPENSE);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -559,6 +564,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
payDto.setUserDeptIds(dto.getDeptIds());
payDto.setIsInclude(dto.getIsInclude());
payDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
payDto.setWalletTypeIdList(dto.getWalletTypeIdList());
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
payDto.setCreateTimeList(dto.getCreateTimeList());
}
@@ -574,6 +580,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
refundDto.setIsInclude(dto.getIsInclude());
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
refundDto.setRefundStatusCodes(List.of(HardSaleStatusEnum.COMPLETE.getStatus()));
refundDto.setWalletTypeIdList(dto.getWalletTypeIdList());
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
refundDto.setRefundTimeList(dto.getCreateTimeList());
}
@@ -272,6 +272,12 @@
<if test="dto.walletTypeId != null">
and w_m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and w_m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
order by a.create_time desc, a.user_id desc
</sql>
@@ -448,6 +454,12 @@
<if test="dto.walletTypeId != null">
and w_m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and w_m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.hardTypeCodes != null and dto.hardTypeCodes.size() != 0">
and m.type in
<foreach collection="dto.hardTypeCodes" item="v" open="(" close=")" separator=",">
@@ -480,6 +492,12 @@
<if test="dto.walletTypeId != null">
and w_m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and w_m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.refundTimeList != null and dto.refundTimeList.length == 2">
and r.audit_time between #{dto.refundTimeList[0]} and #{dto.refundTimeList[1]}
</if>
@@ -619,6 +637,12 @@
<if test="dto.walletTypeId != null">
and w_m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and w_m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.isRefundSuccess != null and dto.isRefundSuccess == true ">
and (a.refund_status is null or a.refund_status not in ('20'))
</if>
@@ -667,6 +691,12 @@
<if test="dto.walletTypeId != null">
and w_m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and w_m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.orderStatusCodes != null and dto.orderStatusCodes.size() != 0">
and o.order_status in
<foreach collection="dto.orderStatusCodes" item="v" open="(" close=")" separator=",">
@@ -2,11 +2,9 @@ package com.bsd.pjcloud.admin.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -16,6 +16,8 @@ public class WalletManageBalanceDto implements BaseIsIncludeTreeInterface {
private Long walletTypeId;
private List<Long> walletTypeIdList;
private Boolean isInclude;
private List<Long> deptIds;
@@ -10,6 +10,8 @@ import java.util.List;
@Data
public class WalletManageDto extends WalletManageEntity implements BaseIsIncludeTreeInterface {
private List<Long> walletTypeIdList;
private List<Long> userIds;
private List<Long> walletIds;
@@ -37,6 +37,8 @@ public class WalletTransactionDto extends WalletTransactionEntity implements Bas
private Long walletTypeId;
private List<Long> walletTypeIdList;
private List<String> bizTypes;
private LocalDate[] createTimeList;
@@ -30,6 +30,8 @@ public class WalletTransactionSumAndCountDto implements BaseIsIncludeTreeInterfa
private Long walletTypeId;
private List<Long> walletTypeIdList;
private Long walletId;
/**
@@ -8,31 +8,42 @@ public class WalletTypeTotalVo {
/**
* 总金额
*/
private Long totalPrice;
private Long totalPrice = 0L;
/**
* 总次数
*/
private Long totalTime;
private Long totalTime = 0L;
/**
* 消费钱包总金额
*/
private Long xfTotalPrice;
private Long xfTotalPrice = 0L;
/**
* 消费钱包总次数
*/
private Long xfTotalTime;
private Long xfTotalTime = 0L;
/**
* 饭卡钱包总金额
*/
private Long eatTotalPrice;
private Long eatTotalPrice = 0L;
/**
* 饭卡钱包总次数
*/
private Long eatTotalTime;
private Long eatTotalTime = 0L;
/**
* 充值钱包总金额
*/
private Long topupTotalPrice = 0L;
/**
* 充值钱包总次数
*/
private Long topupTotalTime = 0L;
}
@@ -34,6 +34,7 @@ public interface WalletManageMapper extends PjcloudBaseMapper<WalletManageEntity
.eq(ObjectUtil.isNotEmpty(dto.getIsFreeze()), WalletManageEntity::getIsFreeze, dto.getIsFreeze())
.in(ObjectUtil.isNotEmpty(dto.getWalletIds()), WalletManageEntity::getId, dto.getWalletIds())
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletManageEntity::getUserId, dto.getUserIds())
.in(ObjectUtil.isNotEmpty(dto.getWalletTypeIdList()), WalletManageEntity::getWalletTypeId, dto.getWalletTypeIdList())
.between(
ObjectUtil.isNotEmpty(dto.getCreateTimeList()),
WalletManageEntity::getCreateTime,
@@ -280,7 +280,9 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
});
List<Long> userIds = walletPage.getRecords().stream().map(WalletManageVo::getUserId).distinct().toList();
// 查询钱包类表
List<WalletTypeEntity> walletTypeList = walletTypeService.list();
WalletTypeDto walletTypeDto = new WalletTypeDto();
walletTypeDto.setWalletTypeIds(dto.getWalletTypeIdList());
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
if (ObjectUtil.isEmpty(walletTypeList)) return walletPage;
// 查询所有钱包类型的流水记录
for (WalletTypeEntity i : walletTypeList) {
@@ -308,7 +310,9 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
public WalletQbTotalVo qbTotal(WalletManageBalanceDto dto, DataScope dataScope) {
WalletQbTotalVo result = new WalletQbTotalVo();
// 查询钱包类表
List<WalletTypeEntity> walletTypeList = walletTypeService.list();
WalletTypeDto walletTypeDto = new WalletTypeDto();
walletTypeDto.setWalletTypeIds(dto.getWalletTypeIdList());
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
walletTypeList = walletTypeList.stream().filter(item -> ObjectUtil.equals(item.getId(), dto.getWalletTypeId())).toList();
}
@@ -305,7 +305,9 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
public WalletTypeTotalVo walletTypetotal(WalletTransactionDto dto, DataScope dataScope) {
WalletTypeTotalVo result = new WalletTypeTotalVo();
// 查询钱包类型
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(new WalletTypeDto());
WalletTypeDto walletTypeDto = new WalletTypeDto();
walletTypeDto.setWalletTypeIds(dto.getWalletTypeIdList());
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
if (ObjectUtil.isEmpty(walletTypeList)) return null;
for (WalletTypeEntity v : walletTypeList) {
WalletTransactionDto queryDto = BeanUtils.toBean(dto, WalletTransactionDto.class);
@@ -322,9 +324,14 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
result.setXfTotalTime(total.getTimeTotal());
continue;
}
if (ObjectUtil.equals(v.getUniqueCode(), WalletTypeEnum.TOPUP.getCode())) {
result.setTopupTotalPrice(total.getPriceTotal());
result.setTopupTotalTime(total.getTimeTotal());
continue;
}
}
result.setTotalPrice(result.getEatTotalPrice() + result.getXfTotalPrice());
result.setTotalTime(result.getEatTotalTime() + result.getXfTotalTime());
result.setTotalPrice(result.getEatTotalPrice() + result.getXfTotalPrice() + result.getTopupTotalPrice());
result.setTotalTime(result.getEatTotalTime() + result.getXfTotalTime() + result.getTopupTotalTime());
return result;
}
@@ -162,6 +162,12 @@
<if test="dto.walletTypeId != null">
and m.wallet_type_id = ${dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.type != null">
<if test="dto.type == 1">
and a.price &gt; 0
@@ -214,6 +220,12 @@
<if test="dto.walletTypeId != null">
and m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.type != null">
<if test="dto.type == 1">
and a.price &gt; 0
@@ -249,6 +261,12 @@
<if test="dto.walletTypeId != null">
and m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
</select>
@@ -264,6 +282,12 @@
<if test="dto.walletTypeId != null">
and m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
group by a.dept_id
</select>
@@ -294,6 +318,12 @@
<if test="dto.walletTypeId != null">
and m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
order by a.create_time desc, a.user_id desc
</select>
@@ -307,6 +337,12 @@
<if test="dto.walletTypeId != null">
and m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
order by a.create_time desc, a.user_id desc
</select>
@@ -320,6 +356,12 @@
<if test="dto.walletTypeId != null">
and m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.walletTypeIdList != null and dto.walletTypeIdList.size() != 0">
and m.wallet_type_id in
<foreach collection="dto.walletTypeIdList" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
order by a.create_time desc, a.user_id desc
</select>