Sfoglia il codice sorgente

Merge branch 'develop' of http://163.228.141.122:3000/TEAMMODEL/TEAMModelOS into develop

XW 8 mesi fa
parent
commit
c5ac65184d

+ 3 - 1
TEAMModelOS/ClientApp/public/lang/en-US.js

@@ -8033,7 +8033,9 @@ const LANG_EN_US = {
         stuNumber: 'Number of students',
         class:'class',
         fileUrl: 'FileUrl',
-        joinStatus: 'Registration status',
+        participantList: 'Participant List',
+        joinStatus: 'Registration',
+        joinStatusFinal: 'Final',
         tmid: 'TEAM Model ID',
         teacherName: 'Name',
         jointGroup: 'Group',

+ 3 - 1
TEAMModelOS/ClientApp/public/lang/zh-CN.js

@@ -8034,7 +8034,9 @@ const LANG_ZH_CN = {
         stuNumber: '学生数',
         class:'班级',
         fileUrl: '档案连结',
-        joinStatus: '报名状况',
+        participantList: '参加名单',
+        joinStatus: '报名',
+        joinStatusFinal: '决赛',
         tmid: '醍摩豆帐号',
         teacherName: '老师姓名',
         jointGroup: '报名群组',

+ 3 - 1
TEAMModelOS/ClientApp/public/lang/zh-TW.js

@@ -8034,7 +8034,9 @@ const LANG_ZH_TW = {
         stuNumber: '學生數',
         class:'班級',
         fileUrl: '檔案連結',
-        joinStatus: '報名狀況',
+        participantList: '參加名單',
+        joinStatus: '報名',
+        joinStatusFinal: '決賽',
         tmid: '醍摩豆帳號',
         teacherName: '老師姓名',
         jointGroup: '報名群組',

+ 16 - 8
TEAMModelOS/ClientApp/src/view/htcommunity/htMgtHome.vue

@@ -17,9 +17,10 @@
                     <el-button type="text" @click="viewDetails(scope.row)">{{$t("htcommunity.view")}}</el-button>
                 </template>
             </el-table-column>
-            <el-table-column :label="this.$t('htcommunity.joinStatus')">
+            <el-table-column :label="this.$t('htcommunity.participantList')">
                 <template slot-scope="scope">
-                    <el-button type="text" @click="viewJoinStatus(scope.row)">{{$t("htcommunity.view")}}</el-button>
+                    <el-button type="text" @click="viewJoinStatus(scope.row)">{{$t("htcommunity.joinStatus")}}</el-button>
+                    <el-button type="text" @click="viewFinalJoinStatus(scope.row)">{{$t("htcommunity.joinStatusFinal")}}</el-button>
                 </template>
             </el-table-column>
             <el-table-column :label="this.$t('htcommunity.eventExam')">
@@ -168,7 +169,7 @@
             </span>
         </el-dialog>
         <!-- 報名狀況彈出視窗 -->
-        <el-dialog :title="this.$t('htcommunity.joinStatus')" :visible.sync="showJoinModal" width="75%">
+        <el-dialog :title="joinModalTitle" :visible.sync="showJoinModal" width="75%">
             <el-button type="primary" class="btn-new" size="small" style="margin-top: 0; margin-bottom: 10px; margin-left: 0; " @click="exportExcel('teacherCourse')">{{this.$t("htcommunity.export")}}</el-button>
             <el-table :data="joinTeacherCourseArr" border v-loading="teacherCourseLoading" @sort-change="onSortChangeCourse">
                 <el-table-column prop="jointGroupName" :label="this.$t('htcommunity.jointGroup')" sortable="custom" min-width="50"></el-table-column>
@@ -243,12 +244,12 @@ export default {
       showJoinModal: false, //報名狀況子視窗
       teacherCourseLoading: false,
       joinTeacherCourseArr: [],
+      joinModalTitle: '', //報名狀態視窗標題
     };
   },
   methods: {
     // 時程編輯的啟用及關閉  以及  動態切換活動布置及評量可重複啟用及關閉
     scheduleDisabled(scope, column) {
-          console.log('scheduleDisabled scope:', scope)
       if (scope.row.progress === "going") {
         return true;
       } else {
@@ -423,7 +424,6 @@ export default {
           location: item.location,
           blobs: item.blobs === null ? "" : item.blobs[0].blob,
         }
-          console.log('activity.originalData.schedule', schedule);
         this.newActivity.planContent.push(schedule);
       });
 
@@ -432,16 +432,24 @@ export default {
     //查看報名狀況
     viewJoinStatus(activity) {
         this.showJoinModal = true;
-        this.getJoinList(activity);
+        this.joinModalTitle = this.$t('htcommunity.joinStatus');
+        this.getJoinList(activity, 'regular');
+    },
+    //查看決賽名單
+    viewFinalJoinStatus(activity) {
+        this.showJoinModal = true;
+        this.joinModalTitle = this.$t('htcommunity.joinStatusFinal');
+        this.getJoinList(activity, 'custom');
     },
     // 取得報名老師資料
-    getJoinList(activity) {
+    getJoinList(activity, type) {
         this.teacherCourseLoading = true;
         //先清除列表
         this.joinTeacherCourseArr.splice(0, this.joinTeacherCourseArr.length);
           try {
               let param = {
-                  jointEventId: activity.id
+                  jointEventId: activity.id,
+                  type: type
               };
               //  取得報名老師資料API
               this.$api.htcommunity.jointCourseFind(param).then(

+ 1 - 0
TEAMModelOS/Controllers/Teacher/JointEventController.cs

@@ -1607,6 +1607,7 @@ namespace TEAMModelOS.Controllers.Common
             public string jointEventId { get; set; }
             public string jointGroupId { get; set; }
             public string scope { get; set; } //school:學校(選課班) private:個人 
+            public string type { get; set; } //regular:報名資訊 custom:決賽名單
             public string creatorId { get; set; }
             public string creatorName { get; set; }
             public string schoolId { get; set; } //老師教育雲綁定的學校ID

+ 61 - 1
TEAMModelOS/Controllers/XTest/BusinessController.cs

@@ -1,4 +1,4 @@
-using Microsoft.Azure.Cosmos;
+using Microsoft.Azure.Cosmos;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Newtonsoft.Json;
@@ -18,6 +18,8 @@ using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
+using Azure.Storage.Blobs.Models;
+using Microsoft.AspNetCore.Authorization;
 
 
 namespace TEAMModelOS.Controllers.XTest
@@ -27,9 +29,11 @@ namespace TEAMModelOS.Controllers.XTest
     public class BusinessController : ControllerBase
     {
         private readonly AzureCosmosFactory _azureCosmos;
+        private readonly AzureStorageFactory _azureStorage;
         public BusinessController(AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing)
         {
             _azureCosmos = azureCosmos;
+            _azureStorage = azureStorage;
         }
         /// <summary>
         ///
@@ -219,5 +223,61 @@ namespace TEAMModelOS.Controllers.XTest
                 return Ok(new { status = 500 });
             }
         }
+
+        //取的特定Blob容器的使用量
+        [HttpPost("get-blob-list-size")]
+        [Authorize(Roles = "IES")]
+        public async Task<IActionResult> GetBlobListSize(JsonElement json)
+        {
+
+            if (!json.TryGetProperty("container", out JsonElement containerName))
+            {
+                return Ok(new { msg = "参数错误" });
+            }
+
+            //文件夹(关联id)导向的文件夹 exam  homework art records  survey  vote  item
+            string[] prefixDirId = new string[] { "exam", "homework", "art", "records", "survey", "vote", "item" };
+            HashSet<string> ids = new HashSet<string>();
+            Dictionary<string, List<KeyValuePair<string, long?>>> recordUrls = new Dictionary<string, List<KeyValuePair<string, long?>>>(); //單位:bytes
+            foreach (string prefix in prefixDirId)
+            {
+                await foreach (BlobItem blobItem in _azureStorage.GetBlobContainerClient(containerName.ToString()).GetBlobsAsync(BlobTraits.None, BlobStates.None, prefix: prefix))
+                {
+                    var path = blobItem.Name.Split("/");
+                    if (path.Length > 2)
+                    {
+                        string id = path[0];
+                        ids.Add(id);
+                        if (recordUrls.ContainsKey(id))
+                        {
+                            recordUrls[id].Add(new KeyValuePair<string, long?>(blobItem.Name, blobItem.Properties.ContentLength));
+                        }
+                        else
+                        {
+                            recordUrls[id] = new List<KeyValuePair<string, long?>> { new KeyValuePair<string, long?>(blobItem.Name, blobItem.Properties.ContentLength) };
+                        }
+                    }
+
+                }
+            }
+            //資料整理
+            Dictionary<string, long> result = new Dictionary<string, long>();
+            foreach (KeyValuePair<string, List<KeyValuePair<string, long?>>> rec in recordUrls)
+            {
+                foreach (KeyValuePair<string, long?> recVal in rec.Value)
+                {
+                    if (result.ContainsKey(rec.Key))
+                    {
+                        result[rec.Key] += (long)Convert.ToDouble(recVal.Value);
+                    }
+                    else
+                    {
+                        result.Add(rec.Key, (long)Convert.ToDouble(recVal.Value));
+                    }
+                }
+            }
+
+            return Ok(new { result });
+        }
     }
 }