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
package com.panzhihua.service_community.service.impl;
 
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.dtos.property.CommonPage;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.raffle.ComActRafflePrizeCount;
import com.panzhihua.common.model.vos.community.raffle.ComActRaffleRecordVO;
import com.panzhihua.common.model.vos.community.warehouse.QRCodeVO;
import com.panzhihua.service_community.dao.ComActRafflePrizeDao;
import com.panzhihua.service_community.entity.ComActRaffleRecord;
import com.panzhihua.service_community.dao.ComActRaffleRecordDao;
import com.panzhihua.service_community.service.ComActRaffleRecordService;
import com.panzhihua.service_community.util.QRCodeUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
 
/**
 * 抽奖活动中奖记录表(ComActRaffleRecord)表服务实现类
 * projectName 成都呐喊信息技术有限公司-智慧社区项目
 * description: 抽奖活动中奖记录表相关功能
 *
 * @author zzj
 * @since 2022-02-18 14:32:02
 */
@Slf4j
@Service
public class ComActRaffleRecordServiceImpl extends ServiceImpl<ComActRaffleRecordDao, ComActRaffleRecord> implements ComActRaffleRecordService {
    @Resource
    private ComActRafflePrizeDao comActRafflePrizeDao;
    @Resource
    private ComActRaffleRecordDao comActRaffleRecordDao;
 
    @Override
    public R pageList(CommonPage commonPage) {
        return R.ok(this.baseMapper.pageList(new Page(commonPage.getPage(),commonPage.getSize()),commonPage));
    }
 
    @Override
    public R queryPrize(Long id) {
        ComActRafflePrizeCount comActRafflePrizeCount= comActRafflePrizeDao.selectCount(id);
        comActRafflePrizeCount.setComActRafflePrizeVOList(comActRafflePrizeDao.selectByRaffleId(id));
        return R.ok(comActRafflePrizeCount);
    }
 
    @Override
    public R queryQrCode(QRCodeVO qrCodeVO) {
        ComActRaffleRecordVO comActRaffleRecord=comActRaffleRecordDao.selectOneById((long)qrCodeVO.getId());
        if(comActRaffleRecord!=null){
            return R.ok(QRCodeUtil.getBase64QRCode(JSON.toJSONString(qrCodeVO)));
        }
        return R.fail("抽奖记录不存在");
    }
 
    @Override
    public R export(CommonPage commonPage) {
        return R.ok(this.baseMapper.export(commonPage));
    }
 
    @Override
    public R selectById(Long id) {
        return R.ok(this.baseMapper.selectOneById(id));
    }
}