| | |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.account.api.feignClient.AppUserAddressClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | |
| | | byId.setReceivingName(data.getName()+"-"+data.getPhone()); |
| | | byId.setReceivingAddress(data.getAddress()); |
| | | } |
| | | } |
| | | switch (byId.getOrderType()){ |
| | | case 1: |
| | | TGoods data = goodsClient.getGoodsById(byId.getGoodsId()).getData(); |
| | | if (data!=null){ |
| | | byId.setName(data.getName()); |
| | | } |
| | | break; |
| | | case 2: |
| | | TCoupon data1 = couponClient.getCouponById1(byId.getCouponId()).getData(); |
| | | if (data1!=null){ |
| | | byId.setName(data1.getName()); |
| | | } |
| | | break; |
| | | } |
| | | return AjaxResult.success(byId); |
| | | } |
| | |
| | | return R.ok(exchangeOrderService.lambdaQuery().eq(TExchangeOrder::getCouponId,goodId).eq(TExchangeOrder::getAppUserId,userId).ne(TExchangeOrder::getStatus,4).count()); |
| | | } |
| | | } |
| | | @Resource |
| | | private AppUserAddressClient appUserAddressClient; |
| | | |
| | | @PostMapping("/create") |
| | | public R<ExchangeBackDto> exchangeCreate(@RequestBody ExchangeDto exchangeDto){ |
| | |
| | | tExchangeOrder.setPurchaseQuantity(1); |
| | | tExchangeOrder.setAppUserAddressId(exchangeDto.getAddressId()==null?null:Long.valueOf(exchangeDto.getAddressId())); |
| | | tExchangeOrder.setPoints(exchangeDto.getPoint()); |
| | | tExchangeOrder.setRemark(""); |
| | | tExchangeOrder.setRemark(exchangeDto.getRemark()); |
| | | if (exchangeDto.getGoodType()==1){ |
| | | tExchangeOrder.setStatus(1); |
| | | }else { |
| | |
| | | } |
| | | tExchangeOrder.setCreateTime(LocalDateTime.now()); |
| | | tExchangeOrder.setDelFlag(false); |
| | | |
| | | TAppUserAddress data = appUserAddressClient.getAppUserAddressById(exchangeDto.getAddressId()).getData(); |
| | | tExchangeOrder.setAddressJson(JSON.toJSONString(data)); |
| | | |
| | | exchangeOrderService.save(tExchangeOrder); |
| | | ExchangeBackDto exchangeBackDto = new ExchangeBackDto(); |
| | | exchangeBackDto.setId(tExchangeOrder.getId()); |
| | | exchangeBackDto.setCode(tExchangeOrder.getCode()); |
| | | |
| | | return R.ok(exchangeBackDto); |
| | | |
| | | } |
| | |
| | | @ApiOperation(value = "获取兑换订单详情", tags = {"小程序-兑换记录"}) |
| | | public AjaxResult<ExchangeOrderGoodsInfo> getGoodsExchangeOrder(@PathVariable String id){ |
| | | ExchangeOrderGoodsInfo goodsExchangeOrder = exchangeOrderService.getGoodsExchangeOrder(id); |
| | | |
| | | return AjaxResult.success(goodsExchangeOrder); |
| | | } |
| | | |