feat:部门交易记录修改

This commit is contained in:
dzc committed 2025-02-19 10:04:26 +08:00
1 parent 641dbbc60c
commit 334b65799f
9 files changed
+84 -11

No files matched your search

@@ -14,8 +14,11 @@ public class HardOrderDto extends HardOrderEntity {
* 订单部门id极其子部门id
*/
private Long deptIdIdDeepen;
private List<Long> deptIds;
private Boolean isDeepDept = false;
private List<Long> userIds;
private List<Long> userDeptIds;
@@ -12,10 +12,10 @@ public class HardDeptTotalVo {
@Schema(description = "部门名")
private String deptName;
@Schema(description = "充值金额")
@Schema(description = "批量充值金额")
private Long walletPrice = 0L;
@Schema(description = "充值次数")
@Schema(description = "批量充值次数")
private Long walletCount = 0L;
@Schema(description = "消费金额")
@@ -3,7 +3,6 @@ package com.bsd.pjcloud.hard.controller.order;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
@@ -21,6 +21,7 @@ import com.bsd.pjcloud.hard.api.vo.order.HardOrderSumAndCountVo;
import com.bsd.pjcloud.hard.mapper.HardManagerMapper;
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
import com.bsd.pjcloud.hard.service.HardOrderTotalService;
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
import com.bsd.pjcloud.wallet.api.dto.WalletTransactionSumAndCountDto;
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletTransactionService;
@@ -35,6 +36,7 @@ import org.springframework.validation.annotation.Validated;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
@Validated
@Slf4j
@@ -51,6 +53,13 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
@Override
public Page<HardOrderSbVo> pageListSb(Page page, HardOrderDto dto) {
if (ObjectUtil.isNotEmpty(dto.getIsDeepDept()) && dto.getIsDeepDept() && ObjectUtil.isNotEmpty(dto.getDeptId())) {
List<SysDept> deptList = remoteDeptService.getDescendantList(dto.getDeptId()).getData();
dto.setDeptId(null);
if (ObjectUtil.isNotEmpty(deptList)) {
dto.setDeptIds(deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList()));
}
}
Page<HardOrderSbVo> list = hardOrderMapper.pageListSb(page, dto);
if (ObjectUtil.isNotEmpty(list)) {
// 商户
@@ -148,10 +157,11 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
item.setDeptName(v.getName());
return item;
}).toList();
// 查询钱包流水
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletFuture = CompletableFuture.supplyAsync(() -> {
// 查询钱包批量充值流水
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletBatchFuture = CompletableFuture.supplyAsync(() -> {
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
walletDto.setDeptIds(deptIds);
walletDto.setBizTypes(List.of(WalletBizEnum.BATCH.getCode()));
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
walletDto.setCreateTimeList(dto.getCreateTimeList());
}
@@ -186,15 +196,15 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
}
return hardOrderMapper.sumAndCount(refundDto);
});
CompletableFuture<Void> allFutures = CompletableFuture.allOf(walletFuture, payFuture, refundFuture);
CompletableFuture<Void> allFutures = CompletableFuture.allOf(walletBatchFuture, payFuture, refundFuture);
allFutures.join();
List<WalletTransactionSumAndCountVo> walletList = walletFuture.join();
List<WalletTransactionSumAndCountVo> walletBatchList = walletBatchFuture.join();
List<HardOrderSumAndCountVo> payList = payFuture.join();
List<HardOrderSumAndCountVo> refundList = refundFuture.join();
// 聚合一下数据
for (HardDeptTotalVo v : resultList) {
if (ObjectUtil.isNotEmpty(walletList)) {
walletList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
if (ObjectUtil.isNotEmpty(walletBatchList)) {
walletBatchList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
v.setWalletPrice(i.getSum());
v.setWalletCount(i.getCount());
});
@@ -77,6 +77,15 @@
<if test="dto.hourType != null and dto.hourType != '' ">
and a.hour_type = #{dto.hourType}
</if>
<if test="dto.deptId != null">
and a.dept_id = #{dto.deptId}
</if>
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
and a.dept_id in
<foreach collection="dto.deptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
<if test="dto.orderStatusCodes != null and dto.orderStatusCodes.size() != 0">
and a.order_status in
<foreach collection="dto.orderStatusCodes" item="v" open="(" close=")" separator=",">
@@ -48,6 +48,12 @@ public interface RemoteDeptService {
@GetMapping("/dept/list")
R<List<SysDept>> getAllDept(@RequestParam("parentDeptId") Long parentDeptId);
/**
* 查询所有部门包括被删除的
* 被删除的部门名有(被删除)标注
*
* @return
*/
@NoToken
@GetMapping("/dept/inner-all-dept")
R<List<SysDept>> getInnerAllDept();
@@ -92,7 +98,7 @@ public interface RemoteDeptService {
R<List<SysDept>> getParentDeptList(@RequestParam("deptId") Long deptId);
/**
* 获得指定部门的所有父部门
* 获得指定部门的所有子部门
*
* @param deptId
* @return
@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.vo.DeptExcelVO;
import com.bsd.pjcloud.admin.mapper.SysDeptMapper;
import com.bsd.pjcloud.admin.service.SysDeptService;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.excel.annotation.RequestExcel;
@@ -61,6 +62,8 @@ public class SysDeptController {
private final SysDeptService sysDeptService;
private final SysDeptMapper sysDeptMapper;
/**
* 通过ID查询
*
@@ -226,6 +229,6 @@ public class SysDeptController {
@Inner
@GetMapping("/inner-all-dept")
public R<List<SysDept>> getInnerAllDept() {
return R.ok(sysDeptService.list());
return R.ok(sysDeptMapper.allList());
}
}
@@ -23,6 +23,8 @@ import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 部门管理 Mapper 接口
@@ -34,4 +36,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysDeptMapper extends PjcloudBaseMapper<SysDept> {
List<SysDept> allList();
}
@@ -20,4 +20,44 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsd.pjcloud.admin.mapper.SysDeptMapper">
<resultMap id="sysDeptMap" type="com.bsd.pjcloud.admin.api.entity.SysDept">
<id property="deptId" column="dept_id"/>
<result property="name" column="name"/>
<result property="hardGroupId" column="hard_group_id"/>
<result property="sortOrder" column="sort_order"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<sql id="selectA">
select a.dept_id,
a.name,
a.hard_group_id,
a.sort_order,
a.create_by,
a.update_by,
a.create_time,
a.update_time,
a.del_flag,
a.parent_id,
a.tenant_id
</sql>
<select id="allList" resultType="com.bsd.pjcloud.admin.api.entity.SysDept">
select a.dept_id,
a.hard_group_id,
a.sort_order,
a.create_by,
a.update_by,
a.create_time,
a.update_time,
a.del_flag,
a.parent_id,
a.tenant_id,
if(a.del_flag != 0, CONCAT(a.name, '(已被删除)'), a.name) as name
from sys_dept a;
</select>
</mapper>