| | |
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | | import org.yeshi.utils.TimeUtil;
|
| | |
|
| | | public class PinDuoDuoUtil {
|
| | |
|
| | |
| | | promotionRate = MoneyBigDecimalUtil.div3(goods.getPredictPromotionRate(),
|
| | | new BigDecimal(1000));
|
| | |
|
| | | Boolean hasCoupon = goods.getHasCoupon();
|
| | | if (hasCoupon == null || !hasCoupon) {
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price, promotionRate), rate);
|
| | | } else {
|
| | | BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred);
|
| | | BigDecimal startFree = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponMinOrderAmount()), hundred);
|
| | | if (startFree.compareTo(price) <= 0 && price.compareTo(amount) > 0) {
|
| | | BigDecimal finalPrice = price.subtract(amount);
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(finalPrice, promotionRate), rate);
|
| | | } else {// 不能用券
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price, promotionRate), rate);
|
| | | }
|
| | | }
|
| | | return BigDecimalUtil.getWithNoZera(money).setScale(2);
|
| | | }
|
| | |
|
| | |
|
| | | public static BigDecimal getGoodsShareMoney(PDDGoodsDetail goods, BigDecimal rate) {
|
| | | BigDecimal money = null;
|
| | | BigDecimal hundred = new BigDecimal(100);
|
| | | rate = MoneyBigDecimalUtil.div(rate, hundred);
|
| | | BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred).setScale(2);
|
| | | BigDecimal promotionRate = MoneyBigDecimalUtil.div3(new BigDecimal(goods.getPromotionRate()),
|
| | | new BigDecimal(1000));
|
| | | Boolean hasCoupon = goods.getHasCoupon();
|
| | | if (hasCoupon == null || !hasCoupon) {
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price, promotionRate), rate);
|
| | |
| | | JSONArray array = json.optJSONObject("store").optJSONObject("initDataObj")
|
| | | .optJSONObject("goods").optJSONArray("detailGallery");
|
| | | for (int j = 0; j < array.size(); j++) {
|
| | | imgList.add("http:" + array.optJSONObject(j).optString("url"));
|
| | | String u = array.optJSONObject(j).optString("url");
|
| | | if (!u.startsWith("http"))
|
| | | imgList.add("http:" + u);
|
| | | else
|
| | | imgList.add(u);
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
| | | return urlList;
|
| | | }
|
| | |
|
| | | public static String getCustomParams(Long uid) {
|
| | | return uid + "_" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd");
|
| | | }
|
| | |
|
| | | public static String getUidFromCustomParams(String params) {
|
| | | return params.split("_")[0];
|
| | | }
|
| | |
|
| | | }
|