puzhibing
2026-04-29 67f37d5ff7418fd03158af226ab67b48019c7b06
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
package com.xiaopeng.operation.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaopeng.api.model.operation.XpOfficialPartner;
import com.xiaopeng.common.core.exception.ServiceException;
import com.xiaopeng.operation.mapper.XpOfficialPartnerMapper;
import com.xiaopeng.operation.service.IXpOfficialPartnerService;
import com.xiaopeng.operation.vo.OfficialPartnerVo;
import org.springframework.stereotype.Service;
 
@Service
public class XpOfficialPartnerServiceImpl extends ServiceImpl<XpOfficialPartnerMapper, XpOfficialPartner> implements IXpOfficialPartnerService {
 
 
    /**
     * 添加合作商
     * @param vo
     */
    @Override
    public void addOfficialPartner(OfficialPartnerVo vo) {
        XpOfficialPartner officialPartner = this.getOne(new QueryWrapper<XpOfficialPartner>().eq("app_key", vo.getAppKey()).eq("is_deleted", 0));
        if(null == officialPartner){
            throw new ServiceException("权限校验失败");
        }
        if(!officialPartner.getAppSecret().equals(vo.getAppSecret())){
            throw new ServiceException("权限校验失败");
        }
        XpOfficialPartner xpOfficialPartner = new XpOfficialPartner();
        xpOfficialPartner.setName(vo.getName());
        xpOfficialPartner.setBrandName(vo.getBrandName());
        xpOfficialPartner.setLogoUrl(vo.getLogoUrl());
        this.updateById(xpOfficialPartner);
    }
}