|
|
package AccessSystemController
|
|
|
|
|
|
import (
|
|
|
"dsSupport/Model"
|
|
|
"dsSupport/MyModel/AccessSystem/AccessSystemDao"
|
|
|
"dsSupport/MyModel/AccessSystem/AccessSystemRpc/BaseOrganizationService"
|
|
|
"dsSupport/MyModel/AccessSystem/AccessSystemRpc/BasePositionService"
|
|
|
"dsSupport/MyModel/AccessSystem/AccessSystemRpc/GovAreaService"
|
|
|
"dsSupport/Utils/CommonUtil"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"net/http"
|
|
|
"os"
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
|
//模块的路由配置
|
|
|
func Routers(r *gin.RouterGroup) {
|
|
|
rr := r.Group("/accessSystem")
|
|
|
//配置接口
|
|
|
rr.GET("/PageAccessSystemInfo", PageAccessSystemInfo)
|
|
|
rr.POST("/AddAccessSystemInfo", AddAccessSystemInfo)
|
|
|
rr.POST("/UpdateAccessSystemInfo", UpdateAccessSystemInfo)
|
|
|
rr.POST("/DeleteAccessSystemInfo", DeleteAccessSystemInfo)
|
|
|
rr.POST("/EnableAccessSystemInfo", EnableAccessSystemInfo)
|
|
|
rr.POST("/DisableAccessSystemInfo", DisableAccessSystemInfo)
|
|
|
|
|
|
rr.GET("/GetAccessSystemRangeInfo", GetAccessSystemRangeInfo)
|
|
|
rr.POST("/SettingAccessSystemRangeInfo", SettingAccessSystemRangeInfo)
|
|
|
rr.GET("/GetAccessSystemSsoInfo", GetAccessSystemSsoInfo)
|
|
|
rr.POST("/SettingAccessSystemSsoInfo", SettingAccessSystemSsoInfo)
|
|
|
rr.POST("/EmptyAccessSystemSsoInfo", EmptyAccessSystemSsoInfo)
|
|
|
rr.GET("/GetAccessSystemIntegratedInfo", GetAccessSystemIntegratedInfo)
|
|
|
rr.POST("/SettingAccessSystemIntegratedInfo", SettingAccessSystemIntegratedInfo)
|
|
|
rr.POST("/EmptyAccessSystemIntegratedInfo", EmptyAccessSystemIntegratedInfo)
|
|
|
rr.GET("/GetPositionTreeInfo", GetPositionTreeInfo)
|
|
|
rr.GET("/GetAccessSystemIdentityPositionInfo", GetAccessSystemIdentityPositionInfo)
|
|
|
rr.POST("/SettingAccessSystemIdentityPositionInfo", SettingAccessSystemIdentityPositionInfo)
|
|
|
|
|
|
rr.GET("/GetAccessSystemStageInfo", GetAccessSystemStageInfo)
|
|
|
rr.POST("/SettingAccessSystemStageInfo", SettingAccessSystemStageInfo)
|
|
|
|
|
|
rr.GET("/PageGovArea", PageGovArea)
|
|
|
rr.GET("/GetOrganizationList", GetOrganizationList)
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// @Summary 获取接入系统列表
|
|
|
// @Description 获取接入系统列表
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param page query int true "第几页"
|
|
|
// @Param limit query int true "一页显示多少条"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/PageAccessSystemInfo [get]
|
|
|
// @X-EmptyLimit ["page","limit"]
|
|
|
// @X-IntRangeLimit [{"page":"1,1000"},{"limit":"1,1000"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [0]
|
|
|
func PageAccessSystemInfo(c *gin.Context) {
|
|
|
//第几页
|
|
|
page := CommonUtil.ConvertStringToInt(c.Query("page"))
|
|
|
//一页显示多少条
|
|
|
limit := CommonUtil.ConvertStringToInt(c.Query("limit"))
|
|
|
|
|
|
res, count, err := AccessSystemDao.ListApp("", page, limit)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
List: res,
|
|
|
Count: count,
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// @Summary 增加接入系统
|
|
|
// @Description 增加接入系统
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appName formData string true "系统名称"
|
|
|
// @Param appCode formData string true "系统编码"
|
|
|
// @Param sortId formData int false "排序号"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/AddAccessSystemInfo [post]
|
|
|
// @X-EmptyLimit ["appName","appCode"]
|
|
|
// @X-LengthLimit [{"appName":"2,30"},{"appCode":"2,20"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [1]
|
|
|
func AddAccessSystemInfo(c *gin.Context) {
|
|
|
//系统名称
|
|
|
appName := c.PostForm("appName")
|
|
|
//系统编码
|
|
|
appCode := c.PostForm("appCode")
|
|
|
//排序号
|
|
|
sortId := CommonUtil.ConvertStringToInt32(c.PostForm("sortId"))
|
|
|
id, err := AccessSystemDao.AddApp(appCode, appName, sortId)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
AppId: id,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 修改接入系统
|
|
|
// @Description 修改接入系统
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Param appName formData string true "系统名称"
|
|
|
// @Param appCode formData string true "系统编码"
|
|
|
// @Param sortId formData int false "排序号"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/UpdateAccessSystemInfo [post]
|
|
|
// @X-EmptyLimit ["appId","appName","appCode"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"},{"appName":"2,30"},{"appCode":"2,20"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [2]
|
|
|
func UpdateAccessSystemInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
//系统名称
|
|
|
appName := c.PostForm("appName")
|
|
|
//系统编码
|
|
|
appCode := c.PostForm("appCode")
|
|
|
//排序号
|
|
|
sortId := CommonUtil.ConvertStringToInt32(c.PostForm("sortId"))
|
|
|
err := AccessSystemDao.UpdateApp(appId, appCode, appName, sortId)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 删除接入系统
|
|
|
// @Description 删除接入系统
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/DeleteAccessSystemInfo [post]
|
|
|
// @X-EmptyLimit ["appId"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [3]
|
|
|
func DeleteAccessSystemInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
err := AccessSystemDao.DelApp(appId)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 启用接入系统
|
|
|
// @Description 启用接入系统
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/EnableAccessSystemInfo [post]
|
|
|
// @X-EmptyLimit ["appId"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [4]
|
|
|
func EnableAccessSystemInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
err := AccessSystemDao.ChangeAppStatus(appId, 1)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 禁用接入系统
|
|
|
// @Description 禁用接入系统
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/DisableAccessSystemInfo [post]
|
|
|
// @X-EmptyLimit ["appId"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [5]
|
|
|
func DisableAccessSystemInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
err := AccessSystemDao.ChangeAppStatus(appId, -2)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 获取接入系统的使用范围
|
|
|
// @Description 获取接入系统的使用范围
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId query string true "系统ID"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/GetAccessSystemRangeInfo [get]
|
|
|
// @X-EmptyLimit ["appId"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [6]
|
|
|
func GetAccessSystemRangeInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.Query("appId")
|
|
|
|
|
|
res, err := AccessSystemDao.GetAppRange(appId)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
List: res,
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// @Summary 设置接入系统的使用范围
|
|
|
// @Description 设置接入系统的使用范围
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Param rangeCode formData string true "使用范围的行政区划码、单位ID,多个用逗号分隔"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/SettingAccessSystemRangeInfo [post]
|
|
|
// @X-EmptyLimit ["orgId","rangeCode"]
|
|
|
// @X-LengthLimit [{"orgId":"36,36"},{"rangeCode":"1,3700"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [7]
|
|
|
func SettingAccessSystemRangeInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
//使用范围的行政区划码、单位ID,多个用逗号分隔
|
|
|
rangeCode := c.PostForm("rangeCode")
|
|
|
arr := make([]string, 0)
|
|
|
if len(rangeCode) > 0 {
|
|
|
arr = strings.Split(rangeCode, ",")
|
|
|
}
|
|
|
|
|
|
err := AccessSystemDao.SaveAppRange(appId, arr)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 获取接入系统的统一认证信息
|
|
|
// @Description 获取接入系统的统一认证信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId query string true "系统ID"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/GetAccessSystemSsoInfo [get]
|
|
|
// @X-EmptyLimit ["appId"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [8]
|
|
|
func GetAccessSystemSsoInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.Query("appId")
|
|
|
res, err := AccessSystemDao.GetApp(appId)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
List: CommonUtil.MapKeepFields(res, "redirect_uri", "logout_uri"),
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 设置接入系统的统一认证信息
|
|
|
// @Description 设置接入系统的统一认证信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Param redirectUri formData string true "统一认证回调地址"
|
|
|
// @Param logoutUri formData string false "统一认证登出地址"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/SettingAccessSystemSsoInfo [post]
|
|
|
// @X-EmptyLimit ["appId","redirectUri"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"},{"redirectUri":"2,300"},{"logoutUri":"2,300"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [9]
|
|
|
func SettingAccessSystemSsoInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
//统一认证回调地址
|
|
|
redirectUri := c.PostForm("redirectUri")
|
|
|
//统一认证登出地址
|
|
|
logoutUri := c.PostForm("logoutUri")
|
|
|
|
|
|
err := AccessSystemDao.UpdateSso(appId, redirectUri, logoutUri)
|
|
|
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// @Summary 清空接入系统的统一认证信息
|
|
|
// @Description 清空接入系统的统一认证信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/EmptyAccessSystemSsoInfo [post]
|
|
|
// @X-EmptyLimit ["orgId"]
|
|
|
// @X-LengthLimit [{"orgId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [10]
|
|
|
func EmptyAccessSystemSsoInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
err := AccessSystemDao.ClearSso(appId)
|
|
|
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 获取接入系统的集成信息
|
|
|
// @Description 获取接入系统的集成信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId query string true "系统ID"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/GetAccessSystemIntegratedInfo [get]
|
|
|
// @X-EmptyLimit ["appId"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [11]
|
|
|
func GetAccessSystemIntegratedInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.Query("appId")
|
|
|
|
|
|
res, err := AccessSystemDao.GetApp(appId)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
List: CommonUtil.MapKeepFields(res, "app_url", "app_icon"),
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 设置接入系统的集成信息
|
|
|
// @Description 设置接入系统的集成信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept multipart/form-data
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Param appUrl formData string true "接入系统在集成页面的调用地址"
|
|
|
// @Param appIcon formData file true "图标"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/SettingAccessSystemIntegratedInfo [post]
|
|
|
// @X-EmptyLimit ["appId","appUrl"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [12]
|
|
|
func SettingAccessSystemIntegratedInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
//接入系统在集成页面的调用地址
|
|
|
appUrl := c.PostForm("appUrl")
|
|
|
//接入系统在集成页面的图标
|
|
|
header, _ := c.FormFile("appIcon")
|
|
|
rootPath, _ := os.Getwd()
|
|
|
iconDir := rootPath + "/Html/Icon/"
|
|
|
//生成图标的ID
|
|
|
iconFileId := CommonUtil.GetUUID()
|
|
|
iconFileName := iconFileId + "." + strings.Split(header.Filename, ".")[1]
|
|
|
iconPath := iconDir + iconFileName
|
|
|
//保存图标
|
|
|
c.SaveUploadedFile(header, iconPath)
|
|
|
|
|
|
err := AccessSystemDao.UpdateIntegration(appId, appUrl, "/dsSupport/Icon/"+iconFileName)
|
|
|
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// @Summary 清空接入系统的集成信息
|
|
|
// @Description 清空接入系统的集成信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/EmptyAccessSystemIntegratedInfo [post]
|
|
|
// @X-EmptyLimit ["orgId"]
|
|
|
// @X-LengthLimit [{"orgId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [13]
|
|
|
func EmptyAccessSystemIntegratedInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
err := AccessSystemDao.ClearIntegration(appId)
|
|
|
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 获取职务树信息
|
|
|
// @Description 获取职务树信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/GetPositionTreeInfo [get]
|
|
|
// @X-RemoveSwaggerField ["id_int","b_use","last_updated_time","postion_flag"]
|
|
|
// @X-Sort [14]
|
|
|
func GetPositionTreeInfo(c *gin.Context) {
|
|
|
r, err := BasePositionService.TreePositionInfo()
|
|
|
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 + "]"),
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 获取接入系统的身份信息和职务信息
|
|
|
// @Description 获取接入系统的身份信息和职务信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId query string true "系统ID"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/GetAccessSystemIdentityPositionInfo [get]
|
|
|
// @X-EmptyLimit ["appId"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [15]
|
|
|
func GetAccessSystemIdentityPositionInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.Query("appId")
|
|
|
|
|
|
identityRes, err1 := AccessSystemDao.GetAppIdentity(appId)
|
|
|
if err1 != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err1.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
teacherFlag := 2
|
|
|
studentFlag := 2
|
|
|
parentFlag := 2
|
|
|
|
|
|
for i := range identityRes {
|
|
|
if identityRes[i]["identity_id"] == CommonUtil.ConvertIntToInt64(2) {
|
|
|
teacherFlag = 1
|
|
|
}
|
|
|
if identityRes[i]["identity_id"] == CommonUtil.ConvertIntToInt64(3) {
|
|
|
studentFlag = 1
|
|
|
}
|
|
|
if identityRes[i]["identity_id"] == CommonUtil.ConvertIntToInt64(4) {
|
|
|
parentFlag = 1
|
|
|
}
|
|
|
}
|
|
|
|
|
|
positionRes, err := AccessSystemDao.GetAppPosition(appId)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
positionArr := make([]string, 0)
|
|
|
|
|
|
if len(positionRes) > 0 {
|
|
|
teacherFlag = 3
|
|
|
for i := range positionRes {
|
|
|
positionArr = append(positionArr, positionRes[i]["position_id"].(string))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
TeacherFlag: teacherFlag,
|
|
|
StudentFlag: studentFlag,
|
|
|
ParentFlag: parentFlag,
|
|
|
PositionList: positionArr,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// @Summary 设置接入系统的身份信息和职务信息
|
|
|
// @Description 设置接入系统的身份信息和职务信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Param teacherFlag formData int true "教师身份是否可用 1:可用 2:不可用 3:部分职位可用"
|
|
|
// @Param studentFlag formData int true "学生身份是否可用 1:可用 2:不可用"
|
|
|
// @Param parentFlag formData int true "家长身份是否可用 1:可用 2:不可用"
|
|
|
// @Param positionIds formData string false "职务ID,多个用逗号分隔"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/SettingAccessSystemIdentityPositionInfo [post]
|
|
|
// @X-EmptyLimit ["appId","teacherFlag","studentFlag","parentFlag"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-IntRangeLimit [{"teacherFlag":"1,3"},{"studentFlag":"1,2"},{"parentFlag":"1,2"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [16]
|
|
|
func SettingAccessSystemIdentityPositionInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
//教师身份是否可用 1:可用 2:不可用 3:部分职位可用
|
|
|
teacherFlag := CommonUtil.ConvertStringToInt(c.PostForm("teacherFlag"))
|
|
|
//学生身份是否可用 1:可用 2:不可用
|
|
|
studentFlag := CommonUtil.ConvertStringToInt(c.PostForm("studentFlag"))
|
|
|
//家长身份是否可用 1:可用 2:不可用
|
|
|
parentFlag := CommonUtil.ConvertStringToInt(c.PostForm("parentFlag"))
|
|
|
//职务ID,多个用逗号分隔
|
|
|
positionIds := c.PostForm("positionIds")
|
|
|
|
|
|
identityArr := make([]int, 0)
|
|
|
if teacherFlag < 3 {
|
|
|
identityArr = append(identityArr, 2)
|
|
|
}
|
|
|
if studentFlag == 1 {
|
|
|
identityArr = append(identityArr, 3)
|
|
|
}
|
|
|
if parentFlag == 1 {
|
|
|
identityArr = append(identityArr, 4)
|
|
|
}
|
|
|
|
|
|
err := AccessSystemDao.SaveAppIdentity(appId, identityArr)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
if len(positionIds) > 0 {
|
|
|
err := AccessSystemDao.SaveAppPosition(appId, strings.Split(positionIds, ","))
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 获取接入系统的学段信息
|
|
|
// @Description 获取接入系统的学段信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId query string true "系统ID"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/GetAccessSystemStageInfo [get]
|
|
|
// @X-EmptyLimit ["appId"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [17]
|
|
|
func GetAccessSystemStageInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.Query("appId")
|
|
|
|
|
|
res, err := AccessSystemDao.GetAppStage(appId)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
arr := make([]int64, 0)
|
|
|
if len(res) > 0 {
|
|
|
for i := range res {
|
|
|
arr = append(arr, res[i]["stage_id"].(int64))
|
|
|
}
|
|
|
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
List: arr,
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
// @Summary 设置接入系统的学段信息
|
|
|
// @Description 设置接入系统的学段信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param appId formData string true "系统ID"
|
|
|
// @Param stageIds formData int true "学段ID,多个用逗号分隔,如果是通用传-1"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/SettingAccessSystemStageInfo [post]
|
|
|
// @X-EmptyLimit ["appId","stageIds"]
|
|
|
// @X-LengthLimit [{"appId":"36,36"}]
|
|
|
// @X-IntRangeLimit [{"teacherFlag":"1,3"},{"studentFlag":"1,2"},{"parentFlag":"1,2"}]
|
|
|
// @X-TableName ["t_app_base"]
|
|
|
// @X-Sort [18]
|
|
|
func SettingAccessSystemStageInfo(c *gin.Context) {
|
|
|
//系统ID
|
|
|
appId := c.PostForm("appId")
|
|
|
//学段ID,多个用逗号分隔,如果是通用传-1
|
|
|
stageIds := c.PostForm("stageIds")
|
|
|
stageArr := strings.Split(stageIds, ",")
|
|
|
err := AccessSystemDao.SaveAppStage(appId, stageArr)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: err.Error(),
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
Message: "操作成功!",
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 获取行政区划信息
|
|
|
// @Description 获取行政区划信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param page query int true "第几页"
|
|
|
// @Param limit query int true "一页显示多少条"
|
|
|
// @Param areaCode query string true "行政区划码"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/PageGovArea [get]
|
|
|
// @X-EmptyLimit ["page","limit","areaCode"]
|
|
|
// @X-IntLimit ["page","limit","areaCode"]
|
|
|
// @X-LengthLimit [{"areaCode":"6,6"}]
|
|
|
// @X-Sort [19]
|
|
|
func PageGovArea(c *gin.Context) {
|
|
|
page := CommonUtil.ConvertStringToInt32(c.Query("page"))
|
|
|
limit := CommonUtil.ConvertStringToInt32(c.Query("limit"))
|
|
|
areaCode := c.Query("areaCode")
|
|
|
r, err := GovAreaService.PageGovArea(page, limit, areaCode)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: "调用RPC服务失败!",
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
List: CommonUtil.ConvertJsonStringToMapArray(r.List),
|
|
|
Message: "获取成功",
|
|
|
Count: r.Count,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// @Summary 获取行政区划信息
|
|
|
// @Description 获取行政区划信息
|
|
|
// @Tags 接入系统
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
// @Produce json
|
|
|
// @Param page query int true "第几页"
|
|
|
// @Param limit query int true "一页显示多少条"
|
|
|
// @Param areaCode query string true "行政区划码"
|
|
|
// @Param orgName query string false "行政区划码"
|
|
|
// @Success 200 {object} Model.Res
|
|
|
// @Router /support/accessSystem/GetOrganizationList [get]
|
|
|
// @X-EmptyLimit ["page","limit","areaCode"]
|
|
|
// @X-LengthLimit [{"areaCode":"6,6"}]
|
|
|
// @X-Sort [20]
|
|
|
func GetOrganizationList(c *gin.Context) {
|
|
|
page := CommonUtil.ConvertStringToInt32(c.Query("page"))
|
|
|
limit := CommonUtil.ConvertStringToInt32(c.Query("limit"))
|
|
|
areaCode := c.Query("areaCode")
|
|
|
orgName := c.Query("orgName")
|
|
|
r, err := BaseOrganizationService.GetOrganizationList(page, limit, areaCode, orgName)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: false,
|
|
|
Message: "调用RPC服务失败!",
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
c.JSON(http.StatusOK, Model.Res{
|
|
|
Success: true,
|
|
|
List: CommonUtil.ConvertJsonStringToMapArray(r.List),
|
|
|
Message: "获取成功",
|
|
|
Count: r.Count,
|
|
|
})
|
|
|
}
|