diff --git a/Document/东师理想大数据中心发展思路V1.1.mmap b/Document/东师理想大数据中心发展思路V1.1.mmap new file mode 100644 index 00000000..af0a4853 Binary files /dev/null and b/Document/东师理想大数据中心发展思路V1.1.mmap differ diff --git a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go index 2fff1c94..9c10c03e 100644 --- a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go +++ b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go @@ -586,3 +586,14 @@ func GetFsb(bureauId string) ([]map[string]interface{}, error) { list, err := db.SQL(sql, bureauId).Query().List() return list, err } + +/** +功能:根据单位代码,获取单位信息 +作者:黄海 +时间:2020-08-21 +*/ +func GetBureauInfoByCode(bureauCode string) ([]map[string]interface{}, error) { + sql := `select * from t_base_organization where b_use=1 and org_code=?` + list, err := db.SQL(sql, bureauCode).Query().List() + return list, err +} diff --git a/dsBaseRpc/Tools/InitOrg/Build/go_build_InitOrg_go.exe b/dsBaseRpc/Tools/InitOrg/Build/go_build_InitOrg_go.exe new file mode 100644 index 00000000..e52e635c Binary files /dev/null and b/dsBaseRpc/Tools/InitOrg/Build/go_build_InitOrg_go.exe differ diff --git a/dsBaseRpc/Tools/InitOrg/Data/22.23.24.25.通告稿_主体校、附设班信息.xlsx b/dsBaseRpc/Tools/InitOrg/Data/22.23.24.25.通告稿_主体校、附设班信息.xlsx new file mode 100644 index 00000000..59800fc7 Binary files /dev/null and b/dsBaseRpc/Tools/InitOrg/Data/22.23.24.25.通告稿_主体校、附设班信息.xlsx differ diff --git a/dsBaseRpc/Tools/InitOrg/InitFsb.go b/dsBaseRpc/Tools/InitOrg/InitFsb.go new file mode 100644 index 00000000..fdfe6e50 --- /dev/null +++ b/dsBaseRpc/Tools/InitOrg/InitFsb.go @@ -0,0 +1,50 @@ +package main + +import ( + "dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao" + "dsBaseRpc/Utils/CommonUtil" + "fmt" + "github.com/360EntSecGroup-Skylar/excelize/v2" +) + +func main() { + fileName := `./Tools/InitOrg/Data/22.23.24.25.通告稿_主体校、附设班信息.xlsx` + f, err := excelize.OpenFile(fileName) + if err != nil { + fmt.Println(err) + return + } + sheetName := `通告稿_附设班信息` + rows, err := f.GetRows(sheetName) + if err != nil { + fmt.Println(err.Error()) + } + for i, row := range rows { + //放过第一行 + if i == 0 { + continue + } + //单位名称 + orgName := row[1] + //机构编码 + orgCode := row[2] + //附设教学班类型 + fsbCode := row[10] + //插入附设班数据 + list, err := BaseOrganizationDao.GetBureauInfoByCode(orgCode) + if err != nil { + fmt.Println(orgCode) + //panic("查询机构代码出错!") + continue + } + if list == nil || len(list) == 0 { + fmt.Println(orgCode) + //panic("查询机构代码出错!") + continue + } + bureauId := list[0]["org_id"].(string) + BaseOrganizationDao.UpdateFsb(bureauId, []string{fsbCode}) + fmt.Println(CommonUtil.ConvertIntToString(i) + ":完成" + orgName) + } + fmt.Println("恭喜,所有数据初始化完成!") +} diff --git a/dsBaseRpc/Tools/InitOrg/InitOrg.go b/dsBaseRpc/Tools/InitOrg/InitOrg.go new file mode 100644 index 00000000..979e0eed --- /dev/null +++ b/dsBaseRpc/Tools/InitOrg/InitOrg.go @@ -0,0 +1,74 @@ +package main + +import ( + "dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao" + "dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationService" + "dsBaseRpc/Utils/CommonUtil" + "dsBaseRpc/models" + "fmt" + "github.com/360EntSecGroup-Skylar/excelize/v2" +) + +func main() { + fileName := `./Tools/InitOrg/Data/22.23.24.25.通告稿_主体校、附设班信息.xlsx` + f, err := excelize.OpenFile(fileName) + if err != nil { + fmt.Println(err) + return + } + sheetName := `通告稿_主体校信息` + rows, err := f.GetRows(sheetName) + if err != nil { + fmt.Println(err.Error()) + } + for i, row := range rows { + //放过第一行 + if i == 0 { + continue + } + //学校名 + orgName := row[1] + //机构编码 + orgCode := row[2] + //机构所在地 + areaCode := row[4][0:6] + //上级管理单位 + managerAreaCode := row[6][0:6] + //举办者类型码 + xxjbzm := row[8] + //办学类型 + xxbxlxm := row[10] + //城乡级别 + szdcxlxm := row[14] + + //已有的数据不再处理 + if orgCode == "3422000032" || orgCode == "3122001304" { + continue + } + //增加学校 + model := new(models.TBaseOrganization) + model.OrgId = CommonUtil.GetUUID() + model.BureauId = model.OrgId + model.OrgName = orgName + model.BUse = 1 + model.ManagerAreaCode = managerAreaCode + model.ProvinceCode = "220000" + model.CityCode = "220100" + model.DistrictCode = areaCode + model.SortId = 1 + model.Xxbxlxm = xxbxlxm + model.MainSchoolId = model.BureauId + model.OrgType = 2 + model.ParentId = "0" + model.AreaCode = areaCode + model.OrgCode = orgCode + model.MainSchoolType = 1 + model.Szdcxlxm = szdcxlxm + model.Xxjbzm = xxjbzm + BaseOrganizationDao.AddBaseOrganization(*model) + //通过管理员帐号 + BaseOrganizationService.UpdateManager(model.OrgId, 1) + fmt.Println(CommonUtil.ConvertIntToString(i) + ":成功完成" + orgName + "。") + } + fmt.Println("恭喜,所有学校初始化完成!") +} diff --git a/dsBaseRpc/models/t_app_base.go b/dsBaseRpc/models/t_app_base.go new file mode 100644 index 00000000..46477eca --- /dev/null +++ b/dsBaseRpc/models/t_app_base.go @@ -0,0 +1,14 @@ +package models + +type TAppBase struct { + AppId string `xorm:"not null pk comment('系统ID') CHAR(36)"` + AppCode string `xorm:"not null comment('系统编码') VARCHAR(50)"` + AppName string `xorm:"not null comment('系统名称') VARCHAR(100)"` + AccessKey string `xorm:"not null comment('AK') CHAR(20)"` + SecretKey string `xorm:"not null comment('SK') CHAR(26)"` + AppUrl string `xorm:"default 'NULL' comment('系统集成页面调用地址') VARCHAR(1024)"` + AppIcon string `xorm:"default 'NULL' comment('系统图标的路径') VARCHAR(1024)"` + RedirectUri string `xorm:"default 'NULL' comment('统一认证回调地址') VARCHAR(1024)"` + LogoutUri string `xorm:"default 'NULL' comment('统一认证登出地址') VARCHAR(1024)"` + BUse int32 `xorm:"not null comment('是否可用 -2:不可用 1:可用') TINYINT(1)"` +} diff --git a/dsBaseRpc/models/t_app_identity.go b/dsBaseRpc/models/t_app_identity.go new file mode 100644 index 00000000..a36481ed --- /dev/null +++ b/dsBaseRpc/models/t_app_identity.go @@ -0,0 +1,6 @@ +package models + +type TAppIdentity struct { + AppId string `xorm:"not null pk comment('系统ID') index CHAR(36)"` + IdentityId int32 `xorm:"not null pk comment('身份ID') INT(11)"` +} diff --git a/dsBaseRpc/models/t_app_position.go b/dsBaseRpc/models/t_app_position.go new file mode 100644 index 00000000..fc50bb97 --- /dev/null +++ b/dsBaseRpc/models/t_app_position.go @@ -0,0 +1,6 @@ +package models + +type TAppPosition struct { + AppId string `xorm:"not null pk comment('系统ID') index CHAR(36)"` + PositionId string `xorm:"not null pk comment('职务ID,所有职务可用:-1') CHAR(36)"` +} diff --git a/dsBaseRpc/models/t_app_range.go b/dsBaseRpc/models/t_app_range.go new file mode 100644 index 00000000..8072f281 --- /dev/null +++ b/dsBaseRpc/models/t_app_range.go @@ -0,0 +1,6 @@ +package models + +type TAppRange struct { + AppId string `xorm:"not null pk comment('系统ID') CHAR(36)"` + RangeCode string `xorm:"not null pk comment('行政区划码或单位ID') VARCHAR(36)"` +} diff --git a/dsBaseRpc/models/t_app_stage.go b/dsBaseRpc/models/t_app_stage.go new file mode 100644 index 00000000..836c07db --- /dev/null +++ b/dsBaseRpc/models/t_app_stage.go @@ -0,0 +1,6 @@ +package models + +type TAppStage struct { + AppId string `xorm:"not null pk comment('系统ID') index CHAR(36)"` + StageId int32 `xorm:"not null pk comment('学段ID,所有学段可用:-1') INT(11)"` +} diff --git a/dsBaseRpc/models/t_base_charge_work.go b/dsBaseRpc/models/t_base_charge_work.go deleted file mode 100644 index b9f1cd47..00000000 --- a/dsBaseRpc/models/t_base_charge_work.go +++ /dev/null @@ -1,13 +0,0 @@ -package models - -type TBaseChargeWork struct { - Id string `xorm:"not null pk comment('主键') CHAR(36)"` - Code string `xorm:"not null comment('编码') CHAR(10)"` - Name string `xorm:"not null comment('分管工作名称') VARCHAR(50)"` - ParentId string `xorm:"not null comment('上级节点') CHAR(36)"` - LevelId int32 `xorm:"not null comment('1:虚根节点 2:单位等级 3:单位类型 4:分管工作') INT(11)"` - BureauLevel int32 `xorm:"not null comment('单位等级 1:市级 2:区级') INT(11)"` - OrgType int32 `xorm:"not null comment('单位类型 1:教育局 2:学校 7:教辅单位') INT(11)"` - BUse int32 `xorm:"not null comment('是否启用') TINYINT(1)"` - SortId int32 `xorm:"not null comment('排序号') INT(11)"` -} diff --git a/dsBaseRpc/models/t_base_organization.go b/dsBaseRpc/models/t_base_organization.go index 70c1b1bb..a89431e9 100644 --- a/dsBaseRpc/models/t_base_organization.go +++ b/dsBaseRpc/models/t_base_organization.go @@ -11,7 +11,7 @@ type TBaseOrganization struct { MainSchoolType int32 `xorm:"not null default 1 comment('主校类型,1:普通校,2:主校,3:分校') INT(11)"` MainSchoolId string `xorm:"not null default '''' comment('如果是分校,所属主校的ID,如果是主校,是自己的ID,如果是分校,是主校ID,如果是普通校,也是自己的ID') CHAR(36)"` Xxbxlxm string `xorm:"not null default '''' comment('学校办学类型(学校专有属性)有字典') CHAR(3)"` - Szdcxlxm string `xorm:"not null default '''' comment('学校城乡类型(学校专有属性)有字典') CHAR(2)"` + Szdcxlxm string `xorm:"not null default '''' comment('学校城乡类型(学校专有属性)有字典') CHAR(3)"` Xxjbzm string `xorm:"not null default '''' comment('学校举办者(学校专有属性)有字典') CHAR(3)"` Fzr string `xorm:"not null default '''' comment('机构负责人ID(*一个单位只能有一个负责人)') CHAR(36)"` Fddbr string `xorm:"not null default '''' comment('机构法定代表人') VARCHAR(50)"` diff --git a/dsBaseRpc/models/t_base_teacher_charge_work.go b/dsBaseRpc/models/t_base_teacher_charge_work.go deleted file mode 100644 index 4a367085..00000000 --- a/dsBaseRpc/models/t_base_teacher_charge_work.go +++ /dev/null @@ -1,10 +0,0 @@ -package models - -type TBaseTeacherChargeWork struct { - Id string `xorm:"not null pk comment('主键') CHAR(36)"` - PersonId string `xorm:"not null default '''' comment('人员ID') index CHAR(18)"` - BureauId string `xorm:"not null default '''' comment('单位ID') index CHAR(18)"` - JobTitleId int32 `xorm:"not null default 0 comment('职务ID') INT(11)"` - ChargeWorkId int32 `xorm:"not null default 0 comment('分管工作ID') INT(11)"` - BUse int32 `xorm:"not null default 1 comment('是否启用 0:未启用 1:启用') TINYINT(1)"` -} diff --git a/dsBaseRpc/models/t_dataex_datain.go b/dsBaseRpc/models/t_dataex_datain.go deleted file mode 100644 index 33600161..00000000 --- a/dsBaseRpc/models/t_dataex_datain.go +++ /dev/null @@ -1,19 +0,0 @@ -package models - -import ( - "time" -) - -type TDataexDatain struct { - Id string `xorm:"not null pk comment('ID') VARCHAR(36)"` - SystemId string `xorm:"not null comment('数据提供系统ID') VARCHAR(36)"` - DatasourceId string `xorm:"not null comment('数据源ID') VARCHAR(36)"` - OrgId string `xorm:"not null comment('数据所属机构ID') VARCHAR(36)"` - DataId string `xorm:"not null comment('数据ID') VARCHAR(36)"` - DataContent string `xorm:"default 'NULL' comment('数据内容【Json格式】') VARCHAR"` - FileUri string `xorm:"default 'NULL' comment('文件地址【文件交换】') VARCHAR(500)"` - ChangeTime time.Time `xorm:"default 'NULL' comment('最近修改时间') DATETIME"` - DeleteTime time.Time `xorm:"default 'NULL' comment('删除时间') DATETIME"` - DeleteFlag int32 `xorm:"not null default -1 comment('删除标志【默认-1,1:删除,-1:正常】') INT(11)"` - EnableFlag int32 `xorm:"not null default 1 comment('启用标志【默认1,1:启用,-1:禁用】') INT(11)"` -} diff --git a/dsBaseRpc/models/t_dataex_dataout.go b/dsBaseRpc/models/t_dataex_dataout.go deleted file mode 100644 index 169d110d..00000000 --- a/dsBaseRpc/models/t_dataex_dataout.go +++ /dev/null @@ -1,20 +0,0 @@ -package models - -import ( - "time" -) - -type TDataexDataout struct { - Id string `xorm:"not null pk VARCHAR(36)"` - SystemId string `xorm:"not null comment('数据提供系统ID') VARCHAR(36)"` - ConsumeSystemid string `xorm:"default ''NULL'' comment('数据使用系统ID') VARCHAR(36)"` - DatasourceId string `xorm:"not null comment('数据源ID') VARCHAR(36)"` - OrgId string `xorm:"not null comment('数据所属机构ID') VARCHAR(36)"` - DataId string `xorm:"not null comment('数据ID') VARCHAR(36)"` - DataContent string `xorm:"default 'NULL' comment('数据内容【Json格式】') VARCHAR"` - FileUri string `xorm:"default 'NULL' comment('文件地址【文件交换】') VARCHAR(500)"` - ChangeTime time.Time `xorm:"default 'NULL' comment('最近修改时间') DATETIME"` - DeleteTime time.Time `xorm:"default 'NULL' comment('删除时间') DATETIME"` - DeleteFlag int32 `xorm:"not null default -1 comment('删除标志【默认-1,1:删除,-1:正常】') INT(11)"` - EnableFlag int32 `xorm:"not null default 1 comment('启用标志【默认1,1:启用,-1:禁用】') INT(11)"` -} diff --git a/dsSso/Controller/ControllerOauth2/ControllerOauth2.go b/dsSso/Controller/ControllerOauth2/ControllerOauth2.go index 55f23fe0..fe62fe88 100644 --- a/dsSso/Controller/ControllerOauth2/ControllerOauth2.go +++ b/dsSso/Controller/ControllerOauth2/ControllerOauth2.go @@ -52,6 +52,8 @@ func Routers(r *gin.RouterGroup) { r.GET("/checkOpenId", checkOpenId) //绑定用户 r.POST("/bindWxUser", bindWxUser) + //解除绑定 + r.POST("/unBindWxUser", unBindWxUser) return } @@ -705,3 +707,28 @@ func bindWxUser(context *gin.Context) { return } } + +// @Summary 解除绑定微信用户 +// @Description 绑定微信用户 +// @Tags 解除登录验证类 +// @Accept application/x-www-form-urlencoded +// @Produce json +// @Success 200 {string} string +// @Router /oauth2/unBindWxUser [get] +func unBindWxUser(context *gin.Context) { + identityId, _ := context.Cookie("identity_id") + personId, _ := context.Cookie("person_id") + //进行两者之间的解除绑定 + _, err := ServiceLoginPerson.UnBindWxUser(identityId, personId) + if err != nil { + context.JSON(http.StatusOK, Model.Res{ + Code: http.StatusNotImplemented, + Msg: "在执行unBindWxUser函数时出错!", + }) + return + } + context.JSON(http.StatusOK, Model.Res{ + Code: http.StatusOK, + Msg: "解除绑定成功!", + }) +} diff --git a/dsSso/Service/ServiceLoginPerson/ServiceLoginPerson.go b/dsSso/Service/ServiceLoginPerson/ServiceLoginPerson.go index 4c8967ba..3c2a5c84 100644 --- a/dsSso/Service/ServiceLoginPerson/ServiceLoginPerson.go +++ b/dsSso/Service/ServiceLoginPerson/ServiceLoginPerson.go @@ -61,3 +61,8 @@ func BindWxUser(identityId string, personId string, openid string) (bool, error) success, err := DaoSysLoginPerson.BindWxUser(identityId, personId, openid) return success, err } +//解除绑定微信的用户 +func UnBindWxUser(identityId string, personId string) (bool, error) { + success, err := DaoSysLoginPerson.UnBindWxUser(identityId, personId) + return success, err +} diff --git a/dsSso/docs/docs.go b/dsSso/docs/docs.go index 0bba7740..7944aca5 100644 --- a/dsSso/docs/docs.go +++ b/dsSso/docs/docs.go @@ -405,6 +405,29 @@ var doc = `{ ] } }, + "/oauth2/unBindWxUser": { + "get": { + "description": "绑定微信用户", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json" + ], + "tags": [ + "解除登录验证类" + ], + "summary": "解除绑定微信用户", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, "/oauth2/wxLogin": { "post": { "description": "微信登录", diff --git a/dsSso/docs/swagger.json b/dsSso/docs/swagger.json index a8515c0a..0b21d67d 100644 --- a/dsSso/docs/swagger.json +++ b/dsSso/docs/swagger.json @@ -389,6 +389,29 @@ ] } }, + "/oauth2/unBindWxUser": { + "get": { + "description": "绑定微信用户", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json" + ], + "tags": [ + "解除登录验证类" + ], + "summary": "解除绑定微信用户", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, "/oauth2/wxLogin": { "post": { "description": "微信登录", diff --git a/dsSso/docs/swagger.yaml b/dsSso/docs/swagger.yaml index c634d8ac..921b0227 100644 --- a/dsSso/docs/swagger.yaml +++ b/dsSso/docs/swagger.yaml @@ -294,6 +294,21 @@ paths: - 登录验证类 x-emptylimit: - userName + /oauth2/unBindWxUser: + get: + consumes: + - application/x-www-form-urlencoded + description: 绑定微信用户 + produces: + - application/json + responses: + "200": + description: OK + schema: + type: string + summary: 解除绑定微信用户 + tags: + - 解除登录验证类 /oauth2/wxLogin: post: consumes: