| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getGoodsCouponList", method = RequestMethod.POST) |
| | | public void getGoodsCouponList(AcceptData acceptData, Long uid, Long auctionId, PrintWriter out) { |
| | | public void getGoodsCouponList(AcceptData acceptData, Long uid, String auctionId, PrintWriter out) { |
| | | if (uid == null) { |
| | | out.print(JsonUtil.loadFalseResult("用户未登录")); |
| | | return; |
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "useFreeCoupon", method = RequestMethod.POST) |
| | | public void useFreeCoupon(AcceptData acceptData, Long uid, Long cid, Long goodId, Integer goodsType, PrintWriter out) { |
| | | public void useFreeCoupon(AcceptData acceptData, Long uid, Long cid, String goodId, Integer goodsType, PrintWriter out) { |
| | | if (uid == null) { |
| | | out.print(JsonUtil.loadFalseResult("用户未登录")); |
| | | return; |
| | |
| | | BigDecimal priceLimit = BigDecimal.valueOf(9.9); |
| | | switch (goodsType) { |
| | | case Constant.SOURCE_TYPE_TAOBAO: |
| | | state = checkCanUsedTB(Long.parseLong(goodsId), priceLimit); |
| | | state = checkCanUsedTB(goodsId, priceLimit); |
| | | break; |
| | | case Constant.SOURCE_TYPE_JD: |
| | | state = checkCanUsedTB(Long.parseLong(goodsId), priceLimit); |
| | | state = checkCanUsedTB(goodsId, priceLimit); |
| | | break; |
| | | case Constant.SOURCE_TYPE_PDD: |
| | | state = checkCanUsedTB(Long.parseLong(goodsId), priceLimit); |
| | | state = checkCanUsedTB(goodsId, priceLimit); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | } |
| | | |
| | | |
| | | private boolean checkCanUsedTB(Long goodsId, BigDecimal priceLimit) { |
| | | private boolean checkCanUsedTB(String goodsId, BigDecimal priceLimit) { |
| | | try { |
| | | TaoBaoGoodsBrief goods = redisManager.getTaoBaoGoodsBrief(goodsId); |
| | | if (goods == null) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | private boolean checkCanUsedJD(Long goodsId, BigDecimal priceLimit) { |
| | | JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(goodsId); |
| | | if (goods == null) |
| | | return false; |
| | | BigDecimal quanPrice = JDUtil.getCouponPrice(goods); |
| | | if (quanPrice.compareTo(priceLimit) <= 0) |
| | | return true; |
| | | |
| | | return false; |
| | | } |
| | | |
| | | private boolean checkCanUsedPDD(Long goodsId, BigDecimal priceLimit) { |
| | | PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId); |
| | | if (goods == null) |
| | | return false; |
| | | BigDecimal quanPrice = PinDuoDuoUtil.getCouponPrice(goods); |
| | | if (quanPrice.compareTo(priceLimit) <= 0) |
| | | return true; |
| | | |
| | | return false; |
| | | } |
| | | |
| | | } |