From 5fbe0ab34f9d2df4f35a8da4b7f4adadc431b531 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 14 一月 2025 15:18:40 +0800 Subject: [PATCH] 修改bug --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java | 107 +++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 74 insertions(+), 33 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java index 82218b8..e8d1e6e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java @@ -90,42 +90,83 @@ @GetMapping("/commissionStatistics/info") @ApiOperation(value = "门店余额明细上方数据", notes = "门店余额明细", tags = {"门店后台"}) - public R<ShopBalanceDto> shopCommissionStatisticsinfo(){ + public R<ShopBalanceDto> shopCommissionStatisticsinfo(Integer type){ Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); ShopBalanceDto dto = new ShopBalanceDto(); - List<ShopBalanceStatement> list = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 3).list(); - List<ShopBalanceStatement> list1 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 1).list(); - BigDecimal bigDecimal1 = new BigDecimal(0); - for (ShopBalanceStatement shopBalanceStatement : list) { - bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount()); - } - for (ShopBalanceStatement shopBalanceStatement : list1) { - bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount()); - } - dto.setBigDecimal1(bigDecimal1); - - BigDecimal bigDecimal2= new BigDecimal(0); - for (ShopBalanceStatement shopBalanceStatement : list) { - bigDecimal2 = bigDecimal2.add(shopBalanceStatement.getVariableAmount()); - } - dto.setBigDecimal2(bigDecimal2); - - BigDecimal bigDecimal3= new BigDecimal(0); - for (ShopBalanceStatement shopBalanceStatement : list1) { - bigDecimal3 = bigDecimal3.add(shopBalanceStatement.getVariableAmount()); - } - dto.setBigDecimal3(bigDecimal3); - - List<ShopBalanceStatement> list2 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 2).list(); - BigDecimal bigDecimal4= new BigDecimal(0); - for (ShopBalanceStatement shopBalanceStatement : list2) { - bigDecimal4 = bigDecimal4.add(shopBalanceStatement.getVariableAmount()); - } - dto.setBigDecimal4(bigDecimal4); - Shop byId = shopService.getById(objectId); - dto.setBigDecimal5(byId.getCanWithdrawMoney()); - dto.setBigDecimal6(byId.getWithdrawMoney()); + + if (type==null){ + List<ShopBalanceStatement> list = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 3).list(); + List<ShopBalanceStatement> list1 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 1).list(); + BigDecimal bigDecimal1 = new BigDecimal(0); + for (ShopBalanceStatement shopBalanceStatement : list) { + bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount()); + } + for (ShopBalanceStatement shopBalanceStatement : list1) { + bigDecimal1 = bigDecimal1.add(shopBalanceStatement.getVariableAmount()); + } + dto.setBigDecimal1(bigDecimal1); + + BigDecimal bigDecimal2= new BigDecimal(0); + for (ShopBalanceStatement shopBalanceStatement : list) { + bigDecimal2 = bigDecimal2.add(shopBalanceStatement.getVariableAmount()); + } + dto.setBigDecimal2(bigDecimal2); + + BigDecimal bigDecimal3= new BigDecimal(0); + for (ShopBalanceStatement shopBalanceStatement : list1) { + bigDecimal3 = bigDecimal3.add(shopBalanceStatement.getVariableAmount()); + } + dto.setBigDecimal3(bigDecimal3); + + List<ShopBalanceStatement> list2 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 2).list(); + BigDecimal bigDecimal4= new BigDecimal(0); + for (ShopBalanceStatement shopBalanceStatement : list2) { + bigDecimal4 = bigDecimal4.add(shopBalanceStatement.getVariableAmount()); + } + dto.setBigDecimal4(bigDecimal4); + + dto.setBigDecimal5(byId.getCanWithdrawMoney()); + dto.setBigDecimal6(byId.getWithdrawMoney()); + return R.ok(dto); + }else{ + switch (type){ + case 1: + // 关联用户分拥 + BigDecimal bigDecimal = new BigDecimal("0"); + List<ShopBalanceStatement> list1 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 1).list(); + for (ShopBalanceStatement shopBalanceStatement : list1) { + bigDecimal = bigDecimal.add(shopBalanceStatement.getVariableAmount()); + } + dto.setBigDecimal3(bigDecimal); + dto.setBigDecimal1(bigDecimal); + break; + case 2: + // 下级门店分佣 + BigDecimal bigDecimal2= new BigDecimal(0); + List<ShopBalanceStatement> list2 = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 2).list(); + for (ShopBalanceStatement shopBalanceStatement : list2) { + bigDecimal2 = bigDecimal2.add(shopBalanceStatement.getVariableAmount()); + } + dto.setBigDecimal4(bigDecimal2); + dto.setBigDecimal1(bigDecimal2); + break; + case 3: + // 服务费分佣 + List<ShopBalanceStatement> list = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId,objectId).eq(ShopBalanceStatement::getType, 3).list(); + BigDecimal bigDecimal3= new BigDecimal(0); + for (ShopBalanceStatement shopBalanceStatement : list) { + bigDecimal3 = bigDecimal3.add(shopBalanceStatement.getVariableAmount()); + } + dto.setBigDecimal2(bigDecimal3); + dto.setBigDecimal1(bigDecimal3); + break; + case 4: + // 余额提现 + dto.setBigDecimal6(byId.getWithdrawMoney()); + break; + } + } return R.ok(dto); } -- Gitblit v1.7.1