PointsOperationController.java
3.07 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package com.topdraw.business.process.rest;
import com.topdraw.annotation.Log;
import com.topdraw.business.basicdata.points.available.service.PointsAvailableService;
import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria;
import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryType;
import com.topdraw.business.basicdata.points.detail.service.PointsDetailService;
import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailQueryCriteria;
import com.topdraw.business.process.domian.TempPoints;
import com.topdraw.business.process.service.PointsOperationService;
import com.topdraw.common.ResultInfo;
import com.topdraw.util.TimestampUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author XiangHan
* @date 2021-10-22
*/
@Api(tags = "PointsOperation管理")
@RestController
@RequestMapping("/api/PointsOperation")
public class PointsOperationController {
private static final Logger LOG = LoggerFactory.getLogger(PointsOperationController.class);
@Autowired
private PointsOperationService pointsOperationService;
@Autowired
private PointsDetailService pointsDetailService;
@Autowired
private PointsAvailableService pointsAvailableService;
@GetMapping(value = "/pagePointsDetails")
@ApiOperation("查询PointsDetail")
public ResultInfo pagePointsDetails(PointsDetailQueryCriteria criteria, Pageable pageable) {
return ResultInfo.successPage(pointsDetailService.queryAll(criteria,pageable));
}
@GetMapping(value = "/pageAvailablePoints")
@ApiOperation("查询PointsAvailable")
public ResultInfo pageAvailablePoints(PointsAvailableQueryCriteria criteria, Pageable pageable) {
PointsAvailableQueryType queryType = criteria.getQueryType();
// 可用
if (queryType == PointsAvailableQueryType.AVAILABLE_ONLY) {
criteria.setExpireTime(TimestampUtil.now());
}
return ResultInfo.successPage(pointsAvailableService.queryAll(criteria,pageable));
}
@Log
@PostMapping(value = "/grantPointsByManual")
@ApiOperation("新增PointsDetail")
public ResultInfo grantPointsByManual(@Validated @RequestBody TempPoints tempPoints) {
Long memberId = tempPoints.getMemberId();
LOG.info("PointsOperationController -->> grantPointsByManual -->> " + tempPoints);
this.pointsOperationService.grantPointsByManual(memberId,tempPoints);
return ResultInfo.success();
}
@Log
@PostMapping(value = "/customPoints")
@ApiOperation("积分消耗")
public ResultInfo customPoints(@Validated @RequestBody TempPoints tempPoints) {
this.pointsOperationService.customPoints(tempPoints);
return ResultInfo.success();
}
}