|
@@ -20,6 +20,7 @@ using TEAMModelOS.Services.Common;
|
|
using TEAMModelOS.SDK.Models.Service;
|
|
using TEAMModelOS.SDK.Models.Service;
|
|
using HTEXLib.COMM.Helpers;
|
|
using HTEXLib.COMM.Helpers;
|
|
using System.Text;
|
|
using System.Text;
|
|
|
|
+using static TEAMModelOS.SDK.Models.Teacher;
|
|
|
|
|
|
namespace TEAMModelFunction
|
|
namespace TEAMModelFunction
|
|
{
|
|
{
|
|
@@ -65,14 +66,14 @@ namespace TEAMModelFunction
|
|
var members = yxtrain.SelectMany(x => x.members).ToList();
|
|
var members = yxtrain.SelectMany(x => x.members).ToList();
|
|
if (members.IsNotEmpty()) {
|
|
if (members.IsNotEmpty()) {
|
|
queryText = new StringBuilder($"SELECT distinct value(c) FROM c where c.type='yxtrain' " +
|
|
queryText = new StringBuilder($"SELECT distinct value(c) FROM c where c.type='yxtrain' " +
|
|
- $"and c.id in ({string.Join(",",members.Select(x=>$"'{x.id}'"))}) ");
|
|
|
|
|
|
+ $"and c.id in ({string.Join(",", members.Select(x => $"'{x.id}'"))}) ");
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<TeacherTrain>(queryText: queryText.ToString(),
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<TeacherTrain>(queryText: queryText.ToString(),
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TeacherTrain-{school}") }))
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TeacherTrain-{school}") }))
|
|
{
|
|
{
|
|
trains.Add(item);
|
|
trains.Add(item);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
string sql = $" SELECT value(c) FROM c join a in c.binds where ARRAY_LENGTH(c.binds)>0 and a.type='{config.config}' ";
|
|
string sql = $" SELECT value(c) FROM c join a in c.binds where ARRAY_LENGTH(c.binds)>0 and a.type='{config.config}' ";
|
|
List<Teacher> teachers = new List<Teacher>();
|
|
List<Teacher> teachers = new List<Teacher>();
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<Teacher>(queryText: sql,
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<Teacher>(queryText: sql,
|
|
@@ -80,13 +81,116 @@ namespace TEAMModelFunction
|
|
{
|
|
{
|
|
teachers.Add(item);
|
|
teachers.Add(item);
|
|
}
|
|
}
|
|
-
|
|
|
|
//5.3.1.12学员培训基本情况批量回写-UpdateTeacherListSituation
|
|
//5.3.1.12学员培训基本情况批量回写-UpdateTeacherListSituation
|
|
|
|
+ List<TeacherTrain> trains53112OK = new List<TeacherTrain>();
|
|
|
|
+
|
|
//5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
|
|
//5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
|
|
|
|
+ List<TeacherTrain> trains53113OK = new List<TeacherTrain>();
|
|
|
|
+
|
|
//5.3.1.17学员课堂实录批量回写-UploadKTSLList
|
|
//5.3.1.17学员课堂实录批量回写-UploadKTSLList
|
|
|
|
+ List<TeacherTrain> trains53117OK = new List<TeacherTrain>();
|
|
|
|
+
|
|
//5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
|
|
//5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
|
|
|
|
+ List<TeacherTrain> trains53122OK = new List<TeacherTrain>();
|
|
|
|
+
|
|
|
|
+ List<KeyValuePair<TeacherTrain,string>> trainsNO = new List<KeyValuePair<TeacherTrain, string>>();
|
|
|
|
+ List<PushFail> fails= new List<PushFail>();
|
|
|
|
+ trains.ForEach(x => {
|
|
|
|
+ var teacher = teachers.Find(t => t.id.Equals(x.id));
|
|
|
|
+ if (teacher == null)
|
|
|
|
+ {
|
|
|
|
+ fails.Add(new PushFail { tmdid = x.id, msgs = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("tmdid-unexistent", "账号不存在!") } });
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ List<KeyValuePair<string, string>> msgs = new List<KeyValuePair<string, string>>();
|
|
|
|
+ var binddata = teachers.Where(t => t.id.Equals(x.id)).SelectMany(z => z.binds)
|
|
|
|
+ .Where(d => d.data.IsNotEmpty()).SelectMany(d => d.data)
|
|
|
|
+ .Where(d => string.IsNullOrEmpty(d) && d.Contains(config.config) && d.Contains(config.path));
|
|
|
|
+ if (binddata != null && binddata.Count() > 0)
|
|
|
|
+ {
|
|
|
|
+ var bindData = binddata.First().ToObject<ScBindData>();
|
|
|
|
+ if (binddata != null)
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //如果没有找到绑定信息,则去blob查找。
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ //如果没有找到绑定信息,则去blob查找。
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
return new OkObjectResult(new { });
|
|
return new OkObjectResult(new { });
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public (int t53112OK, List<KeyValuePair<string, string>> msgs) check53112(TeacherTrain teacherTrain, List<KeyValuePair<string, string>> msgs)
|
|
|
|
+ {
|
|
|
|
+ //校验 基本情况是否满足
|
|
|
|
+ int t53112OK = 1;
|
|
|
|
+ if (teacherTrain.finalScore < 0)
|
|
|
|
+ {
|
|
|
|
+ msgs.Add(new KeyValuePair<string, string>("finalScore", $"最终评定结果参数:{teacherTrain.finalScore}"));
|
|
|
|
+ t53112OK = 0;
|
|
|
|
+ }
|
|
|
|
+ if (string.IsNullOrEmpty(teacherTrain.summary) || teacherTrain.summary.Length > 300)
|
|
|
|
+ {
|
|
|
|
+ string msg = string.IsNullOrEmpty(teacherTrain.summary) ? "未填写" : teacherTrain.summary.Length > 300 ? "字数超过300." : "";
|
|
|
|
+ msgs.Add(new KeyValuePair<string, string>("summary", $"教师培训总结:{msg}"));
|
|
|
|
+ t53112OK = 0;
|
|
|
|
+ }
|
|
|
|
+ if (teacherTrain.totalTime <= 0)
|
|
|
|
+ {
|
|
|
|
+ msgs.Add(new KeyValuePair<string, string>("totalTime", $"未获得学时:{teacherTrain.totalTime}"));
|
|
|
|
+ t53112OK = 0;
|
|
|
|
+ }
|
|
|
|
+ return (t53112OK, msgs);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public (int t53112OK, List<KeyValuePair<string, string>> msgs) check53113(TeacherTrain teacherTrain, List<KeyValuePair<string, string>> msgs)
|
|
|
|
+ {
|
|
|
|
+ //校验 基本情况是否满足
|
|
|
|
+ int t53112OK =1;
|
|
|
|
+ if (teacherTrain.finalScore < 0)
|
|
|
|
+ {
|
|
|
|
+ msgs.Add(new KeyValuePair<string, string>("finalScore", $"最终评定结果参数:{teacherTrain.finalScore}"));
|
|
|
|
+ t53112OK = 0;
|
|
|
|
+ }
|
|
|
|
+ if (string.IsNullOrEmpty(teacherTrain.summary) || teacherTrain.summary.Length>300)
|
|
|
|
+ {
|
|
|
|
+ string msg = string.IsNullOrEmpty(teacherTrain.summary) ? "未填写" : teacherTrain.summary.Length > 300 ? "字数超过300." : "";
|
|
|
|
+ msgs.Add(new KeyValuePair<string, string>("summary", $"教师培训总结:{msg}"));
|
|
|
|
+ t53112OK = 0;
|
|
|
|
+ }
|
|
|
|
+ if (teacherTrain.totalTime <= 0)
|
|
|
|
+ {
|
|
|
|
+ msgs.Add(new KeyValuePair<string, string>("totalTime", $"未获得学时:{teacherTrain.totalTime}"));
|
|
|
|
+ t53112OK = 0;
|
|
|
|
+ }
|
|
|
|
+ return (t53112OK, msgs);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public class PushFail {
|
|
|
|
+ public string tmdid { get; set; }
|
|
|
|
+ public string name { get; set; }
|
|
|
|
+ public string picture { get; set; }
|
|
|
|
+ public List<KeyValuePair<string,string>> msgs { get; set; }
|
|
|
|
+ }
|
|
|
|
+ public class ScPush{
|
|
|
|
+ public string tmdid { get; set; }
|
|
|
|
+ public string userid { get; set; }
|
|
|
|
+ public string pxid { get; set; }
|
|
|
|
+ public int tbase { get; set; } = -1;//基本信息推送状态 -1 未推送,0 推送失败,1推送成功
|
|
|
|
+ public int tability { get; set; } = -1;//能力点推送状态 -1 未推送,0 推送失败,1推送成功
|
|
|
|
+ public int tktsl { get; set; } = -1;//课堂实录推送状态 -1 未推送,0 推送失败,1推送成功
|
|
|
|
+ public int txbyx { get; set; } = -1;//校本研修推送状态 -1 未推送,0 推送失败,1推送成功
|
|
|
|
+ public string rbase { get; set; }//基本信息推送失败原因
|
|
|
|
+ public string rability { get; set; }//能力点推送失败原因
|
|
|
|
+ public string rktsl { get; set; }//课堂实录推送失败原因
|
|
|
|
+ public string rxbyx { get; set; } //校本研修推送失败原因
|
|
|
|
+ }
|
|
public class ScTchTmd{
|
|
public class ScTchTmd{
|
|
public string tmdid { get; set; }
|
|
public string tmdid { get; set; }
|
|
public string name { get; set; }
|
|
public string name { get; set; }
|
|
@@ -97,10 +201,85 @@ namespace TEAMModelFunction
|
|
public string pid { get; set; }
|
|
public string pid { get; set; }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 5.3.1.1获取项目列表
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="req"></param>
|
|
|
|
+ /// <param name="log"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [FunctionName("GetProjectInfoByTrainComID")]
|
|
|
|
+ public async Task<IActionResult> GetProjectInfoByTrainComID([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log)
|
|
|
|
+ {
|
|
|
|
+ List<ScProject> projects = null;
|
|
|
|
+ string data = await new StreamReader(req.Body).ReadToEndAsync();
|
|
|
|
+ JsonElement accessConfig = data.ToObject<JsonElement>().GetProperty("accessConfig");
|
|
|
|
+ ScAccessConfig config = $"{accessConfig}".ToObject<ScAccessConfig>();
|
|
|
|
+ Code = "GetProjectInfoByTrainComID";
|
|
|
|
+ parameterMap = new Dictionary<string, object>();
|
|
|
|
+ parameterMap.Add("TrainComID", config.trainComID);
|
|
|
|
+ ScsResult result = new ScsResult { code = Code, title = "5.3.1.1获取项目列表" };
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
|
|
|
|
+ if (result.result)
|
|
|
|
+ {
|
|
|
|
+ projects = result.content.ToObject<List<ScProject>>();
|
|
|
|
+ }
|
|
|
|
+ return new OkObjectResult(new { data = projects.ToJsonString() });
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
|
|
+ await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetProjectInfoByTrainComID\n{ex.Message}{ex.StackTrace}\n{result.ToJsonString()}", GroupNames.成都开发測試群組);
|
|
|
|
+ return new OkObjectResult(projects);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 5.3.1.19获取项目设置的可选能力点
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="req"></param>
|
|
|
|
+ /// <param name="log"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [FunctionName("GetProjectDiagnosis")]
|
|
|
|
+ public async Task<IActionResult> GetProjectDiagnosis([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log)
|
|
|
|
+ {
|
|
|
|
+ List<ScsProjectDiagnosis> projects = new List<ScsProjectDiagnosis> () ;
|
|
|
|
+ string data = await new StreamReader(req.Body).ReadToEndAsync();
|
|
|
|
+ JsonElement accessConfig = data.ToObject<JsonElement>().GetProperty("accessConfig");
|
|
|
|
+ ScAccessConfig config = $"{accessConfig}".ToObject<ScAccessConfig>();
|
|
|
|
+ Code = "GetProjectInfoByTrainComID";
|
|
|
|
+ parameterMap = new Dictionary<string, object>();
|
|
|
|
+ parameterMap.Add("TrainComID", config.trainComID);
|
|
|
|
+ List<ScsResult> results = new List<ScsResult>();
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ if (config.p.IsNotEmpty()) {
|
|
|
|
+ foreach (var ps in config.p)
|
|
|
|
+ {
|
|
|
|
+ List<ScPDiagnosis> diagnoses= new List<ScPDiagnosis> ();
|
|
|
|
+ ScsResult result = new ScsResult { code = Code, title = "5.3.1.19获取项目设置的可选能力点" };
|
|
|
|
+ result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
|
|
|
|
+ if (result.result)
|
|
|
|
+ {
|
|
|
|
+ diagnoses = result.content.ToObject<List<ScPDiagnosis>>();
|
|
|
|
+ if (diagnoses.IsNotEmpty()) {
|
|
|
|
+ projects.Add(new ScsProjectDiagnosis { project = ps, diagnoses = diagnoses });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ results.Add(result);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return new OkObjectResult(new { data = projects.ToJsonString() });
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
|
|
+ await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetProjectInfoByTrainComID\n{ex.Message}{ex.StackTrace}\n{results.ToJsonString()}", GroupNames.成都开发測試群組);
|
|
|
|
+ return new OkObjectResult(projects);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- ///
|
|
|
|
|
|
+ /// 5.3.1.3通过项目编号获取学员测评能力项V2
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="req"></param>
|
|
/// <param name="req"></param>
|
|
/// <param name="log"></param>
|
|
/// <param name="log"></param>
|
|
@@ -115,8 +294,6 @@ namespace TEAMModelFunction
|
|
Code = "GetDiagnosisListByProject_V2";
|
|
Code = "GetDiagnosisListByProject_V2";
|
|
parameterMap = new Dictionary<string, object>();
|
|
parameterMap = new Dictionary<string, object>();
|
|
parameterMap.Add("TrainComID", config.trainComID);
|
|
parameterMap.Add("TrainComID", config.trainComID);
|
|
- //parameterMap.Add("ProjectID", "22");
|
|
|
|
- //parameterMap.Add("ProjectItemID", "22");
|
|
|
|
parameterMap.Add("PXID", pxid);
|
|
parameterMap.Add("PXID", pxid);
|
|
ScsResult result = new ScsResult { code = Code, title = "5.3.1.3通过项目编号获取学员测评能力项V2" };
|
|
ScsResult result = new ScsResult { code = Code, title = "5.3.1.3通过项目编号获取学员测评能力项V2" };
|
|
try
|
|
try
|