From 09e1a2229d148cedeea1c32effca1d75829640a1 Mon Sep 17 00:00:00 2001 From: dao Date: Thu, 28 Mar 2024 09:20:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A5=BF=E6=98=8C=E5=90=8C=E6=AD=A5=E9=83=A8?= =?UTF-8?q?=E9=97=A8=EF=BC=88=E9=83=A8=E9=97=A8=E8=B4=9F=E8=B4=A3=E4=BA=BA?= =?UTF-8?q?=E3=80=81=E5=A4=87=E6=B3=A8=E7=AD=89=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalSchoolApi/Controllers/YKTTrabs.cs | 95 +++++++++++++----------- 1 file changed, 53 insertions(+), 42 deletions(-) diff --git a/DigitalSchoolApi/Controllers/YKTTrabs.cs b/DigitalSchoolApi/Controllers/YKTTrabs.cs index 8492281..f23d156 100644 --- a/DigitalSchoolApi/Controllers/YKTTrabs.cs +++ b/DigitalSchoolApi/Controllers/YKTTrabs.cs @@ -813,7 +813,7 @@ namespace DigitalSchoolApi.Controllers conncore.Execute( "insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),121,'typecode','开票typecode:" + item.Key + "',getdate())"); } - InvoiceEBillByTypeTwo(conn,orderEntity, item.Key, item); + InvoiceEBillByTypeTwo(conn, orderEntity, item.Key, item); } catch (Exception ex) { @@ -1030,7 +1030,7 @@ namespace DigitalSchoolApi.Controllers } } - private static void InvoiceEBillByTypeTwo(IDbConnection conn,FinaChargeStuOrderEntity orderEntity, string billCode, IGrouping stuEnrollFeeOrderDetailList) + private static void InvoiceEBillByTypeTwo(IDbConnection conn, FinaChargeStuOrderEntity orderEntity, string billCode, IGrouping stuEnrollFeeOrderDetailList) { Encoding encoding = Encoding.UTF8; string StuName = conn.QuerySingle("select StuName from FinaChargeStudent where stuno='" + orderEntity.StuNo + "'").StuName; @@ -1465,37 +1465,7 @@ namespace DigitalSchoolApi.Controllers #endregion - using (IDbConnection db =new SqlConnection(_coresqlConnection)) - { - - #region 部门 - List departments = db.Query("select * from LR_Base_Department").ToList(); - int anumDept = 0; - int unumDept = 0; - foreach (var item in depts) - { - try - { - if(departments.Any(x=>x.F_DepartmentId==item.ID)) - { - var sql = $"update LR_Base_Department set F_FullName='{item.NAME_}',F_ParentId='{item.PID}',F_EnCode='{item.ID}',F_ShortName='{item.NAME_SHORT}',F_CreateDate='{DateTime.Now}' where F_DepartmentId='{item.ID}'"; - anumDept += db.Execute(sql); - } - else - { - var sql = $"insert into LR_Base_Department (F_DepartmentId,F_CompanyId,F_ParentId,F_EnCode,F_FullName,F_ShortName,F_SortCode,F_DeleteMark,F_EnabledMark,F_CreateDate,F_Order) values ('{item.ID}','207fa1a9-160c-4943-a89b-8fa4db0547ce','{item.PID}','{item.ID}','{item.NAME_}','{item.NAME_SHORT}',0,0,1,'{DateTime.Now}',0)"; - anumDept += db.Execute(sql); - } - } - catch (Exception ex) - { - db.Execute( - $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新部门数据','编号({item.ID}),姓名({item.NAME_})更新时出现异常:{ex.Message}',getdate())"); - } - } - - #endregion - } + var teachinfo = new List(); using (IDbConnection conncores = new SqlConnection(_sqlConnection)) { @@ -1532,7 +1502,7 @@ namespace DigitalSchoolApi.Controllers sb.Remove(sb.ToString().LastIndexOf(","), 1); } //修改条件 - sb.Append($" where MajorNo='{item.CODE_ }' and MajorName='{item.NAME_}'"); + sb.Append($" where MajorNo='{item.CODE_}' and MajorName='{item.NAME_}'"); unumMajor += conncores.Execute(sb.ToString()); } else @@ -1592,7 +1562,7 @@ namespace DigitalSchoolApi.Controllers sb.Remove(sb.ToString().LastIndexOf(","), 1); } //修改条件 - sb.Append($" where lessonno='{item.CODE_ }' and lessonName='{item.NAME_}'"); + sb.Append($" where lessonno='{item.CODE_}' and lessonName='{item.NAME_}'"); unumlesson += conncores.Execute(sb.ToString()); } else @@ -1619,9 +1589,9 @@ namespace DigitalSchoolApi.Controllers } #endregion - + #region 教师信息 - List teachinfo = conncores.Query("select * from empinfo").ToList(); + teachinfo = conncores.Query("select * from empinfo").ToList(); int anumTeach = 0; int unumTeach = 0; foreach (var item in jsxx) @@ -1678,7 +1648,7 @@ namespace DigitalSchoolApi.Controllers sb.Remove(sb.ToString().LastIndexOf(","), 1); } //修改条件 - sb.Append($" where empno='{item.TEA_NO }' and empName='{item.NAME_}'"); + sb.Append($" where empno='{item.TEA_NO}' and empName='{item.NAME_}'"); unumTeach += conncores.Execute(sb.ToString()); } else @@ -1764,7 +1734,7 @@ namespace DigitalSchoolApi.Controllers sb.Remove(sb.ToString().LastIndexOf(","), 1); } //修改条件 - sb.Append($" where classno='{item.NO_ }' and className='{item.NAME_}'"); + sb.Append($" where classno='{item.NO_}' and className='{item.NAME_}'"); unumClass += conncores.Execute(sb.ToString()); } else @@ -1849,7 +1819,7 @@ namespace DigitalSchoolApi.Controllers sb.Remove(sb.ToString().LastIndexOf(","), 1); } //修改条件 - sb.Append($" where classroomno='{item.CODE_ }' and classroomName='{item.NAME_}'"); + sb.Append($" where classroomno='{item.CODE_}' and classroomName='{item.NAME_}'"); unumCroom += conncores.Execute(sb.ToString()); } else @@ -1881,6 +1851,47 @@ namespace DigitalSchoolApi.Controllers #endregion } + using (IDbConnection db = new SqlConnection(_coresqlConnection)) + { + + #region 部门 + List departments = db.Query("select * from LR_Base_Department").ToList(); + int anumDept = 0; + int unumDept = 0; + + foreach (var item in depts) + { + try + { + if (item.LEVEL_TYPE.ToLower() != "xx" && item.LEVEL_TYPE.ToLower() != "zy") + { + var manager = string.Empty; + if (!string.IsNullOrWhiteSpace(item.ADMIN_MANAGE_TEA_NO)) + { + manager = teachinfo.FirstOrDefault(x => x.EmpNo == item.ADMIN_MANAGE_TEA_NO)?.EmpId ?? ""; + } + if (departments.Any(x => x.F_DepartmentId == item.ID)) + { + var sql = $"update LR_Base_Department set F_FullName='{item.NAME_}',F_ParentId='{item.PID}',F_EnCode='{item.CODE_}',F_ShortName='{item.NAME_SHORT}',F_Manager='{manager}',F_Description='{item.LEVEL_TYPE}',F_CreateDate='{DateTime.Now}' where F_DepartmentId='{item.ID}'"; + anumDept += db.Execute(sql); + } + else + { + var sql = $"insert into LR_Base_Department (F_DepartmentId,F_CompanyId,F_ParentId,F_EnCode,F_FullName,F_ShortName,F_Manager,F_Description,F_SortCode,F_DeleteMark,F_EnabledMark,F_CreateDate,F_Order) values ('{item.ID}','207fa1a9-160c-4943-a89b-8fa4db0547ce','{item.PID}','{item.CODE_}','{item.NAME_}','{item.NAME_SHORT}','{manager}','{item.LEVEL_TYPE}',0,0,1,'{DateTime.Now}',0)"; + anumDept += db.Execute(sql); + } + } + + } + catch (Exception ex) + { + db.Execute( + $"insert into LR_Base_Log(F_LogId,F_CategoryId,F_SourceObjectId,F_SourceContentJson,F_OperateTime) values(newid(),55555,'更新部门数据','编号({item.ID}),姓名({item.NAME_})更新时出现异常:{ex.Message}',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, @@ -1947,7 +1958,7 @@ namespace DigitalSchoolApi.Controllers } if (!string.IsNullOrEmpty(item.SEX_CODE)) { - sb.Append(" GenderNo='"+(item.SEX_CODE=="1"?"1":"0")+"',"); + sb.Append(" GenderNo='" + (item.SEX_CODE == "1" ? "1" : "0") + "',"); } //民族 if (!string.IsNullOrEmpty(item.NATION_CODE)) @@ -2138,7 +2149,7 @@ namespace DigitalSchoolApi.Controllers sb.Append($" '{xsxx.ENROLL_GRADE.ToString().Substring(2)}',"); } - if (xsxx.IS_NORMAL!=null) + if (xsxx.IS_NORMAL != null) { fieleSb.Append("InSchoolStatus,"); sb.Append(" '" + (xsxx.IS_NORMAL) + "',");