| | |
| | | */
|
| | | public static BigDecimal getGoodsFanLiMoney(PDDGoodsDetail goods, BigDecimal rate) {
|
| | | BigDecimal money = null;
|
| | | BigDecimal price = new BigDecimal(goods.getMinNormalPrice());
|
| | | BigDecimal promotionRate = new BigDecimal(goods.getPromotionRate());
|
| | | BigDecimal hundred = new BigDecimal(100);
|
| | | rate = MoneyBigDecimalUtil.div(rate, hundred);
|
| | | BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred).setScale(2);
|
| | | BigDecimal promotionRate = MoneyBigDecimalUtil.div(new BigDecimal(goods.getPromotionRate()), new BigDecimal(1000));
|
| | |
|
| | | Boolean hasCoupon = goods.getHasCoupon();
|
| | | if (hasCoupon == null || !hasCoupon) {
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(
|
| | | MoneyBigDecimalUtil.mul(price, promotionRate),new BigDecimal("0.001")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price, promotionRate), rate);
|
| | | } else {
|
| | | BigDecimal amount = new BigDecimal(goods.getCouponDiscount());
|
| | | BigDecimal startFree = new BigDecimal(goods.getCouponMinOrderAmount()); |
| | | 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(MoneyBigDecimalUtil.mul(finalPrice, promotionRate), new BigDecimal("0.001")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | |
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(finalPrice, promotionRate),rate);
|
| | | } else {// 不能用券
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(
|
| | | MoneyBigDecimalUtil.mul(price,promotionRate), new BigDecimal("0.001")), |
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(price,promotionRate), rate);
|
| | | }
|
| | | }
|
| | | return BigDecimalUtil.getWithNoZera(money);
|
| | | return BigDecimalUtil.getWithNoZera(money).setScale(2);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public static BigDecimal getQuanPrice(PDDGoodsDetail goods) {
|
| | | BigDecimal price = new BigDecimal(goods.getMinNormalPrice());
|
| | | BigDecimal hundred = new BigDecimal(100);
|
| | | BigDecimal price = MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), hundred);
|
| | | Boolean hasCoupon = goods.getHasCoupon();
|
| | | if (hasCoupon == null || !hasCoupon) {
|
| | | return price;
|
| | | return price.setScale(2);
|
| | | }
|
| | |
|
| | | BigDecimal amount = new BigDecimal(goods.getCouponDiscount());
|
| | | BigDecimal startFree = new BigDecimal(goods.getCouponMinOrderAmount());
|
| | | BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred);
|
| | | BigDecimal startFree = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponMinOrderAmount()), hundred);
|
| | | if (startFree.compareTo(price) <= 0) {
|
| | | BigDecimal quanPrice = MoneyBigDecimalUtil.sub(price, amount);
|
| | | return quanPrice;
|
| | | return quanPrice.setScale(2);
|
| | | } else {
|
| | | return price;
|
| | | return price.setScale(2);
|
| | | }
|
| | | }
|
| | |
|
| | | public static String getSaleCount(long count) {
|
| | | String salesCountMidea = null;
|
| | | if (count < 10000) {
|
| | | salesCountMidea = count + "";
|
| | | } else {
|
| | | double sales = count;
|
| | | salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | salesCountMidea = salesCountMidea + "万";
|
| | | }
|
| | | return salesCountMidea;
|
| | | }
|
| | | |
| | |
|
| | |
|
| | |
|
| | |
|
| | | public static List<String> getDetailImages(Long id) {
|
| | | List<String> imgList = new ArrayList<>();
|