@@ -78,8 +78,8 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
var login_res_str = HttpMethods.Get(login_url);
var login_res = JsonConvert.DeserializeObject<InsResult>(login_res_str);
var login_data = login_res.data;
_redis.Write($"access_token", ((dynamic)login_data)?.access_token, TimeSpan.FromSeconds(25 0));
_redis.Write($"client_secret", ((dynamic)login_data)?.client_secret, TimeSpan.FromSeconds(17 0000));
_redis.Write($"access_token", ((dynamic)login_data)?.access_token, TimeSpan.FromSeconds(20 0));
_redis.Write($"client_secret", ((dynamic)login_data)?.client_secret, TimeSpan.FromSeconds(16 0000));
_redis.Write($"refresh_token", ((dynamic)login_data)?.refresh_token, TimeSpan.FromSeconds(250));
}
/// <summary>
@@ -101,7 +101,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
login();
return;
}
_redis.Write($"access_token", ((dynamic)refresh_res)?.access_token, TimeSpan.FromSeconds(25 0));
_redis.Write($"access_token", ((dynamic)refresh_res)?.access_token, TimeSpan.FromSeconds(20 0));
_redis.Write($"refresh_token", ((dynamic)refresh_res)?.refresh_token, TimeSpan.FromSeconds(250));
}
/// <summary>
@@ -494,6 +494,61 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
}
}
}
/// <summary>
/// 教师资质证书
/// </summary>
public void SyncTeacherQualifications()
{
try
{
//校区信息
var company = this.BaseRepository().FindList<CompanyEntity>(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault();
//教师数据
var teacherTrain = this.BaseRepository("CollegeMIS").FindList<TeacherQualificationsEntity>($@"select min(empid) as gzzyqksjid,count(1) as jszgzrs, sum(case when JobRank in (1,2,3,4) then 1 else 0 end) as gjzcrs,
sum(case when JobRank in (5,6,7,8) then 1 else 0 end) as zjzcrs,
sum(case when JobRank not in (1,2,3,4,5,6,7,8) then 1 else 0 end) as cjzcrs
from empinfo ");
ParamModel paramModel = new ParamModel();
paramModel.dataObjName = "ods_zzzssj";
var list = new List<object>();
foreach (var data in teacherTrain)
{
var param = new
{
gzzyqksjid = company.F_CompanyId,// data.gzzyqksjid,
xxjgdm = company.F_USCreditCode,
xxjgmc = company.F_FullName,
jszgzrs = data.jszgzrs,
gjzcrs = data.gjzcrs,
zjzcrs = data.zjzcrs,
cjzcrs = data.cjzcrs,
sjcjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")
};
list.Add(param);
}
paramModel.fileds = list;
var json = JsonConvert.SerializeObject(paramModel);
var connect = _redis.Read<string>("access_token");
connect = (connect).Replace("\"", "");
var res = HttpMethods.HttpPostConnect(saveIncrUrl, json, connect);
}
catch (ExceptionEx ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion
#region MyRegion
@@ -511,6 +566,15 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop
public List<object> fileds { get; set; }
}
public class TeacherQualificationsEntity
{
public string gzzyqksjid { get; set; }
public int jszgzrs { get; set; }
public int gjzcrs { get; set; }
public int zjzcrs { get; set; }
public int cjzcrs { get; set; }
}
#endregion
}
}