From ae2294be876ac4595d7b31b36c0057726d12354f Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 14 五月 2021 16:11:16 +0800 Subject: [PATCH] 淘宝券后价计算方法名称修改 --- fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopUtil.java | 158 +++++++++++++++++++++++++++------------------------- 1 files changed, 81 insertions(+), 77 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopUtil.java index c5e7b79..6ecad86 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopUtil.java @@ -11,93 +11,97 @@ public class VipShopUtil { - private static String getBase64Str(String str) { - try { - return StringUtil.getBase64String(str); - } catch (Exception e) { - e.printStackTrace(); - } + private static String getBase64Str(String str) { + try { + return StringUtil.getBase64String(str); + } catch (Exception e) { + e.printStackTrace(); + } - return null; - } + return null; + } - /** - * 鑾峰彇鍒嗕韩鐨勬笭閬撴爣璇� - * @Title: getShareChanTag - * @Description: - * @param uid - * @return - * String 杩斿洖绫诲瀷 - * @throws - */ - public static String getShareChanTag(Long uid) { - return getBase64Str("share#" + uid); - } + /** + * 鑾峰彇鍒嗕韩鐨勬笭閬撴爣璇� + * + * @param uid + * @return String 杩斿洖绫诲瀷 + * @throws + * @Title: getShareChanTag + * @Description: + */ + public static String getShareChanTag(Long uid) { + return getBase64Str("share#" + uid); + } - /** - * 鑾峰彇鑷喘鐨勬笭閬撴爣璇� - * @Title: getBuyChanTag - * @Description: - * @param uid - * @return - * String 杩斿洖绫诲瀷 - * @throws - */ - public static String getBuyChanTag(Long uid) { - return getBase64Str("buy#" + uid); + /** + * 鑾峰彇鑷喘鐨勬笭閬撴爣璇� + * + * @param uid + * @return String 杩斿洖绫诲瀷 + * @throws + * @Title: getBuyChanTag + * @Description: + */ + public static String getBuyChanTag(Long uid) { + return getBase64Str("buy#" + uid); - } + } - public static String getCouponChanTag() { - return getBase64Str("coupon"); + public static String getCouponChanTag() { + return getBase64Str("coupon"); - } + } - public static String getUidFromChanTag(String tag) { - String decodeTag = StringUtil.getFromBase64(tag); - return decodeTag.split("#")[1]; - } + public static String getUidFromChanTag(String tag) { + String decodeTag = StringUtil.getFromBase64(tag); + return decodeTag.split("#")[1]; + } - public static String getTypeFromChanTag(String tag) { - String decodeTag = StringUtil.getFromBase64(tag); - return decodeTag.split("#")[0]; - } + public static String getTypeFromChanTag(String tag) { + String decodeTag = StringUtil.getFromBase64(tag); + return decodeTag.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); - } + 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); + } - /** - * 鑾峰彇璁㈠崟璇︽儏鐨勫敮涓�鏍囪瘑 - * @Title: getOrderDetailIdentifyCode - * @Description: - * @param orderSn - * @param goodsId - * @param sizeId - * @return - * String 杩斿洖绫诲瀷 - * @throws - */ - public static String getOrderDetailIdentifyCode(String orderSn, String goodsId, String sizeId) { + public static BigDecimal getCouponPrice(VIPGoodsInfo goods) { + return new BigDecimal(goods.getVipPrice()); + } - return StringUtil.Md5(orderSn + "#" + goodsId + "#" + sizeId); - } + /** + * 鑾峰彇璁㈠崟璇︽儏鐨勫敮涓�鏍囪瘑 + * + * @param orderSn + * @param goodsId + * @param sizeId + * @return String 杩斿洖绫诲瀷 + * @throws + * @Title: getOrderDetailIdentifyCode + * @Description: + */ + public static String getOrderDetailIdentifyCode(String orderSn, String goodsId, String sizeId) { - public static String parseGoodsIdByUrl(String url) { - try { - if (url.contains(".vip.com/") && (url.contains("detail-") || url.contains("product-"))) { - String preUrl = url.split("\\?")[0]; - String goodsId = preUrl.split("-")[preUrl.split("-").length - 1].replace(".html", "").replace(".htm", - ""); - if (NumberUtil.isNumeric(goodsId)) - return goodsId; - } - } catch (Exception e) { - } - return null; - } + return StringUtil.Md5(orderSn + "#" + goodsId + "#" + sizeId); + } + + public static String parseGoodsIdByUrl(String url) { + try { + if (url.contains(".vip.com/") && (url.contains("detail-") || url.contains("product-"))) { + String preUrl = url.split("\\?")[0]; + String goodsId = preUrl.split("-")[preUrl.split("-").length - 1].replace(".html", "").replace(".htm", + ""); + if (NumberUtil.isNumeric(goodsId)) + return goodsId; + } + } catch (Exception e) { + } + return null; + } } -- Gitblit v1.8.0