diff --git a/dsBaseWeb/Business/BaseOrganization/BaseOrganizationController/BaseOrganizationController.go b/dsBaseWeb/Business/BaseOrganization/BaseOrganizationController/BaseOrganizationController.go index 7a204140..7e7b97e0 100644 --- a/dsBaseWeb/Business/BaseOrganization/BaseOrganizationController/BaseOrganizationController.go +++ b/dsBaseWeb/Business/BaseOrganization/BaseOrganizationController/BaseOrganizationController.go @@ -33,6 +33,7 @@ func Routers(r *gin.RouterGroup) { rr.POST("/AddSchoolInfo", AddSchoolInfo) rr.POST("/UpdateSchoolInfo", UpdateSchoolInfo) rr.POST("/DeleteSchoolInfo", DeleteSchoolInfo) + rr.GET("/ListEduByCityCodeInfo", ListEduByCityCodeInfo) //部门相关接口 rr.GET("/PageOrgInfo", PageOrgInfo) @@ -814,13 +815,13 @@ func GetSchoolInfoById(c *gin.Context) { // @Param areaCode formData string true "行政区划编码" // @Param orgCode formData string true "学校编码" // @Param orgName formData string true "学校名称" -// @Param directlyUnderType formData int true "直属类型 1:普通 2:省直 3:市直" // @Param isBranchSchool formData int true "是否为分校 -1:非分校 1:是分校" // @Param mainSchoolId formData string false "主校ID(是分校时才传)" -// @Param xxbbm formData string true "学校办别(字典:xxbbm)" +// @Param managerAreaCode formData string true "上级管理单位行政区划编码" // @Param xxbxlxm formData string true "学校办学类型(字典:xxbxlxm)" // @Param szdcxlxm formData string true "学校城乡类型(字典:szdcxlxm)" // @Param xxjbzm formData string true "学校举办者(字典:xxjbzm)" +// @Param fsbIds formData string false "附设班办学类型ID,多个用逗号分隔" // @Param fddbr formData string false "学校法定代表人" // @Param fddbrdh formData string false "学校法定代表人电话" // @Param address formData string false "学校地址" @@ -841,20 +842,20 @@ func AddSchoolInfo(c *gin.Context) { orgCode := c.PostForm("orgCode") //学校名称 orgName := c.PostForm("orgName") - //直属类型 1:普通 2:省直 3:市直 - directlyUnderType := CommonUtil.ConvertStringToInt32(c.PostForm("directlyUnderType")) //是否为分校 -1:非分校 1:是分校 isBranchSchool := CommonUtil.ConvertStringToInt32(c.PostForm("isBranchSchool")) //主校ID mainSchoolId := c.PostForm("mainSchoolId") - //学校办别 - xxbbm := c.PostForm("xxbbm") + //上级管理单位行政区划编码 + managerAreaCode := c.PostForm("managerAreaCode") //学校办学类型 xxbxlxm := c.PostForm("xxbxlxm") //学校城乡类型 szdcxlxm := c.PostForm("szdcxlxm") //学校举办者 xxjbzm := c.PostForm("xxjbzm") + //附设班办学类型ID,多个用逗号分隔 + fsbIds := c.PostForm("fsbIds") //学校法定代表人 fddbr := c.PostForm("fddbr") //学校法定代表人电话 @@ -876,7 +877,7 @@ func AddSchoolInfo(c *gin.Context) { } //操作IP actionIpAddress := c.ClientIP() - r, err := BaseOrganizationService.AddSchoolInfo(areaCode, orgCode, orgName, directlyUnderType, isBranchSchool, mainSchoolId, xxbbm, xxbxlxm, szdcxlxm, xxjbzm, fddbr, fddbrdh, address, lxdh, sortId, actionPersonId, actionIpAddress) + r, err := BaseOrganizationService.AddSchoolInfo(areaCode, orgCode, orgName, managerAreaCode, isBranchSchool, mainSchoolId, fsbIds, xxbxlxm, szdcxlxm, xxjbzm, fddbr, fddbrdh, address, lxdh, sortId, actionPersonId, actionIpAddress) if err != nil { c.JSON(http.StatusOK, Model.Res{ Success: false, @@ -898,13 +899,13 @@ func AddSchoolInfo(c *gin.Context) { // @Param orgId formData string true "学校ID" // @Param orgCode formData string true "学校编码" // @Param orgName formData string true "学校名称" -// @Param directlyUnderType formData int true "直属类型 1:普通 2:省直 3:市直" // @Param isBranchSchool formData int true "是否为分校 -1:非分校 1:是分校" // @Param mainSchoolId formData string false "主校ID(是分校时才传)" -// @Param xxbbm formData string true "学校办别(字典:xxbbm)" +// @Param managerAreaCode formData string true "上级管理单位行政区划编码" // @Param xxbxlxm formData string true "学校办学类型(字典:xxbxlxm)" // @Param szdcxlxm formData string true "学校城乡类型(字典:szdcxlxm)" // @Param xxjbzm formData string true "学校举办者(字典:xxjbzm)" +// @Param fsbIds formData string false "附设班办学类型ID,多个用逗号分隔" // @Param fddbr formData string false "学校法定代表人" // @Param fddbrdh formData string false "学校法定代表人电话" // @Param address formData string false "学校地址" @@ -925,14 +926,14 @@ func UpdateSchoolInfo(c *gin.Context) { orgCode := c.PostForm("orgCode") //学校名称 orgName := c.PostForm("orgName") - //直属类型 1:普通 2:省直 3:市直 - directlyUnderType := CommonUtil.ConvertStringToInt32(c.PostForm("directlyUnderType")) + //上级管理单位行政区划编码 + managerAreaCode := c.PostForm("managerAreaCode") //是否为分校 -1:非分校 1:是分校 isBranchSchool := CommonUtil.ConvertStringToInt32(c.PostForm("isBranchSchool")) //主校ID mainSchoolId := c.PostForm("mainSchoolId") - //学校办别 - xxbbm := c.PostForm("xxbbm") + //附设班办学类型ID,多个用逗号分隔 + fsbIds := c.PostForm("fsbIds") //学校办学类型 xxbxlxm := c.PostForm("xxbxlxm") //学校城乡类型 @@ -960,7 +961,7 @@ func UpdateSchoolInfo(c *gin.Context) { } //操作IP actionIpAddress := c.ClientIP() - r, err := BaseOrganizationService.UpdateSchoolInfo(orgId, orgCode, orgName, directlyUnderType, isBranchSchool, mainSchoolId, xxbbm, xxbxlxm, szdcxlxm, xxjbzm, fddbr, fddbrdh, address, lxdh, sortId, actionPersonId, actionIpAddress) + r, err := BaseOrganizationService.UpdateSchoolInfo(orgId, orgCode, orgName, managerAreaCode, isBranchSchool, mainSchoolId, fsbIds, xxbxlxm, szdcxlxm, xxjbzm, fddbr, fddbrdh, address, lxdh, sortId, actionPersonId, actionIpAddress) if err != nil { c.JSON(http.StatusOK, Model.Res{ Success: false, @@ -1348,3 +1349,34 @@ func ListOrgByOrgKeyWord(c *gin.Context) { List: CommonUtil.ConvertJsonStringToMapArray(r.List), }) } + +// @Summary 根据市的行政区划码获取教育局列表 +// @Description 根据市的行政区划码获取教育局列表 +// @Tags 组织机构 +// @Accept application/x-www-form-urlencoded +// @Produce json +// @Param cityCode query string true "市的行政区划码" +// @Success 200 {object} Model.Res +// @Router /base/organization/ListEduByCityCodeInfo [get] +// @X-EmptyLimit ["cityCode"] +// @X-LengthLimit [{"cityCode":"6,6"}] +// @X-RoleLimit ["1","3","4"] +// @X-Sort [24] +func ListEduByCityCodeInfo(c *gin.Context) { + //单位名称关键字 + cityCode := c.Query("cityCode") + + r, err := BaseOrganizationService.ListEduByCityCodeInfo(cityCode) + if err != nil { + c.JSON(http.StatusOK, Model.Res{ + Success: false, + Message: "调用RPC服务失败!", + }) + return + } + c.JSON(http.StatusOK, Model.Res{ + Success: r.Success, + Message: r.Message, + List: CommonUtil.ConvertJsonStringToMapArray(r.List), + }) +} \ No newline at end of file diff --git a/dsBaseWeb/Business/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go b/dsBaseWeb/Business/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go index e9f6bbf7..13f282d3 100644 --- a/dsBaseWeb/Business/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go +++ b/dsBaseWeb/Business/BaseOrganization/BaseOrganizationService/BaseOrganizationService.go @@ -98,14 +98,22 @@ func GetSchoolInfoById(orgId string, actionPersonId string, actionIpAddress stri return Reply, err } -func AddSchoolInfo(areaCode string, orgCode string, orgName string, directlyUnderType int32, isBranchSchool int32, mainSchoolId string, xxbbm string, xxbxlxm string, szdcxlxm string, xxjbzm string, fddbr string, fddbrdh string, address string, lxdh string, sortId int32, actionPersonId string, actionIpAddress string) (*BaseOrganizationProto.Reply, error) { - Reply, err := AddBaseOrganization(BaseOrganizationProto.ModelArg{AreaCode: areaCode, OrgCode: orgCode, OrgName: orgName, OrgType: 2, DirectlyUnderType: directlyUnderType, IsBranchSchool: isBranchSchool, MainSchoolId: mainSchoolId, Xxbbm: xxbbm, Xxbxlxm: xxbxlxm, Szdcxlxm: szdcxlxm, Xxjbzm: xxjbzm, Fddbr: fddbr, Fddbrdh: fddbrdh, Address: address, Lxdh: lxdh, SortId: sortId, BUse: 1, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress}) +func AddSchoolInfo(areaCode string, orgCode string, orgName string, managerAreaCode string, isBranchSchool int32, mainSchoolId string, fsbIds string, xxbxlxm string, szdcxlxm string, xxjbzm string, fddbr string, fddbrdh string, address string, lxdh string, sortId int32, actionPersonId string, actionIpAddress string) (*BaseOrganizationProto.Reply, error) { + idArr := make([]string, 0) + if len(fsbIds) > 0 { + idArr = strings.Split(fsbIds, ",") + } + Reply, err := AddBaseOrganization(BaseOrganizationProto.ModelArg{AreaCode: areaCode, OrgCode: orgCode, OrgName: orgName, OrgType: 2, ManagerAreaCode: managerAreaCode, IsBranchSchool: isBranchSchool, MainSchoolId: mainSchoolId, FsbIds: idArr, Xxbxlxm: xxbxlxm, Szdcxlxm: szdcxlxm, Xxjbzm: xxjbzm, Fddbr: fddbr, Fddbrdh: fddbrdh, Address: address, Lxdh: lxdh, SortId: sortId, BUse: 1, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress}) return Reply, err } -func UpdateSchoolInfo(orgId string, orgCode string, orgName string, directlyUnderType int32, isBranchSchool int32, mainSchoolId string, xxbbm string, xxbxlxm string, szdcxlxm string, xxjbzm string, fddbr string, fddbrdh string, address string, lxdh string, sortId int32, actionPersonId string, actionIpAddress string) (*BaseOrganizationProto.Reply, error) { +func UpdateSchoolInfo(orgId string, orgCode string, orgName string, managerAreaCode string, isBranchSchool int32, mainSchoolId string, fsbIds string, xxbxlxm string, szdcxlxm string, xxjbzm string, fddbr string, fddbrdh string, address string, lxdh string, sortId int32, actionPersonId string, actionIpAddress string) (*BaseOrganizationProto.Reply, error) { forceUpdateFields := []string{"fddbr", "fddbrdh", "address", "lxdh"} - Reply, err := UpdateBaseOrganization(BaseOrganizationProto.ModelArg{OrgId: orgId, OrgCode: orgCode, OrgName: orgName, DirectlyUnderType: directlyUnderType, IsBranchSchool: isBranchSchool, MainSchoolId: mainSchoolId, Xxbbm: xxbbm, Xxbxlxm: xxbxlxm, Szdcxlxm: szdcxlxm, Xxjbzm: xxjbzm, Fddbr: fddbr, Fddbrdh: fddbrdh, Address: address, Lxdh: lxdh, SortId: sortId, ForceUpdateFields: forceUpdateFields, OrgType: 2, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress}) + idArr := make([]string, 0) + if len(fsbIds) > 0 { + idArr = strings.Split(fsbIds, ",") + } + Reply, err := UpdateBaseOrganization(BaseOrganizationProto.ModelArg{OrgId: orgId, OrgCode: orgCode, OrgName: orgName, ManagerAreaCode: managerAreaCode, IsBranchSchool: isBranchSchool, MainSchoolId: mainSchoolId, FsbIds: idArr, Xxbxlxm: xxbxlxm, Szdcxlxm: szdcxlxm, Xxjbzm: xxjbzm, Fddbr: fddbr, Fddbrdh: fddbrdh, Address: address, Lxdh: lxdh, SortId: sortId, ForceUpdateFields: forceUpdateFields, OrgType: 2, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress}) return Reply, err } @@ -164,6 +172,11 @@ func ListOrgByOrgKeyWord(personId string, keyWord string) (*BaseOrganizationProt return Reply, err } +func ListEduByCityCodeInfo(cityCode string) (*BaseOrganizationProto.Reply, error) { + Reply, err := ListEduByCityCode(BaseOrganizationProto.CityCodeArg{CityCode: cityCode}) + return Reply, err +} + func GetOrgTreeInfo(bureauId string, actionPersonId string, actionIpAddress string) (*BaseOrganizationProto.Reply, error) { Reply, err := GetBureauOrgTree(BaseOrganizationProto.ModelArg{BureauId: bureauId, ActionPersonId: actionPersonId, ActionIpAddress: actionIpAddress}) if Reply.List != "[]" { diff --git a/dsBaseWeb/Business/BaseOrganization/BaseOrganizationService/BaseOrganizationServiceRpc.go b/dsBaseWeb/Business/BaseOrganization/BaseOrganizationService/BaseOrganizationServiceRpc.go index 30749387..f8a39910 100644 --- a/dsBaseWeb/Business/BaseOrganization/BaseOrganizationService/BaseOrganizationServiceRpc.go +++ b/dsBaseWeb/Business/BaseOrganization/BaseOrganizationService/BaseOrganizationServiceRpc.go @@ -230,3 +230,20 @@ func ListOrgInfoByOrgKeyWord(listOrgArg BaseOrganizationProto.ListOrgArg) (*Base } return Reply, err } + +func ListEduByCityCode(arg BaseOrganizationProto.CityCodeArg) (*BaseOrganizationProto.Reply, error) { + //1、准备动作:连接服务器 + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + conn := GRpcUtil.GetConnection() + if conn == nil { + return nil, errors.New("RPC服务未启动!") + } + //2、业务传参 + c := BaseOrganizationProto.NewBaseOrganizationManageClient(conn) + Reply, err := c.ListEduByCityCode(ctx, &arg) + if err != nil { + LogUtil.Error("获取教育局列表错误: ", err.Error()) + } + return Reply, err +}