From 6ccd0f9e28c083e5f62d7d5074a85584a77af6bb Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 14 一月 2025 17:09:02 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java | 125 +++++++++++++++++++++++++++++------------ 1 files changed, 89 insertions(+), 36 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 86a05d4..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 @@ -25,6 +25,8 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalTime; import java.util.Collection; import java.util.List; import java.util.List; @@ -88,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); } @@ -165,9 +208,19 @@ * @return */ @PostMapping("/getShopBalanceStatementList") - public R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestParam("types") Collection<Integer> types, @RequestParam("objectId") Long objectId){ - List<ShopBalanceStatement> list = shopBalanceStatementService.list(new LambdaQueryWrapper<ShopBalanceStatement>().eq(ShopBalanceStatement::getObjectId, objectId) - .in(ShopBalanceStatement::getType, types)); + public R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestParam("types") Collection<Integer> types, @RequestParam(value = "objectId",required = false) Long objectId){ + List<ShopBalanceStatement> list = shopBalanceStatementService.list(new LambdaQueryWrapper<ShopBalanceStatement>() + .eq(objectId != null,ShopBalanceStatement::getObjectId, objectId) + .in(types !=null && !types.isEmpty(),ShopBalanceStatement::getType, types)); + return R.ok(list); + } + + @PostMapping("/getShopBalanceStatementList2") + public R<List<ShopBalanceStatement>> getShopBalanceStatementList2(@RequestParam("type") Integer type, + @RequestParam(value = "date") LocalDateTime date){ + List<ShopBalanceStatement> list = shopBalanceStatementService.list(new LambdaQueryWrapper<ShopBalanceStatement>() + .eq(ShopBalanceStatement::getType, type) + .between(ShopBalanceStatement::getCreateTime, date.with(LocalTime.MIN), date.with(LocalTime.MAX))); return R.ok(list); } } -- Gitblit v1.7.1