## 注册、升级上传盒数,预处理分拆数据调整;
This commit is contained in:
		
							parent
							
								
									ad74163059
								
							
						
					
					
						commit
						0e3a424077
					
				| 
						 | 
				
			
			@ -789,8 +789,10 @@ public class RetailOrderServiceImpl implements IRetailOrderService {
 | 
			
		|||
 | 
			
		||||
        // 订单商品拆分数据
 | 
			
		||||
        List<SaOrderWares> orderWaresList = new ArrayList<>();
 | 
			
		||||
        // 订单商品map(key:商品主键-商品价格,value:商品数量)
 | 
			
		||||
        Map<String, BigDecimal> orderWaresMap = new HashMap<>();
 | 
			
		||||
        // 订单商品拆分map(key:商品主键,value:商品数量)
 | 
			
		||||
        Map<Integer, BigDecimal> orderWaresMap = new HashMap<>();
 | 
			
		||||
        // 订单商品价格拆分map(key:商品主键,value:商品价格)
 | 
			
		||||
        Map<Integer, BigDecimal> orderWaresPriceMap = new HashMap<>();
 | 
			
		||||
        // 商品销量数据
 | 
			
		||||
        List<WaresNumberParam> waresNumberList = new ArrayList<>();
 | 
			
		||||
        // 商品销量map(key:商品主键,value:商品数量)
 | 
			
		||||
| 
						 | 
				
			
			@ -812,14 +814,18 @@ public class RetailOrderServiceImpl implements IRetailOrderService {
 | 
			
		|||
            // 指定商品拆分 并且 非赠品
 | 
			
		||||
            if (boxProductList.contains(saOrderItems.getWareCode())
 | 
			
		||||
                    && EYesNo.NO.getIntValue() == saOrderItems.getIsGift()) {
 | 
			
		||||
                BigDecimal boxNum = saOrderItems.getWaresBoxNum().multiply(new BigDecimal(saOrderItems.getWaresQuantity()));
 | 
			
		||||
                // key: 商品ID-商品价格(产品价格*产品数量)
 | 
			
		||||
                String key = saOrderItems.getPkWares() + "-" + (saOrderItems.getPrice().multiply(new BigDecimal(saOrderItems.getQuantity())));
 | 
			
		||||
                if (orderWaresMap.containsKey(key)) {
 | 
			
		||||
                    BigDecimal tmpBoxNum = orderWaresMap.get(key).add(boxNum);
 | 
			
		||||
                    orderWaresMap.put(key, tmpBoxNum);
 | 
			
		||||
                // 商品数量
 | 
			
		||||
                BigDecimal waresQuantity = new BigDecimal(saOrderItems.getWaresQuantity());
 | 
			
		||||
                // 盒数 = 商品上传盒数 * 商品数量
 | 
			
		||||
                BigDecimal boxNum = saOrderItems.getWaresBoxNum().multiply(waresQuantity);
 | 
			
		||||
                orderWaresMap.put(saOrderItems.getPkWares(), boxNum);
 | 
			
		||||
                // 价格 = 商品上传价格 * 商品数量,不存在直接放入,存在则进行累加
 | 
			
		||||
                BigDecimal waresPrice = saOrderItems.getPrice().multiply(waresQuantity);
 | 
			
		||||
                if (orderWaresPriceMap.containsKey(saOrderItems.getPkWares())) {
 | 
			
		||||
                    BigDecimal tmpWaresPrice = orderWaresPriceMap.get(saOrderItems.getPkWares());
 | 
			
		||||
                    orderWaresPriceMap.put(saOrderItems.getPkWares(), tmpWaresPrice.add(waresPrice));
 | 
			
		||||
                } else {
 | 
			
		||||
                    orderWaresMap.put(key, boxNum);
 | 
			
		||||
                    orderWaresPriceMap.put(saOrderItems.getPkWares(), waresPrice);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                waresLimitMap.merge(saOrderItems.getPkWares(), saOrderItems.getWaresQuantity(), Integer::sum);
 | 
			
		||||
| 
						 | 
				
			
			@ -831,11 +837,11 @@ public class RetailOrderServiceImpl implements IRetailOrderService {
 | 
			
		|||
 | 
			
		||||
        if (orderWaresMap.size() > 0) {
 | 
			
		||||
            // 处理订单商品拆分数据
 | 
			
		||||
            for (String key : orderWaresMap.keySet()) {
 | 
			
		||||
            for (Integer key : orderWaresMap.keySet()) {
 | 
			
		||||
                SaOrderWares saOrderWares = SaOrderWares.builder()
 | 
			
		||||
                        .pkOrder(saOrderExt.getPkId())
 | 
			
		||||
                        .pkWares(Integer.parseInt(key.split("-")[0]))
 | 
			
		||||
                        .waresPrice(new BigDecimal(key.split("-")[1]))
 | 
			
		||||
                        .pkWares(key)
 | 
			
		||||
                        .waresPrice(orderWaresPriceMap.get(key))
 | 
			
		||||
                        .waresQuantity(orderWaresMap.get(key))
 | 
			
		||||
                        .build();
 | 
			
		||||
                saOrderWares.setPkCreator(saOrderExt.getPkCreator());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue