| 
					
				 | 
			
			
				@@ -42,6 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.core.env.Environment; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.util.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.RoundingMode; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1596,7 +1597,15 @@ public class GoodsServiceImpl implements GoodsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     log.error("调用库存系统接口出现错误!返回结果为空!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw new ServiceException("调用库存系统接口出现错误!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                wareQueryStockResponseDTO = JacksonUtil.fromStringJson(queryWarehouseStockResponse, WareQueryStockResponseDTO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                wareQueryStockResponseDTO = (WareQueryStockResponseDTO) XmlUtil.xmlStrToBean(queryWarehouseStockResponse, WareQueryStockResponseDTO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (Objects.isNull(wareQueryStockResponseDTO)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.error("解析一步达库存系统响应数据出现错误!请求响应结果:{}", queryWarehouseStockResponse); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw new ServiceException("解析一步达库存系统响应数据出现错误!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ("failure".equals(wareQueryStockResponseDTO.getFlag())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.error("请求一步达库存系统返回错误响应!响应数据:{}", queryWarehouseStockResponse); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw new ServiceException(String.format("请求一步达库存系统查询库存错误!响应数据:%s", wareQueryStockResponseDTO.getMessage())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 wareQueryStockResponseDTO = new WareQueryStockResponseDTO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 wareQueryStockResponseDTO.setCode("0"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1611,14 +1620,13 @@ public class GoodsServiceImpl implements GoodsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 wareQueryStockResponseDTO.setItems(wareQueryStockResponseItemDTOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (Objects.isNull(wareQueryStockResponseDTO)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                log.error("解析一步达库存系统响应数据出现错误!请求响应结果:{}", queryWarehouseStockResponse); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                throw new ServiceException("解析一步达库存系统响应数据出现错误!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 校验库存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            WareQueryStockResponseDTO.WareQueryStockResponseItemDTO itemDTO = wareQueryStockResponseDTO.getItems().get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<WareQueryStockResponseDTO.WareQueryStockResponseItemDTO> items = wareQueryStockResponseDTO.getItems(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (CollectionUtils.isEmpty(items)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.error("查询商品时:【{}】,仓库不存在该商品!", prodBarcode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new ServiceException(String.format("查询商品时:【%s】,仓库不存在该商品!", prodBarcode)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            WareQueryStockResponseDTO.WareQueryStockResponseItemDTO itemDTO = items.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 仓库可用库存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             wareQuantity = itemDTO.getQuantity(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             JedisUtil.hset(warehouseStockMapKey, wareStockNumberKey, String.valueOf(wareQuantity)); 
			 |