| 
					
				 | 
			
			
				@@ -19,20 +19,21 @@ namespace XdCxRhDW.WebApi.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public class DetectCgController : BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private readonly TestService service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private readonly string uploadFolder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private readonly DetectService service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ///  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="service"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        public DetectCgController(TestService service) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public DetectCgController(DetectService service) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.uploadFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.service = service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private static readonly object thisLock = new object(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Dictionary<string, XcorrUtils> keyValues = new Dictionary<string, XcorrUtils>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private string UploadFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private (bool, string) ValidateCalcParam(CalcDto dto) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (dto == null) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -78,8 +79,8 @@ namespace XdCxRhDW.WebApi.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public async Task<AjaxResult<EstimationResDto>> EstimationCalc(CalcDto dto) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var token = Request.GetCorrelationId().ToString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dto.file1 = Path.Combine(UploadFolder, dto.file1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dto.file2 = Path.Combine(UploadFolder, dto.file2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dto.file1 = Path.Combine(uploadFolder, dto.file1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dto.file2 = Path.Combine(uploadFolder, dto.file2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var vpres = ValidateCalcParam(dto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!vpres.Item1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -167,11 +168,11 @@ namespace XdCxRhDW.WebApi.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      /// 参估计算停止 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      /// <param name="token"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 参估计算停止 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="token"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //[HttpPost] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //public async Task<AjaxResult<bool>> StopEstimationCalc(string token) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //{ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -227,7 +228,7 @@ namespace XdCxRhDW.WebApi.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public async Task<AjaxResult<IEnumerable<DetectResDto>>> DetectCalc(DetectDto dto) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var token = Request.GetCorrelationId().ToString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dto.file1 = Path.Combine(UploadFolder, dto.file1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dto.file1 = Path.Combine(uploadFolder, dto.file1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var vpres = ValidateDetectParam(dto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!vpres.Item1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -303,32 +304,6 @@ namespace XdCxRhDW.WebApi.Controllers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// 上传文件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        [HttpPost, SwaggerForm] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        public async Task<AjaxResult<FileDto>> UploadFile() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (!Request.Content.IsMimeMultipartContent("form-data")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return Error<FileDto>("请求数据不是multipart/form-data类型"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var provider = new MultipartMemoryStreamProvider(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            await Request.Content.ReadAsMultipartAsync(provider); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Directory.CreateDirectory(UploadFolder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var content = provider.Contents.First(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var fileName = Guid.NewGuid().ToString() + ".dat"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var fileData = await content.ReadAsByteArrayAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            FileDto fileDto = new FileDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            fileDto.FileName = fileName; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 将文件保存到本地文件夹中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var filePath = Path.Combine(UploadFolder, fileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            using (var fileStream = new FileStream(filePath, FileMode.Create)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                await fileStream.WriteAsync(fileData, 0, fileData.Length); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return Success(fileDto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |