Browse Source

代码优化

Li 2 years ago
parent
commit
c120a93d38

+ 2 - 2
TEAMModelBI/Controllers/BICommon/JointlyController.cs

@@ -19,7 +19,7 @@ namespace TEAMModelBI.Controllers.BICommon
         private readonly AzureStorageFactory _azureStorage;
         private readonly DingDing _dingDing;
         private readonly Option _option;
-        public readonly List<string> _containers = new List<string> { "Teacher", "School", "Student", "Normal", "Common" };
+        public readonly List<string> _containers = new() { "Teacher", "School", "Student", "Normal", "Common" };
 
         public JointlyController(AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option)
         {
@@ -42,7 +42,7 @@ namespace TEAMModelBI.Controllers.BICommon
             if (!jsonEmelent.TryGetProperty("type", out JsonElement type)) return BadRequest();
             jsonEmelent.TryGetProperty("code", out JsonElement code);
             var cosmosClient = _azureCosmos.GetCosmosClient();
-            List<object> objs = new List<object>();
+            List<object> objs = new();
             List<int> types = type.ToObject<List<int>>();
 
             if (types.Count > 0)

+ 4 - 4
TEAMModelBI/Controllers/BINormal/AbilityMgmtController.cs

@@ -60,7 +60,7 @@ namespace TEAMModelBI.Controllers.BINormal
                 if ($"{site}".Equals(BIConst.Global))
                     cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
 
-                List<Ability> abilities = new List<Ability>();
+                List<Ability> abilities = new();
                 string sqltxt = "select value(c) from c";
                 await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Ability>(queryText: sqltxt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{standard}") }))
                 {
@@ -136,7 +136,7 @@ namespace TEAMModelBI.Controllers.BINormal
                     tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
                     blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
                 }
-                List<AbilityTask> syllabus = new List<AbilityTask>();
+                List<AbilityTask> syllabus = new();
                 string sql = $"select value(c) from c where c.abilityId='{id}'";
                 var response = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemStreamAsync(id.ToString(), new PartitionKey($"Ability-{standard}"));
                 await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AbilityTask>(queryText: sql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{standard}") }))
@@ -178,7 +178,7 @@ namespace TEAMModelBI.Controllers.BINormal
             {
                 var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
 
-                StringBuilder stringBuilder = new StringBuilder($"{_tmdName}【{_tmdId}】");
+                StringBuilder stringBuilder = new($"{_tmdName}【{_tmdId}】");
 
                 //Ability ability = recordAbility.ability;
                 ability.pk = "Ability";
@@ -207,7 +207,7 @@ namespace TEAMModelBI.Controllers.BINormal
                 {
                     ability.comid = Guid.NewGuid().ToString();
 
-                    StringBuilder sqltxt = new StringBuilder("select value(c) from c  where c.status = 1 ");
+                    StringBuilder sqltxt = new("select value(c) from c  where c.status = 1 ");
                     if (!string.IsNullOrEmpty(ability.dimension))
                     {
                         sqltxt.Append($" and c.dimension = '{ability.dimension}' and c.name = '{ability.name}'  and c.no = '{ability.no}' ");

+ 9 - 9
TEAMModelBI/Controllers/BINormal/AbilityTaskMgmtController.cs

@@ -63,8 +63,8 @@ namespace TEAMModelBI.Controllers.BINormal
                 if ($"{site}".Equals(BIConst.Global))
                     cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
                 Ability ability = null;
-                List<AbilityTaskTreeNode> abilityTaskTreeNodes = new List<AbilityTaskTreeNode>();//原始数据未排序
-                List<AbilityTaskTreeNode> redtAbilityTaskTreeNodes = new List<AbilityTaskTreeNode>();//排序后的数据
+                List<AbilityTaskTreeNode> abilityTaskTreeNodes = new();//原始数据未排序
+                List<AbilityTaskTreeNode> redtAbilityTaskTreeNodes = new();//排序后的数据
 
                 int rnodeCount = 0;
                 try
@@ -84,7 +84,7 @@ namespace TEAMModelBI.Controllers.BINormal
                         list.ForEach(x => { if (x.IsNotEmpty()) { rnodeCount += 1; } });
                     }
                     List<AbilityTaskTree> trees = AbilityService.ListToTree(item.children);
-                    AbilityTaskTreeNode abilityTaskTreeNode = new AbilityTaskTreeNode() { id = item.id, scope = item.scope, trees = trees, abilityId = item.abilityId, auth = item.auth, codeval = ability.school };
+                    AbilityTaskTreeNode abilityTaskTreeNode = new() { id = item.id, scope = item.scope, trees = trees, abilityId = item.abilityId, auth = item.auth, codeval = ability.school };
                     abilityTaskTreeNodes.Add(abilityTaskTreeNode);
                 }
 
@@ -139,7 +139,7 @@ namespace TEAMModelBI.Controllers.BINormal
                     blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
                 }
 
-                StringBuilder msgBuilder = new StringBuilder($"{_tmdName}【{_tmdId}】");
+                StringBuilder msgBuilder = new($"{_tmdName}【{_tmdId}】");
                 string type = null;
                 long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                 foreach (var abilityTaskTree in recordAbilityTask.abilityTask)
@@ -161,9 +161,9 @@ namespace TEAMModelBI.Controllers.BINormal
                             {
                                 abilityTaskTree.trees.ForEach(x => x.id = abilityTaskTree.id);
                             }
-                            List<Tnode> nodes = new List<Tnode>();
+                            List<Tnode> nodes = new();
                             AbilityService.TreeToList(abilityTaskTree.trees, nodes, now);
-                            abilityTask = new AbilityTask();
+                            abilityTask = new();
                             abilityTask.id = abilityTaskTree.id;
                             abilityTask.children = nodes;
                             abilityTask.code = $"AbilityTask-{recordAbilityTask.standard}";
@@ -183,7 +183,7 @@ namespace TEAMModelBI.Controllers.BINormal
                             {
                                 abilityTaskTree.trees.ForEach(x => x.id = abilityTaskTree.id);
                             }
-                            List<Tnode> nodes = new List<Tnode>();
+                            List<Tnode> nodes = new();
                             AbilityService.TreeToList(abilityTaskTree.trees, nodes, now);
                             abilityTask.children = nodes;
                             abilityTaskTree.auth = abilityTask.auth;
@@ -200,9 +200,9 @@ namespace TEAMModelBI.Controllers.BINormal
                         {
                             abilityTaskTree.trees.ForEach(x => x.id = abilityTaskTree.id);
                         }
-                        List<Tnode> nodes = new List<Tnode>();
+                        List<Tnode> nodes = new();
                         AbilityService.TreeToList(abilityTaskTree.trees, nodes, now);
-                        AbilityTask abilityTask = new AbilityTask
+                        AbilityTask abilityTask = new()
                         {
                             id = id,
                             code = $"AbilityTask-{recordAbilityTask.standard}",

+ 3 - 5
TEAMModelBI/Controllers/BINormal/BatchAreaController.cs

@@ -153,7 +153,6 @@ namespace TEAMModelBI.Controllers.BINormal
                     };
                 }
 
-
                 return Ok(new { state = 200, areas, continuationToken });
             }
             catch (Exception ex)
@@ -744,7 +743,6 @@ namespace TEAMModelBI.Controllers.BINormal
                         //abilityTasks.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{_oldStandard}")));
                         await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{_oldStandard}"));
                     }
-
                 }
                 catch
                 {
@@ -813,7 +811,7 @@ namespace TEAMModelBI.Controllers.BINormal
                 string partitionCode = "DelBeforeCopyAbility-mark";
 
                 //执行复制操作
-                BatchCopyFile batchCopyFile = new BatchCopyFile();
+                BatchCopyFile batchCopyFile = new();
                 batchCopyFile.blobCntr = "teammodelos";
                 batchCopyFile.oldFileName = $"{_newStandard}";
                 batchCopyFile.newFileName = $"{_oldStandard}";
@@ -834,7 +832,7 @@ namespace TEAMModelBI.Controllers.BINormal
                 }
 
                 //发送消息实体
-                Notification notification = new Notification
+                Notification notification = new()
                 {
                     hubName = "hita",
                     type = "msg",
@@ -963,7 +961,7 @@ namespace TEAMModelBI.Controllers.BINormal
 
                     List<object> fileobj = new();
                     //先删除原有的文件
-                    List<Task<Response<bool>>> DelList = new List<Task<Response<bool>>>();
+                    List<Task<Response<bool>>> DelList = new();
                     await foreach (BlobItem blobItem in blobClient.GetBlobsAsync(BlobTraits.None, BlobStates.None, $"yxpt/{area.standard}/"))
                     {
                         fileobj.Add(blobItem.Name);

+ 10 - 10
TEAMModelBI/Controllers/BISchool/BatchSchoolController.cs

@@ -67,7 +67,7 @@ namespace TEAMModelBI.Controllers.BISchool
         public async Task<IActionResult> GetAuthorityBIList(JsonElement jsonElement)
         {
             jsonElement.TryGetProperty("site", out JsonElement site);
-            Dictionary<string, object> dic = new Dictionary<string, object> { { "PartitionKey", "authority-bi" } };
+            Dictionary<string, object> dic = new() { { "PartitionKey", "authority-bi" } };
             var table = _azureStorage.GetCloudTableClient().GetTableReference("SchoolSetting");
             if ($"{site}".Equals(BIConst.Global))
                 table = _azureStorage.GetCloudTableClient(BIConst.Global).GetTableReference("SchoolSetting");
@@ -460,7 +460,7 @@ namespace TEAMModelBI.Controllers.BISchool
                 jsonElement.TryGetProperty("site", out JsonElement site);
                 string schoolId = (jsonElement.TryGetProperty("schoolId", out JsonElement _schoolId)) ? _schoolId.GetString() : string.Empty;
 
-                Dictionary<string, List<Dictionary<string, string>>> haveSchoolManger = new Dictionary<string, List<Dictionary<string, string>>>();
+                Dictionary<string, List<Dictionary<string, string>>> haveSchoolManger = new();
 
                 string managerWhereOption = (!string.IsNullOrWhiteSpace(schoolId)) ? $" AND c.code = 'Teacher-{schoolId}'" : string.Empty;
                 //查询学校的顾问
@@ -476,7 +476,7 @@ namespace TEAMModelBI.Controllers.BISchool
                         string id = obj.GetProperty("id").GetString(); //管理员ID
                         string name = obj.GetProperty("name").GetString(); //管理员姓名
                         string tempSchoolId = obj.GetProperty("schoolId").GetString(); //学校ID
-                        Dictionary<string, string> managerDic = new Dictionary<string, string>();
+                        Dictionary<string, string> managerDic = new();
                         managerDic.Add("id", id);
                         managerDic.Add("name", name);
                         if (haveSchoolManger.ContainsKey(tempSchoolId))
@@ -574,7 +574,7 @@ namespace TEAMModelBI.Controllers.BISchool
 
                 List<string> assistId = _assistId.ToObject<List<string>>();
                 //List<string> periodS = period.ToObject<List<string>>();
-                Dictionary<string, List<Dictionary<string, string>>> haveSchoolManger = new Dictionary<string, List<Dictionary<string, string>>>();
+                Dictionary<string, List<Dictionary<string, string>>> haveSchoolManger = new();
                 var cosmosClient = _azureCosmos.GetCosmosClient();
                 var tableClient = _azureStorage.GetCloudTableClient();
                 var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
@@ -589,7 +589,7 @@ namespace TEAMModelBI.Controllers.BISchool
                 School tempShool = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>($"{_schoolId}", new PartitionKey("Base"));
                 if (tempShool != null)
                 {
-                    List<Period> periods = new List<Period>();
+                    List<Period> periods = new();
                     string campusId = Guid.NewGuid().ToString();
                     //periodS.ForEach(x =>
                     //{
@@ -610,7 +610,7 @@ namespace TEAMModelBI.Controllers.BISchool
 
                     //修改学校教师关联的信息
                     string sql = $"SELECT distinct value(c) FROM c join A1 in c.schools where A1.schoolId='{tempShool.id}'";
-                    List<Teacher> teachers = new List<Teacher>();
+                    List<Teacher> teachers = new();
                     await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<Teacher>(sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
                     {
                         teachers.Add(item);
@@ -631,7 +631,7 @@ namespace TEAMModelBI.Controllers.BISchool
                     {
                         //修改学校顾问
                         string sqlTxt = $"SELECT value(c) From c WHERE ARRAY_CONTAINS(c.roles,'assist',true)";
-                        List<SchoolTeacher> schoolTeachers = new List<SchoolTeacher>();
+                        List<SchoolTeacher> schoolTeachers = new();
                         await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<SchoolTeacher>(queryText: sqlTxt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{tempShool.id}") }))
                         {
                             if (!assistId.Contains(item.id))
@@ -680,7 +680,7 @@ namespace TEAMModelBI.Controllers.BISchool
                                     }
                                     else
                                     {
-                                        SchoolTeacher addSchoolTeacher = new SchoolTeacher
+                                        SchoolTeacher addSchoolTeacher = new()
                                         {
                                             id = itemTeacher,
                                             code = $"Teacher-{tempShool.id}",
@@ -698,7 +698,7 @@ namespace TEAMModelBI.Controllers.BISchool
                                 }
                                 else
                                 {
-                                    Teacher.TeacherSchool teacherSchool = new Teacher.TeacherSchool
+                                    Teacher.TeacherSchool teacherSchool = new()
                                     {
                                         schoolId = tempShool.id,
                                         name = tempShool.name,
@@ -712,7 +712,7 @@ namespace TEAMModelBI.Controllers.BISchool
                                     await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(tempTeacher, tempTeacher.id, new PartitionKey($"Base"));
 
                                     //不存在则在原来的基础上添加顾问角色
-                                    SchoolTeacher addSchoolTeacher = new SchoolTeacher
+                                    SchoolTeacher addSchoolTeacher = new()
                                     {
                                         id = itemTeacher,
                                         code = $"Teacher-{tempShool.id}",

+ 2 - 5
TEAMModelBI/Controllers/BISchool/RoomController.cs

@@ -57,7 +57,7 @@ namespace TEAMModelBI.Controllers.BISchool
                 jsonElement.TryGetProperty("site", out JsonElement site);
                 var s = string.IsNullOrEmpty($"{serial}") ? null : $"{serial}";
 
-                Room room = new Room();
+                Room room = new();
                 var cosmosClient = _azureCosmos.GetCosmosClient();
                 var tableClient = _azureStorage.GetCloudTableClient();
                 var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
@@ -77,17 +77,14 @@ namespace TEAMModelBI.Controllers.BISchool
 
                     room = await cosmosClient.GetContainer("TEAMModelOS", "School").ReplaceItemAsync(roomInfo, $"{roomId}", new PartitionKey($"{roomCode}"));
 
-                    StringBuilder stringBudeler = new StringBuilder($"{_tmdName}【{_tmdId}】将{roomInfo.id}教师和{serial}产品");
+                    StringBuilder stringBudeler = new($"{_tmdName}【{_tmdId}】将{roomInfo.id}教师和{serial}产品");
                     if (!string.IsNullOrEmpty($"{serial}")) { stringBudeler.Append($"绑定。"); } else { stringBudeler.Append($"解绑。"); }
 
                     //保存操作记录
                     await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "room-update", $"{_tmdName}【{_tmdId}】将{roomInfo.id}教师和{serial}产品绑定", _dingDing, httpContext: HttpContext);
                 }
                 else
-                {
                     return Ok(new { state = 401, msg = "未找到教室" });
-                }
-
                 return Ok(new { state = 200, room });
             }
             catch (Exception ex)

+ 14 - 14
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -121,7 +121,7 @@ namespace TEAMModelBI.Controllers.BISchool
                     {
                         foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
                         {
-                            NotAreaSchool notAreaSchool = new NotAreaSchool()
+                            NotAreaSchool notAreaSchool = new()
                             {
                                 id = obj.GetProperty("id").GetString(),
                                 name = obj.GetProperty("name").GetString(),
@@ -150,7 +150,7 @@ namespace TEAMModelBI.Controllers.BISchool
                     }
                 }
 
-                List<NotAreaSchool> notAreaSchools = new List<NotAreaSchool>();
+                List<NotAreaSchool> notAreaSchools = new();
                 tempNotAreaSchools.ForEach(nas =>
                 {
                     if (nas.areas == null)
@@ -367,7 +367,7 @@ namespace TEAMModelBI.Controllers.BISchool
                 if (response.Status == 200)
                 {
                     string sql = $"SELECT distinct value(c) FROM c join A1 in c.schools where A1.schoolId='{school.id}'";
-                    List<Teacher> teachers = new List<Teacher>();
+                    List<Teacher> teachers = new();
                     await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<Teacher>(sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
                     {
                         teachers.Add(item);
@@ -1085,11 +1085,11 @@ namespace TEAMModelBI.Controllers.BISchool
             int lessLastYearCnt = 0; //去年的课例
             int lessYearCnt = 0; //今年的课例
 
-            int allInterCnt = 0;   //所有互动
-            int lastDayInterCnt = 0;   // 昨天课例互动
-            int interCnt = 0;   // 今天课例互动
-            int lastYearInterCnt = 0;   // 去年课例互动
-            int yearInterCnt = 0;   // 今年课例互动
+            double allInterCnt = 0;   //所有互动
+            double lastDayInterCnt = 0;   // 昨天课例互动
+            double interCnt = 0;   // 今天课例互动
+            double lastYearInterCnt = 0;   // 去年课例互动
+            double yearInterCnt = 0;   // 今年课例互动
 
             int allActCnt = 0;    //所有活动
             int lastActCnt = 0;    //昨天活动
@@ -1104,7 +1104,7 @@ namespace TEAMModelBI.Controllers.BISchool
             lessAllCant = await CommonFind.GetSqlValueCount(cosmosClient, "School", commSql, $"LessonRecord-{schoolId}");
 
             string lessCode = $"LessonRecord-{schoolId}";
-            string lessLastdaySql = $"{commSql} where c.startTime >= {lastDays} and c.startTime <= {lastDays} ";
+            string lessLastdaySql = $"{commSql} where c.startTime >= {lastDays} and c.startTime <= {lastDaye} ";
             lessLastdayCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", lessLastdaySql, lessCode);
 
             string lessDaySql = $"{commSql} where c.startTime >= {days} and c.startTime <= {daye} ";
@@ -1118,19 +1118,19 @@ namespace TEAMModelBI.Controllers.BISchool
 
             //课例互动
             string strInterSql = $"select value(sum(c.clientInteractionAverge)) from c";
-            allInterCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", strInterSql, lessCode);
+            allInterCnt = await CommonFind.GetSqlValueDoubleCounnt(cosmosClient, "School", strInterSql, lessCode);
 
             string lastdayInterSql = $"{strInterSql} where c.startTime >= { lastDays} and c.startTime <= {lastDays} ";
-            lastDayInterCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", lastdayInterSql, lessCode);
+            lastDayInterCnt = await CommonFind.GetSqlValueDoubleCounnt(cosmosClient, "School", lastdayInterSql, lessCode);
 
             string dayInterSql = $"{strInterSql} where c.startTime >= { days} and c.startTime <= {daye} ";
-            interCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", dayInterSql, lessCode);
+            interCnt = await CommonFind.GetSqlValueDoubleCounnt(cosmosClient, "School", dayInterSql, lessCode);
 
             string lastYarInterSql = $"{strInterSql} where c.startTime >= { lastYears} and c.startTime <= {lastYeare} ";
-            lastYearInterCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", lastYarInterSql, lessCode);
+            lastYearInterCnt = await CommonFind.GetSqlValueDoubleCounnt(cosmosClient, "School", lastYarInterSql, lessCode);
 
             string yearInterSql = $"{strInterSql} where c.startTime >= { years} and c.startTime <= {yeare} ";
-            yearInterCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", yearInterSql, lessCode);
+            yearInterCnt = await CommonFind.GetSqlValueDoubleCounnt(cosmosClient, "School", yearInterSql, lessCode);
 
             //活动
             allActCnt = await ActivityWay.GetCnt(cosmosClient, condSql: $"and c.school='{schoolId}'");

+ 4 - 4
TEAMModelBI/Controllers/BIStudent/StudentController.cs

@@ -46,7 +46,7 @@ namespace TEAMModelBI.Controllers.BIStudent
             var cosmosClient = _azureCosmos.GetCosmosClient();
             if ($"{site}".Equals(BIConst.Global))
                 cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
-            List<object> objs = new List<object>();
+            List<object> objs = new();
             await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: $"select value(c) from c where c.id='{studentId}'", requestOptions: string.IsNullOrEmpty($"{code}") ? new QueryRequestOptions() { } : new QueryRequestOptions() { PartitionKey = new PartitionKey($"{code}") }))
             {
                 using var json = await JsonDocument.ParseAsync(item.ContentStream);
@@ -81,7 +81,7 @@ namespace TEAMModelBI.Controllers.BIStudent
 
                 //string sqlTxt = "SELECT select c.id,c.code,c.classIds FROM c  where c.pk='Activity' and c.classIds <> []";
                 string sqlTxt = "select c.id,c.code,c.classIds from c where c.school='cswznb' and c.classIds <> []";
-                List<CorrectStu> correctStus = new List<CorrectStu>();
+                List<CorrectStu> correctStus = new();
                 await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: sqlTxt, requestOptions: new QueryRequestOptions() { }))
                 {
                     using var json = await JsonDocument.ParseAsync(item.ContentStream);
@@ -94,10 +94,10 @@ namespace TEAMModelBI.Controllers.BIStudent
 
                         //List<string> newList = templist.Distinct().ToList(); //Equals实现去重  
                         //List<string> newLis1 = templist.Where((x, i) => templist.FindIndex(z => z == x) == i).ToList(); //Lambda表达式去重 
-                        HashSet<string> hashSet = new HashSet<string>(templist);//哈希自动去重
+                        HashSet<string> hashSet = new(templist);//哈希自动去重
                         if (hashSet.Count != templist.Count)
                         {
-                            CorrectStu correctList = new CorrectStu() { id = $"{tempTd}", code = $"{code}", classIds = hashSet.ToList() };
+                            CorrectStu correctList = new() { id = $"{tempTd}", code = $"{code}", classIds = hashSet.ToList() };
                             correctStus.Add(correctList);
                         }
                     }

+ 0 - 1
TEAMModelBI/Controllers/BITable/BIOpenApiController.cs

@@ -146,7 +146,6 @@ namespace TEAMModelBI.Controllers.BITable
             }
         }
 
-
         public record ReadApi
         {
             public string id { get; set; }

+ 27 - 27
TEAMModelBI/Controllers/BITable/DDStructController.cs

@@ -64,8 +64,8 @@ namespace TEAMModelBI.Controllers.BITable
                 string appSecret = _configuration["DingDingAuth:appSecret"];
 
                 //获取access_token
-                DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
-                OapiGettokenRequest request = new OapiGettokenRequest();
+                DefaultDingTalkClient client = new("https://oapi.dingtalk.com/gettoken");
+                OapiGettokenRequest request = new();
                 request.Appkey = appKey;
                 request.Appsecret = appSecret;
                 request.SetHttpMethod("Get");
@@ -95,7 +95,7 @@ namespace TEAMModelBI.Controllers.BITable
 
                         //获取一级部门用户列表
                         IDingTalkClient userListClient1 = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/user/listid");
-                        OapiUserListidRequest reqUserList1 = new OapiUserListidRequest() { DeptId = deptList.DeptId };
+                        OapiUserListidRequest reqUserList1 = new() { DeptId = deptList.DeptId };
                         OapiUserListidResponse rspUserList1 = userListClient1.Execute(reqUserList1, access_token);
                         if (rspUserList1.Result != null)
                         {
@@ -104,26 +104,26 @@ namespace TEAMModelBI.Controllers.BITable
 
                         //获取用户详细信息
                         IDingTalkClient v2UserListClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get");
-                        OapiV2UserGetRequest reqv2UserList = new OapiV2UserGetRequest();
+                        OapiV2UserGetRequest reqv2UserList = new();
                         OapiV2UserGetResponse rspv2UserList = v2UserListClient.Execute(reqv2UserList, access_token);
 
                         //获取二级部门列表
-                        OapiV2DepartmentListsubRequest reqlistsub = new OapiV2DepartmentListsubRequest() { DeptId = deptList.DeptId, Language = "zh_CN" };
+                        OapiV2DepartmentListsubRequest reqlistsub = new() { DeptId = deptList.DeptId, Language = "zh_CN" };
                         OapiV2DepartmentListsubResponse rsplistsub = v2ListsubClient1.Execute(reqlistsub, access_token);
 
-                        List<DeptBaseResponseDomain> deptBaseResponseDomainList = new List<DeptBaseResponseDomain>();
+                        List<DeptBaseResponseDomain> deptBaseResponseDomainList = new();
                         if (rsplistsub.Result != null)
                         {
                             foreach (var deptlist2 in rsplistsub.Result)
                             {
                                 //添加二级部门
-                                DeptBaseResponseDomain deptBaseResponseDomain2 = new DeptBaseResponseDomain();
+                                DeptBaseResponseDomain deptBaseResponseDomain2 = new();
                                 deptBaseResponseDomain2.deptId = deptlist2.DeptId;
                                 deptBaseResponseDomain2.Name = deptlist2.Name;
                                 deptBaseResponseDomain2.ParentId = deptlist2.ParentId;
 
                                 //获取三级部门用户列表
-                                OapiUserListidRequest reqUserList2 = new OapiUserListidRequest() { DeptId = deptlist2.DeptId };
+                                OapiUserListidRequest reqUserList2 = new() { DeptId = deptlist2.DeptId };
                                 OapiUserListidResponse rspUserList2 = userListClient1.Execute(reqUserList2, access_token);
                                 if (rspUserList2.Result != null)
                                 {
@@ -131,23 +131,23 @@ namespace TEAMModelBI.Controllers.BITable
                                     deptBaseResponseDomain2.ddUserList = rspUserList2.Result.UseridList;
                                 }
                                 //获取三级部门列表
-                                OapiV2DepartmentListsubRequest reqlistsub3 = new OapiV2DepartmentListsubRequest() { DeptId = deptlist2.DeptId, Language = "zh_CN" };
+                                OapiV2DepartmentListsubRequest reqlistsub3 = new() { DeptId = deptlist2.DeptId, Language = "zh_CN" };
                                 OapiV2DepartmentListsubResponse rsplistsub3 = v2ListsubClient1.Execute(reqlistsub3, access_token);
 
-                                List<DeptBaseResponseDomain> deptBaseResponseDomain3List = new List<DeptBaseResponseDomain>();
+                                List<DeptBaseResponseDomain> deptBaseResponseDomain3List = new();
 
                                 if (rsplistsub3.Result != null)
                                 {
                                     foreach (var dept3List in rsplistsub3.Result)
                                     {
                                         //添加三级部门
-                                        DeptBaseResponseDomain deptBaseResponseDomain3 = new DeptBaseResponseDomain();
+                                        DeptBaseResponseDomain deptBaseResponseDomain3 = new();
                                         deptBaseResponseDomain3.deptId = dept3List.DeptId;
                                         deptBaseResponseDomain3.Name = dept3List.Name;
                                         deptBaseResponseDomain3.ParentId = dept3List.ParentId;
 
                                         //获取部门用户列表
-                                        OapiUserListidRequest reqUserList3 = new OapiUserListidRequest() { DeptId = dept3List.DeptId };
+                                        OapiUserListidRequest reqUserList3 = new() { DeptId = dept3List.DeptId };
                                         OapiUserListidResponse rspUserList3 = userListClient1.Execute(reqUserList3, access_token);
                                         if (rspUserList3.Result != null)
                                         {
@@ -156,23 +156,23 @@ namespace TEAMModelBI.Controllers.BITable
                                         }
 
                                         //获取部门列表  四级目录
-                                        OapiV2DepartmentListsubRequest reqlistsub4 = new OapiV2DepartmentListsubRequest() { DeptId = dept3List.DeptId, Language = "zh_CN" };
+                                        OapiV2DepartmentListsubRequest reqlistsub4 = new() { DeptId = dept3List.DeptId, Language = "zh_CN" };
                                         OapiV2DepartmentListsubResponse rsplistsu4 = v2ListsubClient1.Execute(reqlistsub4, access_token);
 
-                                        List<DeptBaseResponseDomain> deptBaseResponseDomain4List = new List<DeptBaseResponseDomain>();
+                                        List<DeptBaseResponseDomain> deptBaseResponseDomain4List = new();
                                         if (rsplistsu4.Result != null)
                                         {
 
                                             foreach (var dept4List in rsplistsu4.Result)
                                             {
-                                                DeptBaseResponseDomain deptBaseResponseDomain4 = new DeptBaseResponseDomain();
+                                                DeptBaseResponseDomain deptBaseResponseDomain4 = new();
                                                 deptBaseResponseDomain4.deptId = dept4List.DeptId;
                                                 deptBaseResponseDomain4.Name = dept4List.Name;
                                                 deptBaseResponseDomain4.ParentId = dept4List.ParentId;
                                                 deptBaseResponseDomain4List.Add(deptBaseResponseDomain4);
 
                                                 //获取四级部门用户列表
-                                                OapiUserListidRequest reqUserList4 = new OapiUserListidRequest() { DeptId = dept4List.DeptId };
+                                                OapiUserListidRequest reqUserList4 = new() { DeptId = dept4List.DeptId };
                                                 OapiUserListidResponse rspUserList4 = userListClient1.Execute(reqUserList4, access_token);
                                                 if (rspUserList4.Result != null)
                                                 {
@@ -340,7 +340,7 @@ namespace TEAMModelBI.Controllers.BITable
                     {
                         foreach (var tempDept in rspDeptLis2.Result)
                         {
-                            OapiV2UserListRequest reqUserList2 = new OapiV2UserListRequest();
+                            OapiV2UserListRequest reqUserList2 = new();
                             reqUserList2.DeptId = long.Parse($"{tempDept.DeptId}");
                             reqUserList2.Cursor = 0L;
                             reqUserList2.Size = 50L;
@@ -356,7 +356,7 @@ namespace TEAMModelBI.Controllers.BITable
                                     var tempInfo = dDAndTmdInfos.Find(x => x.unionid.Equals(itemUser2.Unionid));
                                     if (string.IsNullOrEmpty($"{tempInfo}"))
                                     {
-                                        DDUserInfoAndTMD dDAndTmdInfo2 = new DDUserInfoAndTMD();
+                                        DDUserInfoAndTMD dDAndTmdInfo2 = new();
                                         dDAndTmdInfo2.unionid = itemUser2.Unionid;
                                         dDAndTmdInfo2.userid = itemUser2.Userid;
                                         dDAndTmdInfo2.title = itemUser2.Title;
@@ -451,8 +451,8 @@ namespace TEAMModelBI.Controllers.BITable
 
 
                 //获取access_token
-                DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
-                OapiGettokenRequest request = new OapiGettokenRequest();
+                DefaultDingTalkClient client = new("https://oapi.dingtalk.com/gettoken");
+                OapiGettokenRequest request = new();
                 request.Appkey = appKey;
                 request.Appsecret = appSecret;
                 request.SetHttpMethod("Get");
@@ -466,7 +466,7 @@ namespace TEAMModelBI.Controllers.BITable
                 string access_token = response.AccessToken;
                 IDingTalkClient userInfoClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get");
 
-                Dictionary<string, object> dic = new Dictionary<string, object> { { "PartitionKey", "authority-bi" } };
+                Dictionary<string, object> dic = new() { { "PartitionKey", "authority-bi" } };
                 var table = _azureStorage.GetCloudTableClient().GetTableReference("SchoolSetting");
                 var cosmosClient = _azureCosmos.GetCosmosClient();
                 if ($"{site}".Equals(BIConst.Global)) 
@@ -484,14 +484,14 @@ namespace TEAMModelBI.Controllers.BITable
                     List<string> str_userids = str_userids1.Where((x, i) => str_userids1.FindIndex(z => z == x) == i).ToList();//Lambda表达式去重 
                     foreach (var tempid in str_userids)
                     {
-                        OapiV2UserGetRequest reqUserInfo = new OapiV2UserGetRequest() { Userid = $"{tempid}", Language = "zh_CN" };                        
+                        OapiV2UserGetRequest reqUserInfo = new() { Userid = $"{tempid}", Language = "zh_CN" };                        
                         OapiV2UserGetResponse rspUserInfo = userInfoClient.Execute(reqUserInfo, access_token);
                         if (rspUserInfo.Result != null)
                         {
-                            List<string> roles = new List<string>();//角色列表
-                            List<string> power = new List<string>();//权限列表
+                            List<string> roles = new();//角色列表
+                            List<string> power = new();//权限列表
 
-                            DDUserInfoAndTMD dDUserInfoAndTMD = new DDUserInfoAndTMD();
+                            DDUserInfoAndTMD dDUserInfoAndTMD = new();
                             dDUserInfoAndTMD.unionid = rspUserInfo.Result.Unionid;
                             dDUserInfoAndTMD.title = rspUserInfo.Result.Title;
                             dDUserInfoAndTMD.userid = rspUserInfo.Result.Userid;
@@ -577,7 +577,7 @@ namespace TEAMModelBI.Controllers.BITable
 
             //获取企业内部应用的accessToken
             IDingTalkClient Iclient = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
-            OapiGettokenRequest request = new OapiGettokenRequest();
+            OapiGettokenRequest request = new();
             request.Appkey = str_appKey;
             request.Appsecret = str_appSecret;
             request.SetHttpMethod("GET");
@@ -587,7 +587,7 @@ namespace TEAMModelBI.Controllers.BITable
                 return Ok(new { state = 0, message = "请检查配置" });
             }
             IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/org/union/branch/get");
-            OapiOrgUnionBranchGetRequest req = new OapiOrgUnionBranchGetRequest();
+            OapiOrgUnionBranchGetRequest req = new();
             OapiOrgUnionBranchGetResponse rsp = client.Execute(req, tokenResponse.AccessToken);
 
             return Ok(new { Result = rsp.Result, Body = rsp.Body, RequestId = rsp.RequestId, SubErrCode = rsp.SubErrCode, Success = rsp.Success });

+ 2 - 2
TEAMModelBI/Controllers/BITable/OperateLogController.cs

@@ -111,8 +111,8 @@ namespace TEAMModelBI.Controllers.BITable
 
                 var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
                 //var temp = await _azureStorage.Delete<OperateLog>(partitionKey: "OperateLog-BI", rowKey: $"{startDate}");  //删除单个
-                StringBuilder operateStr = new StringBuilder($"{_tmdName}【{_tmdId}】账户删除操作记录,");
-                StringBuilder tableStrWhere = new StringBuilder();
+                StringBuilder operateStr = new($"{_tmdName}【{_tmdId}】账户删除操作记录,");
+                StringBuilder tableStrWhere = new();
                 if (!string.IsNullOrEmpty($"{rowKey}"))
                 {
                     tableStrWhere.Append($"RowKey {QueryComparisons.Equal} '{rowKey}'");

+ 21 - 21
TEAMModelBI/Controllers/BITable/TableDingDingInfoController.cs

@@ -91,7 +91,7 @@ namespace TEAMModelBI.Controllers.BITable
 
                 //获取access_token
                 IDingTalkClient tokenClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
-                OapiGettokenRequest tokenRequest = new OapiGettokenRequest() { Appkey = appKey, Appsecret = appSecret };
+                OapiGettokenRequest tokenRequest = new() { Appkey = appKey, Appsecret = appSecret };
                 tokenRequest.SetHttpMethod("Get");
                 OapiGettokenResponse tokenRespone = tokenClient.Execute(tokenRequest);
                 if (tokenRespone.IsError)
@@ -104,7 +104,7 @@ namespace TEAMModelBI.Controllers.BITable
                 //获取部门接口
                 IDingTalkClient deptListClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listsub");
                 //一级部门
-                OapiV2DepartmentListsubRequest reqDeptList1 = new OapiV2DepartmentListsubRequest() { DeptId = 1L, Language = "zh_CN" };
+                OapiV2DepartmentListsubRequest reqDeptList1 = new() { DeptId = 1L, Language = "zh_CN" };
                 OapiV2DepartmentListsubResponse rspDeptList1 = deptListClient.Execute(reqDeptList1, access_token);
 
                 List<DingDingUserInfo> ddUserInfos = new();
@@ -119,7 +119,7 @@ namespace TEAMModelBI.Controllers.BITable
                         if (dingDingUserInfos1.Count > 0) ddUserInfos.AddRange(dingDingUserInfos1);
 
                         //获取二级部门
-                        OapiV2DepartmentListsubRequest reqDeptList2 = new OapiV2DepartmentListsubRequest() { DeptId = tempDept1.DeptId, Language = "zh_CN" };
+                        OapiV2DepartmentListsubRequest reqDeptList2 = new() { DeptId = tempDept1.DeptId, Language = "zh_CN" };
                         OapiV2DepartmentListsubResponse rspDeptList2 = deptListClient.Execute(reqDeptList2, access_token);
                         if (rspDeptList2.Result != null)
                         {
@@ -131,7 +131,7 @@ namespace TEAMModelBI.Controllers.BITable
                                 if (dingDingUserInfos2.Count > 0) ddUserInfos.AddRange(dingDingUserInfos2);
 
                                 //获取三级部门
-                                OapiV2DepartmentListsubRequest reqDeptList3 = new OapiV2DepartmentListsubRequest() { DeptId = tempDept2.DeptId, Language = "zh_CN" };
+                                OapiV2DepartmentListsubRequest reqDeptList3 = new() { DeptId = tempDept2.DeptId, Language = "zh_CN" };
                                 OapiV2DepartmentListsubResponse rspDeptList3 = deptListClient.Execute(reqDeptList3, access_token);
                                 if (rspDeptList3.Result != null)
                                 {
@@ -143,7 +143,7 @@ namespace TEAMModelBI.Controllers.BITable
                                         if (dingDingUserInfos3.Count > 0) ddUserInfos.AddRange(dingDingUserInfos3);
 
                                         //获取四级部门
-                                        OapiV2DepartmentListsubRequest reqDeptList4 = new OapiV2DepartmentListsubRequest() { DeptId = tempDept3.DeptId, Language = "zh_CN" };
+                                        OapiV2DepartmentListsubRequest reqDeptList4 = new() { DeptId = tempDept3.DeptId, Language = "zh_CN" };
                                         OapiV2DepartmentListsubResponse rspDeptList4 = deptListClient.Execute(reqDeptList4, access_token);
                                         if (rspDeptList4.Result != null)
                                         {
@@ -155,7 +155,7 @@ namespace TEAMModelBI.Controllers.BITable
                                                 if (dingDingUserInfos4.Count > 0) ddUserInfos.AddRange(dingDingUserInfos4);
 
                                                 //获取五级部门
-                                                OapiV2DepartmentListsubRequest reqDeptList5 = new OapiV2DepartmentListsubRequest() { DeptId = tempDept4.DeptId, Language = "zh_CN" };
+                                                OapiV2DepartmentListsubRequest reqDeptList5 = new() { DeptId = tempDept4.DeptId, Language = "zh_CN" };
                                                 OapiV2DepartmentListsubResponse rspDeptList5 = deptListClient.Execute(reqDeptList5, access_token);
                                                 if (rspDeptList5.Result != null)
                                                 {
@@ -437,7 +437,7 @@ namespace TEAMModelBI.Controllers.BITable
                 var table = tableClient.GetTableReference("BIDDUserInfo");
                 //string divide = _configuration["CustomParam:SiteScope"];
                 string divide = _option.Location;
-                Dictionary<string, object> dic = new Dictionary<string, object> { { "PartitionKey", $"{divide}" } };
+                Dictionary<string, object> dic = new() { { "PartitionKey", $"{divide}" } };
 
                 List<DingDingUserInfo> tempUserInfos = await table.FindListByDict<DingDingUserInfo>(dic);
 
@@ -491,7 +491,7 @@ namespace TEAMModelBI.Controllers.BITable
 
                     if (!string.IsNullOrEmpty(item.schoolIds))
                     {
-                        List<string> tempSchoolIds = new List<string>(item.schoolIds.Split("|"));
+                        List<string> tempSchoolIds = new(item.schoolIds.Split("|"));
                         tempUserInfo.handleSchools = await SchoolWay.GetSchoolInfos(cosmosCliet, tempSchoolIds);
                     }
                     ddUserInfos.Add(tempUserInfo);
@@ -546,7 +546,7 @@ namespace TEAMModelBI.Controllers.BITable
                 //string divide = _configuration["CustomParam:SiteScope"];
                 string divide = _option.Location;
 
-                Dictionary<string, object> dic = new Dictionary<string, object> { { "PartitionKey", $"{divide}" }, { "mobile", $"{mobile}" } };
+                Dictionary<string, object> dic = new() { { "PartitionKey", $"{divide}" }, { "mobile", $"{mobile}" } };
                 List<DingDingUserInfo> ddUserInfoList = await table.FindListByDict<DingDingUserInfo>(dic);
 
                 if (ddUserInfoList.Count > 0)
@@ -617,7 +617,7 @@ namespace TEAMModelBI.Controllers.BITable
 
                         if (!string.IsNullOrEmpty(respUser.schoolIds))
                         {
-                            List<string> tempSchoolIds = new List<string>(respUser.schoolIds.Split("|"));
+                            List<string> tempSchoolIds = new(respUser.schoolIds.Split("|"));
                             dDUserInfo.handleSchools = await SchoolWay.GetSchoolInfos(cosmosCliet, tempSchoolIds);
                         }
                         ddUserInfos.Add(dDUserInfo);
@@ -802,7 +802,7 @@ namespace TEAMModelBI.Controllers.BITable
 
                 //获取access_token
                 IDingTalkClient tokenClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
-                OapiGettokenRequest tokenRequest = new OapiGettokenRequest() { Appkey = appKey, Appsecret = appSecret };
+                OapiGettokenRequest tokenRequest = new() { Appkey = appKey, Appsecret = appSecret };
                 tokenRequest.SetHttpMethod("Get");
                 OapiGettokenResponse tokenRespone = tokenClient.Execute(tokenRequest);
                 if (tokenRespone.IsError)
@@ -815,7 +815,7 @@ namespace TEAMModelBI.Controllers.BITable
                 //获取部门接口
                 IDingTalkClient deptListClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listsub");
                 //一级部门
-                OapiV2DepartmentListsubRequest reqDeptList1 = new OapiV2DepartmentListsubRequest() { DeptId = 1L, Language = "zh_CN" };
+                OapiV2DepartmentListsubRequest reqDeptList1 = new() { DeptId = 1L, Language = "zh_CN" };
                 OapiV2DepartmentListsubResponse rspDeptList1 = deptListClient.Execute(reqDeptList1, access_token);
 
                 List<DingDingUserInfo> ddUserInfos = new();
@@ -830,7 +830,7 @@ namespace TEAMModelBI.Controllers.BITable
                         if (dingDingUserInfos1.Count > 0) ddUserInfos.AddRange(dingDingUserInfos1);
 
                         //获取二级部门
-                        OapiV2DepartmentListsubRequest reqDeptList2 = new OapiV2DepartmentListsubRequest() { DeptId = tempDept1.DeptId, Language = "zh_CN" };
+                        OapiV2DepartmentListsubRequest reqDeptList2 = new() { DeptId = tempDept1.DeptId, Language = "zh_CN" };
                         OapiV2DepartmentListsubResponse rspDeptList2 = deptListClient.Execute(reqDeptList2, access_token);
                         if (rspDeptList2.Result != null)
                         {
@@ -842,7 +842,7 @@ namespace TEAMModelBI.Controllers.BITable
                                 if (dingDingUserInfos2.Count > 0) ddUserInfos.AddRange(dingDingUserInfos2);
 
                                 //获取三级部门
-                                OapiV2DepartmentListsubRequest reqDeptList3 = new OapiV2DepartmentListsubRequest() { DeptId = tempDept2.DeptId, Language = "zh_CN" };
+                                OapiV2DepartmentListsubRequest reqDeptList3 = new() { DeptId = tempDept2.DeptId, Language = "zh_CN" };
                                 OapiV2DepartmentListsubResponse rspDeptList3 = deptListClient.Execute(reqDeptList3, access_token);
                                 if (rspDeptList3.Result != null)
                                 {
@@ -854,7 +854,7 @@ namespace TEAMModelBI.Controllers.BITable
                                         if (dingDingUserInfos3.Count > 0) ddUserInfos.AddRange(dingDingUserInfos3);
 
                                         //获取四级部门
-                                        OapiV2DepartmentListsubRequest reqDeptList4 = new OapiV2DepartmentListsubRequest() { DeptId = tempDept3.DeptId, Language = "zh_CN" };
+                                        OapiV2DepartmentListsubRequest reqDeptList4 = new() { DeptId = tempDept3.DeptId, Language = "zh_CN" };
                                         OapiV2DepartmentListsubResponse rspDeptList4 = deptListClient.Execute(reqDeptList4, access_token);
                                         if (rspDeptList4.Result != null)
                                         {
@@ -866,7 +866,7 @@ namespace TEAMModelBI.Controllers.BITable
                                                 if (dingDingUserInfos4.Count > 0) ddUserInfos.AddRange(dingDingUserInfos4);
 
                                                 //获取五级部门
-                                                OapiV2DepartmentListsubRequest reqDeptList5 = new OapiV2DepartmentListsubRequest() { DeptId = tempDept4.DeptId, Language = "zh_CN" };
+                                                OapiV2DepartmentListsubRequest reqDeptList5 = new() { DeptId = tempDept4.DeptId, Language = "zh_CN" };
                                                 OapiV2DepartmentListsubResponse rspDeptList5 = deptListClient.Execute(reqDeptList5, access_token);
                                                 if (rspDeptList5.Result != null)
                                                 {
@@ -1144,7 +1144,7 @@ namespace TEAMModelBI.Controllers.BITable
 
                 //获取access_token
                 IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
-                OapiGettokenRequest request = new OapiGettokenRequest() { Appkey = appKey, Appsecret = appSecret };
+                OapiGettokenRequest request = new() { Appkey = appKey, Appsecret = appSecret };
                 request.SetHttpMethod("Get");
                 OapiGettokenResponse response = client.Execute(request);
                 if (response.IsError)
@@ -1156,15 +1156,15 @@ namespace TEAMModelBI.Controllers.BITable
                 string access_token = response.AccessToken;
 
                 IDingTalkClient InductionClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/querypreentry");
-                OapiSmartworkHrmEmployeeQuerypreentryRequest reqInduction = new OapiSmartworkHrmEmployeeQuerypreentryRequest() { Offset = 0L, Size = 50 };
+                OapiSmartworkHrmEmployeeQuerypreentryRequest reqInduction = new() { Offset = 0L, Size = 50 };
                 reqInduction.SetHttpMethod("GET");
                 OapiSmartworkHrmEmployeeQuerypreentryResponse rspInduction = InductionClient.Execute(reqInduction, access_token);
                 if (rspInduction.Result.DataList != null)
                 {
-                    List<DingDingUserInfo> ddUserInfos = new List<DingDingUserInfo>();
+                    List<DingDingUserInfo> ddUserInfos = new();
                     foreach (var itemId in rspInduction.Result.DataList)
                     {
-                        DingDingUserInfo ddUserInfo = new DingDingUserInfo();
+                        DingDingUserInfo ddUserInfo = new();
                         ddUserInfo.PartitionKey = divide;
                         ddUserInfo.RowKey = itemId;
                         ddUserInfos.Add(ddUserInfo);
@@ -1234,7 +1234,7 @@ namespace TEAMModelBI.Controllers.BITable
                 string access_token = response.AccessToken;
 
                 IDingTalkClient quitStaffClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/querydimission");
-                OapiSmartworkHrmEmployeeQuerydimissionRequest reqDimission = new OapiSmartworkHrmEmployeeQuerydimissionRequest() { Offset = 0L, Size = 50L };
+                OapiSmartworkHrmEmployeeQuerydimissionRequest reqDimission = new() { Offset = 0L, Size = 50L };
                 OapiSmartworkHrmEmployeeQuerydimissionResponse rspDimission = quitStaffClient.Execute(reqDimission, access_token);
                 if (rspDimission.Result != null)
                 {

+ 2 - 2
TEAMModelBI/Controllers/BITeacher/TeacherController.cs

@@ -46,7 +46,7 @@ namespace TEAMModelBI.Controllers.BITeacher
             if ($"{site}".Equals(BIConst.Global))
                 cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
             
-            List<SchoolTeacher> teachers = new List<SchoolTeacher>();
+            List<SchoolTeacher> teachers = new();
             string sqlTxt = "";
             if (!string.IsNullOrEmpty($"{tmdId}")) 
             {
@@ -93,7 +93,7 @@ namespace TEAMModelBI.Controllers.BITeacher
             var cosmosClient = _azureCosmos.GetCosmosClient();
             if ($"{site}".Equals(BIConst.Global))
                 cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
-            List<object> objs = new List<object>();
+            List<object> objs = new();
 
             await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(queryText: $"select value(c) from c where c.id='{teacherId}'", requestOptions: string.IsNullOrEmpty($"{code}") ? new QueryRequestOptions() { } : new QueryRequestOptions() { PartitionKey = new PartitionKey($"{code}") }))
             {

+ 17 - 19
TEAMModelBI/Controllers/BITest/TestController.cs

@@ -94,7 +94,7 @@ namespace TEAMModelBI.Controllers.BITest
             if (!jsonElement.TryGetProperty("oldStandard", out JsonElement _oldStandard)) return BadRequest();
             var cosmosClient = _azureCosmos.GetCosmosClient();
 
-            List<string> abilityIds = new List<string>();  //册别的ID集合
+            List<string> abilityIds = new();  //册别的ID集合
 
             //查询册别信息
             await foreach (var tempAbility in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{_oldStandard}") }))
@@ -107,7 +107,7 @@ namespace TEAMModelBI.Controllers.BITest
                 var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityIds, $"Ability-{_oldStandard}");
             }
 
-            List<string> abilityTaskIds = new List<string>();  //章节ID集合
+            List<string> abilityTaskIds = new();  //章节ID集合
 
             await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AbilityTask>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{_oldStandard}") }))
             {
@@ -201,7 +201,7 @@ namespace TEAMModelBI.Controllers.BITest
             jsonElement.TryGetProperty("endDate", out JsonElement endDate);
             jsonElement.TryGetProperty("platform", out JsonElement platform);
 
-            List<string> strlist = new List<string>();
+            List<string> strlist = new();
             if (!string.IsNullOrEmpty($"{single}"))
                 strlist.Add($"RowKey {QueryComparisons.Equal} {single}");
             if (!string.IsNullOrEmpty($"{startDate}"))
@@ -270,7 +270,7 @@ namespace TEAMModelBI.Controllers.BITest
 
             //获取access_token
             IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
-            OapiGettokenRequest request = new OapiGettokenRequest() { Appkey = appKey, Appsecret = appSecret };
+            OapiGettokenRequest request = new() { Appkey = appKey, Appsecret = appSecret };
             request.SetHttpMethod("Get");
             OapiGettokenResponse response = client.Execute(request);
             if (response.IsError)
@@ -282,7 +282,7 @@ namespace TEAMModelBI.Controllers.BITest
             string access_token = response.AccessToken;
             
             IDingTalkClient quitStaffClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/querydimission");
-            OapiSmartworkHrmEmployeeQuerydimissionRequest reqDimission = new OapiSmartworkHrmEmployeeQuerydimissionRequest() { Offset = 0L, Size = 50L };
+            OapiSmartworkHrmEmployeeQuerydimissionRequest reqDimission = new() { Offset = 0L, Size = 50L };
             OapiSmartworkHrmEmployeeQuerydimissionResponse rspDimission = quitStaffClient.Execute(reqDimission, access_token);
 
             if (rspDimission.SubErrCode == "60011")
@@ -314,7 +314,7 @@ namespace TEAMModelBI.Controllers.BITest
 
             //获取access_token
             IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
-            OapiGettokenRequest request = new OapiGettokenRequest() { Appkey = appKey, Appsecret = appSecret };
+            OapiGettokenRequest request = new() { Appkey = appKey, Appsecret = appSecret };
             request.SetHttpMethod("Get");
             OapiGettokenResponse response = client.Execute(request);
             if (response.IsError)
@@ -326,7 +326,7 @@ namespace TEAMModelBI.Controllers.BITest
             string access_token = response.AccessToken;
 
             IDingTalkClient InductionClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/querypreentry");
-            OapiSmartworkHrmEmployeeQuerypreentryRequest reqInduction = new OapiSmartworkHrmEmployeeQuerypreentryRequest() { Offset = 0L, Size = 50 };
+            OapiSmartworkHrmEmployeeQuerypreentryRequest reqInduction = new() { Offset = 0L, Size = 50 };
             reqInduction.SetHttpMethod("GET");
             OapiSmartworkHrmEmployeeQuerypreentryResponse rspInduction = InductionClient.Execute(reqInduction, access_token);
             if (rspInduction.Result.DataList != null)
@@ -334,7 +334,7 @@ namespace TEAMModelBI.Controllers.BITest
                 foreach (var itemId in rspInduction.Result.DataList)
                 {
                     IDingTalkClient client3 = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get");
-                    OapiV2UserGetRequest v2GetRequest = new OapiV2UserGetRequest()
+                    OapiV2UserGetRequest v2GetRequest = new()
                     {
                         Userid = itemId,
                         Language = "zh_CN"
@@ -365,7 +365,7 @@ namespace TEAMModelBI.Controllers.BITest
 
             //获取access_token
             IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
-            OapiGettokenRequest request = new OapiGettokenRequest() { Appkey = appKey, Appsecret = appSecret };
+            OapiGettokenRequest request = new() { Appkey = appKey, Appsecret = appSecret };
             request.SetHttpMethod("Get");
             OapiGettokenResponse response = client.Execute(request);
             if (response.IsError)
@@ -390,7 +390,7 @@ namespace TEAMModelBI.Controllers.BITest
             //} while (vars);
 
             IDingTalkClient jobclient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/queryonjob");
-            OapiSmartworkHrmEmployeeQueryonjobRequest jobreq = new OapiSmartworkHrmEmployeeQueryonjobRequest { StatusList = "2,3,-1", Offset = 1, Size = 50 };   //2:试用期 3:正式 5:待离职 -1:无状态
+            OapiSmartworkHrmEmployeeQueryonjobRequest jobreq = new() { StatusList = "2,3,-1", Offset = 1, Size = 50 };   //2:试用期 3:正式 5:待离职 -1:无状态
             OapiSmartworkHrmEmployeeQueryonjobResponse jobrsp = jobclient.Execute(jobreq, access_token);
             if (jobrsp.SubErrCode == "60011")
             {
@@ -422,7 +422,7 @@ namespace TEAMModelBI.Controllers.BITest
                 var cosmosClient = _azureCosmos.GetCosmosClient();
                 List<AssistSchool> schoolAssists = new();
                 //StringBuilder stringBuilder = new StringBuilder("select value(c) from c");
-                StringBuilder stringBuilder = new StringBuilder("select c.id,c.code,c.schoolCode,c.name,c.region,c.province,c.city,c.dist,c.size,c.address,c.picture,c.type,c.scale,c.areaId,c.standard from c");
+                StringBuilder stringBuilder = new("select c.id,c.code,c.schoolCode,c.name,c.region,c.province,c.city,c.dist,c.size,c.address,c.picture,c.type,c.scale,c.areaId,c.standard from c");
 
                 if (!string.IsNullOrEmpty($"{_schoolCode}"))
                 {
@@ -745,8 +745,8 @@ namespace TEAMModelBI.Controllers.BITest
         public async Task<IActionResult> GetYearMonth()
         {
             var cosmosClient = _azureCosmos.GetCosmosClient();
-            Dictionary<int, long> tempYear = new Dictionary<int, long>();
-            List<TempSchool> tempSchools = new List<TempSchool>();
+            Dictionary<int, long> tempYear = new();
+            List<TempSchool> tempSchools = new();
             for (int i = 1; i < 13; i++)
             {
                 var start = 00022222330;
@@ -758,7 +758,7 @@ namespace TEAMModelBI.Controllers.BITest
                     {
                         foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
                         {
-                            TempSchool tempSchool = new TempSchool();
+                            TempSchool tempSchool = new();
                             tempSchool.id = obj.GetProperty("id").GetString();
                             tempSchool.ts = obj.GetProperty("_ts").GetInt64();
                             tempSchool.name = obj.GetProperty("name").GetString();
@@ -906,11 +906,11 @@ namespace TEAMModelBI.Controllers.BITest
         public async Task<IActionResult> GetRepeat(JsonElement jsonElement) 
         {
             jsonElement.TryGetProperty("datetime", out JsonElement _datetime);
-            Dictionary<string, string> prodict = new Dictionary<string, string>() { { "YMPCVCIM", "学情分析模组" }, { "IPDYZYLC", "智慧学校管理服务" }, { "3CLYJ6NP", "AClass ONE智慧学伴" }, { "IPALJ6NY", "数据储存服务空间" },{ "VABAJ6NV", "卷卡合一阅卷系统" } };
+            Dictionary<string, string> prodict = new() { { "YMPCVCIM", "学情分析模组" }, { "IPDYZYLC", "智慧学校管理服务" }, { "3CLYJ6NP", "AClass ONE智慧学伴" }, { "IPALJ6NY", "数据储存服务空间" },{ "VABAJ6NV", "卷卡合一阅卷系统" } };
             var ste = prodict["IPDYZYLC"];
 
-            List<string> str_str = new List<string>() { "12", "20", "13", "13", "14", "16" };
-            List<strend> strends = new List<strend> { new strend { id = 1, name = "12", age = 20 }, new strend { id = 1, name = "13", age = 20 }, new strend { id = 2, name = "22", age = 22 }, new strend { id = 3, name = "23", age = 23 } };
+            List<string> str_str = new() { "12", "20", "13", "13", "14", "16" };
+            List<strend> strends = new() { new strend { id = 1, name = "12", age = 20 }, new strend { id = 1, name = "13", age = 20 }, new strend { id = 2, name = "22", age = 22 }, new strend { id = 3, name = "23", age = 23 } };
             //str_str.Distinct().ToList();
             strends.Where((x, i) => strends.FindIndex(z => z.id.Equals(x.id)) == i).ToList();
             List<strend> str_strend1 = strends.Where((x, i) => strends.FindIndex(z => z.id.Equals(x.id)) == i).ToList();
@@ -1258,8 +1258,6 @@ namespace TEAMModelBI.Controllers.BITest
 
             var temps= await _azureRedis.GetRedisClient(dbnum: 0, name: "Global").SortedSetIncrementAsync($"Login:IES:Test", $"1", 1);//一天24小时  小时为单位
 
-
-
             var cosmosDefaulat = _azureCosmos.GetCosmosClient(); //默认数据库
             List<School> schools = new();
             await foreach (var item in cosmosDefaulat.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<School>(queryText: "select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))

+ 8 - 8
TEAMModelBI/Controllers/Census/ActivitySticsController.cs

@@ -724,7 +724,7 @@ namespace TEAMModelBI.Controllers.Census
 
             List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
 
-            List<ActivityCount> activityCounts = new List<ActivityCount>();
+            List<ActivityCount> activityCounts = new();
             foreach (var itemId in schoolIds)
             {
                 School school = new();
@@ -734,7 +734,7 @@ namespace TEAMModelBI.Controllers.Census
                     using var json = await JsonDocument.ParseAsync(response.ContentStream);
                     school = json.ToObject<School>();
                 }
-                ActivityCount activityCount = new ActivityCount() { id = itemId, name = school.name != null ? school.name : itemId };
+                ActivityCount activityCount = new() { id = itemId, name = school.name != null ? school.name : itemId };
                 foreach (var type in StaticValue.activityTypes)
                 {
                     string activitySql = $"SELECT value(count(c.id)) FROM c WHERE c.pk='{type}' AND c.school='{itemId}'";
@@ -769,7 +769,7 @@ namespace TEAMModelBI.Controllers.Census
             if (!string.IsNullOrEmpty($"{tmdId}"))
             {
                 List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
-                List<ActivityCount> activityCounts = new List<ActivityCount>();
+                List<ActivityCount> activityCounts = new();
                 foreach (var schoolId in schoolIds)
                 {
                     School school = new();
@@ -779,7 +779,7 @@ namespace TEAMModelBI.Controllers.Census
                         using var json = await JsonDocument.ParseAsync(response.ContentStream);
                         school = json.ToObject<School>();
                     }
-                    ActivityCount activityCount = new ActivityCount() { id = schoolId, name = school.name != null ? school.name : schoolId };
+                    ActivityCount activityCount = new() { id = schoolId, name = school.name != null ? school.name : schoolId };
 
                     foreach (var type in StaticValue.activityTypes)
                     {
@@ -801,7 +801,7 @@ namespace TEAMModelBI.Controllers.Census
                     string querySql = $"SELECT value(COUNT(c.id)) FROM c where c.pk='{type}' and c.createTime >= {start} and c.createTime <= {end}";
                     long totals = await CommonFind.GetSqlValueCount(cosmosClient, "Common", querySql);
 
-                    KeyValuePair<string, object> valuePair = new KeyValuePair<string, object>(type, totals);
+                    KeyValuePair<string, object> valuePair = new(type, totals);
                     typeCount.Add(valuePair);
                 }
 
@@ -839,7 +839,7 @@ namespace TEAMModelBI.Controllers.Census
             foreach (var school in schools)
             {
 
-                ActivityCount tempCount = new ActivityCount() { id = school.id, name = school.name != null ? school.name : school.id };
+                ActivityCount tempCount = new() { id = school.id, name = school.name != null ? school.name : school.id };
                 foreach (var type in StaticValue.activityTypes)
                 {
                     StringBuilder sqlTxt = new($"select value(COUNT(c.id)) from c where c.pk='{type}' and c.school='{school.id}' ");
@@ -887,8 +887,8 @@ namespace TEAMModelBI.Controllers.Census
             var cosmosClient = _azureCosmos.GetCosmosClient();
             if ($"{site}".Equals(BIConst.Global))
                 cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
-            List<object> infos = new List<object>();
-            StringBuilder sqlTxt = new StringBuilder($"select * from c where c.id='{id}'");
+            List<object> infos = new();
+            StringBuilder sqlTxt = new($"select * from c where c.id='{id}'");
             if (!string.IsNullOrEmpty($"{activity}"))
             {
                 sqlTxt.Append($" and c.pk='{activity}'");

+ 13 - 13
TEAMModelBI/Controllers/Census/ItemSticsController.cs

@@ -62,7 +62,7 @@ namespace TEAMModelBI.Controllers.Census
                         school = json.ToObject<School>();
                     }
 
-                    ItemTatols itempTatols = new ItemTatols() { id = scid, name = school.name != null ? school.name : scid };
+                    ItemTatols itempTatols = new() { id = scid, name = school.name != null ? school.name : scid };
 
                     string sqlTxt = $"select value(COUNT(c.id)) from c where c.code='Item-{scid}'";
                     long totals = await CommonFind.GetSqlValueCount(cosmosClient, new List<string>() { "School", "Teacher" }, sqlTxt.ToString());
@@ -97,8 +97,8 @@ namespace TEAMModelBI.Controllers.Census
             var cosmosClient = _azureCosmos.GetCosmosClient();
             if ($"{site}".Equals(BIConst.Global))
                 cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
-            List<string> itemType = new List<string> { "single", "multiple", "judge", "complete", "subjective", "connector", "correct", "compose" };
-            List<object> typeCount = new List<object>();
+            List<string> itemType = new() { "single", "multiple", "judge", "complete", "subjective", "connector", "correct", "compose" };
+            List<object> typeCount = new();
 
             if (!string.IsNullOrEmpty($"{tmdId}"))
             {
@@ -114,7 +114,7 @@ namespace TEAMModelBI.Controllers.Census
                         school = json.ToObject<School>();
                     }
 
-                    Census tempCensus = new Census() { id = schoolId, name = school.name != null ? school.name : schoolId };
+                    Census tempCensus = new() { id = schoolId, name = school.name != null ? school.name : schoolId };
 
                     foreach (var type in itemType)
                     {
@@ -165,11 +165,11 @@ namespace TEAMModelBI.Controllers.Census
                 cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
             var (start, end) = TimeHelper.GetTermStartOrEnd(DateTime.Now);
 
-            List<object> levelCount = new List<object>();
+            List<object> levelCount = new();
 
             if (!string.IsNullOrEmpty($"{tmdId}"))
             {
-                List<string> schoolIds = new List<string>();
+                List<string> schoolIds = new();
                 schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
 
                 foreach (var schoolId in schoolIds)
@@ -183,7 +183,7 @@ namespace TEAMModelBI.Controllers.Census
                         school = json.ToObject<School>();
                     }
 
-                    Census tempCensus = new Census() { id = schoolId, name = school.name != null ? school.name : schoolId };
+                    Census tempCensus = new() { id = schoolId, name = school.name != null ? school.name : schoolId };
 
                     for (int i = 1; i < 6; i++)
                     {
@@ -233,11 +233,11 @@ namespace TEAMModelBI.Controllers.Census
             var cosmosClient = _azureCosmos.GetCosmosClient();
             if ($"{site}".Equals(BIConst.Global))
                 cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
-            List<object> layerCount = new List<object>();
+            List<object> layerCount = new();
 
             if (!string.IsNullOrEmpty($"{tmdId}"))
             {
-                List<string> schoolIds = new List<string>();
+                List<string> schoolIds = new();
                 schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
 
                 foreach (var schoolId in schoolIds)
@@ -250,7 +250,7 @@ namespace TEAMModelBI.Controllers.Census
                         school = json.ToObject<School>();
                     }
 
-                    Census tempCensus = new Census() { id = schoolId, name = school.name != null ? school.name : schoolId };
+                    Census tempCensus = new() { id = schoolId, name = school.name != null ? school.name : schoolId };
 
                     for (int i = 1; i <= 6; i++)
                     {
@@ -271,7 +271,7 @@ namespace TEAMModelBI.Controllers.Census
             {
                 for (int i = 1; i <= 6; i++)
                 {
-                    StringBuilder sqlTxt = new StringBuilder($"select value(COUNT(c.id)) from c where c.pk='Item' and c.field={i}");
+                    StringBuilder sqlTxt = new($"select value(COUNT(c.id)) from c where c.pk='Item' and c.field={i}");
                     if (bool.Parse($"{term}") == true)
                     {
                         sqlTxt.Append($" and c.createTime >= {start} and c.createTime <= {end}");
@@ -301,7 +301,7 @@ namespace TEAMModelBI.Controllers.Census
             if ($"{site}".Equals(BIConst.Global))
                 cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
 
-            List<object> objItems = new List<object>();
+            List<object> objItems = new();
             string sqlTxt = $"select * from c where c.id='{itemId}' and c.pk='Item'";
 
             if (!string.IsNullOrEmpty($"{isPersonal}"))
@@ -323,7 +323,7 @@ namespace TEAMModelBI.Controllers.Census
             }
             else 
             {
-                List<string> tableName = new List<string> { "School", "Teacher" };
+                List<string> tableName = new() { "School", "Teacher" };
                 foreach (string key in tableName) 
                 {
                     await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", key).GetItemQueryStreamIterator(queryText: sqlTxt, requestOptions: new QueryRequestOptions() { }))

+ 7 - 7
TEAMModelBI/Controllers/Census/PaperController.cs

@@ -57,10 +57,10 @@ namespace TEAMModelBI.Controllers.Census
 
             if (!string.IsNullOrEmpty($"{tmdId}"))
             {
-                List<string> schoolIds = new List<string>();
+                List<string> schoolIds = new();
                 schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
 
-                List<SchoolPaper> schoolPapers = new List<SchoolPaper>();
+                List<SchoolPaper> schoolPapers = new();
                 string time = "";
                 bool bos = bool.Parse($"{term}");
                 if (bos == true)
@@ -141,8 +141,8 @@ namespace TEAMModelBI.Controllers.Census
             var cosmosClient = _azureCosmos.GetCosmosClient();
             if ($"{site}".Equals(BIConst.Global))
                 cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
-            List<string> schoolIds = new List<string>();
-            List<SchoolPaper> schoolPapers = new List<SchoolPaper>();
+            List<string> schoolIds = new();
+            List<SchoolPaper> schoolPapers = new();
 
             schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
 
@@ -156,7 +156,7 @@ namespace TEAMModelBI.Controllers.Census
                     school = json.ToObject<School>();
                 }
 
-                SchoolPaper schoolPaper = new SchoolPaper() { id = schoolId , name = school != null ? school.name : schoolId };
+                SchoolPaper schoolPaper = new() { id = schoolId , name = school != null ? school.name : schoolId };
 
                 schoolPaper.totals = await CommonFind.GetSqlValueCount(cosmosClient, "School", $"select value(COUNT(c.id)) from c where c.code='Paper-{schoolId}'");
 
@@ -260,7 +260,7 @@ namespace TEAMModelBI.Controllers.Census
                         school = json.ToObject<School>();
                     }
 
-                    SchoolPaper schoolPaper = new SchoolPaper() { id = schoolId, name = school != null ? school.name : schoolId };
+                    SchoolPaper schoolPaper = new() { id = schoolId, name = school != null ? school.name : schoolId };
 
                     string sqlTxt = $"select value(count(c.id)) from c where c.createTime >={start} and c.createTime <={end}";
 
@@ -331,7 +331,7 @@ namespace TEAMModelBI.Controllers.Census
             }
             else
             {
-                List<string> tableName = new List<string> { "School", "Teacher" };
+                List<string> tableName = new(){ "School", "Teacher" };
                 foreach (var temp in tableName)
                 {
                     await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", temp).GetItemQueryStreamIterator(queryText: sqlTxt, requestOptions: new QueryRequestOptions() { }))

+ 13 - 15
TEAMModelBI/Controllers/Census/ProductStatisController.cs

@@ -180,15 +180,15 @@ namespace TEAMModelBI.Controllers.Census
             if ($"{site}".Equals(BIConst.Global))
                 clientContainer = _azureCosmos.GetCosmosClient(name: BIConst.Global);
 
-            List<SchoolProductSerial> serials = new List<SchoolProductSerial>(); //软体
-            List<SchoolProductService> services = new List<SchoolProductService>(); //服务
-            List<SchoolProductHard> hards = new List<SchoolProductHard>(); //硬体
+            List<SchoolProductSerial> serials = new(); //软体
+            List<SchoolProductService> services = new(); //服务
+            List<SchoolProductHard> hards = new(); //硬体
 
-            SchoolProductSum productSum = new SchoolProductSum(); //产品状态
-            List<SchoolProductSumProdInfo> prodinfo = new List<SchoolProductSumProdInfo>(); //学校的产品信息
-            List<SchoolProductSumData> serialRecord = new List<SchoolProductSumData>(); //软体购买记录
-            List<SchoolProductSumDataService> serviceRecord = new List<SchoolProductSumDataService>(); //服务购买记录
-            List<SchoolProductSumDataHard> hardRecord = new List<SchoolProductSumDataHard>(); //硬体购买记录
+            SchoolProductSum productSum = new(); //产品状态
+            List<SchoolProductSumProdInfo> prodinfo = new(); //学校的产品信息
+            List<SchoolProductSumData> serialRecord = new(); //软体购买记录
+            List<SchoolProductSumDataService> serviceRecord = new(); //服务购买记录
+            List<SchoolProductSumDataHard> hardRecord = new(); //硬体购买记录
 
 
             //取产品的数量
@@ -243,7 +243,7 @@ namespace TEAMModelBI.Controllers.Census
             }
 
             //学校教室
-            List<Room> rooms = new List<Room>();
+            List<Room> rooms = new();
             await foreach (var item in clientContainer.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<Room>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Room-{schoolCode}") }))
             {
                 rooms.Add(item);
@@ -268,7 +268,7 @@ namespace TEAMModelBI.Controllers.Census
                 cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
 
             List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
-            List<SchoolProduct> schoolProducts = new List<SchoolProduct>();
+            List<SchoolProduct> schoolProducts = new();
             foreach (var scid in schoolIds)
             {
                 School school = new();
@@ -280,7 +280,7 @@ namespace TEAMModelBI.Controllers.Census
                     school = json.ToObject<School>();
                 }
 
-                SchoolProduct sProduct = new SchoolProduct() { id = scid, name = school != null ? school.name : scid };
+                SchoolProduct sProduct = new() { id = scid, name = school != null ? school.name : scid };
 
                 List<ProductStatis> productStatis = new();
 
@@ -322,7 +322,7 @@ namespace TEAMModelBI.Controllers.Census
                             }
                             else
                             {
-                                ProductStatis tempProd = new ProductStatis()
+                                ProductStatis tempProd = new()
                                 {
                                     prodCode = serial.prodCode,
                                     prodName = _serials[serial.prodCode],
@@ -344,7 +344,7 @@ namespace TEAMModelBI.Controllers.Census
                             }
                             else
                             {
-                                ProductStatis tempProd = new ProductStatis()
+                                ProductStatis tempProd = new()
                                 {
                                     prodCode = ser.prodCode,
                                     prodName = _services[ser.prodCode],
@@ -600,8 +600,6 @@ namespace TEAMModelBI.Controllers.Census
             //public string dataType { get; set; }
 
             public long Count { get; set; }
-
-
         }
          
     }

+ 1 - 41
TEAMModelBI/Controllers/RepairApi/TeacherREPController.cs

@@ -20,47 +20,7 @@ namespace TEAMModelBI.Controllers.RepairApi
 
         }
 
-        List<string> schools = new()
-        {
-            "dghznx",
-            "cxhhlx",
-            "xjaxx",
-            "zjqxx",
-            "xnygxx",
-            "lxxcfx",
-            "gxjrxx",
-            "cdgxsx",
-            "yzxx",
-            "kjyxx",
-            "wjylxx",
-            "dsgjxx",
-            "ydzt",
-            "xndbxx",
-            "sqtszx",
-            "cdxczx",
-            "ghsyzx",
-            "lqsx",
-            "cdxxps",
-            "xcfx",
-            "xyqxx",
-            "xncbyy",
-            "cdlqjk",
-            "lqdmxx",
-            "lqyx",
-            "pclxxx",
-            "cdfzx",
-            "xnblxx",
-            "ghsx",
-            "khdycz",
-            "khbmxx",
-            "khdecz",
-            "khzx",
-            "khhbzx",
-            "gxxcxx",
-            "khhtxx",
-            "khdxxx",
-            "khsyxx"
-        };
+        List<string> schools = new() { "dghznx", "cxhhlx", "xjaxx", "zjqxx", "xnygxx", "lxxcfx", "gxjrxx", "cdgxsx", "yzxx", "kjyxx", "wjylxx", "dsgjxx", "ydzt", "xndbxx", "sqtszx", "cdxczx", "ghsyzx", "lqsx", "cdxxps", "xcfx", "xyqxx", "xncbyy", "cdlqjk", "lqdmxx", "lqyx", "pclxxx", "cdfzx", "xnblxx", "ghsx", "khdycz", "khbmxx", "khdecz", "khzx", "khhbzx", "gxxcxx", "khhtxx", "khdxxx", "khsyxx" };
 
         /// <summary>
         /// 修改教师学校信息

+ 5 - 0
TEAMModelOS.SDK/Models/Cosmos/BI/StaticValue.cs

@@ -14,6 +14,11 @@ namespace TEAMModelOS.SDK.Models.Cosmos.BI
         /// </summary>
         public static List<string> suffixName = new() { ".js", ".css", ".ico", ".aspx", ".php", ".aws", ".html" };
 
+        /// <summary>
+        /// 文件类型 cosmosDB
+        /// </summary>
+        public static List<string> fileType = new() { "audio", "doc", "image", "other", "records", "res", "video"};
+
 
     }
 }