@@ -1,518 +0,0 @@ | |||
数字化智慧校园 | |||
基础信息接口 | |||
V1.0 | |||
接口服务器: | |||
学校服务器,部署地址:http://112.45.152.8:8083/ | |||
调用方式: | |||
标准http get请求 | |||
返回数据类型: | |||
标准json | |||
返回数据结构 | |||
主要关心code和data即可 | |||
属性 | |||
返回值 | |||
备注 | |||
code | |||
200(int) | |||
200成功 其余失败 | |||
info | |||
响应成功(string) | |||
状态描述 | |||
data | |||
业务数据(object) | |||
业务数据 | |||
部门接口 | |||
地址:http:// /arrangelesson/department | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
F_DepartmentId | |||
GUID (string) | |||
GUID部门ID | |||
否 | |||
F_ParentId | |||
上级部门ID(string) | |||
-1和0均代表根 | |||
否 | |||
F_EnCode | |||
部门编号(string) | |||
部门编号 | |||
否 | |||
F_FullName | |||
部门全称(string) | |||
否 | |||
F_ShortName | |||
部门简称(string) | |||
F_Manager | |||
负责人(string) | |||
F_OuterPhone | |||
电话(string) | |||
教师信息接口 | |||
地址:http://部署地址/arrangelesson/allteacher | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
EmpId | |||
GUID (string) | |||
GUID教师ID | |||
否 | |||
EmpNo | |||
教职工编号(string) | |||
否 | |||
EmpName | |||
职工姓名(string) | |||
否 | |||
GenderNo | |||
性别(bool) | |||
true男false女 | |||
Birthday | |||
生日(datetime) | |||
F_DepartmentId | |||
部门ID(string) | |||
mobile | |||
电话(string) | |||
学生信息接口 | |||
地址:http://部署地址/arrangelesson/allstudent | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
StuId | |||
GUID (string) | |||
GUID学生ID | |||
否 | |||
StuNo | |||
学生编号(string) | |||
否 | |||
StuName | |||
姓名(string) | |||
否 | |||
ksh | |||
考生号(string) | |||
GenderNo | |||
性别(bool) | |||
true男false女 | |||
Birthday | |||
生日(datetime) | |||
mobile | |||
电话(string) | |||
IdentityCardNo | |||
身份证号(string) | |||
DeptNo | |||
系部编号(string) | |||
MajorNo | |||
专业编号(string) | |||
Grade | |||
级别(18代表2018级,19表示2019级)(string) | |||
ClassNo | |||
班级编号(string) | |||
系部接口 | |||
地址:http://部署地址/arrangelesson/alldept | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
DeptId | |||
GUID (string) | |||
GUID系部ID | |||
否 | |||
DeptNo | |||
系部编号(string) | |||
否 | |||
DeptName | |||
系部名称(string) | |||
否 | |||
专业接口 | |||
地址:http://部署地址/arrangelesson/allmajor | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
ID | |||
GUID (string) | |||
GUID专业ID | |||
否 | |||
MajorNo | |||
专业编号(string) | |||
否 | |||
MajorName | |||
专业名称(string) | |||
否 | |||
DeptNo | |||
系部编号(string) | |||
校区接口 | |||
地址:http://部署地址/arrangelesson/allschool | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
F_CompanyId | |||
GUID (string) | |||
GUID校区ID | |||
否 | |||
F_FullName | |||
校区名称(string) | |||
否 | |||
班级接口 | |||
地址:http://部署地址/arrangelesson/allclass | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
ClassId | |||
GUID (string) | |||
GUI班级ID | |||
否 | |||
ClassNo | |||
班级编号(string) | |||
否 | |||
ClassName | |||
班级名称(string) | |||
否 | |||
DeptNo | |||
系部编号(string) | |||
MajorNo | |||
专业编号(string) | |||
Grade | |||
级别(18代表2018级,19表示2019级)(string) | |||
用户接口 | |||
地址:http://部署地址/arrangelesson/alluser | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
F_UserId | |||
GUID (string) | |||
GUI用户ID | |||
否 | |||
ClassNo | |||
班级编号(string) | |||
F_CompanyId | |||
校区Id(string) | |||
F_Description | |||
用户类型(string) | |||
2教师,3学生 | |||
F_RealName | |||
姓名(string) | |||
F_Account | |||
登录帐号(string) | |||
Year | |||
级别(string) | |||
2018代表2018年入学 | |||
课程接口 | |||
地址:http://部署地址/arrangelesson/alllesson | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
LessonId | |||
GUID (string) | |||
GUI课程ID | |||
否 | |||
LessonNo | |||
课程编号(string) | |||
否 | |||
LessonName | |||
课程名称(string) | |||
否 | |||
LessonSortNo | |||
课程类型(string) | |||
1必修,2选修 | |||
F_SchoolId | |||
校区Id(string) | |||
必修开课计划接口 | |||
地址:http://部署地址/arrangelesson/allclasslesson | |||
所需参数:AcademicYearNo=19-20&Semester=1 | |||
参数名称 | |||
值 | |||
备注 | |||
AcademicYearNo | |||
19-20 | |||
代表学年19-20、18-19等 | |||
Semester | |||
1、2 | |||
学期1、2 | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
F_SchoolId | |||
校区Id(string) | |||
DeptNo | |||
系部编号(string) | |||
MajorNo | |||
专业编号(string) | |||
LessonNo | |||
课程编号(string) | |||
LessonName | |||
课程名称(string) | |||
EmpNo | |||
代课老师编号(string) | |||
EmpName | |||
代课老师姓名(string) | |||
TeachClassNo | |||
班级编号(string) | |||
ClassRoomNo | |||
教室编号(string) | |||
LessonTime | |||
上课节次(string) | |||
11代表星期一第一节,12星期一第二节 | |||
学生选修选课接口 | |||
地址:http://部署地址/arrangelesson/allelelectivelesson | |||
所需参数:AcademicYearNo=19-20&Semester=1 | |||
参数名称 | |||
值 | |||
备注 | |||
AcademicYearNo | |||
19-20 | |||
代表学年19-20、18-19等 | |||
Semester | |||
1、2 | |||
学期1、2 | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
StuNo | |||
学号(string) | |||
LessonNo | |||
课程编号(string) | |||
EmpNo | |||
代课老师编号(string) | |||
ClassRoomNo | |||
教室编号(string) | |||
LessonSection | |||
上课节次(string) | |||
37,38代表星期3第七节、第八节上课 | |||
LessonTime | |||
上课时间(string) | |||
16:20-17:05,17:15-18:00 两节课的时间 | |||
新生信息接口(人脸平台) | |||
地址:http://部署地址/arrangelesson/getnewstudentlist | |||
所需参数:Grade =22 | |||
参数名称 | |||
值 | |||
备注 | |||
Grade | |||
22 | |||
代表级别,22年级新生传22,23年传23 | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
StuNo | |||
学号(string) | |||
IdentityCardNo | |||
身份证号(string) | |||
ksh | |||
考生号(string) | |||
StuName | |||
学生姓名(string) | |||
GenderNo | |||
性别代码(string) | |||
1男,0女 | |||
ProvinceNo | |||
地区代码(string) | |||
MajorName | |||
专业名称 | |||
ClassName | |||
班级名称 | |||
ExamPhoto | |||
高考照片Url | |||
新生核验结果接口(人脸平台) | |||
地址:http://部署地址/arrangelesson/newstudentcompare | |||
HTTP Post Content-Type=application/json | |||
所需参数:{"IdentityCardNo":"xxxx","ScenePhoto":"xx","IdentPhoto":"xx","PhotoCheckStatus":"0"} | |||
参数名称 | |||
值 | |||
备注 | |||
IdentityCardNo | |||
身份证号(string) | |||
ScenePhoto | |||
现场照片URL(string) | |||
IdentPhoto | |||
身份证照片URL(string) | |||
PhotoCheckStatus | |||
核验状态(int) | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
code | |||
返回结果(string) | |||
200表示成功,其他失败 | |||
info | |||
返回结果说明(string) | |||
data | |||
忽略 | |||
@@ -0,0 +1,480 @@ | |||
数字化智慧校园 | |||
基础信息接口 | |||
V2.0 | |||
接口服务器: | |||
学校服务器,部署地址:http://127.0.0.1:9002/ | |||
调用方式: | |||
标准http get请求,数据接口需要在header中传参 token,否则无数据返回。 | |||
返回数据类型: | |||
标准json | |||
返回数据结构 | |||
主要关心code和data即可 | |||
属性 | |||
返回值 | |||
备注 | |||
code | |||
200(int) | |||
200成功 其余失败 | |||
info | |||
响应成功(string) | |||
状态描述 | |||
data | |||
业务数据(object) | |||
业务数据 | |||
获取TOKEN | |||
地址:http://部署地址/arrangelesson/gettoken?sysid=1 sysid向管理员获取 | |||
属性 | |||
返回值 | |||
备注 | |||
code | |||
200(int) | |||
200成功 其余失败 | |||
info | |||
响应成功(string) | |||
状态描述 | |||
data | |||
业务数据(object) | |||
业务数据 | |||
部门接口 | |||
地址:http://部署地址/arrangelesson/department | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
F_DepartmentId | |||
GUID (string) | |||
GUID部门ID | |||
否 | |||
F_ParentId | |||
上级部门ID(string) | |||
-1和0均代表根 | |||
否 | |||
F_EnCode | |||
部门编号(string) | |||
部门编号 | |||
否 | |||
F_FullName | |||
部门全称(string) | |||
否 | |||
F_ShortName | |||
部门简称(string) | |||
F_Manager | |||
负责人(string) | |||
F_OuterPhone | |||
电话(string) | |||
教师信息接口 | |||
地址:http://部署地址/arrangelesson/allteacher | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
EmpId | |||
GUID (string) | |||
GUID教师ID | |||
否 | |||
EmpNo | |||
教职工编号(string) | |||
否 | |||
EmpName | |||
职工姓名(string) | |||
否 | |||
GenderNo | |||
性别(bool) | |||
true男false女 | |||
Birthday | |||
生日(datetime) | |||
F_DepartmentId | |||
部门ID(string) | |||
mobile | |||
电话(string) | |||
学生信息接口 | |||
地址:http://部署地址/arrangelesson/allstudent | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
StuId | |||
GUID (string) | |||
GUID学生ID | |||
否 | |||
StuNo | |||
学生编号(string) | |||
否 | |||
StuName | |||
姓名(string) | |||
否 | |||
ksh | |||
考生号(string) | |||
GenderNo | |||
性别(bool) | |||
true男false女 | |||
Birthday | |||
生日(datetime) | |||
mobile | |||
电话(string) | |||
IdentityCardNo | |||
身份证号(string) | |||
DeptNo | |||
系部编号(string) | |||
MajorNo | |||
专业编号(string) | |||
Grade | |||
级别(18代表2018级,19表示2019级)(string) | |||
ClassNo | |||
班级编号(string) | |||
系部接口 | |||
地址:http://部署地址/arrangelesson/alldept | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
DeptId | |||
GUID (string) | |||
GUID系部ID | |||
否 | |||
DeptNo | |||
系部编号(string) | |||
否 | |||
DeptName | |||
系部名称(string) | |||
否 | |||
专业接口 | |||
地址:http://部署地址/arrangelesson/allmajor | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
ID | |||
GUID (string) | |||
GUID专业ID | |||
否 | |||
MajorNo | |||
专业编号(string) | |||
否 | |||
MajorName | |||
专业名称(string) | |||
否 | |||
DeptNo | |||
系部编号(string) | |||
校区接口 | |||
地址:http://部署地址/arrangelesson/allschool | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
F_CompanyId | |||
GUID (string) | |||
GUID校区ID | |||
否 | |||
F_FullName | |||
校区名称(string) | |||
否 | |||
班级接口 | |||
地址:http://部署地址/arrangelesson/allclass | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
ClassId | |||
GUID (string) | |||
GUI班级ID | |||
否 | |||
ClassNo | |||
班级编号(string) | |||
否 | |||
ClassName | |||
班级名称(string) | |||
否 | |||
DeptNo | |||
系部编号(string) | |||
MajorNo | |||
专业编号(string) | |||
Grade | |||
级别(18代表2018级,19表示2019级)(string) | |||
用户接口 | |||
地址:http://部署地址/arrangelesson/alluser | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
F_UserId | |||
GUID (string) | |||
GUI用户ID | |||
否 | |||
ClassNo | |||
班级编号(string) | |||
F_CompanyId | |||
校区Id(string) | |||
F_Description | |||
用户类型(string) | |||
2教师,3学生 | |||
F_RealName | |||
姓名(string) | |||
F_Account | |||
登录帐号(string) | |||
Year | |||
级别(string) | |||
2018代表2018年入学 | |||
课程接口 | |||
地址:http://部署地址/arrangelesson/alllesson | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
LessonId | |||
GUID (string) | |||
GUI课程ID | |||
否 | |||
LessonNo | |||
课程编号(string) | |||
否 | |||
LessonName | |||
课程名称(string) | |||
否 | |||
LessonSortNo | |||
课程类型(string) | |||
1必修,2选修 | |||
F_SchoolId | |||
校区Id(string) | |||
必修开课计划接口 | |||
地址:http://部署地址/arrangelesson/allclasslesson | |||
所需参数:AcademicYearNo=19-20&Semester=1 | |||
参数名称 | |||
值 | |||
备注 | |||
AcademicYearNo | |||
19-20 | |||
代表学年19-20、18-19等 | |||
Semester | |||
1、2 | |||
学期1、2 | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
F_SchoolId | |||
校区Id(string) | |||
DeptNo | |||
系部编号(string) | |||
MajorNo | |||
专业编号(string) | |||
LessonNo | |||
课程编号(string) | |||
LessonName | |||
课程名称(string) | |||
EmpNo | |||
代课老师编号(string) | |||
EmpName | |||
代课老师姓名(string) | |||
TeachClassNo | |||
班级编号(string) | |||
ClassRoomNo | |||
教室编号(string) | |||
LessonTime | |||
上课节次(string) | |||
11代表星期一第一节,12星期一第二节 | |||
学生选修选课接口 | |||
地址:http://部署地址/arrangelesson/allelelectivelesson | |||
所需参数:AcademicYearNo=19-20&Semester=1 | |||
参数名称 | |||
值 | |||
备注 | |||
AcademicYearNo | |||
19-20 | |||
代表学年19-20、18-19等 | |||
Semester | |||
1、2 | |||
学期1、2 | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
StuNo | |||
学号(string) | |||
LessonNo | |||
课程编号(string) | |||
EmpNo | |||
代课老师编号(string) | |||
ClassRoomNo | |||
教室编号(string) | |||
LessonSection | |||
上课节次(string) | |||
37,38代表星期3第七节、第八节上课 | |||
LessonTime | |||
上课时间(string) | |||
16:20-17:05,17:15-18:00 两节课的时间 | |||
根据身份证号更新照片接口 | |||
标准http post请求 | |||
地址: | |||
http://部署地址/EducationalAdministration/EmpRegister/updatePhotoByIdCard | |||
所需参数:(限制一次最多传值50条) | |||
参数名称 | |||
值 | |||
备注 | |||
IdCard | |||
身份证号 | |||
PhotoUrl | |||
照片地址 | |||
IdentityFlag | |||
1、2 | |||
身份标识(1老师,2学生) | |||
主要业务数据 其余字段可忽略 | |||
属性 | |||
返回值 | |||
备注 | |||
可否为空 | |||
IdCard | |||
身份证号 | |||
OperateFlag | |||
true , false | |||
操作标识(true更新成功,false更新失败) | |||
FailMsg | |||
更新失败原因 | |||
@@ -191,6 +191,9 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="Bootstraper.cs" /> | |||
<Compile Include="Modules\ArrangelessonLogin.cs" /> | |||
<Compile Include="Modules\BaseNoAuthenticationNoLogin.cs" /> | |||
<Compile Include="Modules\UsernologinApi.cs" /> | |||
<Compile Include="Modules\EducationalAdministration\ArrangeExamTermApi.cs" /> | |||
<Compile Include="Modules\EducationalAdministration\ArrangeExamTermNewApi.cs" /> | |||
<Compile Include="Modules\FunctionApi.cs" /> | |||
@@ -274,6 +277,7 @@ | |||
<Compile Include="Program.cs" /> | |||
<Compile Include="Properties\AssemblyInfo.cs" /> | |||
<Compile Include="Modules\UserApi.cs" /> | |||
<Compile Include="Until\MyEnum.cs" /> | |||
<Compile Include="Until\ReqEntity.cs" /> | |||
<Compile Include="Until\ReqPageParam.cs" /> | |||
<Compile Include="Modules\PersonnelManagement\ActivityScheduleApi.cs" /> | |||
@@ -370,6 +374,7 @@ | |||
<ItemGroup> | |||
<Folder Include="App_Data\" /> | |||
<Folder Include="Models\" /> | |||
<Folder Include="Modules\RepairReport\" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Analyzer Include="..\packages\Microsoft.DependencyValidation.Analyzers.0.10.0\analyzers\dotnet\cs\Microsoft.DependencyValidation.Analyzers.resources.dll" /> | |||
@@ -6,15 +6,18 @@ using System.Web; | |||
using Learun.Application.Base.SystemModule; | |||
using Learun.Application.Organization; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using Learun.Util; | |||
using Nancy; | |||
using static Learun.Application.WebApi.Until.MyEnum; | |||
namespace Learun.Application.WebApi.Modules | |||
{ | |||
public class Arrangelesson : BaseNoAuthentication | |||
public class Arrangelesson : BaseNoAuthenticationNoLogin | |||
{ | |||
public Arrangelesson() | |||
: base("/arrangelesson/") | |||
{ | |||
Get["/gettoken"] = GetToken; | |||
Get["/lessontype"] = GetLessonTypes; | |||
Get["/classtype"] = GetClassType; | |||
Get["/student"] = GetStudents; | |||
@@ -82,7 +85,14 @@ namespace Learun.Application.WebApi.Modules | |||
{ | |||
return Success("ok"); | |||
} | |||
private Response GetToken(dynamic _) | |||
{ | |||
string sid = Request.Query["sysid"]; | |||
var sys = EnumAttribute.GetVal(typeof(ThrSys), sid.ToInt()); | |||
if (sys.IsEmpty()) return Fail("参数错误!"); | |||
var token = DESEncrypt.Encrypt(sys); | |||
return Success(token); | |||
} | |||
private Response GetAllLesson(dynamic _) | |||
{ | |||
var result = lessonInfoIbll.GetAllLesson(); | |||
@@ -0,0 +1,349 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Web; | |||
using Learun.Application.Organization; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using Learun.Util; | |||
using Nancy; | |||
using static Learun.Application.WebApi.Until.MyEnum; | |||
namespace Learun.Application.WebApi.Modules | |||
{ | |||
public class ArrangelessonLogin : BaseApi | |||
{ | |||
public ArrangelessonLogin() | |||
: base("/arrangelessonlogin/") | |||
{ | |||
Get["/lessontype"] = GetLessonTypes; | |||
Get["/classtype"] = GetClassType; | |||
Get["/student"] = GetStudents; | |||
Get["/lessonsortdetail"] = GetLessonSortDetails; | |||
Get["/lessonsort"] = GetLessonSorts; | |||
Get["/classlesson"] = GetClassLessons; | |||
Get["/bukaolist"] = GetBuKaoList; | |||
//以下接口需要传值学年学期 | |||
Get["/school"] = GetSchools; | |||
Get["/dept"] = GetDepts; | |||
Get["/major"] = GetMajors; | |||
Get["/classroom"] = GetClassrooms; | |||
Get["/lesson"] = GetLessons; | |||
Get["/teacher"] = GetTeachers; | |||
Get["/class"] = GetClasses; | |||
Get["/stu"] = GetStus; | |||
//以下返回全部 | |||
Get["/department"] = GetDepartment; | |||
Get["/allteacher"] = GetAllTeachers; | |||
Get["/allstudent"] = GetAllStudents; | |||
Get["/alldept"] = GetAllDept; | |||
Get["/allmajor"] = GetAllMajor; | |||
Get["/alllesson"] = GetAllLesson; | |||
Get["/allclass"] = GetAllClass; | |||
Get["/alluser"] = GetAllUsers; | |||
Get["/allschool"] = GetAllSchools; | |||
Get["/allclasslesson"] = GetAllClassLesson; | |||
Get["/allelelectivelesson"] = GetAllElectiveLesson; | |||
//以下接口不往ArrangeLessonSync里记录已传数据 | |||
Get["/schoolNotRecord"] = GetSchoolsNotRecord; | |||
Get["/deptNotRecord"] = GetDeptsNotRecord; | |||
Get["/majorNotRecord"] = GetMajorsNotRecord; | |||
Get["/classroomNotRecord"] = GetClassroomsNotRecord; | |||
Get["/lessonNotRecord"] = GetLessonsNotRecord; | |||
Get["/teacherNotRecord"] = GetTeachersNotRecord; | |||
Get["/classNotRecord"] = GetClassesNotRecord; | |||
Get["/stuNotRecord"] = GetStusNotRecord; | |||
Get["trantest"] = TranTest; | |||
//按条件重置基础数据同步状态 | |||
Get["/initbasicdata"] = InitBasicData; | |||
} | |||
private readonly ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); | |||
private readonly StuScoreIBLL stuScoreIBLL = new StuScoreBLL(); | |||
private DepartmentIBLL departmentIBLL = new DepartmentBLL(); | |||
EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); | |||
private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL(); | |||
CdDeptIBLL cdDeptIbll = new CdDeptBLL(); | |||
CdMajorIBLL cdMajorIbll = new CdMajorBLL(); | |||
private LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL(); | |||
ClassInfoIBLL classInfoIbll = new ClassInfoBLL(); | |||
UserIBLL userIbll = new UserBLL(); | |||
private CompanyIBLL companyIbll = new CompanyBLL(); | |||
private StuSelectLessonListOfElectiveIBLL stuSelectLessonListOfElectiveIbll = | |||
new StuSelectLessonListOfElectiveBLL(); | |||
private Response TranTest(dynamic _) | |||
{ | |||
return Success("ok"); | |||
} | |||
private Response GetAllLesson(dynamic _) | |||
{ | |||
var result = lessonInfoIbll.GetAllLesson(); | |||
return Success(result); | |||
} | |||
private Response GetAllClass(dynamic _) | |||
{ | |||
var result = classInfoIbll.GetAllClass(); | |||
return Success(result); | |||
} | |||
private Response GetAllTeachers(dynamic _) | |||
{ | |||
var result = empInfoIbll.GetAllList().Where(m => m.CheckMark == true).ToList(); | |||
return Success(result); | |||
} | |||
private Response GetAllSchools(dynamic _) | |||
{ | |||
var result = companyIbll.GetList(); | |||
return Success(result); | |||
} | |||
private Response GetAllClassLesson(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetAllClassLesson(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
private Response InitBasicData(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
string BaseTable = Request.Query["BaseTable"]; | |||
if (string.IsNullOrEmpty(AcademicYearNo) || string.IsNullOrEmpty(Semester)) | |||
{ | |||
return Fail("学年学期参数不能为空"); | |||
} | |||
if (string.IsNullOrEmpty(BaseTable)) | |||
{ | |||
return Fail("基础表参数不能为空"); | |||
} | |||
ArrangeLessonTermEntity arrangeLessonTermEntity = new ArrangeLessonTermEntity(); | |||
arrangeLessonTermEntity.AcademicYearNo = AcademicYearNo; | |||
arrangeLessonTermEntity.Semester = Semester; | |||
arrangeLessonTermEntity.SyncBasicTable = BaseTable; | |||
arrangeLessonTermIBLL.InitAsyncDataByCondition(arrangeLessonTermEntity); | |||
return Success("操作成功"); | |||
} | |||
private Response GetAllElectiveLesson(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = stuSelectLessonListOfElectiveIbll.GetAllElectiveLesson(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
private Response GetAllUsers(dynamic _) | |||
{ | |||
var result = userIbll.GetAllList().Where(m => !m.F_Account.Contains("System") && m.F_DeleteMark == 0 && m.F_EnabledMark == 1).Select(m => new | |||
{ | |||
m.F_UserId, | |||
m.F_CompanyId, | |||
m.F_DepartmentId, | |||
F_Description = m.F_Description == "教师" ? "2" : "3", | |||
ClassNo = stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(m.F_Account)?.ClassNo, | |||
m.F_RealName, | |||
m.F_Account, | |||
Year = "20" + stuInfoBasicIbll.GetStuInfoBasicEntityByStuNo(m.F_Account)?.Grade, | |||
m.F_IdentityCardNo | |||
}); | |||
return Success(result); | |||
} | |||
private Response GetAllStudents(dynamic _) | |||
{ | |||
var result = stuInfoBasicIbll.GetAllList(); | |||
return Success(result); | |||
} | |||
private Response GetDepartment(dynamic _) | |||
{ | |||
var result = departmentIBLL.GetAllList(); | |||
return Success(result); | |||
} | |||
private Response GetAllDept(dynamic _) | |||
{ | |||
var result = cdDeptIbll.GetAllList(); | |||
return Success(result); | |||
} | |||
private Response GetAllMajor(dynamic _) | |||
{ | |||
var result = cdMajorIbll.GetAllList(); | |||
return Success(result); | |||
} | |||
private Response GetLessonTypes(dynamic _) | |||
{ | |||
var result = arrangeLessonTermIBLL.GetLessonTypes(); | |||
return Success(result); | |||
} | |||
private Response GetDepts(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetDepts(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
private Response GetDeptsNotRecord(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetDeptsNotRecord(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
private Response GetSchools(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetSchools(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
private Response GetSchoolsNotRecord(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetSchoolsNotRecord(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
private Response GetClassLessons(dynamic _) | |||
{ | |||
var result = arrangeLessonTermIBLL.GetClassLessons().Select(m => new | |||
{ | |||
m.AcademicYearNo, | |||
m.Semester, | |||
m.DeptNo, | |||
m.MajorNo, | |||
m.LessonNo, | |||
m.TeachClassNo, | |||
m.EmpNo, | |||
m.LessonSortNo | |||
}); | |||
return Success(result); | |||
} | |||
public Response GetStudents(dynamic _) | |||
{ | |||
var result = arrangeLessonTermIBLL.GetStudents(); | |||
return Success(result); | |||
} | |||
public Response GetMajors(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetMajors(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetMajorsNotRecord(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetMajorsNotRecord(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetClassrooms(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetClassrooms(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetClassroomsNotRecord(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetClassroomsNotRecord(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetClassType(dynamic _) | |||
{ | |||
var result = arrangeLessonTermIBLL.GetClassType(); | |||
return Success(result); | |||
} | |||
public Response GetLessons(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetLessons(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetLessonsNotRecord(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetLessonsNotRecord(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetLessonSortDetails(dynamic _) | |||
{ | |||
var result = arrangeLessonTermIBLL.GetLessonSortDetails(); | |||
return Success(result); | |||
} | |||
public Response GetLessonSorts(dynamic _) | |||
{ | |||
var result = arrangeLessonTermIBLL.GetLessonSorts(); | |||
return Success(result); | |||
} | |||
public Response GetTeachers(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetTeachers(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetTeachersNotRecord(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetTeachersNotRecord(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetClasses(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetClasses(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetClassesNotRecord(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetClassesNotRecord(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetStus(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetStus(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
public Response GetStusNotRecord(dynamic _) | |||
{ | |||
string AcademicYearNo = Request.Query["AcademicYearNo"]; | |||
string Semester = Request.Query["Semester"]; | |||
var result = arrangeLessonTermIBLL.GetStusNotRecord(AcademicYearNo, Semester); | |||
return Success(result); | |||
} | |||
/// <summary> | |||
/// 补考名单数据 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
private Response GetBuKaoList(dynamic _) | |||
{ | |||
var allList = new List<StuScoreEntity>(); | |||
var notPassList = stuScoreIBLL.GetStuScoreNotPassList(); | |||
allList.AddRange(notPassList); | |||
var notPassTwoList = stuScoreIBLL.GetStuScoreNotPassTwoList(); | |||
allList.AddRange(notPassTwoList); | |||
var result = allList.Select(x => new { x.BuKaoFlag, x.AcademicYearNo, x.Semester, x.StuId, x.StuName, x.LessonId, x.LessonName, x.ClassId, x.ClassName, x.EmpId, x.EmpName }).OrderBy(x => x.BuKaoFlag).ThenByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.StuId); | |||
return Success(result); | |||
} | |||
} | |||
} |
@@ -0,0 +1,257 @@ | |||
using Learun.Application.Base.SystemModule; | |||
using Learun.Loger; | |||
using Learun.Util; | |||
using Learun.Util.Operat; | |||
using Nancy; | |||
using Nancy.ModelBinding; | |||
using System;//D:\Item\repos\DigitalScholl\Learun.Framework.Ultimate V7\Learun.Application.WebApi\Modules\TransferApi.cs | |||
using System.Linq; | |||
using static Learun.Application.WebApi.Until.MyEnum; | |||
namespace Learun.Application.WebApi | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.0 数字化智慧校园 | |||
/// Copyright (c) 2013-2018 北京泉江科技有限公司 | |||
/// 创建人:数字化智慧校园-框架开发组 | |||
/// 日 期:2017.05.12 | |||
/// 描 述:Nancy-Api基础模块 | |||
/// </summary> | |||
public class BaseNoAuthenticationNoLogin : NancyModule | |||
{ | |||
#region 构造函数 | |||
public BaseNoAuthenticationNoLogin() | |||
: base() | |||
{ | |||
Before += BeforeRequest; | |||
OnError += OnErroe; | |||
} | |||
public BaseNoAuthenticationNoLogin(string baseUrl) | |||
: base(baseUrl) | |||
{ | |||
Before += BeforeRequest; | |||
OnError += OnErroe; | |||
} | |||
#endregion | |||
#region 获取请求数据 | |||
/// <summary> | |||
/// 获取请求数据 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <returns></returns> | |||
public T GetReqData<T>() where T : class | |||
{ | |||
try | |||
{ | |||
ReqParameter<string> req = this.Bind<ReqParameter<string>>(); | |||
return req.data.ToObject<T>(); | |||
} | |||
catch (Exception) | |||
{ | |||
throw; | |||
} | |||
} | |||
/// <summary> | |||
/// 获取请求数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
public string GetReqData() | |||
{ | |||
try | |||
{ | |||
ReqParameter<string> req = this.Bind<ReqParameter<string>>(); | |||
return req.data; | |||
} | |||
catch (Exception) | |||
{ | |||
throw; | |||
} | |||
} | |||
/// <summary> | |||
/// 获取请求数据 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <returns></returns> | |||
public T GetReq<T>() where T : class | |||
{ | |||
try | |||
{ | |||
T req = this.Bind<T>(); | |||
return req; | |||
} | |||
catch (Exception) | |||
{ | |||
throw; | |||
} | |||
} | |||
#endregion | |||
#region 响应接口 | |||
/// <summary> | |||
/// 成功响应数据 | |||
/// </summary> | |||
/// <param name="msg"></param> | |||
/// <returns></returns> | |||
public Response Success(string info) | |||
{ | |||
ResParameter res = new ResParameter { code = ResponseCode.success, info = "响应成功", data = info }; | |||
return Response.AsText(res.ToJson()).WithContentType("application/json"); | |||
} | |||
/// <summary> | |||
/// 成功响应数据 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="res"></param> | |||
/// <returns></returns> | |||
public Response Success(object data) | |||
{ | |||
ResParameter res = new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }; | |||
return Response.AsText(res.ToJson()).WithContentType("application/json"); | |||
} | |||
/// <summary> | |||
/// 成功响应数据 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="res"></param> | |||
/// <returns></returns> | |||
public Response Success<T>(T data) where T : class | |||
{ | |||
ResParameter res = new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }; | |||
return Response.AsText(res.ToJson()).WithContentType("application/json"); | |||
} | |||
/// <summary> | |||
/// 成功响应数据 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="res"></param> | |||
/// <returns></returns> | |||
public Response SuccessString(string data) | |||
{ | |||
ResParameter res = new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }; | |||
return Response.AsText(res.ToJson()).WithContentType("application/json"); | |||
} | |||
/// <summary> | |||
/// 接口响应失败 | |||
/// </summary> | |||
/// <param name="msg"></param> | |||
/// <returns></returns> | |||
public Response Fail(string info) | |||
{ | |||
ResParameter res = new ResParameter { code = ResponseCode.fail, info = info, data = new object { } }; | |||
return Response.AsText(res.ToJson()).WithContentType("application/json"); | |||
} | |||
public Response FailNoLogin(string info) | |||
{ | |||
ResParameter res = new ResParameter { code = ResponseCode.nologin, info = info, data = new object { } }; | |||
return Response.AsText(res.ToJson()).WithContentType("application/json"); | |||
} | |||
#endregion | |||
#region 异常抓取 | |||
/// <summary> | |||
/// 日志对象实体 | |||
/// </summary> | |||
private Log _logger; | |||
/// <summary> | |||
/// 日志操作 | |||
/// </summary> | |||
public Log Logger | |||
{ | |||
get { return _logger ?? (_logger = LogFactory.GetLogger(this.GetType().ToString())); } | |||
} | |||
/// <summary> | |||
/// 监听接口异常 | |||
/// </summary> | |||
/// <param name="ctx">连接上下信息</param> | |||
/// <param name="ex">异常信息</param> | |||
/// <returns></returns> | |||
private Response OnErroe(NancyContext ctx, Exception ex) | |||
{ | |||
try | |||
{ | |||
this.WriteLog(ctx, ex); | |||
} | |||
catch (Exception) | |||
{ | |||
} | |||
string msg = "提示:" + ex.Message; | |||
return Response.AsText(new ResParameter { code = ResponseCode.exception, info = msg }.ToJson()).WithContentType("application/json").WithStatusCode(HttpStatusCode.OK); | |||
} | |||
/// <summary> | |||
/// 写入日志(log4net) | |||
/// </summary> | |||
/// <param name="context">提供使用</param> | |||
private void WriteLog(NancyContext context, Exception ex) | |||
{ | |||
if (context == null) | |||
return; | |||
string path = context.ResolvedRoute.Description.Path; | |||
var log = LogFactory.GetLogger("workflowapi"); | |||
Exception Error = ex; | |||
LogMessage logMessage = new LogMessage(); | |||
logMessage.OperationTime = DateTime.Now; | |||
logMessage.Url = path; | |||
logMessage.Class = "learunwebapi"; | |||
logMessage.Ip = Net.Ip; | |||
logMessage.Host = Net.Host; | |||
logMessage.Browser = Net.Browser; | |||
if (Error.InnerException == null) | |||
{ | |||
logMessage.ExceptionInfo = Error.Message; | |||
logMessage.ExceptionSource = Error.Source; | |||
logMessage.ExceptionRemark = Error.StackTrace; | |||
} | |||
else | |||
{ | |||
logMessage.ExceptionInfo = Error.InnerException.Message; | |||
logMessage.ExceptionSource = Error.InnerException.Source; | |||
logMessage.ExceptionRemark = Error.InnerException.StackTrace; | |||
} | |||
string strMessage = new LogFormat().ExceptionFormat(logMessage); | |||
log.Error(strMessage); | |||
LogEntity logEntity = new LogEntity(); | |||
logEntity.F_CategoryId = 4; | |||
logEntity.F_OperateTypeId = ((int)OperationType.Exception).ToString(); | |||
logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Exception); | |||
logEntity.F_OperateAccount = logMessage.UserName; | |||
logEntity.F_ExecuteResult = -1; | |||
logEntity.F_ExecuteResultJson = strMessage; | |||
logEntity.F_Description = "移动端"; | |||
logEntity.WriteLog(); | |||
} | |||
#endregion | |||
#region 权限验证 | |||
/// <summary> | |||
/// 前置拦截器 | |||
/// </summary> | |||
/// <param name="ctx"></param> | |||
/// <returns></returns> | |||
private Response BeforeRequest(NancyContext ctx) | |||
{ | |||
string path = ctx.ResolvedRoute.Description.Path; | |||
if (path == "/arrangelesson/gettoken") | |||
{// token接口,默认页面接口不做权限验证处理 | |||
return null; | |||
} | |||
var rToken = ctx.Request.Headers["token"].FirstOrDefault(); | |||
if(rToken.IsEmpty()) return this.FailNoLogin("权限校验失败!"); | |||
var tss = EnumAttribute.GetVsS(typeof(ThrSys)); | |||
var Requesttoken = DESEncrypt.Decrypt(rToken); | |||
if(!tss.Contains(Requesttoken)) return this.FailNoLogin("权限校验失败!!"); | |||
return null; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,469 @@ | |||
using Nancy; | |||
using Learun.Util; | |||
using System.Collections.Generic; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using System; | |||
using System.IO; | |||
using Learun.Application.Base.SystemModule; | |||
using System.Net; | |||
using System.Linq; | |||
using System.Text; | |||
using Newtonsoft.Json; | |||
using System.Collections; | |||
using System.Web; | |||
using Learun.Application.Organization; | |||
namespace Learun.Application.WebApi | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS-Ultimate V7.0.0 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2018 上海力软信息技术有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2019-08-19 17:50 | |||
/// 描 述:传送接口 | |||
/// </summary> | |||
public class TransferApi : BaseNoAuthentication | |||
{ | |||
private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL(); | |||
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); | |||
private DepartmentIBLL departmentIBLL = new DepartmentBLL(); | |||
private UserIBLL userIBLL = new UserBLL(); | |||
/// <summary> | |||
/// 注册接口 | |||
/// <summary> | |||
public TransferApi() | |||
: base("/TransferApi/BasicInfo") | |||
{ | |||
//发送部门基础信息 | |||
Get["/sendDepartmentInfo"] = SendDepartmentInfo; | |||
//发送教师基础信息 | |||
Get["/sendTeacherInfo"] = SendTeacherInfo; | |||
//发送学生基础信息 | |||
Get["/sendStudentInfo"] = SendStudentInfo; | |||
} | |||
/// <summary> | |||
/// cookie | |||
/// </summary> | |||
public static CookieCollection cookie { get; set; } | |||
public static string cookiestr { get; set; } | |||
public static DateTime cookiestrTime { get; set; } | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取cookie接口 | |||
/// </summary> | |||
/// <returns></returns> | |||
public static bool GetCookie() | |||
{ | |||
var loginParam = new | |||
{ | |||
Id = "admin", | |||
Pwd = Md5Helper.Encrypt("Admin_123456", 32) | |||
}; | |||
var responseLogin = SendRequest("POST", @"http://172.70.0.4:8088/fastgate/user/login", Encoding.UTF8, JsonConvert.SerializeObject(loginParam)); | |||
var responseLoginObj = JsonConvert.DeserializeObject<dynamic>(responseLogin); | |||
if (responseLoginObj.ErrCode == 200) | |||
{ | |||
return true; | |||
} | |||
else | |||
{ | |||
return GetCookie(); | |||
} | |||
} | |||
/// <summary> | |||
/// 发送部门基础信息 | |||
/// <summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response SendDepartmentInfo(dynamic _) | |||
{ | |||
var result = new List<string>(); | |||
if (string.IsNullOrEmpty(cookiestr) || ((DateTime.Now - cookiestrTime).Minutes > 10)) | |||
{ | |||
//调登录接口拿到cookie | |||
GetCookie(); | |||
} | |||
var departmentList = departmentIBLL.GetAllList().Where(x => x.SendFlag == false); | |||
foreach (var item in departmentList) | |||
{ | |||
var param = new | |||
{ | |||
ParentCode = string.IsNullOrEmpty(item.F_ParentId) || item.F_ParentId == "0" ? "iccsid" : (departmentIBLL.GetEntity(item.F_ParentId) == null ? "iccsid" : departmentIBLL.GetEntity(item.F_ParentId)?.F_EnCode), | |||
pageSize = 10, | |||
Name = item.F_FullName, | |||
Code = item.F_EnCode, | |||
}; | |||
var responseSend = SendRequestWithCookie("POST", "application/json;charset=utf-8", @"http://172.70.0.4:8088/fastgate/department", Encoding.UTF8, JsonConvert.SerializeObject(param)); | |||
var responseSendObj = JsonConvert.DeserializeObject<dynamic>(responseSend); | |||
result.Add("部门编号" + item.F_EnCode + ",新增接口结果:" + responseSendObj.ErrCode + responseSendObj.ErrMsg); | |||
if (responseSendObj.ErrCode == 200) | |||
{ | |||
//第三方新增成功,修改表-发送标识为true | |||
//TODO: | |||
var entity = departmentIBLL.GetEntity(item.F_DepartmentId); | |||
if (entity != null) | |||
{ | |||
entity.SendFlag = true; | |||
departmentIBLL.SaveEntity2(entity.F_DepartmentId, entity); | |||
} | |||
} | |||
else if (responseSendObj.ErrCode == 1010) //{ "ErrCode":1010,"ErrMsg":"登录状态已失效"} | |||
{ | |||
//获取cookie | |||
GetCookie(); | |||
} | |||
else if (responseSendObj.ErrCode == 10000) //10000 code repetition | |||
{ | |||
//调修改接口 | |||
var param2 = new | |||
{ | |||
Code = item.F_EnCode, | |||
Name = item.F_FullName, | |||
pageSize = 10, | |||
}; | |||
var responseSend2 = SendRequestWithCookie("PUT", "application/json;charset=utf-8", @"http://172.70.0.4:8088/fastgate/department", Encoding.UTF8, JsonConvert.SerializeObject(param2)); | |||
var responseSendObj2 = JsonConvert.DeserializeObject<dynamic>(responseSend2); | |||
result.Add("部门编号" + item.F_EnCode + ",修改接口结果:" + responseSendObj2.ErrCode + responseSendObj2.ErrMsg); | |||
if (responseSendObj2.ErrCode == 200) | |||
{ | |||
//第三方修改成功,修改表-发送标识为true | |||
//TODO: | |||
var entity = departmentIBLL.GetEntity(item.F_DepartmentId); | |||
if (entity != null) | |||
{ | |||
entity.SendFlag = true; | |||
departmentIBLL.SaveEntity2(entity.F_DepartmentId, entity); | |||
} | |||
} | |||
else | |||
{ | |||
//其他错误 | |||
} | |||
} | |||
else | |||
{ | |||
//其他错误 | |||
} | |||
} | |||
return Success(result); | |||
} | |||
/// <summary> | |||
/// 发送教师基础信息 | |||
/// <summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response SendTeacherInfo(dynamic _) | |||
{ | |||
var result = new List<string>(); | |||
if (string.IsNullOrEmpty(cookiestr) || ((DateTime.Now - cookiestrTime).Minutes > 10)) | |||
{ | |||
//调登录接口拿到cookie | |||
GetCookie(); | |||
} | |||
//var teacherList = empInfoIBLL.GetAllList(); | |||
//foreach (var item in teacherList) | |||
{ | |||
Dictionary<string, string> parameters = new Dictionary<string, string>(); //参数列表 | |||
parameters.Add("Sex", "1"); | |||
parameters.Add("Depart", "5"); | |||
parameters.Add("Name", "测试1"); | |||
parameters.Add("Code", "ceshi1"); | |||
var param = BuildQuery2(parameters, "----WebKitFormBoundaryAOT8GpQYYAP9jgGf"); | |||
var contentType = "multipart/form-data; boundary=----WebKitFormBoundaryAOT8GpQYYAP9jgGf"; | |||
var responseSend = SendRequestWithCookie("POST", contentType, @"http://172.70.0.4:8088/fastgate/person", Encoding.UTF8, param); | |||
var responseSendObj = JsonConvert.DeserializeObject<dynamic>(responseSend); | |||
result.Add("教师编号,新增接口结果:" + responseSendObj.ErrCode + responseSendObj.ErrMsg); | |||
if (responseSendObj.ErrCode == 200) | |||
{ | |||
//第三方新增成功,修改表-发送标识为true | |||
//TODO: | |||
} | |||
else if (responseSendObj.ErrCode == 1010) //{ "ErrCode":1010,"ErrMsg":"登录状态已失效"} | |||
{ | |||
//获取cookie | |||
GetCookie(); | |||
} | |||
else if (responseSendObj.ErrCode == 202) //202 code repeat | |||
{ | |||
//调查询接口 | |||
var responseSend3 = SendRequestWithCookie("GET", "application/json;charset=utf-8", @"http://172.70.0.4:8088/fastgate/personCode/ceshi1", Encoding.UTF8, null); | |||
var responseSendObj3 = JsonConvert.DeserializeObject<PersonInfo>(responseSend3); | |||
result.Add("教师编号,查询接口结果:" + responseSendObj3.ErrCode + responseSendObj3.ErrMsg + JsonConvert.SerializeObject(responseSendObj3.data)); | |||
if (responseSendObj3.ErrCode == 200) | |||
{ | |||
//第三方查询成功 | |||
//调修改接口 | |||
Dictionary<string, string> parameters2 = new Dictionary<string, string>(); //参数列表 | |||
parameters2.Add("Sex", "1"); | |||
parameters2.Add("Depart", "5"); | |||
parameters2.Add("Name", "测试ceshi1"); | |||
parameters2.Add("Code", "ceshi1"); | |||
parameters2.Add("Seqid", responseSendObj3.data.Seqid.ToString()); | |||
parameters2.Add("ImageList", string.Join(",", responseSendObj3.data.Pictures.Select(x => x.PersonPicturePath))); | |||
var param2 = BuildQuery2(parameters2, "----WebKitFormBoundaryMAj7ABMLt3aJpmGH"); | |||
var contentType2 = "multipart/form-data; boundary=----WebKitFormBoundaryMAj7ABMLt3aJpmGH"; | |||
var responseSend2 = SendRequestWithCookie("PUT", contentType2, @"http://172.70.0.4:8088/fastgate/person", Encoding.UTF8, param2); | |||
var responseSendObj2 = JsonConvert.DeserializeObject<dynamic>(responseSend2); | |||
result.Add("教师编号,修改接口结果:" + responseSendObj2.ErrCode + responseSendObj2.ErrMsg); | |||
if (responseSendObj2.ErrCode == 200) | |||
{ | |||
//第三方修改成功,修改表-发送标识为true | |||
//TODO: | |||
} | |||
else if (responseSendObj2.ErrCode == 1010) //{ "ErrCode":1010,"ErrMsg":"登录状态已失效"} | |||
{ | |||
//获取cookie | |||
GetCookie(); | |||
} | |||
else | |||
{ | |||
//其他错误 | |||
} | |||
} | |||
else if (responseSendObj3.ErrCode == 1010) //{ "ErrCode":1010,"ErrMsg":"登录状态已失效"} | |||
{ | |||
//获取cookie | |||
GetCookie(); | |||
} | |||
} | |||
else | |||
{ | |||
//其他错误 | |||
} | |||
} | |||
return Success(result); | |||
} | |||
/// <summary> | |||
/// 发送学生基础信息 | |||
/// </summary> | |||
/// <returns></returns> | |||
public Response SendStudentInfo(dynamic _) | |||
{ | |||
return Success("成功了!"); | |||
} | |||
#endregion | |||
#region 公共方法 | |||
/// <summary> | |||
/// 请求获取cookie: | |||
/// </summary> | |||
/// <param name="type">GET,POST</param> | |||
/// <param name="url"></param> | |||
/// <param name="encoding">UTF-8</param> | |||
/// <param name="data">传送需要的参数</param> | |||
/// <returns></returns> | |||
public static string SendRequest(string type, string url, Encoding encoding, string data) | |||
{ | |||
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); | |||
webRequest.Method = type; | |||
webRequest.ContentType = "application/json"; | |||
if (type == "POST") | |||
{ | |||
byte[] postdata = Encoding.UTF8.GetBytes(data); | |||
webRequest.ContentLength = postdata.Length; | |||
Stream newStream = webRequest.GetRequestStream(); | |||
newStream.Write(postdata, 0, postdata.Length); | |||
newStream.Close(); | |||
} | |||
//使用HttpWebRequest的CookieContainer属性进行设置 | |||
CookieContainer ckCtnr = new CookieContainer(); | |||
if (cookie != null) | |||
{ | |||
ckCtnr.Add(cookie); //此处的cookie是HttpWebResponse对象的Cookies属性 | |||
} | |||
//获取应答网页 | |||
webRequest.CookieContainer = ckCtnr; | |||
//webRequest.Headers.Add("Cookie", "JSESSIONID=518211FE9243E875A3C570D510E7262F; Path=/fastgate; HttpOnly"); | |||
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); | |||
cookie = webResponse.Cookies;//获取Cookie | |||
cookiestr = webResponse.Headers.Get("Set-Cookie");//获取Cookie字符串 | |||
if (!string.IsNullOrEmpty(cookiestr)) | |||
{ | |||
cookiestrTime = DateTime.Now;//获取Cookie的时间 | |||
} | |||
StreamReader sr = new StreamReader(webResponse.GetResponseStream(), encoding); | |||
string str = sr.ReadToEnd(); | |||
sr.Close(); | |||
webResponse.Close(); | |||
return str; | |||
} | |||
/// <summary> | |||
/// 请求携带cookie: | |||
/// </summary> | |||
/// <param name="type">GET,POST,PUT</param> | |||
/// <param name="contentType">请求头类型(json是application/json;charset=utf-8,form-data是multipart/form-data; boundary=----WebKitFormBoundaryAOT8GpQYYAP9jgGf,)</param> | |||
/// <param name="url"></param> | |||
/// <param name="encoding">UTF-8</param> | |||
/// <param name="data">传送需要的参数</param> | |||
/// <returns></returns> | |||
public static string SendRequestWithCookie(string type, string contentType, string url, Encoding encoding, string data) | |||
{ | |||
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); | |||
webRequest.Method = type; | |||
webRequest.ContentType = contentType; | |||
webRequest.Headers.Add("Cookie", cookiestr);//携带Cookie | |||
if (type == "POST" || type == "PUT") | |||
{ | |||
byte[] postdata = Encoding.UTF8.GetBytes(data); | |||
webRequest.ContentLength = postdata.Length; | |||
Stream newStream = webRequest.GetRequestStream(); | |||
newStream.Write(postdata, 0, postdata.Length); | |||
newStream.Close(); | |||
} | |||
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); | |||
StreamReader sr = new StreamReader(webResponse.GetResponseStream(), encoding); | |||
string str = sr.ReadToEnd(); | |||
sr.Close(); | |||
webResponse.Close(); | |||
return str; | |||
} | |||
/// <summary> | |||
/// 组装请求参数 | |||
/// </summary> | |||
/// <param name="parameters"></param> | |||
/// <param name="encode"></param> | |||
/// <returns></returns> | |||
private static string BuildQuery(IDictionary<string, string> parameters, string encode) | |||
{ | |||
StringBuilder postData = new StringBuilder(); | |||
bool hasParam = false; | |||
IEnumerator<KeyValuePair<string, string>> dem = parameters.GetEnumerator(); | |||
while (dem.MoveNext()) | |||
{ | |||
string name = dem.Current.Key; | |||
string value = dem.Current.Value; | |||
// 忽略参数名或参数值为空的参数 | |||
if (!string.IsNullOrEmpty(name)) | |||
{ | |||
if (hasParam) | |||
{ | |||
postData.Append("&"); | |||
} | |||
postData.Append(name); | |||
postData.Append("="); | |||
if (encode == "gb2312") | |||
{ | |||
postData.Append(HttpUtility.UrlEncode(value, Encoding.GetEncoding("gb2312"))); | |||
} | |||
else if (encode == "utf8") | |||
{ | |||
postData.Append(HttpUtility.UrlEncode(value, Encoding.UTF8)); | |||
} | |||
else | |||
{ | |||
postData.Append(value); | |||
} | |||
hasParam = true; | |||
} | |||
} | |||
return postData.ToString(); | |||
} | |||
/// <summary> | |||
/// 组装请求参数 | |||
/// </summary> | |||
/// <param name="parameters">key-value</param> | |||
/// <param name="boundary">分隔符</param> | |||
/// <returns></returns> | |||
private static string BuildQuery2(IDictionary<string, string> parameters, string boundary) | |||
{ | |||
StringBuilder buffer = new StringBuilder(); | |||
foreach (string key in parameters.Keys) | |||
{ | |||
buffer.Append("\r\n").Append("--").Append(boundary).Append("\r\n"); | |||
if (key == "file") | |||
{ | |||
buffer.Append("Content-Disposition: form-data; name=\"" + key + "\";filename=\"920_complete_1.jpg\"\r\n"); | |||
buffer.Append("Content-Type: image/jpeg"); | |||
} | |||
else | |||
{ | |||
buffer.Append("Content-Disposition: form-data; name=\"" + key + "\"\r\n\r\n"); | |||
buffer.Append(parameters[key]); | |||
} | |||
} | |||
buffer.Append("\r\n").Append("--").Append(boundary).Append("--"); | |||
return buffer.ToString(); | |||
} | |||
#endregion | |||
#region 私有类 | |||
/// <summary> | |||
/// 表单实体类 | |||
/// <summary> | |||
private class ReqFormEntity | |||
{ | |||
public string keyValue { get; set; } | |||
public string strEntity { get; set; } | |||
} | |||
/// <summary> | |||
/// 人员详细信息 | |||
/// <summary> | |||
private class PersonInfo | |||
{ | |||
/// <summary> | |||
/// 错误码(200表示成功, | |||
/// </summary> | |||
public int ErrCode { get; set; } | |||
/// <summary> | |||
/// 错误信息,”success”为正常 | |||
/// </summary> | |||
public string ErrMsg { get; set; } | |||
public PersonInfoData data { get; set; } | |||
} | |||
private class PersonInfoData | |||
{ | |||
/// <summary> | |||
/// 人员存在数据库的唯一ID | |||
/// </summary> | |||
public int Seqid { get; set; } | |||
/// <summary> | |||
/// 头像存储的地址ur | |||
/// </summary> | |||
public List<PersonDataPictures> Pictures { get; set; } | |||
} | |||
private class PersonDataPictures | |||
{ | |||
/// <summary> | |||
/// 登记照片地址 | |||
/// </summary> | |||
public string PersonPicturePath { get; set; } | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace Learun.Application.WebApi.Until | |||
{ | |||
public class MyEnum | |||
{ | |||
public enum ThrSys | |||
{ | |||
[Description("超星")] | |||
ChaoXin=31233, | |||
[Description("正方")] | |||
ZhengFang = 31234 | |||
} | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Reflection; | |||
@@ -40,5 +41,36 @@ namespace Learun.Util | |||
} | |||
return null; | |||
} | |||
public static string GetVal(Type enumType,int value) | |||
{ | |||
try | |||
{ | |||
var name = enumType.GetEnumName(value); | |||
return name; | |||
} | |||
catch (Exception e) | |||
{ | |||
return ""; | |||
} | |||
} | |||
/// <summary> | |||
/// 返回枚举项的描述信息。 | |||
/// </summary> | |||
/// <param name="value">要获取描述信息的枚举项。</param> | |||
/// <returns>枚举想的描述信息。</returns> | |||
public static List<string> GetVsS(Type value) | |||
{ | |||
var ls = new List<string>(); | |||
var vs = Enum.GetValues(value); | |||
foreach (var item in vs) | |||
{ | |||
ls.Add(item.ToString()); | |||
} | |||
return ls; | |||
} | |||
} | |||
} |