From a2bed1ddf6bb193da7c4faae37a516d77014555b Mon Sep 17 00:00:00 2001 From: huangyawei Date: Mon, 5 Aug 2024 20:51:16 +0800 Subject: [PATCH] =?UTF-8?q?release-=20TaskPoint=E5=BA=8F=E5=88=97=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../luoo/user/controller/PointController.java | 604 +++++++++--------- .../java/com/luoo/user/pojo/TaskPoint.java | 3 +- luoo_user/src/main/resources/sql/20240802.sql | 4 + 3 files changed, 311 insertions(+), 300 deletions(-) diff --git a/luoo_user/src/main/java/com/luoo/user/controller/PointController.java b/luoo_user/src/main/java/com/luoo/user/controller/PointController.java index ab765f0..57d9014 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/PointController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/PointController.java @@ -46,305 +46,311 @@ import org.springframework.web.bind.annotation.RestController; @Api(tags = "积分模块") public class PointController { - @Autowired - private TaskPointService taskPointService; - - @Autowired - private UserPointLogService userPointLogService; - - @Autowired - private LotteryService lotteryService; - - @Autowired - private DrawLotteryService drawLotteryService; - - - @ApiOperation(value = "1.1.新增任务积分配置(PC)", notes = "仅限admin权限用户调用") - @PostMapping("/task/add") - @GlobalInterceptor(checkAdminLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "taskPoint", value = "任务积分配置", required = true, dataType = "TaskPoint", paramType = "body"), - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")}) - public Result add( - @RequestHeader(value = "Authorization", required = true) String authorization, - @RequestBody TaskPointDto taskPointDto) { - TaskPoint taskPoint = new TaskPoint(); - BeanUtils.copyProperties(taskPointDto, taskPoint); - taskPointService.add(taskPoint, authorization); - return Result.success(); - } - - @ApiOperation(value = "1.2.修改任务积分配置(PC)", notes = "仅限admin权限用户调用") - @PostMapping("/task/update") - @GlobalInterceptor(checkAdminLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "taskPoint", value = "任务积分配置", required = true, dataType = "TaskPoint", paramType = "body"), - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")} - ) - public Result update( - @RequestHeader(value = "Authorization", required = true) String authorization, - @RequestBody TaskPointDto taskPointDto) { - TaskPoint taskPoint = new TaskPoint(); - BeanUtils.copyProperties(taskPointDto, taskPoint); - taskPointService.update(taskPoint, authorization); - return Result.success(); - } - - @ApiOperation(value = "1.3.批量修改任务积分配置(PC)", notes = "仅限admin权限用户调用") - @PostMapping("/task/batch/update") - @GlobalInterceptor(checkAdminLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "taskPoints", value = "任务积分配置", required = true, dataType = "List", paramType = "body"), - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")} - ) - public Result batchUpdate( - @RequestHeader(value = "Authorization", required = true) String authorization, - @RequestBody List taskPoints) { - taskPointService.batchUpdate(taskPoints, authorization); - return Result.success(); - } - - @ApiOperation(value = "1.4.批量禁用任务积分配置(PC)", notes = "仅限admin权限用户调用") - @PostMapping("/task/batch/disable") - @GlobalInterceptor(checkAdminLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "任务积分配置id", required = true, dataType = "List", paramType = "body"), - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "valid", value = "是否生效 1-生效 2-不生效", required = true, dataType = "Integer", paramType = "query") - } - ) - public Result batchDisable( - @RequestHeader(value = "Authorization", required = true) String authorization, - @RequestBody List ids, - @RequestParam Integer valid) { - taskPointService.batchDisable(ids, authorization, valid); - return Result.success(); - } - - @ApiOperation(value = "1.5.禁用任务积分配置(PC)", notes = "仅限admin权限用户调用") - @PostMapping("/task/disable") - @GlobalInterceptor(checkAdminLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "任务积分配置id", required = true, dataType = "String", paramType = "body"), - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "valid", value = "是否生效 1-生效 2-不生效", required = true, dataType = "Integer", paramType = "query") - }) - public Result disable( - @RequestHeader(value = "Authorization", required = true) String authorization, - @RequestParam String id, - @RequestParam Integer valid) { - taskPointService.disable(id, authorization, valid); - return Result.success(); - } - - @ApiOperation(value = "1.6. 任务积分列表(PC)", notes = "任务积分列表") - @GetMapping("/task/list/{page}/{size}") - public Result> getUnApproveList( - @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, - @ApiParam(value = "页码", required = true) @PathVariable Integer page, - @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { - return Result.success(taskPointService.getTaskPointList(page, size)); - } - - @ApiOperation(value = "2.1. 用户根据新手任务获取积分", notes = "仅限app用户调用") - @PostMapping("/log/earn/task/new") - @GlobalInterceptor(checkAppUserLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "taskPointId", value = "任务积分配置id", required = true, dataType = "String", paramType = "body") - }) - public Result addLogNew( - @RequestHeader(value = "Authorization", required = true) String authorization, - @RequestBody String taskPointId) { - userPointLogService.addByTaskNew(taskPointId, authorization); - return Result.success(); - } - - @ApiOperation(value = "2.2. 用户根据日常任务获取积分", notes = "仅限app用户调用") - @PostMapping("/log/earn/task/daily") - @GlobalInterceptor(checkAppUserLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "taskPointId", value = "任务积分配置id", required = true, dataType = "String", paramType = "body") - }) - public Result addLogDaily( - @RequestHeader(value = "Authorization", required = true) String authorization, - @RequestBody String taskPointId) { - userPointLogService.addByTaskDaily(taskPointId, authorization); - return Result.success(); - } - - @ApiOperation(value = "2.3.用户积分日志列表(APP&PC)", notes = "用户积分日志列表") - @PostMapping("/log/list/{page}/{size}") - @GlobalInterceptor(checkAppUserLogin = true) - public Result> getUserPointLogList( - @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, - @ApiParam(value = "查询对象") @RequestBody UserPointLogSearchDto userPointLogSearchDto, - @ApiParam(value = "页码", required = true) @PathVariable Integer page, - @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { - return Result.success( - userPointLogService.getUserPointLogList(token, userPointLogSearchDto, page, size)); - } - - @ApiOperation(value = "2.4.每日签到(APP)", notes = "仅限app用户调用") - @PostMapping("/log/earn/sign") - @GlobalInterceptor(checkAppUserLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header") - }) - public Result addLogSign(@RequestHeader(value = "Authorization", required = true) String authorization) { - userPointLogService.dailySign(authorization); - return Result.success(); - } - - @ApiOperation(value = "2.5.分享期刊(APP)", notes = "仅限app用户调用") - @PostMapping("/log/share/journal") - @GlobalInterceptor(checkAppUserLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "journalId", value = "期刊id", required = true, dataType = "String", paramType = "query") - }) - public Result addLogShareJournal(@RequestHeader(value = "Authorization", required = true) String authorization, @RequestParam String journalId) { - userPointLogService.shareJournal(authorization); - return Result.success(); - } - - - @ApiOperation(value = "3.1.添加抽奖(PC)", notes = "仅限admin权限用户调用") - @PostMapping("/lottery/add") - @GlobalInterceptor(checkAdminLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "lotteryAddDto", value = "抽奖信息", required = true, dataType = "LotteryAddDto", paramType = "body") - }) - public Result addLottery(@RequestHeader("Authorization") String token, - @Validated @RequestBody LotteryAddDto lotteryAddDto) { - Lottery lottery = new Lottery(); - BeanUtils.copyProperties(lotteryAddDto, lottery); - - lotteryService.add(lottery, token); - return Result.success(); - } - - @ApiOperation(value = "3.2.抽奖列表页(PC)", notes = "admin") - @PostMapping("/lottery/list/{page}/{size}") - @GlobalInterceptor(checkAdminLogin = true) - public Result> lotteryList( - @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, - @ApiParam(value = "查询对象") @RequestBody LotterySearchDto lotterySearchDto, - @ApiParam(value = "页码", required = true) @PathVariable Integer page, - @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { - return Result.success(lotteryService.lotteryPageResult(page, size, lotterySearchDto)); - } - - @ApiOperation(value = "3.3.根据抽奖id获取地区列表(APP)", notes = "仅限app权限用户调用") - @PostMapping("/lottery/region/list") - @GlobalInterceptor(checkAppUserLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "lotteryId", value = "抽奖id", required = true, dataType = "String", paramType = "query") - }) - public Result> getLotteryRegionList( - @RequestHeader("Authorization") String token, - @RequestParam String lotteryId) { - return Result.success(lotteryService.getLotteryRegionList(lotteryId)); - } - - @ApiOperation(value = "3.4.编辑抽奖(PC)", notes = "仅限admin权限用户调用") - @PostMapping("/lottery/edit") - @GlobalInterceptor(checkAdminLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "lotteryUpdateDto", value = "抽奖信息", required = true, dataType = "LotteryUpdateDto", paramType = "body") - }) - public Result editLottery(@RequestHeader("Authorization") String token, - @Validated @RequestBody LotteryUpdateDto lotteryUpdateDto) { - Lottery lottery = new Lottery(); - BeanUtils.copyProperties(lotteryUpdateDto, lottery); - lotteryService.edit(lottery, token); - return Result.success(); - } - - @ApiOperation(value = "3.5.发布抽奖(PC)", notes = "仅限admin权限用户调用") - @PostMapping("/lottery/publish") - @GlobalInterceptor(checkAdminLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query") - }) - public Result publishLottery(@RequestHeader("Authorization") String token, - @RequestParam String id) { - lotteryService.publish(id, token); - return Result.success(); - } - - @ApiOperation(value = "3.6.停止抽奖(PC)", notes = "仅限admin权限用户调用") - @PostMapping("/lottery/stop") - @GlobalInterceptor(checkAdminLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query"), - @ApiImplicitParam(name = "stopReason", value = "停止原因", required = true, dataType = "String", paramType = "body") - }) - public Result stopLottery(@RequestHeader("Authorization") String token, - @NotNull String id, @RequestBody @NotNull String stopReason) { - lotteryService.stop(id, token, stopReason); - return Result.success(); - } - - @ApiOperation(value = "3.7.参与抽奖(APP)") - @PostMapping("/lottery/participate") - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query"), - @ApiImplicitParam(name = "regionId", value = "区域id", required = true, dataType = "Integer", paramType = "query") - }) - public Result participate(@RequestHeader("Authorization") String token, @NotNull String id, @NotNull Integer regionId) { - lotteryService.participate(id, token, regionId); - return Result.success(); - } - - @ApiOperation(value = "3.8.自动抽奖结果(PC)", notes = "用这个方法主动触发自动抽奖结果") - @PostMapping("/lottery/auto") - @GlobalInterceptor(checkAdminLogin = true) - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), - @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query") - }) - public Result auto(@RequestHeader("Authorization") String token, @NotNull String id) { - drawLotteryService.auto(id, token); - return Result.success(); - } - - @ApiOperation(value = "3.9.抽奖列表页,以及本人是否已参加(APP)", notes = "APP") - @PostMapping("/lottery/list/user/{page}/{size}") - @GlobalInterceptor(checkAppUserLogin = true) - public Result> findLotteryListForApp( - @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, - @ApiParam(value = "查询对象") @RequestBody LotterySearchDto lotterySearchDto, - @ApiParam(value = "页码", required = true) @PathVariable Integer page, - @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { - return Result.success(lotteryService.findLotteryListForApp(page, size, lotterySearchDto, token)); - } - - @ApiOperation(value = "3.10.已参与抽奖的人(APP)", notes = "APP") - @PostMapping("/lottery/participated/{page}/{size}") - @GlobalInterceptor(checkAppUserLogin = true) - public Result> findParticipatedLotteryUserList( - @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) { - return Result.success(lotteryService.findPageByLotteryId(page, size, lotteryId)); - } - - @ApiOperation(value = "3.11.抽奖结果(APP)", notes = "APP") - @PostMapping("/lottery/result/{id}") - @GlobalInterceptor(checkAppUserLogin = true) - public Result findLotteryResult(@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, - @ApiParam(value = "抽奖id", required = true) @PathVariable String id) { - return Result.success(lotteryService.getLotteryUserResult(id, token)); - } + @Autowired + private TaskPointService taskPointService; + + @Autowired + private UserPointLogService userPointLogService; + + @Autowired + private LotteryService lotteryService; + + @Autowired + private DrawLotteryService drawLotteryService; + + + @ApiOperation(value = "1.1.新增任务积分配置(PC)", notes = "仅限admin权限用户调用") + @PostMapping("/task/add") + @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "taskPoint", value = "任务积分配置", required = true, dataType = "TaskPoint", paramType = "body"), + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")}) + public Result add( + @RequestHeader(value = "Authorization", required = true) String authorization, + @RequestBody TaskPointDto taskPointDto) { + TaskPoint taskPoint = new TaskPoint(); + BeanUtils.copyProperties(taskPointDto, taskPoint); + taskPointService.add(taskPoint, authorization); + return Result.success(); + } + + @ApiOperation(value = "1.2.修改任务积分配置(PC)", notes = "仅限admin权限用户调用") + @PostMapping("/task/update") + @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "taskPoint", value = "任务积分配置", required = true, dataType = "TaskPoint", paramType = "body"), + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")} + ) + public Result update( + @RequestHeader(value = "Authorization", required = true) String authorization, + @RequestBody TaskPointDto taskPointDto) { + TaskPoint taskPoint = new TaskPoint(); + BeanUtils.copyProperties(taskPointDto, taskPoint); + taskPointService.update(taskPoint, authorization); + return Result.success(); + } + + @ApiOperation(value = "1.3.批量修改任务积分配置(PC)", notes = "仅限admin权限用户调用") + @PostMapping("/task/batch/update") + @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "taskPoints", value = "任务积分配置", required = true, dataType = "List", paramType = "body")} + ) + public Result batchUpdate( + @RequestHeader(value = "Authorization", required = true) String authorization, + @RequestBody List taskPoints) { + taskPointService.batchUpdate(taskPoints, authorization); + return Result.success(); + } + + @ApiOperation(value = "1.4.批量禁用任务积分配置(PC)", notes = "仅限admin权限用户调用") + @PostMapping("/task/batch/disable") + @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "ids", value = "任务积分配置id", required = true, dataType = "List", paramType = "body"), + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "valid", value = "是否生效 1-生效 2-不生效", required = true, dataType = "Integer", paramType = "query") + } + ) + public Result batchDisable( + @RequestHeader(value = "Authorization", required = true) String authorization, + @RequestBody List ids, + @RequestParam Integer valid) { + taskPointService.batchDisable(ids, authorization, valid); + return Result.success(); + } + + @ApiOperation(value = "1.5.禁用任务积分配置(PC)", notes = "仅限admin权限用户调用") + @PostMapping("/task/disable") + @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "任务积分配置id", required = true, dataType = "String", paramType = "body"), + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "valid", value = "是否生效 1-生效 2-不生效", required = true, dataType = "Integer", paramType = "query") + }) + public Result disable( + @RequestHeader(value = "Authorization", required = true) String authorization, + @RequestParam String id, + @RequestParam Integer valid) { + taskPointService.disable(id, authorization, valid); + return Result.success(); + } + + @ApiOperation(value = "1.6. 任务积分列表(PC)", notes = "任务积分列表") + @GetMapping("/task/list/{page}/{size}") + public Result> getUnApproveList( + @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, + @ApiParam(value = "页码", required = true) @PathVariable Integer page, + @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { + return Result.success(taskPointService.getTaskPointList(page, size)); + } + + @ApiOperation(value = "2.1. 用户根据新手任务获取积分", notes = "仅限app用户调用") + @PostMapping("/log/earn/task/new") + @GlobalInterceptor(checkAppUserLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "taskPointId", value = "任务积分配置id", required = true, dataType = "String", paramType = "body") + }) + public Result addLogNew( + @RequestHeader(value = "Authorization", required = true) String authorization, + @RequestBody String taskPointId) { + userPointLogService.addByTaskNew(taskPointId, authorization); + return Result.success(); + } + + @ApiOperation(value = "2.2. 用户根据日常任务获取积分", notes = "仅限app用户调用") + @PostMapping("/log/earn/task/daily") + @GlobalInterceptor(checkAppUserLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "taskPointId", value = "任务积分配置id", required = true, dataType = "String", paramType = "body") + }) + public Result addLogDaily( + @RequestHeader(value = "Authorization", required = true) String authorization, + @RequestBody String taskPointId) { + userPointLogService.addByTaskDaily(taskPointId, authorization); + return Result.success(); + } + + @ApiOperation(value = "2.3.用户积分日志列表(APP&PC)", notes = "用户积分日志列表") + @PostMapping("/log/list/{page}/{size}") + @GlobalInterceptor(checkAppUserLogin = true) + public Result> getUserPointLogList( + @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, + @ApiParam(value = "查询对象") @RequestBody UserPointLogSearchDto userPointLogSearchDto, + @ApiParam(value = "页码", required = true) @PathVariable Integer page, + @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { + return Result.success( + userPointLogService.getUserPointLogList(token, userPointLogSearchDto, page, size)); + } + + @ApiOperation(value = "2.4.每日签到(APP)", notes = "仅限app用户调用") + @PostMapping("/log/earn/sign") + @GlobalInterceptor(checkAppUserLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header") + }) + public Result addLogSign( + @RequestHeader(value = "Authorization", required = true) String authorization) { + userPointLogService.dailySign(authorization); + return Result.success(); + } + + @ApiOperation(value = "2.5.分享期刊(APP)", notes = "仅限app用户调用") + @PostMapping("/log/share/journal") + @GlobalInterceptor(checkAppUserLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "journalId", value = "期刊id", required = true, dataType = "String", paramType = "query") + }) + public Result addLogShareJournal( + @RequestHeader(value = "Authorization", required = true) String authorization, + @RequestParam String journalId) { + userPointLogService.shareJournal(authorization); + return Result.success(); + } + + + @ApiOperation(value = "3.1.添加抽奖(PC)", notes = "仅限admin权限用户调用") + @PostMapping("/lottery/add") + @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "lotteryAddDto", value = "抽奖信息", required = true, dataType = "LotteryAddDto", paramType = "body") + }) + public Result addLottery(@RequestHeader("Authorization") String token, + @Validated @RequestBody LotteryAddDto lotteryAddDto) { + Lottery lottery = new Lottery(); + BeanUtils.copyProperties(lotteryAddDto, lottery); + + lotteryService.add(lottery, token); + return Result.success(); + } + + @ApiOperation(value = "3.2.抽奖列表页(PC)", notes = "admin") + @PostMapping("/lottery/list/{page}/{size}") + @GlobalInterceptor(checkAdminLogin = true) + public Result> lotteryList( + @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, + @ApiParam(value = "查询对象") @RequestBody LotterySearchDto lotterySearchDto, + @ApiParam(value = "页码", required = true) @PathVariable Integer page, + @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { + return Result.success(lotteryService.lotteryPageResult(page, size, lotterySearchDto)); + } + + @ApiOperation(value = "3.3.根据抽奖id获取地区列表(APP)", notes = "仅限app权限用户调用") + @PostMapping("/lottery/region/list") + @GlobalInterceptor(checkAppUserLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "lotteryId", value = "抽奖id", required = true, dataType = "String", paramType = "query") + }) + public Result> getLotteryRegionList( + @RequestHeader("Authorization") String token, + @RequestParam String lotteryId) { + return Result.success(lotteryService.getLotteryRegionList(lotteryId)); + } + + @ApiOperation(value = "3.4.编辑抽奖(PC)", notes = "仅限admin权限用户调用") + @PostMapping("/lottery/edit") + @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "lotteryUpdateDto", value = "抽奖信息", required = true, dataType = "LotteryUpdateDto", paramType = "body") + }) + public Result editLottery(@RequestHeader("Authorization") String token, + @Validated @RequestBody LotteryUpdateDto lotteryUpdateDto) { + Lottery lottery = new Lottery(); + BeanUtils.copyProperties(lotteryUpdateDto, lottery); + lotteryService.edit(lottery, token); + return Result.success(); + } + + @ApiOperation(value = "3.5.发布抽奖(PC)", notes = "仅限admin权限用户调用") + @PostMapping("/lottery/publish") + @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query") + }) + public Result publishLottery(@RequestHeader("Authorization") String token, + @RequestParam String id) { + lotteryService.publish(id, token); + return Result.success(); + } + + @ApiOperation(value = "3.6.停止抽奖(PC)", notes = "仅限admin权限用户调用") + @PostMapping("/lottery/stop") + @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query"), + @ApiImplicitParam(name = "stopReason", value = "停止原因", required = true, dataType = "String", paramType = "body") + }) + public Result stopLottery(@RequestHeader("Authorization") String token, + @NotNull String id, @RequestBody @NotNull String stopReason) { + lotteryService.stop(id, token, stopReason); + return Result.success(); + } + + @ApiOperation(value = "3.7.参与抽奖(APP)") + @PostMapping("/lottery/participate") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query"), + @ApiImplicitParam(name = "regionId", value = "区域id", required = true, dataType = "Integer", paramType = "query") + }) + public Result participate(@RequestHeader("Authorization") String token, @NotNull String id, + @NotNull Integer regionId) { + lotteryService.participate(id, token, regionId); + return Result.success(); + } + + @ApiOperation(value = "3.8.自动抽奖结果(PC)", notes = "用这个方法主动触发自动抽奖结果") + @PostMapping("/lottery/auto") + @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"), + @ApiImplicitParam(name = "id", value = "抽奖id", required = true, dataType = "String", paramType = "query") + }) + public Result auto(@RequestHeader("Authorization") String token, @NotNull String id) { + drawLotteryService.auto(id, token); + return Result.success(); + } + + @ApiOperation(value = "3.9.抽奖列表页,以及本人是否已参加(APP)", notes = "APP") + @PostMapping("/lottery/list/user/{page}/{size}") + @GlobalInterceptor(checkAppUserLogin = true) + public Result> findLotteryListForApp( + @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, + @ApiParam(value = "查询对象") @RequestBody LotterySearchDto lotterySearchDto, + @ApiParam(value = "页码", required = true) @PathVariable Integer page, + @ApiParam(value = "每页条数", required = true) @PathVariable Integer size) { + return Result.success( + lotteryService.findLotteryListForApp(page, size, lotterySearchDto, token)); + } + + @ApiOperation(value = "3.10.已参与抽奖的人(APP)", notes = "APP") + @PostMapping("/lottery/participated/{page}/{size}") + @GlobalInterceptor(checkAppUserLogin = true) + public Result> findParticipatedLotteryUserList( + @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) { + return Result.success(lotteryService.findPageByLotteryId(page, size, lotteryId)); + } + + @ApiOperation(value = "3.11.抽奖结果(APP)", notes = "APP") + @PostMapping("/lottery/result/{id}") + @GlobalInterceptor(checkAppUserLogin = true) + public Result findLotteryResult( + @ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token, + @ApiParam(value = "抽奖id", required = true) @PathVariable String id) { + return Result.success(lotteryService.getLotteryUserResult(id, token)); + } } diff --git a/luoo_user/src/main/java/com/luoo/user/pojo/TaskPoint.java b/luoo_user/src/main/java/com/luoo/user/pojo/TaskPoint.java index 4ce1b3e..d2266c3 100644 --- a/luoo_user/src/main/java/com/luoo/user/pojo/TaskPoint.java +++ b/luoo_user/src/main/java/com/luoo/user/pojo/TaskPoint.java @@ -2,6 +2,7 @@ package com.luoo.user.pojo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; import java.time.LocalDateTime; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,7 +33,7 @@ import org.springframework.format.annotation.DateTimeFormat; @DynamicUpdate @Table(name = "tb_task_point") @EntityListeners(AuditingEntityListener.class) -public class TaskPoint { +public class TaskPoint implements Serializable { @Id @Size(max = 20) diff --git a/luoo_user/src/main/resources/sql/20240802.sql b/luoo_user/src/main/resources/sql/20240802.sql index 7ede2ae..158c801 100644 --- a/luoo_user/src/main/resources/sql/20240802.sql +++ b/luoo_user/src/main/resources/sql/20240802.sql @@ -19,3 +19,7 @@ alter table tb_user_info alter table tb_user_info add enable_chat int null comment '是否允许私信 0为关闭 1为启用 默认启用'; +alter table tb_lottery_user + modify region_id int null comment '地区id'; + +