Pu Zhibing
2025-02-07 810d81a44d78bc3e7c42c2f116cc9968ab04baef
修改门店首页统计bug
4个文件已修改
40 ■■■■ 已修改文件
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopBalanceStatementClientFallbackFactory.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopBalanceStatementClient.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopBalanceStatementClientFallbackFactory.java
@@ -30,7 +30,7 @@
            }
            @Override
            public R<List<ShopBalanceStatement>> getShopBalanceStatementList2(Integer type, LocalDateTime date) {
            public R<List<ShopBalanceStatement>> getShopBalanceStatementList2(Integer type, Integer shopId, LocalDateTime date) {
                return R.fail();
            }
        };
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopBalanceStatementClient.java
@@ -38,6 +38,6 @@
    R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestParam("types") Collection<Integer> types, @RequestParam(value = "objectId",required = false) Long objectId);
    @PostMapping("/shop-balance-statement/getShopBalanceStatementList2")
    R<List<ShopBalanceStatement>> getShopBalanceStatementList2(@RequestParam("type") Integer type,
    R<List<ShopBalanceStatement>> getShopBalanceStatementList2(@RequestParam("type") Integer type, @RequestParam(value = "shopId") Integer shopId,
                                                               @RequestParam(value = "date") LocalDateTime date);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -993,13 +993,27 @@
        if (cd.getStartTime().isAfter(cd.getEndTime())) {
            return R.fail("开始时间不能大于结束时间");
        }
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        Map<String, Map<Integer, BigDecimal>> dailyVipCommissions = new TreeMap<>();
        getDatesBetween(cd.getStartTime(), cd.getEndTime()).forEach(date -> {
            for (int i = 1; i < 8; i++){
                List<BalanceChangeRecord> list = balanceChangeRecordService.list(new LambdaQueryWrapper<BalanceChangeRecord>()
                LambdaQueryWrapper<BalanceChangeRecord> queryWrapper = new LambdaQueryWrapper<BalanceChangeRecord>()
                        .between(BalanceChangeRecord::getCreateTime, date, date.plusDays(1))
                        .eq(BalanceChangeRecord::getChangeType,4)
                        .eq(BalanceChangeRecord::getVipId, i));
                        .eq(BalanceChangeRecord::getChangeType, 4)
                        .eq(BalanceChangeRecord::getVipId, i);
                if(sysUser.getRoleType() == 2){
                    Integer objectId = sysUser.getObjectId();
                    List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getShopId, objectId).eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1));
                    List<Long> appUserIds = list.stream().map(AppUser::getId).collect(Collectors.toList());
                    Set<Long> data = orderClient.getAppUserByShoppingShop(objectId).getData();
                    appUserIds.addAll(data);
                    if(appUserIds.size() == 0){
                        appUserIds.add(-1L);
                    }
                    queryWrapper.in(BalanceChangeRecord::getAppUserId, appUserIds);
                }
                List<BalanceChangeRecord> list = balanceChangeRecordService.list(queryWrapper);
                BigDecimal reduce = list.stream().map(BalanceChangeRecord::getChangeAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                String dateKey = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                dailyVipCommissions.computeIfAbsent(dateKey, k -> new HashMap<>())
@@ -1007,7 +1021,11 @@
            }
            for (int i = 1; i < 4; i++){
                R<List<ShopBalanceStatement>> r = shopBalanceStatementClient.getShopBalanceStatementList2(i, date);
                Integer objectId = 0;
                if(sysUser.getRoleType() == 2){
                    objectId = sysUser.getObjectId();
                }
                R<List<ShopBalanceStatement>> r = shopBalanceStatementClient.getShopBalanceStatementList2(i, objectId, date);
                if (!CollectionUtils.isEmpty(r.getData())){
                    List<ShopBalanceStatement> list = r.getData();
                    BigDecimal reduce = list.stream().map(ShopBalanceStatement::getVariableAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
@@ -217,11 +217,15 @@
    }
    @PostMapping("/getShopBalanceStatementList2")
    public R<List<ShopBalanceStatement>> getShopBalanceStatementList2(@RequestParam("type") Integer type,
    public R<List<ShopBalanceStatement>> getShopBalanceStatementList2(@RequestParam("type") Integer type, @RequestParam(value = "shopId") Integer shopId,
                                                                      @RequestParam(value = "date") LocalDateTime date){
        List<ShopBalanceStatement> list = shopBalanceStatementService.list(new LambdaQueryWrapper<ShopBalanceStatement>()
        LambdaQueryWrapper<ShopBalanceStatement> queryWrapper = new LambdaQueryWrapper<ShopBalanceStatement>()
                .eq(ShopBalanceStatement::getType, type)
                .between(ShopBalanceStatement::getCreateTime, date.with(LocalTime.MIN), date.with(LocalTime.MAX)));
                .between(ShopBalanceStatement::getCreateTime, date.with(LocalTime.MIN), date.with(LocalTime.MAX));
        if(null != shopId && 0 != shopId){
            queryWrapper.eq(ShopBalanceStatement::getShopId, shopId);
        }
        List<ShopBalanceStatement> list = shopBalanceStatementService.list(queryWrapper);
        return R.ok(list);
    }
}