|
|
@@ -1,8 +1,11 @@
|
|
|
package com.fdage.controller.app;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.fdage.base.dto.DeskListRspDto;
|
|
|
import com.fdage.base.entity.TmDesk;
|
|
|
+import com.fdage.base.entity.TmOrder;
|
|
|
import com.fdage.base.service.impl.TmDeskServiceImpl;
|
|
|
+import com.fdage.base.service.impl.TmOrderServiceImpl;
|
|
|
import com.fdage.base.utils.DataUtils;
|
|
|
import fdage.back.sdk.base.entity.Result;
|
|
|
import fdage.back.sdk.base.enums.ResultCodeEnum;
|
|
|
@@ -12,6 +15,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
@@ -19,6 +23,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* 2 * @Author: Abner
|
|
|
* 3 * @Date: 2021/2/19 11:02
|
|
|
@@ -33,6 +40,9 @@ public class AppDeskController {
|
|
|
@Autowired
|
|
|
private TmDeskServiceImpl tmDeskService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TmOrderServiceImpl tmOrderService;
|
|
|
+
|
|
|
@GetMapping("/listOfCanteen")
|
|
|
@ApiOperation(value = "获取餐厅下所有可预订的桌子列表")
|
|
|
@ApiImplicitParams({
|
|
|
@@ -50,9 +60,22 @@ public class AppDeskController {
|
|
|
throw new CommonBaseException(ResultCodeEnum.D101 , "餐厅ID缺失");
|
|
|
}
|
|
|
IPage<TmDesk> resultPage = tmDeskService.getListByCanteen(pageNum , pageSize , canteenId);
|
|
|
-
|
|
|
+ List<DeskListRspDto> totalDestList = new ArrayList<>();
|
|
|
+ if(null != resultPage && !CollectionUtils.isEmpty(resultPage.getRecords())){
|
|
|
+ for (TmDesk desk : resultPage.getRecords()) {
|
|
|
+ DeskListRspDto deskListRspDto = new DeskListRspDto();
|
|
|
+ deskListRspDto.setTmDesk(desk);
|
|
|
+ if(null != desk){
|
|
|
+ TmOrder tmOrder = tmOrderService.getLatestByDesk(desk.getId());
|
|
|
+ if(null != tmOrder){
|
|
|
+ deskListRspDto.setTmOrder(tmOrder);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ totalDestList.add(deskListRspDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
return Result.success(DataUtils.assembleResult(resultPage.getTotal(), resultPage.getPages(),
|
|
|
- resultPage.getCurrent(), resultPage.getRecords()));
|
|
|
+ resultPage.getCurrent(), totalDestList));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getDetail")
|