流水金额、流水次数、净流水、净流水次数
This commit is contained in:
1 parent
65026ed042
commit
63ad442825
3 files changed
+22
-41
No files matched your search
-1
@@ -127,5 +127,4 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
List<HardOrderSumAndCountVo> sumAndCountTotalByHourType(@Param("dto") HardOrderSumAndCountDto dto);
|
||||
|
||||
HardZyCardSyncVo totalYearMonthDay(@Param("dto") HardOrderDto hardOrderDto);
|
||||
|
||||
}
|
||||
+11
-24
@@ -404,23 +404,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
}
|
||||
return hardOrderMapper.refundSumAndCount(refundDto);
|
||||
});
|
||||
// 消费净次数
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> profitFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto refundDto = new HardOrderSumAndCountDto();
|
||||
refundDto.setUserDeptIds(deptIds);
|
||||
refundDto.setIsRefundSuccess(true);
|
||||
List<String> paySuccessCodes = new ArrayList<>(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
paySuccessCodes.add(HardOrderStatusEnum.REFUND.getType());
|
||||
refundDto.setOrderStatusCodes(paySuccessCodes);
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
refundDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
refundDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return hardOrderMapper.sumAndCount(refundDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(walletBatchFuture, walletReduceFuture, payFuture, refundFuture, walletOnceBatchFuture, walletOnceReduceFuture, profitFuture);
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(walletBatchFuture, walletReduceFuture, payFuture, refundFuture, walletOnceBatchFuture, walletOnceReduceFuture);
|
||||
allFutures.join();
|
||||
List<WalletTransactionSumAndCountVo> walletBatchList = walletBatchFuture.join();
|
||||
List<WalletTransactionSumAndCountVo> walletReduceList = walletReduceFuture.join();
|
||||
@@ -428,7 +412,6 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
List<WalletTransactionSumAndCountVo> walletOnceReduceList = walletOnceReduceFuture.join();
|
||||
List<HardOrderSumAndCountVo> payList = payFuture.join();
|
||||
List<HardOrderSumAndCountVo> refundList = refundFuture.join();
|
||||
List<HardOrderSumAndCountVo> profitList = profitFuture.join();
|
||||
// 聚合一下数据
|
||||
for (HardDeptTotalVo v : resultList) {
|
||||
if (ObjectUtil.isNotEmpty(walletBatchList)) {
|
||||
@@ -469,12 +452,16 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
v.setOrderRefundCont(i.getCount());
|
||||
});
|
||||
}
|
||||
// 查看盈利流水
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setOrderProfitPrice(i.getSum());
|
||||
v.setOrderProfitCont(i.getCount());
|
||||
});
|
||||
}
|
||||
// 计算净流水
|
||||
for (HardDeptTotalVo v : resultList) {
|
||||
// 流水金额
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderPayPrice())) {
|
||||
v.setOrderProfitPrice(v.getOrderPayPrice() - v.getOrderRefundPrice());
|
||||
}
|
||||
// 流水次数
|
||||
if (ObjectUtil.isNotEmpty(v.getOrderPayCount())) {
|
||||
v.setOrderProfitCont(v.getOrderPayCount() - v.getOrderRefundCont());
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
|
||||
+11
-16
@@ -309,7 +309,7 @@
|
||||
<select id="sumAndCount" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderSumAndCountVo">
|
||||
select
|
||||
a.user_dept_id as deptId,
|
||||
sum(a.pay_price) as sum,
|
||||
sum(a.pay_price - ifnull(a.refund_price, 0)) as sum,
|
||||
count(0) as count
|
||||
from hard_order a
|
||||
<where>
|
||||
@@ -343,42 +343,37 @@
|
||||
</select>
|
||||
|
||||
<select id="refundSumAndCount" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderSumAndCountVo">
|
||||
select
|
||||
a.user_dept_id as deptId,
|
||||
sum(a.pay_price) as sum,
|
||||
count(0) as count
|
||||
from hard_order a
|
||||
inner join hard_after_sale r on r.order_id = a.id and r.del_flag = '0' and r.status = '50'
|
||||
select o.user_dept_id as deptId,sum(ifnull(a.refund_price, 0)) as sum, count(0) as count
|
||||
from hard_after_sale a
|
||||
inner join hard_order o on o.id = a.order_id and o.del_flag = '0'
|
||||
<where>
|
||||
a.del_flag = 0
|
||||
<if test="dto.walletTypeId != null">
|
||||
</if>
|
||||
a.del_flag = '0'
|
||||
<if test="dto.orderStatusCodes != null and dto.orderStatusCodes.size() != 0">
|
||||
and a.order_status in
|
||||
and o.order_status in
|
||||
<foreach collection="dto.orderStatusCodes" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.getUserDeptIds != null and dto.getUserDeptIds.size() != 0">
|
||||
and a.user_dept_id in
|
||||
and o.user_dept_id in
|
||||
<foreach collection="dto.getUserDeptIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
and o.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.refundTimeList != null and dto.refundTimeList.length == 2">
|
||||
and r.audit_time between #{dto.refundTimeList[0]} and #{dto.refundTimeList[1]}
|
||||
and a.audit_time between #{dto.refundTimeList[0]} and #{dto.refundTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.mchIds != null and dto.mchIds.size() != 0">
|
||||
and a.merchant_id in
|
||||
and o.merchant_id in
|
||||
<foreach collection="dto.mchIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by a.user_dept_id
|
||||
group by o.user_dept_id
|
||||
</select>
|
||||
|
||||
<select id="sumAndCountTotalByHourType" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderSumAndCountVo">
|
||||
|
||||
Reference in new issue
Block a user