From c8e2fab9ae930401aabdd6c2d461aa6b8828829f Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 05 六月 2023 14:56:31 +0800
Subject: [PATCH] 更新支付功能
---
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java | 56 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java
index 03b5969..61bea73 100644
--- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java
+++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TBranchOfficeServiceImpl.java
@@ -76,7 +76,8 @@
// 优惠券数据,,,通过订单找到该区域的下单人,找出优惠券信息
List<Integer> userIds = orders.stream().map(TOrder::getUserId).collect(Collectors.toList());
- List<TUserToCoupon> tUserToCoupons = tUserToCouponMapper.selectList(new EntityWrapper<TUserToCoupon>().in("userId", userIds));
+ List<TUserToCoupon> tUserToCoupons = tUserToCouponMapper.selectList(new EntityWrapper<TUserToCoupon>().eq("objectId", tBranchOfficeId)
+ .eq("roleType",2));
// 优惠券有效数量
int validCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum();
// 过期数量
@@ -127,6 +128,7 @@
wrapper.eq("status",status);
}
wrapper.ne("status", StatusEnum.DELETE.getCode());
+ wrapper.orderBy("createTime",false);
// 判断代理商 分公司
Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType();
Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId();
@@ -152,9 +154,13 @@
public void queryOtherInfo(List<TBranchOfficeResp> tBranchOfficeRespList) {
List<TOrder> orders = tOrderMapper.selectList(new EntityWrapper<TOrder>());
+
for (TBranchOfficeResp tBranchOfficeResp : tBranchOfficeRespList) {
List<TOrder> orderList = orders.stream().filter(t -> tBranchOfficeResp.getId().equals(t.getBranchOfficeId())).collect(Collectors.toList());
+
+ List<TUserToCoupon> tUserToCoupons = tUserToCouponMapper.selectList(new EntityWrapper<TUserToCoupon>().eq("objectId", tBranchOfficeResp.getId())
+ .eq("roleType",2));
if(!CollectionUtils.isEmpty(orderList)){
@@ -165,29 +171,29 @@
// 优惠券数据,,,通过订单找到该区域的下单人,找出优惠券信息
List<Integer> userIds = orderList.stream().map(TOrder::getUserId).collect(Collectors.toList());
- List<TUserToCoupon> tUserToCoupons = tUserToCouponMapper.selectList(new EntityWrapper<TUserToCoupon>().in("userId", userIds));
- // 优惠券有效数量
- int validCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum();
- // 过期数量
- int expireCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getExpireCount).sum();
- // 总数量
- int totalCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum();
- // 已使用优惠券;总数量减去有效数量
- tBranchOfficeResp.setUsedCount(totalCount-validCount-expireCount);
-
- // 已发放优惠券
- tBranchOfficeResp.setTotalCount(totalCount);
-
- BigDecimal orderPriceCount = new BigDecimal("0");
-
- // 累计优惠券金额
- for (TUserToCoupon tUserToCoupon : tUserToCoupons) {
- TCoupon tCoupon = tCouponMapper.selectById(tUserToCoupon.getCouponId());
- BigDecimal price = tCoupon.getCouponPreferentialAmount().multiply(new BigDecimal(tUserToCoupon.getCouponTotal()));
- orderPriceCount = orderPriceCount.add(price);
- }
- tBranchOfficeResp.setOrderPriceCount(orderPriceCount);
}
+
+ // 优惠券有效数量
+ int validCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum();
+ // 过期数量
+ int expireCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getExpireCount).sum();
+ // 总数量
+ int totalCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum();
+ // 已使用优惠券;总数量减去有效数量
+ tBranchOfficeResp.setUsedCount(totalCount-validCount-expireCount);
+
+ // 已发放优惠券
+ tBranchOfficeResp.setTotalCount(totalCount);
+
+ BigDecimal orderPriceCount = new BigDecimal("0");
+ // 累计优惠券金额
+ for (TUserToCoupon tUserToCoupon : tUserToCoupons) {
+ TCoupon tCoupon = tCouponMapper.selectById(tUserToCoupon.getCouponId());
+ BigDecimal price = tCoupon.getCouponPreferentialAmount().multiply(new BigDecimal(tUserToCoupon.getCouponTotal()));
+ orderPriceCount = orderPriceCount.add(price);
+ }
+ tBranchOfficeResp.setOrderPriceCount(orderPriceCount);
+
// 司机数量
Integer driverCount = tDriverMapper.selectCount(new EntityWrapper<TDriver>().eq("branchOfficeId", tBranchOfficeResp.getId()));
tBranchOfficeResp.setDriverCount(driverCount);
@@ -221,8 +227,8 @@
tBranchOffice.setDistrictName(area.getName());
tBranchOffice.setDistrictCode(area.getCode());
}else {
- tBranchOffice.setDistrictName("");
- tBranchOffice.setDistrictCode("");
+ tBranchOffice.setDistrictName(city.getName());
+ tBranchOffice.setDistrictCode(city.getCode());
}
// 通过省市查询代理商
--
Gitblit v1.7.1