ExpOperationController.java
1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.topdraw.business.process.rest;
import com.topdraw.business.process.domian.TempExp;
import com.topdraw.business.process.service.ExpOperationService;
import com.topdraw.common.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
/**
* @author XiangHan
* @date 2021-10-22
*/
@Api(tags = "成长值管理")
@RestController
@RequestMapping("/uce/expOperation")
@Slf4j
public class ExpOperationController {
@Autowired
private ExpOperationService expOperationService;
@PostMapping(value = "/addExp")
@ApiOperation("手动发放成长值")
public ResultInfo grantExpByManual(@Validated @RequestBody TempExp tempExp) {
log.info("手动发放成长值,参数 ==>> {}", tempExp);
Long memberId = tempExp.getMemberId();
if (Objects.isNull(memberId)) {
log.error("发放成长值失败,参数错误,无会员id");
return ResultInfo.failure("发放成长值失败,参数错误,无会员id");
}
Long rewardExp = tempExp.getRewardExp();
if (Objects.isNull(rewardExp) || rewardExp <= 0L) {
log.error("发放成长值失败,参数错误,成长值为空或者小于0 ==>> {}", rewardExp);
return ResultInfo.failure("发放成长值失败,参数错误,成长值为空或者小于0");
}
List<TempExp> tempExpList = Arrays.asList(tempExp);
this.expOperationService.grantExpByManual(tempExpList);
return ResultInfo.success();
}
}