release- TaskPoint序列化

release-2024-08-08
huangyawei 4 months ago
parent c44c213f92
commit a2bed1ddf6

@ -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<Void> 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<Void> 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<TaskPoint>", paramType = "body"),
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")}
)
public Result<Void> batchUpdate(
@RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody List<TaskPointDto> 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<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<Void> batchDisable(
@RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody List<String> 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<Void> 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<PageResult<TaskPoint>> 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<Void> 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<Void> 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<PageResult<UserPointLog>> 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<Void> 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<Void> 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<Void> 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<PageResult<Lottery>> 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<List<LotteryRegion>> 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<Void> 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<Void> 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<Void> 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<Void> 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<Void> 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<PageResult<Lottery>> 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<PageResult<LotteryUser>> 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<Integer> 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<Void> 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<Void> 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<TaskPoint>", paramType = "body")}
)
public Result<Void> batchUpdate(
@RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody List<TaskPointDto> 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<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<Void> batchDisable(
@RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody List<String> 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<Void> 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<PageResult<TaskPoint>> 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<Void> 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<Void> 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<PageResult<UserPointLog>> 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<Void> 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<Void> 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<Void> 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<PageResult<Lottery>> 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<List<LotteryRegion>> 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<Void> 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<Void> 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<Void> 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<Void> 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<Void> 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<PageResult<Lottery>> 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<PageResult<LotteryUser>> 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<Integer> 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));
}
}

@ -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)

@ -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';

Loading…
Cancel
Save