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);
|
}
|
}
|