package com.hrt.system.service.impl;
|
|
import com.hrt.system.domain.poji.shop.Shop;
|
import com.hrt.system.domain.poji.shop.ShopCertificate;
|
import com.hrt.system.domain.poji.shop.ShopFile;
|
import com.hrt.system.domain.poji.shop.ShopRelTag;
|
import com.hrt.system.domain.vo.AppShopInfoVo;
|
import com.hrt.system.mapper.shop.ShopMapper;
|
import com.hrt.system.service.shop.ShopCertificateService;
|
import com.hrt.system.service.shop.ShopFileService;
|
import com.hrt.system.service.shop.ShopRelTagService;
|
import com.hrt.system.service.shop.ShopService;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import org.springframework.beans.BeanUtils;
|
import org.springframework.context.annotation.Bean;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
import java.util.StringJoiner;
|
|
/**
|
* <p>
|
* 商户表 服务实现类
|
* </p>
|
*
|
* @author jqs
|
* @since 2023-04-17
|
*/
|
@Service
|
public class ShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements ShopService {
|
|
@Resource
|
private ShopMapper shopMapper;
|
|
@Resource
|
private ShopFileService shopFileService;
|
|
@Resource
|
private ShopCertificateService shopCertificateService;
|
|
/**
|
* 获取商户详情
|
* @param shopId
|
* @return
|
*/
|
@Override
|
public AppShopInfoVo getShopInfo(Long shopId){
|
AppShopInfoVo appShopInfoVo = new AppShopInfoVo();
|
Shop shop = this.getById(shopId);
|
BeanUtils.copyProperties(shop,appShopInfoVo);
|
//商户地址
|
appShopInfoVo.setShopAddress(shop.getShopAreaName()+shop.getShopAddress());
|
//商品图片
|
List<ShopFile> shopFileList = shopFileService.listShopFileByShopId(shopId);
|
String shopPicture = null;
|
StringJoiner shopBanners = new StringJoiner(",");
|
if(shopFileList!=null&&!shopFileList.isEmpty()){
|
for(ShopFile shopFile : shopFileList){
|
if(shopFile.getFileType()==1){
|
shopPicture = shopFile.getFileUrl();
|
}else{
|
shopBanners.add(shopFile.getFileUrl());
|
}
|
}
|
}
|
appShopInfoVo.setShopPicture(shopPicture);
|
appShopInfoVo.setShopBanners(shopBanners.toString());
|
//商户证书
|
List<ShopCertificate> shopCertificateList = shopCertificateService.listShopCertificateByShopId(shopId);
|
if(shopCertificateList!=null&&!shopCertificateList.isEmpty()){
|
appShopInfoVo.setShopCertificateList(shopCertificateList);
|
}
|
return appShopInfoVo;
|
}
|
}
|