| | |
| | | |
| | | @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(); |
| | | Shop byId = shopService.getById(objectId); |
| | | |
| | | 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); |
| | |
| | | } |
| | | dto.setBigDecimal4(bigDecimal4); |
| | | |
| | | Shop byId = shopService.getById(objectId); |
| | | 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); |
| | | } |
| | | |
| | | |