|
|
|
@ -3,8 +3,11 @@ package com.luoo.user.controller;
|
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
|
import api.PageResult;
|
|
|
|
|
import api.Result;
|
|
|
|
|
import com.luoo.user.dto.point.UserPointLogSearchDto;
|
|
|
|
|
import com.luoo.user.pojo.TaskPoint;
|
|
|
|
|
import com.luoo.user.pojo.UserPointLog;
|
|
|
|
|
import com.luoo.user.service.TaskPointService;
|
|
|
|
|
import com.luoo.user.service.UserPointLogService;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
@ -13,6 +16,7 @@ import io.swagger.annotations.ApiParam;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
@ -31,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@Slf4j
|
|
|
|
|
@CrossOrigin
|
|
|
|
|
@RequestMapping("/point")
|
|
|
|
|
@Api(tags = "积分模块")
|
|
|
|
|
public class PointController {
|
|
|
|
@ -38,13 +43,16 @@ public class PointController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private TaskPointService taskPointService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserPointLogService userPointLogService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "1.1.新增任务积分配置", notes = "仅限admin权限用户调用")
|
|
|
|
|
@PostMapping("/task/add")
|
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "taskPoint", value = "任务积分配置", required = true, dataType = "TaskPoint", paramType = "body"),
|
|
|
|
|
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")})
|
|
|
|
|
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")})
|
|
|
|
|
public Result<Void> add(
|
|
|
|
|
@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
|
@RequestBody TaskPoint taskPoint) {
|
|
|
|
@ -57,7 +65,7 @@ public class PointController {
|
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "taskPoint", value = "任务积分配置", required = true, dataType = "TaskPoint", paramType = "body"),
|
|
|
|
|
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")}
|
|
|
|
|
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")}
|
|
|
|
|
)
|
|
|
|
|
public Result<Void> update(
|
|
|
|
|
@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
@ -71,7 +79,7 @@ public class PointController {
|
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "taskPoints", value = "任务积分配置", required = true, dataType = "List<TaskPoint>", paramType = "body"),
|
|
|
|
|
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")}
|
|
|
|
|
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")}
|
|
|
|
|
)
|
|
|
|
|
public Result<Void> batchUpdate(
|
|
|
|
|
@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
@ -85,7 +93,7 @@ public class PointController {
|
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "ids", value = "任务积分配置id", required = true, dataType = "List<String>", paramType = "body"),
|
|
|
|
|
@ApiImplicitParam(name = "token", 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")
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
@ -102,7 +110,7 @@ public class PointController {
|
|
|
|
|
@GlobalInterceptor(checkAdminLogin = true)
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "id", value = "任务积分配置id", required = true, dataType = "String", paramType = "body"),
|
|
|
|
|
@ApiImplicitParam(name = "token", 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")
|
|
|
|
|
})
|
|
|
|
|
public Result<Void> disable(
|
|
|
|
@ -115,12 +123,51 @@ public class PointController {
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "1.6. 任务积分列表", notes = "任务积分列表")
|
|
|
|
|
@GetMapping("/task/list/{page}/{size}")
|
|
|
|
|
public Result<PageResult<TaskPoint>> getUnApproveList(@ApiParam(value = "Header中的token信息", required = true) @RequestHeader("Authorization") String token,
|
|
|
|
|
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.用户积分日志列表", 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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|