jiangqs
2023-04-20 437a8ae4bcca79e8886662a40c11f499fea1a25e
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
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;
    }
}