| | |
| | | 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; |
| | |
| | | ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(pageNum, pageSize), shopBalanceStatement); |
| | | return R.ok(shopCommissionStatisticsVO); |
| | | } |
| | | /** |
| | | * 导出门店分佣统计 |
| | | */ |
| | | @GetMapping("/export") |
| | | @ApiOperation("导出门店分佣统计") |
| | | public void export(HttpServletResponse response , ShopBalanceStatement shopBalanceStatement){ |
| | | ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(1, Integer.MAX_VALUE), shopBalanceStatement); |
| | | IPage<ShopBalanceStatement> statementIPage = shopCommissionStatisticsVO.getStatementIPage(); |
| | | ExcelUtil<ShopBalanceStatement> util = new ExcelUtil<>(ShopBalanceStatement.class); |
| | | util.exportExcel(response, statementIPage.getRecords(), "用户积分统计"); |
| | | } |
| | | @GetMapping("/commissionStatistics/list") |
| | | @ApiOperation(value = "门店余额明细", notes = "门店余额明细", tags = {"门店后台"}) |
| | | public R<Page<ShopBalanceStatement>> shopCommissionStatisticslist(@ApiParam("页码") @RequestParam Integer pageNum, |
| | |
| | | |
| | | @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); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出门店分佣统计 |
| | | */ |
| | | @GetMapping("/export") |
| | | @ApiOperation("导出门店分佣统计") |
| | | public void export(HttpServletResponse response , ShopBalanceStatement shopBalanceStatement){ |
| | | ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(1, Integer.MAX_VALUE), shopBalanceStatement); |
| | | IPage<ShopBalanceStatement> statementIPage = shopCommissionStatisticsVO.getStatementIPage(); |
| | | ExcelUtil<ShopBalanceStatement> util = new ExcelUtil<>(ShopBalanceStatement.class); |
| | | util.exportExcel(response, statementIPage.getRecords(), "用户积分统计"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | @RequestParam(value = "date") LocalDateTime date){ |
| | | List<ShopBalanceStatement> list = shopBalanceStatementService.list(new LambdaQueryWrapper<ShopBalanceStatement>() |
| | | .eq(ShopBalanceStatement::getType, type) |
| | | .in(ShopBalanceStatement::getCreateTime, date)); |
| | | .between(ShopBalanceStatement::getCreateTime, date.with(LocalTime.MIN), date.with(LocalTime.MAX))); |
| | | return R.ok(list); |
| | | } |
| | | } |