|  | @@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  |  import org.springframework.http.MediaType;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Controller;
 | 
	
		
			
				|  |  | +import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  |  import org.springframework.validation.annotation.Validated;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -105,7 +106,31 @@ public class OpenController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          log.info("创建管乐迷订单:{}", JSON.toJSONString(order));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        orderService.mecProductOrderCreate(order);
 | 
	
		
			
				|  |  | +        if (!CollectionUtils.isEmpty(order.getCloseOrderNoList())) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            RLock lock = redissonClient.getLock(OrderCacheEnum.LOCK_REFUND_ORDER_MALL + ":delivery");
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                boolean b = lock.tryLock(60, 60, TimeUnit.SECONDS);
 | 
	
		
			
				|  |  | +                if (b) {
 | 
	
		
			
				|  |  | +                    orderService.mecProductOrderCreate(order);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    return CommonResult.success(true);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } catch (InterruptedException e) {
 | 
	
		
			
				|  |  | +                log.error("批量修改订单", e);
 | 
	
		
			
				|  |  | +            } finally {
 | 
	
		
			
				|  |  | +                if (lock.getHoldCount() >0) {
 | 
	
		
			
				|  |  | +                    lock.unlock();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            orderService.mecProductOrderCreate(order);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return CommonResult.success(true);
 | 
	
	
		
			
				|  | @@ -137,7 +162,31 @@ public class OpenController {
 | 
	
		
			
				|  |  |      public CommonResult<Boolean> productUpdateOrderStatus(@RequestParam("orderNo") String orderNo,@RequestParam("status") Integer status) {
 | 
	
		
			
				|  |  |          log.info("同步订单状态:{},{}", orderNo, status);
 | 
	
		
			
				|  |  |          // 已发货订单不可修改状态
 | 
	
		
			
				|  |  | -        orderService.productUpdateOrderStatus(orderNo, status);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (status == 4) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            RLock lock = redissonClient.getLock(OrderCacheEnum.LOCK_REFUND_ORDER_MALL + ":delivery");
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                boolean b = lock.tryLock(60, 60, TimeUnit.SECONDS);
 | 
	
		
			
				|  |  | +                if (b) {
 | 
	
		
			
				|  |  | +                    orderService.productUpdateOrderStatus(orderNo, status);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    return CommonResult.success(true);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } catch (InterruptedException e) {
 | 
	
		
			
				|  |  | +                log.error("批量修改订单", e);
 | 
	
		
			
				|  |  | +            } finally {
 | 
	
		
			
				|  |  | +                if (lock.getHoldCount() >0) {
 | 
	
		
			
				|  |  | +                    lock.unlock();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            orderService.productUpdateOrderStatus(orderNo, status);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return CommonResult.success(true);
 | 
	
		
			
				|  |  |      }
 |