抽奖详情(PC)
抽奖用户列表(PC)
release-2024-04-25
huangyawei 4 months ago
parent a18a8ca557
commit 13603d06c6

@ -9,9 +9,7 @@ import com.luoo.user.service.DrawLotteryService;
import com.luoo.user.service.LotteryService; import com.luoo.user.service.LotteryService;
import com.luoo.user.service.TaskPointService; import com.luoo.user.service.TaskPointService;
import com.luoo.user.service.UserPointLogService; import com.luoo.user.service.UserPointLogService;
import com.luoo.user.vo.point.LotteryAPPVO; import com.luoo.user.vo.point.*;
import com.luoo.user.vo.point.LotteryPCVO;
import com.luoo.user.vo.point.UserPointLogVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -49,120 +47,120 @@ import org.springframework.web.bind.annotation.RestController;
@Api(tags = "积分模块") @Api(tags = "积分模块")
public class PointController { public class PointController {
@Autowired @Autowired
private TaskPointService taskPointService; private TaskPointService taskPointService;
@Autowired @Autowired
private UserPointLogService userPointLogService; private UserPointLogService userPointLogService;
@Autowired @Autowired
private LotteryService lotteryService; private LotteryService lotteryService;
@Autowired @Autowired
private DrawLotteryService drawLotteryService; private DrawLotteryService drawLotteryService;
@ApiOperation(value = "1.1.新增任务积分配置(PC)", notes = "仅限admin权限用户调用") @ApiOperation(value = "1.1.新增任务积分配置(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/task/add") @PostMapping("/task/add")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "taskPoint", value = "任务积分配置", required = true, dataType = "TaskPoint", paramType = "body"), @ApiImplicitParam(name = "taskPoint", value = "任务积分配置", required = true, dataType = "TaskPoint", paramType = "body"),
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")}) @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")})
public Result<Void> add( public Result<Void> add(
@RequestHeader(value = "Authorization", required = true) String authorization, @RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody TaskPointDto taskPointDto) { @RequestBody TaskPointDto taskPointDto) {
TaskPoint taskPoint = new TaskPoint(); TaskPoint taskPoint = new TaskPoint();
BeanUtils.copyProperties(taskPointDto, taskPoint); BeanUtils.copyProperties(taskPointDto, taskPoint);
taskPointService.add(taskPoint, authorization); taskPointService.add(taskPoint, authorization);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "1.2.修改任务积分配置(PC)", notes = "仅限admin权限用户调用") @ApiOperation(value = "1.2.修改任务积分配置(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/task/update") @PostMapping("/task/update")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "taskPoint", value = "任务积分配置", required = true, dataType = "TaskPoint", paramType = "body"), @ApiImplicitParam(name = "taskPoint", value = "任务积分配置", required = true, dataType = "TaskPoint", paramType = "body"),
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")} @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")}
) )
public Result<Void> update( public Result<Void> update(
@RequestHeader(value = "Authorization", required = true) String authorization, @RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody TaskPointDto taskPointDto) { @RequestBody TaskPointDto taskPointDto) {
TaskPoint taskPoint = new TaskPoint(); TaskPoint taskPoint = new TaskPoint();
BeanUtils.copyProperties(taskPointDto, taskPoint); BeanUtils.copyProperties(taskPointDto, taskPoint);
taskPointService.update(taskPoint, authorization); taskPointService.update(taskPoint, authorization);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "1.3.批量修改任务积分配置(PC)", notes = "仅限admin权限用户调用") @ApiOperation(value = "1.3.批量修改任务积分配置(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/task/batch/update") @PostMapping("/task/batch/update")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "taskPoints", value = "任务积分配置", required = true, dataType = "List<TaskPoint>", paramType = "body")} @ApiImplicitParam(name = "taskPoints", value = "任务积分配置", required = true, dataType = "List<TaskPoint>", paramType = "body")}
) )
public Result<Void> batchUpdate( public Result<Void> batchUpdate(
@RequestHeader(value = "Authorization", required = true) String authorization, @RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody List<TaskPointDto> taskPoints) { @RequestBody List<TaskPointDto> taskPoints) {
taskPointService.batchUpdate(taskPoints, authorization); taskPointService.batchUpdate(taskPoints, authorization);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "1.4.批量禁用任务积分配置(PC)", notes = "仅限admin权限用户调用") @ApiOperation(value = "1.4.批量禁用任务积分配置(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/task/batch/disable") @PostMapping("/task/batch/disable")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "任务积分配置id", required = true, dataType = "List<String>", paramType = "body"), @ApiImplicitParam(name = "ids", value = "任务积分配置id", required = true, dataType = "List<String>", paramType = "body"),
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "valid", value = "是否生效 1-生效 2-不生效", required = true, dataType = "Integer", paramType = "query") @ApiImplicitParam(name = "valid", value = "是否生效 1-生效 2-不生效", required = true, dataType = "Integer", paramType = "query")
} }
) )
public Result<Void> batchDisable( public Result<Void> batchDisable(
@RequestHeader(value = "Authorization", required = true) String authorization, @RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody List<String> ids, @RequestBody List<String> ids,
@RequestParam Integer valid) { @RequestParam Integer valid) {
taskPointService.batchDisable(ids, authorization, valid); taskPointService.batchDisable(ids, authorization, valid);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "1.5.禁用任务积分配置(PC)", notes = "仅限admin权限用户调用") @ApiOperation(value = "1.5.禁用任务积分配置(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/task/disable") @PostMapping("/task/disable")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "任务积分配置id", required = true, dataType = "String", paramType = "body"), @ApiImplicitParam(name = "id", value = "任务积分配置id", required = true, dataType = "String", paramType = "body"),
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "valid", value = "是否生效 1-生效 2-不生效", required = true, dataType = "Integer", paramType = "query") @ApiImplicitParam(name = "valid", value = "是否生效 1-生效 2-不生效", required = true, dataType = "Integer", paramType = "query")
}) })
public Result<Void> disable( public Result<Void> disable(
@RequestHeader(value = "Authorization", required = true) String authorization, @RequestHeader(value = "Authorization", required = true) String authorization,
@RequestParam String id, @RequestParam String id,
@RequestParam Integer valid) { @RequestParam Integer valid) {
taskPointService.disable(id, authorization, valid); taskPointService.disable(id, authorization, valid);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "1.6. 任务积分列表(PC)", notes = "任务积分列表") @ApiOperation(value = "1.6. 任务积分列表(PC)", notes = "任务积分列表")
@GetMapping("/task/list/{page}/{size}") @GetMapping("/task/list/{page}/{size}")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
public Result<PageResult<TaskPoint>> getUnApproveList( public Result<PageResult<TaskPoint>> getUnApproveList(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "页码", required = true) @PathVariable Integer page, @ApiParam(value = "页码", required = true) @PathVariable Integer page,
@ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) {
return Result.success(taskPointService.getTaskPointList(page, size)); return Result.success(taskPointService.getTaskPointList(page, size));
} }
@ApiOperation(value = "1.7. 任务积分列表(APP)", notes = "任务积分列表") @ApiOperation(value = "1.7. 任务积分列表(APP)", notes = "任务积分列表")
@GetMapping("/task/list/app") @GetMapping("/task/list/app")
@GlobalInterceptor(checkAppUserLogin = true) @GlobalInterceptor(checkAppUserLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "type", value = "任务类型 1-新手任务 2-日常任务", required = true, dataType = "Integer", paramType = "query") @ApiImplicitParam(name = "type", value = "任务类型 1-新手任务 2-日常任务", required = true, dataType = "Integer", paramType = "query")
}) })
public Result<List<TaskPointForAppDto>> getUnApproveListApp( public Result<List<TaskPointForAppDto>> getUnApproveListApp(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "任务类型 1-新手任务 2-日常任务", required = true) Integer type @ApiParam(value = "任务类型 1-新手任务 2-日常任务", required = true) Integer type
) { ) {
return Result.success(taskPointService.getTaskPointListForApp(token, type)); return Result.success(taskPointService.getTaskPointListForApp(token, type));
} }
// @ApiOperation(value = "2.1. 用户根据新手任务获取积分", notes = "仅限app用户调用") // @ApiOperation(value = "2.1. 用户根据新手任务获取积分", notes = "仅限app用户调用")
// @PostMapping("/log/earn/task/new") // @PostMapping("/log/earn/task/new")
@ -192,195 +190,216 @@ public class PointController {
// return Result.success(); // return Result.success();
// } // }
@ApiOperation(value = "2.2.用户积分日志列表APP", notes = "用户积分日志列表") @ApiOperation(value = "2.2.用户积分日志列表APP", notes = "用户积分日志列表")
@PostMapping("/admin/log/list/{page}/{size}") @PostMapping("/admin/log/list/{page}/{size}")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
public Result<PageResult<UserPointLogVO>> getUserPointLogListForAdmin( public Result<PageResult<UserPointLogVO>> getUserPointLogListForAdmin(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "查询对象") @RequestBody UserPointLogSearchDto userPointLogSearchDto, @ApiParam(value = "查询对象") @RequestBody UserPointLogSearchDto userPointLogSearchDto,
@ApiParam(value = "页码", required = true) @PathVariable Integer page, @ApiParam(value = "页码", required = true) @PathVariable Integer page,
@ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) {
return Result.success( return Result.success(
userPointLogService.getUserPointLogList(token, userPointLogSearchDto, page, size)); userPointLogService.getUserPointLogList(token, userPointLogSearchDto, page, size));
} }
@ApiOperation(value = "2.3.用户积分日志列表PC", notes = "用户积分日志列表") @ApiOperation(value = "2.3.用户积分日志列表PC", notes = "用户积分日志列表")
@PostMapping("/app/log/list/{page}/{size}") @PostMapping("/app/log/list/{page}/{size}")
@GlobalInterceptor(checkAppUserLogin = true) @GlobalInterceptor(checkAppUserLogin = true)
public Result<PageResult<UserPointLogVO>> getUserPointLogListForApp( public Result<PageResult<UserPointLogVO>> getUserPointLogListForApp(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "查询对象") @RequestBody UserPointLogSearchDto userPointLogSearchDto, @ApiParam(value = "查询对象") @RequestBody UserPointLogSearchDto userPointLogSearchDto,
@ApiParam(value = "页码", required = true) @PathVariable Integer page, @ApiParam(value = "页码", required = true) @PathVariable Integer page,
@ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) {
return Result.success( return Result.success(
userPointLogService.getUserPointLogList(token, userPointLogSearchDto, page, size)); userPointLogService.getUserPointLogList(token, userPointLogSearchDto, page, size));
} }
@ApiOperation(value = "2.4.每日签到(APP)", notes = "仅限app用户调用") @ApiOperation(value = "2.4.每日签到(APP)", notes = "仅限app用户调用")
@PostMapping("/log/earn/sign") @PostMapping("/log/earn/sign")
@GlobalInterceptor(checkAppUserLogin = true) @GlobalInterceptor(checkAppUserLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header") @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")
}) })
public Result<Void> addLogSign( public Result<Void> addLogSign(
@RequestHeader(value = "Authorization", required = true) String authorization) { @RequestHeader(value = "Authorization", required = true) String authorization) {
userPointLogService.dailySign(authorization); userPointLogService.dailySign(authorization);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "2.5.分享期刊(APP)", notes = "仅限app用户调用") @ApiOperation(value = "2.5.分享期刊(APP)", notes = "仅限app用户调用")
@PostMapping("/log/share/journal") @PostMapping("/log/share/journal")
@GlobalInterceptor(checkAppUserLogin = true) @GlobalInterceptor(checkAppUserLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "journalId", value = "期刊id", required = true, dataType = "String", paramType = "query") @ApiImplicitParam(name = "journalId", value = "期刊id", required = true, dataType = "String", paramType = "query")
}) })
public Result<Void> addLogShareJournal( public Result<Void> addLogShareJournal(
@RequestHeader(value = "Authorization", required = true) String authorization, @RequestHeader(value = "Authorization", required = true) String authorization,
@RequestParam String journalId) { @RequestParam String journalId) {
userPointLogService.shareJournal(authorization); userPointLogService.shareJournal(authorization);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "3.1.添加抽奖(PC)", notes = "仅限admin权限用户调用") @ApiOperation(value = "3.1.添加抽奖(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/lottery/add") @PostMapping("/lottery/add")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "lotteryAddDto", value = "抽奖信息", required = true, dataType = "LotteryAddDto", paramType = "body") @ApiImplicitParam(name = "lotteryAddDto", value = "抽奖信息", required = true, dataType = "LotteryAddDto", paramType = "body")
}) })
public Result<Void> addLottery(@RequestHeader("Authorization") String token, public Result<Void> addLottery(@RequestHeader("Authorization") String token,
@Validated @RequestBody LotteryAddDto lotteryAddDto) { @Validated @RequestBody LotteryAddDto lotteryAddDto) {
Lottery lottery = new Lottery(); Lottery lottery = new Lottery();
BeanUtils.copyProperties(lotteryAddDto, lottery); BeanUtils.copyProperties(lotteryAddDto, lottery);
lotteryService.add(lottery, token); lotteryService.add(lottery, token);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "3.2.抽奖列表页(PC)", notes = "admin") @ApiOperation(value = "3.2.抽奖列表页(PC)", notes = "admin")
@PostMapping("/lottery/list/{page}/{size}") @PostMapping("/lottery/list/{page}/{size}")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
public Result<PageResult<LotteryPCVO>> lotteryList( public Result<PageResult<LotteryPCVO>> lotteryList(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "查询对象") @RequestBody LotterySearchDto lotterySearchDto, @ApiParam(value = "查询对象") @RequestBody LotterySearchDto lotterySearchDto,
@ApiParam(value = "页码", required = true) @PathVariable Integer page, @ApiParam(value = "页码", required = true) @PathVariable Integer page,
@ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) {
return Result.success(lotteryService.lotteryPageResult(page, size, lotterySearchDto)); return Result.success(lotteryService.lotteryPageResult(page, size, lotterySearchDto));
} }
@ApiOperation(value = "3.3.根据抽奖id获取地区列表(APP)", notes = "仅限app权限用户调用") @ApiOperation(value = "3.3.根据抽奖id获取地区列表(APP)", notes = "仅限app权限用户调用")
@PostMapping("/lottery/region/list") @PostMapping("/lottery/region/list")
@GlobalInterceptor(checkAppUserLogin = true) @GlobalInterceptor(checkAppUserLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "lotteryId", value = "抽奖id", required = true, dataType = "String", paramType = "query") @ApiImplicitParam(name = "lotteryId", value = "抽奖id", required = true, dataType = "String", paramType = "query")
}) })
public Result<List<LotteryRegion>> getLotteryRegionList( public Result<List<LotteryRegion>> getLotteryRegionList(
@RequestHeader("Authorization") String token, @RequestHeader("Authorization") String token,
@RequestParam String lotteryId) { @RequestParam String lotteryId) {
return Result.success(lotteryService.getLotteryRegionList(lotteryId)); return Result.success(lotteryService.getLotteryRegionList(lotteryId));
} }
@ApiOperation(value = "3.4.编辑抽奖(PC)", notes = "仅限admin权限用户调用") @ApiOperation(value = "3.4.编辑抽奖(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/lottery/edit") @PostMapping("/lottery/edit")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "lotteryUpdateDto", value = "抽奖信息", required = true, dataType = "LotteryUpdateDto", paramType = "body") @ApiImplicitParam(name = "lotteryUpdateDto", value = "抽奖信息", required = true, dataType = "LotteryUpdateDto", paramType = "body")
}) })
public Result<Void> editLottery(@RequestHeader("Authorization") String token, public Result<Void> editLottery(@RequestHeader("Authorization") String token,
@Validated @RequestBody LotteryUpdateDto lotteryUpdateDto) { @Validated @RequestBody LotteryUpdateDto lotteryUpdateDto) {
Lottery lottery = new Lottery(); Lottery lottery = new Lottery();
BeanUtils.copyProperties(lotteryUpdateDto, lottery); BeanUtils.copyProperties(lotteryUpdateDto, lottery);
lotteryService.edit(lottery, token); lotteryService.edit(lottery, token);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "3.5.发布抽奖(PC)", notes = "仅限admin权限用户调用") @ApiOperation(value = "3.5.发布抽奖(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/lottery/publish") @PostMapping("/lottery/publish")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query") @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query")
}) })
public Result<Void> publishLottery(@RequestHeader("Authorization") String token, public Result<Void> publishLottery(@RequestHeader("Authorization") String token,
@RequestParam String id) { @RequestParam String id) {
lotteryService.publish(id, token); lotteryService.publish(id, token);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "3.6.停止抽奖(PC)", notes = "仅限admin权限用户调用") @ApiOperation(value = "3.6.停止抽奖(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/lottery/stop") @PostMapping("/lottery/stop")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "stopReason", value = "停止原因", required = true, dataType = "String", paramType = "body") @ApiImplicitParam(name = "stopReason", value = "停止原因", required = true, dataType = "String", paramType = "body")
}) })
public Result<Void> stopLottery(@RequestHeader("Authorization") String token, public Result<Void> stopLottery(@RequestHeader("Authorization") String token,
@NotNull String id, @RequestBody @NotNull String stopReason) { @NotNull String id, @RequestBody @NotNull String stopReason) {
lotteryService.stop(id, token, stopReason); lotteryService.stop(id, token, stopReason);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "3.7.参与抽奖(APP)") @ApiOperation(value = "3.7.参与抽奖(APP)")
@PostMapping("/lottery/participate") @PostMapping("/lottery/participate")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "regionId", value = "区域id", required = true, dataType = "Integer", paramType = "query") @ApiImplicitParam(name = "regionId", value = "区域id", required = true, dataType = "Integer", paramType = "query")
}) })
public Result<Void> participate(@RequestHeader("Authorization") String token, @NotNull String id, public Result<Void> participate(@RequestHeader("Authorization") String token, @NotNull String id,
@NotNull Integer regionId) { @NotNull Integer regionId) {
lotteryService.participate(id, token, regionId); lotteryService.participate(id, token, regionId);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "3.8.自动抽奖结果(PC)", notes = "用这个方法主动触发自动抽奖结果") @ApiOperation(value = "3.8.自动抽奖结果(PC)", notes = "用这个方法主动触发自动抽奖结果")
@PostMapping("/lottery/auto") @PostMapping("/lottery/auto")
@GlobalInterceptor(checkAdminLogin = true) @GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query") @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query")
}) })
public Result<Void> auto(@RequestHeader("Authorization") String token, @NotNull String id) { public Result<Void> auto(@RequestHeader("Authorization") String token, @NotNull String id) {
drawLotteryService.auto(id, token); drawLotteryService.auto(id, token);
return Result.success(); return Result.success();
} }
@ApiOperation(value = "3.9.抽奖列表页,以及本人是否已参加(APP)", notes = "APP") @ApiOperation(value = "3.9.抽奖列表页,以及本人是否已参加(APP)", notes = "APP")
@PostMapping("/lottery/list/user/{page}/{size}") @PostMapping("/lottery/list/user/{page}/{size}")
@GlobalInterceptor(checkAppUserLogin = true) @GlobalInterceptor(checkAppUserLogin = true)
public Result<PageResult<LotteryAPPVO>> findLotteryListForApp( public Result<PageResult<LotteryAPPVO>> findLotteryListForApp(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "查询对象") @RequestBody LotterySearchDto lotterySearchDto, @ApiParam(value = "查询对象") @RequestBody LotterySearchDto lotterySearchDto,
@ApiParam(value = "页码", required = true) @PathVariable Integer page, @ApiParam(value = "页码", required = true) @PathVariable Integer page,
@ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) {
return Result.success( return Result.success(
lotteryService.findLotteryListForApp(page, size, lotterySearchDto, token)); lotteryService.findLotteryListForApp(page, size, lotterySearchDto, token));
} }
@ApiOperation(value = "3.10.已参与抽奖的人(APP)", notes = "APP") @ApiOperation(value = "3.10.已参与抽奖的人(APP)", notes = "APP")
@PostMapping("/lottery/participated/{page}/{size}") @GetMapping("/lottery/participated/{page}/{size}")
@GlobalInterceptor(checkAppUserLogin = true) @GlobalInterceptor(checkAppUserLogin = true)
public Result<PageResult<LotteryUser>> findParticipatedLotteryUserList( public Result<PageResult<LotteryUser>> findParticipatedLotteryUserList(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "抽奖id") String lotteryId, @ApiParam(value = "抽奖id") String lotteryId,
@ApiParam(value = "页码", required = true) @PathVariable Integer page, @ApiParam(value = "页码", required = true) @PathVariable Integer page,
@ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) {
return Result.success(lotteryService.findPageByLotteryId(page, size, lotteryId)); return Result.success(lotteryService.findPageByLotteryId(page, size, lotteryId));
} }
@ApiOperation(value = "3.11.抽奖结果(APP)", notes = "APP") @ApiOperation(value = "3.11.抽奖结果(APP)", notes = "APP")
@PostMapping("/lottery/result/{id}") @GetMapping("/lottery/result/{id}")
@GlobalInterceptor(checkAppUserLogin = true) @GlobalInterceptor(checkAppUserLogin = true)
public Result<Integer> findLotteryResult( public Result<Integer> findLotteryResult(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "抽奖id", required = true) @PathVariable String id) { @ApiParam(value = "抽奖id", required = true) @PathVariable String id) {
return Result.success(lotteryService.getLotteryUserResult(id, token)); return Result.success(lotteryService.getLotteryUserResult(id, token));
} }
@ApiOperation(value = "3.12.抽奖详情(PC)", notes = "PC")
@GetMapping("/lottery/detail/{id}")
@GlobalInterceptor(checkAdminLogin = true)
public Result<LotteryDetailPCVO> findLotteryDetailPCVO(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "抽奖id", required = true) @PathVariable String id) {
return Result.success(lotteryService.getLotteryDetailPCVO(id));
}
@ApiOperation(value = "3.13.抽奖用户列表(PC)", notes = "PC")
@GetMapping("/lottery/user/{page}/{size}")
@GlobalInterceptor(checkAdminLogin = true)
public Result<PageResult<LotteryUserDetailPCVO>> findLotteryUserList(
@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
@ApiParam(value = "抽奖id") String lotteryId,
@ApiParam(value = "页码", required = true) @PathVariable Integer page,
@ApiParam(value = "每页条数", required = true) @PathVariable Integer size,
@ApiParam(value = "用户类型") Integer userType) {
return Result.success(lotteryService.getLotteryUserList(page, size, lotteryId, userType));
}
} }

@ -9,7 +9,9 @@ import com.luoo.user.dao.UserInfoDao;
import com.luoo.user.dto.point.LotterySearchDto; import com.luoo.user.dto.point.LotterySearchDto;
import com.luoo.user.pojo.*; import com.luoo.user.pojo.*;
import com.luoo.user.vo.point.LotteryAPPVO; import com.luoo.user.vo.point.LotteryAPPVO;
import com.luoo.user.vo.point.LotteryDetailPCVO;
import com.luoo.user.vo.point.LotteryPCVO; import com.luoo.user.vo.point.LotteryPCVO;
import com.luoo.user.vo.point.LotteryUserDetailPCVO;
import com.querydsl.core.BooleanBuilder; import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Projections; import com.querydsl.core.types.Projections;
import com.querydsl.jpa.impl.JPAQueryFactory; import com.querydsl.jpa.impl.JPAQueryFactory;
@ -31,8 +33,6 @@ import javax.persistence.criteria.Root;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@ -570,4 +570,111 @@ public class LotteryService {
return lotteryUser.getResult(); return lotteryUser.getResult();
} }
/**
*
*
* @param lotteryId id
* @return
*/
public LotteryDetailPCVO getLotteryDetailPCVO(String lotteryId) {
QLottery qLottery = QLottery.lottery;
LotteryDetailPCVO lotteryDetailPCVO = jpaQueryFactory
.select(Projections.bean(LotteryDetailPCVO.class,
qLottery.id,
qLottery.code,
qLottery.title,
qLottery.type,
qLottery.num,
qLottery.participant,
qLottery.point,
qLottery.applyStartTime,
qLottery.applyEndTime,
qLottery.drawTime,
qLottery.way,
qLottery.image,
qLottery.description,
qLottery.status,
qLottery.createTime,
qLottery.stopReason
))
.from(qLottery)
.where(qLottery.id.eq(lotteryId))
.fetchOne();
QLotteryRegion qLotteryRegion = QLotteryRegion.lotteryRegion;
List<LotteryRegion> lotteryRegionList = jpaQueryFactory
.select(Projections.bean(LotteryRegion.class,
qLotteryRegion.id,
qLotteryRegion.regionId,
qLotteryRegion.lotteryId
))
.from(qLotteryRegion)
.where(qLotteryRegion.lotteryId.eq(lotteryId))
.fetch();
assert lotteryDetailPCVO != null;
lotteryDetailPCVO.setLotteryRegionList(lotteryRegionList);
return lotteryDetailPCVO;
}
/**
* id
*
* @param page
* @param size
* @param lotteryId id
* @param userType null- 1-
* @return
*/
public PageResult<LotteryUserDetailPCVO> getLotteryUserList(Integer page, Integer size, String lotteryId, Integer userType) {
QLotteryUser qLotteryUser = QLotteryUser.lotteryUser;
QUserInfo qUserInfo = QUserInfo.userInfo;
QRegion qRegion = QRegion.region;
BooleanBuilder booleanBuilder = new BooleanBuilder();
checkLotteryUserCondition(booleanBuilder,qLotteryUser, lotteryId, userType);
Pageable pageable = PageRequest.of(page - 1, size);
List<LotteryUserDetailPCVO> lotteryUserList = jpaQueryFactory
.select(Projections.bean(LotteryUserDetailPCVO.class,
qLotteryUser.lotteryId.as("lotteryId"),
qLotteryUser.userId.as("userId"),
qLotteryUser.regionId.as("regionId"),
qRegion.name.as("regionName"),
qUserInfo.mobile.as("mobile"),
qUserInfo.nickName.as("nickName"),
qUserInfo.point.as("point")
))
.from(qLotteryUser)
.leftJoin(qRegion)
.on(qLotteryUser.regionId.eq(qRegion.id))
.leftJoin(qUserInfo)
.on(qLotteryUser.userId.eq(qUserInfo.id))
.where(booleanBuilder)
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.fetch();
long total = jpaQueryFactory
.select(qLotteryUser.count())
.from(qLotteryUser)
.leftJoin(qRegion)
.on(qLotteryUser.regionId.eq(qRegion.id))
.leftJoin(qUserInfo)
.on(qLotteryUser.userId.eq(qUserInfo.id))
.where(booleanBuilder)
.fetchCount();
return new PageResult<>(total, lotteryUserList);
}
private void checkLotteryUserCondition(BooleanBuilder booleanBuilder, QLotteryUser qLotteryUser, String lotteryId, Integer userType) {
booleanBuilder.and(qLotteryUser.lotteryId.eq(lotteryId));
if (Objects.nonNull(userType)) {
booleanBuilder.and(qLotteryUser.result.eq(userType));
}
}
} }

@ -0,0 +1,105 @@
package com.luoo.user.vo.point;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.luoo.user.pojo.LotteryRegion;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import java.util.List;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @program: luoo
* @description: PC
* @author: yawei.huang
* @create: 2024-08-10 10:48
**/
@Data
public class LotteryDetailPCVO {
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "抽奖编码")
private String code;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "抽奖类型 1-门票抽奖 2-实物抽奖")
private Integer type;
@ApiModelProperty(value = "奖品总数量")
private Integer num;
@ApiModelProperty(value = "可参加人员 1-全部 2-全部会员 3-永久会员 4-贡献者")
private Integer participant;
@ApiModelProperty(value = "积分")
private Integer point;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "报名开始时间")
private LocalDateTime applyStartTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "报名结束时间")
private LocalDateTime applyEndTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "抽奖时间")
private LocalDateTime drawTime;
@ApiModelProperty(value = "抽奖方式 1-自动抽奖 2-手动抽奖")
private Integer way;
@ApiModelProperty(value = "抽奖封面url")
private String image;
@ApiModelProperty(value = "抽奖描述")
private String description;
@ApiModelProperty(value = "抽奖状态 0-编辑中 1-报名中 2-已抽奖 3-已停止")
private Integer status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("创建时间")
@CreatedDate
private LocalDateTime createTime;
@ApiModelProperty(value = "停止原因")
private String stopReason;
@ApiModelProperty(value = "抽奖区域列表")
List<LotteryRegion> lotteryRegionList;
public LotteryDetailPCVO() {
}
public LotteryDetailPCVO(String id, String code, String title, Integer type, Integer num, Integer participant, Integer point, LocalDateTime applyStartTime, LocalDateTime applyEndTime, LocalDateTime drawTime, Integer way, String image, String description, Integer status, LocalDateTime createTime, String stopReason) {
this.id = id;
this.code = code;
this.title = title;
this.type = type;
this.num = num;
this.participant = participant;
this.point = point;
this.applyStartTime = applyStartTime;
this.applyEndTime = applyEndTime;
this.drawTime = drawTime;
this.way = way;
this.image = image;
this.description = description;
this.status = status;
this.createTime = createTime;
this.stopReason = stopReason;
}
}

@ -0,0 +1,41 @@
package com.luoo.user.vo.point;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
/**
* @program: luoo
* @description:
* @author: yawei.huang
* @create: 2024-08-10 10:49
**/
@Data
public class LotteryUserDetailPCVO implements Serializable {
@ApiModelProperty(value = "抽奖id")
private String lotteryId;
@ApiModelProperty(value = "用户id")
private String userId;
@ApiModelProperty(value = "区域id")
private Integer regionId;
@ApiModelProperty(value = "区域名称")
private String regionName;
@ApiModelProperty(value = "手机号")
private String mobile;
@ApiModelProperty(value = "昵称")
private String nickName;
@ApiModelProperty(value = "用户积分")
private Integer point;
@ApiModelProperty(value = "用户等级")
private String level;
}
Loading…
Cancel
Save