diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index c253dca..463d4ea 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -748,7 +748,7 @@ namespace DigitalSchoolApi.Controllers { StuEnrollFeeOrderEntity orderEntity = conn.QuerySingle("select * from StuEnrollFeeOrder where orderid='" + OrderId + "'"); - if (orderEntity.Status == 1||orderEntity.Status==999) + if (orderEntity.Status == 1 || orderEntity.Status == 999) { List stuEnrollFeeOrderDetailList = conn.Query(@"select a.*, b.InvoiceTypeCode from StuEnrollFeeOrderDetail a @@ -876,7 +876,7 @@ namespace DigitalSchoolApi.Controllers biParam.recer = "林智慧"; biParam.stuName = StuName; //biParam.stuNo = orderEntity.StuNo; - biParam.memo = "缴费年度:"+ orderEntity.YearNo+",学号:" + orderEntity.StuNo; + biParam.memo = "缴费年度:" + orderEntity.YearNo + ",学号:" + orderEntity.StuNo; biParam.@operator = "林智慧"; biParam.reViewer = "陈劲华"; biParam.totalAmt = Convert.ToDouble(stuEnrollFeeOrderDetailList.Sum(x => x.YJAmount));// Convert.ToDouble(orderEntity.YJAmount); @@ -1141,7 +1141,7 @@ namespace DigitalSchoolApi.Controllers //记录票号 var recordId = Guid.NewGuid(); 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))); @@ -1434,10 +1434,385 @@ namespace DigitalSchoolApi.Controllers { try { + #region 记录获取数据条数 + //专业 + List zyxx = conn_oracle.Query("select * from V_ZYXX").ToList(); + //课程信息 + List kcxx = conn_oracle.Query("select * from V_KCXX").ToList(); + //教师 + List jsxx = conn_oracle.Query("select * from V_JSXX").ToList(); + //行政班级表 + List bjxx = conn_oracle.Query("select * from V_BJXX").ToList(); + //教室组织机构 + List zzjg = conn_oracle.Query("select * from V_JS_ZZJG").ToList(); + //学生信息 + List xsxx = conn_oracle.Query("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 cdMajors = conncores.Query("select * from CdMajor").ToList(); + int anumMajor = 0; + int unumMajor = 0; + if (zyxx.Count() > 0) + { + foreach (var item in zyxx) + { + try + { + if (cdMajors.Exists(x => x.MajorNo == item.CODE_ && x.MajorName == item.NAME_ && x.DeptNo == item.PID)) + { + StringBuilder sb = new StringBuilder("update CdMajor set "); + if (!string.IsNullOrEmpty(item.PID)) + { + sb.Append($" DeptNo='{item.PID}',"); + } + if (!string.IsNullOrEmpty(item.ORDER_)) + { + sb.Append($" F_ORDER='{item.ORDER_}',"); + } + if (!string.IsNullOrEmpty(item.ZYFL_CODE)) + { + sb.Append($" ZYFL_CODE='{item.ZYFL_CODE}',"); + } + sb.Append(@" CheckMark='" + (item.ISTRUE == true ? 1 : 0) + "',"); + //去掉最后一个逗号 + if (sb.ToString().Contains(",")) + { + sb.Remove(sb.ToString().LastIndexOf(","), 1); + } + //修改条件 + 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 LessonInfos = conncores.Query("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 "); + if (!string.IsNullOrEmpty(item.COURSE_TYPE_CODE)) + { + sb.Append($" LessonTypeId='{item.COURSE_TYPE_CODE}',"); + } + if (!string.IsNullOrEmpty(item.COURSE_ATTR_CODE)) + { + sb.Append($" LessonSortDetailNo='{item.COURSE_ATTR_CODE}',"); + } + if (!string.IsNullOrEmpty(item.COURSE_NATURE_CODE)) + { + sb.Append($" LessonSortNo='{item.COURSE_NATURE_CODE}',"); + } + sb.Append(@" CheckMark='" + (item.ISTRUE == true ? 1 : 0) + "',"); + //去掉最后一个逗号 + if (sb.ToString().Contains(",")) + { + sb.Remove(sb.ToString().LastIndexOf(","), 1); + } + //修改条件 + 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 teachinfo = conncores.Query("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 "); + if (!string.IsNullOrEmpty(item.ZZJG_ID)) + { + sb.Append($" ZZJG_ID='{item.ZZJG_ID}',"); + } + if (!string.IsNullOrEmpty(item.DEPT_ID)) + { + sb.Append($" F_DepartmentId='{item.DEPT_ID}',"); + } + if (!string.IsNullOrEmpty(item.BZLX_CODE)) + { + sb.Append($" BZLX_CODE='{item.BZLX_CODE}',"); + } + if (!string.IsNullOrEmpty(item.TEA_STATUS_CODE)) + { + sb.Append($" IsInActiveStatus='{item.TEA_STATUS_CODE}',"); + } + if (!string.IsNullOrEmpty(item.BZLB_CODE)) + { + sb.Append($" BZLB_CODE='{item.BZLB_CODE}',"); + } + if (!string.IsNullOrEmpty(item.IDNO)) + { + sb.Append($" IdentityCardNo='{item.IDNO}',"); + } + if (!string.IsNullOrEmpty(item.BIRTH_DATE)) + { + sb.Append($" Birthday='{item.BIRTH_DATE}',"); + } + if (!string.IsNullOrEmpty(item.PHONE)) + { + sb.Append($" mobile='{item.PHONE}',"); + } + if (!string.IsNullOrEmpty(item.EDU_ID)) + { + sb.Append($" HighestRecord='{item.EDU_ID}',"); + } + if (!string.IsNullOrEmpty(item.DEGREE_ID)) + { + sb.Append($" DegreeNo='{item.DEGREE_ID}',"); + } + sb.Append(@" CheckMark='" + (item.IS_NORMAL == true ? 1 : 0) + "',"); + //去掉最后一个逗号 + if (sb.ToString().Contains(",")) + { + sb.Remove(sb.ToString().LastIndexOf(","), 1); + } + //修改条件 + 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 classModels = conncores.Query("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 "); + if (!string.IsNullOrEmpty(item.MAJOR_CODE)) + { + sb.Append($" MajorNo='{item.MAJOR_CODE}',"); + } + if (!string.IsNullOrEmpty(item.LENGTH_SCHOOLING)) + { + sb.Append($" Educational='{item.LENGTH_SCHOOLING}',"); + } + if (!string.IsNullOrEmpty(item.PYCC_CODE)) + { + sb.Append($" PYCC_CODE='{item.PYCC_CODE}',"); + } + if (!string.IsNullOrEmpty(item.GRADE)) + { + sb.Append($" Grade='{item.GRADE.Substring(2)}',"); + } + if (!string.IsNullOrEmpty(item.GRADUATE_YEAR)) + { + sb.Append($" GRADUATE_YEAR='{item.GRADUATE_YEAR}',"); + } + if (!string.IsNullOrEmpty(item.GRADUATE_SCHOOLYEAR)) + { + sb.Append($" GRADUATE_SCHOOLYEAR='{item.GRADUATE_SCHOOLYEAR}',"); + } + if (!string.IsNullOrEmpty(item.GRADUATE_DATE)) + { + sb.Append($" GRADUATE_DATE='{item.GRADUATE_DATE}',"); + } + if (!string.IsNullOrEmpty(item.PINYIN)) + { + sb.Append($" PINYIN='{item.PINYIN}',"); + } + if (!string.IsNullOrEmpty(item.NAME_SHORT)) + { + sb.Append($" NAME_SHORT='{item.NAME_SHORT}',"); + } + if (!string.IsNullOrEmpty(item.PINYIN_SHORT)) + { + sb.Append($" PINYIN_SHORT='{item.PINYIN_SHORT}',"); + } + sb.Append(@" CheckMark='" + (item.ISTRUE == true ? 1 : 0) + "',"); + //去掉最后一个逗号 + if (sb.ToString().Contains(",")) + { + sb.Remove(sb.ToString().LastIndexOf(","), 1); + } + //修改条件 + sb.Append($" where classno='{item.NO_ }' and className='{item.NAME_}'"); + unumlesson += 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; + } + } + 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())"); + } + } + //记录修改数据总数 + 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 classRoomModels = conncores.Query("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 "); + if (!string.IsNullOrEmpty(item.PID)) + { + sb.Append($" PID='{item.PID}',"); + } + if (!string.IsNullOrEmpty(item.PATH_)) + { + sb.Append($" PATH_='{item.PATH_}',"); + } + if (!string.IsNullOrEmpty(item.LEVEL_)) + { + sb.Append($" ClassroomFloor='{item.LEVEL_}',"); + } + if (!string.IsNullOrEmpty(item.LEVEL_TYPE)) + { + sb.Append($" LEVEL_TYPE='{item.LEVEL_TYPE}',"); + } + if (!string.IsNullOrEmpty(item.ORDER_)) + { + sb.Append($" ORDER_='{item.ORDER_}',"); + } + if (!string.IsNullOrEmpty(item.JSLX_CODE)) + { + sb.Append($" ClassroomTypeNo='{item.JSLX_CODE}',"); + } + if (!string.IsNullOrEmpty(item.ZW_COUNT)) + { + sb.Append($" ContainStuNum='{item.ZW_COUNT}',"); + } + if (!string.IsNullOrEmpty(item.JXL_ID)) + { + sb.Append($" ClassroomBuildingNo='{item.JXL_ID}',"); + } + if (!string.IsNullOrEmpty(item.XQ_ID)) + { + sb.Append($" F_SchoolId='{item.XQ_ID}',"); + } + sb.Append(@" CheckMark='" + (item.ISTRUE == true ? 1 : 0) + "',"); + //去掉最后一个逗号 + if (sb.ToString().Contains(",")) + { + sb.Remove(sb.ToString().LastIndexOf(","), 1); + } + //修改条件 + sb.Append($" where classroomno='{item.CODE_ }' and classroomName='{item.NAME_}'"); + unumlesson += 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; + } + } + 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,'更新教师数据','新增数据{anumCroom}条,修改数据{unumCroom}条,共计{unumCroom + anumCroom}条,获取数据{bjxx.Count()}',getdate())"); + #endregion + } + //获取oracle学生数据 - List xcStudentList = conn_oracle.Query(@"select ID,stu_no,name_, - (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(); + //List xcStudentList = conn_oracle.Query(@"select ID,stu_no,name_, + //(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(); + // List xcStudentList = conn_oracle.Query(@"select ID,stu_no,name_, //(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 @@ -1445,92 +1820,112 @@ 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,'从西昌中间库更新学生数据','获取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 stuInfoBasicList = conn.Query(@"select * from StuInfoBasic ").ToList(); - //数据字典表 + ////数据字典表 List dicList = conn.Query(@"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 "); - if (!string.IsNullOrEmpty(xcstu.DEPT_ID)) + if (!string.IsNullOrEmpty(item.DEPT_ID)) { - sb.Append($" DeptNo='{xcstu.DEPT_ID}',"); + sb.Append($" DeptNo='{item.DEPT_ID}',"); } //专业 - if (!string.IsNullOrEmpty(xcstu.MAJOR_CODE)) + if (!string.IsNullOrEmpty(item.MAJOR_CODE)) { - sb.Append($" MajorNo='{xcstu.MAJOR_CODE}',"); + sb.Append($" MajorNo='{item.MAJOR_CODE}',"); } //班级 - if (!string.IsNullOrEmpty(xcstu.CLASS_ID)) + if (!string.IsNullOrEmpty(item.CLASS_ID)) { - sb.Append($" ClassNo='{xcstu.CLASS_ID}',"); + sb.Append($" ClassNo='{item.CLASS_ID}',"); } - if (!string.IsNullOrEmpty(xcstu.BIRTHDAY)) + if (!string.IsNullOrEmpty(item.FORMER_NAME)) { - var date = Convert.ToDateTime(xcstu.BIRTHDAY); + sb.Append($" FORMER_NAME='{item.FORMER_NAME}',"); + } + if (!string.IsNullOrEmpty(item.PINYIN)) + { + sb.Append($" SpellFull='{item.PINYIN}',"); + } + if (!string.IsNullOrEmpty(item.BIRTHDAY)) + { + var date = Convert.ToDateTime(item.BIRTHDAY); sb.Append($" Birthday='{date}',"); } - if (!string.IsNullOrEmpty(xcstu.SEX_CODE)) + + if (!string.IsNullOrEmpty(item.IDNO)) + { + sb.Append($" IdentityCardNo='{item.IDNO}',"); + } + if (!string.IsNullOrEmpty(item.SEX_CODE)) { - sb.Append($" GenderNo='{xcstu.SEX_CODE}',"); + sb.Append($" GenderNo='{item.SEX_CODE}',"); } //民族 - if (!string.IsNullOrEmpty(xcstu.NATION_CODE)) + if (!string.IsNullOrEmpty(item.NATION_CODE)) { var NationalityNo = dicList.Where(x => - x.TName == "National" && x.Mcode == xcstu.NATION_CODE).Select(x => x.Code).FirstOrDefault(); + x.TName == "National" && x.Mcode == item.NATION_CODE).Select(x => x.Code).FirstOrDefault(); if (!string.IsNullOrEmpty(NationalityNo)) { sb.Append($" NationalityNo='{NationalityNo}',"); } } //政治面貌 - if (!string.IsNullOrEmpty(xcstu.POLITICS_CODE)) + if (!string.IsNullOrEmpty(item.POLITICS_CODE)) { - sb.Append($" PartyFaceNo='{xcstu.POLITICS_CODE}',"); + sb.Append($" PartyFaceNo='{item.POLITICS_CODE}',"); } //学制 - if (!string.IsNullOrEmpty(xcstu.SEX_CODE)) + if (!string.IsNullOrEmpty(item.LENGTH_SCHOOLING)) { - sb.Append($" EduSystem='{xcstu.LENGTH_SCHOOLING}',"); + sb.Append($" EduSystem='{item.LENGTH_SCHOOLING}',"); + } + if (!string.IsNullOrEmpty(item.PYCC_CODE)) + { + sb.Append($" PYCC_CODE='{item.PYCC_CODE}',"); } ////入学日期 oracle中格式有误,先不更新 - //if (!string.IsNullOrEmpty(xcstu.ENROLL_DATE)) - //{ - // var date = Convert.ToDateTime(xcstu.ENROLL_DATE); - // sb.Append($" RegisterDate='{date}',"); - //} + if (!string.IsNullOrEmpty(item.ENROLL_DATE)) + { + var date = Convert.ToDateTime(item.ENROLL_DATE); + sb.Append($" RegisterDate='{date}',"); + } //入学年级 - if (xcstu.ENROLL_GRADE != null) + if (!string.IsNullOrEmpty(item.ENROLL_GRADE)) + { + sb.Append($" Grade='{item.ENROLL_GRADE.Substring(2)}',"); + } + if (!string.IsNullOrEmpty(item.STU_STATE_CODE)) { - sb.Append($" Grade='{xcstu.ENROLL_GRADE}',"); + sb.Append($" STU_STATE_CODE='{item.STU_STATE_CODE}',"); } - //家庭地址 - if (xcstu.PLACE_DOMICILE != null) + if (!string.IsNullOrEmpty(item.STU_ROLL_CODE)) { - sb.Append($" FamilyAddress='{xcstu.PLACE_DOMICILE}',"); + sb.Append($" STU_ROLL_CODE='{item.STU_ROLL_CODE}',"); } + sb.Append(@" CheckMark='" + (item.IS_NORMAL) + "',"); //去掉最后一个逗号 if (sb.ToString().Contains(",")) { sb.Remove(sb.ToString().LastIndexOf(","), 1); } - - sb.Append($" where StuNo='{xcstu.STU_NO}' and StuName='{xcstu.NAME_}'"); + sb.Append($" where StuNo='{item.STU_NO}' and StuName='{item.NAME_}'"); //System.IO.File.AppendAllText(@"c:\test.txt", sb.ToString() + "\r\n"); #endregion unum += conn.Execute(sb.ToString()); @@ -1539,7 +1934,7 @@ namespace DigitalSchoolApi.Controllers { //新增学生 //拼接SQL - string mysql = GetAddSql(dicList, xcstu); + string mysql = GetAddSql(dicList, item); anum += conn.Execute(mysql); } } @@ -1548,7 +1943,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,'从西昌中间库更新学生数据','学生学号({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())"); } } } @@ -1583,45 +1978,55 @@ namespace DigitalSchoolApi.Controllers } } - private static string GetAddSql(List dicList, XCStudentEntity xcstu) + private static string GetAddSql(List dicList, V_XSXX xsxx) { string mysql = "insert into StuInfoBasic("; StringBuilder fieleSb = new StringBuilder(); StringBuilder sb = new StringBuilder(); fieleSb.Append("StuId,stuno,stuname,CheckMark,F_SchoolId,"); - sb.Append($" NEWID(),'{xcstu.STU_NO}','{xcstu.NAME_}','1','207fa1a9-160c-4943-a89b-8fa4db0547ce',"); - if (!string.IsNullOrEmpty(xcstu.DEPT_ID)) + sb.Append($" NEWID(),'{xsxx.STU_NO}','{xsxx.NAME_}','1','207fa1a9-160c-4943-a89b-8fa4db0547ce',"); + if (!string.IsNullOrEmpty(xsxx.DEPT_ID)) { fieleSb.Append("DeptNo,"); - sb.Append($" '{xcstu.DEPT_ID}',"); + sb.Append($" '{xsxx.DEPT_ID}',"); } //专业 - if (!string.IsNullOrEmpty(xcstu.MAJOR_CODE)) + if (!string.IsNullOrEmpty(xsxx.MAJOR_CODE)) { fieleSb.Append("MajorNo,"); - sb.Append($" '{xcstu.MAJOR_CODE}',"); + sb.Append($" '{xsxx.MAJOR_CODE}',"); } - if (!string.IsNullOrEmpty(xcstu.CLASS_ID)) + if (!string.IsNullOrEmpty(xsxx.CLASS_ID)) { fieleSb.Append("ClassNo,"); - sb.Append($" '{xcstu.CLASS_ID}',"); + sb.Append($" '{xsxx.CLASS_ID}',"); + } + if (!string.IsNullOrEmpty(xsxx.PINYIN)) + { + fieleSb.Append("SpellFull,"); + sb.Append($" '{xsxx.PINYIN}',"); } - if (!string.IsNullOrEmpty(xcstu.BIRTHDAY)) + if (!string.IsNullOrEmpty(xsxx.BIRTHDAY)) { - var date = Convert.ToDateTime(xcstu.BIRTHDAY); + var date = Convert.ToDateTime(xsxx.BIRTHDAY); fieleSb.Append("Birthday,"); sb.Append($" '{date}',"); } - if (!string.IsNullOrEmpty(xcstu.SEX_CODE)) + if (!string.IsNullOrEmpty(xsxx.IDNO)) { - fieleSb.Append("GenderNo,"); - sb.Append($" '{xcstu.SEX_CODE}',"); + fieleSb.Append("IdentityCardNo,"); + sb.Append($" '{xsxx.IDNO}',"); + } + if (!string.IsNullOrEmpty(xsxx.SEX_CODE)) + { + fieleSb.Append("IdentityCardNo,"); + sb.Append($" '{xsxx.SEX_CODE}',"); } //民族 - if (!string.IsNullOrEmpty(xcstu.NATION_CODE)) + if (!string.IsNullOrEmpty(xsxx.NATION_CODE)) { var NationalityNo = dicList.Where(x => - x.TName == "National" && x.Mcode == xcstu.NATION_CODE).Select(x => x.Code).FirstOrDefault(); + x.TName == "National" && x.Mcode == xsxx.NATION_CODE).Select(x => x.Code).FirstOrDefault(); if (!string.IsNullOrEmpty(NationalityNo)) { fieleSb.Append("NationalityNo,"); @@ -1629,36 +2034,37 @@ namespace DigitalSchoolApi.Controllers } } //政治面貌 - if (!string.IsNullOrEmpty(xcstu.POLITICS_CODE)) + if (!string.IsNullOrEmpty(xsxx.POLITICS_CODE)) { fieleSb.Append("PartyFaceNo,"); - sb.Append($" '{xcstu.POLITICS_CODE}',"); + sb.Append($" '{xsxx.POLITICS_CODE}',"); } //学制 - if (!string.IsNullOrEmpty(xcstu.SEX_CODE)) + if (!string.IsNullOrEmpty(xsxx.LENGTH_SCHOOLING)) { fieleSb.Append("EduSystem,"); - sb.Append($" '{xcstu.LENGTH_SCHOOLING}',"); + sb.Append($" '{xsxx.LENGTH_SCHOOLING}',"); + } + if (!string.IsNullOrEmpty(xsxx.PYCC_CODE)) + { + fieleSb.Append("PYCC_CODE,"); + sb.Append($" '{xsxx.PYCC_CODE}',"); } + //入学日期 - //if (!string.IsNullOrEmpty(xcstu.ENROLL_DATE)) - //{ - // var date = Convert.ToDateTime(xcstu.ENROLL_DATE); - // fieleSb.Append("RegisterDate,"); - // sb.Append($" '{date}',"); - //} - //入学年级 - if (xcstu.ENROLL_GRADE != null) + if (!string.IsNullOrEmpty(xsxx.ENROLL_DATE)) { - fieleSb.Append("Grade,"); - sb.Append($" '{xcstu.ENROLL_GRADE}',"); + var date = Convert.ToDateTime(xsxx.ENROLL_DATE); + fieleSb.Append("RegisterDate,"); + sb.Append($" '{date}',"); } - //家庭地址 - if (xcstu.PLACE_DOMICILE != null) + //入学年级 + if (xsxx.ENROLL_GRADE != null) { - fieleSb.Append("FamilyAddress,"); - sb.Append($" '{xcstu.PLACE_DOMICILE}',"); + fieleSb.Append("Grade,"); + sb.Append($" '{xsxx.ENROLL_GRADE.ToString().Substring(2)}',"); } + sb.Append(@" CheckMark='" + (xsxx.IS_NORMAL) + "',"); //去掉最后一个逗号 if (fieleSb.ToString().Contains(",") && sb.ToString().Contains(",")) { diff --git a/DigitalSchoolApi/Models/XCStudentEntity.cs b/DigitalSchoolApi/Models/XCStudentEntity.cs index 29f71e1..5affff0 100644 --- a/DigitalSchoolApi/Models/XCStudentEntity.cs +++ b/DigitalSchoolApi/Models/XCStudentEntity.cs @@ -48,7 +48,7 @@ namespace DigitalSchoolApi.Models /// /// 学制 /// - public int? LENGTH_SCHOOLING { get; set; } + public string LENGTH_SCHOOLING { get; set; } /// /// 培养层次CODE1:博士;2:硕士;3:本科;4:专科;9:其他(不可变更) /// @@ -95,7 +95,7 @@ namespace DigitalSchoolApi.Models public class StuInfoBasicModel { #region 实体成员 - + public string ID { get; set; } /// /// 学校编号 /// @@ -151,6 +151,7 @@ namespace DigitalSchoolApi.Models /// 姓名 /// public string StuName { get; set; } + public string FORMER_NAME { get; set; } /// /// 拼音全称 /// @@ -663,6 +664,8 @@ namespace DigitalSchoolApi.Models /// 开户银行位置 /// public string BankLocation { get; set; } + public string PYCC_CODE { get; set; } + #endregion } @@ -677,4 +680,257 @@ namespace DigitalSchoolApi.Models public string Name { get; set; } public string TName { get; set; } } + public class CdMajorModel + { + public string ID { get; set; } + public string MajorNo { get; set; } + public string MajorName { get; set; } + public string F_ORDER { get; set; } + public string ZYFL_CODE { get; set; } + public bool? CheckMark { get; set; } + public string DeptNo { get; set; } + public string F_SchoolId { get; set; } + } + /// + /// 专业 + /// + public class V_ZYXX + { + public string ID { get; set; } + /// + /// 专业代码 + /// + public string CODE_ { get; set; } + /// + /// 名称 + /// + public string NAME_ { get; set; } + /// + /// 院系ID + /// + public string PID { get; set; } + /// + /// 排序号 + /// + public string ORDER_ { get; set; } + /// + ///是否可用 1:是,0:否 + /// + public bool? ISTRUE { get; set; } + /// + /// 专业分类 1:本科;2:专科;3:专升本;用于人才培养方案 + /// + public string ZYFL_CODE { get; set; } + } + public class LessonInfoModel + { + public string LessonId { get; set; } + public string LessonNo { get; set; } + public string LessonName { get; set; } + public string COURSE_TYPE_CODE { get; set; } + public string COURSE_ATTR_CODE { get; set; } + public string COURSE_NATURE_CODE { get; set; } + public string F_SchoolId { get; set; } + public bool? CheckMark { get; set; } + } + public class V_KCXX + { + public string ID { get; set; } + /// + /// 代码 + /// + public string CODE_ { get; set; } + /// + /// 名称 + /// + public string NAME_ { get; set; } + /// + /// 课程类型CODE A类(纯理论课)/B类((理论+实践)课)/ C类(纯实践课) + /// + public string COURSE_TYPE_CODE { get; set; } + /// + /// 课程属性CODE 公共课、专业基础课、专业课。 + /// + public string COURSE_ATTR_CODE { get; set; } + /// + /// 课程性质CODE 课程性质(单一选项):必修课/专业选修课/公共选修课 + /// + public string COURSE_NATURE_CODE { get; set; } + /// + /// 是否可用 + /// + public bool? ISTRUE { get; set; } + } + public class TeachModel + { + public string EmpId { get; set; } + public string ZZJG_ID { get; set; } + public string F_DepartmentId { get; set; } + public string EmpNo { get; set; } + public string EmpName { get; set; } + /// + /// 编制类型 在编(1)、人事代理(2)、其他(9)(不可变更) + /// + public string BZLX_CODE { get; set; } + public string IsInActiveStatus { get; set; } + /// + /// 教学类(10)、行政类(20)、教辅类(30)、工勤类(40)、外聘教师类(80)、科研类(50)、校办企业类(60)、附设机构类(70)、其他类(99)(不可变更) + /// + public string BZLB_CODE { get; set; } + /// + /// 教职工状态 在职(11,含其他原因在岗人员)、延聘(12)、返聘(04)、退休(01)、离职(07)、其他(99,表示不在校)等等,使用国标 + /// + public string IdentityCardNo { get; set; } + public string Birthday { get; set; } + public string mobile { get; set; } + /// + /// 学历 博士研究生:01,硕士研究生:10,本科:20,专科:30,中专:40,技工:50,高中,60(不可变更 + /// + public string HighestRecord { get; set; } + /// + /// 学位 名誉博士:1,博士:2,硕士:3,学士:4,双学士:5(不可变更) + /// + public string DegreeNo { get; set; } + public string F_CompanyId { get; set; } + public bool? CheckMark { get; set; } + + } + public class V_JSXX + { + public string ID { get; set; } + /// + /// 组织机构ID + /// + public string ZZJG_ID { get; set; } + public string DEPT_ID { get; set; } + public string TEA_NO { get; set; } + public string NAME_ { get; set; } + /// + /// 编制类型 + /// 在编(1)、人事代理(2)、其他(9)(不可变更) + /// + public string BZLX_CODE { get; set; } + /// + /// 教职工状态 + /// 在职(11,含其他原因在岗人员)、延聘(12)、返聘(04)、退休(01)、离职(07)、其他(99,表示不在校)等等,使用国标 + /// + public string TEA_STATUS_CODE { get; set; } + /// + /// 编制类别 + /// 教学类(10)、行政类(20)、教辅类(30)、工勤类(40)、外聘教师类(80)、科研类(50)、校办企业类(60)、附设机构类(70)、其他类(99)(不可变更) + /// + public string BZLB_CODE { get; set; } + public string IDNO { get; set; } + public string BIRTH_DATE { get; set; } + public string PHONE { get; set; } + /// + /// 最高学历 + /// 博士研究生:01,硕士研究生:10,本科:20,专科:30,中专:40,技工:50,高中,60(不可变更) + /// + public string EDU_ID { get; set; } + /// + /// 最高学位 + /// 名誉博士:1,博士:2,硕士:3,学士:4,双学士:5(不可变更) + /// + public string DEGREE_ID { get; set; } + public bool? IS_NORMAL { get; set; } + } + + public class ClassModel + { + public string ClassId { get; set; } + public string ClassNo { get; set; } + public string ClassName { get; set; } + public string MajorNo { get; set; } + public string Educational { get; set; } + /// + /// 培养层次CODE 1:博士;2:硕士;3:本科;4:专科;9:其他(不可变更 + /// + public string PYCC_CODE { get; set; } + public string Grade { get; set; } + public string GRADUATE_YEAR { get; set; } + public string GRADUATE_SCHOOLYEAR { get; set; } + public DateTime? GRADUATE_DATE { get; set; } + public bool? CheckMark { get; set; } + public string PINYIN { get; set; } + public string NAME_SHORT { get; set; } + public string PINYIN_SHORT { get; set; } + + } + public class V_BJXX + { + public string ID { get; set; } + public string NO_ { get; set; } + public string NAME_ { get; set; } + public string MAJOR_CODE { get; set; } + public string LENGTH_SCHOOLING { get; set; } + public string PYCC_CODE { get; set; } + public string GRADE { get; set; } + public string GRADUATE_YEAR { get; set; } + public string GRADUATE_SCHOOLYEAR { get; set; } + public string GRADUATE_DATE { get; set; } + public bool? ISTRUE { get; set; } + public string PINYIN { get; set; } + public string NAME_SHORT { get; set; } + public string PINYIN_SHORT { get; set; } + } + + public class ClassRoomModel + { + public string ClassroomId { get; set; } + public string ClassroomNo { get; set; } + public string ClassroomName { get; set; } + public string PID { get; set; } + public string PATH_ { get; set; } + public string ClassroomFloor { get; set; } + public string LEVEL_TYPE { get; set; } + public bool? CheckMark { get; set; } + public string ORDER_ { get; set; } + public string ClassroomTypeNo { get; set; } + public string ContainStuNum { get; set; } + public string ClassroomBuildingNo { get; set; } + public string F_SchoolId { get; set; } + } + public class V_JS_ZZJG + { + public string ID { get; set; } + public string CODE_ { get; set; } + public string NAME_ { get; set; } + public string PID { get; set; } + public string PATH_ { get; set; } + public string LEVEL_ { get; set; } + public string LEVEL_TYPE { get; set; } + public bool? ISTRUE { get; set; } + public string ORDER_ { get; set; } + /// + /// 1:多媒体教室;2:语音室;3:实验室;4:计算机房;5:普通教室;6:专用教室;9:其他(不可变更) + /// + public string JSLX_CODE { get; set; } + public string ZW_COUNT { get; set; } + public string JXL_ID { get; set; } + public string XQ_ID { get; set; } + } + public class V_XSXX + { + public string ID { get; set; } + public string STU_NO { get; set; } + public string NAME_ { get; set; } + public string FORMER_NAME { get; set; } + public string DEPT_ID { get; set; } + public string MAJOR_CODE { get; set; } + public string CLASS_ID { get; set; } + public string PINYIN { get; set; } + public string BIRTHDAY { get; set; } + public string IDNO { get; set; } + public string SEX_CODE { get; set; } + public string NATION_CODE { get; set; } + public string POLITICS_CODE { get; set; } + public string LENGTH_SCHOOLING { get; set; } + public string PYCC_CODE { get; set; } + public string ENROLL_DATE { get; set; } + public string ENROLL_GRADE { get; set; } + public string STU_STATE_CODE { get; set; } + public string STU_ROLL_CODE { get; set; } + public string IS_NORMAL { get; set; } + } } \ No newline at end of file