From 9ecfb35c72c6aa05fcc1479a0353c9305db1681b Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Mon, 27 Jul 2020 15:59:52 +0800 Subject: [PATCH 1/7] 'commit' --- dsSso/Controller/ControllerOauth2/ControllerOauth2.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/dsSso/Controller/ControllerOauth2/ControllerOauth2.go b/dsSso/Controller/ControllerOauth2/ControllerOauth2.go index c04df891..e5e8af27 100644 --- a/dsSso/Controller/ControllerOauth2/ControllerOauth2.go +++ b/dsSso/Controller/ControllerOauth2/ControllerOauth2.go @@ -328,13 +328,6 @@ func authorizePost(context *gin.Context) { }) return } - //if CommonUtil.ConvertStringToInt(identityId) > 1 { - // context.JSON(http.StatusOK, Model.Res{ - // Code: http.StatusNotImplemented, - // Msg: "非管理员用户暂不能登录,敬请期待!!", - // }) - // return - //} } else { context.JSON(http.StatusOK, Model.Res{ Code: http.StatusNotImplemented, From c9e4e122d6a4d329d91fb98393edd6fddd0c2c53 Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Mon, 27 Jul 2020 16:00:07 +0800 Subject: [PATCH 2/7] 'commit' --- dsSso/Controller/ControllerOauth2/ControllerOauth2.go | 1 - 1 file changed, 1 deletion(-) diff --git a/dsSso/Controller/ControllerOauth2/ControllerOauth2.go b/dsSso/Controller/ControllerOauth2/ControllerOauth2.go index e5e8af27..71e7b8c1 100644 --- a/dsSso/Controller/ControllerOauth2/ControllerOauth2.go +++ b/dsSso/Controller/ControllerOauth2/ControllerOauth2.go @@ -43,7 +43,6 @@ func Routers(r *gin.RouterGroup) { r.GET("/getCaptchaPng", getCaptchaPng) //退出接口 r.GET("/logout", logout) - r.POST("/logout", logout) return } From ce00aac1582c4a6e32068c270150d69dc9c1f1d0 Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Mon, 27 Jul 2020 16:15:26 +0800 Subject: [PATCH 3/7] 'commit' --- dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go index 622d3bc7..dcbfb541 100644 --- a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go +++ b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go @@ -97,8 +97,8 @@ func PageBaseClass(in *BaseClassProto.QueryArg) ([]map[string]interface{}, int32 return nil, 0, err } //调用多查询字段通用方法 - list, count, err := SqlKit.QueryForPk(sql) - return list, count, err + list, err := db.SQL(sql).Query().List() + return list, int32(len(list)), err } //根据学校ID获取学部(学段)信息 From f89a4bb5c5aec57202f72722dad9eab9d579e0ac Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Mon, 27 Jul 2020 16:51:05 +0800 Subject: [PATCH 4/7] 'commit' --- dsBaseRpc/Config/Config.ini | 4 ++-- .../Linux上安装Go环境+配置DLV.txt | 11 +++++---- .../BaseClass/BaseClassDao/BaseClassDao.go | 24 +++++++++++++++++++ .../BaseOrganizationService.go | 11 +++------ 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/dsBaseRpc/Config/Config.ini b/dsBaseRpc/Config/Config.ini index 85d4ec3f..62bd776f 100644 --- a/dsBaseRpc/Config/Config.ini +++ b/dsBaseRpc/Config/Config.ini @@ -7,7 +7,7 @@ pwd = DsideaL147258369 [distribute] #发布功能的配置 ip = server.dsmin.com -port = 26611 +port = 22 user = root pwd = dsideal remotePath = /usr/local/dsMin/dsBaseRpc/ @@ -32,7 +32,7 @@ KafkaAddress = server.dsmin.com:9092 # 数据汇集的地址 [dataExchange] -host = http://10.10.14.239:9009 +host = http://10.10.14.186:9009 exchangeUrl = /v1/dataex/DataexSet SystemAuthUrl = /v1/dataex/SystemAuth SystemId = BASE_GO diff --git a/dsBaseRpc/Linux上安装Go环境+配置DLV.txt b/dsBaseRpc/Linux上安装Go环境+配置DLV.txt index 4de6d55b..69c73c23 100644 --- a/dsBaseRpc/Linux上安装Go环境+配置DLV.txt +++ b/dsBaseRpc/Linux上安装Go环境+配置DLV.txt @@ -2,19 +2,19 @@ wget -c https://studygolang.com/dl/golang/go1.14.6.linux-amd64.tar.gz tar -C /usr/local/ -zxvf go1.14.6.linux-amd64.tar.gz -echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile.d/go.sh -echo "export PATH=$PATH:/home/user/go/bin" >> /etc/profile.d/go.sh -echo "export PATH=$PATH:/root/go/bin" >> /etc/profile.d/go.sh +echo "export PATH=$PATH:/usr/local/go/bin:/home/user/go/bin" >> /etc/profile.d/go.sh source /etc/profile.d/go.sh mkdir -p ~/home/user/go echo "export GOPATH=/home/user/go" >> /etc/profile.d/gopath.sh +#设置代理 +echo "export GO111MODULE=on" >> /etc/profile.d/gopath.sh +echo "export GOPROXY=https://goproxy.cn,direct" >> /etc/profile.d/gopath.sh + source /etc/profile.d/gopath.sh chmod +x /etc/profile.d/*.sh echo $GOPATH -#设置代理 -go env -w GOPROXY=https://goproxy.cn,direct # 下载dlv yum install git -y @@ -23,6 +23,7 @@ go get github.com/go-delve/delve/cmd/dlv # Goland配置方法 https://www.jianshu.com/p/e74e940a64d9 +cd /usr/local/dsMin/dsBaseRpc dlv --listen=:2345 --headless=true --api-version=2 exec ./dsBaseRpc # 构建 diff --git a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go index dcbfb541..082e88d5 100644 --- a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go +++ b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go @@ -2,6 +2,7 @@ package BaseClassDao import ( "dsBaseRpc/RpcService/BaseClass/BaseClassProto" + "dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao" "dsBaseRpc/Utils/CommonUtil" "dsBaseRpc/Utils/DbUtil" "dsBaseRpc/Utils/SqlKit" @@ -76,6 +77,29 @@ func UpdateBaseClass(model models.TBaseClass, ForceUpdateFields []string) (int64 return affected, err } +/** +功能:指定单位(部门)下是不是存在班级 +作者:黄海 +时间:2020-07-27 +*/ +func ExistClass(orgId string) (bool, error) { + var sql string + if BaseOrganizationDao.IsBuMen(orgId) { + sql = `select count(*) as c from t_base_class where b_use=1 and org_id=?` + } else { + sql = `select count(*) as c from t_base_class where b_use=1 and bureau_id=?` + } + list, err := db.SQL(sql).Query().List() + if err != nil { + return false, err + } + if list[0]["c"].(int64) > 0 { + return false, nil + } else { + return true, nil + } +} + //分页查询 func PageBaseClass(in *BaseClassProto.QueryArg) ([]map[string]interface{}, int32, error) { //接收传入参数 diff --git a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go index 2361dcdc..cb2de51f 100644 --- a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go +++ b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go @@ -5,7 +5,6 @@ import ( "dsBaseRpc/Const" "dsBaseRpc/Const/ErrorConst" "dsBaseRpc/RpcService/BaseClass/BaseClassDao" - "dsBaseRpc/RpcService/BaseClass/BaseClassProto" "dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao" "dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationProto" "dsBaseRpc/RpcService/BaseOrganizationManager/BaseOrganizationManagerDao" @@ -309,18 +308,14 @@ func (s *Rpc) DeleteBaseOrganization(ctx context.Context, in *BaseOrganizationPr return &reply, err } //判断是不是有可用的班级 - var inClass BaseClassProto.QueryArg - inClass.BureauId = in.Ids[i] - inClass.Page = 1 - inClass.Limit = 1 - _, count, err = BaseClassDao.PageBaseClass(&inClass) + exist, err := BaseClassDao.ExistClass(in.Ids[i]) if err != nil { - LogUtil.Error(ErrorConst.SqlUpdateError, "执行PageBaseClass时发生严重错误:"+err.Error()) + LogUtil.Error(ErrorConst.SqlUpdateError, "执行ExistClass时发生严重错误:"+err.Error()) reply.Success = false reply.Message = Const.DataBaseActionError return &reply, err } - if count > 0 { + if exist { reply.Success = false //判断是单位还是部门 if BaseOrganizationDao.IsBuMen(inTeacher.OrgId) { From 3e3a5c0886033f78efceccb5d6e7219d4a1966bf Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Mon, 27 Jul 2020 16:53:13 +0800 Subject: [PATCH 5/7] 'commit' --- dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go index 082e88d5..2d103330 100644 --- a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go +++ b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go @@ -89,7 +89,7 @@ func ExistClass(orgId string) (bool, error) { } else { sql = `select count(*) as c from t_base_class where b_use=1 and bureau_id=?` } - list, err := db.SQL(sql).Query().List() + list, err := db.SQL(sql, orgId).Query().List() if err != nil { return false, err } From 8885ad23cf218a70bebceb04d3197f65dd612a9f Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Mon, 27 Jul 2020 16:56:53 +0800 Subject: [PATCH 6/7] 'commit' --- dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go index 2d103330..2f8472c0 100644 --- a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go +++ b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go @@ -94,9 +94,9 @@ func ExistClass(orgId string) (bool, error) { return false, err } if list[0]["c"].(int64) > 0 { - return false, nil - } else { return true, nil + } else { + return false, nil } } From bdb216a220c6bb84189f6af1dc73df14eebc6a76 Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Tue, 28 Jul 2020 09:10:23 +0800 Subject: [PATCH 7/7] 'commit' --- dsSso/autologin.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 dsSso/autologin.html diff --git a/dsSso/autologin.html b/dsSso/autologin.html new file mode 100644 index 00000000..aa686fb5 --- /dev/null +++ b/dsSso/autologin.html @@ -0,0 +1,23 @@ + + + + 自动登录 + + + + + + + + + + +