conn.Execute($"insert into StuEnrollInvoiceRecord(Id,YearNo,StuNo,billNo,random,billStatus) values('{recordId}','{orderEntity.YearNo}','{orderEntity.StuNo}','{eBillNo}','{checkCode}','1')");
//查询票据url
var invoiceobj = new { billBatchCode = eBillCode, billNo = eBillNo, random = checkCode, channelMode = "1" };
var datainvoice = Convert.ToBase64String(encoding.GetBytes(JsonConvert.SerializeObject(invoiceobj)));
List<V_ZYXX> zyxx = conn_oracle.Query<V_ZYXX>("select * from V_ZYXX").ToList();
//课程信息
List<V_KCXX> kcxx = conn_oracle.Query<V_KCXX>("select * from V_KCXX").ToList();
//教师
List<V_JSXX> jsxx = conn_oracle.Query<V_JSXX>("select * from V_JSXX").ToList();
//行政班级表
List<V_BJXX> bjxx = conn_oracle.Query<V_BJXX>("select * from V_BJXX").ToList();
//教室组织机构
List<V_JS_ZZJG> zzjg = conn_oracle.Query<V_JS_ZZJG>("select * from V_JS_ZZJG").ToList();
//学生信息
List<V_XSXX> xsxx = conn_oracle.Query<V_XSXX>("select * from V_XSXX").ToList();
//记录获取数据条数
using (IDbConnection conncore = new SqlConnection(_coresqlConnection))
{
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库专业数据','获取oracle专业数据共{zyxx.Count()}条',getdate())");
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库课程数据','获取oracle课程数据共{kcxx.Count()}条',getdate())");
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库教师数据','获取oracle教师数据共{jsxx.Count()}条',getdate())");
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库班级数据','获取oracle班级数据共{bjxx.Count()}条',getdate())");
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库教室数据','获取oracle教室数据共{jsxx.Count()}条',getdate())");
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'中间库学生数据','获取oracle学生数据共{xsxx.Count()}条',getdate())");
}
#endregion
using (IDbConnection conncores = new SqlConnection(_sqlConnection))
{
#region 专业
//获取中间库数据
List<CdMajorModel> cdMajors = conncores.Query<CdMajorModel>("select * from CdMajor").ToList();
sb.Append($" where MajorNo='{item.CODE_ }' and MajorName='{item.NAME_}'");
unumMajor += conncores.Execute(sb.ToString());
}
else
{
int mysql = conncores.Execute($"insert into CdMajor(ID,MajorNo,MajorName,DeptNo,CheckMark,F_SchoolId,ZYFL_CODE,F_ORDER) values(newid(),'{item.CODE_}','{item.NAME_}','{item.PID}','{item.ISTRUE}','207fa1a9-160c-4943-a89b-8fa4db0547ce','{item.ZYFL_CODE}','{item.ORDER_}')");
anumMajor += mysql;
}
}
catch (Exception e)
{
conncores.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新专业数据','编号({item.CODE_}),姓名({item.NAME_})更新时出现异常:{e.Message}',getdate())");
}
}
}
else
{
}
//记录修改数据总数
conncores.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新专业数据','新增数据{anumMajor}条,修改数据{unumMajor}条,共计{anumMajor + unumMajor}条,获取数据{zyxx.Count()}',getdate())");
#endregion
#region 课程
List<LessonInfoModel> LessonInfos = conncores.Query<LessonInfoModel>("select * from lessoninfo").ToList();
int anumLesson = 0;
int unumlesson = 0;
foreach (var item in kcxx)
{
try
{
if (LessonInfos.Exists(x => x.LessonName == item.CODE_ && x.LessonNo == item.NAME_))
{
StringBuilder sb = new StringBuilder("update lessoninfo set ");
sb.Append($" where lessonno='{item.CODE_ }' and lessonName='{item.NAME_}'");
unumlesson += conncores.Execute(sb.ToString());
}
else
{
int mysql = conncores.Execute($"insert into LessonInfo(LessonId,LessonNo,LessonName,CheckMark,F_SchoolId,LessonSortNo,LessonSortDetailNo,LessonTypeId) values(newid(), '{item.CODE_}', '{item.NAME_}', '{item.ISTRUE}', '207fa1a9-160c-4943-a89b-8fa4db0547ce', '{item.COURSE_NATURE_CODE}', '{item.COURSE_ATTR_CODE}', '{item.COURSE_TYPE_CODE}')");
anumLesson += mysql;
}
}
catch (Exception e)
{
conncores.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新课程数据','编号({item.CODE_}),姓名({item.NAME_})更新时出现异常:{e.Message}',getdate())");
}
}
//记录修改数据总数
conncores.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新课程数据','新增数据{anumLesson}条,修改数据{unumlesson}条,共计{unumlesson + anumLesson}条,获取数据{kcxx.Count()}',getdate())");
#endregion
#region 教师信息
List<TeachModel> teachinfo = conncores.Query<TeachModel>("select * from empinfo").ToList();
int anumTeach = 0;
int unumTeach = 0;
foreach (var item in jsxx)
{
try
{
if (teachinfo.Exists(x => x.EmpNo == item.TEA_NO && x.EmpName == item.NAME_))
{
StringBuilder sb = new StringBuilder("update empinfo set ");
sb.Append($" where empno='{item.TEA_NO }' and empName='{item.NAME_}'");
unumlesson += conncores.Execute(sb.ToString());
}
else
{
int mysql = conncores.Execute($"insert into empinfo (empid,ZZJG_ID,F_DepartmentId,empNo,empName,Birthday,IdentityCardNo,mobile,DegreeNo,HighestRecord,CheckMark,F_CompanyId,BZLB_CODE,BZLX_CODE,IsInActiveStatus) values (newid(), '{item.ZZJG_ID}', '{item.DEPT_ID}', '{item.TEA_NO}', '{item.NAME_}', '{item.BIRTH_DATE}', '{item.IDNO}', '{item.PHONE}', '{item.EDU_ID}', '{item.DEGREE_ID}', '{item.IS_NORMAL}', '207fa1a9-160c-4943-a89b-8fa4db0547ce', '{item.BZLB_CODE}', '{item.BZLX_CODE}', '{item.TEA_STATUS_CODE}')");
anumLesson += mysql;
}
}
catch (Exception e)
{
conncores.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新教师数据','编号({item.TEA_NO}),姓名({item.NAME_})更新时出现异常:{e.Message}',getdate())");
}
}
//记录修改数据总数
conncores.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新教师数据','新增数据{anumTeach}条,修改数据{unumTeach}条,共计{unumTeach + anumTeach}条,获取数据{jsxx.Count()}',getdate())");
#endregion
#region 班级信息
List<ClassModel> classModels = conncores.Query<ClassModel>("select * from classinfo").ToList();
int anumClass = 0;
int unumClass = 0;
foreach (var item in bjxx)
{
try
{
if (classModels.Exists(x => x.ClassName == item.NAME_ && x.ClassNo == item.NO_))
{
StringBuilder sb = new StringBuilder("update classinfo set ");
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新教师数据','编号({item.NO_}),姓名({item.NAME_})更新时出现异常:{e.Message}',getdate())");
}
}
//记录修改数据总数
conncores.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新教师数据','新增数据{anumClass}条,修改数据{unumClass}条,共计{unumClass + anumClass}条,获取数据{bjxx.Count()}',getdate())");
#endregion
#region 班级信息
List<ClassRoomModel> classRoomModels = conncores.Query<ClassRoomModel>("select * from classroominfo").ToList();
int anumCroom = 0;
int unumCroom = 0;
foreach (var item in zzjg)
{
try
{
if (classRoomModels.Exists(x => x.ClassroomNo == item.CODE_ && x.ClassroomName == item.NAME_))
{
StringBuilder sb = new StringBuilder("update classroominfo set ");
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新教师数据','编号({item.CODE_}),姓名({item.NAME_})更新时出现异常:{e.Message}',getdate())");
}
}
//记录修改数据总数
conncores.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新教师数据','新增数据{anumCroom}条,修改数据{unumCroom}条,共计{unumCroom + anumCroom}条,获取数据{bjxx.Count()}',getdate())");
(case when dept_id in ('01','02','03') then dept_id when dept_id='00' then '06' when dept_id='23' then '04' when dept_id='06' then '07' else '' end )as dept_id,
MAJOR_CODE,class_id,birthday,(case sex_code when '2' then '0' else '1' end) as sex_code,NATION_CODE,POLITICS_CODE,LENGTH_SCHOOLING,ENROLL_DATE,substr(ENROLL_GRADE,3,2) as ENROLL_GRADE from v_lq_xs_stu").ToList();
//(case when dept_id in ('01','02','03') then dept_id when dept_id='00' then '06' when dept_id='23' then '04' when dept_id='06' then '07' else '' end )as dept_id,
//MAJOR_CODE,class_id,birthday,(case sex_code when '2' then '0' else '1' end) as sex_code,NATION_CODE,POLITICS_CODE,LENGTH_SCHOOLING,ENROLL_DATE,substr(ENROLL_GRADE,3,2) as ENROLL_GRADE from v_lq_xs_stu").ToList();
//(case when dept_id in ('01','02','03') then dept_id when dept_id='00' then '06' when dept_id='23' then '04' when dept_id='06' then '07' else '' end )as dept_id,
//MAJOR_CODE,class_id,birthday,(case sex_code when '2' then '0' else '1' end) as sex_code,NATION_CODE,POLITICS_CODE,LENGTH_SCHOOLING,ENROLL_DATE,substr(ENROLL_GRADE,3,2) as ENROLL_GRADE from v_lq_xs_stu
using (IDbConnection conncore = new SqlConnection(_coresqlConnection))
{
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),578,'从西昌中间库更新学生数据','获取oracle学生数据{xcStudentList.Count()}条',getdate())");
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),578,'从西昌中间库更新学生数据','获取oracle学生数据{xsxx.Count()}条',getdate())");
}
using (IDbConnection conn = new SqlConnection(_sqlConnection))
{
//西昌学生信息表
List<StuInfoBasicModel> stuInfoBasicList = conn.Query<StuInfoBasicModel>(@"select * from StuInfoBasic ").ToList();
//数据字典表
////数据字典表
List<MiddleDicEntity> dicList = conn.Query<MiddleDicEntity>(@"select * from MiddleDictionary ").ToList();
int anum = 0;
int unum = 0;
foreach (var xcstu in xcStudentList)
foreach (var item in xsxx)
{
try
{
if (stuInfoBasicList.Exists(x => x.StuNo == xcstu.STU_NO && x.StuName == xcstu.NAME_))
if (stuInfoBasicList.Exists(x => x.StuNo == item.STU_NO && x.StuName == item.NAME_))
{
//学生存在,修改
#region 拼接SQL
StringBuilder sb = new StringBuilder("update StuInfoBasic set ");
using (IDbConnection conncore = new SqlConnection(_coresqlConnection))
{
conncore.Execute(
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),578,'从西昌中间库更新学生数据','学生学号({xcstu.STU_NO}),姓名({xcstu.NAME_})更新时出现异常:{e.Message}',getdate())");
$"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),578,'从西昌中间库更新学生数据','学生学号({item.STU_NO}),姓名({item.NAME_})更新时出现异常:{e.Message}',getdate())");