|
@@ -30,12 +30,14 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
private readonly SnowflakeId _snowflakeId;
|
|
|
private readonly DingDing _dingDing;
|
|
|
private readonly Option _option;
|
|
|
- public AbilityStatisticsController(AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option)
|
|
|
+ private readonly ThirdApisService _thirdApisService;
|
|
|
+ public AbilityStatisticsController(AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, ThirdApisService thirdApisService)
|
|
|
{
|
|
|
_azureCosmos = azureCosmos;
|
|
|
_snowflakeId = snowflakeId;
|
|
|
_dingDing = dingDing;
|
|
|
- _option = option?.Value; ;
|
|
|
+ _option = option?.Value;
|
|
|
+ _thirdApisService = thirdApisService;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 对某个订阅的能力点进行操作
|
|
@@ -505,6 +507,43 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+ else if (other.roleType.Equals("leader"))
|
|
|
+ {
|
|
|
+ //学校的身份不管是谁,只能以学校的身份进行一次评论
|
|
|
+ abilitySub.allDone = true;
|
|
|
+ var otherScore = abilitySub.otherScore.Find(x => x.roleType.Equals(other.roleType));
|
|
|
+ if (otherScore != null)
|
|
|
+ {
|
|
|
+ otherScore.tmdname = other.tmdname;
|
|
|
+ otherScore.score = other.score;
|
|
|
+ if (!string.IsNullOrEmpty(replyId))
|
|
|
+ {
|
|
|
+ if (otherScore.replyIds.IsNotEmpty())
|
|
|
+ {
|
|
|
+ otherScore.replyIds.Add(replyId);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ otherScore.replyIds = new List<string>() { replyId };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ otherScore.scoreUploads = other.scoreUploads;
|
|
|
+ otherScore.time = nowTime;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ abilitySub.otherScore.Add(new OtherScore
|
|
|
+ {
|
|
|
+ roleType = other.roleType,
|
|
|
+ tmdid = other.tmdid,
|
|
|
+ tmdname = other.tmdname,
|
|
|
+ score = other.score,
|
|
|
+ replyIds = new List<string>() { replyId },
|
|
|
+ scoreUploads = other.scoreUploads,
|
|
|
+ time = nowTime
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
//其他身份的同一个人可以以不同身份进行点评
|
|
@@ -1238,7 +1277,7 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
/// <returns></returns>
|
|
|
[ProducesDefaultResponseType]
|
|
|
[HttpPost("get-group-subs")]
|
|
|
- [AuthToken(Roles = "teacher,student,admin,area")]
|
|
|
+ [AuthToken(Roles = "teacher,admin,area")]
|
|
|
public async Task<IActionResult> GetGroupSubs(JsonElement request)
|
|
|
{
|
|
|
try
|
|
@@ -1286,14 +1325,12 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
ids.Add("default");
|
|
|
}
|
|
|
(List<RMember> tmdInfos, List<RGroupList> classInfos) = await GroupListService.GetStutmdidListids(client, _dingDing, ids, $"{_school}");
|
|
|
- // (List<TmdInfo> tmdInfos, List<ClassListInfo> classInfos) = await TriggerStuActivity.GetTchList(client, _dingDing, ids, $"{school}");
|
|
|
- //(List<TmdInfo> tmdInfos, List<ClassListInfo> classInfos) = await TriggerStuActivity.GetTchList(client, _dingDing, ids, $"{_school}");
|
|
|
List<GroupMember> teachers = new List<GroupMember>();
|
|
|
foreach (var classInfo in classInfos)
|
|
|
{
|
|
|
foreach (var tmdinfo in classInfo.members)
|
|
|
{
|
|
|
- teachers.Add(new GroupMember { groupId = classInfo.id, groupName = classInfo.name, tmdid = tmdinfo.id, tmdname = tmdinfo.name, picture = tmdinfo.picture });
|
|
|
+ teachers.Add(new GroupMember { groupId = classInfo.id, groupName = classInfo.name, tmdid = tmdinfo.id, tmdname = tmdinfo.name, picture = tmdinfo.picture ,tag=tmdinfo.tag});
|
|
|
}
|
|
|
}
|
|
|
if ($"{_all}".Equals("1"))
|
|
@@ -1335,54 +1372,19 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
}
|
|
|
catch (CosmosException ex) { }
|
|
|
}
|
|
|
- //foreach (var comid in comids)
|
|
|
- //{
|
|
|
- // try
|
|
|
- // {
|
|
|
- // Debate debate = await _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "School").ReadItemAsync<Debate>(comid, new PartitionKey($"Debate-{school}"));
|
|
|
- // debates.Add(debate);
|
|
|
- // }
|
|
|
- // catch (CosmosException ex)
|
|
|
- // {
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- //}
|
|
|
- // List<DebateReply> debateReplies = debates.SelectMany(x => x.replies).ToList();
|
|
|
- //groupMembers.ForEach(groupMember =>
|
|
|
- //{
|
|
|
- // groupMember.sub.otherScore.ForEach(y =>
|
|
|
- // {
|
|
|
- // List<string> replyIds = new List<string>();
|
|
|
- // y.replyIds.ForEach(reply =>
|
|
|
- // {
|
|
|
- // if (reply != null)
|
|
|
- // {
|
|
|
- // DebateReply replies = debateReplies.Find(x => reply.Equals(x.id));
|
|
|
- // if (replies != null)
|
|
|
- // {
|
|
|
- // replyIds.Add(replies.comment);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // });
|
|
|
- // y.replyIds = replyIds;
|
|
|
- // });
|
|
|
-
|
|
|
- //});
|
|
|
return Ok(new { groupMembers, abilities });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- var teacer = teachers.Find(x => x.tmdid.Equals($"{_tmdid}"));
|
|
|
+ var teacer = teachers.FindAll(x => x.tmdid.Equals($"{_tmdid}"));
|
|
|
if (teacer != null)
|
|
|
{
|
|
|
- //List<Debate> debates = new List<Debate>();
|
|
|
List<SubGroupMember> groupMembers = new List<SubGroupMember>();
|
|
|
- // HashSet<string> comids = new HashSet<string>();
|
|
|
- var tecs = teachers.Where(x => x.groupId.Equals(teacer.groupId)).ToList();
|
|
|
+ var tecs = teachers.Where(x => teacer.Select(y=>y.groupId).Contains(x.groupId)).ToList();
|
|
|
foreach (var t in tecs)
|
|
|
{
|
|
|
- //排除自己
|
|
|
- if (t.tmdid.Equals($"{_tmdid}")) { continue; }
|
|
|
+ //排除自己,如果不是组长则不排除
|
|
|
+ if (t.tmdid.Equals($"{_tmdid}")&&string.IsNullOrEmpty(t.tag)) { continue; }
|
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
|
|
|
.GetItemQueryIterator<AbilitySub>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilitySub-{school}-{t.tmdid}") }))
|
|
|
{
|
|
@@ -1401,43 +1403,11 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
otherScore = item.otherScore,
|
|
|
comid = item.comid,
|
|
|
self = item.self
|
|
|
- }
|
|
|
+ },
|
|
|
+ tag=t.tag
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- //foreach (var comid in comids)
|
|
|
- //{
|
|
|
- // try
|
|
|
- // {
|
|
|
- // Debate debate = await _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "School").ReadItemAsync<Debate>(comid, new PartitionKey($"Debate-{school}"));
|
|
|
- // debates.Add(debate);
|
|
|
- // }
|
|
|
- // catch (CosmosException ex)
|
|
|
- // {
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- //}
|
|
|
- //List<DebateReply> debateReplies = debates.SelectMany(x => x.replies).ToList();
|
|
|
- //groupMembers.ForEach(groupMember =>
|
|
|
- //{
|
|
|
- // groupMember.sub.otherScore.ForEach(y =>
|
|
|
- // {
|
|
|
- // List<string> replyIds = new List<string>();
|
|
|
- // y.replyIds.ForEach(reply =>
|
|
|
- // {
|
|
|
- // if (reply != null)
|
|
|
- // {
|
|
|
- // DebateReply replies = debateReplies.Find(x => reply.Equals(x.id));
|
|
|
- // if (replies != null)
|
|
|
- // {
|
|
|
- // replyIds.Add(replies.comment);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // });
|
|
|
- // y.replyIds = replyIds;
|
|
|
- // });
|
|
|
-
|
|
|
- //});
|
|
|
return Ok(new { groupMembers, abilities });
|
|
|
}
|
|
|
else
|
|
@@ -1468,6 +1438,7 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
public string picture { get; set; }
|
|
|
public string groupName { get; set; }
|
|
|
public string groupId { get; set; }
|
|
|
+ public string tag { get; set; }
|
|
|
}
|
|
|
public class SubGroupMember
|
|
|
{
|
|
@@ -1477,6 +1448,7 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
public string groupName { get; set; }
|
|
|
public string groupId { get; set; }
|
|
|
public SubGroup sub { get; set; }
|
|
|
+ public string tag { get; set; }
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 保存
|
|
@@ -1570,7 +1542,7 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
List<AbilitySub> rcdSubs = new List<AbilitySub>();
|
|
|
//必修
|
|
|
List<Ability> currencyAb1 = new List<Ability>();
|
|
|
- //选修
|
|
|
+ //通识
|
|
|
List<Ability> currencyAb2 = new List<Ability>();
|
|
|
//tmdid
|
|
|
if (!request.TryGetProperty("tmdid", out JsonElement tmdid)) return Ok(new { error = 400 });
|
|
@@ -1617,28 +1589,19 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
else {
|
|
|
return Ok(new { error = 400 });
|
|
|
};
|
|
|
-
|
|
|
- Area area = null;
|
|
|
- try
|
|
|
- {
|
|
|
- client.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Area>($"", requestOptions:new QueryRequestOptions { PartitionKey=new PartitionKey("Base-Area") });
|
|
|
- }
|
|
|
- catch (CosmosException ex)
|
|
|
- {
|
|
|
- return Ok(new { error = 404, msg = "区域不存在!" });
|
|
|
- }
|
|
|
- AreaSetting setting = null;
|
|
|
- if (area != null)
|
|
|
- {
|
|
|
- try
|
|
|
+ (string accessConfig, Area area, AreaSetting setting) = await ThirdService.GetAccessConfig(client, $"{standard}");
|
|
|
+ //未对接其他平台。有对接其他平台则必修。
|
|
|
+ if (!string.IsNullOrEmpty(accessConfig)) {
|
|
|
+ var abilitys = await ThirdService.GetDiagnosisList(client, $"{standard}", _dingDing, setting, _thirdApisService, $"PXID");
|
|
|
+ if (abilitys != null)
|
|
|
{
|
|
|
- setting = await client.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<AreaSetting>(area.id, new PartitionKey("AreaSetting"));
|
|
|
+ abilitys.ForEach(x => { x.currency = 1; });
|
|
|
}
|
|
|
- catch (CosmosException)
|
|
|
- {
|
|
|
- return Ok(new { error = 404, msg = "设置不存在!" });
|
|
|
+ else {
|
|
|
+ currencyAb1 = null;
|
|
|
}
|
|
|
}
|
|
|
+ //通识
|
|
|
foreach (var item in currencyAb2) {
|
|
|
var had = hadSubs.Where(x => x.id.Equals(item.id)).FirstOrDefault();
|
|
|
if (had == null) {
|
|
@@ -1657,6 +1620,7 @@ namespace TEAMModelOS.Controllers.Research
|
|
|
await _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher").CreateItemAsync(abilitySub, new PartitionKey(abilitySub.code));
|
|
|
}
|
|
|
}
|
|
|
+ //必修
|
|
|
foreach (var item in currencyAb1)
|
|
|
{
|
|
|
var had = hadSubs.Where(x => x.id.Equals(item.id)).FirstOrDefault();
|