Browse Source

Merge branch 'develop6.0-tmd' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop6.0-tmd

Li 3 years ago
parent
commit
5cf5ad260a

+ 1 - 1
TEAMModelOS.FunctionV4/CosmosDB/TriggerExam.cs

@@ -533,7 +533,7 @@ namespace TEAMModelOS.FunctionV4
                     int sIndex = 0;
                     foreach (List<double> sc in classResult.studentScores)
                     {                      
-                        double nc = sc.Sum();
+                        double nc = Math.Round(sc.Sum(), 2);
                         newSumScore.Add(nc);
                         subScore += nc;
                         classResult.sum[sIndex] = nc;

+ 3 - 3
TEAMModelOS.FunctionV4/TEAMModelOS.FunctionV4.csproj

@@ -5,9 +5,9 @@
 		<OutputType>Exe</OutputType>
 		<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
 		<SignAssembly>true</SignAssembly>
-		<AssemblyVersion>5.2204.22.1</AssemblyVersion>
-		<FileVersion>5.2204.22.1</FileVersion>
-		<Version>5.2204.22</Version>
+		<AssemblyVersion>5.2204.24.1</AssemblyVersion>
+		<FileVersion>5.2204.24.1</FileVersion>
+		<Version>5.2204.24</Version>
 		<PackageId>TEAMModelOS.FunctionV4</PackageId>
 		<Authors>teammodel</Authors>
 		<Company>醍摩豆(成都)信息技术有限公司</Company>

+ 4 - 1
TEAMModelOS/ClientApp/src/components/student-web/ClassRecord/DataCount.vue

@@ -112,8 +112,11 @@ export default {
                 */
                 this.attendType = nowClient.attendState
                 // this.dataList[0].value = nowClient.attendState
+                // 记分
                 this.dataList[0].value = nowClient.score
+                // 互动分
                 this.dataList[1].value = nowClient.interactScore
+                // 任务数
                 this.dataList[4].value = nowClient.taskCompleteCount
                 nowClient.examScoreList.map(item => {
                     this.dataList2[2].value += item
@@ -134,7 +137,7 @@ export default {
             // 测验总题数
             this.dataList2[0].value = summary.report.examQuizCount
             // 互动题数
-            this.dataList[1].value = summary.report.interactionCount
+            this.dataList2[1].value = summary.report.interactionCount
             // 测验得分率
             // this.dataList[8].value = summary.examPointRate
             this.$forceUpdate()

+ 1 - 1
TEAMModelOS/ClientApp/src/utils/excel.js

@@ -110,7 +110,7 @@ export const export_array_to_excel = ({ key, data, title, filename, autoWidth, s
     if (setTitle && setTitle.rules) {
         ws["!merges"] = setTitle.rules
     }
-    XLSX.utils.book_append_sheet(wb, ws, filename);
+    XLSX.utils.book_append_sheet(wb, ws);
     var wbout = XLSX.write(wb, {
         bookType: 'xlsx',
         bookSST: true,

+ 3 - 2
TEAMModelOS/ClientApp/src/view/classrecord/ClassRecord.vue

@@ -50,7 +50,7 @@
                     <div class="courseware-wrap">
                         <img :src="curImg" alt="" class="course-cur-img">
                         <div class="cus-page-wrap">
-                            <Page :total="pageList.length" :current="curPage" :page-size="1" size="small" @on-change="getCurHTEX" />
+                            <Page :total="pageList.length" :current.sync="curPage" :page-size="1" size="small" @on-change="getCurHTEX" />
                         </div>
                     </div>
                     <video-player2 v-if="hasVideo" v-show="isShowVd" @on-vd-error="videoError" class="video-player-box" :markers="markers" ref="videoPlayer" :options="playerOptions" :playsinline="true" @getCurPage="getCurPage">
@@ -472,7 +472,7 @@ export default {
             if (this.backPage) {
                 this.$router.push({
                     name: this.backPage,
-                    record:this.recordInfo
+                    record: this.recordInfo
                 })
             } else {
                 this.$router.go(-1)
@@ -481,6 +481,7 @@ export default {
     },
     computed: {
         curImg() {
+            console.log(this.curPage)
             if (this.pageList[this.curPage - 1]) {
                 return this.pageList[this.curPage - 1].img
             } else {

+ 1 - 1
TEAMModelOS/ClientApp/src/view/homework/ManageHomeWork.vue

@@ -400,7 +400,7 @@
 							className:i.classes[0].name,
 							submitTime:i.submit ? this.$tools.formatTime(i.submitTime,'yyyy-MM-dd hh:mm') : '-',
 							score:i.score === -1 ? '-' : i.score,
-							comment:i.replies.length ? params.row.replies[0] : '—'
+							comment:i.replies.length ? i.replies[0] : '—'
 						}
 					}),
 					autoWidth: true,

+ 4 - 2
TEAMModelOS/ClientApp/src/view/jyzx/index.vue

@@ -36,7 +36,9 @@
                                 <span style="float: left; color: #c51111;" v-if="item.currency === 2">不计学时</span>
                                 <span style="float: left;" v-if="item.currency === 1">
                                     <!-- 总计学时是所有分钟相加得到,会与所有能力点已学的学时相加相冲突,所以只show总计的学时 -->
-                                    {{ $t('jyzx.online.timeStudy') }}:{{ item.total }}{{ $t('jyzx.online.minute') }}
+                                    {{ $t('jyzx.online.timeStudy') }}:
+                                    {{ (setting.limitMinutes != -1 && (item.total > setting.limitMinutes)) ? setting.limitMinutes : item.total }}
+                                    {{ $t('jyzx.online.minute') }}
                                 </span>
                                 <span v-show="item.done && item.currency === 1" style="background-color: #16c18e;color: #fff; padding: 2px 5px;border-radius: 5px;">{{ $t('jyzx.common.complete') }}</span>
                             </p>
@@ -100,7 +102,7 @@
                                             </p>
                                             <div>
                                                 <video v-if="item.type === 'video'" :id="'video' + index" :src="item.formalUrl" controls="controls" style="border-radius: 5px;max-height: 700px;max-width: 100%;"
-                                                    :currentTime="currentTime" controlslist="noplaybackrate nodownload"
+                                                    :currentTime="currentTime" controlslist="noplaybackrate nodownload" oncontextmenu="return false;"
                                                     @pause="sendTime" @abort="pointList[activePointIndex].currency === 1 ? sendTime : ''" @playing="pointList[activePointIndex].currency === 1 ? startTime(item, index) : ''"
                                                     @timeupdate="timeChange" @ended="endStudy"
                                                 />

+ 40 - 34
TEAMModelOS/Controllers/Both/LessonRecordController.cs

@@ -340,33 +340,34 @@ namespace TEAMModelOS.Controllers
             {
                 records.Add(item);
             }
-            //if (records.Any()) {
-            //    var groupIds= records.SelectMany(x => x.groupIds).ToHashSet();
-            //    if (groupIds.Any()) {
-            //        var groups = await GroupListService.GetGroupListListids(_azureCosmos.GetCosmosClient(), _dingDing, groupIds.ToList(), school," c.id ");
-            //        //获取已经被删除的名单。
-            //        var idsExp =  groupIds.Except(groups.Select(x => x.id));
-            //        if (idsExp.Any()) {
+            if (records.Any()) {
+                var groupIds= records.SelectMany(x => x.groupIds).ToHashSet();
+                if (groupIds.Any()) {
+                    var groups = await GroupListService.GetGroupListListids(_azureCosmos.GetCosmosClient(), _dingDing, groupIds.ToList(), school," c.id ");
+                    //获取已经被删除的名单。
+                    var idsExp =  groupIds.Except(groups.Select(x => x.id));
+                    if (idsExp.Any()) {
+
                    
-            //            foreach(var item in records)
-            //            {
-            //                int countRmv = item.groupIds.RemoveAll(x => idsExp.Contains(x));
-            //                if (countRmv > 0)
-            //                {
-            //                    try {
-            //                        LessonRecord record = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReadItemAsync<LessonRecord>(item.id, new PartitionKey(code));
-            //                        record.groupIds = item.groupIds;
-            //                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync<LessonRecord>(record, item.id, new PartitionKey(code));
-            //                    } catch (CosmosException ex) when (ex.Status == 404) {
-            //                        continue;
-            //                    }
-            //                }
-            //            }
-            //        }
-            //    }
-            //}
+                        foreach(var item in records)
+                        {
+                            int countRmv = item.groupIds.RemoveAll(x => idsExp.Contains(x));
+                            if (countRmv > 0)
+                            {
+                                try {
+                                    LessonRecord record = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReadItemAsync<LessonRecord>(item.id, new PartitionKey(code));
+                                    record.groupIds = item.groupIds;
+                                    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync<LessonRecord>(record, item.id, new PartitionKey(code));
+                                } catch (CosmosException ex) when (ex.Status == 404) {
+                                    continue;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
             count = records.Count;
-            return Ok(new { count=count });
+            return Ok(new { count=count, records });
         }
       
         /// <summary>
@@ -389,7 +390,7 @@ namespace TEAMModelOS.Controllers
             }
             if (!request.TryGetProperty("scope", out JsonElement _scope)) return BadRequest();
             StringBuilder sql = new StringBuilder();
-            sql.Append("select distinct value(c) from c ");
+            sql.Append("select   value(c) from c ");
             int pageCount = 10;
             Dictionary<string, object> dict = GetLessonCond(request);
             if (request.TryGetProperty("pageCount", out JsonElement _pageCount))
@@ -519,14 +520,19 @@ namespace TEAMModelOS.Controllers
                 long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                 //查询时处理已经过期的课例。防止ServiceBus未触发的。
                 var expireRecords= lessonRecords.Where(x=> x.expire > 0 && now > x.expire);
-                foreach (var item in expireRecords) {
-                    //item.status = 404;
-                    //await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync(item, item.id, new PartitionKey(item.code));
-                    var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
-                    var messageChange = new ServiceBusMessage(new { delete_id=item.id,tmdid=item.tmdid,scope=item.scope,opt="delete",school=item.school }.ToJsonString());
-                    messageChange.ApplicationProperties.Add("name", "LessonRecordEvent");
-                    await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageChange);
-                    return Ok(new { status = 200 });
+                try {
+                    foreach (var item in expireRecords)
+                    {
+                        //item.status = 404;
+                        //await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync(item, item.id, new PartitionKey(item.code));
+                        var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
+                        var messageChange = new ServiceBusMessage(new { delete_id = item.id, tmdid = item.tmdid, scope = item.scope, opt = "delete", school = item.school }.ToJsonString());
+                        messageChange.ApplicationProperties.Add("name", "LessonRecordEvent");
+                        await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageChange);
+                        return Ok(new { status = 200 });
+                    }
+                } catch (Exception ex) {
+                    await  _dingDing.SendBotMsg($"{_option.Location},ServiceBus ,LessonRecordEvent 发送消息失败,检查是否配置正常。", GroupNames.成都开发測試群組);
                 }
                 var tmdids = lessonRecords.Select(x => x.tmdid).ToHashSet();
                 if (tmdids != null && tmdids.Count > 0)

+ 19 - 14
TEAMModelOS/Controllers/Common/HomeworkController.cs

@@ -98,14 +98,16 @@ namespace TEAMModelOS.Controllers.Learn
                 if (string.IsNullOrEmpty(homework.id))
                 {
                     homework.id = Guid.NewGuid().ToString();
-                    if (homework.startTime > now)
-                    {
-                        homework.progress = "pending";
-                    }
-                    else
-                    {
-                        homework.progress = "going";
-                    }
+                    if (string.IsNullOrEmpty(homework.progress)) {
+                        if (homework.startTime > now)
+                        {
+                            homework.progress = "pending";
+                        }
+                        else
+                        {
+                            homework.progress = "going";
+                        }
+                    }                   
                    // homework.progress = "going";
                     var messageBlob = new ServiceBusMessage();
                     string blobcntr = null;
@@ -171,13 +173,16 @@ namespace TEAMModelOS.Controllers.Learn
                     }
                     else
                     {
-                        if (homework.startTime > now)
-                        {
-                            homework.progress = "pending";
-                        }
-                        else
+                        if (string.IsNullOrEmpty(homework.progress))
                         {
-                            homework.progress = "going";
+                            if (homework.startTime > now)
+                            {
+                                homework.progress = "pending";
+                            }
+                            else
+                            {
+                                homework.progress = "going";
+                            }
                         }
                         //homework.progress = "going";
                         homework.recordUrl = $"/homework/{homework.id}/record.json";

+ 19 - 13
TEAMModelOS/Controllers/Common/SurveyController.cs

@@ -89,14 +89,17 @@ namespace TEAMModelOS.Controllers
                 if (string.IsNullOrEmpty(request.id))
                 {
                     request.id = Guid.NewGuid().ToString();
-                   
-                    if (request.startTime > now)
-                    {
-                        request.progress = "pending";
-                    }
-                    else
+
+                    if (string.IsNullOrEmpty(request.progress))
                     {
-                        request.progress = "going";
+                        if (request.startTime > now)
+                        {
+                            request.progress = "pending";
+                        }
+                        else
+                        {
+                            request.progress = "going";
+                        }
                     }
                     var messageBlob = new ServiceBusMessage();
                     string blobcntr = null;
@@ -161,13 +164,16 @@ namespace TEAMModelOS.Controllers
                         request = await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync(request, info.id, new PartitionKey($"{info.code}"));
                     }
                     else {
-                        if (request.startTime > now)
+                        if (string.IsNullOrEmpty(request.progress))
                         {
-                            request.progress = "pending";
-                        }
-                        else
-                        {
-                            request.progress = "going";
+                            if (request.startTime > now)
+                            {
+                                request.progress = "pending";
+                            }
+                            else
+                            {
+                                request.progress = "going";
+                            }
                         }
                         request.recordUrl = $"/survey/{request.id}/record.json";
                         var cods = new { records = new List<string>(), userids = new List<string>(), question = new List<QuestionRecord>() };

+ 19 - 11
TEAMModelOS/Controllers/Common/VoteController.cs

@@ -78,13 +78,18 @@ namespace TEAMModelOS.Controllers
                 {
                    
                     request.id = Guid.NewGuid().ToString();
-                    if (request.startTime > now)
+                    if(string.IsNullOrEmpty(request.progress))
                     {
-                        request.progress = "pending";
-                    }
-                    else { 
-                        request.progress = "going";
+                        if (request.startTime > now)
+                        {
+                            request.progress = "pending";
+                        }
+                        else
+                        {
+                            request.progress = "going";
+                        }
                     }
+                    
                     string blobcntr = null;
                     var messageBlob = new ServiceBusMessage();
                     if (request.scope.Equals("school"))
@@ -150,13 +155,16 @@ namespace TEAMModelOS.Controllers
                     }
                     else
                     {
-                        if (request.startTime > now)
-                        {
-                            request.progress = "pending";
-                        }
-                        else
+                        if (string.IsNullOrEmpty(request.progress))
                         {
-                            request.progress = "going";
+                            if (request.startTime > now)
+                            {
+                                request.progress = "pending";
+                            }
+                            else
+                            {
+                                request.progress = "going";
+                            }
                         }
                         string url = $"/vote/{request.id}/record.json";
                         request.recordUrl = url;

+ 24 - 3
TEAMModelOS/Controllers/XTest/TestController.cs

@@ -758,16 +758,31 @@ namespace TEAMModelOS.Controllers
             await table.SaveOrUpdateAll(teachersUp);
             return Ok();
         }
-        [HttpPost("test-scteacher")]
+        [HttpPost("fix-teacher-ability-files")]
         public async Task<IActionResult> TestScteacher(JsonElement json) {
+            if (!json.TryGetProperty("ids", out JsonElement _ids)) return BadRequest();
+            List<string> idss = _ids.Deserialize<List<string>>();
+            if (!idss.Any()) {
+                return BadRequest();
+            }
             var table = _azureStorage.GetCloudTableClient().GetTableReference("ScYxpt");
+
+            List<string> schools = new List<string>();
+            string schoolSql = " select value(c.id) from c where c.areaId='870a5a6b-1ab3-461a-bdeb-baec19780ddb' ";
+            await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetItemQueryIterator<string>(schoolSql, requestOptions: new QueryRequestOptions { PartitionKey=new PartitionKey("Base")}))
+            {
+                schools.Add(item);
+            }
             List<TeacherFile> teacherFiles = new List<TeacherFile>();
-            string sqls = "select distinct c.id,c.code from c where c.pk='TeacherFile' and  IS_DEFINED(c.fileRecords)=false ";
+            string sqls = $"select distinct c.id,c.code from c where c.pk='TeacherFile' and  c.id in ({string.Join(",", idss.Select(x => $"'{x}'"))}) ";
             List<IdNameCode> ids = new List<IdNameCode>();
             await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetItemQueryIterator<IdNameCode>(sqls, requestOptions: new QueryRequestOptions {  }))
             {
                 item.code= item.code.Replace("TeacherFile-", "");
-                ids.Add(item);
+                if (schools.Contains(item.code)) {
+                    ids.Add(item);
+                }
+             
             }
             var grp = ids.GroupBy(g => g.code).Select(x => new { key = x.Key, list = x.ToList() });
           
@@ -777,6 +792,12 @@ namespace TEAMModelOS.Controllers
                        var id  =  ids.Find(x => x.id.Equals(tch.id))?.id;
                         if (id != null) {
                             TeacherFile teacherFile = new TeacherFile { id = id,pk= "TeacherFile",code= $"TeacherFile-{gp.key}",ttl=-1 };
+                            try {
+                                TeacherTrain teacherTrain = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<TeacherTrain>(id, new PartitionKey($"TeacherTrain-{gp.key}"));
+                                teacherTrain.update.Add("TeacherAbility");
+                                await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync<TeacherTrain>(teacherTrain,id, new PartitionKey($"TeacherTrain-{gp.key}"));
+                            } catch (Exception) { 
+                            }
                             List<AbilitySub> abilitySubs = new List<AbilitySub>();
                             string sql = "select value(c) from c ";
                             try {

+ 3 - 3
TEAMModelOS/TEAMModelOS.csproj

@@ -32,9 +32,9 @@
     <SpaRoot>ClientApp\</SpaRoot>
     <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
     <UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
-    <Version>5.2204.22</Version>
-    <AssemblyVersion>5.2204.22.1</AssemblyVersion>
-    <FileVersion>5.2204.22.1</FileVersion>
+    <Version>5.2204.24</Version>
+    <AssemblyVersion>5.2204.24.1</AssemblyVersion>
+    <FileVersion>5.2204.24.1</FileVersion>
     <Description>TEAMModelOS(IES5)</Description>
     <PackageReleaseNotes>6.0版本说明</PackageReleaseNotes>
     <PackageId>TEAMModelOS</PackageId>