|
@@ -1,9 +1,12 @@
|
|
package com.fdage.controller.app;
|
|
package com.fdage.controller.app;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import com.fdage.base.dto.OrderAndCanteenRspDto;
|
|
import com.fdage.base.dto.OrderAppReqDto;
|
|
import com.fdage.base.dto.OrderAppReqDto;
|
|
|
|
+import com.fdage.base.entity.TmCanteen;
|
|
import com.fdage.base.entity.TmOrder;
|
|
import com.fdage.base.entity.TmOrder;
|
|
import com.fdage.base.entity.TmUser;
|
|
import com.fdage.base.entity.TmUser;
|
|
|
|
+import com.fdage.base.service.impl.TmCanteenServiceImpl;
|
|
import com.fdage.base.service.impl.TmOrderServiceImpl;
|
|
import com.fdage.base.service.impl.TmOrderServiceImpl;
|
|
import com.fdage.base.utils.DataUtils;
|
|
import com.fdage.base.utils.DataUtils;
|
|
import com.fdage.controller.BaseController;
|
|
import com.fdage.controller.BaseController;
|
|
@@ -17,11 +20,14 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.log4j.Log4j2;
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
@@ -42,6 +48,9 @@ public class AppOrderController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private TmOrderServiceImpl tmOrderService;
|
|
private TmOrderServiceImpl tmOrderService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private TmCanteenServiceImpl tmCanteenService;
|
|
|
|
+
|
|
|
|
|
|
@GetMapping("/listByUser")
|
|
@GetMapping("/listByUser")
|
|
@ApiOperation(value = "拉取用户所有订单列表")
|
|
@ApiOperation(value = "拉取用户所有订单列表")
|
|
@@ -60,9 +69,20 @@ public class AppOrderController extends BaseController {
|
|
throw new CommonBaseException(ResultCodeEnum.D101 , "缺失分页参数");
|
|
throw new CommonBaseException(ResultCodeEnum.D101 , "缺失分页参数");
|
|
}
|
|
}
|
|
IPage<TmOrder> resultPage = tmOrderService.getListByUser(tmUser.getId() , pageNum , pageSize);
|
|
IPage<TmOrder> resultPage = tmOrderService.getListByUser(tmUser.getId() , pageNum , pageSize);
|
|
-
|
|
|
|
|
|
+ List<OrderAndCanteenRspDto> list = new ArrayList<>();
|
|
|
|
+ if(null != resultPage && !CollectionUtils.isEmpty(resultPage.getRecords())){
|
|
|
|
+ for (TmOrder order : resultPage.getRecords()) {
|
|
|
|
+ OrderAndCanteenRspDto orderAndCanteenRspDto = new OrderAndCanteenRspDto();
|
|
|
|
+ orderAndCanteenRspDto.setOrder(order);
|
|
|
|
+ if(null != order && StringUtils.isNotBlank(order.getCanteenId())){
|
|
|
|
+ TmCanteen canteen = tmCanteenService.getById(order.getCanteenId());
|
|
|
|
+ orderAndCanteenRspDto.setCanteen(canteen);
|
|
|
|
+ }
|
|
|
|
+ list.add(orderAndCanteenRspDto);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return Result.success(DataUtils.assembleResult(resultPage.getTotal(), resultPage.getPages(),
|
|
return Result.success(DataUtils.assembleResult(resultPage.getTotal(), resultPage.getPages(),
|
|
- resultPage.getCurrent(), resultPage.getRecords()));
|
|
|
|
|
|
+ resultPage.getCurrent(), list));
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/getOne")
|
|
@GetMapping("/getOne")
|