diff --git a/app/hdl/institutional_management/public_platoon/hdl_basic.go b/app/hdl/institutional_management/public_platoon/hdl_basic.go index 0353c51..3f2d71c 100644 --- a/app/hdl/institutional_management/public_platoon/hdl_basic.go +++ b/app/hdl/institutional_management/public_platoon/hdl_basic.go @@ -73,7 +73,7 @@ func GetPublicPlatoonBasic(c *gin.Context) { // @Param req body interface{} true "公排设置表单内容" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /api/publicPlatoon/getBasic [post] +// @Router /api/publicPlatoon/updateBasic [put] func UpdatePublicPlatoonBasic(c *gin.Context) { var req *md.UpdatePublicPlatoonBasicReq if err := c.ShouldBindJSON(&req); err != nil { @@ -179,134 +179,124 @@ func GetRelationshipMap(c *gin.Context) { // @Accept json // @Produce json // @param Authorization header string true "验证参数Bearer和token空格拼接" -// @Param req query public_platoon.FindUserRelationshipMapReq true "用户ID" -// @Success 200 {object} public_platoon.RelationshipMap "具体数据" +// @Param uid query string true "用户ID" +// @Success 200 {object} md.TreeNode "具体数据" // @Failure 400 {object} md.Response "具体错误" // @Router /api/publicPlatoon/findUserRelationshipMap [get] -//func FindUserRelationshipMap(c *gin.Context) { -// var req *public_platoon.FindUserRelationshipMapReq -// if err := c.ShouldBindQuery(&req); err != nil { -// e.OutErr(c, e.ERR_INVALID_ARGS, err) -// return -// } -// -// RelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) -// relations, err1 := RelationDb.PublicPlatoonUserRelationFindByUid(req.Uid) -// if err1 != nil { -// e.OutErr(c, e.ERR_DB_ORM, err1) -// return -// } -// -// userDb := implement.NewUserDb(db.Db) -// user, err3 := userDb.UserGetOneById(relations[0].Uid) -// if err3 != nil { -// e.OutErr(c, e.ERR_DB_ORM, err3.Error()) -// return -// } -// var son []public_platoon.RelationshipMap -// res := public_platoon.RelationshipMap{ -// AvatarUrl: user.Avatar, -// Phone: user.Phone, -// Nickname: user.Nickname, -// Uid: user.Id, -// Pid: relations[0].RecommendUid, -// Level: relations[0].Level1, -// Position: relations[0].Position1, -// SystemID: relations[0].Id, -// Son: son, -// } -// for i := 1; i < len(relations); i++ { -// user, err4 := userDb.UserGetOneById(relations[i].Uid) -// if err4 != nil { -// e.OutErr(c, e.ERR_DB_ORM, err4.Error()) -// return -// } -// node := public_platoon.RelationshipMap{ -// AvatarUrl: user.Avatar, -// Phone: user.Phone, -// Nickname: user.Nickname, -// Uid: user.Id, -// Pid: relations[i].RecommendUid, -// Level: relations[i].Level1, -// Position: relations[i].Position1, -// SystemID: relations[i].Id, -// Son: nil, -// } -// res.Son = append(res.Son, node) -// } -// e.OutSuc(c, res, nil) -//} -// -//// FindSubUserRelationshipMap -//// @Summary 制度中心-公排管理-关系分布图(获取指定用户上级) -//// @Tags 公排管理 -//// @Description 关系分布图(获取指定用户上级) -//// @Accept json -//// @Produce json -//// @param Authorization header string true "验证参数Bearer和token空格拼接" -//// @Param req query public_platoon.FindSubUserRelationshipMapReq true "用户ID" -//// @Success 200 {object} public_platoon.RelationshipMap "具体数据" -//// @Failure 400 {object} md.Response "具体错误" -//// @Router /api/publicPlatoon/findSubUserRelationshipMap [get] -//func FindSubUserRelationshipMap(c *gin.Context) { -// var req *public_platoon.FindSubUserRelationshipMapReq -// if err := c.ShouldBindQuery(&req); err != nil { -// e.OutErr(c, e.ERR_INVALID_ARGS, err) -// return -// } -// -// RelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) -// sonRelation, err1 := RelationDb.PublicPlatoonUserRelationGetOneByUid(req.Uid) -// if err1 != nil { -// e.OutErr(c, e.ERR_DB_ORM, err1) -// return -// } -// parentRelation, err2 := RelationDb.PublicPlatoonUserRelationGetOneByUid(sonRelation.FatherUid1) -// if err2 != nil { -// e.OutErr(c, e.ERR_DB_ORM, err2) -// return -// } -// -// userDb := implement.NewUserDb(db.Db) -// son, err3 := userDb.UserGetOneById(sonRelation.Uid) -// if err3 != nil { -// e.OutErr(c, e.ERR_DB_ORM, err3.Error()) -// return -// } -// -// parent, err4 := userDb.UserGetOneById(parentRelation.Uid) -// if err4 != nil { -// e.OutErr(c, e.ERR_DB_ORM, err4.Error()) -// return -// } -// -// var sonNode []public_platoon.RelationshipMap -// sonNode1 := public_platoon.RelationshipMap{ -// AvatarUrl: son.Avatar, -// Phone: son.Phone, -// Nickname: son.Nickname, -// Uid: son.Id, -// Pid: sonRelation.RecommendUid, -// Level: sonRelation.Level1, -// Position: sonRelation.Position1, -// SystemID: sonRelation.Id, -// Son: nil, -// } -// sonNode = append(sonNode, sonNode1) -// res := public_platoon.RelationshipMap{ -// AvatarUrl: parent.Avatar, -// Phone: parent.Phone, -// Nickname: parent.Nickname, -// Uid: parent.Id, -// Pid: parentRelation.RecommendUid, -// Level: parentRelation.Level1, -// Position: parentRelation.Position1, -// SystemID: parentRelation.Id, -// Son: sonNode, -// } -// e.OutSuc(c, res, nil) -//} +func FindUserRelationshipMap(c *gin.Context) { + uid := c.Query("uid") + + userRelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) + var err error + var relation *model.PublicPlatoonUserRelation + relation, err = userRelationDb.PublicPlatoonUserRelationGetOneByParams(map[string]interface{}{ + "key": "uid", + "value": uid, + }) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + var list *md.TreeNode + list, err = svc.GetTrees(db.Db, relation, 3) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + e.OutSuc(c, list, nil) +} + +// FindSubUserRelationshipMap +// @Summary 制度中心-公排管理-关系分布图(获取指定用户上级) +// @Tags 公排管理 +// @Description 关系分布图(获取指定用户上级) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param uid query string true "用户ID" +// @Success 200 {object} md.RelationshipMap "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/publicPlatoon/findSubUserRelationshipMap [get] +func FindSubUserRelationshipMap(c *gin.Context) { + uid := c.Query("uid") + RelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) + sonRelation, err1 := RelationDb.PublicPlatoonUserRelationGetOneByParams(map[string]interface{}{ + "key": "uid", + "value": uid, + }) + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1) + return + } + + parentRelation, err2 := RelationDb.PublicPlatoonUserRelationGetOneByParams(map[string]interface{}{ + "key": "uid", + "value": sonRelation.FatherUid1, + }) + if err2 != nil { + e.OutErr(c, e.ERR_DB_ORM, err2) + return + } + + userDb := implement.NewUserDb(db.Db) + son, err3 := userDb.UserGetOneByParams(map[string]interface{}{ + "key": "id", + "value": sonRelation.Uid, + }) + if err3 != nil { + e.OutErr(c, e.ERR_DB_ORM, err3.Error()) + return + } + + parent, err4 := userDb.UserGetOneByParams(map[string]interface{}{ + "key": "id", + "value": parentRelation.Uid, + }) + if err4 != nil { + e.OutErr(c, e.ERR_DB_ORM, err4.Error()) + return + } + + var sonNode []*md.TreeNode + sonNode = append(sonNode, &md.TreeNode{ + AvatarURL: son.Avatar, + Phone: son.Phone, + Nickname: son.Nickname, + Uid: son.Id, + PID: sonRelation.RecommendUid, + Level: sonRelation.Level1, + Position: sonRelation.Position1, + SystemID: sonRelation.Id, + Son: nil, + }) + res := md.TreeNode{ + AvatarURL: parent.Avatar, + Phone: parent.Phone, + Nickname: parent.Nickname, + Uid: parent.Id, + PID: parentRelation.RecommendUid, + Level: parentRelation.Level1, + Position: parentRelation.Position1, + SystemID: parentRelation.Id, + Son: sonNode, + } + e.OutSuc(c, res, nil) +} + +// ExchangeUserPosition +// @Summary 制度中心-公排管理-关系分布图(位置转换) +// @Tags 公排管理 +// @Description 关系分布图(位置转换) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body interface{} true "需要交换的两个位置" +// @Success 200 {} "成功返回" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/publicPlatoon/exchangeUserPosition [post] func ExchangeUserPosition(c *gin.Context) { var req *md.ExchangeUserPositionReq if err1 := c.ShouldBindJSON(&req); err1 != nil { @@ -314,8 +304,8 @@ func ExchangeUserPosition(c *gin.Context) { return } - relationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) - relation1, err2 := relationDb.PublicPlatoonUserRelationGetOneByPosition(req.Position1) + userRelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) + relation1, err2 := userRelationDb.PublicPlatoonUserRelationGetOneByPosition(req.Position1) if err2 != nil { e.OutErr(c, e.ERR_DB_ORM, err2) return @@ -325,7 +315,7 @@ func ExchangeUserPosition(c *gin.Context) { return } - relation2, err3 := relationDb.PublicPlatoonUserRelationGetOneByPosition(req.Position1) + relation2, err3 := userRelationDb.PublicPlatoonUserRelationGetOneByPosition(req.Position1) if err3 != nil { e.OutErr(c, e.ERR_DB_ORM, err3) return @@ -339,9 +329,11 @@ func ExchangeUserPosition(c *gin.Context) { e.OutErr(c, e.ERR_BAD_REQUEST, errors.New("创始人位置不能被修改")) } - //uid1 := relation1.Uid - //uid2 := relation2.Uid - //recommendUid1 := relation1.RecommendUid - //recommendUid2 := relation2.RecommendUid - //relation1.Uid = "" + err4 := svc.ExchangeUserPosition(db.Db, relation1, relation2) + if err4 != nil { + e.OutErr(c, e.ERR_DB_ORM, err4.Error()) + return + } + + e.OutSuc(c, nil, nil) } diff --git a/app/md/institutional_management/public_platoon/md_public_platoon.go b/app/md/institutional_management/public_platoon/md_public_platoon.go index e3d9f29..6dcc5c1 100644 --- a/app/md/institutional_management/public_platoon/md_public_platoon.go +++ b/app/md/institutional_management/public_platoon/md_public_platoon.go @@ -43,17 +43,9 @@ type RelationshipMapResp struct { SearchUid string `json:"searchUid"` } -type FindUserRelationshipMapReq struct { - Uid int64 `json:"uid"` -} - -type FindSubUserRelationshipMapReq struct { - Uid int64 `json:"uid"` -} - type ExchangeUserPositionReq struct { - Position1 int64 `json:"position_1"` - Position2 int64 `json:"position_2"` + Position1 int64 `json:"position_1,required"` + Position2 int64 `json:"position_2,required"` } type TreeNode struct { @@ -63,7 +55,7 @@ type TreeNode struct { Uid int64 `json:"uid"` PID int64 `json:"pid"` Position int64 `json:"position"` - SystemID int64 `json:"system_id"` + SystemID int `json:"system_id"` Level int `json:"level"` Son []*TreeNode `json:"son"` } diff --git a/app/router/router.go b/app/router/router.go index cfae419..00f6c1a 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -62,8 +62,8 @@ func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理 rPublicPlatoon.GET("/getBasic", public_platoon.GetPublicPlatoonBasic) rPublicPlatoon.PUT("/updateBasic", public_platoon.UpdatePublicPlatoonBasic) rPublicPlatoon.GET("/relationshipMap", public_platoon.GetRelationshipMap) - //rPublicPlatoon.GET("/findUserRelationshipMap", public_platoon.FindUserRelationshipMap) - //rPublicPlatoon.GET("/findSubUserRelationshipMap", public_platoon.FindSubUserRelationshipMap) + rPublicPlatoon.GET("/findUserRelationshipMap", public_platoon.FindUserRelationshipMap) + rPublicPlatoon.GET("/findSubUserRelationshipMap", public_platoon.FindSubUserRelationshipMap) rPublicPlatoon.POST("/exchangeUserPosition", public_platoon.ExchangeUserPosition) } } diff --git a/app/svc/public_platoon/svc_relation_ship_map.go b/app/svc/public_platoon/svc_relation_ship_map.go index 04de525..a1ae9d0 100644 --- a/app/svc/public_platoon/svc_relation_ship_map.go +++ b/app/svc/public_platoon/svc_relation_ship_map.go @@ -3,6 +3,8 @@ package svc import ( md "applet/app/md/institutional_management/public_platoon" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "fmt" "xorm.io/xorm" ) @@ -79,3 +81,58 @@ func GetTrees(engine *xorm.Engine, firstUser *model.PublicPlatoonUserRelation, l trees([]*md.TreeNode{rootNode}) return rootNode, nil } + +func ExchangeUserPosition(engine *xorm.Engine, relation1, relation2 *model.PublicPlatoonUserRelation) (err error) { + uid1 := relation1.Uid + uid2 := relation2.Uid + recommendUid1 := relation1.RecommendUid + recommendUid2 := relation2.RecommendUid + relation1.Uid = uid2 + relation2.Uid = uid1 + relation1.RecommendUid = recommendUid2 + relation2.RecommendUid = recommendUid1 + + forceColums := []string{"recommend_uid", "uid"} + + session := engine.NewSession() + defer session.Close() + + if err := session.Begin(); err != nil { + return zhios_order_relate_logx.Error(err) + } + + _, err = session.Where("id = ?", relation1.Id).Cols(forceColums...).Update(session, &relation1) + if err != nil { + return zhios_order_relate_logx.Error(err) + } + + _, err = session.Where("id = ?", relation2.Id).Cols(forceColums...).Update(session, &relation2) + if err != nil { + return zhios_order_relate_logx.Error(err) + } + + m := new(model.PublicPlatoonUserRelation) + for i := 1; i < 9; i++ { + str := fmt.Sprintf("father_uid%d", i) + _, err = session.Table(m).Where(fmt.Sprintf("%s = ?", str), uid1).Cols(str).Update(map[string]interface{}{str: -66}) + _, err = session.Table(m).Where(fmt.Sprintf("%s = ?", str), uid2).Cols(str).Update(map[string]interface{}{str: -666}) + if err != nil { + return zhios_order_relate_logx.Error(err) + } + } + + for i := 1; i < 9; i++ { + str := fmt.Sprintf("father_uid%d", i) + _, err = session.Table(m).Where(fmt.Sprintf("%s = ?", str), -66).Cols(str).Update(map[string]interface{}{str: uid2}) + _, err = session.Table(m).Where(fmt.Sprintf("%s = ?", str), -666).Cols(str).Update(map[string]interface{}{str: uid1}) + if err != nil { + return zhios_order_relate_logx.Error(err) + } + } + + if err = session.Commit(); err != nil { + return zhios_order_relate_logx.Error(err) + } + + return nil +} diff --git a/docs/docs.go b/docs/docs.go index 15eb510..3d2711f 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -103,9 +103,54 @@ const docTemplate = `{ } } }, - "/api/publicPlatoon/getBasic": { + "/api/publicPlatoon/exchangeUserPosition": { + "post": { + "description": "关系分布图(位置转换)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "公排管理" + ], + "summary": "制度中心-公排管理-关系分布图(位置转换)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "需要交换的两个位置", + "name": "req", + "in": "body", + "required": true, + "schema": {} + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "type": "" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/publicPlatoon/findSubUserRelationshipMap": { "get": { - "description": "公排基础设置(获取)", + "description": "关系分布图(获取指定用户上级)", "consumes": [ "application/json" ], @@ -115,7 +160,7 @@ const docTemplate = `{ "tags": [ "公排管理" ], - "summary": "制度中心-公排管理-公排基础设置(获取)", + "summary": "制度中心-公排管理-关系分布图(获取指定用户上级)", "parameters": [ { "type": "string", @@ -123,13 +168,20 @@ const docTemplate = `{ "name": "Authorization", "in": "header", "required": true + }, + { + "type": "string", + "description": "用户ID", + "name": "uid", + "in": "query", + "required": true } ], "responses": { "200": { "description": "具体数据", "schema": { - "$ref": "#/definitions/md.GetPublicPlatoonBasicResp" + "$ref": "#/definitions/md.RelationshipMap" } }, "400": { @@ -139,9 +191,11 @@ const docTemplate = `{ } } } - }, - "post": { - "description": "公排基础设置(修改)", + } + }, + "/api/publicPlatoon/findUserRelationshipMap": { + "get": { + "description": "关系分布图(获取指定用户下级)", "consumes": [ "application/json" ], @@ -151,7 +205,7 @@ const docTemplate = `{ "tags": [ "公排管理" ], - "summary": "制度中心-公排管理-公排基础设置(修改)", + "summary": "制度中心-公排管理-关系分布图(获取指定用户下级)", "parameters": [ { "type": "string", @@ -161,18 +215,56 @@ const docTemplate = `{ "required": true }, { - "description": "公排设置表单内容", - "name": "req", - "in": "body", - "required": true, - "schema": {} + "type": "string", + "description": "用户ID", + "name": "uid", + "in": "query", + "required": true } ], "responses": { "200": { - "description": "success", + "description": "具体数据", "schema": { - "type": "string" + "$ref": "#/definitions/md.TreeNode" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/publicPlatoon/getBasic": { + "get": { + "description": "公排基础设置(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "公排管理" + ], + "summary": "制度中心-公排管理-公排基础设置(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.GetPublicPlatoonBasicResp" } }, "400": { @@ -235,6 +327,51 @@ const docTemplate = `{ } } } + }, + "/api/publicPlatoon/updateBasic": { + "put": { + "description": "公排基础设置(修改)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "公排管理" + ], + "summary": "制度中心-公排管理-公排基础设置(修改)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "公排设置表单内容", + "name": "req", + "in": "body", + "required": true, + "schema": {} + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } } }, "definitions": { @@ -293,6 +430,41 @@ const docTemplate = `{ } } }, + "md.RelationshipMap": { + "type": "object", + "properties": { + "avatar_url": { + "type": "string" + }, + "level": { + "type": "integer" + }, + "nickname": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "pid": { + "type": "integer" + }, + "position": { + "type": "integer" + }, + "son": { + "type": "array", + "items": { + "$ref": "#/definitions/md.RelationshipMap" + } + }, + "system_id": { + "type": "integer" + }, + "uid": { + "type": "integer" + } + } + }, "md.Response": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 348c67c..2cbf3b5 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -96,9 +96,54 @@ } } }, - "/api/publicPlatoon/getBasic": { + "/api/publicPlatoon/exchangeUserPosition": { + "post": { + "description": "关系分布图(位置转换)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "公排管理" + ], + "summary": "制度中心-公排管理-关系分布图(位置转换)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "需要交换的两个位置", + "name": "req", + "in": "body", + "required": true, + "schema": {} + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "type": "" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/publicPlatoon/findSubUserRelationshipMap": { "get": { - "description": "公排基础设置(获取)", + "description": "关系分布图(获取指定用户上级)", "consumes": [ "application/json" ], @@ -108,7 +153,7 @@ "tags": [ "公排管理" ], - "summary": "制度中心-公排管理-公排基础设置(获取)", + "summary": "制度中心-公排管理-关系分布图(获取指定用户上级)", "parameters": [ { "type": "string", @@ -116,13 +161,20 @@ "name": "Authorization", "in": "header", "required": true + }, + { + "type": "string", + "description": "用户ID", + "name": "uid", + "in": "query", + "required": true } ], "responses": { "200": { "description": "具体数据", "schema": { - "$ref": "#/definitions/md.GetPublicPlatoonBasicResp" + "$ref": "#/definitions/md.RelationshipMap" } }, "400": { @@ -132,9 +184,11 @@ } } } - }, - "post": { - "description": "公排基础设置(修改)", + } + }, + "/api/publicPlatoon/findUserRelationshipMap": { + "get": { + "description": "关系分布图(获取指定用户下级)", "consumes": [ "application/json" ], @@ -144,7 +198,7 @@ "tags": [ "公排管理" ], - "summary": "制度中心-公排管理-公排基础设置(修改)", + "summary": "制度中心-公排管理-关系分布图(获取指定用户下级)", "parameters": [ { "type": "string", @@ -154,18 +208,56 @@ "required": true }, { - "description": "公排设置表单内容", - "name": "req", - "in": "body", - "required": true, - "schema": {} + "type": "string", + "description": "用户ID", + "name": "uid", + "in": "query", + "required": true } ], "responses": { "200": { - "description": "success", + "description": "具体数据", "schema": { - "type": "string" + "$ref": "#/definitions/md.TreeNode" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, + "/api/publicPlatoon/getBasic": { + "get": { + "description": "公排基础设置(获取)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "公排管理" + ], + "summary": "制度中心-公排管理-公排基础设置(获取)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "具体数据", + "schema": { + "$ref": "#/definitions/md.GetPublicPlatoonBasicResp" } }, "400": { @@ -228,6 +320,51 @@ } } } + }, + "/api/publicPlatoon/updateBasic": { + "put": { + "description": "公排基础设置(修改)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "公排管理" + ], + "summary": "制度中心-公排管理-公排基础设置(修改)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "公排设置表单内容", + "name": "req", + "in": "body", + "required": true, + "schema": {} + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } } }, "definitions": { @@ -286,6 +423,41 @@ } } }, + "md.RelationshipMap": { + "type": "object", + "properties": { + "avatar_url": { + "type": "string" + }, + "level": { + "type": "integer" + }, + "nickname": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "pid": { + "type": "integer" + }, + "position": { + "type": "integer" + }, + "son": { + "type": "array", + "items": { + "$ref": "#/definitions/md.RelationshipMap" + } + }, + "system_id": { + "type": "integer" + }, + "uid": { + "type": "integer" + } + } + }, "md.Response": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 18586cd..cb2b8ab 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -36,6 +36,29 @@ definitions: token: type: string type: object + md.RelationshipMap: + properties: + avatar_url: + type: string + level: + type: integer + nickname: + type: string + phone: + type: string + pid: + type: integer + position: + type: integer + son: + items: + $ref: '#/definitions/md.RelationshipMap' + type: array + system_id: + type: integer + uid: + type: integer + type: object md.Response: properties: code: @@ -136,58 +159,119 @@ paths: summary: 登陆 tags: - 登录 - /api/publicPlatoon/getBasic: + /api/publicPlatoon/exchangeUserPosition: + post: + consumes: + - application/json + description: 关系分布图(位置转换) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 需要交换的两个位置 + in: body + name: req + required: true + schema: {} + produces: + - application/json + responses: + "200": + description: 成功返回 + schema: + type: "" + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-公排管理-关系分布图(位置转换) + tags: + - 公排管理 + /api/publicPlatoon/findSubUserRelationshipMap: get: consumes: - application/json - description: 公排基础设置(获取) + description: 关系分布图(获取指定用户上级) parameters: - description: 验证参数Bearer和token空格拼接 in: header name: Authorization required: true type: string + - description: 用户ID + in: query + name: uid + required: true + type: string produces: - application/json responses: "200": description: 具体数据 schema: - $ref: '#/definitions/md.GetPublicPlatoonBasicResp' + $ref: '#/definitions/md.RelationshipMap' "400": description: 具体错误 schema: $ref: '#/definitions/md.Response' - summary: 制度中心-公排管理-公排基础设置(获取) + summary: 制度中心-公排管理-关系分布图(获取指定用户上级) tags: - 公排管理 - post: + /api/publicPlatoon/findUserRelationshipMap: + get: consumes: - application/json - description: 公排基础设置(修改) + description: 关系分布图(获取指定用户下级) parameters: - description: 验证参数Bearer和token空格拼接 in: header name: Authorization required: true type: string - - description: 公排设置表单内容 - in: body - name: req + - description: 用户ID + in: query + name: uid required: true - schema: {} + type: string produces: - application/json responses: "200": - description: success + description: 具体数据 schema: - type: string + $ref: '#/definitions/md.TreeNode' "400": description: 具体错误 schema: $ref: '#/definitions/md.Response' - summary: 制度中心-公排管理-公排基础设置(修改) + summary: 制度中心-公排管理-关系分布图(获取指定用户下级) + tags: + - 公排管理 + /api/publicPlatoon/getBasic: + get: + consumes: + - application/json + description: 公排基础设置(获取) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + produces: + - application/json + responses: + "200": + description: 具体数据 + schema: + $ref: '#/definitions/md.GetPublicPlatoonBasicResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-公排管理-公排基础设置(获取) tags: - 公排管理 /api/publicPlatoon/relationshipMap: @@ -225,6 +309,36 @@ paths: summary: 制度中心-公排管理-关系分布图(获取) tags: - 公排管理 + /api/publicPlatoon/updateBasic: + put: + consumes: + - application/json + description: 公排基础设置(修改) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 公排设置表单内容 + in: body + name: req + required: true + schema: {} + produces: + - application/json + responses: + "200": + description: success + schema: + type: string + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-公排管理-公排基础设置(修改) + tags: + - 公排管理 securityDefinitions: MasterID: in: header