From e34dd91b46f312fb81413e41599db235229d4536 Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Sat, 18 Jul 2020 16:31:00 +0800 Subject: [PATCH] 'commit' --- .../BaseClassService/BaseClassService.go | 42 +++++++++++ .../BaseGlobalService/BaseGlobalService.go | 31 ++++++++ .../BaseOrganizationService.go | 61 ++++++++++++++++ .../BasePurviewService/BasePurviewService.go | 31 ++++++++ .../BaseRolePersonService.go | 43 +++++++++++ .../BaseStudentService/BaseStudentService.go | 55 ++++++++++++++ .../BaseTeacherService/BaseTeacherService.go | 55 ++++++++++++++ .../GovArea/GovAreaService/GovAreaService.go | 31 ++++++++ .../SysDict/SysDictService/SysDictService.go | 49 +++++++++++++ .../SysLoginpersonService.go | 73 +++++++++++++++++++ dsBaseRpc/main.go | 1 - 11 files changed, 471 insertions(+), 1 deletion(-) diff --git a/dsBaseRpc/RpcService/BaseClass/BaseClassService/BaseClassService.go b/dsBaseRpc/RpcService/BaseClass/BaseClassService/BaseClassService.go index ee0ca9e1..7c187911 100644 --- a/dsBaseRpc/RpcService/BaseClass/BaseClassService/BaseClassService.go +++ b/dsBaseRpc/RpcService/BaseClass/BaseClassService/BaseClassService.go @@ -21,6 +21,12 @@ type Rpc struct{} //服务对象 //选择单条 func (s *Rpc) GetBaseClass(ctx context.Context, in *BaseClassProto.ModelArg) (*BaseClassProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseClassProto.Reply //通用获取单条 @@ -35,6 +41,12 @@ func (s *Rpc) GetBaseClass(ctx context.Context, in *BaseClassProto.ModelArg) (*B //增加 func (s *Rpc) AddBaseClass(ctx context.Context, in *BaseClassProto.ModelArg) (*BaseClassProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseClassProto.Reply //检查单位号是不是存在 @@ -150,6 +162,12 @@ func (s *Rpc) AddBaseClass(ctx context.Context, in *BaseClassProto.ModelArg) (*B //删除 func (s *Rpc) DeleteBaseClass(ctx context.Context, in *BaseClassProto.DeleteIdsArg) (*BaseClassProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseClassProto.Reply @@ -204,6 +222,12 @@ func (s *Rpc) DeleteBaseClass(ctx context.Context, in *BaseClassProto.DeleteIdsA //修改 func (s *Rpc) UpdateBaseClass(ctx context.Context, in *BaseClassProto.ModelArg) (*BaseClassProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseClassProto.Reply //修改 @@ -241,6 +265,12 @@ func (s *Rpc) UpdateBaseClass(ctx context.Context, in *BaseClassProto.ModelArg) //分页查询 func (s *Rpc) PageBaseClass(ctx context.Context, in *BaseClassProto.QueryArg) (*BaseClassProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseClassProto.Reply list, count, err := BaseClassDao.PageBaseClass(in) @@ -260,6 +290,12 @@ func (s *Rpc) PageBaseClass(ctx context.Context, in *BaseClassProto.QueryArg) (* //根据学校ID获取学部(学段)信息 func (s *Rpc) GetStage(ctx context.Context, in *BaseClassProto.ModelArg) (*BaseClassProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseClassProto.Reply list, count, err := BaseClassDao.GetStage(in.BureauId) @@ -279,6 +315,12 @@ func (s *Rpc) GetStage(ctx context.Context, in *BaseClassProto.ModelArg) (*BaseC //根据学校ID和学部(学段)ID获取入学年份 func (s *Rpc) GetRxnf(ctx context.Context, in *BaseClassProto.ModelArg) (*BaseClassProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseClassProto.Reply list, count, err := BaseClassDao.GetRxnf(in.BureauId, in.StageId) diff --git a/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalService/BaseGlobalService.go b/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalService/BaseGlobalService.go index dcff768f..f8501715 100644 --- a/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalService/BaseGlobalService.go +++ b/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalService/BaseGlobalService.go @@ -10,11 +10,18 @@ import ( "dsBaseRpc/Utils/LogUtil" "dsBaseRpc/Utils/SqlKit" "dsBaseRpc/models" + "fmt" ) type Rpc struct{} //服务对象 //选择单条 func (s *Rpc) GetBaseGlobal(ctx context.Context, in *BaseGlobalProto.ModelArg) (*BaseGlobalProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseGlobalProto.Reply //通用获取单条 @@ -29,6 +36,12 @@ func (s *Rpc) GetBaseGlobal(ctx context.Context, in *BaseGlobalProto.ModelArg) ( //增加 func (s *Rpc) AddBaseGlobal(ctx context.Context, in *BaseGlobalProto.ModelArg) (*BaseGlobalProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseGlobalProto.Reply //调用dao @@ -63,6 +76,12 @@ func (s *Rpc) AddBaseGlobal(ctx context.Context, in *BaseGlobalProto.ModelArg) ( //删除 func (s *Rpc) DeleteBaseGlobal(ctx context.Context, in *BaseGlobalProto.DeleteIdsArg) (*BaseGlobalProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseGlobalProto.Reply //调用通用删除命令进行删除 @@ -81,6 +100,12 @@ func (s *Rpc) DeleteBaseGlobal(ctx context.Context, in *BaseGlobalProto.DeleteId //修改 func (s *Rpc) UpdateBaseGlobal(ctx context.Context, in *BaseGlobalProto.ModelArg) (*BaseGlobalProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseGlobalProto.Reply //修改 @@ -116,6 +141,12 @@ func (s *Rpc) UpdateBaseGlobal(ctx context.Context, in *BaseGlobalProto.ModelArg //分页查询 func (s *Rpc) PageBaseGlobal(ctx context.Context, in *BaseGlobalProto.QueryArg) (*BaseGlobalProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseGlobalProto.Reply list, count, err := BaseGlobalDao.PageBaseGlobal(in) diff --git a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go index 930804a1..d0f350da 100644 --- a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go +++ b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go @@ -22,12 +22,19 @@ import ( "dsBaseRpc/Utils/SqlKit" "dsBaseRpc/models" "errors" + "fmt" ) type Rpc struct{} //服务对象 //选择单条 func (s *Rpc) GetBaseOrganization(ctx context.Context, in *BaseOrganizationProto.ModelArg) (*BaseOrganizationProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseOrganizationProto.Reply //使用通用方法获取单条记录 @@ -43,6 +50,12 @@ func (s *Rpc) GetBaseOrganization(ctx context.Context, in *BaseOrganizationProto //增加 func (s *Rpc) AddBaseOrganization(ctx context.Context, in *BaseOrganizationProto.ModelArg) (*BaseOrganizationProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseOrganizationProto.Reply //是不是部门 @@ -239,6 +252,12 @@ func (s *Rpc) AddBaseOrganization(ctx context.Context, in *BaseOrganizationProto //删除 func (s *Rpc) DeleteBaseOrganization(ctx context.Context, in *BaseOrganizationProto.DeleteIdsArg) (*BaseOrganizationProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseOrganizationProto.Reply @@ -356,6 +375,12 @@ func (s *Rpc) DeleteBaseOrganization(ctx context.Context, in *BaseOrganizationPr //修改 func (s *Rpc) UpdateBaseOrganization(ctx context.Context, in *BaseOrganizationProto.ModelArg) (*BaseOrganizationProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseOrganizationProto.Reply //1、指定的org_code是否存在 @@ -505,6 +530,12 @@ func (s *Rpc) UpdateBaseOrganization(ctx context.Context, in *BaseOrganizationPr //分页查询显示 func (s *Rpc) PageBaseOrganization(ctx context.Context, in *BaseOrganizationProto.QueryArg) (*BaseOrganizationProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseOrganizationProto.Reply //检查传入的area_code是否存在 @@ -546,6 +577,12 @@ func (s *Rpc) PageBaseOrganization(ctx context.Context, in *BaseOrganizationProt //一次查询多个 func (s *Rpc) GetMultipleBaseOrganization(ctx context.Context, in *BaseOrganizationProto.MultipleQueryArg) (*BaseOrganizationProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseOrganizationProto.Reply @@ -574,6 +611,12 @@ func (s *Rpc) GetMultipleBaseOrganization(ctx context.Context, in *BaseOrganizat //通过单位ID,获取单位及单位下所有的部门信息,组装成结构体返回,用于构建树 func (s *Rpc) GetBureauOrgTree(ctx context.Context, in *BaseOrganizationProto.ModelArg) (*BaseOrganizationProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseOrganizationProto.Reply //调用Dao层方法获取数据 @@ -604,6 +647,12 @@ func (s *Rpc) GetBureauOrgTree(ctx context.Context, in *BaseOrganizationProto.Mo //根据一个或多个部门ID获取部门领导 func (s *Rpc) GetOrgManager(ctx context.Context, in *BaseOrganizationProto.MultipleQueryArg) (*BaseOrganizationProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseOrganizationProto.Reply //调用Dao层方法获取数据 @@ -740,6 +789,12 @@ func UpdateManager(bureauId string, bUse int32) error { 时间:2020-06-08 */ func (s *Rpc) SetEnableEdu(ctx context.Context, in *BaseOrganizationProto.MultipleQueryArg) (*BaseOrganizationProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseOrganizationProto.Reply //设置为启用状态 @@ -763,6 +818,12 @@ func (s *Rpc) SetEnableEdu(ctx context.Context, in *BaseOrganizationProto.Multip 时间:2020-06-08 */ func (s *Rpc) SetDisableEdu(ctx context.Context, in *BaseOrganizationProto.MultipleQueryArg) (*BaseOrganizationProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseOrganizationProto.Reply //设置为禁用状态 diff --git a/dsBaseRpc/RpcService/BasePurview/BasePurviewService/BasePurviewService.go b/dsBaseRpc/RpcService/BasePurview/BasePurviewService/BasePurviewService.go index 93f9d5a9..3d3a2cb4 100644 --- a/dsBaseRpc/RpcService/BasePurview/BasePurviewService/BasePurviewService.go +++ b/dsBaseRpc/RpcService/BasePurview/BasePurviewService/BasePurviewService.go @@ -10,6 +10,7 @@ import ( "dsBaseRpc/Utils/LogUtil" "dsBaseRpc/Utils/SqlKit" "dsBaseRpc/models" + "fmt" "html" ) @@ -17,6 +18,12 @@ type Rpc struct{} //服务对象 //选择单条 func (s *Rpc) GetBasePurview(ctx context.Context, in *BasePurviewProto.ModelArg) (*BasePurviewProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //统一返回的结构体 var reply BasePurviewProto.Reply //通用获取单条 @@ -31,6 +38,12 @@ func (s *Rpc) GetBasePurview(ctx context.Context, in *BasePurviewProto.ModelArg) //增加 func (s *Rpc) AddBasePurview(ctx context.Context, in *BasePurviewProto.ModelArg) (*BasePurviewProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BasePurviewProto.Reply //1、检查非空 @@ -68,6 +81,12 @@ func (s *Rpc) AddBasePurview(ctx context.Context, in *BasePurviewProto.ModelArg) //删除 func (s *Rpc) DeleteBasePurview(ctx context.Context, in *BasePurviewProto.DeleteIdsArg) (*BasePurviewProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BasePurviewProto.Reply //调用通用删除命令进行删除 @@ -86,6 +105,12 @@ func (s *Rpc) DeleteBasePurview(ctx context.Context, in *BasePurviewProto.Delete //修改 func (s *Rpc) UpdateBasePurview(ctx context.Context, in *BasePurviewProto.ModelArg) (*BasePurviewProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() var reply BasePurviewProto.Reply model := new(models.TBasePurview) //修改 @@ -113,6 +138,12 @@ func (s *Rpc) UpdateBasePurview(ctx context.Context, in *BasePurviewProto.ModelA //分页查询 func (s *Rpc) PageBasePurview(ctx context.Context, in *BasePurviewProto.QueryArg) (*BasePurviewProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() var reply BasePurviewProto.Reply list, count, err := BasePurviewDao.PageBasePurview(in) diff --git a/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonService/BaseRolePersonService.go b/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonService/BaseRolePersonService.go index ca96310c..070d7588 100644 --- a/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonService/BaseRolePersonService.go +++ b/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonService/BaseRolePersonService.go @@ -11,12 +11,19 @@ import ( "dsBaseRpc/Utils/LogUtil" "dsBaseRpc/Utils/SqlKit" "dsBaseRpc/models" + "fmt" ) type Rpc struct{} //服务对象 //选择单条 func (s *Rpc) GetBaseRolePerson(ctx context.Context, in *BaseRolePersonProto.ModelArg) (*BaseRolePersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseRolePersonProto.Reply //通用获取单条 @@ -31,6 +38,12 @@ func (s *Rpc) GetBaseRolePerson(ctx context.Context, in *BaseRolePersonProto.Mod //增加 func (s *Rpc) AddBaseRolePerson(ctx context.Context, in *BaseRolePersonProto.ModelArg) (*BaseRolePersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseRolePersonProto.Reply //调用dao @@ -63,6 +76,12 @@ func (s *Rpc) AddBaseRolePerson(ctx context.Context, in *BaseRolePersonProto.Mod //删除 func (s *Rpc) DeleteBaseRolePerson(ctx context.Context, in *BaseRolePersonProto.DeleteIdsArg) (*BaseRolePersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseRolePersonProto.Reply //调用通用删除命令进行删除 @@ -81,6 +100,12 @@ func (s *Rpc) DeleteBaseRolePerson(ctx context.Context, in *BaseRolePersonProto. //修改 func (s *Rpc) UpdateBaseRolePerson(ctx context.Context, in *BaseRolePersonProto.ModelArg) (*BaseRolePersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseRolePersonProto.Reply //3、修改 @@ -114,6 +139,12 @@ func (s *Rpc) UpdateBaseRolePerson(ctx context.Context, in *BaseRolePersonProto. //分页查询 func (s *Rpc) PageBaseRolePerson(ctx context.Context, in *BaseRolePersonProto.QueryArg) (*BaseRolePersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseRolePersonProto.Reply list, count, err := BaseRolePersonDao.PageBaseRolePerson(in) @@ -143,6 +174,12 @@ func (s *Rpc) PageBaseRolePerson(ctx context.Context, in *BaseRolePersonProto.Qu //根据人员ID获取所管辖的地区信息 func (s *Rpc) GetManageArea(ctx context.Context, in *BaseRolePersonProto.GetManageAreaArg) (*BaseRolePersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() var reply BaseRolePersonProto.Reply //1、判断这个人员是不是超级管理员 @@ -199,6 +236,12 @@ func (s *Rpc) GetManageArea(ctx context.Context, in *BaseRolePersonProto.GetMana //检查指定人员是否有预操作数据对象的控制权 func (s *Rpc) CheckDataPrivilege(ctx context.Context, in *BaseRolePersonProto.CheckDataPrivilegeArg) (*BaseRolePersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() var reply BaseRolePersonProto.Reply //操作人员ID actionPersonId := in.ActionPersonId diff --git a/dsBaseRpc/RpcService/BaseStudent/BaseStudentService/BaseStudentService.go b/dsBaseRpc/RpcService/BaseStudent/BaseStudentService/BaseStudentService.go index f083b4a7..eddc8eeb 100644 --- a/dsBaseRpc/RpcService/BaseStudent/BaseStudentService/BaseStudentService.go +++ b/dsBaseRpc/RpcService/BaseStudent/BaseStudentService/BaseStudentService.go @@ -18,12 +18,19 @@ import ( "dsBaseRpc/Utils/PinYinUtil" "dsBaseRpc/Utils/SqlKit" "dsBaseRpc/models" + "fmt" "github.com/pkg/errors" ) type Rpc struct{} //服务对象 //选择单条 func (s *Rpc) GetBaseStudent(ctx context.Context, in *BaseStudentProto.ModelArg) (*BaseStudentProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseStudentProto.Reply //通用获取单条 @@ -38,6 +45,12 @@ func (s *Rpc) GetBaseStudent(ctx context.Context, in *BaseStudentProto.ModelArg) //增加 func (s *Rpc) AddBaseStudent(ctx context.Context, in *BaseStudentProto.ModelArg) (*BaseStudentProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseStudentProto.Reply //========================================== @@ -183,6 +196,12 @@ func (s *Rpc) AddBaseStudent(ctx context.Context, in *BaseStudentProto.ModelArg) //删除 func (s *Rpc) DeleteBaseStudent(ctx context.Context, in *BaseStudentProto.DeleteIdsArg) (*BaseStudentProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseStudentProto.Reply //调用通用删除命令进行删除 @@ -231,6 +250,12 @@ func (s *Rpc) DeleteBaseStudent(ctx context.Context, in *BaseStudentProto.Delete //修改 func (s *Rpc) UpdateBaseStudent(ctx context.Context, in *BaseStudentProto.ModelArg) (*BaseStudentProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseStudentProto.Reply @@ -344,6 +369,12 @@ func (s *Rpc) UpdateBaseStudent(ctx context.Context, in *BaseStudentProto.ModelA //分页查询 func (s *Rpc) PageBaseStudent(ctx context.Context, in *BaseStudentProto.QueryArg) (*BaseStudentProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseStudentProto.Reply list, count, err := BaseStudentDao.PageBaseStudent(in) @@ -363,6 +394,12 @@ func (s *Rpc) PageBaseStudent(ctx context.Context, in *BaseStudentProto.QueryArg //学生调整班级 func (s *Rpc) ReviseStudentClass(ctx context.Context, in *BaseStudentProto.ReviseArg) (*BaseStudentProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseStudentProto.Reply //调用dao @@ -382,6 +419,12 @@ func (s *Rpc) ReviseStudentClass(ctx context.Context, in *BaseStudentProto.Revis //导出本校学生账号信息到EXCEL func (s *Rpc) ExportStudentAccountInfoExcel(ctx context.Context, in *BaseStudentProto.ModelArg) (*BaseStudentProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseStudentProto.Reply list, _, err := BaseStudentDao.ExportStudentAccountInfoExcel(in) @@ -403,6 +446,12 @@ func (s *Rpc) ExportStudentAccountInfoExcel(ctx context.Context, in *BaseStudent //导出本校学生信息到EXCEL func (s *Rpc) ExportStudentInfoExcel(ctx context.Context, in *BaseStudentProto.ModelArg) (*BaseStudentProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseStudentProto.Reply TargetPath := CommonUtil.GetExportExcelFilePath() @@ -423,6 +472,12 @@ func (s *Rpc) ExportStudentInfoExcel(ctx context.Context, in *BaseStudentProto.M //导入本校学生信息 func (s *Rpc) ImportStudentInfoExcel(ctx context.Context, in *BaseStudentProto.ImportArg) (*BaseStudentProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseStudentProto.Reply //将业务逻辑封装到dao层 diff --git a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherService/BaseTeacherService.go b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherService/BaseTeacherService.go index 4594a5c2..f37523ea 100644 --- a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherService/BaseTeacherService.go +++ b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherService/BaseTeacherService.go @@ -20,12 +20,19 @@ import ( "dsBaseRpc/Utils/PinYinUtil" "dsBaseRpc/Utils/SqlKit" "dsBaseRpc/models" + "fmt" ) type Rpc struct{} //服务对象 //选择单条 func (s *Rpc) GetBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg) (*BaseTeacherProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseTeacherProto.Reply //通用获取单条 @@ -46,6 +53,12 @@ func (s *Rpc) GetBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg) //增加 func (s *Rpc) AddBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg) (*BaseTeacherProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseTeacherProto.Reply //========================================== @@ -167,6 +180,12 @@ func (s *Rpc) AddBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg) //删除 func (s *Rpc) DeleteBaseTeacher(ctx context.Context, in *BaseTeacherProto.DeleteIdsArg) (*BaseTeacherProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseTeacherProto.Reply //调用通用删除命令进行删除 @@ -205,6 +224,12 @@ func (s *Rpc) DeleteBaseTeacher(ctx context.Context, in *BaseTeacherProto.Delete //修改 func (s *Rpc) UpdateBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg) (*BaseTeacherProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseTeacherProto.Reply @@ -299,6 +324,12 @@ func (s *Rpc) UpdateBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelA //分页查询 func (s *Rpc) PageBaseTeacher(ctx context.Context, in *BaseTeacherProto.QueryArg) (*BaseTeacherProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseTeacherProto.Reply list, count, err := BaseTeacherDao.PageBaseTeacher(in) @@ -318,6 +349,12 @@ func (s *Rpc) PageBaseTeacher(ctx context.Context, in *BaseTeacherProto.QueryArg //教师调整部门(批量) func (s *Rpc) ReviseTeacherOrg(ctx context.Context, in *BaseTeacherProto.ReviseArg) (*BaseTeacherProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseTeacherProto.Reply //调用dao @@ -337,6 +374,12 @@ func (s *Rpc) ReviseTeacherOrg(ctx context.Context, in *BaseTeacherProto.ReviseA //导出本单位教职工账号信息到EXCEL func (s *Rpc) ExportTeacherAccountInfoExcel(ctx context.Context, in *BaseTeacherProto.ModelArg) (*BaseTeacherProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseTeacherProto.Reply list, _, err := BaseTeacherDao.ExportTeacherAccountInfoExcel(in) @@ -358,6 +401,12 @@ func (s *Rpc) ExportTeacherAccountInfoExcel(ctx context.Context, in *BaseTeacher //导出本单位教职工信息到EXCEL func (s *Rpc) ExportTeacherInfoExcel(ctx context.Context, in *BaseTeacherProto.ModelArg) (*BaseTeacherProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseTeacherProto.Reply //导出 @@ -373,6 +422,12 @@ func (s *Rpc) ExportTeacherInfoExcel(ctx context.Context, in *BaseTeacherProto.M //导入本校教师信息 func (s *Rpc) ImportTeacherInfoExcel(ctx context.Context, in *BaseTeacherProto.ImportArg) (*BaseTeacherProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply BaseTeacherProto.Reply //将业务逻辑封装到dao层 diff --git a/dsBaseRpc/RpcService/GovArea/GovAreaService/GovAreaService.go b/dsBaseRpc/RpcService/GovArea/GovAreaService/GovAreaService.go index d3fd06d1..d1bede55 100644 --- a/dsBaseRpc/RpcService/GovArea/GovAreaService/GovAreaService.go +++ b/dsBaseRpc/RpcService/GovArea/GovAreaService/GovAreaService.go @@ -10,12 +10,19 @@ import ( "dsBaseRpc/Utils/LogUtil" "dsBaseRpc/Utils/SqlKit" "dsBaseRpc/models" + "fmt" ) type Rpc struct{} //服务对象 //选择单条 func (s *Rpc) GetGovArea(ctx context.Context, in *GovAreaProto.ModelArg) (*GovAreaProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //统一返回的结构体 var reply GovAreaProto.Reply //参数检查 @@ -36,6 +43,12 @@ func (s *Rpc) GetGovArea(ctx context.Context, in *GovAreaProto.ModelArg) (*GovAr //增加 func (s *Rpc) AddGovArea(ctx context.Context, in *GovAreaProto.ModelArg) (*GovAreaProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() var reply GovAreaProto.Reply //1、判断区域码是不是已存在 exist, err := GovAreaDao.ExistAreaCode(in.AreaCode) @@ -82,6 +95,12 @@ func (s *Rpc) AddGovArea(ctx context.Context, in *GovAreaProto.ModelArg) (*GovAr //删除 func (s *Rpc) DeleteGovArea(ctx context.Context, in *GovAreaProto.DeleteIdsArg) (*GovAreaProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply GovAreaProto.Reply //调用通用删除命令进行删除 @@ -100,6 +119,12 @@ func (s *Rpc) DeleteGovArea(ctx context.Context, in *GovAreaProto.DeleteIdsArg) //修改 func (s *Rpc) UpdateGovArea(ctx context.Context, in *GovAreaProto.ModelArg) (*GovAreaProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply GovAreaProto.Reply var err error @@ -124,6 +149,12 @@ func (s *Rpc) UpdateGovArea(ctx context.Context, in *GovAreaProto.ModelArg) (*Go //分页查询 func (s *Rpc) PageGovArea(ctx context.Context, in *GovAreaProto.QueryArg) (*GovAreaProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply GovAreaProto.Reply //参数检查 diff --git a/dsBaseRpc/RpcService/SysDict/SysDictService/SysDictService.go b/dsBaseRpc/RpcService/SysDict/SysDictService/SysDictService.go index 1ec863f7..b2190321 100644 --- a/dsBaseRpc/RpcService/SysDict/SysDictService/SysDictService.go +++ b/dsBaseRpc/RpcService/SysDict/SysDictService/SysDictService.go @@ -10,12 +10,19 @@ import ( "dsBaseRpc/Utils/LogUtil" "dsBaseRpc/Utils/SqlKit" "encoding/json" + "fmt" ) type Rpc struct{} //服务对象 //选择单条 func (s *Rpc) GetSysDict(ctx context.Context, in *SysDictProto.ModelArg) (*SysDictProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //统一返回的结构体 var reply SysDictProto.Reply //通用获取单条 @@ -30,6 +37,12 @@ func (s *Rpc) GetSysDict(ctx context.Context, in *SysDictProto.ModelArg) (*SysDi //分页查询 func (s *Rpc) PageSysDict(ctx context.Context, in *SysDictProto.QueryArg) (*SysDictProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysDictProto.Reply //是不是分页没有传参数 @@ -56,6 +69,12 @@ func (s *Rpc) PageSysDict(ctx context.Context, in *SysDictProto.QueryArg) (*SysD //传入一组IDS,返回字典数据列表 func (s *Rpc) PageSysDictMultipleDictCode(ctx context.Context, in *SysDictProto.MultipleQueryArg) (*SysDictProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysDictProto.Reply list, count, err := SysDictDao.PageSysDictMultipleDictCode(in.DictKind, in.MultipleDictCode) @@ -75,6 +94,12 @@ func (s *Rpc) PageSysDictMultipleDictCode(ctx context.Context, in *SysDictProto. //获取学段信息 func (s *Rpc) GetStage(ctx context.Context, in *SysDictProto.ModelArg) (*SysDictProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysDictProto.Reply list, count, err := SysDictDao.GetStage() @@ -94,6 +119,12 @@ func (s *Rpc) GetStage(ctx context.Context, in *SysDictProto.ModelArg) (*SysDict //根据学段ID获取学科信息 func (s *Rpc) GetSubject(ctx context.Context, in *SysDictProto.GetSubjectArg) (*SysDictProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysDictProto.Reply list, count, err := SysDictDao.GetSubject(in) @@ -113,6 +144,12 @@ func (s *Rpc) GetSubject(ctx context.Context, in *SysDictProto.GetSubjectArg) (* //根据多个dict_kind获取字典信息 func (s *Rpc) GetMultipleDict(ctx context.Context, in *SysDictProto.GetMultipleDictArg) (*SysDictProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysDictProto.Reply list, _, err := SysDictDao.GetMultipleDict(in) @@ -147,6 +184,12 @@ func (s *Rpc) GetMultipleDict(ctx context.Context, in *SysDictProto.GetMultipleD //根据多个学段ID获取学段名称 func (s *Rpc) GetStageName(ctx context.Context, in *SysDictProto.GetStageNameArg) (*SysDictProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysDictProto.Reply list, count, err := SysDictDao.GetStageName(in) @@ -166,6 +209,12 @@ func (s *Rpc) GetStageName(ctx context.Context, in *SysDictProto.GetStageNameArg //根据多个学科ID获取学科名称 func (s *Rpc) GetSubjectName(ctx context.Context, in *SysDictProto.GetSubjectNameArg) (*SysDictProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysDictProto.Reply list, count, err := SysDictDao.GetSubjectName(in) diff --git a/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonService/SysLoginpersonService.go b/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonService/SysLoginpersonService.go index 6b08137d..3c599da4 100644 --- a/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonService/SysLoginpersonService.go +++ b/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonService/SysLoginpersonService.go @@ -12,12 +12,19 @@ import ( "dsBaseRpc/Utils/LogUtil" "dsBaseRpc/Utils/SqlKit" "dsBaseRpc/models" + "fmt" ) type Rpc struct{} //服务对象 //选择单条 func (s *Rpc) GetSysLoginperson(ctx context.Context, in *SysLoginpersonProto.ModelArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply //通用获取单条 @@ -32,6 +39,12 @@ func (s *Rpc) GetSysLoginperson(ctx context.Context, in *SysLoginpersonProto.Mod //增加 func (s *Rpc) AddSysLoginperson(ctx context.Context, in *SysLoginpersonProto.ModelArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply _, err := AddLoginperson(in.IdentityId, in.PersonId, in.PersonName) @@ -48,6 +61,12 @@ func (s *Rpc) AddSysLoginperson(ctx context.Context, in *SysLoginpersonProto.Mod //删除 func (s *Rpc) DeleteSysLoginperson(ctx context.Context, in *SysLoginpersonProto.DeleteIdsArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply //调用通用删除命令进行删除 @@ -66,6 +85,12 @@ func (s *Rpc) DeleteSysLoginperson(ctx context.Context, in *SysLoginpersonProto. //修改 func (s *Rpc) UpdateSysLoginperson(ctx context.Context, in *SysLoginpersonProto.ModelArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply //修改 @@ -87,6 +112,12 @@ func (s *Rpc) UpdateSysLoginperson(ctx context.Context, in *SysLoginpersonProto. //分页查询(单位管理员) func (s *Rpc) PageSysLoginperson(ctx context.Context, in *SysLoginpersonProto.QueryArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply list, count, err := SysLoginpersonDao.PageSysLoginPerson(in) @@ -106,6 +137,12 @@ func (s *Rpc) PageSysLoginperson(ctx context.Context, in *SysLoginpersonProto.Qu //地区管理员列表 func (s *Rpc) PageAreaManager(ctx context.Context, in *SysLoginpersonProto.AreaManagerArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply list, count, err := SysLoginpersonDao.PageAreaManager(in) @@ -125,6 +162,12 @@ func (s *Rpc) PageAreaManager(ctx context.Context, in *SysLoginpersonProto.AreaM //重置密码 func (s *Rpc) ResetPassWord(ctx context.Context, in *SysLoginpersonProto.ResetPassWordArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply //修改 @@ -143,6 +186,12 @@ func (s *Rpc) ResetPassWord(ctx context.Context, in *SysLoginpersonProto.ResetPa //启用账号 func (s *Rpc) EnableAccount(ctx context.Context, in *SysLoginpersonProto.AccountArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply //修改 @@ -161,6 +210,12 @@ func (s *Rpc) EnableAccount(ctx context.Context, in *SysLoginpersonProto.Account //禁用账号 func (s *Rpc) DisableAccount(ctx context.Context, in *SysLoginpersonProto.AccountArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply //修改 @@ -179,6 +234,12 @@ func (s *Rpc) DisableAccount(ctx context.Context, in *SysLoginpersonProto.Accoun //导出单位管理员到EXCEL func (s *Rpc) PageSysLoginpersonExcel(ctx context.Context, in *SysLoginpersonProto.QueryArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply @@ -205,6 +266,12 @@ func (s *Rpc) PageSysLoginpersonExcel(ctx context.Context, in *SysLoginpersonPro //导出地区管理员到EXCEL func (s *Rpc) PageAreaManagerExcel(ctx context.Context, in *SysLoginpersonProto.AreaManagerArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply @@ -232,6 +299,12 @@ func (s *Rpc) PageAreaManagerExcel(ctx context.Context, in *SysLoginpersonProto. //更改人员登录密码 func (s *Rpc) UpdateLoginPassWord(ctx context.Context, in *SysLoginpersonProto.UpdateLoginPassWordArg) (*SysLoginpersonProto.Reply, error) { + //异常处理 + defer func() { + if err := recover(); err != nil { + fmt.Printf("%s\n", err) + } + }() //rpc响应 var reply SysLoginpersonProto.Reply //密码长度检查 diff --git a/dsBaseRpc/main.go b/dsBaseRpc/main.go index a4b67cea..1823e9c8 100644 --- a/dsBaseRpc/main.go +++ b/dsBaseRpc/main.go @@ -68,7 +68,6 @@ func main() { SysKit.InitLoginIdIntMax() //四、发布Grpc服务 - //配置grpc服务器 lis, err := net.Listen("tcp", ":"+ConfigUtil.RpcServerPort) if err != nil { fmt.Printf("failed to listen: %v\n", err)