| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserPoint; |
| | | import com.ruoyi.account.mapper.UserPointMapper; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserPointService; |
| | | import com.ruoyi.account.vo.UserPointDetailVO; |
| | |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.time.LocalTime; |
| | | import java.time.YearMonth; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "积分变更记录", tags = "管理后台-财务统计-用户积分统计") |
| | | public R<Page<UserPoint>> list(@ApiParam("页码") @RequestParam Integer pageNum, @ApiParam("大小") Integer pageSize, UserPoint userPoint) { |
| | | List<String> userIds = appUserService.listObjs(new LambdaQueryWrapper<AppUser>() |
| | | .select(AppUser::getId) |
| | | .eq(AppUser::getPhone, userPoint.getPhone()) |
| | | .like(AppUser::getName, userPoint.getUserName()), String::valueOf); |
| | | public R<IPage<UserPoint>> list(UserPoint userPoint) { |
| | | IPage<UserPoint> userPointPage = userPointService.getUserPointPage(Page.of(userPoint.getPageNum(), userPoint.getPageSize()), userPoint); |
| | | return R.ok(userPointPage); |
| | | } |
| | | |
| | | Page<UserPoint> page = userPointService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<UserPoint>() |
| | | .in(!CollectionUtils.isEmpty(userIds), UserPoint::getAppUserId, userIds) |
| | | .eq(UserPoint::getType, userPoint.getType()) |
| | | .between(UserPoint::getCreateTime, userPoint.getStartTime(), userPoint.getEndTime()) |
| | | .orderByDesc(UserPoint::getCreateTime)); |
| | | @GetMapping("/user/list") |
| | | @ApiOperation(value = "积分管理-用户积分明细(必传用户id)", tags = "后台") |
| | | public R<Page<UserPoint>> userlist(UserPoint userPoint) { |
| | | Page<UserPoint> page = userPointService.lambdaQuery().eq(UserPoint::getAppUserId, userPoint.getAppUserId()).orderByDesc(UserPoint::getCreateTime).page(Page.of(userPoint.getPageNum(), userPoint.getPageSize())); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 导出 |
| | |
| | | @GetMapping("/export") |
| | | @ApiOperation(value = "积分变更记录导出", tags = "管理后台-财务统计-用户积分统计") |
| | | public void export(HttpServletResponse response, UserPoint userPoint) { |
| | | List<String> userIds = appUserService.listObjs(new LambdaQueryWrapper<AppUser>() |
| | | .select(AppUser::getId) |
| | | .eq(AppUser::getPhone, userPoint.getPhone()) |
| | | .like(AppUser::getName, userPoint.getUserName()), String::valueOf); |
| | | |
| | | List<UserPoint> userPointList = userPointService.list(new LambdaQueryWrapper<UserPoint>() |
| | | .in(!CollectionUtils.isEmpty(userIds), UserPoint::getAppUserId, userIds) |
| | | .eq(UserPoint::getType, userPoint.getType()) |
| | | .between(UserPoint::getCreateTime, userPoint.getStartTime(), userPoint.getEndTime()) |
| | | .orderByDesc(UserPoint::getCreateTime)); |
| | | |
| | | ExcelUtil<UserPoint> util = new ExcelUtil<UserPoint>(UserPoint.class); |
| | | IPage<UserPoint> userPointPage = userPointService.getUserPointPage(Page.of(1, Integer.MAX_VALUE), userPoint); |
| | | List<UserPoint> userPointList = userPointPage.getRecords(); |
| | | ExcelUtil<UserPoint> util = new ExcelUtil<>(UserPoint.class); |
| | | util.exportExcel(response, userPointList, "用户积分统计"); |
| | | } |
| | | |