admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
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
120
121
122
123
124
125
126
127
128
129
130
package com.yeshi.fanli.util.factory.goods;
 
import java.math.BigDecimal;
 
import com.yeshi.fanli.dto.jd.JDShopInfo;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.common.entity.taobao.TaoBaoShop;
import com.yeshi.common.entity.taobao.TaoBaoShopInfo;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.vo.goods.ShopInfoVO;
 
 
 
/**
 *  店铺加工
 * @author Administrator
 *
 */
public class ShopInfoVOFactory {
 
    
    /**
     * 淘宝店铺
     * @param goods 淘宝商品
     * @param pid
     * @param fanLiRate 返利比例
     * @return
     */
    public static ShopInfoVO convertTaoBaoShop(TaoBaoShop shop) {
        ShopInfoVO shopInfoVO = new ShopInfoVO();
        shopInfoVO.setId(shop.getId().toString());
        shopInfoVO.setShopLink(shop.getShopLink());
        shopInfoVO.setScoreGoods(shop.getScoreGoods());
        shopInfoVO.setScoreSeller(shop.getScoreSeller());
        shopInfoVO.setScoreLogistics(shop.getScoreLogistics());
        shopInfoVO.setScoreGoodsD(shop.getScoreGoodsD());
        shopInfoVO.setScoreSellerD(shop.getScoreSellerD());
        shopInfoVO.setScoreLogisticsD(shop.getScoreLogisticsD());
        shopInfoVO.setGoodRatePercentage(shop.getGoodRatePercentage());
        
        Integer shopType = shop.getUserType();
        if (shopType != null && shopType == 1) {
            shopInfoVO.setUserType(11); // 天猫
        } else {
            shopInfoVO.setUserType(10); // 淘宝
        }
        
        String shopNameCustom = shop.getShopNameCustom();
        if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
            shopInfoVO.setShopName(shopNameCustom);
        } else {
            shopInfoVO.setShopName(shop.getShopName());
        }
        
        String shopIconCustom = shop.getShopIconCustom();
        if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
            shopInfoVO.setShopIcon(shopIconCustom);
        } else {
            shopInfoVO.setShopIcon(shop.getShopIcon());
        }
        
        String shopLink = shop.getShopLink();
        if (StringUtil.isNullOrEmpty(shopLink))
            shopLink = TaoBaoUtil.getShopLink(shop.getId());
        shopInfoVO.setShopLink(shopLink);
        
        return shopInfoVO;
    }
    
 
    /**
     * 淘宝店铺
     * @param goods 淘宝商品
     * @param pid
     * @param fanLiRate 返利比例
     * @return
     */
    public static ShopInfoVO convertTaoBaoShop(TaoBaoShopInfo shop) {
        ShopInfoVO shopInfoVO = new ShopInfoVO();
        shopInfoVO.setId(shop.getUserId().toString());
        shopInfoVO.setShopName(shop.getShopTitle());
        shopInfoVO.setShopIcon(shop.getPictureUrl());
        shopInfoVO.setShopLink(shop.getShopUrl());
        String shopType = shop.getShopType();
        if (shopType != null && "B".equalsIgnoreCase(shopType)) {
            shopInfoVO.setUserType(11); // 天猫
        } else {
            shopInfoVO.setUserType(10); // 淘宝
        }
        return shopInfoVO;
    }
    
    
    /**
     * 拼多多店铺
     * @param goods 淘宝商品
     * @param pid
     * @param fanLiRate 返利比例
     * @return
     */
    public static ShopInfoVO convertPDDShop(PDDGoodsDetail goods) {
        ShopInfoVO shopInfoVO = new ShopInfoVO();
        shopInfoVO.setId(goods.getMallId().toString());
        shopInfoVO.setShopName(goods.getMallName());
        shopInfoVO.setUserType(30);
        shopInfoVO.setScoreGoods(new BigDecimal(goods.getAvgDesc()));
        shopInfoVO.setScoreSeller(new BigDecimal(goods.getAvgServ()));
        shopInfoVO.setScoreLogistics(new BigDecimal(goods.getAvgLgst()));
        shopInfoVO.setGoodRatePercentage(new BigDecimal(goods.getGoodsEvalScore()));
        shopInfoVO.setShopLink("https://mobile.yangkeduo.com/mall_page.html?mall_id=" + goods.getMallId());
        return shopInfoVO;
    }
    
    /**
     * 拼多多店铺
     * @param goods 淘宝商品
     * @param pid
     * @param fanLiRate 返利比例
     * @return
     */
    public static ShopInfoVO convertJDShop(JDShopInfo shopInfo) {
        ShopInfoVO shopInfoVO = new ShopInfoVO();
        shopInfoVO.setId(shopInfo.getShopId().toString());
        shopInfoVO.setShopName(shopInfo.getShopName());
        shopInfoVO.setUserType(20);
        shopInfoVO.setShopLink("https://shop.m.jd.com/?shopId=" + shopInfo.getShopId());
        return shopInfoVO;
    }
}