|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
using static Tiobon.Core.Model.Consts; |
|
|
|
|
using Serilog; |
|
|
|
|
using static Tiobon.Core.Model.Consts; |
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
|
|
|
|
|
@ -588,4 +589,67 @@ FROM (SELECT A.*, |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 牛尾培训讲师同步 |
|
|
|
|
public async Task Ushio_Sync() |
|
|
|
|
{ |
|
|
|
|
Log.Information($"【牛尾培训讲师同步】开始同步"); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
string sql = @"SELECT A.SchoolId,
|
|
|
|
|
b.DeptID, |
|
|
|
|
C.StaffId, |
|
|
|
|
A.TeacherType, |
|
|
|
|
A.TeacherNo, |
|
|
|
|
A.TeacherName, |
|
|
|
|
A.PhotoUrl, |
|
|
|
|
A.Gender, |
|
|
|
|
A.Email, |
|
|
|
|
A.Mobile, |
|
|
|
|
A.TeacherLevel, |
|
|
|
|
A.Price, |
|
|
|
|
A.SkillPoints, |
|
|
|
|
A.ApplyReason, |
|
|
|
|
C.StaffId SponsorId,A.WorkNo |
|
|
|
|
FROM [120.26.205.42].[GhrUshio].[dbo].Ushio_TrainTeacher A |
|
|
|
|
LEFT JOIN Ghro_Dept B ON A.DeptNo = B.DeptNo |
|
|
|
|
LEFT JOIN Ghra_Staff C ON A.TeacherNo = C.StaffNo |
|
|
|
|
LEFT JOIN Ghra_Staff D ON A.ApplyStaffNo = D.StaffNo |
|
|
|
|
WHERE WorkNo NOT IN (SELECT WorkNo |
|
|
|
|
FROM Ghre_Teacher |
|
|
|
|
WHERE WorkNo IS NOT NULL)";
|
|
|
|
|
|
|
|
|
|
var dt = await Db.Ado.GetDataTableAsync(sql); |
|
|
|
|
|
|
|
|
|
var list = Db.Utilities.DataTableToList<Ghre_TeacherDto>(dt); |
|
|
|
|
|
|
|
|
|
Log.Information($"【牛尾培训讲师同步】查询到待同步{list.Count}条数据"); |
|
|
|
|
for (int i = 0; i < list.Count; i++) |
|
|
|
|
{ |
|
|
|
|
Log.Information($"【牛尾培训讲师同步】同步队列{i + 1}/{list.Count}"); |
|
|
|
|
|
|
|
|
|
var insert = Mapper.Map(list[i]).ToANew<InsertGhre_TeacherInput>(); |
|
|
|
|
|
|
|
|
|
if (await base.AnyAsync(x => x.WorkNo == insert.WorkNo)) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
if (insert.SchoolId == 0) insert.SchoolId = null; |
|
|
|
|
|
|
|
|
|
var id = await base.Add(insert); |
|
|
|
|
|
|
|
|
|
sql = $"SELECT ISNULL(MAX(id)+1,1) FROM Ghre_Teacher WHERE Id !='{id}'"; |
|
|
|
|
var id1 = await Db.Ado.GetLongAsync(sql); |
|
|
|
|
sql = $"UPDATE Ghre_Teacher SET Id={id1} WHERE Id ='{id}'"; |
|
|
|
|
await Db.Ado.ExecuteCommandAsync(sql); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (Exception E) |
|
|
|
|
{ |
|
|
|
|
Log.Information($"【牛尾培训讲师同步】发生错误:{E.Message}"); |
|
|
|
|
Log.Information($"【牛尾培训讲师同步】发生错误行:{E.StackTrace}"); |
|
|
|
|
} |
|
|
|
|
Log.Information($"【牛尾培训讲师同步】结束同步"); |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
} |