mitao
2024-05-27 c26092c422c4b72fa5d51a38f6de1b48ab1ccd87
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
package com.ruoyi.auction.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.auction.controller.forepart.dto.AuctionSalesroomGoodsDTO;
import com.ruoyi.auction.controller.forepart.dto.ForepartAuctionBidRecordDTO;
import com.ruoyi.auction.controller.forepart.vo.ForepartAuctionSalesroomVO;
import com.ruoyi.auction.domain.AuctionSalesroom;
import com.ruoyi.auction.domain.AuctionVideo;
import com.ruoyi.auction.mapper.AuctionSalesroomMapper;
import com.ruoyi.auction.service.IAuctionSalesroomService;
import com.ruoyi.auction.service.IAuctionVideoService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.page.PageDTO;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
 
/**
 * <p>
 * 拍卖场表 服务实现类
 * </p>
 *
 * @author mitao
 * @since 2024-05-16
 */
@Service
public class AuctionSalesroomServiceImpl extends ServiceImpl<AuctionSalesroomMapper, AuctionSalesroom> implements IAuctionSalesroomService {
    @Resource
    private IAuctionSalesroomService iAuctionSalesroomService;
 
    @Resource
    private IAuctionVideoService iAuctionVideoService;
 
    @Resource
    private SysUserClient sysUserClient;
 
 
    @Override
    public PageDTO<AuctionSalesroom> getAuctionBidRecordList(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) {
        Page<AuctionSalesroom> page = new Page<>(ationSalesroomGoodsDTO.getPageCurr(), ationSalesroomGoodsDTO.getPageSize());
        LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery();
        wrapper.eq(AuctionSalesroom::getSalesroomName,ationSalesroomGoodsDTO.getSalesroomName());
        wrapper.eq(AuctionSalesroom::getDelFlag,0);
        Page<AuctionSalesroom> page1=iAuctionSalesroomService.page(page, wrapper);
        return PageDTO.of(page1);
    }
 
    @Override
    public ForepartAuctionSalesroomVO getBaaner(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) {
        LambdaQueryWrapper<AuctionVideo> wrapper=Wrappers.lambdaQuery();
        wrapper.eq(AuctionVideo::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId());
        wrapper.eq(AuctionVideo::getDelFlag,0);
        AuctionVideo auctionVideo=iAuctionVideoService.getOne(wrapper);
        ForepartAuctionSalesroomVO forepartAuctionSalesroomVO =new ForepartAuctionSalesroomVO();
        AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId());
        forepartAuctionSalesroomVO.setAuctionSalesroomStatus(auctionSalesroom.getStatus().getCode());
        if (auctionVideo!=null){
            forepartAuctionSalesroomVO.setUrl(auctionVideo.getPromotionVideoUrl());
        }else{
            forepartAuctionSalesroomVO.setUrl(auctionSalesroom.getCoverPic());
        }
        return forepartAuctionSalesroomVO;
    }
 
    @Override
    public AuctionSalesroom getAuctionBidRecordOne(ForepartAuctionBidRecordDTO arepartAuctionBidRecordDTO) {
        R<SysUser> r=sysUserClient.queryUserByPhone(arepartAuctionBidRecordDTO.getPhone());
        SysUser sysUser=r.getData();
 
        if (sysUser!=null){
            throw new ServiceException("手机号未注册");
        }
 
        if (!sysUser.getPassword().equals(arepartAuctionBidRecordDTO.getPassword())){
            throw new ServiceException("密码输入错误");
        }
 
        if (!sysUser.getUserType().equals("2")){
            throw new ServiceException("该人员不是拍卖师");
        }
 
        LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery();
        wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,arepartAuctionBidRecordDTO.getAuctionSalesroomQrcode());
        wrapper.eq(AuctionSalesroom::getDelFlag,0);
        AuctionSalesroom auctionBidRecord=iAuctionSalesroomService.getOne(wrapper);
        return auctionBidRecord;
    }
}