瀏覽代碼

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

zhouj1203@hotmail.com 3 年之前
父節點
當前提交
b2cb9a99bf
共有 23 個文件被更改,包括 200 次插入189 次删除
  1. 3 1
      TEAMModelOS.FunctionV4/ServiceBus/ActiveTaskTopic.cs
  2. 1 0
      TEAMModelOS.SDK/Models/Cosmos/Teacher/Teacher.cs
  3. 1 0
      TEAMModelOS/ClientApp/src/components/student-web/HomeView/CourseListView.vue
  4. 2 0
      TEAMModelOS/ClientApp/src/locale/lang/en-US/learnActivity.js
  5. 3 0
      TEAMModelOS/ClientApp/src/locale/lang/en-US/teachermgmt.js
  6. 2 0
      TEAMModelOS/ClientApp/src/locale/lang/zh-CN/learnActivity.js
  7. 3 0
      TEAMModelOS/ClientApp/src/locale/lang/zh-CN/teachermgmt.js
  8. 2 0
      TEAMModelOS/ClientApp/src/locale/lang/zh-TW/learnActivity.js
  9. 3 0
      TEAMModelOS/ClientApp/src/locale/lang/zh-TW/teachermgmt.js
  10. 1 1
      TEAMModelOS/ClientApp/src/utils/excel.js
  11. 17 22
      TEAMModelOS/ClientApp/src/utils/js-fn.js
  12. 4 4
      TEAMModelOS/ClientApp/src/view/assessment/Assessment.vue
  13. 3 2
      TEAMModelOS/ClientApp/src/view/learnactivity/ExamMgt.vue
  14. 1 1
      TEAMModelOS/ClientApp/src/view/learnactivity/Scoring.vue
  15. 16 12
      TEAMModelOS/ClientApp/src/view/learnactivity/tabs/AnswerTable.vue
  16. 10 5
      TEAMModelOS/ClientApp/src/view/learnactivity/tabs/DataView.vue
  17. 1 1
      TEAMModelOS/ClientApp/src/view/student-account/stuMgt/AddStudent.vue
  18. 0 1
      TEAMModelOS/ClientApp/src/view/teachermgmt/Index.less
  19. 3 3
      TEAMModelOS/ClientApp/src/view/teachermgmt/components/mgt/TeacherMgt.vue
  20. 57 120
      TEAMModelOS/Controllers/School/SchoolController.cs
  21. 53 15
      TEAMModelOS/Controllers/Teacher/InitController.cs
  22. 1 1
      TEAMModelOS/Controllers/XTest/FixDataController.cs
  23. 13 0
      TEAMModelOS/Controllers/XTest/TestController.cs

+ 3 - 1
TEAMModelOS.FunctionV4/ServiceBus/ActiveTaskTopic.cs

@@ -1089,6 +1089,8 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                             case "create":
                                 oldlessonRecord = null;
                                 //处理课堂选用的课程信息
+                                Teacher teacher = await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>(tmdid, new PartitionKey("Base"));
+                                lessonRecord.show = teacher.lessonShow;
                                 if (!string.IsNullOrEmpty(lessonRecord.courseId))
                                 {
                                     Course course = null;
@@ -1195,7 +1197,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                 try {
                                     if (scope.Equals("private"))
                                     {
-                                        Teacher teacher = await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>(tmdid, new PartitionKey("Base"));
+                                       
                                         if (teacher.lessonLimit != -1)
                                         {
 

+ 1 - 0
TEAMModelOS.SDK/Models/Cosmos/Teacher/Teacher.cs

@@ -15,6 +15,7 @@ namespace TEAMModelOS.SDK.Models
         public List<TeacherArea> areas { get; set; } = new List<TeacherArea>();
         public List<ThirdBind> binds { get; set; } = new List<ThirdBind>();
         public int lessonLimit { get; set; } = 0;
+        public List<string> lessonShow { get; set; } = new List<string>();
         public class TeacherSchool
         {
             public string schoolId { get; set; }

+ 1 - 0
TEAMModelOS/ClientApp/src/components/student-web/HomeView/CourseListView.vue

@@ -1011,6 +1011,7 @@ export default {
         */
         clickCell(row, index, type) {
             this.name = "tab5"
+            this.continuationToken = null
             let nowClassInfor = undefined
             if(type) {
                 nowClassInfor = this._.cloneDeep(row)

+ 2 - 0
TEAMModelOS/ClientApp/src/locale/lang/en-US/learnActivity.js

@@ -288,6 +288,8 @@ export default {
     simple: {
         totalPeople: 'Total No. of people',
         missExam: 'No. of absentee',
+        missExamRate: '缺考率',
+        ccRate:'及格率',
         classLabel: 'Class',
         sjLabel: 'Subject',
         avgScore: 'Average Score',

+ 3 - 0
TEAMModelOS/ClientApp/src/locale/lang/en-US/teachermgmt.js

@@ -207,6 +207,9 @@ export default {
     setSubjTitle: 'Set Subject',
     sltSubjTips: 'Please select a subject',
     subjectFilter: 'Subject Filter',
+    statusFilter: '狀態篩選',
+    jobFilter: '職稱篩選',
+    authFilter: '權限篩選',
     search: 'Search',
     //老師帳號分配空間授權控件teachermgmt/index.vue 空間欄位部分
     allocationSpace: 'Allocate Teaching Space',

+ 2 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/learnActivity.js

@@ -288,6 +288,8 @@ export default {
     simple: {
         totalPeople: '总人数',
         missExam: '缺考数',
+        missExamRate: '缺考率',
+        ccRate:'及格率',
         classLabel: '班级',
         sjLabel: '学科',
         avgScore: '平均分',

+ 3 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/teachermgmt.js

@@ -206,6 +206,9 @@ export default {
     setSubjTitle: '设置学科',
     sltSubjTips: '请选择学科',
     subjectFilter: '学科筛选',
+    statusFilter: '状态筛选',
+    jobFilter: '职称筛选',
+    authFilter: '权限筛选',
     search: '搜索',
     //老師帳號分配空間授權控件teachermgmt/index.vue 空間欄位部分
     allocationSpace: '分配教学空间',

+ 2 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/learnActivity.js

@@ -288,6 +288,8 @@ export default {
     simple: {
         totalPeople: '總人數',
         missExam: '缺考數',
+        missExamRate: '缺考率',
+        ccRate:'及格率',
         classLabel: '班級',
         sjLabel: '學科',
         avgScore: '平均分',

+ 3 - 0
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/teachermgmt.js

@@ -206,6 +206,9 @@ export default {
     setSubjTitle: '設置學科',
     sltSubjTips: '請選擇學科',
     subjectFilter: '學科篩選',
+    statusFilter: '狀態篩選',
+    jobFilter: '職稱篩選',
+    authFilter: '權限篩選',
     search: '搜尋',
     //老師帳號分配空間授權控件teachermgmt/index.vue 空間欄位部分
     allocationSpace: '分配教學空間',

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

@@ -7,7 +7,7 @@ function auto_width(ws, data) {
     const colWidth = data.map(row => row.map(val => {
         /*if null/undefined*/
         if (val == null) {
-            return { 'wch': 10 };
+            return { 'wch': 140 };
         }
         /*if chinese*/
         else if (val.toString().charCodeAt(0) > 255) {

+ 17 - 22
TEAMModelOS/ClientApp/src/utils/js-fn.js

@@ -1,7 +1,7 @@
 
 import store from '@/store'
 import {
-	app
+    app
 } from '@/boot-app.js'
 /*
  * 根据某个属性进行分组
@@ -100,7 +100,7 @@ function createVideoPoster(url, name, quality) {
                 video.setAttribute('crossOrigin', 'Anonymous')
                 video.setAttribute('src', url)
                 video.currentTime = 1
-				console.log(url)
+                console.log(url)
                 video.addEventListener('loadeddata', () => {
                     let canvas = document.createElement('canvas')
                     canvas.width = 300
@@ -127,7 +127,7 @@ function createVideoPoster(url, name, quality) {
  *dataUrl转文件 
  */
 function dataURLtoFile(dataurl, filename) {
-	console.log(...arguments);
+    console.log(...arguments);
     let arr = dataurl.split(',')
     let mime = arr[0].match(/:(.*?);/)[1]
     let bstr = atob(arr[1])
@@ -264,26 +264,21 @@ function getGradeNameByYear(data, curPd, year) {
  * @param curPd 当前学段id
  * @param grade 年级index
  */
-function getYearByGrade(data, curPd, grade) {
+function getYearByGrade(grade) {
     let date = new Date()
     let curYear = date.getFullYear()
     let month = date.getMonth() + 1
-    if (grade > -1 && data && data.period && curPd) {
-        let pData = data.period.find(item => {
-            return item.id == curPd
+    grade = parseInt(grade)
+    let curPeriod = store.state.user?.curPeriod
+    if (grade > -1 && curPeriod) {
+        let start = curPeriod.semesters.find(item => {
+            return item.start == 1
         })
-        if (pData) {
-            let start = pData.semesters.find(item => {
-                return item.start == 1
-            })
-            // 根据入学月份确定当前年级和学级的关系
-            if (start && month < start.month) {
-                curYear--
-            }
-            return curYear - grade
-        } else {
-            return curYear
+        // 根据入学月份确定当前年级和学级的关系
+        if (start && month < start.month) {
+            curYear--
         }
+        return curYear - grade
     } else {
         return curYear
     }
@@ -310,10 +305,10 @@ function getTeacherSubjects(ids) {
                 let subjectInfo = schoolPeriod[i].subjects.find(subject => subject.id === sid)
                 if (subjectInfo) {
                     data.push({
-                        periodId:schoolPeriod[i].id,
-                        periodName:schoolPeriod[i].name,
-                        subjectId:subjectInfo.id,
-                        subjectName:subjectInfo.name
+                        periodId: schoolPeriod[i].id,
+                        periodName: schoolPeriod[i].name,
+                        subjectId: subjectInfo.id,
+                        subjectName: subjectInfo.name
                     })
                     break
                 }

+ 4 - 4
TEAMModelOS/ClientApp/src/view/assessment/Assessment.vue

@@ -629,9 +629,8 @@
 		methods: {
 			/* 导出表格数据 */
 			onExportTable(){
-				console.log(this.assessmentList)
-				let header = ['姓名','总学时','线上研修学时','认证材料学时','校本研修学时','课堂实录学时','认证材料未提交数','作业未提交数','课堂实录是否提交']
-				let keys = ['name','totalTime','online','ability','offline','video','noAbilityCount','noHwCount','isSubmitVideo']
+				let header = ['姓名','总学时','线上研修学时','认证材料学时','校本研修学时','课堂实录学时','认证材料需提交数','认证材料未提交数','作业未提交数','课堂实录是否提交']
+				let keys = ['name','totalTime','online','ability','offline','video','abilityCount','noAbilityCount','noHwCount','isSubmitVideo']
 				let datas = this.assessmentList.map(i => {
 					return {
 						name:i.userInfo.name,
@@ -640,16 +639,17 @@
 						ability:i.hoursArr[1],
 						offline:i.hoursArr[2],
 						video:i.hoursArr[3],
+						abilityCount:i.abilities.length,
 						noAbilityCount:i.abilities.filter(i => i.zpscore === -1).length,
 						noHwCount:i.trains.filter(item => item.haswork && !item.url).length,
 						isSubmitVideo:i.video ? '已提交':'未提交'
 					}
 				})
-				console.error(datas)
 				const params = {
 					title: header,
 					key:keys,
 					data: datas,
+					autoWidth:true,
 					filename: this.$store.state.user.schoolProfile.school_base.name + '研修情况统计表'
 				}
 				excel.export_array_to_excel(params)

+ 3 - 2
TEAMModelOS/ClientApp/src/view/learnactivity/ExamMgt.vue

@@ -253,7 +253,8 @@ export default {
         } else {
             this.scope = 'private'
         }
-        this.findEvaluation()
+        this.filterPeriod = this.$store.state.user.curPeriod?.id
+        this.findEvaluation(true)
     },
     methods: {
         handleReachBottom() {
@@ -857,10 +858,10 @@ export default {
         },
         '$store.state.user.curPeriod': {
             deep: true,
-            immediate: true,
             handler(n, o) {
                 if (n) {
                     this.filterPeriod = n.id
+                    this.findEvaluation(true)
                 }
             }
         }

+ 1 - 1
TEAMModelOS/ClientApp/src/view/learnactivity/Scoring.vue

@@ -1018,7 +1018,7 @@ export default {
                     //TODO 处理年级选项
                     data = this.examInfo.grades
                     data.forEach(item => {
-                        let year = this.$jsFn.getYearByGrade(this.schoolBase, this.periodId, item.id)
+                        let year = this.$jsFn.getYearByGrade(item.id)
                         item.children = []
                         this.examClassLilst.forEach(classItem => {
                             if (classItem.year == year) {

+ 16 - 12
TEAMModelOS/ClientApp/src/view/learnactivity/tabs/AnswerTable.vue

@@ -352,7 +352,7 @@ export default {
                     //TODO 处理年级选项
                     data = this.examInfo.grades
                     data.forEach(item => {
-                        let year = this.$jsFn.getYearByGrade(this.schoolBase, this.periodId, item.id)
+                        let year = this.$jsFn.getYearByGrade(item.id)
                         item.children = []
                         this.examClassLilst.forEach(classItem => {
                             if (classItem.year == year) {
@@ -442,6 +442,7 @@ export default {
     watch: {
         examInfo: {
             handler(n, o) {
+                if (!n) return
                 if (n.subjects && n.subjects.length) {
                     this.chooseSubject = n.subjects[0].id;
                 }
@@ -462,7 +463,7 @@ export default {
                 this.examStuList = []
                 this.chooseClass = ''
                 //这里统一获取名单数据(教学班、行政班、个人名单)
-                let ids = this.examInfo.stuLists.length ? this.examInfo.stuLists : this.examInfo.classes
+                let ids = n.stuLists?.length ? n.stuLists : n.classes
                 let params = {
                     'schoolId': this.$store.state.userInfo.schoolCode,
                     'ids': ids
@@ -479,7 +480,7 @@ export default {
 
             },
             deep: true,
-            immediate:true
+            immediate: true
         },
         targetsData: {
             handler(n, o) {
@@ -1141,14 +1142,6 @@ export default {
          * }
          */
         getStatusInfo(answer, score, status) {
-            //评测结束,学生缺考
-            if (status == 1) {
-                return {
-                    status: 1,
-                    statusText: this.$t('learnActivity.score.status4'),
-                    statusColor: '#ed4014'
-                }
-            }
             //评测设置学生可以补考
             if (status == 2 || status == 3) {
                 return {
@@ -1157,14 +1150,25 @@ export default {
                     statusColor: '#2db7f5'
                 }
             }
+
+            //评测结束,学生缺考
+            if (status == 1 && this.examInfo.progress == 'finish') {
+                return {
+                    status: 1,
+                    statusText: this.$t('learnActivity.score.status4'),
+                    statusColor: '#ed4014'
+                }
+            }
+
             //评测进行中,未作答
-            if (!answer.length) {
+            if (status == 1 && this.examInfo.progress == 'going') {
                 return {
                     status: 0,
                     statusText: this.$t('learnActivity.score.status1'),
                     statusColor: '#808695'
                 }
             }
+            // status:0
             //已作答,未评分
             if (score.includes(-1)) {
                 return {

+ 10 - 5
TEAMModelOS/ClientApp/src/view/learnactivity/tabs/DataView.vue

@@ -31,22 +31,25 @@
                         {{$t('learnActivity.simple.totalPeople')}}
                     </p>
                 </div>
-                <!-- 缺考人数 -->
+                <!-- 缺考人数 (缺考率)-->
                 <div class="data-count-item">
                     <p class="data-value" style="color:#ed4014">
-                        {{examInfo.lostStu ? examInfo.lostStu.length : 0}}
+                        {{examInfo.qRate}}
+                        <span style="font-size:13px">%</span>
                     </p>
                     <p class="data-text">
-                        {{$t('learnActivity.simple.missExam')}}
+                        {{$t('learnActivity.simple.missExamRate')}}
                     </p>
                 </div>
                 <!-- 及格人数 -->
                 <div class="data-count-item" v-show="examInfo.subjects && examInfo.subjects.length == 1">
                     <p class="data-value">
-                        {{complyData[0] ? complyData[0].passCount : 0}}
+                        <!-- {{complyData[0] ? complyData[0].passRate : 0}} -->
+                        {{complyData[0] ? complyData[0].passRate : 0}}
+                        <span style="font-size:13px">%</span>
                     </p>
                     <p class="data-text">
-                        {{$t('learnActivity.simple.cc')}}
+                        {{$t('learnActivity.simple.ccRate')}}
                     </p>
                 </div>
                 <!-- 平均分 -->
@@ -261,10 +264,12 @@ export default {
                     let passScore = item.paperScore * 0.6
                     let pass = item.total.filter(i => i >= passScore)
                     let passCount = pass.length
+                    let passRate = item.total.length ? (passCount * 100 / item.total.length).toFixed(1) : 0
                     data.push({
                         id: item.subjectId,
                         name: item.subjectName,
                         passCount: passCount,
+                        passRate: passRate,
                         failCount: item.total.length - passCount
                     })
                 })

+ 1 - 1
TEAMModelOS/ClientApp/src/view/student-account/stuMgt/AddStudent.vue

@@ -282,7 +282,7 @@ export default {
         filterClasses() {
             var data = this.classes
             if (this.searchGrade > -1) {
-                let year = this.$jsFn.getYearByGrade(this.schoolBase, this.searchPeriod, this.searchGrade)
+                let year = this.$jsFn.getYearByGrade(this.searchGrade)
                 console.log(year)
                 data = data.filter((item) => {
                     return item.year == year && item.periodId == this.searchPeriod

+ 0 - 1
TEAMModelOS/ClientApp/src/view/teachermgmt/Index.less

@@ -10,7 +10,6 @@
         background-color: var(--body-bg);
         .tab-box {
             display: inline-block;
-            width: 30%;
             min-width: 303px;
             .pane{
                 margin-right: 40px;

+ 3 - 3
TEAMModelOS/ClientApp/src/view/teachermgmt/components/mgt/TeacherMgt.vue

@@ -4,17 +4,17 @@
         <div class="teacher-mgt-main">
             <div class="mgt-tools-wrap light-iview-form">
                 <!-- 状态筛选 -->
-                <Select v-model="filters.status" style="width:130px;margin-right:5px" clearable placeholder="状态筛选">
+                <Select v-model="filters.status" style="width:130px;margin-right:5px" clearable :placeholder="$t('teachermgmt.statusFilter')">
                     <Option v-for="item in statusFilters" :value="item.value" :key="item.value">{{ item.label }}</Option>
                 </Select>
                 <!-- 学科筛选 -->
                 <Cascader :data="subjectData" v-model="filters.subject" :placeholder="$t('teachermgmt.subjectFilter')" style="width:130px;margin-right:5px;display: inline-block;"></Cascader>
                 <!-- 职称筛选 -->
-                <Select v-model="filters.job" style="width:130px;margin-right:5px" clearable placeholder="职称筛选">
+                <Select v-model="filters.job" style="width:130px;margin-right:5px" clearable :placeholder="$t('teachermgmt.jobFilter')">
                     <Option v-for="item in jobs" :value="item" :key="item">{{ item }}</Option>
                 </Select>
                 <!-- 权限筛选 -->
-                <Select v-model="filters.auth" style="width:130px;margin-right:5px" clearable placeholder="权限筛选">
+                <Select v-model="filters.auth" style="width:130px;margin-right:5px" clearable :placeholder="$t('teachermgmt.authFilter')">
                     <Option v-for="item in authFilter" :value="item.value" :key="item.value">{{ item.label }}</Option>
                 </Select>
                 <!-- 关键字搜索 -->

+ 57 - 120
TEAMModelOS/Controllers/School/SchoolController.cs

@@ -1716,8 +1716,63 @@ namespace TEAMModelOS.Controllers
                             }
                         }
                     }
-                    teacherImport = new TeacherImport {id = $"{_schoolId}", code = "TeacherImport", pk = "TeacherImport", teachers=teachers};
-                    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).UpsertItemAsync(teacherImport, new PartitionKey("TeacherImport"));
+
+                    Azure .Response response=  await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync($"{_schoolId}", new PartitionKey("TeacherImport"));
+                    if (response.Status == 200)
+                    {
+                        teacherImport = JsonDocument.Parse(response.Content).RootElement.Deserialize<TeacherImport>();
+                        if (teacherImport != null && teacherImport.teachers.Any())
+                        {
+                            teachers.ForEach(x => {
+                                ImportTeacher tch = null;
+                                if (string.IsNullOrWhiteSpace(x.id))
+                                {
+                                    tch = teacherImport.teachers.Find(t => t.iname.Equals(x.iname));
+                                }
+                                else {
+                                    tch = teacherImport.teachers.Find(t => t.id.Equals(x.id));
+                                }
+                                if (tch != null)
+                                {
+                                    tch.time = now;
+                                    tch.status = x.status;
+                                    tch.name = x.name;
+                                    tch.iname = x.iname;
+                                    tch.picture = x.picture;
+                                    tch.phone = x.phone;
+                                    tch.tmdid = x.tmdid;
+                                    tch.email = x.email;
+                                    tch.note = x.note;
+                                    tch.id=x.id;
+                                }
+                                else {
+                                    teacherImport.teachers.Add(new ImportTeacher {
+                                        time = now,
+                                        status = x.status,
+                                        name = x.name,
+                                        iname = x.iname,
+                                        picture = x.picture,
+                                        phone = x.phone,
+                                        tmdid = x.tmdid,
+                                        email = x.email,
+                                        note = x.note,
+                                        id = x.id
+                                    });
+                                }
+                            });
+                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{_schoolId}", new PartitionKey("TeacherImport"));
+                        }
+                        else {
+                            teacherImport = new TeacherImport { id = $"{_schoolId}", code = "TeacherImport", pk = "TeacherImport", teachers = teachers };
+                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport,$"{_schoolId}", new PartitionKey("TeacherImport"));
+                        }
+                    }
+                    else {
+                        teacherImport = new TeacherImport { id = $"{_schoolId}", code = "TeacherImport", pk = "TeacherImport", teachers = teachers };
+                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).CreateItemAsync(teacherImport, new PartitionKey("TeacherImport"));
+                    }
+
+                   
                     if (inviteids.Any()) {
                         string bizcode = "invite";
                         Notification notification = new Notification
@@ -1737,124 +1792,6 @@ namespace TEAMModelOS.Controllers
                         var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
                     }
                     break;
-                    /*
-                case "find":
-                    Azure.Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync($"{_schoolId}", new PartitionKey("TeacherImport"));
-                    if (response.Status == 200)
-                    {
-                        teacherImport = JsonDocument.Parse(response.Content).RootElement.ToObject<TeacherImport>();
-                        var idsIn = teacherImport.teachers.Where(x => !string.IsNullOrWhiteSpace(x.id));
-                        //id是空 其他不是空的
-                        var tmdidsi = teacherImport.teachers.Where(x => string.IsNullOrWhiteSpace(x.id) && !string.IsNullOrWhiteSpace(x.tmdid)).Select(z => z.tmdid);
-                        var phonesi = teacherImport.teachers.Where(x => string.IsNullOrWhiteSpace(x.id) && !string.IsNullOrWhiteSpace(x.phone)).Select(z => z.phone);
-                        var emailsi = teacherImport.teachers.Where(x => string.IsNullOrWhiteSpace(x.id) && !string.IsNullOrWhiteSpace(x.email)).Select(z => z.email);
-                        List<string> skeys = new List<string>();
-                        if (tmdidsi.Any())
-                        {
-                            skeys.AddRange(tmdidsi);
-                        }
-                        if (phonesi.Any())
-                        {
-                            skeys.AddRange(phonesi);
-                        }
-                        if (emailsi.Any())
-                        {
-                            skeys.AddRange(emailsi);
-                        }
-                        if (idsIn.Any())
-                        {
-                            skeys.AddRange(idsIn.Select(x=>x.id));
-                            string sqlInSchool = $"select c.id,c.status from c where c.id in ({string.Join(",", idsIn.Select(x => $"'{x.id}'"))}) ";
-                            await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School)
-                                .GetItemQueryIterator<SchoolTeacher>(queryText: sqlInSchool, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Teacher-{_schoolId}") }))
-                            {
-                                idsInSchool.Add(item);
-                            }
-                        }
-                        if (skeys.Any())
-                        {
-                            try {
-                                var content = new StringContent(skeys.ToJsonString(), Encoding.UTF8, "application/json");
-                                string json = await _coreAPIHttpService.GetUserInfos(content);
-                                if (!string.IsNullOrWhiteSpace(json))
-                                {
-                                    coreUsers = json.ToObject<List<CoreUser>>();
-                                }
-                            } catch (Exception ex) {
-                                //await _dingDing.SendBotMsg($"{_option.Location},导入名单时,查验key信息错误{ex.Message}\n{ex.StackTrace}\n{skeys.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
-                            }
-                        }
-                        if (coreUsers.Any()) {
-                            teacherImport.teachers.ForEach(t => {
-                                if (!string.IsNullOrWhiteSpace(t.id))
-                                {
-                                    CoreUser coreUser = coreUsers.Find(x => x.searchKey.Equals(t.id) || x.id.Equals(t.id));
-                                    if (coreUser != null)
-                                    {
-                                        t.id = coreUser.id;
-                                        t.picture = coreUser.picture;
-                                    }
-                                    else
-                                    {
-                                        t.id = null;
-                                    }
-                                }
-                                if (string.IsNullOrWhiteSpace(t.id)) {
-                                    if (!string.IsNullOrWhiteSpace(t.tmdid))
-                                    {
-                                        CoreUser coreUser = coreUsers.Find(x => x.id.Equals(t.tmdid));
-                                        if (coreUser != null)
-                                        {
-                                            t.id = coreUser.id;
-                                            t.picture = coreUser.picture;
-                                        }
-                                    }
-                                    if (string.IsNullOrWhiteSpace(t.id))
-                                    {
-                                        if (!string.IsNullOrWhiteSpace(t.phone))
-                                        {
-                                            CoreUser coreUser = coreUsers.Find(x => x.mobile.Equals(t.phone));
-                                            if (coreUser != null)
-                                            {
-                                                t.id = coreUser.id;
-                                                t.picture = coreUser.picture;
-                                            }
-                                        }
-                                    }
-                                    if (string.IsNullOrWhiteSpace(t.id))
-                                    {
-                                        if (!string.IsNullOrWhiteSpace(t.email))
-                                        {
-                                            CoreUser coreUser = coreUsers.Find(x => x.mail.Equals(t.email));
-                                            if (coreUser != null)
-                                            {
-                                                t.id = coreUser.id;
-                                                t.picture = coreUser.picture;
-                                            }
-                                        }
-                                    }
-                                }
-                                
-                                if (!string.IsNullOrWhiteSpace(t.id))
-                                {
-                                    SchoolTeacher teacher = idsInSchool.Find(x => x.id.Equals(t.id));
-                                    if (teacher != null)
-                                    {
-                                        t.status = teacher.status;
-                                    }
-                                    else
-                                    {
-                                        t.status = "import";
-                                    }
-                                }
-                            });
-                        }
-                    }
-                    else {
-                        teacherImport= new TeacherImport { id=$"{_schoolId}",code= "TeacherImport",pk= "TeacherImport",teachers= new List<ImportTeacher>() };
-                    }
-                    break;
-                    */
             }
             return Ok(new { teacherImport });
         

+ 53 - 15
TEAMModelOS/Controllers/Teacher/InitController.cs

@@ -130,7 +130,17 @@ namespace TEAMModelOS.Controllers
                         {
                             return BadRequest(new { status = -1, msg = "您未加入该学校!" });
                         }
-                        //设置教师的科目信息
+                    //修改教师的最大课例保存数量
+                    case bool when $"{_opt}".Equals("UpdateLessonLimit", StringComparison.OrdinalIgnoreCase) && (request.TryGetProperty("lessonLimit", out JsonElement _lessonLimit)):
+                        teacher.lessonLimit = int.Parse($"{_lessonLimit}");
+                        await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, userid, new PartitionKey("Base"));
+                        return Ok(new { teacher, status = 1 });
+                    //修改教师设置自动将课例发布给谁的设置
+                    case bool when $"{_opt}".Equals("UpdateLessonShow", StringComparison.OrdinalIgnoreCase) && (request.TryGetProperty("lessonShow", out JsonElement _lessonShow)):
+                        teacher.lessonShow = _lessonShow.Deserialize<List<string>>();
+                        await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, userid, new PartitionKey("Base"));
+                        return Ok(new { teacher, status = 1 });
+                    //设置教师的科目信息
                     case bool when $"{_opt}".Equals("SetTeacherSubject", StringComparison.OrdinalIgnoreCase) && request.TryGetProperty("targerTecher", out JsonElement _targetTecher) 
                         && request.TryGetProperty("subjectIds", out JsonElement _subjectIds):
                         if (_subjectIds.ValueKind.Equals(JsonValueKind.Array))
@@ -252,12 +262,21 @@ namespace TEAMModelOS.Controllers
                 TeacherInfo teacherInfo= await TeacherService.TeacherInfo(_azureCosmos, teacher, $"{name}", $"{picture}", id, _azureStorage, _option);
                 teacherInfo.areas.ForEach(x => { if (x.setting != null) { x.setting.accessConfig=x.setting.accessConfig; } });
                 LoginLog(id, $"{name}", 200);
+                int lessonLimit = teacherInfo.teacher.lessonLimit;
+                if (teacherInfo.teacher.lessonLimit == 0)
+                {
+                    //未设置的的采用系统设置的默认值30
+                    lessonLimit = Constant.private_lesson_limit;
+                }
                 return Ok(new { location = _option.Location, teacherInfo. auth_token, teacherInfo. blob_uri, teacherInfo.blob_sas, teacherInfo.schools, teacherInfo.defaultschool, teacherInfo. courses,
                     teacherInfo.total,
                     teacherInfo.osblob_uri,
                     teacherInfo.osblob_sas,
                     teacherInfo.tsize, status = 200,
-                    teacherInfo. areas });
+                    teacherInfo. areas ,
+                    lessonLimit,
+                    teacherInfo.teacher.lessonShow
+                });
             }
             catch (CosmosException ex)
             {
@@ -550,10 +569,19 @@ namespace TEAMModelOS.Controllers
                 ///https://teammodelstorage.blob.core.chinacloudapi.cn/teammodelos
                 var (osblob_uri, osblob_sas) = roles.Contains("area") ? _azureStorage.GetBlobContainerSAS("teammodelos", BlobContainerSasPermissions.Write | BlobContainerSasPermissions.Read | BlobContainerSasPermissions.List | BlobContainerSasPermissions.Delete) : _azureStorage.GetBlobContainerSAS("teammodelos", BlobContainerSasPermissions.Read | BlobContainerSasPermissions.List);
                 areas.ForEach(x => { { if (x.setting != null) { x.setting.accessConfig = x.setting.accessConfig; } } });
+
+                int lessonLimit =teacher.lessonLimit;
+                if (teacher.lessonLimit == 0)
+                {
+                    //未设置的的采用系统设置的默认值30
+                    lessonLimit = Constant.private_lesson_limit;
+                }
                 return Ok(new { auth_token, blob_uri, blob_sas, school_base, 
                     school_courses,  school_classes, school_rooms, size, 
                     osblob_uri, osblob_sas, status = 200, areas , currArea , 
-                    productSum= new {
+                    lessonLimit,
+                    teacher.lessonShow,
+                    productSum = new {
                         serial = serials,
                         service= services
                     } });
@@ -770,13 +798,8 @@ namespace TEAMModelOS.Controllers
                     if (response.Status == 200)
                     {
                         teacherImport = JsonDocument.Parse(response.Content).RootElement.Deserialize<TeacherImport>();
-                        var tchs = teacherImport?.teachers?.FindAll(x => !string.IsNullOrWhiteSpace(x.id)  && x.id.Equals(id));
-                        if (tchs.IsNotEmpty())
-                        {
-                            var tch = tchs[0];
-                             
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{school_code}", new PartitionKey("TeacherImport"));
-                        }
+                        var tchs = teacherImport?.teachers?.RemoveAll(x => !string.IsNullOrWhiteSpace(x.id)  && x.id.Equals(id));
+                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{school_code}", new PartitionKey("TeacherImport"));
                     }
 
                     return Ok(new { stauts = 1 });
@@ -834,12 +857,13 @@ namespace TEAMModelOS.Controllers
                         };
                         var response = await client.GetContainer(Constant.TEAMModelOS, "School").CreateItemAsync(st, new PartitionKey($"Teacher-{school_code}"));
                     }
+                    Azure.Response responseImport = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync($"{school_code}", new PartitionKey("TeacherImport"));
+                    TeacherImport teacherImport = null;
                     if ($"{grant_type}".Equals("request")) {
-                        Azure.Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync($"{school_code}", new PartitionKey("TeacherImport"));
-                        TeacherImport teacherImport = null;
-                        if (response.Status == 200)
+                       
+                        if (responseImport.Status == 200)
                         {
-                            teacherImport = JsonDocument.Parse(response.Content).RootElement.Deserialize<TeacherImport>();
+                            teacherImport = JsonDocument.Parse(responseImport.Content).RootElement.Deserialize<TeacherImport>();
                             var tchs = teacherImport?.teachers?.FindAll(x =>  string.IsNullOrWhiteSpace(x.iname) && x.iname.Equals($"{name}") && string.IsNullOrWhiteSpace(x.id));
                             if (tchs.IsNotEmpty())
                             {
@@ -869,7 +893,21 @@ namespace TEAMModelOS.Controllers
                     }
                     if (grant_type.ToString().Equals("join"))
                     {
-                        await TmdUserService.JoinSchool(client, teacher.id, teacher.picture, teacher.name, school.schoolId, school.name);
+                        if (responseImport.Status == 200)
+                        {
+                            teacherImport = JsonDocument.Parse(responseImport.Content).RootElement.Deserialize<TeacherImport>();
+                            teacherImport?.teachers.ForEach(x => {
+                                if (x.id.Equals(teacher.id)) { 
+                                    x.name=teacher.name;
+                                    x.status = "join";
+                                    x.time=DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
+                                    x.picture=teacher.picture;
+                                }
+                            });
+                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{school_code}", new PartitionKey("TeacherImport"));
+                            await TmdUserService.JoinSchool(client, teacher.id, teacher.picture, teacher.name, school.schoolId, school.name);
+                        }
+                            
                     }
                     Notification notification = null;
 

+ 1 - 1
TEAMModelOS/Controllers/XTest/FixDataController.cs

@@ -2264,7 +2264,7 @@ namespace TEAMModelOS.Controllers
             }
             return students;
         }
-
+     
 
         public record CorrectStu
         {

+ 13 - 0
TEAMModelOS/Controllers/XTest/TestController.cs

@@ -701,6 +701,19 @@ namespace TEAMModelOS.Controllers
             }
             return Ok(new { data });
         }
+
+
+        [HttpPost("test-blob-folder")]
+        public async Task<IActionResult> TestBlobFolder(JsonElement json)
+        {
+            var client=  _azureStorage.GetBlobContainerClient("1595321354") ;
+            List<BlobItem> blobItems = new List<BlobItem>();
+            await foreach (BlobItem item in client.GetBlobsAsync(BlobTraits.None, BlobStates.None, $"records/207784031177150464/")) {
+                blobItems.Add(item);
+                break;
+            }
+            return Ok(blobItems);
+        }
     }
 
 }