admin
2020-05-20 b7ba001c2a17b592abc026a8cb81c3ef6ea6ef71
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
package com.yeshi.fanli.util.vipshop;
 
import java.math.BigDecimal;
 
import org.yeshi.utils.BigDecimalUtil;
 
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
 
public class VipShopUtil {
 
    /**
     * 获取分享的渠道标识
     * @Title: getShareChanTag
     * @Description: 
     * @param uid
     * @return 
     * String 返回类型
     * @throws
     */
    public static String getShareChanTag(Long uid) {
        return "share#" + uid;
    }
 
    /**
     * 获取自购的渠道标识
     * @Title: getBuyChanTag
     * @Description: 
     * @param uid
     * @return 
     * String 返回类型
     * @throws
     */
    public static String getBuyChanTag(Long uid) {
        return "buy#" + uid;
 
    }
 
    public static String getUidFromChanTag(String tag) {
 
        return tag.split("#")[1];
    }
 
    public static String getTypeFromChanTag(String tag) {
        return tag.split("#")[0];
    }
 
    public static BigDecimal getGoodsFanLiMoney(VIPGoodsInfo goods, BigDecimal rate) {
        BigDecimal money = null;
        BigDecimal hundred = new BigDecimal(100);
        rate = MoneyBigDecimalUtil.div(rate, hundred);
        money = MoneyBigDecimalUtil.mul(new BigDecimal(goods.getCommission()), rate);
        return BigDecimalUtil.getWithNoZera(money).setScale(2);
    }
}