6/19 实现了订单用户的显示

This commit is contained in:
mlf9527 2023-06-19 17:14:31 +08:00
parent 395b60115a
commit 7a50f71928
3 changed files with 20 additions and 8 deletions

View File

@ -119,6 +119,7 @@ public class OrderDetailController {
ExcelUtils.exportExcelToTarget(response, null, list, OrderDetailExcel.class);
}
@GetMapping("detailInfo/{orderId}")
public Result Info(@PathVariable Long orderId,@ApiIgnore @RequestParam Map<String,Object> params){
OrdersDTO ordersDTO = ordersService.get(orderId);

View File

@ -11,8 +11,10 @@ import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.takeout.dto.OrdersDTO;
import io.renren.modules.takeout.dto.UserDTO;
import io.renren.modules.takeout.excel.OrdersExcel;
import io.renren.modules.takeout.service.OrdersService;
import io.renren.modules.takeout.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -25,6 +27,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -39,6 +42,8 @@ import java.util.Map;
public class OrdersController {
@Autowired
private OrdersService ordersService;
@Autowired
private UserService userService;
@GetMapping("page")
@ApiOperation("分页")
@ -52,6 +57,12 @@ public class OrdersController {
public Result<PageData<OrdersDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<OrdersDTO> page = ordersService.page(params);
List<OrdersDTO> ordersDTOS = page.getList().stream().map(ordersDTO -> {
UserDTO userDTO = userService.get(ordersDTO.getUserId());
ordersDTO.setUserName(userDTO.getName());
return ordersDTO;
}).collect(Collectors.toList());
page.setList(ordersDTOS);
return new Result<PageData<OrdersDTO>>().ok(page);
}