ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -715,6 +715,7 @@ if(sysUser.getRoleType() == 2){ queryWrapper.eq(AppUser::getShopId, sysUser.getObjectId()); } queryWrapper.orderByAsc(AppUser::getCreateTime); List<AppUser> appUserList = appUserService.list(queryWrapper); if (appUserList.isEmpty()) { return R.ok(new CommissionDetail()); @@ -723,7 +724,7 @@ BigDecimal totalServiceFee = BigDecimal.ZERO; BigDecimal totalUserCommission = BigDecimal.ZERO; Map<Integer, BigDecimal> vipCommissions = new HashMap<>(); Map<String, Map<Integer, BigDecimal>> dailyVipCommissions = new HashMap<>(); Map<String, Map<Integer, BigDecimal>> dailyVipCommissions = new TreeMap<>(); for (AppUser appUser : appUserList) { BigDecimal distributionAmount = Optional.ofNullable(appUser.getTotalDistributionAmount()).orElse(BigDecimal.ZERO); totalCommission = totalCommission.add(distributionAmount); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
@@ -62,34 +62,14 @@ ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement(); shopBalanceStatement.setType(1); List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord); List<WalletStatisticsDetail> walletStatisticsDetailList = new ArrayList<>(); for (BalanceChangeRecord changeRecord : balanceChangeRecordList) { IPage<BalanceChangeRecord> balanceChangeRecordIPage = this.baseMapper.queryCommissionStatistics(page, balanceChangeRecord); IPage<WalletStatisticsDetail> walletStatisticsDetailIPage = balanceChangeRecordIPage.convert(changeRecord -> { WalletStatisticsDetail walletStatisticsDetail = new WalletStatisticsDetail(); BeanUtils.copyBeanProp(walletStatisticsDetail, changeRecord); walletStatisticsDetailList.add(walletStatisticsDetail); } return walletStatisticsDetail; }); // 按时间排序(倒序) walletStatisticsDetailList.sort(Comparator.comparing(WalletStatisticsDetail::getCreateTime).reversed()); long current = page.getCurrent(); long size = page.getSize(); if (current < 1) { current = 1; } int fromIndex = (int) ((current - 1) * size); int toIndex = (int) Math.min(fromIndex + size, walletStatisticsDetailList.size()); if (fromIndex >= walletStatisticsDetailList.size()) { throw new ServiceException("页面参数无效"); } List<WalletStatisticsDetail> walletStatisticsDetailList2 = walletStatisticsDetailList.subList(fromIndex, toIndex); Map<Integer, BigDecimal> shopCommissionMap = walletStatisticsDetailList.stream() Map<Integer, BigDecimal> shopCommissionMap = walletStatisticsDetailIPage.getRecords().stream() .collect(Collectors.groupingBy( WalletStatisticsDetail::getChangeType, Collectors.reducing( @@ -105,12 +85,7 @@ WalletStatistics walletStatistics = new WalletStatistics(); Page<WalletStatisticsDetail> page1 = new Page<>(); page1.setRecords(walletStatisticsDetailList2); page1.setTotal(walletStatisticsDetailList.size()); page1.setCurrent(current); page1.setSize(size); walletStatistics.setPage(page1); walletStatistics.setPage(walletStatisticsDetailIPage); walletStatistics.setTotalRecharge(totalRecharge); walletStatistics.setTotalWithdraw(totalWithdraw); walletStatistics.setTotalShopWithdraw(totalShopWithdraw); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -1141,8 +1141,7 @@ //处理优惠券 if(null != order.getUserCouponId()){ UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData(); if(null != userCoupon && 1 == userCoupon.getStatus()){ userCoupon.setStatus(2); if(null != userCoupon && null == userCoupon.getUseTime()){ userCoupon.setUseTime(LocalDateTime.now()); userCouponClient.editUserCoupon(userCoupon); } @@ -1367,7 +1366,7 @@ //处理优惠券 if(null != order.getUserCouponId()){ UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData(); if(null != userCoupon && 1 == userCoupon.getStatus()){ if(null != userCoupon && null == userCoupon.getUseTime()){ userCoupon.setStatus(2); userCoupon.setUseTime(LocalDateTime.now()); userCouponClient.editUserCoupon(userCoupon); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java
@@ -66,11 +66,11 @@ @PostMapping("/addRedPackegeSet") @Transactional(rollbackFor = Exception.class) public R<Void> addRedPackegeSet(@RequestBody RedPackegeSetDto redPackegeSets){ redPackegeSetService.remove(null); List<RedPackegeSet> redPackegeSetList = redPackegeSets.getRedPackegeSets(); if (hasOverlap(redPackegeSetList)) { R.fail("时间段存在重叠,请重新配置"); return R.fail("时间段存在重叠,请重新配置"); } redPackegeSetService.remove(null); redPackegeSetService.saveBatch(redPackegeSetList); return R.ok(); } @@ -85,7 +85,7 @@ return R.ok(); } private boolean hasOverlap(List<RedPackegeSet> redPackegeSetList) { public static boolean hasOverlap(List<RedPackegeSet> redPackegeSetList) { // 首先根据startTime对列表进行排序 Collections.sort(redPackegeSetList, Comparator.comparing(RedPackegeSet::getStartTime)); @@ -104,6 +104,22 @@ return false; } public static void main(String[] args) { // 示例数据 RedPackegeSet redPackegeSet = new RedPackegeSet(); redPackegeSet.setStartTime(LocalDateTime.of(2025, 1, 13, 0, 0)); redPackegeSet.setEndTime(LocalDateTime.of(2025, 1, 14, 0, 0)); RedPackegeSet redPackegeSet2 = new RedPackegeSet(); redPackegeSet2.setStartTime(LocalDateTime.of(2025, 1, 13, 0, 0)); redPackegeSet2.setEndTime(LocalDateTime.of(2025, 1, 14, 0, 0)); List<RedPackegeSet> redPackegeSetList = Arrays.asList( redPackegeSet,redPackegeSet2 ); boolean overlapExists = hasOverlap(redPackegeSetList); System.out.println("是否存在重叠: " + overlapExists); }