| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | import com.ruoyi.other.dto.ShopBalanceDto; |
| | | import com.ruoyi.other.service.ShopBalanceStatementService; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.vo.ShopCommissionStatisticsVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class ShopBalanceStatementController { |
| | | @Resource |
| | | private ShopBalanceStatementService shopBalanceStatementService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 门店分佣统计 |
| | |
| | | } |
| | | @GetMapping("/commissionStatistics/list") |
| | | @ApiOperation(value = "门店余额明细", notes = "门店余额明细", tags = {"门店后台"}) |
| | | public R<ShopCommissionStatisticsVO> shopCommissionStatisticslist(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | public R<Page<ShopBalanceStatement>> shopCommissionStatisticslist(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | ShopBalanceStatement shopBalanceStatement){ |
| | | ShopCommissionStatisticsVO shopCommissionStatisticsVO = shopBalanceStatementService.shopCommissionStatistics(Page.of(pageNum, pageSize), shopBalanceStatement); |
| | | return R.ok(shopCommissionStatisticsVO); |
| | | Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); |
| | | Page<ShopBalanceStatement> page = shopBalanceStatementService.lambdaQuery().eq(ShopBalanceStatement::getShopId, objectId).eq(shopBalanceStatement.getType() != null, ShopBalanceStatement::getType, shopBalanceStatement.getType()) |
| | | .orderByDesc(ShopBalanceStatement::getCreateTime) |
| | | .page(Page.of(pageNum, pageSize)); |
| | | |
| | | return R.ok(page); |
| | | |
| | | |
| | | } |
| | | |
| | | @Resource |
| | | private ShopService shopService; |
| | | @GetMapping("/commissionStatistics/info") |
| | | @ApiOperation(value = "门店余额明细上方数据", notes = "门店余额明细", tags = {"门店后台"}) |
| | | public R<ShopBalanceDto> shopCommissionStatisticsinfo(){ |
| | | 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, 4).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()); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出门店分佣统计 |
| | | */ |