|
|
@ -3,11 +3,9 @@ package com.luoo.user.controller;
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
import api.PageResult;
|
|
|
|
import api.PageResult;
|
|
|
|
import api.Result;
|
|
|
|
import api.Result;
|
|
|
|
import com.luoo.user.dto.point.LotteryDto;
|
|
|
|
import com.luoo.user.dto.point.*;
|
|
|
|
import com.luoo.user.dto.point.LotterySearchDto;
|
|
|
|
|
|
|
|
import com.luoo.user.dto.point.TaskPointDto;
|
|
|
|
|
|
|
|
import com.luoo.user.dto.point.UserPointLogSearchDto;
|
|
|
|
|
|
|
|
import com.luoo.user.pojo.Lottery;
|
|
|
|
import com.luoo.user.pojo.Lottery;
|
|
|
|
|
|
|
|
import com.luoo.user.pojo.LotteryRegion;
|
|
|
|
import com.luoo.user.pojo.TaskPoint;
|
|
|
|
import com.luoo.user.pojo.TaskPoint;
|
|
|
|
import com.luoo.user.pojo.UserPointLog;
|
|
|
|
import com.luoo.user.pojo.UserPointLog;
|
|
|
|
import com.luoo.user.service.DrawLotteryService;
|
|
|
|
import com.luoo.user.service.DrawLotteryService;
|
|
|
@ -26,6 +24,7 @@ import javax.validation.constraints.NotNull;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
@ -219,17 +218,19 @@ public class PointController {
|
|
|
|
@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 = "lottery", value = "抽奖信息", required = true, dataType = "Lottery", 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,
|
|
|
|
@RequestBody Lottery lottery) {
|
|
|
|
@Validated @RequestBody LotteryAddDto lotteryAddDto) {
|
|
|
|
|
|
|
|
Lottery lottery = new 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/APP)", notes = "admin/app")
|
|
|
|
@PostMapping("/lottery/list/{page}/{size}")
|
|
|
|
@PostMapping("/lottery/list/{page}/{size}")
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
|
|
|
|
public Result<PageResult<Lottery>> lotteryList(
|
|
|
|
public Result<PageResult<Lottery>> 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,
|
|
|
@ -238,35 +239,48 @@ public class PointController {
|
|
|
|
return Result.success(lotteryService.lotteryPageResult(page, size, lotterySearchDto));
|
|
|
|
return Result.success(lotteryService.lotteryPageResult(page, size, lotterySearchDto));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "3.3.编辑抽奖(PC)", notes = "仅限admin权限用户调用")
|
|
|
|
@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")
|
|
|
|
@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 = "lottery", value = "抽奖信息", required = true, dataType = "Lottery", 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,
|
|
|
|
@RequestBody LotteryDto lotteryDto) {
|
|
|
|
@Validated @RequestBody LotteryUpdateDto lotteryUpdateDto) {
|
|
|
|
Lottery lottery = new Lottery();
|
|
|
|
Lottery lottery = new Lottery();
|
|
|
|
BeanUtils.copyProperties(lotteryDto, lottery);
|
|
|
|
BeanUtils.copyProperties(lotteryUpdateDto, lottery);
|
|
|
|
lotteryService.edit(lottery, token);
|
|
|
|
lotteryService.edit(lottery, token);
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "3.4.发布抽奖(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 = "body")
|
|
|
|
@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,
|
|
|
|
@RequestBody String id) {
|
|
|
|
@RequestParam String id) {
|
|
|
|
lotteryService.publish(id, token);
|
|
|
|
lotteryService.publish(id, token);
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "3.5.停止抽奖(PC)", notes = "仅限admin权限用户调用")
|
|
|
|
@ApiOperation(value = "3.6.停止抽奖(PC)", notes = "仅限admin权限用户调用")
|
|
|
|
@PostMapping("/lottery/stop")
|
|
|
|
@PostMapping("/lottery/stop")
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
@ApiImplicitParams({
|
|
|
|
@ApiImplicitParams({
|
|
|
@ -280,19 +294,19 @@ public class PointController {
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "3.6.参与抽奖(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 = "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) {
|
|
|
|
public Result<Void> participate(@RequestHeader("Authorization") String token, @NotNull String id, @NotNull Integer regionId) {
|
|
|
|
lotteryService.participate(id, token, regionId);
|
|
|
|
lotteryService.participate(id, token, regionId);
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "3.7.自动抽奖结果(PC)", notes = "用这个方法主动触发自动抽奖结果")
|
|
|
|
@ApiOperation(value = "3.8.自动抽奖结果(PC)", notes = "用这个方法主动触发自动抽奖结果")
|
|
|
|
@PostMapping("/lottery/auto")
|
|
|
|
@PostMapping("/lottery/auto")
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
@ApiImplicitParams({
|
|
|
|
@ApiImplicitParams({
|
|
|
|