Selaa lähdekoodia

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

liqk 4 vuotta sitten
vanhempi
commit
c09f09f8c4

+ 19 - 5
TEAMModelFunction/ActivityHttpTrigger.cs

@@ -16,6 +16,7 @@ using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Models.Cosmos;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
 using TEAMModelOS.TEAMModelFunction;
+using System.Linq;
 
 namespace TEAMModelFunction
 {
@@ -400,15 +401,28 @@ namespace TEAMModelFunction
             ILogger log)
         {
             var client = _azureCosmos.GetCosmosClient();
-            //List<ItemInfo> items = new List<ItemInfo>();
+            List<ItemInfo> items = new List<ItemInfo>();
             var queryslt = $"SELECT  value(c) FROM c ";
-            ItemCond cond = new ItemCond();
+            
             await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ItemInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-hbcn") }))
             {
-                ItemService.CountItemCond(item,null,cond);
-                //items.Add(item);
+                
+                items.Add(item);
             }
-            return new OkObjectResult(new { cond });
+            List<ItemCond> itemConds = new List<ItemCond>();
+            items.GroupBy(x => x.periodId).ToList().ForEach( x=> {
+                ItemCond cond = new ItemCond() { id=x.Key,code=$"ItemCond-hbcn" };
+                x.ToList().ForEach(y => {
+                   ItemService.CountItemCond(y, null, cond);
+                });
+               
+                itemConds.Add(cond);
+            });
+            itemConds.ForEach(async cond =>
+            {
+                await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<ItemCond>(cond, new PartitionKey(cond.code));
+            });
+            return new OkObjectResult(new { itemConds });
         }
         /// <summary>
         /// 设置问卷调查未初始化学生列表的业务

+ 4 - 4
TEAMModelFunction/ItemService.cs

@@ -18,7 +18,7 @@ namespace TEAMModelOS.TEAMModelFunction
             //检查两个对象是否是同一条记录
             if (newItem != null && odlItem == null)
             {
-                string newKey = $"{newItem.periodId}-{newItem.subjectId}";
+                string newKey = $"{newItem.subjectId}";
                 List<string> grade = newItem.gradeIds;
                 UpdateItemCond(cond, true,newKey, grade, newItem.type, newItem.level, newItem.field.HasValue?newItem.field.Value:0);
             }
@@ -28,18 +28,18 @@ namespace TEAMModelOS.TEAMModelFunction
                 if (newItem.id == odlItem.id && newItem.code == odlItem.code)
                 {
                     //先增加
-                    string newKey = $"{newItem.periodId}-{newItem.subjectId}";
+                    string newKey = $"{newItem.subjectId}";
                     List<string> newGrade = newItem.gradeIds;
                     UpdateItemCond(cond, true, newKey, newGrade, newItem.type, newItem.level, newItem.field.HasValue ? newItem.field.Value : 0);
                     //后变更删除
-                    string oldKey = $"{odlItem.periodId}-{odlItem.subjectId}";
+                    string oldKey = $"{odlItem.subjectId}";
                     List<string> oldGrade = odlItem.gradeIds;
                     UpdateItemCond(cond, false, oldKey, oldGrade, odlItem.type, odlItem.level, odlItem.field.HasValue ? odlItem.field.Value : 0);
                 }
             }
             else if (newItem == null && odlItem != null)
             {
-                string oldKey = $"{odlItem.periodId}-{odlItem.subjectId}";
+                string oldKey = $"{odlItem.subjectId}";
                 List<string> oldGrade = odlItem.gradeIds;
                 UpdateItemCond(cond, false, oldKey, oldGrade, odlItem.type, odlItem.level, odlItem.field.HasValue ? odlItem.field.Value : 0);
             }

+ 1 - 1
TEAMModelOS.SDK/Models/Cosmos/Common/ItemCond.cs

@@ -13,7 +13,7 @@ namespace TEAMModelOS.SDK.Models
             pk = "ItemCond";
         }
         //key  学段id-科目id
-        public  Dictionary<string, List<CondCount>>  conds = new  Dictionary<string, List<CondCount>> ();
+        public Dictionary<string, List<CondCount>> conds { get; set; } = new Dictionary<string, List<CondCount>>();
     }
     public class CondCount {
         public KeyValuePair<string, int> grade { get; set; } = new KeyValuePair<string, int>();

+ 2 - 2
TEAMModelOS/ClientApp/src/utils/blobTool.js

@@ -1,7 +1,7 @@
 import { GLOBAL } from '@/static/Global.js';
 import JsFn from '@/utils/js-fn.js';
 import API from '@/api/index.js';
-const blobPath = ['audio', 'doc', 'exam','image', 'item', 'notice', 'other', 'paper', 'res', 'student', 'survey', 'temp', 'thum', 'video', 'vote']
+const blobPath = ['audio', 'doc', 'exam','image', 'item', 'notice', 'other', 'paper','syllabus', 'res', 'student', 'survey', 'temp', 'thum', 'video', 'vote']
 const { BlobServiceClient, BlobClient } = require("@azure/storage-blob")
 //获取文件后缀和类型
 function getExAndType(fileName) {
@@ -195,7 +195,7 @@ export default class BlobTool {
      */
     upload(file, path, option, checkSize = true, handleSize = true) {
         console.log(blobPath.includes(path))
-        if (!blobPath.includes(path)) {
+        if (!blobPath.includes(path.split('/')[0])) {
             throw new Error('上传路径不合法,请检查上传路径:' + path)
         }
         return new Promise(async (r, j) => {

+ 1 - 1
TEAMModelOS/ClientApp/src/view/syllabus/Syllabus.vue

@@ -83,7 +83,7 @@
 					</span>
 				</div>
 				<div class="syllabus-tree-box">
-					<EmptyData :top="100" v-if="curNode.rnodes && !curNode.rnodes.length"></EmptyData>
+					<EmptyData :top="-203" v-if="curNode.rnodes && !curNode.rnodes.length"></EmptyData>
 					<div class="node-resource-box" v-else>
 						<div class="node-resource-item" v-for="(item,index) in curNode.rnodes">
 							<img src="../../assets/source/image.png" v-if="item.type === 'image'" />