feat:app查询商户全部流水记录
This commit is contained in:
1 parent
7a10979276
commit
3eaff4b3e3
5 files changed
+99
-2
No files matched your search
+25
-1
@@ -66,7 +66,7 @@ public class HardOrderTotalController {
|
||||
/* ************************************* start app start ************************************* */
|
||||
@Operation(summary = "app查询商户每天流水记录", description = "app查询订单列表根据权限")
|
||||
@GetMapping("/app/mch-water-day")
|
||||
public R appMchTotal(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
|
||||
public R appMchWaterDay(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
// 查询用户部门
|
||||
UserInfo userInfo = userService.getByUserId(user.getId()).getData();
|
||||
@@ -85,6 +85,30 @@ public class HardOrderTotalController {
|
||||
dto.setMchIds(mchDtoIds);
|
||||
return R.ok(hardOrderTotalService.listCsByDay(page, dto, user));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询商户全部流水记录", description = "app查询商户全部流水记录")
|
||||
@GetMapping("/app/mch-water-total")
|
||||
public R appMchWaterTotal(@ParameterObject HardOrderDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
// 查询用户部门
|
||||
UserInfo userInfo = userService.getByUserId(user.getId()).getData();
|
||||
dto.setIsFindCarList(false);
|
||||
// 判断是否为合作超市管理员工
|
||||
if (!hardManagerService.isSuperMarketAdmin(user)) return R.ok(new Page());
|
||||
// 查询用户属于的商户
|
||||
MchManageVo mch = mchService.getFirstMchByDeptId(userInfo.getSysUser().getDeptId()).getData();
|
||||
if (ObjectUtil.isEmpty(mch)) throw new RuntimeException("该用户下不存在商户");
|
||||
List<Long> mchDtoIds = new ArrayList<>(List.of(mch.getId()));
|
||||
// 查询商户和下面的子商户
|
||||
List<MchManageVo> mchList = mchService.getByParentId(mch.getId()).getData();
|
||||
// 查询子商户
|
||||
List<Long> mchIds = mchList.stream().map(MchManageVo::getId).toList();
|
||||
mchDtoIds.addAll(mchIds);
|
||||
dto.setMchIds(mchDtoIds);
|
||||
return R.ok(hardOrderTotalService.mchWaterTotal(dto, user));
|
||||
}
|
||||
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@PostMapping("/page-list-sb")
|
||||
|
||||
+2
@@ -101,6 +101,8 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
|
||||
List<HardOrderCsVo> listCsByDay(@Param("dto") HardOrderDto totalDto);
|
||||
|
||||
HardOrderCsVo listCsTotal(@Param("dto") HardOrderDto totalDto);
|
||||
|
||||
List<HardOrderPayTypeVo> listOrerPayType(@Param("dto") HardOrderDto dto);
|
||||
|
||||
List<HardOrderSumAndCountVo> sumAndCount(@Param("dto") HardOrderSumAndCountDto dto);
|
||||
|
||||
+6
@@ -26,6 +26,11 @@ public interface HardOrderTotalService {
|
||||
*/
|
||||
List<HardOrderCsVo> listCsByDay(Page page, HardOrderDto dto, PjcloudUser user);
|
||||
|
||||
/**
|
||||
* 查询商户总共流水记录
|
||||
*/
|
||||
HardOrderCsVo mchWaterTotal(HardOrderDto dto, PjcloudUser user);
|
||||
|
||||
/**
|
||||
* 部门交易记录
|
||||
*/
|
||||
@@ -45,4 +50,5 @@ public interface HardOrderTotalService {
|
||||
* 统计每天、每周、每月、每年的交易人数和次数
|
||||
*/
|
||||
HardChartLatitudeVo chartLatitude(Long merchantId);
|
||||
|
||||
}
|
||||
+56
-1
@@ -203,7 +203,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
|
||||
return hardOrderMapper.listCsByDay(refundDto);
|
||||
});
|
||||
// 盈利
|
||||
// 消费净次数
|
||||
CompletableFuture<List<HardOrderCsVo>> profitListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto profitDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
profitDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
@@ -244,6 +244,61 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
return totalList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商户总共流水记录
|
||||
*/
|
||||
@Override
|
||||
public HardOrderCsVo mchWaterTotal(HardOrderDto dto, PjcloudUser user) {
|
||||
HardOrderCsVo result = new HardOrderCsVo();
|
||||
// 查询总流水
|
||||
CompletableFuture<HardOrderCsVo> totalFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto totalDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
totalDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
|
||||
return hardOrderMapper.listCsTotal(totalDto);
|
||||
});
|
||||
// 扣款总流水
|
||||
CompletableFuture<HardOrderCsVo> refundFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto refundDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
|
||||
return hardOrderMapper.listCsTotal(refundDto);
|
||||
});
|
||||
// 消费净次数
|
||||
CompletableFuture<HardOrderCsVo> profitFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto profitDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
profitDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return hardOrderMapper.listCsTotal(profitDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(totalFuture, refundFuture, profitFuture);
|
||||
allFutures.join();
|
||||
HardOrderCsVo totalList = totalFuture.join();
|
||||
HardOrderCsVo refundList = refundFuture.join();
|
||||
HardOrderCsVo profitList = profitFuture.join();
|
||||
// 聚合一下数据
|
||||
if (ObjectUtil.isEmpty(totalList)) return result;
|
||||
if (ObjectUtil.isNotEmpty(refundList)) {
|
||||
if (ObjectUtil.isNotEmpty(refundList.getTotalPayPrice())) {
|
||||
totalList.setTotalRefundPrice(refundList.getTotalPayPrice());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(refundList.getTotalPayCount())) {
|
||||
totalList.setTotalRefundCount(refundList.getTotalPayCount());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
if (ObjectUtil.isNotEmpty(profitList.getTotalPayPrice())) {
|
||||
totalList.setTotalProfitPrice(profitList.getTotalPayPrice());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(profitList.getTotalPayCount())) {
|
||||
totalList.setTotalProfitCount(profitList.getTotalPayCount());
|
||||
}
|
||||
}
|
||||
// 商户
|
||||
MchManageVo mchDetail = remoteMchService.getById(totalList.getMerchantId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchDetail)) {
|
||||
WalletDataUtil.convertMch(result, mchDetail);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门交易记录
|
||||
*/
|
||||
|
||||
+10
@@ -255,6 +255,16 @@
|
||||
order by DATE_FORMAT(a.create_time, '%Y-%m-%d') desc, a.merchant_id desc
|
||||
</select>
|
||||
|
||||
<select id="listCsTotal" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderCsVo">
|
||||
select a.merchant_id,
|
||||
sum(a.pay_price) as totalPayPrice,
|
||||
count(0) as totalPayCount
|
||||
from hard_order a
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="listOrerPayType" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderPayTypeVo">
|
||||
select
|
||||
a.pay_type,
|
||||
|
||||
Reference in new issue
Block a user