Просмотр исходного кода

Merge branch 'develop3.0-tmd' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop3.0-tmd

zhouj1203@hotmail.com 4 лет назад
Родитель
Сommit
0f8466ea19

+ 28 - 0
TEAMModelOS.SDK/DI/AzureStorage/AzureStorageBlobExtensions.cs

@@ -11,6 +11,7 @@ using System.IO;
 using Azure.Storage.Blobs.Specialized;
 using System.Collections.Generic;
 using System.Linq;
+using System.Text;
 
 namespace TEAMModelOS.SDK.DI
 {
@@ -37,6 +38,33 @@ namespace TEAMModelOS.SDK.DI
                 return size;
             }
         }
+        /// <summary>
+        /// 取得指定前置詞的 Blob 名稱的總大小(Bytes),例如指定目錄名稱為前置詞
+        /// </summary>      
+        /// <param name="prefix">篩選開頭名稱,Null代表容器總大小</param>
+        /// <returns>總大小(Bytes),如果為Null代表查無前置詞或者發生錯誤</returns>
+        public static async Task<long?> GetBlobsSize(this BlobContainerClient client, List<string>urls)
+        {
+            long? size = 0;
+            try
+            {
+                foreach (var url in urls) {
+                   var eurl = "/" + System.Web.HttpUtility.UrlDecode(url.ToString(), Encoding.UTF8);
+                    client.GetBlobClient(eurl);
+                    if (client.Exists()) {
+                        await foreach (var item in client.GetBlobsAsync(BlobTraits.None, BlobStates.None))
+                        {
+                            size += item.Properties.ContentLength;
+                        }
+                    }
+                }
+                return size;
+            }
+            catch
+            {
+                return size;
+            }
+        }
         /// <summary>        
         /// 批量刪除Blobs
         /// </summary>      

+ 8 - 1
TEAMModelOS/ClientApp/src/view/evaluation/components/BasePointPie.vue

@@ -78,7 +78,9 @@
 					tempArr.push(i)
 				}
 			})
-			let typeList = this._.groupBy(tempArr, 'points')
+			console.log(this.echartsData.item)
+			console.log(tempArr)
+			let typeList = this._.groupBy(tempArr, 'knowledge')
 			console.log(typeList)
 			for (let key in typeList) {
 				if (key !== ''){
@@ -86,6 +88,11 @@
 						value: typeList[key].length,
 						name: key
 					})
+				}else{
+					arr.push({
+						value: typeList[key].length,
+						name: '未绑定知识点'
+					})
 				}
 			}
 			this.drawLine(arr)

+ 1 - 1
TEAMModelOS/ClientApp/src/view/evaluation/index/CreatePaper.vue

@@ -274,7 +274,7 @@
 							})
 						}
 						// 如果导入的是客观题 则需要检测答案与选项是否为空
-						if (objectiveTypes.includes(i.type) && (!i.question.replace(/\s*/g, "") || !i.option.length || !i.answer.length)) {
+						if (objectiveTypes.includes(i.type) && (!i.question.replace(/\s*/g, "") || !i.option.length || !i.answer.length || !i.option || !i.answer)) {
 							this.errorList.push(i)
 						}
 					}

+ 18 - 0
TEAMModelOS/Controllers/Core/BlobController.cs

@@ -254,6 +254,7 @@ namespace TEAMModelOS.Controllers.Core
         }
         /// <summary>
         /// 测试单个文本内容的上传
+        /// {"containerName":"hbcn","updateSize":5000,"deleteurl":[]}
         /// </summary>
         /// <param name="azureBlobSASDto"></param>
         /// <returns></returns>
@@ -266,6 +267,23 @@ namespace TEAMModelOS.Controllers.Core
             var size = await client.GetBlobsSize();
             return Ok(new { size });
         }
+        /// <summary>
+        /// 测试单个文本内容的上传
+        /// {"containerName":"hbcn","updateSize":5000,"deleteurl":[]}
+        /// </summary>
+        /// <param name="azureBlobSASDto"></param>
+        /// <returns></returns>
+        [HttpPost("get-blobUrlsize")]
+        public async Task<ActionResult> getBlobUrlsize(JsonElement request)
+        {
+            request.TryGetProperty("containerName", out JsonElement containerName);
+            request.TryGetProperty("deleteUrl", out JsonElement deleteUrl);
+            var name = containerName.GetString();
+            var urls = deleteUrl.ToObject<List<string>>();
+            var client = _azureStorage.GetBlobContainerClient(name);
+            var size = await client.GetBlobsSize(urls);
+            return Ok(new { size });
+        }
 
         private static (string, string) BlobUrlString(string sasUrl)
         {