From e809f5955584e600d8612540ea814977c49774c2 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 27 八月 2025 23:51:54 +0800 Subject: [PATCH] 修改bug --- ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverPromotionActivityServiceImpl.java | 40 +++------------------------------------- 1 files changed, 3 insertions(+), 37 deletions(-) diff --git a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverPromotionActivityServiceImpl.java b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverPromotionActivityServiceImpl.java index 9395687..0376aa0 100644 --- a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverPromotionActivityServiceImpl.java +++ b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TDriverPromotionActivityServiceImpl.java @@ -3,6 +3,7 @@ import cn.hutool.system.UserInfo; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; +import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.dao.TDriverPromotionActivityMapper; import com.stylefeng.guns.modular.system.service.*; @@ -44,43 +45,8 @@ @Override public List<DriverRankVo> list1(Long id, String driverName) { - List<DriverRankVo> hashMaps = new ArrayList<>(); - - // 获取所有的司机 - Wrapper<TDriver> flag = new EntityWrapper<TDriver>().ne("flag", 3); - if (driverName != null && !"".equals(driverName)) { - flag.like("name", driverName); - } - - List<TDriver> tDrivers = driverService.selectList(flag); - - // 获取绑定的司机的用户 - List<TUser> tUsers = userService.selectList(new EntityWrapper<TUser>().isNotNull("bindDriverId").gt("bindExpireDate", new Date())); - - // 获取所有获得司机收益的订单 - List<TOrderPrivateCar> tOrderPrivateCars = orderPrivateCarService.selectList(new EntityWrapper<TOrderPrivateCar>().eq("promotionActivityId",id).isNotNull("promotionDriverId").isNotNull("successTime")); - List<TOrderTaxi> tOrderTaxis = orderTaxiService.selectList(new EntityWrapper<TOrderTaxi>().eq("promotionActivityId",id).isNotNull("promotionDriverId").isNotNull("successTime")); - List<TOrderCrossCity> tOrderCrossCities = orderCrossCityService.selectList(new EntityWrapper<TOrderCrossCity>().eq("promotionActivityId",id).isNotNull("promotionDriverId").isNotNull("successTime")); - - - for (TDriver tDriver : tDrivers) { - DriverRankVo driverRankVo = new DriverRankVo(); - driverRankVo.setActivityId(id); - driverRankVo.setDriverId(tDriver.getId()); - driverRankVo.setDriverName(tDriver.getName()); - long count = tUsers.stream().filter(e -> tDriver.getId().equals(e.getBindDriverId())).count(); - driverRankVo.setUserNum((int) count); - - BigDecimal reduce = tOrderPrivateCars.stream().filter(e -> tDriver.getId().equals(e.getPromotionDriverId())).map(TOrderPrivateCar::getPromotionMoney).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal reduce1 = tOrderTaxis.stream().filter(e -> tDriver.getId().equals(e.getPromotionDriverId())).map(TOrderTaxi::getPromotionMoney).reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal reduce2 = tOrderCrossCities.stream().filter(e -> tDriver.getId().equals(e.getPromotionDriverId())).map(TOrderCrossCity::getPromotionMoney).reduce(BigDecimal.ZERO, BigDecimal::add); - driverRankVo.setMoney(reduce.add(reduce1).add(reduce2)); - hashMaps.add(driverRankVo); - } -// hashMaps.stream().sorted(Comparator.comparing(e -> Integer.valueOf(e.get("userNum").toString())).reversed()).collect(Collectors.toList()) - // hashMaps 通过userNUm 倒叙 - List<DriverRankVo> collect = hashMaps.stream().sorted(Comparator.comparing(DriverRankVo::getUserNum).reversed()).collect(Collectors.toList()); - return collect; + List<DriverRankVo> driverPromotionActivity = orderPrivateCarService.getDriverPromotionActivity(id.intValue(), driverName); + return driverPromotionActivity; } @Override -- Gitblit v1.7.1