bug
jiangqs
2023-08-25 156e141e55a8abf486157d1fa89d25e23f4a06a3
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package com.ruoyi.shop.service.impl.shop;
 
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.ruoyi.common.core.utils.bean.BeanUtils;
import com.ruoyi.shop.domain.dto.MerShopCertificateEditDto;
import com.ruoyi.shop.domain.dto.MerShopCertificateListDto;
import com.ruoyi.shop.domain.dto.MgtAuditShopCertificateDto;
import com.ruoyi.shop.domain.dto.MgtShopCertificatePageDto;
import com.ruoyi.shop.domain.pojo.shop.ShopCertificate;
import com.ruoyi.shop.domain.vo.MerShopCertificateListVo;
import com.ruoyi.shop.domain.vo.MgtShopCertificatePageVo;
import com.ruoyi.shop.mapper.shop.ShopCertificateMapper;
import com.ruoyi.shop.service.shop.ShopCertificateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
 
/**
 * <p>
 * 商户证书 服务实现类
 * </p>
 *
 * @author jqs
 * @since 2023-04-25
 */
@Service
public class ShopCertificateServiceImpl extends ServiceImpl<ShopCertificateMapper, ShopCertificate> implements ShopCertificateService {
 
    @Resource
    private ShopCertificateMapper shopCertificateMapper;
 
    /**
     * 通过商户id获取商户证书
     * @param shopId
     * @return
     */
    @Override
    public List<ShopCertificate> listShopCertificateByShopId(Long shopId){
        LambdaQueryWrapper<ShopCertificate> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(ShopCertificate::getDelFlag, 0).eq(ShopCertificate::getShopId, shopId).eq(ShopCertificate::getCerStatus,1);
        return this.list(queryWrapper);
    }
 
    /**
     *
     * @param merShopCertificateListDto
     * @return
     */
    @Override
    public List<MerShopCertificateListVo> listShopCertificateVo(MerShopCertificateListDto merShopCertificateListDto){
        List<MerShopCertificateListVo> merShopCertificateListVoList = shopCertificateMapper.listShopCertificateVo(merShopCertificateListDto);
        return merShopCertificateListVoList;
    }
 
    /**
     *
     * @param merShopCertificateEditDto
     */
    @Override
    public void editShopCertificate(MerShopCertificateEditDto merShopCertificateEditDto){
        ShopCertificate shopCertificate = this.getById(merShopCertificateEditDto.getCerId());
        if(shopCertificate==null){
            shopCertificate = new ShopCertificate();
        }
        BeanUtils.copyProperties(merShopCertificateEditDto,shopCertificate);
        shopCertificate.setCerStatus(0);
        shopCertificate.setDelFlag(0);
        shopCertificate.setCreateTime(new Date());
        this.saveOrUpdate(shopCertificate);
    }
 
    /**
     *
     * @param certId
     */
    @Override
    public void deleteShopCertificate(Long certId){
        ShopCertificate shopCertificate = this.getById(certId);
        shopCertificate.setDelFlag(1);
        shopCertificate.setCerStatus(-1);
        this.saveOrUpdate(shopCertificate);
    }
 
    /**
     * @description  平台获取证书审核列表
     * @author  jqs
     * @date    2023/6/12 17:14
     * @param page
     * @param mgtShopCertificatePageDto
     * @return  List<MgtShopCertificatePageVo>
     */
    @Override
    public List<MgtShopCertificatePageVo> pageMgtShopCertificate(Page page, MgtShopCertificatePageDto mgtShopCertificatePageDto){
        List<MgtShopCertificatePageVo> mgtShopCertificatePageVoList = shopCertificateMapper.pageMgtShopCertificate(page, mgtShopCertificatePageDto);
        return mgtShopCertificatePageVoList;
    }
 
    /**
     * @description  审核证书
     * @author  jqs
     * @date    2023/6/12 17:50
     * @param mgtAuditShopCertificateDto
     * @return  void
     */
    @Override
    public void mgtAuditShopCertificate(MgtAuditShopCertificateDto mgtAuditShopCertificateDto){
        ShopCertificate shopCertificate = this.getById(mgtAuditShopCertificateDto.getCerId());
        shopCertificate.setCerStatus(mgtAuditShopCertificateDto.getCerStatus());
        shopCertificate.setAuditUserId(mgtAuditShopCertificateDto.getUserId());
        shopCertificate.setAuditTime(new Date());
        shopCertificate.setRefuseReason(mgtAuditShopCertificateDto.getRefuseReason());
        this.saveOrUpdate(shopCertificate);
    }
}