diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index bba1025..ec9d90a 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -1444,7 +1444,7 @@ namespace DigitalSchoolApi.Controllers //行政班级表 List bjxx = conn_oracle.Query("select * from V_BJXX").ToList(); //教室组织机构 - List zzjg = conn_oracle.Query("select * from V_JS_ZZJG").ToList(); + List zzjg = conn_oracle.Query("select * from V_JS_ZZJG where ID!='0'").ToList(); //学生信息 List xsxx = conn_oracle.Query("select * from V_XSXX").ToList(); //记录获取数据条数 @@ -1539,7 +1539,7 @@ namespace DigitalSchoolApi.Controllers { try { - if (LessonInfos.Exists(x => x.LessonName == item.CODE_ && x.LessonNo == item.NAME_)) + if (LessonInfos.Exists(x => x.LessonNo == item.CODE_ && x.LessonName == item.NAME_)) { StringBuilder sb = new StringBuilder("update lessoninfo set "); if (!string.IsNullOrEmpty(item.COURSE_TYPE_CODE)) @@ -1648,12 +1648,12 @@ namespace DigitalSchoolApi.Controllers } //修改条件 sb.Append($" where empno='{item.TEA_NO }' and empName='{item.NAME_}'"); - unumlesson += conncores.Execute(sb.ToString()); + unumTeach += 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; + anumTeach += mysql; } } catch (Exception e) @@ -1734,23 +1734,34 @@ namespace DigitalSchoolApi.Controllers } //修改条件 sb.Append($" where classno='{item.NO_ }' and className='{item.NAME_}'"); - unumlesson += conncores.Execute(sb.ToString()); + unumClass += conncores.Execute(sb.ToString()); } else { int mysql = conncores.Execute($"insert into classinfo (ClassId, ClassNo, ClassName, MajorNo, Educational, PYCC_CODE, Grade, GRADUATE_YEAR, GRADUATE_SCHOOLYEAR, GRADUATE_DATE, PINYIN, NAME_SHORT, PINYIN_SHORT, CheckMark) values (newid(), '{item.NO_}', '{item.NAME_}', '{item.MAJOR_CODE}', '{item.LENGTH_SCHOOLING}', '{item.PYCC_CODE}', '{item.GRADE.Substring(2)}', '{item.GRADUATE_YEAR}', '{item.GRADUATE_SCHOOLYEAR}', '{item.GRADUATE_DATE}', '{item.PINYIN}', '{item.NAME_SHORT}', '{item.PINYIN_SHORT}', '{item.ISTRUE}')"); - anumLesson += mysql; + anumClass += 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.NO_}),姓名({item.NAME_})更新时出现异常:{e.Message}',getdate())"); + 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,'更新班级数据','编号({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())"); + + 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,'更新班级数据','新增数据{anumClass}条,修改数据{unumClass}条,共计{unumClass + anumClass}条,获取数据{bjxx.Count()}',getdate())"); + + } + #endregion #region 教室信息 @@ -1808,12 +1819,12 @@ namespace DigitalSchoolApi.Controllers } //修改条件 sb.Append($" where classroomno='{item.CODE_ }' and classroomName='{item.NAME_}'"); - unumlesson += conncores.Execute(sb.ToString()); + unumCroom += conncores.Execute(sb.ToString()); } else { int mysql = conncores.Execute($"insert into classroominfo (ClassroomId, ClassroomNo, ClassroomName, PID, PATH_, ClassroomFloor, LEVEL_TYPE, ORDER_, ClassroomTypeNo, ContainStuNum, ClassroomBuildingNo, F_SchoolId, CheckMark) values (newid(), '{item.CODE_}', '{item.NAME_}', '{item.PID}', '{item.PATH_}', '{item.LEVEL_}', '{item.LEVEL_TYPE}', '{item.ORDER_}', '{item.JSLX_CODE}', '{item.ZW_COUNT}', '{item.JXL_ID}', '{item.XQ_ID}', '{item.ISTRUE}')"); - anumLesson += mysql; + anumCroom += mysql; } } catch (Exception e) @@ -1821,7 +1832,7 @@ namespace DigitalSchoolApi.Controllers 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,'更新教师数据','编号({item.CODE_}),姓名({item.NAME_})更新时出现异常:{e.Message}',getdate())"); + $"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())"); } @@ -1832,7 +1843,7 @@ namespace DigitalSchoolApi.Controllers { //记录修改数据总数 conncore.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())"); + $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新教室数据','新增数据{anumCroom}条,修改数据{unumCroom}条,共计{unumCroom + anumCroom}条,获取数据{zzjg.Count()}',getdate())"); } @@ -1932,11 +1943,11 @@ namespace DigitalSchoolApi.Controllers sb.Append($" PYCC_CODE='{item.PYCC_CODE}',"); } ////入学日期 oracle中格式有误,先不更新 - if (!string.IsNullOrEmpty(item.ENROLL_DATE)) - { - var date = Convert.ToDateTime(item.ENROLL_DATE); - sb.Append($" RegisterDate='{date}',"); - } + //if (!string.IsNullOrEmpty(item.ENROLL_DATE)) + //{ + // var date = Convert.ToDateTime(item.ENROLL_DATE); + // sb.Append($" RegisterDate='{date}',"); + //} //入学年级 if (!string.IsNullOrEmpty(item.ENROLL_GRADE)) { @@ -1992,7 +2003,7 @@ namespace DigitalSchoolApi.Controllers 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,'从西昌中间库更新学生数据','异常信息:" + + "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),578,'从西昌中间库获取数据','异常信息:" + e.Message + "',getdate())"); } } @@ -2083,12 +2094,12 @@ namespace DigitalSchoolApi.Controllers } //入学日期 - if (!string.IsNullOrEmpty(xsxx.ENROLL_DATE)) - { - var date = Convert.ToDateTime(xsxx.ENROLL_DATE); - fieleSb.Append("RegisterDate,"); - sb.Append($" '{date}',"); - } + //if (!string.IsNullOrEmpty(xsxx.ENROLL_DATE)) + //{ + // var date = Convert.ToDateTime(xsxx.ENROLL_DATE); + // fieleSb.Append("RegisterDate,"); + // sb.Append($" '{date}',"); + //} //入学年级 if (xsxx.ENROLL_GRADE != null) {