Authored by caoyan

寄存

... ... @@ -188,10 +188,19 @@ public class StorageDepositServiceImpl implements IStorageDepositService{
//2、校验商品状态是不是待寄存
//3、校验订单存不存在
List<StorageDeposit> depositList = storageDepositMapper.selectByDepositCodeList(depositCodeList);
if(CollectionUtils.isEmpty(depositList)) {
throw new ServiceException(400, "寄存码:"+depositCodeStr+"不存在");
}
Map<String, StorageDeposit> depositMap = depositList.stream().collect(Collectors.toMap(StorageDeposit::getDepositCode, s->s));
List<String> orderCodeList = depositList.stream().map(StorageDeposit::getOrderCode).collect(Collectors.toList());
List<BuyerOrder> orderList = buyerOrderMapper.selectBatchByOrderCode(convertStringToLongList(orderCodeList));
Map<String, BuyerOrder> orderMap = orderList.stream().collect(Collectors.toMap(BuyerOrder::getOrderCode, b->b));
for(StorageDeposit item : depositList) {
for(String depositCode : depositCodeList) {
if(!depositMap.keySet().contains(depositCode)) {
throw new ServiceException(400, "寄存码:"+depositCode+"不存在");
}
StorageDeposit item = depositMap.get(depositCode);
if(StringUtils.isNotEmpty(item.getShelfCode()) && item.getShelfCode().equals(shelfCode)) {
throw new ServiceException(400, "寄存码:"+item.getDepositCode()+"已属于当前货位");
}
... ...