feat:部门余额修改

This commit is contained in:
dzc committed 2025-10-23 17:09:47 +08:00
1 parent 8bb3f14337
commit 51cd3a9cf5
4 files changed
+46 -11

No files matched your search

@@ -359,7 +359,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
}
List<SysDept> deptList = remoteDeptService.getInnerAllDept(deptDto).getData();
if (ObjectUtil.isEmpty(deptList)) return null;
List<Long> deptIds = deptList.stream().map(SysDept::getDeptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
// List<Long> deptIds = deptList.stream().map(SysDept::getDeptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
List<HardDeptTotalVo> resultList = deptList.stream().map(v -> {
HardDeptTotalVo item = new HardDeptTotalVo();
item.setDeptId(v.getDeptId());
@@ -369,7 +369,8 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
// 查询钱包批量充值流水
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletBatchFuture = CompletableFuture.supplyAsync(() -> {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(deptIds);
walletDto.setDeptIds(dto.getDeptIds());
walletDto.setIsInclude(dto.getIsInclude());
walletDto.setBizTypes(List.of(WalletBizEnum.BATCH.getCode()));
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -383,7 +384,8 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
// 查询钱包批量扣减流水
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletReduceFuture = CompletableFuture.supplyAsync(() -> {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(deptIds);
walletDto.setDeptIds(dto.getDeptIds());
walletDto.setIsInclude(dto.getIsInclude());
walletDto.setBizTypes(List.of(WalletBizEnum.BATCH.getCode()));
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_EXPENSE);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -397,7 +399,8 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
// 查询钱包退还各自食堂
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletRetrunCanteenFuture = CompletableFuture.supplyAsync(() -> {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(deptIds);
walletDto.setDeptIds(dto.getDeptIds());
walletDto.setIsInclude(dto.getIsInclude());
walletDto.setBizTypes(List.of(WalletBizEnum.RETURN_CANTEEN.getCode()));
// walletDto.setType(WalletTransactionSumAndCountDto.TYPE_EXPENSE);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -411,7 +414,8 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
// 查询钱包单次充值流水
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletOnceBatchFuture = CompletableFuture.supplyAsync(() -> {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(deptIds);
walletDto.setDeptIds(dto.getDeptIds());
walletDto.setIsInclude(dto.getIsInclude());
walletDto.setBizTypes(List.of(WalletBizEnum.UPDATE.getCode()));
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -425,7 +429,8 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
// 查询钱包单次扣减流水
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletOnceReduceFuture = CompletableFuture.supplyAsync(() -> {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(deptIds);
walletDto.setDeptIds(dto.getDeptIds());
walletDto.setIsInclude(dto.getIsInclude());
walletDto.setBizTypes(List.of(WalletBizEnum.UPDATE.getCode()));
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_EXPENSE);
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -439,7 +444,8 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
// 查询订单支付流水
CompletableFuture<List<HardOrderSumAndCountVo>> payFuture = CompletableFuture.supplyAsync(() -> {
HardOrderSumAndCountDto payDto = new HardOrderSumAndCountDto();
payDto.setUserDeptIds(deptIds);
payDto.setUserDeptIds(dto.getDeptIds());
payDto.setIsInclude(dto.getIsInclude());
payDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
payDto.setCreateTimeList(dto.getCreateTimeList());
@@ -452,7 +458,8 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
// 查询订单退款流水
CompletableFuture<List<HardOrderSumAndCountVo>> refundFuture = CompletableFuture.supplyAsync(() -> {
HardOrderSumAndCountDto refundDto = new HardOrderSumAndCountDto();
refundDto.setUserDeptIds(deptIds);
refundDto.setUserDeptIds(dto.getDeptIds());
refundDto.setIsInclude(dto.getIsInclude());
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
refundDto.setRefundStatusCodes(List.of(HardSaleStatusEnum.COMPLETE.getStatus()));
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
@@ -476,6 +476,17 @@
</if>
<if test="dto.getUserDeptIds != null and dto.getUserDeptIds.size() != 0">
and o.user_dept_id in
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
and o.user_dept_id IN
</when>
<when test="dto.isInclude != null and dto.isInclude == false">
and o.user_dept_id NOT IN
</when>
<otherwise>
and o.user_dept_id IN
</otherwise>
</choose>
<foreach collection="dto.getUserDeptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
@@ -1,5 +1,6 @@
package com.bsd.pjcloud.wallet.api.dto;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -7,7 +8,7 @@ import java.time.LocalDateTime;
import java.util.List;
@Data
public class WalletTransactionSumAndCountDto {
public class WalletTransactionSumAndCountDto implements BaseIsIncludeTreeInterface {
/**
* 类型 - 收入
*/
@@ -31,4 +32,9 @@ public class WalletTransactionSumAndCountDto {
private Long walletId;
/**
* 是否包含deptIds
*/
private Boolean isInclude = false;
}
@@ -137,8 +137,9 @@
sum(a.price) as sum,
count(0) as count
from wallet_transaction a
left join wallet_manage m on m.id = a.wallet_id
<where>
a.del_flag = 0 and a.dept_id is not null
a.del_flag = 0 and m.dept_id is not null
<if test="dto.walletId != null">
a.wallet_id = ${dto.walletId}
</if>
@@ -159,7 +160,17 @@
</foreach>
</if>
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
and a.dept_id in
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
and m.dept_id IN
</when>
<when test="dto.isInclude != null and dto.isInclude == false">
and m.dept_id NOT IN
</when>
<otherwise>
and m.dept_id IN
</otherwise>
</choose>
<foreach collection="dto.deptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>