release: TaskPoint 封装DTO

release-2024-08-08
huangyw 4 months ago
parent d4152a148f
commit cf78faaece

@ -4,6 +4,7 @@ import annotation.GlobalInterceptor;
import api.PageResult;
import api.Result;
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.TaskPoint;
@ -22,6 +23,7 @@ import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
@ -57,7 +59,7 @@ public class PointController {
private LotteryService lotteryService;
@ApiOperation(value = "1.1.新增任务积分配置", notes = "仅限admin权限用户调用")
@ApiOperation(value = "1.1.新增任务积分配置(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/task/add")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({
@ -65,12 +67,14 @@ public class PointController {
@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) {
@RequestBody TaskPointDto taskPointDto) {
TaskPoint taskPoint = new TaskPoint();
BeanUtils.copyProperties(taskPointDto, taskPoint);
taskPointService.add(taskPoint, authorization);
return Result.success();
}
@ApiOperation(value = "1.2.修改任务积分配置", notes = "仅限admin权限用户调用")
@ApiOperation(value = "1.2.修改任务积分配置(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/task/update")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({
@ -79,12 +83,14 @@ public class PointController {
)
public Result<Void> update(
@RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody TaskPoint taskPoint) {
@RequestBody TaskPointDto taskPointDto) {
TaskPoint taskPoint = new TaskPoint();
BeanUtils.copyProperties(taskPointDto, taskPoint);
taskPointService.update(taskPoint, authorization);
return Result.success();
}
@ApiOperation(value = "1.3.批量修改任务积分配置", notes = "仅限admin权限用户调用")
@ApiOperation(value = "1.3.批量修改任务积分配置(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/task/batch/update")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({
@ -93,12 +99,12 @@ public class PointController {
)
public Result<Void> batchUpdate(
@RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody List<TaskPoint> taskPoints) {
@RequestBody List<TaskPointDto> taskPoints) {
taskPointService.batchUpdate(taskPoints, authorization);
return Result.success();
}
@ApiOperation(value = "1.4.批量禁用任务积分配置", notes = "仅限admin权限用户调用")
@ApiOperation(value = "1.4.批量禁用任务积分配置(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/task/batch/disable")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({
@ -115,7 +121,7 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "1.5.禁用任务积分配置", notes = "仅限admin权限用户调用")
@ApiOperation(value = "1.5.禁用任务积分配置(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/task/disable")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({
@ -131,7 +137,7 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "1.6. 任务积分列表", notes = "任务积分列表")
@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,
@ -168,7 +174,7 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "2.3.用户积分日志列表", notes = "用户积分日志列表")
@ApiOperation(value = "2.3.用户积分日志列表(APP&PC)", notes = "用户积分日志列表")
@PostMapping("/log/list/{page}/{size}")
@GlobalInterceptor(checkAppUserLogin = true)
public Result<PageResult<UserPointLog>> getUserPointLogList(
@ -180,7 +186,7 @@ public class PointController {
userPointLogService.getUserPointLogList(token, userPointLogSearchDto, page, size));
}
@ApiOperation(value = "2.4.每日签到", notes = "仅限app用户调用")
@ApiOperation(value = "2.4.每日签到(APP)", notes = "仅限app用户调用")
@PostMapping("/log/earn/sign")
@GlobalInterceptor(checkAppUserLogin = true)
@ApiImplicitParams({
@ -191,7 +197,7 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "2.5.分享期刊", notes = "仅限app用户调用")
@ApiOperation(value = "2.5.分享期刊(APP)", notes = "仅限app用户调用")
@PostMapping("/log/share/journal")
@GlobalInterceptor(checkAppUserLogin = true)
@ApiImplicitParams({
@ -204,7 +210,7 @@ public class PointController {
}
@ApiOperation(value = "3.1.添加抽奖", notes = "仅限admin权限用户调用")
@ApiOperation(value = "3.1.添加抽奖(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/lottery/add")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({
@ -217,7 +223,7 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "3.2.抽奖列表页", notes = "仅限admin权限用户调用")
@ApiOperation(value = "3.2.抽奖列表页(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/lottery/list/{page}/{size}")
@GlobalInterceptor(checkAdminLogin = true)
public Result<PageResult<Lottery>> lotteryList(
@ -228,7 +234,7 @@ public class PointController {
return Result.success(lotteryService.lotteryPageResult(page, size, lotterySearchDto));
}
@ApiOperation(value = "3.3.编辑抽奖", notes = "仅限admin权限用户调用")
@ApiOperation(value = "3.3.编辑抽奖(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/lottery/edit")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({
@ -241,7 +247,7 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "3.4.发布抽奖", notes = "仅限admin权限用户调用")
@ApiOperation(value = "3.4.发布抽奖(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/lottery/publish")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({
@ -254,7 +260,7 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "3.5.停止抽奖", notes = "仅限admin权限用户调用")
@ApiOperation(value = "3.5.停止抽奖(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/lottery/stop")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({
@ -268,7 +274,7 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "3.6.参与抽奖")
@ApiOperation(value = "3.6.参与抽奖(APP)")
@PostMapping("/lottery/participate")
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ -280,7 +286,7 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "3.7.自动抽奖结果", notes = "用这个方法主动触发自动抽奖结果")
@ApiOperation(value = "3.7.自动抽奖结果(PC)", notes = "用这个方法主动触发自动抽奖结果")
@PostMapping("/lottery/auto")
@GlobalInterceptor(checkAdminLogin = true)
@ApiImplicitParams({

@ -0,0 +1,32 @@
package com.luoo.user.dto.point;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* DTO for {@link com.luoo.user.pojo.TaskPoint}
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TaskPointDto implements Serializable {
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "积分")
private Integer score;
@ApiModelProperty(value = "任务类型 1-新手任务(只触发一次) 2-日常任务(每次触发) 3-特殊任务")
private Integer type;
@ApiModelProperty(value = "任务描述")
private String description;
@ApiModelProperty("是否生效1-生效 2-不生效")
private Integer valid;
}

@ -45,7 +45,7 @@ public class TaskPoint {
private Integer score;
@Column(name = "type")
@ApiModelProperty(value = "任务类型 1-新手任务(只触发一次) 2-日常任务(每次触发)")
@ApiModelProperty(value = "任务类型 1-新手任务(只触发一次) 2-日常任务(每次触发) 3-特殊任务")
private Integer type;
@Size(max = 255)

@ -2,10 +2,12 @@ package com.luoo.user.service;
import api.PageResult;
import com.luoo.user.dao.TaskPointDao;
import com.luoo.user.dto.point.TaskPointDto;
import com.luoo.user.pojo.TaskPoint;
import dto.UserLoginDto;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@ -88,8 +90,10 @@ public class TaskPointService {
* @param token
*/
@Transactional(rollbackFor = Exception.class)
public void batchUpdate(List<TaskPoint> taskPoints, String token) {
for (TaskPoint taskPoint : taskPoints) {
public void batchUpdate(List<TaskPointDto> taskPoints, String token) {
for (TaskPointDto taskPointDto : taskPoints) {
TaskPoint taskPoint = new TaskPoint();
BeanUtils.copyProperties(taskPointDto, taskPoint);
update(taskPoint, token);
}
}

Loading…
Cancel
Save