无关风月
2024-08-30 2adb12e9b91ce42a044e12ed4303b327f7e6ffd6
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java
@@ -3,6 +3,8 @@
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.ruoyi.account.api.feignClient.AppCouponClient;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.TAppUserAddress;
@@ -35,9 +37,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
 * <p>
@@ -189,11 +189,28 @@
   }
   @GetMapping("/getMyShoppingOrderList")
   @ApiOperation(value = "获取购买订单列表", tags = {"小程序-商城购买订单"})
   public AjaxResult<List<MyShoppingOrderList>> getMyShoppingOrderList(GetMyShoppingOrderList query){
      List<MyShoppingOrderList> list = shoppingOrderService.getMyShoppingOrderList(query);
   public AjaxResult<Map<String, Object>> getMyShoppingOrderList(GetMyShoppingOrderList query){
      Map<String, Object> list = shoppingOrderService.getMyShoppingOrderList(query);
      return AjaxResult.success(list);
   }
   @GetMapping("/getMyShoppingOrderListNum")
   @ApiOperation(value = "获取购买订单列表数量", tags = {"小程序-商城购买订单"})
   public AjaxResult<Map<String, Object>> getMyShoppingOrderListNum(){
      Long userId = tokenService.getLoginUserApplet().getUserId();
      long dfh = shoppingOrderService.count(new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0)
            .eq(TShoppingOrder::getStatus, 1).eq(TShoppingOrder::getAppUserId, userId));
      long dsh = shoppingOrderService.count(new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0)
            .eq(TShoppingOrder::getStatus, 2).eq(TShoppingOrder::getAppUserId, userId));
      long ywc = shoppingOrderService.count(new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0)
            .eq(TShoppingOrder::getStatus, 3).eq(TShoppingOrder::getAppUserId, userId));
      Map<String, Object> map = new HashMap<>();
      map.put("dfh", dfh);
      map.put("dsh", dsh);
      map.put("ywc", ywc);
      return AjaxResult.success(map);
   }
   
   
   @GetMapping("/getMyShoppingOrderInfo/{id}")
@@ -267,7 +284,7 @@
         shoppingOrder.setCouponId(exchangeDto.getGoodId());
      }
      shoppingOrder.setPurchaseQuantity(exchangeDto.getNum());
      shoppingOrder.setAppUserAddressId(Long.valueOf(exchangeDto.getAddressId()));
      shoppingOrder.setAppUserAddressId(exchangeDto.getAddressId());
      shoppingOrder.setOrderAmount(exchangeDto.getOrderPrice());
      if (exchangeDto.getCouponId()!=null) {
         shoppingOrder.setAppCouponId(exchangeDto.getCouponId());