| 
					
				 | 
			
			
				@@ -7,12 +7,11 @@ import com.gree.mall.manager.bean.listvo.material.WebsitStockAccPVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.gree.mall.manager.bean.listvo.material.WebsitStockAccVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.gree.mall.manager.bean.listvo.material.WebsitStockPVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.gree.mall.manager.bean.listvo.material.WebsitStockVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.gree.mall.manager.bean.material.base.MaterialCategoryVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.gree.mall.manager.bean.material.base.WebsitGoodsMVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.gree.mall.manager.constant.Constant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.gree.mall.manager.enums.material.WebsitGoodsTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.gree.mall.manager.exception.RemoteServiceException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.gree.mall.manager.helper.ResponseHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.gree.mall.manager.logic.material.stock.WebsitStockLogic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.gree.mall.manager.plus.entity.WebsitStockAcc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.gree.mall.manager.utils.excel.ExcelUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.gree.mall.manager.zfire.bean.ZfireParamBean; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.gree.mall.manager.zfire.util.FieldUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -20,6 +19,7 @@ import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.integration.redis.util.RedisLockRegistry; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.validation.annotation.Validated; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.PostMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.RequestBody; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -27,10 +27,13 @@ import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.multipart.MultipartFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.annotation.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.concurrent.TimeUnit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.concurrent.locks.Lock; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RestController 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -41,6 +44,8 @@ public class WebsitStockController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     WebsitStockLogic websitStockLogic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    RedisLockRegistry redisLockRegistry; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ZfireList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostMapping("list") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -93,10 +98,22 @@ public class WebsitStockController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostMapping("importM") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation("辅材网点库存-导入(模板名称:辅材网点库存.xlsx)") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public ResponseHelper importData(MultipartFile file) throws IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Object> objects = ExcelUtils.importExcel(file); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        websitStockLogic.importData(objects, WebsitGoodsTypeEnum.M); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return ResponseHelper.success(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ResponseHelper importData(MultipartFile file) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_ORDER + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!obtain.tryLock(10, TimeUnit.SECONDS)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new RemoteServiceException("导入冻结中"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<Object> objects = ExcelUtils.importExcel(file); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            websitStockLogic.importData(objects, WebsitGoodsTypeEnum.M); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResponseHelper.success(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.error("【导入处理】失败", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw e; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } finally { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            obtain.unlock(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |