mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.panzhihua.applets.api;
 
 
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.property.CommonPage;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.raffle.ComActRaffleRecordVO;
import com.panzhihua.common.model.vos.community.warehouse.QRCodeVO;
import com.panzhihua.common.service.community.CommunityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.Date;
 
/**
 * 抽奖活动中奖记录表(ComActRaffleRecord)表控制层
 * projectName 成都呐喊信息技术有限公司-智慧社区项目
 * description: 抽奖活动中奖记录表相关功能
 *
 * @author zzj
 * @since 2022-02-18 14:32:02
 */
@Slf4j
@Api(tags = {"获奖记录"})
@RestController
@RequestMapping("comActRaffleRecord")
public class ComActRaffleRecordApi extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private CommunityService communityService;
 
    /**
     * 分页查询所有数据
     *
     * @param commonPage 查询实体
     * @return 所有数据
     */
    @ApiOperation(value = "分页查询",response = ComActRaffleRecordVO.class)
    @PostMapping("queryAll")
    public R selectAll(@RequestBody CommonPage commonPage) {
        return this.communityService.selectAllComActRaffleRecord(commonPage);
    }
    @ApiOperation(value = "根据抽奖活动id获取奖品统计")
    @GetMapping("/queryPrize")
    public R queryPrize(@RequestParam("id")Long id){
        return this.communityService.queryPrize(id);
    }
 
    /**
     * 生成二维码
     * @param qrCodeVO
     * @return
     */
    @ApiOperation("生成二维码")
    @PostMapping("/getQRCode")
    public R getQRCode(@RequestBody QRCodeVO qrCodeVO){
        return this.communityService.getRaffleQRCode(qrCodeVO);
    }
 
    /**
     * 修改数据
     *
     * @param comActRaffleRecordVO 实体对象
     * @return 修改结果
     */
    @ApiOperation("核销接口")
    @PostMapping("/update")
    public R update(@RequestBody ComActRaffleRecordVO comActRaffleRecordVO) {
        comActRaffleRecordVO.setStaffId(this.getUserId());
        comActRaffleRecordVO.setStaffTime(new Date());
        comActRaffleRecordVO.setStatus(2);
        return this.communityService.updateRaffleRecord(comActRaffleRecordVO);
    }
    /**
     * 新增数据
     *
     * @param comActRaffleRecordVO 实体对象
     * @return 新增结果
     */
    @ApiOperation("参加活动")
    @PostMapping
    public R insert(@RequestBody ComActRaffleRecordVO comActRaffleRecordVO) {
        comActRaffleRecordVO.setCreateTime(new Date());
        comActRaffleRecordVO.setUserId(this.getUserId());
        comActRaffleRecordVO.setStatus(0);
        return communityService.insertRaffleRecord(comActRaffleRecordVO);
    }
    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @ApiOperation("详情")
    @GetMapping("{id}")
    public R selectOne(@PathVariable("id") Long id) {
        return this.communityService.selectOneRaffleRecord(id);
    }
}