| | |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | boolean isVip = false; |
| | | if (user.getVipEndTime().isAfter(LocalDateTime.now())){ |
| | | if (user.getVipEndTime()!=null&&user.getVipEndTime().isAfter(LocalDateTime.now())){ |
| | | isVip = true; |
| | | } |
| | | //计算价格 |
| | |
| | | originalPrice = good.getVipPrice(); |
| | | } |
| | | } |
| | | orderPrice.add(originalPrice.multiply(BigDecimal.valueOf(exchangeDto.getNum()))); |
| | | orderPrice = orderPrice.add(originalPrice.multiply(BigDecimal.valueOf(exchangeDto.getNum()))); |
| | | }else { |
| | | TCoupon coupon = couponService.getById(exchangeDto.getGoodId()); |
| | | BigDecimal originalPrice = coupon.getPaymentAmount(); |
| | |
| | | originalPrice = coupon.getVipPaymentAmount(); |
| | | } |
| | | } |
| | | orderPrice.add(originalPrice); |
| | | orderPrice = orderPrice.add(originalPrice); |
| | | } |
| | | |
| | | exchangeDto.setOrderPrice(orderPrice); |
| | |
| | | exchangeDto.setPayPrice(payPrice); |
| | | exchangeDto.setDiscountPrice(discountPrice); |
| | | exchangeDto.setVipDiscount(vipDiscount); |
| | | exchangeDto.setUserId(userId); |
| | | //创建订单 |
| | | TShoppingOrder shopOrder = orderClient.shopCreate(exchangeDto).getData(); |
| | | if (exchangeDto.getPayMethod()==1) { |
| | |
| | | TGoods goods = goodsService.getById(id); |
| | | return R.ok(goods); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改商品 |
| | | * @param goods |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateGoods") |
| | | public R updateGoods(@RequestBody TGoods goods){ |
| | | goodsService.updateById(goods); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |