فهرست منبع

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

Li 3 سال پیش
والد
کامیت
ac9501fb3a

+ 6 - 6
TEAMModelOS.FunctionV4/ServiceBus/ActiveTaskTopic.cs

@@ -337,7 +337,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
             await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", new RedisValue(name), new RedisValue($"{blobsize}"));
             long end = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
             long dis = (end - statr) / 1000;
-            long timeout = 10;
+            long timeout = 60*5;
             if (dis > timeout)
             {
                 await _dingDing.SendBotMsg($"ServiceBus,RefreshBlob:空间计算已经超过{timeout}秒\n容器名:{name}\n文件夹:{u}\n计算时长:{dis}", GroupNames.醍摩豆服務運維群組);
@@ -524,7 +524,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                     //课程名单变动修改学生课程关联信息
                     await ActivityService.FixStuCourse(client, _dingDing, groupChange);
                     //名单变动修改课例关联信息
-                    await ActivityService.FixLessonRecord(client, _dingDing, groupChange);
+                    //await ActivityService.FixLessonRecord(client, _dingDing, groupChange);
 
                 }
             }
@@ -881,7 +881,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
             else if ($"{scope}".Equals("private"))
             {
                 blobname = $"{tmdid}";
-                code = $"LessonRecord-{tmdid}";
+                code = $"LessonRecord";
                 tbname = "Teacher";
             }
             else
@@ -971,6 +971,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                     LessonBase lessonBase = baseblobDownload.Content.ToObjectFromJson<LessonBase>();
                                     if (lessonBase != null  && lessonBase.summary!=null)
                                     {
+                                        lessonRecord.name = lessonBase.summary.activityName;
                                         lessonRecord.attendCount = lessonBase.summary.attendCount;
                                         lessonRecord.clientCount = lessonBase.summary.clientCount;
                                         lessonRecord.attendRate = lessonBase.summary.attendRate;
@@ -1010,7 +1011,6 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                     //await _dingDing.SendBotMsg($"{_option.Location},课堂id:{_lessonId} blob刷新完成!", GroupNames.醍摩豆服務運維群組);
                                     msgs.Add(update);
                                 }
-                                 
                                 catch (Exception ex)
                                 {
                                    // await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}课程读取base.json,{_lessonId}\n{ex.Message}\n{ex.StackTrace}\n{lessonRecord.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
@@ -1248,7 +1248,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                                 ids.Add(item);
                                             }
                                             //包含收藏的本人的个人课例
-                                            string favorite_count_sql = $"select value(c.id) from  c where c.fromCode='LessonRecord-{tmdid}' and c.scope='private' ";
+                                            string favorite_count_sql = $"select value(c.id) from  c where c.type='LessonRecord'    and c.scope='private' ";
                                             await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetItemQueryIterator<string>(
                                                 queryText: favorite_count_sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Favorite-{tmdid}") }))
                                             {
@@ -1406,7 +1406,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                     }
                     else if ($"{scope}".Equals("private"))
                     {
-                        code = $"LessonRecord-{tmdid}";
+                        code = $"LessonRecord";
                         tbname = "Teacher";
                     }
                     else

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

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

+ 3 - 2
TEAMModelOS/ClientApp/public/web/viewer.html

@@ -478,7 +478,8 @@ See https://github.com/adobe-type-tools/cmap-resources
 		<div id="printContainer"></div>
 	</body>
 	<script>
-		alert('xxxxxxx')
-		document.getElementById("sidebarToggle").click()
+		setTimeout(() => {
+			document.getElementById("sidebarToggle").click()
+		},2000)
 	</script>
 </html>

+ 72 - 41
TEAMModelOS/ClientApp/src/components/student-web/HomeView/CourseListView.vue

@@ -197,20 +197,23 @@
                     <div class="mates-head" v-if="classList.length">
                         <div>
                             {{ $t("studentWeb.exam.studentScore.class") }}:
-                            <Select v-model="courseIndex" style="width:200px">
+                            <Select v-model="courseIndex" style="width:200px" @on-change="classListChange">
                                 <Option v-for="(item, index) in classList" :value="index" :key="index">{{ item.name }}</Option>
                             </Select>
                         </div>
-                        <!-- <div v-if="classList[courseIndex].type === 'teach'" class="nick-name">
-                            我的昵称
+                        <div v-if="classList[courseIndex].type === 'teach'" class="nick-name">
+                            {{ $t("studentWeb.courseContent.myNickName") }}
                             <span v-show="!isShowInput">
-                                {{ nickName.nickname ? nickName.nickname : '未设置' }}
+                                <span v-show="nickName.nickname">{{ nickName.nickname }}</span>
+                                <span v-show="!nickName.nickname" style="color: red;">{{ $t("studentWeb.courseContent.setting.no") }}</span>
                             </span>
                             <span class="change-name" v-show="isShowInput">
                                 <Input v-model="nickName.nickname" style="width: 150px" />
+                                <Icon type="md-checkmark" @click="changeNickName" />
+                                <Icon type="md-close" @click="isShowInput = false" />
                             </span>
-                            <Icon type="md-create" class="change-name-icon" @click="isShowInput = true" />
-                        </div> -->
+                            <Icon v-show="!isShowInput" type="md-create" class="change-name-icon" @click="isShowInput = true" />
+                        </div>
                     </div>
                     <div v-if="isChangeGroupView == false">
                         <!-- <vuescroll> -->
@@ -532,7 +535,7 @@ export default {
                 }, */
                 {
                     title: vm.$t("studentWeb.courseContent.accountType"),
-                    key: "type",
+                    key: "typeName",
                 },
                 {
                     title: vm.$t("studentWeb.courseContent.group"),
@@ -596,41 +599,42 @@ export default {
             this.stuGroup = []
             // this.stuList = []
             let req = {
-                ids: [course],
+                ids: course,
                 schoolId: this.courseNow.school
             }
             this.$api.common.getGroupListByIds(req).then(res => {
                 if(res.groups.length) {
                     res.groups.forEach(groups => {
                         this.classList.push(groups)
-                    })
-                }
-                if(res.members.length) {
-                    this.stuTotal += res.members.length
-                    let arr = this._.cloneDeep(res.members)
-                    // type表示角色类型,1:醍摩豆登陆,2:学生登陆
-                    let arrlist = arr.map((item) => {
-                        if(item.id === this.$store.state.userInfo.sub) {
-                            item.name = `${item.name}(${this.$t("studentWeb.courseContent.me")})`
-                            this.nickName = item
-                        }
-                        if(item.type === 2) {
-                            item.type = this.$t("studentWeb.courseContent.stuAccount")
-                        } else if(item.type === 1) {
-                            item.type = this.$t("studentWeb.courseContent.tmdNum")
+                        if(groups.members.length) {
+                            let arr = this._.cloneDeep(groups.members)
+                            // type表示角色类型,1:醍摩豆登陆,2:学生登陆
+                            let arrlist = arr.map((item) => {
+                                if(item.id === this.$store.state.userInfo.sub) {
+                                    item.name = `${item.name}(${this.$t("studentWeb.courseContent.me")})`
+                                }
+                                if(item.type === 2) {
+                                    item.typeName = this.$t("studentWeb.courseContent.stuAccount")
+                                } else if(item.type === 1) {
+                                    item.typeName = this.$t("studentWeb.courseContent.tmdNum")
+                                }
+                                return item
+                            })
+                            this.stuList.push(arrlist)
+                            /* this.stuList = arr.filter((item) => {
+                                return item.type === 2
+                            }) */
+                            this.tmdList = arr.filter((item) => {
+                                return item.type === 1
+                            })
+                            this.getGroup(groups.members)
                         }
-                        return item
-                    })
-                    this.nickName.scope = res.groups[0].scope
-                    this.stuList.push(arrlist)
-                    /* this.stuList = arr.filter((item) => {
-                        return item.type === 2
-                    }) */
-                    this.tmdList = arr.filter((item) => {
-                        return item.type === 1
                     })
-                    this.getGroup(res.members)
+                    // this.getRecordList()
+                    this.getRecordNum()
+                    this.classListChange(0)
                 }
+                this.stuTotal = res.members.length
             }).finally(() => {
                 this.isLoad = false
             })
@@ -893,17 +897,15 @@ export default {
                 school: this.userInfo.azp,
                 userid: this.courseNow.teaId,
             }
+            this.recordList = []
             // 获取学生名单
             let allClass = this.courseNow.classId.concat(this.courseNow.stuList)
             if(allClass.length) {
-                allClass.forEach(cour => {
-                    this.findStuInfor(cour)
-                })
+                // allClass.forEach(cour => {
+                    this.findStuInfor(allClass)
+                // })
                 this.needParam.classes = this.courseNow.classId
             }
-            this.recordList = []
-            // this.getRecordList()
-            this.getRecordNum()
             // 螢幕寬度<767px時,直接關掉sidebar
             if (window.innerWidth <= 991) {
                 this.$store.commit("ToggleSidebar", false);
@@ -952,7 +954,11 @@ export default {
                 pageCount: 10, //返回六条数据(分页)
                 today: false,
                 continuationToken: this.continuationToken, //返回的有值的话,下次查询就要用这个值
+                groupIds: [],
             }
+            this.classList.forEach(item => {
+                param.groupIds.push(item.id)
+            })
             param.scope === "school" ? param.school = this.userInfo.azp : param.tmdid = this.courseNow.creatorId
             this.$api.studentWeb.getRecordNum(param).then(res => {
                 this.recordNum = res.count
@@ -975,7 +981,11 @@ export default {
                 pageCount: 10, //返回六条数据(分页)
                 today: false,
                 continuationToken: this.continuationToken, //返回的有值的话,下次查询就要用这个值
+                groupIds: [],
             }
+            this.classList.forEach(item => {
+                param.groupIds.push(item.id)
+            })
             param.scope === "school" ? param.school = this.userInfo.azp : param.tmdid = this.courseNow.creatorId
             this.$api.studentWeb.getClassRecord(param).then(res => {
                 if(res.lessonRecords.length) {
@@ -1047,11 +1057,18 @@ export default {
         uploadNote(info) {
             this.$tools.doDownloadByUrl(info.eNote, info.name)
         },
+        classListChange(value) {
+            this.nickName = this.stuList[value].find((item) => {
+                return item.id === this.$store.state.userInfo.sub
+            })
+            this.nickName.scope = this.classList[value].scope
+            this.nickName.cId = this.classList[value].id
+        },
         changeNickName() {
             let param = {
                 opt: "up-nickname",
                 scope: this.nickName.scope,
-                id: this.nickName.classId,
+                id: this.nickName.cId,
                 code: this.nickName.code,
                 type: "teach",
                 members: [{
@@ -1060,7 +1077,15 @@ export default {
                     nickname: this.nickName.nickname,
                 }]
             }
-            this.$api.studentWeb.setNickName(param).then(res => {})
+            this.$api.studentWeb.setNickName(param).then(res => {
+                this.isShowInput = false
+                if(res.updateSuccess.length) {
+                    this.$Message.success(this.$t("studentWeb.courseContent.setting.ok"))
+                }
+                if(res.updateFailed.length) {
+                    this.$Message.success(this.$t("studentWeb.courseContent.setting.error"))
+                }
+            })
         },
     },
 
@@ -1239,6 +1264,12 @@ export default {
         margin-right: 10px;
         cursor: pointer;
     }
+
+    
+    .change-name > .ivu-icon {
+        margin-left: 10px;
+        cursor: pointer;
+    }
 }
 
 .list-block{

+ 1 - 0
TEAMModelOS/ClientApp/src/locale/lang/en-US/lessonRecord.js

@@ -13,6 +13,7 @@ export default {
 	semester: 'Semester',
 	custom: 'Customized Time',
 	lessonInfo: 'Lesson Information',
+	favorite:'Personal Collection',
 	form: {
 		name: 'Lesson Name',
 		place1: 'Please enter lesson name...',

+ 1 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/lessonRecord.js

@@ -13,6 +13,7 @@ export default {
 	semester:'本学期',
 	custom:'自定义范围',
 	lessonInfo:'课程信息',
+	favorite:'个人收藏',
 	form:{
 		name:'课例名称',
 		place1:'请输入课例的名称...',

+ 1 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/lessonRecord.js

@@ -13,6 +13,7 @@ export default {
 	semester:'本學期',
 	custom:'自定義範圍',
 	lessonInfo:'課堂資訊',
+	favorite:'個人收藏',
 	form:{
 		name:'課例名稱',
 		place1:'請輸入課例的名稱...',

+ 3 - 3
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -275,11 +275,11 @@
                                                 {{item.name}}
                                                 <span style="float:right;margin-right:20px">
                                                     <!-- 修改评测名称 -->
-                                                    <Icon v-show="item.owner === 'teacher'" type="md-create" class="common-item-icon" @click.stop="editEvName(index)" :title="$t('learnActivity.mgtScEv.edName')" />
+                                                    <Icon v-show="item.owner === 'teacher'" type="md-create" style="right:80px" class="common-item-icon" @click.stop="editEvName(index)" :title="$t('learnActivity.mgtScEv.edName')" />
                                                     <!-- 删除记录 -->
-                                                    <Icon v-show="item.owner === 'teacher'" type="md-trash" class="common-item-icon" @click.stop="delEv(item)" :title="$t('cusMgt.delRcd')" />
+                                                    <Icon v-show="item.owner === 'teacher'" type="md-trash" style="right:50px" class="common-item-icon" @click.stop="delEv(item)" :title="$t('cusMgt.delRcd')" />
                                                     <!-- 收藏 -->
-                                                    <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" :class="['common-item-icon',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
+                                                    <Icon :type="isFavorite(item.id) ? 'md-heart':'md-heart-outline'" style="right:20px"  :class="['common-item-icon',isFavorite(item.id) ? 'heart-active':'']" @click.stop="toggleFavorite(item)" :title="isFavorite(item.id) ? $t('cusMgt.unfvt') : $t('cusMgt.fvt')" />
                                                 </span>
                                             </p>
                                             <span slot="avatar" style="margin-top:12px;display: inline-block;margin-left:10px;">

+ 124 - 0
TEAMModelOS/ClientApp/src/view/research-center/BaseCleanCond.vue

@@ -0,0 +1,124 @@
+<template>
+	<div class="base-clean-container">
+		<p style="font-weight: bold;color: #189df0;font-size: 14px;margin-bottom: 10px;"><Icon type="md-information-circle" /> 自动清除时间设置</p>
+		<div class="clean-item">
+			<span style="font-weight: bold;margin-right: 20px;">课堂记录保留期限</span>
+			<InputNumber :formatter="value => `${parseInt(Math.floor(value*100)/100)}`" :max="30" :min="1" :step="1" v-model="expireDays"></InputNumber>
+			<span style="margin-left: 10px;">天</span>
+		</div>
+		<p style="font-weight: bold;color: #F06431;font-size: 14px;margin-bottom: 10px;"><Icon type="md-information-circle" /> 符合以下条件的课堂记录,将会进行保留,不会被系统自动清除</p>
+		<div class="clean-item" v-for="(item,index) in condArr">
+			<span class="clean-item-name">{{ item.name }}</span>
+			<Select v-model="item.type" style="width:120px;margin: 0 20px;">
+				<Option value=">=">大于等于</Option>
+				<Option value="<=">小于等于</Option>
+			</Select>
+			<InputNumber :formatter="value => `${parseInt(Math.floor(value*100)/100)}`" :max="item.unit === 'rate' ? 100 : 10000" :min="0" :step="1" v-model="item.value"></InputNumber>
+			<span style="margin-left: 10px;">{{ item.unit === 'rate' ? '%' : item.unit === 'point' ? '分' : '个' }}</span>
+		</div>
+	</div>
+</template>
+
+<script>
+	export default {
+		data(){
+			return {
+				expireDays:7,
+				condArr:[
+					{
+						name:this.$t('lessonRecord.attendCount'),
+						key:'attendRate',
+						value:0, 
+						unit:'rate', 
+						type:'>='
+					},
+					{
+						name:this.$t('lessonRecord.groupCount'),
+						key:'groupCount',
+						value:0, 
+						unit:'count',
+						type:'>='
+					},
+					{
+						name:this.$t('lessonRecord.totalPoint'),
+						key:'totalPoint',
+						value:0, 
+						unit:'point',
+						type:'>='
+					},
+					{
+						name:this.$t('lessonRecord.collateTaskCount'),
+						key:'collateTaskCount',
+						value:0, 
+						unit:'count',
+						type:'>='
+					},
+					{
+						name:this.$t('lessonRecord.collateCount'),
+						key:'collateCount',
+						value:0, 
+						unit:'count',
+						type:'>='
+					},
+					{
+						name:this.$t('lessonRecord.pushCount'),
+						key:'pushCount',
+						value:0, 
+						unit:'count',
+						type:'>='
+					},
+					{
+						name:this.$t('lessonRecord.score'),
+						key:'score',
+						value:0, 
+						unit:'point',
+						type:'>='
+					},
+					{
+						name:this.$t('lessonRecord.interactionCount'),
+						key:'interactionCount',
+						value:0, 
+						unit:'count',
+						type:'>='
+					},
+					{
+						name:this.$t('lessonRecord.clientInteractionCount'),
+						key:'clientInteractionCount',
+						value:0, 
+						unit:'count',
+						type:'>='
+					},
+					{
+						name:this.$t('lessonRecord.examQuizCount'),
+						key:'examQuizCount',
+						value:0, 
+						unit:'count',
+						type:'>='
+					},
+					{
+						name:this.$t('lessonRecord.examPointRate'),
+						key:'examPointRate',
+						value:0, 
+						unit:'rate',
+						type:'>='
+					}
+				]
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.base-clean-container{
+		.clean-item{
+			margin: 15px 0;
+			display: flex;
+			align-items: center;
+			&-name{
+				display: inline-block;
+				font-weight: bold;
+				width: 80px;
+			}
+		}
+	}
+</style>

+ 25 - 8
TEAMModelOS/ClientApp/src/view/research-center/ResearchMgt.vue

@@ -74,9 +74,13 @@
 				<span>{{ $t('lessonRecord.export') }}</span>
 			</div> -->
 			<div class="tool-item" @click="onTagMgClick">
-				<Icon type="md-settings" />
+				<Icon type="logo-buffer" />
 				<span>{{ $t('lessonRecord.tagMg') }}</span>
 			</div>
+			<!-- <div class="tool-item" @click="onSetCleanCond">
+				<Icon type="md-settings" />
+				<span>{{ '课堂记录设置' }}</span>
+			</div> -->
 			<!-- <div class="tool-item">
 				<Icon type="ios-paper-plane" />
 				<span>分享至公开课</span>
@@ -99,6 +103,7 @@
 							</div>
 							<div>
 								<Tag color="orange" v-if="row.category && row.category.length">{{ row.category.join(',') }}</Tag>
+								<Tag color="#FFA2D3" v-if="row.favorite > 0">{{ $t('lessonRecord.favorite') }}</Tag>
 							</div>
 						</div>
 					</template>
@@ -118,12 +123,6 @@
 						<span>{{ $tools.formatTime(row.startTime,'yyyy-MM-dd') }}</span>
 					</template>
 					<template slot-scope="{ row }" slot="action">
-						<!-- <Icon class="action-icon" type="ios-paper-plane" color="#27a3cf"/>
-						<Icon class="action-icon" type="md-play" color="#34cf97" @click="doPlay(row)" />
-						<Icon class="action-icon" type="md-create" color="#3197e5" @click="doEdit(row)" />
-						<Icon class="action-icon" type="md-trash" color="#e25255" @click="doDelete(row)" /> -->
-						<!-- <Icon class="action-icon" type="md-play" color="#34cf97" @click="doPlay(row)" /> -->
-						<!-- <Icon class="action-icon" type="ios-paper-plane" color="#27a3cf" @click="goDetails(row)"/> -->
 						<Icon type="md-download" class="action-icon" color="#34cf97" @click="downloadTable(row)" :title="$t('lessonRecord.action1')"/>
 						<Icon type="md-eye" class="action-icon" color="#3197e5" @click="downloadNote(row)" :title="$t('lessonRecord.action2')"/>
 						<Icon class="action-icon" type="md-trash" color="#e25255" @click="doDelete(row)" :title="$t('lessonRecord.action3')"/>
@@ -144,6 +143,17 @@
 				<Button type="primary" @click="onEditLesson" :loading="editLoading">{{ $t('lessonRecord.save') }}</Button>
 			</div>
 		</Modal>
+		<!-- 编辑新建弹窗 -->
+		<Modal v-model="cleanModal" :mask-closable="false" transfer width="500" class="research-modal">
+			<div slot="header">
+				{{ '课堂记录设置' }}
+			</div>
+			<BaseCleanCond></BaseCleanCond>
+			<div slot="footer">
+				<Button @click="cleanModal = false">{{ $t('lessonRecord.cancel') }}</Button>
+				<Button type="primary" @click="onEditLesson" :loading="editLoading">{{ $t('lessonRecord.save') }}</Button>
+			</div>
+		</Modal>
 		<!-- 类别管理弹窗 -->
 		<Modal v-model="categoryModal" transfer width="660" class="research-modal">
 			<div slot="header">
@@ -172,16 +182,19 @@
 <script>
 	import BaseTypeMgmt from './BaseTypeMgmt.vue'
 	import BaseForm from './BaseForm.vue'
+	import BaseCleanCond from './BaseCleanCond.vue'
 	export default {
 		components: {
 			BaseTypeMgmt,
-			BaseForm
+			BaseForm,
+			BaseCleanCond
 		},
 		data(vm) {
 			return {
 				rangeArr:[vm.$t('lessonRecord.all'),vm.$t('lessonRecord.week'),vm.$t('lessonRecord.month'),vm.$t('lessonRecord.semester'),vm.$t('lessonRecord.custom')],
 				curRangeIndex:0,
 				hideAdFilter:true,
+				cleanModal:false,
 				showRangePicker:false,
 				gradeIndexArr: [],
 				subjectIndexArr: [],
@@ -453,6 +466,10 @@
 			onTagMgClick() {
 				this.categoryModal = true
 			},
+			/* 点击设置自动清理条件 */
+			onSetCleanCond(){
+				this.cleanModal = true
+			},
 			/* 获取类别数据 */
 			initTags() {
 				this.$api.lessonRecord.findLessonTags({

+ 1 - 1
TEAMModelOS/Controllers/Analysis/ClassAnalysisController.cs

@@ -251,7 +251,7 @@ namespace TEAMModelOS.Controllers.Analysis
                 {
                     queryClass = $"select value(c) from c where c.tmdid = '{tmdId}'";
                     tId = tmdId.GetString();
-                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<LessonRecord>(queryText: queryClass, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"LessonRecord-{tmdId}") }))
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<LessonRecord>(queryText: queryClass, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"LessonRecord") }))
                     {
                         records.Add(item);
 

+ 11 - 2
TEAMModelOS/Controllers/Both/CourseController.cs

@@ -313,7 +313,7 @@ namespace TEAMModelOS.Controllers
         {
             if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
             if (!requert.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
-
+            requert.TryGetProperty("period", out JsonElement _period) ;
             try
             {
                 var client = _azureCosmos.GetCosmosClient();
@@ -340,8 +340,12 @@ namespace TEAMModelOS.Controllers
                 var query = $"select c.code,c.id,c.no,c.name,c.period,c.subject,c.scope from c";
                 if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
                 {
+                    string sql = query;
+                    if (!string.IsNullOrWhiteSpace($"{_period}")) {
+                        sql = $"{sql} where c.period.id ='{_period}'";
+                    }
 
-                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{code.GetString()}") }))
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: sql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{code.GetString()}") }))
                     {
                         //continuationToken = item.GetContinuationToken();
                         using var json = await JsonDocument.ParseAsync(item.ContentStream);
@@ -374,6 +378,11 @@ namespace TEAMModelOS.Controllers
                     if (requert.TryGetProperty("schoolId", out JsonElement schoolId))
                     {
                         var querySchool = $"select distinct c.code,c.id,c.no,c.name,c.period,c.subject,c.scope from c join A0 in c.schedule where A0.teacherId = '{code}'";
+                         
+                        if (!string.IsNullOrWhiteSpace($"{_period}"))
+                        {
+                            querySchool = $"{querySchool}  and  c.period.id ='{_period}'";
+                        }
                         await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: querySchool, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{schoolId.GetString()}") }))
                         {
                             //continuationToken = item.GetContinuationToken();

+ 46 - 38
TEAMModelOS/Controllers/Both/LessonRecordController.cs

@@ -84,7 +84,7 @@ namespace TEAMModelOS.Controllers
             else if ($"{_scope}".Equals("private"))
             {
 
-                code = $"LessonRecord-{_tmdid}";
+                code = $"LessonRecord";
                 tbname = "Teacher";
             }
             else
@@ -192,7 +192,7 @@ namespace TEAMModelOS.Controllers
                     }
                     else if ($"{_dscope}".Equals("private"))
                     {
-                        code = $"LessonRecord-{_dtmdid}";
+                        code = $"LessonRecord";
                         tbname = "Teacher";
                     }
                     else
@@ -253,6 +253,7 @@ namespace TEAMModelOS.Controllers
             string code = "";
             string school = null;
             List<string> autoTch = new List<string>();
+            string sqlPrivate = "";
             if (_scope.GetString().Equals("school"))
             {
                 if (!request.TryGetProperty("school", out JsonElement _school)) return BadRequest();
@@ -296,7 +297,8 @@ namespace TEAMModelOS.Controllers
                 if (!request.TryGetProperty("tmdid", out JsonElement _tmdid)) return BadRequest();
                 if (!string.IsNullOrEmpty($"{_tmdid}"))
                 {
-                    code = $"LessonRecord-{_tmdid}";
+                    code = $"LessonRecord";
+                    sqlPrivate = $" and c.tmdid='{_tmdid}'";
                     tbname = "Teacher";
                     List<string> ids = new List<string>();
                     ids.Add($"{_tmdid}");
@@ -331,38 +333,38 @@ namespace TEAMModelOS.Controllers
                 }
                 sqlShow = $" and (array_contains(c.show,'student') or array_contains(c.show,'all')  {autoSql} ) ";
             }
-            cosmosDbQuery.QueryText = cosmosDbQuery.QueryText.Replace("where", $" where (c.status<>404 or IS_DEFINED(c.status) = false ) and  array_length(c.groupIds)>0 {sqlShow}  and  ");
+            
+            cosmosDbQuery.QueryText = cosmosDbQuery.QueryText.Replace("where", $" where (c.status<>404 or IS_DEFINED(c.status) = false ) and  array_length(c.groupIds)>0 {sqlPrivate} {sqlShow}  and  ");
             List<LessonRecord> records = new List<LessonRecord>();
             await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).GetItemQueryIterator<LessonRecord>(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey(code) }))
             {
                 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, records });
         }
@@ -418,6 +420,7 @@ namespace TEAMModelOS.Controllers
             string tbname = "";
             string code = "";
             string school = null;
+            string sqlPrivate = "";
             List<string> autoTch = new List<string>();
             if (_scope.GetString().Equals("school"))
             {
@@ -460,7 +463,9 @@ namespace TEAMModelOS.Controllers
                 if (!request.TryGetProperty("tmdid", out JsonElement _tmdid)) return BadRequest();
                 if (!string.IsNullOrEmpty($"{_tmdid}"))
                 {
-                    code = $"LessonRecord-{_tmdid}";
+                    
+                    sqlPrivate = $" and c.tmdid='{_tmdid}'";
+                    code = $"LessonRecord";
                     tbname = "Teacher";
                     List<string> ids = new List<string>();
                     ids.Add($"{_tmdid}");
@@ -495,7 +500,7 @@ namespace TEAMModelOS.Controllers
                     }
                     sqlShow = $" and (array_contains(c.show,'student') or array_contains(c.show,'all')  {autoSql} ) ";
                 }
-                cosmosDbQuery.QueryText = cosmosDbQuery.QueryText.Replace("where", $" where (c.status<>404 or IS_DEFINED(c.status) = false ) and  array_length(c.groupIds)>0  {sqlShow} and  ");
+                cosmosDbQuery.QueryText = cosmosDbQuery.QueryText.Replace("where", $" where (c.status<>404 or IS_DEFINED(c.status) = false ) and  array_length(c.groupIds)>0 {sqlPrivate}  {sqlShow} and  ");
                 await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname)
                    .GetItemQueryStreamIterator(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, continuationToken: continuationToken,
                    requestOptions: new QueryRequestOptions() { MaxItemCount = pageCount, PartitionKey = new PartitionKey(code) }))
@@ -599,7 +604,7 @@ namespace TEAMModelOS.Controllers
                 if (!request.TryGetProperty("tmdid", out JsonElement _tmdid)) return BadRequest();
                 if (!string.IsNullOrEmpty($"{_tmdid}"))
                 {
-                    code = $"LessonRecord-{_tmdid}";
+                    code = $"LessonRecord";
                     tbname = "Teacher";
                 }
                 else
@@ -636,6 +641,7 @@ namespace TEAMModelOS.Controllers
             if (!request.TryGetProperty("scope", out JsonElement _scope)) return BadRequest();
             string tbname = "";
             string code = "";
+            string sqlPrivate = "";
             if (_scope.GetString().Equals("school") )
             {
                 if (!request.TryGetProperty("school", out JsonElement _school)) return BadRequest();
@@ -654,7 +660,8 @@ namespace TEAMModelOS.Controllers
                 if (!request.TryGetProperty("tmdid", out JsonElement _tmdid)) return BadRequest();
                 if (!string.IsNullOrEmpty($"{_tmdid}"))
                 {
-                    code = $"LessonRecord-{_tmdid}";
+                    sqlPrivate = $" and c.tmdid='{_tmdid}'";
+                    code = $"LessonRecord";
                     tbname = "Teacher";
                 }
                 else {
@@ -690,9 +697,10 @@ namespace TEAMModelOS.Controllers
                 ["today"] = true,
                 ["periodId"] = $"{_periodId}",
             }.ToJsonString().ToObject<JsonElement>();
-            List<LessonRecord> excellentRcd =await GetOtherLessonCond(excellent,   code,   tbname);
-            List<LessonRecord> doubleGreenRcd = await GetOtherLessonCond(doubleGreen, code, tbname);
-            List<LessonRecord> todayRcd = await GetOtherLessonCond(today, code, tbname);
+         
+            List<LessonRecord> excellentRcd =await GetOtherLessonCond(excellent,   code,   tbname, sqlPrivate);
+            List<LessonRecord> doubleGreenRcd = await GetOtherLessonCond(doubleGreen, code, tbname, sqlPrivate);
+            List<LessonRecord> todayRcd = await GetOtherLessonCond(today, code, tbname, sqlPrivate);
             try {
                 var tmdids_excellent = excellentRcd.Select(x => x.tmdid);
                 var tmdids_doubleGreen = excellentRcd.Select(x => x.tmdid);
@@ -739,13 +747,13 @@ namespace TEAMModelOS.Controllers
             }
         }
 
-        private async Task<List<LessonRecord>> GetOtherLessonCond(JsonElement request,string code ,string tbname ) {
+        private async Task<List<LessonRecord>> GetOtherLessonCond(JsonElement request,string code ,string tbname,string sqlPrivate) {
             StringBuilder sql = new StringBuilder();
             sql.Append("select value(c) from c ");
             Dictionary<string, object> dict = GetLessonCond(request);
             AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
             List<LessonRecord> lessonRecords = new List<LessonRecord>();
-            cosmosDbQuery.QueryText = cosmosDbQuery.QueryText.Replace("where", " where (c.status<>404 or IS_DEFINED(c.status) = false ) and  ");
+            cosmosDbQuery.QueryText = cosmosDbQuery.QueryText.Replace("where", $" where (c.status<>404 or IS_DEFINED(c.status) = false )  and  array_length(c.groupIds)>0 {sqlPrivate}  and  ");
             await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname)
                .GetItemQueryStreamIterator(queryDefinition: cosmosDbQuery.CosmosQueryDefinition,
                requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey(code) }))

+ 7 - 2
TEAMModelOS/Controllers/Client/HiTeachController.cs

@@ -81,6 +81,7 @@ namespace TEAMModelOS.Controllers.Client
             var client = _azureCosmos.GetCosmosClient();
             if (!request.TryGetProperty("lesson_id", out JsonElement _lessonId)) return BadRequest();
             if (!request.TryGetProperty("tmdid", out JsonElement _tmdid)) return BadRequest();
+            request.TryGetProperty("name", out JsonElement name);
             request.TryGetProperty("school", out JsonElement _school);
             if (!request.TryGetProperty("scope", out JsonElement _scope)) return BadRequest();
             request.TryGetProperty("grant_types", out JsonElement _grant_types);
@@ -95,7 +96,7 @@ namespace TEAMModelOS.Controllers.Client
             else if ($"{_scope}".Equals("private"))
             {
                
-                code = $"LessonRecord-{_tmdid}";
+                code = $"LessonRecord";
                 tbname = "Teacher";
             }
             else {
@@ -111,6 +112,10 @@ namespace TEAMModelOS.Controllers.Client
                         updates.Add(new LessonUpdate { grant_type = "up-base" });
                     }
                 }
+                if (!string.IsNullOrWhiteSpace($"{name}")) {
+                    lessonRecord.name = $"{name}";
+                    await client.GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync<LessonRecord>(lessonRecord, $"{_lessonId}", new PartitionKey(code));
+                }
                 var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
                 string msg = null;
                 msg = new { lesson_id = $"{_lessonId}", tmdid = $"{_tmdid}", grant_types = updates, school = $"{_school}", scope = $"{_scope}" }.ToJsonString();
@@ -152,7 +157,7 @@ namespace TEAMModelOS.Controllers.Client
                 }
                 if (lessonRecord.scope.Equals("private"))
                 {
-                    lessonRecord.code = $"LessonRecord-{lessonRecord.tmdid}";
+                    lessonRecord.code = $"LessonRecord";
                     tbname = "Teacher";
                 }
                 if (tbname == null) {

+ 12 - 3
TEAMModelOS/Controllers/School/SchoolTeacherController.cs

@@ -437,9 +437,15 @@ namespace TEAMModelOS.Controllers
                 request.TryGetProperty("job", out JsonElement _job);
                 request.TryGetProperty("permission", out JsonElement _permission);
                 request.TryGetProperty("pmAdd", out JsonElement _pmAdd);
-                List<string> addPm = null ;
-                if (_pmAdd.ValueKind.Equals(JsonValueKind.Array)){
-                    addPm= _pmAdd.ToObject<List<string>>();
+                request.TryGetProperty("pmRmv", out JsonElement _pmRmv);
+                List<string> rmvPm = null ;
+                if (_pmRmv.ValueKind.Equals(JsonValueKind.Array)){
+                    rmvPm = _pmRmv.ToObject<List<string>>();
+                }
+                List<string> addPm = null;
+                if (_pmAdd.ValueKind.Equals(JsonValueKind.Array))
+                {
+                    addPm = _pmAdd.ToObject<List<string>>();
                 }
                 List<string> permission = null;
                 if (_permission.ValueKind.Equals(JsonValueKind.Array))
@@ -469,6 +475,9 @@ namespace TEAMModelOS.Controllers
                     if (addPm.IsNotEmpty()) {
                         st.permissions.AddRange(addPm);
                     }
+                    if (rmvPm.IsNotEmpty()) {
+                        st.permissions.RemoveAll(x => rmvPm.Contains(x));
+                    }
                     if (hasjob) {
                         st.job = $"{_job}";
                     }

+ 129 - 11
TEAMModelOS/Controllers/XTest/FixDataController.cs

@@ -1391,10 +1391,12 @@ namespace TEAMModelOS.Controllers
         [HttpPost("add-area-school-admin")]
         public async Task<IActionResult> AddAreaSchoolAdmin(JsonElement data)
         {
+            List<School> errorSchool = new List<School>();
             var client = _azureCosmos.GetCosmosClient();
             List<string> tmdids = data.GetProperty("tmdids").ToObject<List<string>>();
             data.TryGetProperty("areaId", out JsonElement areaId);
             data.TryGetProperty("schoolIds", out JsonElement schoolIds);
+            data.TryGetProperty("addSchool", out JsonElement addSchool);
             data.TryGetProperty("areaAdmin", out JsonElement areaAdmin);
             List<string> ids = new List<string>();
             string idsSql = "";
@@ -1403,12 +1405,87 @@ namespace TEAMModelOS.Controllers
                 ids = schoolIds.ToObject<List<string>>();
                 if (ids.IsNotEmpty())
                 {
-                    idsSql = $" or  c.id in ({string.Join(",", ids.Select(x => $"'{x}'"))})";
+                    idsSql = $"    c.id in ({string.Join(",", ids.Select(x => $"'{x}'"))})";
                 }
             }
-            string areaIdsql = string.IsNullOrWhiteSpace($"{areaId}") ? "-0000000" : $"{areaId}";
-            string sql = $"select distinct value(c) from c where c.areaId='{areaIdsql}'  {idsSql}";
             List<School> schools = new List<School>();
+            if (addSchool.ValueKind.Equals(JsonValueKind.Array))
+            {
+                List<School> codes = new();
+                codes = addSchool.ToObject<List<School>>();
+                List<School> schoolsNew = new List<School>();
+                string _areaId = null;
+                if (!string.IsNullOrWhiteSpace($"{areaId}"))
+                {
+                    _areaId = $"{areaId}";
+                }
+                int scale = 0;
+                data.TryGetProperty("scale", out JsonElement _scale);
+                if (!string.IsNullOrWhiteSpace($"{_scale}"))
+                {
+                    int.TryParse($"{_scale}", out scale);
+                }
+                int size = 0;
+                data.TryGetProperty("size", out JsonElement _size);
+                if (!string.IsNullOrWhiteSpace($"{_size}"))
+                {
+                    int.TryParse($"{_size}", out size);
+                }
+               
+                codes.ForEach(x => {
+                    string campusId = Guid.NewGuid().ToString();
+                    List<Period> periods = new List<Period>();
+                    periods.Add(new Period
+                    {
+                        id = Guid.NewGuid().ToString(),
+                        name = x.name,
+                        campusId = campusId,
+                        semesterCount = 2,
+                        gradeCount = 1,
+                        grades = new List<string> { "一年级" },
+                        subjectCount = 1,
+                        subjects = new List<Subject> { new Subject { name = "预设学科", id = Guid.NewGuid().ToString() } },
+                        semesters = new List<Semester>
+                        {
+                            new Semester { name = "上学期", start = 1, month = 9, day = 1, id = Guid.NewGuid().ToString() },
+                            new Semester { name = "下学期", start = 0, month = 3, day = 1, id = Guid.NewGuid().ToString() }
+                        },
+                    });
+                    School school = new School
+                    {
+                        id = x.id,
+                        name = x.name,
+                        size = size,
+                        code = "Base",
+                        campuses = new List<Campus> { new Campus { name = x.name, id = campusId } },
+                        region = "中国",
+                        province = x.province,
+                        city = $"{x.city}",
+                        timeZone = new SDK.Models.TimeZone { label = "(UTC+08:00) 北京,重庆,香港特别行政区,乌鲁木齐", value = "+08:00" },
+                        type = 1,
+                        pk = "School",
+                        ttl = -1,
+                        schoolCode = x.id,
+                        dist = $"{x.dist}",
+                        period = periods,
+                        areaId = String.IsNullOrWhiteSpace($"{areaId}") ? null: $"{areaId}",
+                        standard = $"standard2"
+                    };
+                    schoolsNew.Add(school);
+                });
+                foreach (var sch in schoolsNew) {
+                    try
+                    {
+                       await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS,Constant.School).CreateItemAsync(sch,new PartitionKey("Base"));
+                        schools.Add(sch);
+                    }
+                    catch (CosmosException ex ){
+                        errorSchool.Add(sch);
+                    }
+                }
+            }
+            string areaIdsql = string.IsNullOrWhiteSpace($"{areaId}") ? "-0000000" : $"{areaId}";
+            string sql = $"select distinct value(c) from c where    {idsSql}";
             await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.School).GetItemQueryIterator<School>(
                 queryText: sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
             {
@@ -1442,6 +1519,29 @@ namespace TEAMModelOS.Controllers
                 }
                 foreach (var school in schools)
                 {
+                    if (!string.IsNullOrWhiteSpace($"{areaId}")) {
+                        school.areaId= $"{areaId}";
+                    }
+                    data.TryGetProperty("scale", out JsonElement _scale);
+                    if (!string.IsNullOrWhiteSpace($"{_scale}"))
+                    {
+                        int  scale = 0;
+                        int.TryParse($"{_scale}",out scale);
+                        if (scale > 0) {
+                            school.scale = scale;
+                        }
+                    }
+                    data.TryGetProperty("size", out JsonElement _size);
+                    if (!string.IsNullOrWhiteSpace($"{_size}"))
+                    {
+                        int size = 0;
+                        int.TryParse($"{_size}", out size);
+                        if (size > 0)
+                        {
+                            school.size = size;
+                        }
+                    }
+                    await client.GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(school, school.id, new PartitionKey("Base"));
                     Azure.Response response = await client.GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync(tmdid, new PartitionKey($"Teacher-{school.id}"));
                     if (response.Status == 200)
                     {
@@ -1510,7 +1610,7 @@ namespace TEAMModelOS.Controllers
                 await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync(teacher, tmdid, new PartitionKey($"Base"));
                 teachers.Add(teacher);
             }
-            return Ok(new { teachers, schoolsTeachers });
+            return Ok(new { teachers, schoolsTeachers, errorSchool });
         }
 
         /// <summary>
@@ -1957,14 +2057,32 @@ namespace TEAMModelOS.Controllers
                await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync<School>(item, item.id, new PartitionKey(item.code));
             }
             return Ok(schoolsSet);
+        }    /// <summary>
+             /// 修复学校课例及blob计算
+             /// </summary>
+             /// <param name="jsonElement"></param>
+             /// <returns></returns>
+        [HttpPost("fix-teacher-private-lesson-record")]
+        public async Task<IActionResult> FixTeacherPrivateLessonRecord(JsonElement json)
+        {
+            var client = _azureCosmos.GetCosmosClient();
+            string sql = " SELECT distinct value(c)  FROM c  where c.pk='LessonRecord'  ";
+            List<LessonRecord> lessonRecords = new List<LessonRecord>();
+            await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetItemQueryIterator<LessonRecord>(queryText: sql, requestOptions: new QueryRequestOptions {}))
+            {
+                item.code = "LessonRecord";
+                await  _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).UpsertItemAsync(item,new PartitionKey (item.code));
+                lessonRecords.Add(item);
+            }
+            return Ok(lessonRecords);
         }
 
-        /// <summary>
-        /// 修复学校课例及blob计算
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [HttpPost("fix-school-lesson-record")]
+            /// <summary>
+            /// 修复学校课例及blob计算
+            /// </summary>
+            /// <param name="jsonElement"></param>
+            /// <returns></returns>
+            [HttpPost("fix-school-lesson-record")]
         public async Task<IActionResult> FixSchoolLessonRecord(JsonElement json)
         {
             var client = _azureCosmos.GetCosmosClient();
@@ -2103,7 +2221,7 @@ namespace TEAMModelOS.Controllers
                 else if ($"{scope}".Equals("private"))
                 {
                     blobname = $"{tmdid}";
-                    code = $"LessonRecord-{tmdid}";
+                    code = $"LessonRecord";
                     tbname = "Teacher";
                 }
                 //如果有更新 则去读取/{_lessonId}/IES/base.json

+ 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.20</Version>
-    <AssemblyVersion>5.2204.20.1</AssemblyVersion>
-    <FileVersion>5.2204.20.1</FileVersion>
+    <Version>5.2204.21</Version>
+    <AssemblyVersion>5.2204.21.1</AssemblyVersion>
+    <FileVersion>5.2204.21.1</FileVersion>
     <Description>TEAMModelOS(IES5)</Description>
     <PackageReleaseNotes>6.0版本说明</PackageReleaseNotes>
     <PackageId>TEAMModelOS</PackageId>