Commit 156f8582 authored by zhengyi's avatar zhengyi

理货订单列表返回订单的全部入仓特性名称集合

parent 70fa3239
......@@ -2147,10 +2147,19 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
//以secId排序
goodsItemList.sort(Comparator.comparing(BoxPreloadGoodsBackVO::getSecId));
List<ProductAttrDO> productAttrDOList = productAttrService.getProductAttrList();
Map<String, String> idNameMap = productAttrDOList.stream()
.collect(Collectors.toMap(attr -> String.valueOf(attr.getId()), ProductAttrDO::getAttrName));
//以订单ID分组
Map<Long, List<BoxPreloadGoodsBackVO>> orderMap = goodsItemList.stream()
Map<Long, List<BoxPreloadGoodsBackVO>> orderMap = goodsItemList.stream().peek(item ->{
item.setAttrNameList(
getAttrNameByIds(item.getProdAttrIds(), idNameMap)
);
item.setWarehouseInAttrNameList(
getAttrNameByIds(item.getWarehouseInProdAttrIds(), idNameMap)
);
})
.collect(Collectors.groupingBy(BoxPreloadGoodsBackVO::getOrderId));
List<BoxTallyDO> tallyDOList = boxTallyService.list(new LambdaQueryWrapper<BoxTallyDO>()
.eq(BoxTallyDO::getShipmentId, shipmentId)
);
......@@ -2174,7 +2183,8 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
if (boxTallyDO != null) {
BeanUtils.copyProperties(boxTallyDO, boxTallyBackVO);
}
Set<String> allWarehouseInAttrNameList = orderGoodsItemList.stream().map(BoxPreloadGoodsBackVO::getWarehouseInAttrNameList).collect(Collectors.toSet());
boxTallyBackVO.setAllWarehouseInAttrNameList(allWarehouseInAttrNameList);
BoxPreloadGoodsBackVO boxPreloadGoodsDO = orderGoodsItemList.get(0);
boxTallyBackVO.setAdvanceType(boxPreloadGoodsDO.getAdvanceType());
boxTallyBackVO.setOrderNo(boxPreloadGoodsDO.getOrderNo());
......@@ -2222,6 +2232,19 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
return boxTallyBackVOS;
}
private List<String> getAttrNameByIds(String attrIds, Map<String, String> idNameMap) {
if (StringUtils.isNotBlank(attrIds)) {
String[] attrIdArray = attrIds.split(",");
List<String> nameList = new ArrayList<>();
for (String attrId : attrIdArray) {
//map一定包含数据,否则是数据错误
nameList.add(idNameMap.get(attrId));
}
return nameList;
}
return null;
}
@Override
public List<BoxGuanlianOrderBackVO> getGuanLianOrderList(Long orderId) {
List<BoxGuanlianOrderBackVO> boxGuanlianBackVOS = new ArrayList<>();
......
......@@ -9,6 +9,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import java.util.Set;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
......@@ -80,5 +81,8 @@ public class BoxTallyBackVO {
@ApiModelProperty(value = "是否有关联单")
private Boolean hasRelationOrder = false;
@ApiModelProperty(value = "订单全部入仓特性")
private Set<String> allWarehouseInAttrNameList;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment