Browse Source

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

XW 3 years ago
parent
commit
01e99cc344

+ 29 - 1
TEAMModelBI/Controllers/BIServer/BiServersController.cs

@@ -15,6 +15,9 @@ using System.Text;
 using System.Net;
 using HTEXLib.COMM.Helpers;
 using System.Net.Http.Json;
+using TEAMModelOS.SDK;
+using TEAMModelBI.Filter;
+using Microsoft.AspNetCore.Authorization;
 
 namespace TEAMModelBI.Controllers.BIServer
 {
@@ -31,14 +34,39 @@ namespace TEAMModelBI.Controllers.BIServer
         private readonly IConfiguration _configuration;
 
         private readonly IHttpClientFactory _http;
+        private readonly CoreAPIHttpService _coreAPIHttpService;
 
-        public BiServersController(AzureCosmosFactory azureCosmos, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, IHttpClientFactory http)
+
+        public BiServersController(AzureCosmosFactory azureCosmos, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService)
         {
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _option = option?.Value;
             _configuration = configuration;
             _http = http;
+            _coreAPIHttpService = coreAPIHttpService;
+        }
+
+        /// <summary>
+        /// 通过手机号、醍摩豆账户、邮箱查询信息
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [AuthToken(Roles = "admin")]
+        [HttpPost("get-coreinfo")]
+        public async Task<IActionResult> GetCoreInfo(JsonElement jsonElement)
+        {
+            try
+            {
+                var content = new StringContent(jsonElement.ToString(), Encoding.UTF8, "application/json");
+                string json = await _coreAPIHttpService.GetUserInfos(content);
+                return Ok(new { state = 200, infos = json.ToObject<JsonElement>() });
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"BI, {_option} /biservers/get-coreinfo  \n {ex.Message} {ex.StackTrace}", GroupNames.成都开发測試群組);
+                return BadRequest();
+            }
         }
 
         /// <summary>

+ 8 - 2
TEAMModelBI/Controllers/DingDingStruc/TableDingDingInfoController.cs

@@ -168,13 +168,19 @@ namespace TEAMModelBI.Controllers.DingDingStruc
                 //List<DingDingUserInfo> TempdingDingUserInfos = await _azureStorage.SaveOrUpdateAll(dingDingUserInfos);  //只是保存至Table
                 //查询数据的数据 并和钉钉查询的数据对比,找出不同的数据,并删除  待后期测试
                 var users = await table.FindListByDict<DingDingUserInfo>(new Dictionary<string, object> { { "PartitionKey", $"{divide}" } });
+
                 List<DingDingUserInfo> noExisits = new();
+
                 if (users.Count > 0)
                 {
                     List<DingDingUserInfo> existsUserInfo = users.Where(u => !tempddUserInfos.Exists(e => u.userId.Equals(e.userId) && u.PartitionKey.Equals(e.PartitionKey))).ToList();
-                    existsUserInfo.AddRange(tempddUserInfos.Where(e => !users.Exists(u => e.userId.Equals(u.userId) && e.PartitionKey.Equals(u.PartitionKey))).ToList());
-                    noExisits = await table.DeleteAll(existsUserInfo);
+                    //existsUserInfo.AddRange(tempddUserInfos.Where(e => !users.Exists(u => e.userId.Equals(u.userId) && e.PartitionKey.Equals(u.PartitionKey))).ToList());
+
+                    ////List<DingDingUserInfo> existsUserInfo = users.Where((x, i) => users.FindIndex(z => z.userId.Equals(x.userId) && x.PartitionKey.Equals(divide)) == i).Select(x => x).ToList();
+
+                    noExisits = await table.DeleteAll(users);
                 }
+
                 List<DingDingUserInfo> UserInfo = await table.SaveOrUpdateAll(tempddUserInfos);  //保存和修改至Table
                 return Ok(new { state = 200, UserInfo, noExisits });
             }

+ 1 - 0
TEAMModelBI/Startup.cs

@@ -94,6 +94,7 @@ namespace TEAMModelBI
             services.AddHttpClient();
             services.AddHttpClient<DingDing>(); 
             services.AddHttpClient<NotificationService>();
+            services.AddCoreAPIHttpService(Configuration);
             services.AddHttpClient<CoreAPIHttpService>();
             services.AddMemoryCache();
             services.AddControllers().AddJsonOptions(options => { options.JsonSerializerOptions.IgnoreNullValues = false; });

+ 4 - 2
TEAMModelBI/appsettings.Development.json

@@ -42,8 +42,10 @@
     "Account": "https://account.teammodel.cn",
     "CoreAPI": "https://api2.teammodel.cn",
     "CoreService": {
-      "clientID": "73266ca3-62b1-4304-b837-c672a8c88001",      //大陆站的ClientId
-      "clientSecret": "E4Sr6[ezaT.b=3DYWoIATmqRDn4HlJb?",     //大陆站的密钥
+      "clientID": "c7317f88-7cea-4e48-ac57-a16071f7b884", //大陆站IES5 ClientId
+      "clientSecret": "kguxh:V.PLmxBdaI@jnrTrDSth]A3346", //大陆站IES5 ClientId
+      //"clientID": "73266ca3-62b1-4304-b837-c672a8c88001",      //大陆站的ClientId
+      //"clientSecret": "E4Sr6[ezaT.b=3DYWoIATmqRDn4HlJb?",     //大陆站的密钥
       //"clientID": "c01d78c2-a72e-416e-94d9-c8d3e4b8eb11",   //国际站的ClientId
       //"clientSecret": "68-Bz:/5Xv:u6PVAFE@s3.=P2PCq5@ux",   //国际站的密钥
       "deviceinfo": "https://api2.teammodel.cn/oauth2/getdeviceinfos",

+ 4 - 2
TEAMModelBI/appsettings.json

@@ -58,8 +58,10 @@
     "Account": "https://account.teammodel.cn",
     "CoreAPI": "https://api2.teammodel.cn",
     "CoreService": {
-      "clientID": "73266ca3-62b1-4304-b837-c672a8c88001",     //大陆站的ClientId
-      "clientSecret": "E4Sr6[ezaT.b=3DYWoIATmqRDn4HlJb?",     //大陆站的密钥
+      "clientID": "c7317f88-7cea-4e48-ac57-a16071f7b884",
+      "clientSecret": "kguxh:V.PLmxBdaI@jnrTrDSth]A3346",
+      //"clientID": "73266ca3-62b1-4304-b837-c672a8c88001",     //大陆站的ClientId
+      //"clientSecret": "E4Sr6[ezaT.b=3DYWoIATmqRDn4HlJb?",     //大陆站的密钥
       //"clientID": "c01d78c2-a72e-416e-94d9-c8d3e4b8eb11",   //国际站的ClientId
       //"clientSecret": "68-Bz:/5Xv:u6PVAFE@s3.=P2PCq5@ux",   //国际站的密钥
       "deviceinfo": "https://api2.teammodel.cn/oauth2/getdeviceinfos",

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

@@ -80,6 +80,7 @@ export default {
     noClassList: 'No course list yet',
     cusRecord: 'Lesson Record',
     acRecord: 'Activity Record',
+    gradeData:'成績統計',
     acType: 'Activity Type:',
     socrateReport: 'Sokrates Report',
     socrateMv: 'Sokrates Video/Screen Clips',

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

@@ -80,6 +80,7 @@ export default {
     noClassList:'暂无上课名单',
     cusRecord:'课堂记录',
     acRecord:'活动记录',
+    gradeData:'成绩统计',
     acType:'活动类型:',
     socrateReport:'苏格拉底报告',
     socrateMv:'苏格拉底影片/桌面',

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

@@ -80,6 +80,7 @@ export default {
     noClassList: '尚無上課名單',
     cusRecord: '課堂記錄',
     acRecord: '活動記錄',
+    gradeData:'成績統計',
     acType: '活動類型:',
     socrateReport: '蘇格拉底報告',
     socrateMv: '蘇格拉底影片/桌面',

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

@@ -471,7 +471,8 @@ export default {
         goBack() {
             if (this.backPage) {
                 this.$router.push({
-                    name: this.backPage
+                    name: this.backPage,
+                    record:this.recordInfo
                 })
             } else {
                 this.$router.go(-1)

+ 46 - 11
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue

@@ -69,9 +69,19 @@
                     </div>
                     <div class="course-classroom-info common-save-btn" id="table-height" slot="right">
                         <div class="course-classroom-info-header tab-box">
-                            <span @click="selectTab('record')" :class="tabName == 'record' ? 'course-classroom-label pane active':'course-classroom-label pane'">{{$t('cusMgt.cusRecord')}}</span>
-                            <span @click="selectTab('activity')" :class="tabName == 'activity' ? 'course-classroom-label pane active':'course-classroom-label pane'">{{$t('cusMgt.acRecord')}}</span>
-                            <span @click="selectTab('stus')" :class="tabName == 'stus' ? 'course-classroom-label pane active':'course-classroom-label pane'">{{$t('courseManage.classroom.studentList')}}</span>
+                            <span @click="selectTab('record')" :class="tabName == 'record' ? 'course-classroom-label pane active':'course-classroom-label pane'">
+                                {{$t('cusMgt.cusRecord')}}
+                            </span>
+                            <span @click="selectTab('activity')" :class="tabName == 'activity' ? 'course-classroom-label pane active':'course-classroom-label pane'">
+                                {{$t('cusMgt.acRecord')}}
+                            </span>
+                            <span @click="selectTab('stus')" :class="tabName == 'stus' ? 'course-classroom-label pane active':'course-classroom-label pane'">
+                                {{$t('courseManage.classroom.studentList')}}
+                            </span>
+                            <!-- 线上暂不开放 -->
+                            <span @click="selectTab('data')" v-show="isDev" :class="tabName == 'data' ? 'course-classroom-label pane active':'course-classroom-label pane'">
+                                {{$t('cusMgt.gradeData')}}
+                            </span>
 
                             <!-- 个人课程时段设置暂不实做 -->
                             <!-- <span @click="selectTab('time')" :class="tabName == 'time' ? 'course-classroom-label line-bottom line-bottom-active':'course-classroom-label line-bottom'">{{$t('cusMgt.cusTime')}}</span> -->
@@ -112,7 +122,8 @@
                                 </span>
                                 <i-switch :loading="sLoading" v-model="isAuto" size="small" @on-change="setAutoPublish" />
                             </div>
-                            <span v-show="tabName == 'stus' && listType == 'school' && teaClassList[curClassIndex] && teaClassList[curClassIndex].classId" class="group-tips">{{$t('cusMgt.groupTips')}}</span>
+                            <!-- <span v-show="tabName == 'stus' && listType == 'school' && teaClassList[curClassIndex] && teaClassList[curClassIndex].classId" class="group-tips">{{$t('cusMgt.groupTips')}}</span> -->
+                            <!-- 活动记录相关操作 -->
                             <div style="float:right;" v-if="tabName == 'activity'">
                                 <span class="action-btn-wrap light-iview-select">
                                     {{$t('cusMgt.acType')}}
@@ -127,9 +138,16 @@
                                 </span>
                             </div>
                         </div>
+                        <!-- 成绩统计 -->
+                        <div v-show="tabName == 'data'" class="animated fadeIn class-record-wrap">
+                            成绩统计
+                        </div>
                         <!-- 学生名单 -->
                         <div class="course-classroom-info-content animated fadeIn" v-if="tabName == 'stus'">
                             <vuescroll style="height:100%;">
+                                <Alert @on-close="isClose = true" v-show="!isClose && listType == 'school' && teaClassList[curClassIndex] && teaClassList[curClassIndex].classId" show-icon type="warning" closable>
+                                    {{$t('cusMgt.groupTips')}}
+                                </Alert>
                                 <Table :columns="isDefList ? classColumn : listColumn" :data="students" @on-selection-change="(selections)=>{delSelection = selections}" :height="tableHeight" class="system-classroom-table" :loading="stuLoading" :no-data-text="$t('cusMgt.noStu')">
                                     <Loading slot="loading" bgColor="rgba(103, 103, 103, 0.27)"></Loading>
                                     <template slot-scope="{ row }" slot="picture">
@@ -512,6 +530,8 @@ export default {
             }
         }
         return {
+            routerRecord: undefined,//首页跳转到课堂记录页面然后返回我的课程携带的数据
+            isClose: false,
             sLoading: false,
             isAuto: false,//是否自动发布课堂记录
             fIds: [],//收藏列表ids
@@ -2127,11 +2147,15 @@ export default {
                 (res) => {
                     if (res.error == null) {
                         this.courseList = res.courses
+                        // 如果从首页跳转返回
+                        if (this.routerRecord) {
+                            this.listType = this.routerRecord.scope || this.listType
+                        }
                         //设置当前课程列表 
-                        // this.courseListShow = this.courseList.filter(item => {
-                        //     return item.scope == this.listType
-                        // })
-                        this.tabClick(this.listType)
+                        this.courseListShow = this.courseList.filter(item => {
+                            return item.scope == this.listType
+                        })
+                        // this.tabClick(this.listType)
                         if (this.courseListShow.length == 0) { //如果没有标准课程,则设置默认为个人课程
                             this.listType = 'private'
                             this.courseListShow = this.courseList.filter(item => {
@@ -2139,18 +2163,21 @@ export default {
                             })
                         }
                         if (this.courseListShow.length) {
-                            this.getCusInfo()
+                            //定位对应的课程index
+                            if (this.routerRecord) {
+                                let index = this.courseListShow.findIndex(item => item.id == this.routerRecord.courseId)
+                                if (index > -1) this.curCusIndex = index
+                            }
+                            this.selectCourse(this.curCusIndex)
                         } else {
                             this.listLoading = false
                         }
 
                     } else {
-                        // this.$Message.error('API ERROR!')
                         this.listLoading = false
                     }
                 },
                 (err) => {
-                    // this.$Message.error('API ERROR!')
                     this.listLoading = false
                 }
             )
@@ -2318,6 +2345,14 @@ export default {
             }
         }
     },
+    beforeRouteEnter(to, from, next) {
+        next(vm => {
+            if (from.params.record) {
+                vm.routerRecord = from.params.record
+            }
+            console.log(arguments)
+        })
+    },
     created() {
         // this.tabName = this.$store.state.config.srvAdrType != 'product' ? 'record' : 'activity'
         this.tabName = 'record'

+ 12 - 12
TEAMModelOS/Controllers/Both/LessonRecordController.cs

@@ -709,22 +709,22 @@ namespace TEAMModelOS.Controllers
 
             if (request.TryGetProperty("week", out JsonElement week) && week.GetBoolean())
             {
-                DateTime dateTimeA = Convert.ToDateTime(DateTimeOffset.UtcNow.ToString("D"));
-                DateTime dateTimeB = Convert.ToDateTime(DateTimeOffset.UtcNow.ToString("D")).AddDays(1);
-                double dayOf00_00_00 = (dateTimeA - dateTime1970).TotalMilliseconds;
-                double day1Of00_00_00 = (dateTimeB - dateTime1970).TotalMilliseconds;
-                dict.Add(">=.startTime", dayOf00_00_00);
-                dict.Add("<.startTime", day1Of00_00_00);
+               // DateTime dateTimeA = Convert.ToDateTime(DateTimeOffset.UtcNow.ToString("D"));
+                DateTime dateTimeB = Convert.ToDateTime(DateTimeOffset.UtcNow.ToString("D")).AddDays(-7);
+                double now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
+                double dayB = (dateTimeB - dateTime1970).TotalMilliseconds;
+                dict.Add("<=.startTime", now);
+                dict.Add(">=.startTime", dayB);
             }
 
             if (request.TryGetProperty("month", out JsonElement month) && month.GetBoolean())
             {
-                DateTime dateTimeA = Convert.ToDateTime(DateTimeOffset.UtcNow.ToString("D"));
-                DateTime dateTimeB = Convert.ToDateTime(DateTimeOffset.UtcNow.ToString("D")).AddDays(1);
-                double dayOf00_00_00 = (dateTimeA - dateTime1970).TotalMilliseconds;
-                double day1Of00_00_00 = (dateTimeB - dateTime1970).TotalMilliseconds;
-                dict.Add(">=.startTime", dayOf00_00_00);
-                dict.Add("<.startTime", day1Of00_00_00);
+                //DateTime dateTimeA = Convert.ToDateTime(DateTimeOffset.UtcNow.ToString("D"));
+                DateTime dateTimeB = Convert.ToDateTime(DateTimeOffset.UtcNow.ToString("D")).AddDays(-30);
+                double now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
+                double dayB = (dateTimeB - dateTime1970).TotalMilliseconds;
+                dict.Add("<=.startTime", now);
+                dict.Add(">=.startTime", dayB);
             }
             if (request.TryGetProperty("stime", out JsonElement stime) && !string.IsNullOrWhiteSpace($"{stime}"))
             {