|  |  |  | 
|---|
|  |  |  | import com.mzl.flower.entity.partner.Partner; | 
|---|
|  |  |  | import com.mzl.flower.mapper.customer.CustomerMapper; | 
|---|
|  |  |  | import com.mzl.flower.mapper.partner.PartnerMapper; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | public class CustomerService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | if (StringUtils.isNotBlank(c.getPartnerId()) || StringUtils.isNotBlank(c.getPartnerUserId())) { | 
|---|
|  |  |  | throw new ValidationException("商户已绑定合伙人,请联系客服人员进行解绑后再进行绑定"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        Partner partner = partnerMapper.selectOne(new QueryWrapper<Partner>() | 
|---|
|  |  |  | //                .eq("user_id", dto.getPartnerUserId())); | 
|---|
|  |  |  | Partner partner = partnerMapper.getByIdOrUserId(dto.getPartnerUserId()); //适配id和userId | 
|---|
|  |  |  | Partner partner; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | long id = Long.parseLong(dto.getPartnerUserId()); | 
|---|
|  |  |  | partner = partnerMapper.selectById(id); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | partner =partnerMapper.selectOne(new QueryWrapper<Partner>().eq("user_id", dto.getPartnerUserId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (partner == null) { | 
|---|
|  |  |  | throw new ValidationException("合伙人不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getPartnerName(String partnerUserId) { | 
|---|
|  |  |  | if (StringUtils.isNotBlank(partnerUserId)) { | 
|---|
|  |  |  | Partner partner = partnerMapper.getByIdOrUserId(partnerUserId); | 
|---|
|  |  |  | Partner partner; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | long id = Long.parseLong(partnerUserId); | 
|---|
|  |  |  | partner = partnerMapper.selectById(id); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | partner =partnerMapper.selectOne(new QueryWrapper<Partner>().eq("user_id", partnerUserId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (partner == null) { | 
|---|
|  |  |  | throw new ValidationException("合伙人不存在"); | 
|---|
|  |  |  | } | 
|---|