[update]订单增加仓库内容

master
NH-LHG 2 years ago
parent 53d57fd22a
commit bd2d61823e

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
@ -12,8 +13,10 @@ import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import org.jeecg.modules.demo.erp.entity.StoreInfo;
import org.jeecg.modules.demo.erp.entity.ext.OrderDetailExt;
import org.jeecg.modules.demo.erp.entity.ext.OrderExt;
import org.jeecg.modules.demo.erp.service.IStoreInfoService;
import org.jeecg.modules.demo.erp.vo.OrderStateVo;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@ -43,7 +46,6 @@ import lombok.extern.slf4j.Slf4j;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/**
@ -61,6 +63,8 @@ public class OrderController {
private IOrderService orderService;
@Autowired
private IOrderDetailService orderDetailService;
@Autowired
private IStoreInfoService iStoreInfoService;
/**
*
@ -82,17 +86,35 @@ public class OrderController {
Page<Order> page = new Page<Order>(pageNo, pageSize);
IPage<Order> pageList = orderService.page(page, queryWrapper);
//仓库信息
List<StoreInfo> storeInfoList = iStoreInfoService.list();
Map<Long,StoreInfo> storeInfoMap = storeInfoList
.stream()
.collect(
Collectors.toMap(StoreInfo::getId, Function.identity(),(k, v) -> k)
);
List<OrderDetailExt> orderDetailExtList = orderDetailService.selectByMainIdExt("");
Map<Long, List<OrderDetailExt>> orderDetailExtMap = orderDetailExtList
.stream()
.collect(
Collectors.groupingBy(OrderDetailExt::getOrderId)
);
Page<OrderExt> pageExt = new Page<>(pageNo, pageSize);
List<OrderExt> records = new ArrayList<>();
pageList.getRecords().forEach(e ->{
OrderExt orderExt = new OrderExt();
BeanUtils.copyProperties(e,orderExt);
if(null != storeInfoMap
&& null != storeInfoMap.get(e.getStoreId())){
orderExt.setStoreAddr(storeInfoMap.get(e.getStoreId()).getAddr());
orderExt.setStoreContacts(storeInfoMap.get(e.getStoreId()).getContacts());
orderExt.setStoreName(storeInfoMap.get(e.getStoreId()).getName());
orderExt.setStorePhone(storeInfoMap.get(e.getStoreId()).getPhone());
}
if(null != orderDetailExtMap
&& null != orderDetailExtMap.get(e.getId())){
orderExt.setOrderDetailList(orderDetailExtMap.get(e.getId()));

@ -31,6 +31,11 @@ public class Order implements Serializable {
@ApiModelProperty(value = "id")
@JsonSerialize(using = ToStringSerializer.class)
private java.lang.Long id;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "仓库id")
@JsonSerialize(using = ToStringSerializer.class)
private java.lang.Long storeId;
/**收件人*/
@Excel(name = "收件人", width = 15)
@ApiModelProperty(value = "收件人")

@ -3,6 +3,7 @@ package org.jeecg.modules.demo.erp.entity.ext;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.modules.demo.erp.entity.Order;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.util.List;
@ -11,6 +12,22 @@ import java.util.List;
*/
@Data
public class OrderExt extends Order {
/**仓库名称*/
@Excel(name = "仓库名称", width = 15)
@ApiModelProperty(value = "仓库名称")
private java.lang.String storeName;
/**仓管员*/
@Excel(name = "仓管员", width = 15)
@ApiModelProperty(value = "仓管员")
private java.lang.String storeContacts;
/**仓管员手机*/
@Excel(name = "仓管员手机", width = 15)
@ApiModelProperty(value = "仓管员手机")
private java.lang.String storePhone;
/**仓库地址*/
@Excel(name = "仓库地址", width = 15)
@ApiModelProperty(value = "仓库地址")
private java.lang.String storeAddr;
@ApiModelProperty(value = "订单详情")
private List<OrderDetailExt> orderDetailList;
}

@ -2,6 +2,8 @@ package org.jeecg.modules.demo.erp.vo;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.jeecg.modules.demo.erp.entity.OrderDetail;
@ -28,6 +30,11 @@ public class OrderPage {
@ApiModelProperty(value = "id")
@JsonSerialize(using = ToStringSerializer.class)
private java.lang.Long id;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "仓库id")
@JsonSerialize(using = ToStringSerializer.class)
private java.lang.Long storeId;
/**收件人*/
@Excel(name = "收件人", width = 15)
@ApiModelProperty(value = "收件人")

Loading…
Cancel
Save