浏览代码

Merge branch 'develop' into TPE/develop

jeff 10 月之前
父节点
当前提交
49e56584ac

+ 3 - 3
TEAMModelBI/TEAMModelBI.csproj

@@ -65,9 +65,9 @@
 		<SpaRoot>ClientApp\</SpaRoot>
 		<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
 		<UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
-		<Version>5.2407.17</Version>
-		<AssemblyVersion>5.2407.17.1</AssemblyVersion>
-		<FileVersion>5.2407.17.1</FileVersion>
+		<Version>5.2407.24</Version>
+		<AssemblyVersion>5.2407.24.1</AssemblyVersion>
+		<FileVersion>5.2407.24.1</FileVersion>
 		<Description>TEAMModelBI(BI)</Description>
 		<PackageReleaseNotes>BI版本说明版本切换标记2022000908</PackageReleaseNotes>
 		<PackageId>TEAMModelBI</PackageId>

+ 107 - 0
TEAMModelOS.Function/CosmosDBTriggers/TriggerJointExam.cs

@@ -0,0 +1,107 @@
+using Microsoft.Azure.Cosmos;
+using Azure.Messaging.ServiceBus;
+using TEAMModelOS.SDK.DI;
+using TEAMModelOS.SDK.Extension;
+using TEAMModelOS.SDK;
+using TEAMModelOS.SDK.Models;
+using TEAMModelOS.SDK.Models.Service;
+using System.Text.Json;
+using Microsoft.Extensions.Configuration;
+using TEAMModelOS.Function;
+namespace TEAMModelOS.CosmosDBTriggers
+{
+    public class TriggerJointExam
+    {
+        public static async Task Trigger(CoreAPIHttpService _coreAPIHttpService, AzureCosmosFactory _azureCosmos, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
+            CosmosClient client, JsonElement input, TriggerData data, IHttpClientFactory _httpClient, IConfiguration _configuration, HttpTrigger _httpTrigger, AzureRedisFactory _azureRedis)
+        {
+            JointExam info = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<JointExam>(data.id, new PartitionKey($"{data.code}"));
+            if (info != null)
+            {
+                var table = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
+                string PartitionKey = string.Format("{0}{1}{2}{3}{4}", info.code, "-", info.creatorId, "-", info.progress); //JointExam-{info.creatorId}-{info.progress}
+                List<ChangeRecord> records = await table.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", data.id }, { "PartitionKey", PartitionKey } });
+                switch (info.progress)
+                {
+                    case "pending":
+                        var message = new ServiceBusMessage(new { id = data.id, progress = "going", code = data.code }.ToJsonString());
+                        message.ApplicationProperties.Add("name", "JointExam");
+                        if (records.Count > 0)
+                        {
+                            try
+                            {
+                                await _serviceBus.GetServiceBusClient().CancelMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), records[0].sequenceNumber);
+                            }
+                            catch (Exception)
+                            {
+                            }
+                            long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), message, DateTimeOffset.FromUnixTimeMilliseconds(data.startTime));
+                            records[0].sequenceNumber = start;
+                            await table.SaveOrUpdate<ChangeRecord>(records[0]);
+                        }
+                        else
+                        {
+                            long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), message, DateTimeOffset.FromUnixTimeMilliseconds(data.startTime));
+                            ChangeRecord changeRecord = new ChangeRecord
+                            {
+                                RowKey = data.id,
+                                PartitionKey = PartitionKey,
+                                sequenceNumber = start,
+                                msgId = message.MessageId
+                            };
+                            await table.Save<ChangeRecord>(changeRecord);
+                        }
+                        break;
+                    case "going":
+                        try
+                        {
+                            //新增serviceBus 消息释放后处理table
+                            string pkey = string.Format("{0}{1}{2}{3}{4}", info.code, "-", info.creatorId, "-", "pending");
+                            await table.DeleteSingle<ChangeRecord>(pkey, data.id);
+                            // 发送信息通知
+                            var messageEnd = new ServiceBusMessage(new { id = data.id, progress = "finish", code = data.code }.ToJsonString());
+                            messageEnd.ApplicationProperties.Add("name", "JointExam");
+                            if (records.Count > 0)
+                            {
+                                long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageEnd, DateTimeOffset.FromUnixTimeMilliseconds(data.endTime));
+                                await _serviceBus.GetServiceBusClient().CancelMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), records[0].sequenceNumber);
+                                records[0].sequenceNumber = end;
+                                await table.SaveOrUpdate<ChangeRecord>(records[0]);
+                            }
+                            else
+                            {
+                                long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageEnd, DateTimeOffset.FromUnixTimeMilliseconds(data.endTime));
+                                ChangeRecord changeRecord = new ChangeRecord
+                                {
+                                    RowKey = data.id,
+                                    PartitionKey = PartitionKey,
+                                    sequenceNumber = end,
+                                    msgId = messageEnd.MessageId
+                                };
+                                await table.Save<ChangeRecord>(changeRecord);
+                            }
+                            //生成所有報名教師個人評量
+                            await JointService.GenerateExamFromJointExamAsync(client, _azureStorage, _serviceBus, _coreAPIHttpService, _azureRedis, _configuration, _dingDing, info);
+                        }
+                        catch (Exception e)
+                        {
+                            await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-{info.id}-ChangeRecord{e.Message}\n{e.StackTrace}\n", GroupNames.醍摩豆服務運維群組);
+                        }
+                        break;
+                    case "finish":
+                        try
+                        {
+                            //新增serviceBus 消息释放后处理table
+                            string pk = string.Format("{0}{1}{2}{3}{4}", info.code, "-", info.creatorId, "-", "going");
+                            await table.DeleteSingle<ChangeRecord>(pk, data.id);
+                        }
+                        catch (Exception e)
+                        {
+                            await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-{info.id}-评测finish状态异常{e.Message}\n{e.StackTrace}\n", GroupNames.醍摩豆服務運維群組);
+                        }
+                        break;
+                }
+            }
+        }
+    }
+}

+ 2 - 2
TEAMModelOS.Function/IESTimerTrigger.cs

@@ -60,8 +60,8 @@ namespace TEAMModelOS.Function
                 // if (local.Contains("Test")||local.Contains("Dep"))
                 {
 
-                    int am = 9;
-                    int pm = 20;
+                    int am = 8;
+                    int pm = 11;
                     //int am = DateTimeOffset.Now.Hour;
                     //int pm = DateTimeOffset.Now.Hour;
                     var url = Environment.GetEnvironmentVariable("HaBookAuth:CoreAPI");

+ 3 - 3
TEAMModelOS.Function/TEAMModelOS.Function.csproj

@@ -5,9 +5,9 @@
     <OutputType>Exe</OutputType>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-	<Version>5.2407.17</Version>
-	<AssemblyVersion>5.2407.17.1</AssemblyVersion>
-	<FileVersion>5.2407.17.1</FileVersion>
+	<Version>5.2407.24</Version>
+	<AssemblyVersion>5.2407.24.1</AssemblyVersion>
+	<FileVersion>5.2407.24.1</FileVersion>
 	<PackageId>TEAMModelOS.FunctionV4</PackageId>
 	<Authors>teammodel</Authors>
 	<Company>醍摩豆(成都)信息技术有限公司</Company>

+ 29 - 4
TEAMModelOS.SDK/Models/Service/KnowledgeService.cs

@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using MathNet.Numerics.Distributions;
+using System.Collections.Generic;
 using System.Linq;
 using TEAMModelOS.SDK.Extension;
 
@@ -11,6 +12,7 @@ namespace TEAMModelOS.SDK.Models.Service
 
             HashSet<string> points = new HashSet<string>();
             List<Block> blocks = new List<Block>();
+            blocks.AddRange(knowledge.blocks);
             var pidNull= knowledge.nodes.FindAll(x => string.IsNullOrWhiteSpace(x.pid));
             if (pidNull.IsNotEmpty()) {
                 foreach (var isnull in pidNull) {
@@ -21,12 +23,22 @@ namespace TEAMModelOS.SDK.Models.Service
             foreach (var node in tree)
             {
                 points.Add(node.name);
-                blocks.Add(new Block { name=node.name, source=2, points=  node.children!=null ? node.children.Select(x => x.name).ToList() : new List<string>() });
+                var blck = blocks.Find(x => x.name.Equals(node.name));
+                if (blck!= null)
+                {
+                    blck.points.AddRange(node.children.Select(x => x.name));
+                    blck.points= blck.points.Distinct().ToList();
+                }
+                else
+                {
+                    blocks.Add(new Block { name=node.name, source=2, points= node.children.Select(x => x.name).Distinct().ToList() });
+                }
                 node.pid=knowledge.id;
                 node.allcids= KnowledgeService.GetChildIds(node, points, blocks);
             }
-            blocks.AddRange(knowledge.blocks);
+            
             knowledge.points.AddRange(points);
+            knowledge.points=knowledge.points.Distinct().ToList();
             KnowledgeTreeDto knowledgeTrees = new KnowledgeTreeDto
             {
                 id= knowledge.id,
@@ -130,7 +142,20 @@ namespace TEAMModelOS.SDK.Models.Service
                     childIds.AddRange(allcids);
                     child.allcids=allcids.Count>100 ? child.children.Select(x => x.id).ToList() : allcids;
                     points.Add(child.name);
-                    blocks.Add(new Block { name=child.name, source=2, points=  child.children!=null ? child.children.Select(x => x.name).ToList() : new List<string>() });
+                    if (child.children.IsNotEmpty())
+                    {
+                        var blck = blocks.Find(x => x.name.Equals(child.name));
+                        if (blck!= null)
+                        {
+                            blck.points.AddRange(child.children.Select(x => x.name));
+                            blck.points= blck.points.Distinct().ToList();
+                        }
+                        else {
+                            
+                        }
+                        blocks.Add(new Block { name=child.name, source=2, points= child.children.Select(x => x.name).Distinct().ToList() });
+                    }
+
                 }
             }
             return childIds;

+ 3 - 0
TEAMModelOS.SDK/Models/Service/SystemService.cs

@@ -344,6 +344,7 @@ Hello {tmdname}, here is the summary report of the homework tasks you have poste
                 {
                     sendTime_pm = pm;
                 }
+
                 string lang = teacher.lang;
                 var tzt = now.GetGMTTime((int)teacher.timezone);
                 if (string.IsNullOrWhiteSpace(teacher.lang)) 
@@ -407,7 +408,9 @@ Hello {tmdname}, here is the summary report of the homework tasks you have poste
                             homeworkCount++;
                         }
                     }
+
                 }
+                await dingDing.SendBotMsg($"{teacher.name},{homework_submit_today.ToJsonString()},pm:{pm},am:{am},tztH:{tzt.Hour},sendPm:{sendTime_pm},sendAm:{sendTime_am}", GroupNames.成都开发測試群組);
                 foreach (var homeworksm in homework_submit) 
                 {
                  

+ 3 - 3
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -1,9 +1,9 @@
 <Project Sdk="Microsoft.NET.Sdk">
 	<PropertyGroup>
 		<TargetFramework>net8.0</TargetFramework>
-		<Version>5.2407.17</Version>
-		<AssemblyVersion>5.2407.17.1</AssemblyVersion>
-		<FileVersion>5.2407.17.1</FileVersion>
+		<Version>5.2407.24</Version>
+		<AssemblyVersion>5.2407.24.1</AssemblyVersion>
+		<FileVersion>5.2407.24.1</FileVersion>
 		<PackageReleaseNotes>发版</PackageReleaseNotes>
 	</PropertyGroup>
 

+ 1 - 1
TEAMModelOS/ClientApp/src/components/student-web/WrongQusetion/AnswerBox.vue

@@ -148,7 +148,7 @@
                         <template v-if="quesInfo.qamode">
                             <el-carousel indicator-position="outside" height="300px" :autoplay="false">
                                 <el-carousel-item v-for="(img, indexs) in quesInfo.attachments" :key="indexs" style="text-align: center;">
-                                    <img :src="img" alt="" style="height: 100%;">
+                                    <img :src="img" alt="" style="height: 100%;" @click="$hevueImgPreview(img)">
                                 </el-carousel-item>
                             </el-carousel>
                             <p style="text-align: center;">

+ 11 - 8
TEAMModelOS/ClientApp/src/view/knowledge-point/index/page.vue

@@ -289,6 +289,7 @@ export default {
             activeBlockIndex: null,
             uploadNum: 0,
             filePointNum: 0,
+            guid: '',
         }
     },
     created() {
@@ -427,6 +428,7 @@ export default {
                         this.activeSubjectIndex = index
                         this.isLoadBlocks = true
                         this.updated = false
+                        this.guid = ''
                         this.readPoint()
                     },
                     onCancel: () => {
@@ -471,7 +473,7 @@ export default {
                 this.currentPoint.name = val.name
             } else {
                 if(!this.currentPoint) {
-                    let guid = this.$tools.guid()
+                    if(!this.guid) this.guid = this.$tools.guid()
                     this.subTree.push({
                         allcids: [],
                         children: [],
@@ -479,7 +481,7 @@ export default {
                         level: 1,
                         link: 0,
                         name: val.name,
-                        pid: this.knowledgeTrees?.id || guid,
+                        pid: this.knowledgeTrees?.id || this.guid,
                         subcids: [],
                         tid: null,
                         used: 0
@@ -535,10 +537,10 @@ export default {
                     this.isLoading = false
                 })
             } else {
-                let guid = this.$tools.guid()
+                if(!this.guid) this.guid = this.$tools.guid()
                 let params = {
                     knowledgeTree: {
-                        id: this.subTreeRoot.length ? this.knowledgeTrees.id : guid, //id为空,表示新增,不为空,表示更新
+                        id: this.knowledgeTrees?.id || this.guid, //id为空,表示新增,不为空,表示更新
                         owner: this.currentParams.school_code,
                         scope: 'school',
                         periodId: this.currentParams.periodId,
@@ -554,6 +556,7 @@ export default {
                         this.updated = false
                         this.currentPoint = undefined
                         this.addMode = 0
+                        this.guid = ''
                         this.knowledgeTrees = res.knowledgeTree || undefined
                         this.subTreeRoot = this.knowledgeTrees?.tree || []
                         this.blockList = this.knowledgeTrees?.blocks || []
@@ -673,7 +676,7 @@ export default {
             this.isParsing = true
             this.addMode = 1
             let pointTree = []
-            let guid = this.$tools.guid()
+            if(!this.guid) this.guid = this.$tools.guid()
             this.readExcel(file, data => {
                 if (data.results.length) {
                     let notContinue = false
@@ -686,11 +689,11 @@ export default {
                                     pointTree.push({
                                         allcids: [],
                                         children: [],
-                                        id: `${pointTree.length ? Number(pointTree[pointTree.length - 1].id) + 1 : this.subTree.length ? Number(this.subTree[this.subTree.length - 1].id) + 1 : '1'}`,
+                                        id: `${pointTree.length ? Number(pointTree[pointTree.length - 1].id) + 1 : (this.subTree.length ? Number(this.subTree[this.subTree.length - 1].id) + 1 : '1')}`,
                                         level: 1,
                                         link: 0,
                                         name: data.results[i][key],
-                                        pid: this.knowledgeTrees?.id || guid,
+                                        pid: this.knowledgeTrees?.id || this.guid,
                                         subcids: [],
                                         tid: null,
                                         used: 0
@@ -841,7 +844,7 @@ export default {
                 if(sameIndex === -1) {
                     let idLast4 = arrOld.length ? arrOld[arrOld.length - 1].id : '-0'
                     let id4 = idLast4.split(`-`)
-                    item.id = `${pid}-${Number(id4[id4.length - 1]) + 1}`
+                    item.id = item.level === 1 ? (Number(id4[0]) + 1).toString() : `${pid}-${Number(id4[id4.length - 1]) + 1}`
                     item.level = index
                     item.pid = pid
                     if(item.children.length) {

+ 1 - 1
TEAMModelOS/ClientApp/src/view/task/marking/err/ErrPaper.vue

@@ -64,7 +64,7 @@
         </Modal>
         <Modal v-model="answerStatus" :title="$t('task.stuAnswer')" width="800">
             <div class="err-info-item" style="margin-top:10px">
-                <span v-if="!stuAnswer.answer.length">未查到该学生答案</span>
+                <span v-if="!stuAnswer.answer.length">{{ $t('task.message1') }}</span>
                 <span v-else v-html="stuAnswer.answer[errPaperIndex][0]"></span>
             </div>
         </Modal>

+ 4 - 4
TEAMModelOS/TEAMModelOS.csproj

@@ -80,11 +80,11 @@
 		<SpaRoot>ClientApp\</SpaRoot>
 		<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
 		<UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
-		<Version>5.2407.17</Version>
-		<AssemblyVersion>5.2407.17.1</AssemblyVersion>
-		<FileVersion>5.2407.17.1</FileVersion>
+		<Version>5.2407.24</Version>
+		<AssemblyVersion>5.2407.24.1</AssemblyVersion>
+		<FileVersion>5.2407.24.1</FileVersion>
 		<Description>TEAMModelOS(IES5)</Description>
-		<PackageReleaseNotes>IES版本说明版本切换标记5.2407.17.1</PackageReleaseNotes>
+		<PackageReleaseNotes>IES版本说明版本切换标记5.2407.24.1</PackageReleaseNotes>
 		<PackageId>TEAMModelOS</PackageId>
 		<Authors>teammodel</Authors>
 		<Company>醍摩豆(成都)信息技术有限公司</Company>

+ 1 - 1
TEAMModelOS/appsettings.Development.json

@@ -18,7 +18,7 @@
     "IdTokenSalt": "8263692E2213497BB55E74792B7900B4",
     "HttpTrigger": "https://teammodelosfunction-test.chinacloudsites.cn/api/",
     //"HttpTrigger": "http://localhost:7071/api/"
-    "Version": "5.2407.17.1"
+    "Version": "5.2407.24.1"
   },
   "Azure": {
     // 测试站数据库

+ 1 - 1
TEAMModelOS/appsettings.json

@@ -18,7 +18,7 @@
     "Exp": 86400,
     "IdTokenSalt": "8263692E2213497BB55E74792B7900B4",
     "HttpTrigger": "https://teammodelosfunction.chinacloudsites.cn/api/",
-    "Version": "5.2407.17.1"
+    "Version": "5.2407.24.1"
   },
   "Azure": {
     "Storage": {