phpcjl
2024-12-05 986338e0539c7a673d80b26086b3bed496dcc3fc
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
76
77
78
79
80
81
package com.ruoyi.account.controller;
 
 
import com.ruoyi.account.api.model.UserPoint;
import com.ruoyi.account.service.UserPointService;
import com.ruoyi.account.vo.UserPointDetailVO;
import com.ruoyi.account.vo.UserPointVO;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author luodangjia
 * @since 2024-11-21
 */
@RestController
@RequestMapping("/user-point")
@Api(tags = "个人积分")
public class UserPointController extends BaseController {
    @Resource
    private UserPointService userPointService;
 
 
    /**
     * 获取个人积分
     */
    @GetMapping("/getUserPoint")
    @ApiOperation("获取个人积分")
    public R<UserPointVO> getUserPoint(){
        return R.ok(userPointService.getUserPoint(SecurityUtils.getUserId()));
    }
 
    /**
     * 获取变更明细
     */
    @GetMapping("/getUserPointDetail")
    @ApiOperation("获取变更明细")
    public R<TableDataInfo> getUserPointDetail(@ApiParam("指定日期") LocalDateTime date,
                                            @ApiParam("变动类型(1=消费积分,2=返佣积分,3=拉新人积分,4=兑换商品 " +
                                                           "5 = 门店业绩积分 6 =门店返佣积分7=技师业绩积分8 =转赠积分 9 =做工积分 " +
                                                           "10 =注册积分)") Integer type){
        startPage();
        List<UserPointDetailVO> list = userPointService.getUserPointDetail(SecurityUtils.getUserId(), date, type);
        return R.ok(getDataTable(list));
    }
 
    /**
     * 转赠积分
     */
    @PostMapping("/transferPoint")
    @ApiOperation("转赠积分")
    public R<Void> transferPoint(@ApiParam("积分") BigDecimal point, @ApiParam("手机号") Long phone){
        return R.ok();
    }
    
    
    /**
     * 保存积分流水记录
     * @param userPoint
     * @return
     */
    @PostMapping("/saveUserPoint")
    public R saveUserPoint(@RequestBody UserPoint userPoint){
        userPointService.save(userPoint);
        return R.ok();
    }
}