LessonService.cs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. using Azure.Cosmos;
  2. using Azure.Messaging.ServiceBus;
  3. using HTEXLib.COMM.Helpers;
  4. using Microsoft.Extensions.Configuration;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Text.Json;
  10. using System.Threading.Tasks;
  11. using TEAMModelOS.SDK.DI;
  12. using TEAMModelOS.SDK.Extension;
  13. using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
  14. using TEAMModelOS.SDK.Models.Cosmos.Common;
  15. namespace TEAMModelOS.SDK.Models.Service
  16. {
  17. public class LessonService
  18. {
  19. public static async void DoLessonStudentRecord(LessonRecord lessonRecord, string scope, CosmosClient client, string school, string tmdid,
  20. Teacher teacher, NotificationService _notificationService, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration, LessonBase lessonBase)
  21. {
  22. var stuids = lessonBase.student.Where(x => x.type == 2).Select(x => new IdNameCode { id = x.id ,code=x.school});
  23. if (stuids.Any()) {
  24. stuids.ToList().ForEach(x => {
  25. x.code = string.IsNullOrWhiteSpace(x.code) ? school : x.code;
  26. });
  27. }
  28. var groups= stuids.Where(z=>!string.IsNullOrWhiteSpace(z.code)).GroupBy(x => x.code).Select(y=>new { code=y.Key,list=y.ToList()});
  29. List<LessonStudentRecord> lessonStudentRecords = new List<LessonStudentRecord>();
  30. foreach (var group in groups) {
  31. string stusql = $"select value(c) from c where c.id in({string.Join(",",group.list.Select(x=>$"'{x.id}'"))})";
  32. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Student).GetItemQueryIterator<LessonStudentRecord>(queryText: stusql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"LessonStudentRecord-{group.code}") })) {
  33. lessonStudentRecords.Add(item);
  34. }
  35. }
  36. var tmdids = lessonBase.student.Where(x => x.type == 1).Select(x => new { id = x.id });
  37. if (tmdids.Any()) {
  38. string tmdsql = $"select value(c) from c where c.id in({string.Join(",", tmdids.Select(x => $"'{x}'"))})";
  39. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Student).GetItemQueryIterator<LessonStudentRecord>(queryText: tmdsql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"LessonStudentRecord") }))
  40. {
  41. lessonStudentRecords.Add(item);
  42. }
  43. }
  44. List<Task<ItemResponse<LessonStudentRecord>>> records = new List<Task<ItemResponse<LessonStudentRecord>>>();
  45. stuids.ToList().ForEach(x => {
  46. var record = lessonStudentRecords.Find(l => l.id.Equals(x.id) && l.code.Equals($"LessonStudentRecord-{x.code}"));
  47. if (record != null)
  48. {
  49. record.records.Add(new StudentRecord { });
  50. }
  51. else {
  52. }
  53. });
  54. tmdids.ToList().ForEach(x => {
  55. var record = lessonStudentRecords.Find(l => l.id.Equals(x.id) && l.code.Equals($"LessonStudentRecord"));
  56. });
  57. }
  58. public static async void DoAutoDeleteSchoolLessonRecord(LessonRecord lessonRecord,string scope ,CosmosClient client,string school,string tmdid,
  59. Teacher teacher, NotificationService _notificationService, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration) {
  60. if (lessonRecord.scope.Equals("school"))
  61. {
  62. SchoolSetting setting = null;
  63. Azure.Response schoolSetting = await client.GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync(school, new PartitionKey("SchoolSetting"));
  64. School schoolBase = await client.GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>(school, new PartitionKey("Base"));
  65. if (schoolSetting.Status == 200)
  66. {
  67. setting = JsonDocument.Parse(schoolSetting.Content).RootElement.Deserialize<SchoolSetting>();
  68. if (setting.lessonSetting != null)
  69. {
  70. if (setting.lessonSetting.openAutoClean != 0 || setting.lessonSetting.openAutoClean != 1)
  71. {
  72. setting.lessonSetting.openAutoClean = 0;
  73. setting.lessonSetting.expireDays = Constant.school_lesson_expire;
  74. }
  75. }
  76. else
  77. {
  78. setting.lessonSetting = new LessonSetting() { openAutoClean = 0, expireDays = Constant.school_lesson_expire };
  79. }
  80. }
  81. else
  82. {
  83. setting = new SchoolSetting() { lessonSetting = new LessonSetting { openAutoClean = 0, expireDays = Constant.school_lesson_expire } };
  84. }
  85. int school_lesson_expire =0;
  86. bool save = true;
  87. List<string> msg = new List<string>();
  88. if (setting.lessonSetting.openAutoClean == 1)
  89. {
  90. if (setting.lessonSetting.conds.IsEmpty())
  91. {
  92. save = false;
  93. }
  94. else {
  95. school_lesson_expire = setting.lessonSetting.expireDays;
  96. foreach (var item in setting.lessonSetting.conds)
  97. {
  98. switch (item.type)
  99. {
  100. case ">=":
  101. switch (item.key)
  102. {
  103. case "attendRate":
  104. if (!(lessonRecord.attendRate >= item.val))
  105. {
  106. save = false;
  107. msg.Add($"{item.key}:{lessonRecord.attendRate}{item.type}{item.val}");
  108. }
  109. break;
  110. case "groupCount":
  111. if (!(lessonRecord.groupCount >= item.val))
  112. {
  113. save = false;
  114. msg.Add($"{item.key}:{lessonRecord.groupCount}{item.type}{item.val}");
  115. }
  116. break;
  117. case "totalPoint":
  118. if (!(lessonRecord.totalPoint >= item.val))
  119. {
  120. save = false;
  121. msg.Add($"{item.key}:{lessonRecord.totalPoint}{item.type}{item.val}");
  122. }
  123. break;
  124. case "collateTaskCount":
  125. if (!(lessonRecord.collateTaskCount >= item.val))
  126. {
  127. save = false;
  128. msg.Add($"{item.key}:{lessonRecord.collateTaskCount}{item.type}{item.val}");
  129. }
  130. break;
  131. case "collateCount":
  132. if (!(lessonRecord.collateCount >= item.val))
  133. {
  134. save = false;
  135. msg.Add($"{item.key}:{lessonRecord.collateCount}{item.type}{item.val}");
  136. }
  137. break;
  138. case "pushCount":
  139. if (!(lessonRecord.pushCount >= item.val))
  140. {
  141. save = false;
  142. msg.Add($"{item.key}:{lessonRecord.pushCount}{item.type}{item.val}");
  143. }
  144. break;
  145. case "totalInteractPoint":
  146. if (!(lessonRecord.totalInteractPoint >= item.val))
  147. {
  148. save = false;
  149. msg.Add($"{item.key}:{lessonRecord.totalInteractPoint}{item.type}{item.val}");
  150. }
  151. break;
  152. case "interactionCount":
  153. if (!(lessonRecord.interactionCount >= item.val))
  154. {
  155. save = false;
  156. msg.Add($"{item.key}:{lessonRecord.interactionCount}{item.type}{item.val}");
  157. }
  158. break;
  159. case "clientInteractionCount":
  160. if (!(lessonRecord.clientInteractionCount >= item.val))
  161. {
  162. save = false;
  163. msg.Add($"{item.key}:{lessonRecord.clientInteractionCount}{item.type}{item.val}");
  164. }
  165. break;
  166. case "examQuizCount":
  167. if (!(lessonRecord.examQuizCount >= item.val))
  168. {
  169. save = false;
  170. msg.Add($"{item.key}:{lessonRecord.examQuizCount}{item.type}{item.val}");
  171. }
  172. break;
  173. case "examPointRate":
  174. if (!(lessonRecord.examPointRate >= item.val))
  175. {
  176. save = false;
  177. msg.Add($"{item.key}:{lessonRecord.examPointRate}{item.type}{item.val}");
  178. }
  179. break;
  180. }
  181. break;
  182. case "<=":
  183. switch (item.key)
  184. {
  185. case "attendRate":
  186. if (!(lessonRecord.attendRate <= item.val))
  187. {
  188. save = false;
  189. msg.Add($"{item.key}:{lessonRecord.attendRate}{item.type}{item.val}");
  190. }
  191. break;
  192. case "groupCount":
  193. if (!(lessonRecord.groupCount <= item.val))
  194. {
  195. save = false;
  196. msg.Add($"{item.key}:{lessonRecord.groupCount}{item.type}{item.val}");
  197. }
  198. break;
  199. case "totalPoint":
  200. if (!(lessonRecord.totalPoint <= item.val))
  201. {
  202. save = false;
  203. msg.Add($"{item.key}:{lessonRecord.totalPoint}{item.type}{item.val}");
  204. }
  205. break;
  206. case "collateTaskCount":
  207. if (!(lessonRecord.collateTaskCount <= item.val))
  208. {
  209. save = false;
  210. msg.Add($"{item.key}:{lessonRecord.collateTaskCount}{item.type}{item.val}");
  211. }
  212. break;
  213. case "collateCount":
  214. if (!(lessonRecord.collateCount <= item.val))
  215. {
  216. save = false;
  217. msg.Add($"{item.key}:{lessonRecord.collateCount}{item.type}{item.val}");
  218. }
  219. break;
  220. case "pushCount":
  221. if (!(lessonRecord.pushCount <= item.val))
  222. {
  223. save = false;
  224. msg.Add($"{item.key}:{lessonRecord.pushCount}{item.type}{item.val}");
  225. }
  226. break;
  227. case "totalInteractPoint":
  228. if (!(lessonRecord.totalInteractPoint <= item.val))
  229. {
  230. save = false;
  231. msg.Add($"{item.key}:{lessonRecord.totalInteractPoint}{item.type}{item.val}");
  232. }
  233. break;
  234. case "interactionCount":
  235. if (!(lessonRecord.interactionCount <= item.val))
  236. {
  237. save = false;
  238. msg.Add($"{item.key}:{lessonRecord.interactionCount}{item.type}{item.val}");
  239. }
  240. break;
  241. case "clientInteractionCount":
  242. if (!(lessonRecord.clientInteractionCount <= item.val))
  243. {
  244. save = false;
  245. msg.Add($"{item.key}:{lessonRecord.clientInteractionCount}{item.type}{item.val}");
  246. }
  247. break;
  248. case "examQuizCount":
  249. if (!(lessonRecord.examQuizCount <= item.val))
  250. {
  251. save = false;
  252. msg.Add($"{item.key}:{lessonRecord.examQuizCount}{item.type}{item.val}");
  253. }
  254. break;
  255. case "examPointRate":
  256. if (!(lessonRecord.examPointRate <= item.val))
  257. {
  258. save = false;
  259. msg.Add($"{item.key}:{lessonRecord.examPointRate}{item.type}{item.val}");
  260. }
  261. break;
  262. }
  263. break;
  264. }
  265. }
  266. }
  267. }
  268. else {
  269. save = false;
  270. school_lesson_expire = Constant.school_lesson_expire;
  271. }
  272. if (!save && school_lesson_expire > 0)
  273. {
  274. // 1-时间戳,7-时间戳
  275. Dictionary<int, ExpireTag> result = new Dictionary<int, ExpireTag>();
  276. //暂定7天
  277. var now = DateTimeOffset.UtcNow;
  278. //剩余3天的通知
  279. //var day3= now.AddDays(school_lesson_expire - 3).ToUnixTimeMilliseconds();
  280. //result.Add(3, day3);
  281. //剩余1天的通知
  282. var day1 = now.AddDays(school_lesson_expire - (school_lesson_expire - 1)).ToUnixTimeMilliseconds();
  283. result.Add(1, new ExpireTag { expire= day1 ,tag= "notification" });
  284. //到期通知
  285. //不到五点上传的课例,七天之后直接删除。
  286. int addSecond = 0;
  287. if (now.Hour > 5)
  288. {
  289. // 到凌晨00点还差 (24 - now.Hour) *60 * 60 分钟,再加天数;
  290. addSecond = school_lesson_expire * 86400 + (24 - now.Hour) * 3600-(now.Hour* 3600);
  291. //再加 00到05小时内的 随机秒数
  292. Random rand = new Random();
  293. int randInt = rand.Next(0, 18000);
  294. addSecond += randInt;
  295. }
  296. else
  297. {
  298. addSecond = school_lesson_expire * 24 * 60 * 60;
  299. }
  300. lessonRecord.expire = now.AddSeconds(addSecond).ToUnixTimeMilliseconds();
  301. result.Add(school_lesson_expire, new ExpireTag { expire = lessonRecord.expire, tag = "delete" });
  302. // result.Add(school_lesson_expire, lessonRecord.expire);
  303. string biz = "expire";
  304. Notification notification = new Notification
  305. {
  306. hubName = "hita",
  307. type = "msg",
  308. from = $"ies5:{ Environment.GetEnvironmentVariable("Option:Location")}:private",
  309. to = new List<string> { tmdid },
  310. label = $"{biz}_lessonRecord",
  311. body = new
  312. {
  313. location = $"{Environment.GetEnvironmentVariable("Option:Location")}",
  314. biz = biz,
  315. tmdid = tmdid,
  316. tmdname = teacher.name,
  317. scope = scope,
  318. school = school,
  319. schoolName = schoolBase.name,
  320. sid = lessonRecord.id,
  321. sname = lessonRecord.name,
  322. stime = lessonRecord.startTime,
  323. expire = lessonRecord.expire,
  324. status = 1,
  325. //day = school_lesson_expire,
  326. time = now
  327. }.ToJsonString(),
  328. expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
  329. };
  330. var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
  331. var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
  332. var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
  333. var location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
  334. await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //站内发送消息
  335. var table = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
  336. List<ChangeRecord> records = await table.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", lessonRecord.id } });
  337. if (records.Count <= 0)
  338. {
  339. foreach (var item in result)
  340. {
  341. string PartitionKey = string.Format("{0}{1}{2}", lessonRecord.code, "-", $"expire-{item.Key}");
  342. //课堂的id ,
  343. //课堂的通知时间类型progress, 默认就会发送一条,到期前一天发送一条,最后已到期发送一条。
  344. var message = new ServiceBusMessage(new
  345. {
  346. id = lessonRecord.id,
  347. progress = item.Key,
  348. code = lessonRecord.code,
  349. scope = lessonRecord.scope,
  350. school = lessonRecord.school,
  351. opt = "delete",
  352. expire = lessonRecord.expire,
  353. tmdid = tmdid,
  354. tmdname = teacher.name,
  355. name = lessonRecord.name,
  356. startTime = lessonRecord.startTime,
  357. tag = item.Value.tag
  358. }.ToJsonString());
  359. message.ApplicationProperties.Add("name", "LessonRecordExpire");
  360. long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), message, DateTimeOffset.FromUnixTimeMilliseconds(item.Value.expire));
  361. ChangeRecord changeRecord = new ChangeRecord
  362. {
  363. RowKey = lessonRecord.id,
  364. PartitionKey = PartitionKey,
  365. sequenceNumber = start,
  366. msgId = message.MessageId
  367. };
  368. await table.Save<ChangeRecord>(changeRecord);
  369. }
  370. }
  371. }
  372. else {
  373. if (lessonRecord.expire > 0)
  374. {
  375. var table = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
  376. List<ChangeRecord> records = await table.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", lessonRecord.id } });
  377. foreach (var record in records)
  378. {
  379. try
  380. {
  381. await table.DeleteSingle<ChangeRecord>(record.PartitionKey, record.RowKey);
  382. await _serviceBus.GetServiceBusClient().CancelMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), record.sequenceNumber);
  383. }
  384. catch (Exception)
  385. {
  386. continue;
  387. }
  388. }
  389. }
  390. lessonRecord.save = 1;
  391. lessonRecord.expire = -1;
  392. }
  393. }
  394. }
  395. public record ExpireTag {
  396. public long expire { get; set; }
  397. public string tag { get; set; }
  398. }
  399. /// <summary>
  400. ///
  401. /// </summary>
  402. /// <param name="client"></param>
  403. /// <param name="_dingDing"></param>
  404. /// <param name="data"></param>
  405. /// <returns></returns>
  406. public static LessonDis DisLessonCount(LessonRecord oldRecord, LessonRecord newRecord, LessonDis lessonDis)
  407. {
  408. //创建课堂的情况
  409. if (oldRecord == null && newRecord != null)
  410. {
  411. lessonDis.record = 1;
  412. }
  413. //删除数据的情况
  414. /*else if (oldRecord != null && newRecord == null)
  415. {
  416. lessonDis.record = -1;
  417. //P分数量加减
  418. if (oldRecord.pScore >= 70)
  419. {
  420. lessonDis.disPCount = -1;
  421. }
  422. //T分数量加减
  423. if (oldRecord.tScore >= 70)
  424. {
  425. lessonDis.disTCount = -1;
  426. }
  427. if (oldRecord.tScore >= 70 && oldRecord.pScore >= 70)
  428. {
  429. lessonDis.disTCount = -1;
  430. }
  431. }*/
  432. //无效操作
  433. else if (oldRecord == null && newRecord == null)
  434. {
  435. }
  436. //前后操作都有值,则表示更新
  437. else
  438. {
  439. //P分数量加减
  440. if (oldRecord.pScore >= 70)
  441. {
  442. if (newRecord.pScore < 70)
  443. {
  444. lessonDis.disPCount = -1;
  445. }
  446. }
  447. else
  448. {
  449. if (newRecord.pScore >= 70)
  450. {
  451. lessonDis.disPCount = 1;
  452. }
  453. }
  454. //T分数量加减
  455. if (oldRecord.tScore >= 70)
  456. {
  457. if (newRecord.tScore < 70)
  458. {
  459. lessonDis.disTCount = -1;
  460. }
  461. }
  462. else
  463. {
  464. if (newRecord.tScore >= 70)
  465. {
  466. lessonDis.disTCount = 1;
  467. }
  468. }
  469. //双绿灯数量
  470. if (oldRecord.tScore >= 70 && oldRecord.pScore >= 70)
  471. {
  472. if (newRecord.tScore < 70 || newRecord.pScore < 70)
  473. {
  474. lessonDis.disDCount = -1;
  475. }
  476. }
  477. else
  478. {
  479. if (newRecord.tScore >= 70 && newRecord.pScore >= 70)
  480. {
  481. lessonDis.disDCount = 1;
  482. }
  483. }
  484. }
  485. return lessonDis;
  486. }
  487. public static LessonDis DisLessonCount_2(LessonRecord oldRecord, LessonRecord newRecord, LessonDis lessonDis)
  488. {
  489. //创建课堂的情况
  490. if (oldRecord == null && newRecord != null)
  491. {
  492. lessonDis.record = 1;
  493. //P分数量加减
  494. if (newRecord.pScore >= 70)
  495. {
  496. lessonDis.disPCount = 1;
  497. }
  498. //T分数量加减
  499. if (newRecord.tScore >= 70)
  500. {
  501. lessonDis.disTCount = 1;
  502. }
  503. //双绿灯数量
  504. if (newRecord.tScore >= 70 && newRecord.pScore >= 70)
  505. {
  506. lessonDis.disDCount = 1;
  507. }
  508. }
  509. return lessonDis;
  510. }
  511. public static async Task FixLessonCount(CosmosClient client, DingDing _dingDing, LessonRecord record, LessonRecord oldRecord, LessonDis lessonDis)
  512. {
  513. LessonRecord data = null;
  514. try
  515. {
  516. if (record != null && oldRecord == null)
  517. {
  518. data = record;
  519. }
  520. if (record == null && oldRecord != null)
  521. {
  522. data = oldRecord;
  523. }
  524. if (record != null && oldRecord != null)
  525. {
  526. data = record;
  527. }
  528. int day = DateTimeOffset.FromUnixTimeMilliseconds(data.startTime).DayOfYear;
  529. int year = DateTimeOffset.FromUnixTimeMilliseconds(data.startTime).Year;
  530. int days = DateTimeHelper.getDays(year);
  531. //int years = DateTimeOffset.UtcNow.DayOfYear;
  532. string tbname = string.Empty;
  533. string code = string.Empty;
  534. if (data.scope != null && data.scope.Equals("school"))
  535. {
  536. if (string.IsNullOrEmpty(data.periodId))
  537. {
  538. code = $"LessonCount-{data.school}-{year}";
  539. tbname = "School";
  540. }
  541. else {
  542. code = $"LessonCount-{data.school}-{year}-{data.periodId}";
  543. tbname = "School";
  544. }
  545. }
  546. else
  547. {
  548. code = $"LessonCount-{year}";
  549. tbname = "Teacher";
  550. }
  551. var response = await client.GetContainer(Constant.TEAMModelOS, tbname).ReadItemStreamAsync(data.tmdid.ToString(), new PartitionKey(code));
  552. if (response.Status == 200)
  553. {
  554. using var json = await JsonDocument.ParseAsync(response.ContentStream);
  555. LessonCount count = json.ToObject<LessonCount>();
  556. count.tCount[day - 1] += lessonDis.disTCount;
  557. count.pCount[day - 1] += lessonDis.disPCount;
  558. count.ptCount[day - 1] += lessonDis.disDCount;
  559. count.beginCount[day - 1] += lessonDis.record;
  560. await client.GetContainer("TEAMModelOS", tbname).ReplaceItemAsync(count, count.id, new PartitionKey(code));
  561. }
  562. else
  563. {
  564. LessonCount count = new LessonCount
  565. {
  566. id = data.tmdid,
  567. code = code,
  568. ttl = -1
  569. };
  570. double[] da = new double[days];
  571. List<double> list = new (da);
  572. List<double> listT = new (da);
  573. List<double> listP = new (da);
  574. List<double> listPT = new (da);
  575. list[day - 1] += lessonDis.record;
  576. listT[day - 1] += lessonDis.disTCount;
  577. listP[day - 1] += lessonDis.disPCount;
  578. listPT[day - 1] += lessonDis.disDCount;
  579. count.beginCount.AddRange(list);
  580. count.tCount.AddRange(listT);
  581. count.pCount.AddRange(listP);
  582. count.ptCount.AddRange(listPT);
  583. //count.courseIds.Add(data.courseId);
  584. await client.GetContainer("TEAMModelOS", tbname).CreateItemAsync(count, new PartitionKey(code));
  585. }
  586. }
  587. catch (Exception ex)
  588. {
  589. await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-LessonCount-FixLessonCount\n{ex.Message}\n{ex.StackTrace}{data.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
  590. }
  591. }
  592. }
  593. }