fix: UDMVolte用户特殊VoIP数据
This commit is contained in:
@@ -132,9 +132,13 @@ func (s *UDMVOIPController) Info(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 解析返回的数据
|
// 解析返回的数据
|
||||||
u := s.udmVOIPService.ParseInfo(username, neId, data)
|
u := s.udmVOIPService.ParseInfo(neId, data)
|
||||||
s.udmVOIPService.Insert(neId, u)
|
if u.ID != "" {
|
||||||
c.JSON(200, resp.OkData(u))
|
s.udmVOIPService.Insert(neId, u.UserName)
|
||||||
|
c.JSON(200, resp.OkData(u))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(200, resp.ErrMsg("No VOIP Data"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// UDMVOIP用户新增
|
// UDMVOIP用户新增
|
||||||
@@ -190,7 +194,7 @@ func (s *UDMVOIPController) Add(c *gin.Context) {
|
|||||||
|
|
||||||
// 命令ok时
|
// 命令ok时
|
||||||
if strings.Contains(data, "ok") {
|
if strings.Contains(data, "ok") {
|
||||||
s.udmVOIPService.Insert(neId, body)
|
s.udmVOIPService.Insert(neId, body.UserName)
|
||||||
}
|
}
|
||||||
c.JSON(200, resp.OkData(data))
|
c.JSON(200, resp.OkData(data))
|
||||||
}
|
}
|
||||||
@@ -266,8 +270,8 @@ func (s *UDMVOIPController) Adds(c *gin.Context) {
|
|||||||
// @Param value path string true "User Name, multiple separated by a , sign"
|
// @Param value path string true "User Name, multiple separated by a , sign"
|
||||||
// @Success 200 {object} object "Response Results"
|
// @Success 200 {object} object "Response Results"
|
||||||
// @Security TokenAuth
|
// @Security TokenAuth
|
||||||
// @Summary UDM Authenticated User Deletion
|
// @Summary UDM VOIP User Deletion
|
||||||
// @Description UDM Authenticated User Deletion
|
// @Description UDM VOIP User Deletion
|
||||||
// @Router /neData/udm/voip/{neId}/{value} [delete]
|
// @Router /neData/udm/voip/{neId}/{value} [delete]
|
||||||
func (s *UDMVOIPController) Remove(c *gin.Context) {
|
func (s *UDMVOIPController) Remove(c *gin.Context) {
|
||||||
language := reqctx.AcceptLanguage(c)
|
language := reqctx.AcceptLanguage(c)
|
||||||
@@ -387,8 +391,8 @@ func (s *UDMVOIPController) Removes(c *gin.Context) {
|
|||||||
// @Param pageSize query number true "pageSize" default(10)
|
// @Param pageSize query number true "pageSize" default(10)
|
||||||
// @Success 200 {object} object "Response Results"
|
// @Success 200 {object} object "Response Results"
|
||||||
// @Security TokenAuth
|
// @Security TokenAuth
|
||||||
// @Summary UDM Authenticated User Export
|
// @Summary UDM VOIP User Export
|
||||||
// @Description UDM Authenticated User Export
|
// @Description UDM VOIP User Export
|
||||||
// @Router /neData/udm/voip/export [get]
|
// @Router /neData/udm/voip/export [get]
|
||||||
func (s *UDMVOIPController) Export(c *gin.Context) {
|
func (s *UDMVOIPController) Export(c *gin.Context) {
|
||||||
language := reqctx.AcceptLanguage(c)
|
language := reqctx.AcceptLanguage(c)
|
||||||
@@ -463,8 +467,8 @@ func (s *UDMVOIPController) Export(c *gin.Context) {
|
|||||||
// @Param data body object true "Request Param"
|
// @Param data body object true "Request Param"
|
||||||
// @Success 200 {object} object "Response Results"
|
// @Success 200 {object} object "Response Results"
|
||||||
// @Security TokenAuth
|
// @Security TokenAuth
|
||||||
// @Summary UDM Authenticated User Import
|
// @Summary UDM VOIP User Import
|
||||||
// @Description UDM Authenticated User Import
|
// @Description UDM VOIP User Import
|
||||||
// @Router /neData/udm/voip/import [post]
|
// @Router /neData/udm/voip/import [post]
|
||||||
func (s *UDMVOIPController) Import(c *gin.Context) {
|
func (s *UDMVOIPController) Import(c *gin.Context) {
|
||||||
language := reqctx.AcceptLanguage(c)
|
language := reqctx.AcceptLanguage(c)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ type UDMVolteIMSController struct {
|
|||||||
// @Param neId path string true "NE ID" default(001)
|
// @Param neId path string true "NE ID" default(001)
|
||||||
// @Success 200 {object} object "Response Results"
|
// @Success 200 {object} object "Response Results"
|
||||||
// @Security TokenAuth
|
// @Security TokenAuth
|
||||||
// @Summary UDM Authentication User Data Refresh
|
// @Summary UDM VolteIMS User Data Refresh
|
||||||
// @Description UDM Authenticated User Data List Refresh Synchronization Latest
|
// @Description UDM Authenticated User Data List Refresh Synchronization Latest
|
||||||
// @Router /neData/udm/volte-ims/resetData/{neId} [put]
|
// @Router /neData/udm/volte-ims/resetData/{neId} [put]
|
||||||
func (s *UDMVolteIMSController) ResetData(c *gin.Context) {
|
func (s *UDMVolteIMSController) ResetData(c *gin.Context) {
|
||||||
@@ -72,8 +72,8 @@ func (s *UDMVolteIMSController) ResetData(c *gin.Context) {
|
|||||||
// @Param pageSize query number true "pageSize" default(10)
|
// @Param pageSize query number true "pageSize" default(10)
|
||||||
// @Success 200 {object} object "Response Results"
|
// @Success 200 {object} object "Response Results"
|
||||||
// @Security TokenAuth
|
// @Security TokenAuth
|
||||||
// @Summary UDM Authentication User List
|
// @Summary UDM VolteIMS User List
|
||||||
// @Description UDM Authentication User List
|
// @Description UDM VolteIMS User List
|
||||||
// @Router /neData/udm/volte-ims/list [get]
|
// @Router /neData/udm/volte-ims/list [get]
|
||||||
func (s *UDMVolteIMSController) List(c *gin.Context) {
|
func (s *UDMVolteIMSController) List(c *gin.Context) {
|
||||||
query := reqctx.QueryMap(c)
|
query := reqctx.QueryMap(c)
|
||||||
@@ -93,18 +93,22 @@ func (s *UDMVolteIMSController) List(c *gin.Context) {
|
|||||||
// @Param msisdn query string true "MSISDN"
|
// @Param msisdn query string true "MSISDN"
|
||||||
// @Success 200 {object} object "Response Results"
|
// @Success 200 {object} object "Response Results"
|
||||||
// @Security TokenAuth
|
// @Security TokenAuth
|
||||||
// @Summary UDM Authentication User Information
|
// @Summary UDM VolteIMS User Information
|
||||||
// @Description UDM Authentication User Information
|
// @Description UDM VolteIMS User Information
|
||||||
// @Router /neData/udm/volte-ims/{neId}/{value} [get]
|
// @Router /neData/udm/volte-ims/{neId}/{value} [get]
|
||||||
func (s *UDMVolteIMSController) Info(c *gin.Context) {
|
func (s *UDMVolteIMSController) Info(c *gin.Context) {
|
||||||
language := reqctx.AcceptLanguage(c)
|
language := reqctx.AcceptLanguage(c)
|
||||||
neId := c.Param("neId")
|
neId := c.Param("neId")
|
||||||
imsi := c.Param("imsi")
|
imsi := c.Param("imsi")
|
||||||
msisdn := c.Query("msisdn")
|
msisdn := c.Query("msisdn")
|
||||||
if neId == "" || imsi == "" || msisdn == "" {
|
if neId == "" || imsi == "" {
|
||||||
c.JSON(400, resp.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
c.JSON(400, resp.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if msisdn == "" {
|
||||||
|
c.JSON(400, resp.CodeMsg(400, "msisdn is required"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 查询网元获取IP
|
// 查询网元获取IP
|
||||||
neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId)
|
neInfo := s.neInfoService.FindByNeTypeAndNeID("UDM", neId)
|
||||||
@@ -138,6 +142,7 @@ func (s *UDMVolteIMSController) Info(c *gin.Context) {
|
|||||||
if u.ID != "" {
|
if u.ID != "" {
|
||||||
s.udmVolteIMSService.InsertByIMSI(imsi, neId)
|
s.udmVolteIMSService.InsertByIMSI(imsi, neId)
|
||||||
c.JSON(200, resp.OkData(u))
|
c.JSON(200, resp.OkData(u))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
c.JSON(200, resp.ErrMsg("No Volte IMS Data"))
|
c.JSON(200, resp.ErrMsg("No Volte IMS Data"))
|
||||||
}
|
}
|
||||||
@@ -153,8 +158,8 @@ func (s *UDMVolteIMSController) Info(c *gin.Context) {
|
|||||||
// @Param data body object true "Request Param"
|
// @Param data body object true "Request Param"
|
||||||
// @Success 200 {object} object "Response Results"
|
// @Success 200 {object} object "Response Results"
|
||||||
// @Security TokenAuth
|
// @Security TokenAuth
|
||||||
// @Summary UDM Authentication User Added
|
// @Summary UDM VolteIMS User Added
|
||||||
// @Description UDM Authentication User Added
|
// @Description UDM VolteIMS User Added If VoIP tag=0, then MSISDN and IMSI need to be the same.
|
||||||
// @Router /neData/udm/volte-ims/{neId} [post]
|
// @Router /neData/udm/volte-ims/{neId} [post]
|
||||||
func (s *UDMVolteIMSController) Add(c *gin.Context) {
|
func (s *UDMVolteIMSController) Add(c *gin.Context) {
|
||||||
language := reqctx.AcceptLanguage(c)
|
language := reqctx.AcceptLanguage(c)
|
||||||
@@ -219,8 +224,8 @@ func (s *UDMVolteIMSController) Add(c *gin.Context) {
|
|||||||
// @Param data body object true "Request Param"
|
// @Param data body object true "Request Param"
|
||||||
// @Success 200 {object} object "Response Results"
|
// @Success 200 {object} object "Response Results"
|
||||||
// @Security TokenAuth
|
// @Security TokenAuth
|
||||||
// @Summary UDM Authentication User Batch Add
|
// @Summary UDM VolteIMS User Batch Add
|
||||||
// @Description UDM Authentication User Batch Add
|
// @Description UDM VolteIMS User Batch Add
|
||||||
// @Router /neData/udm/volte-ims/{neId}/{value} [post]
|
// @Router /neData/udm/volte-ims/{neId}/{value} [post]
|
||||||
func (s *UDMVolteIMSController) Adds(c *gin.Context) {
|
func (s *UDMVolteIMSController) Adds(c *gin.Context) {
|
||||||
language := reqctx.AcceptLanguage(c)
|
language := reqctx.AcceptLanguage(c)
|
||||||
@@ -361,8 +366,8 @@ func (s *UDMVolteIMSController) Remove(c *gin.Context) {
|
|||||||
// @Param num path number true "Number of releases, value includes start imsi"
|
// @Param num path number true "Number of releases, value includes start imsi"
|
||||||
// @Success 200 {object} object "Response Results"
|
// @Success 200 {object} object "Response Results"
|
||||||
// @Security TokenAuth
|
// @Security TokenAuth
|
||||||
// @Summary UDM Authentication User Batch Deletion
|
// @Summary UDM VolteIMS User Batch Deletion
|
||||||
// @Description UDM Authentication User Batch Deletion
|
// @Description UDM VolteIMS User Batch Deletion
|
||||||
// @Router /neData/udm/volte-ims/{neId}/{imsi}/{num} [delete]
|
// @Router /neData/udm/volte-ims/{neId}/{imsi}/{num} [delete]
|
||||||
func (s *UDMVolteIMSController) Removes(c *gin.Context) {
|
func (s *UDMVolteIMSController) Removes(c *gin.Context) {
|
||||||
language := reqctx.AcceptLanguage(c)
|
language := reqctx.AcceptLanguage(c)
|
||||||
|
|||||||
@@ -74,13 +74,17 @@ func (r UDMVOIPUser) ResetData(neId string) int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ParseInfo 解析单个用户userName信息 data从命令MML得到的结果
|
// ParseInfo 解析单个用户userName信息 data从命令MML得到的结果
|
||||||
func (r UDMVOIPUser) ParseInfo(userName, neId string, data map[string]string) model.UDMVOIPUser {
|
func (r UDMVOIPUser) ParseInfo(neId string, data map[string]string) model.UDMVOIPUser {
|
||||||
u := r.udmVOIPRepository.SelectByUserNameAndNeID(userName, neId)
|
u := model.UDMVOIPUser{
|
||||||
|
NeId: neId,
|
||||||
// 用于更新
|
UserName: data["username"],
|
||||||
u.NeId = neId
|
Password: data["password"],
|
||||||
u.UserName = data["username"]
|
}
|
||||||
u.Password = data["password"]
|
// 赋予ID
|
||||||
|
item := r.udmVOIPRepository.SelectByUserNameAndNeID(u.UserName, neId)
|
||||||
|
if item.ID != "" {
|
||||||
|
u.ID = item.ID
|
||||||
|
}
|
||||||
return u
|
return u
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,10 +99,10 @@ func (r UDMVOIPUser) Find(u model.UDMVOIPUser) []model.UDMVOIPUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert 从数据中读取后删除username再存入数据库
|
// Insert 从数据中读取后删除username再存入数据库
|
||||||
func (r UDMVOIPUser) Insert(neId string, u model.UDMVOIPUser) int64 {
|
func (r UDMVOIPUser) Insert(neId string, username string) int64 {
|
||||||
uArr := r.dataByRedis(u.UserName, neId)
|
uArr := r.dataByRedis(username, neId)
|
||||||
if len(uArr) > 0 {
|
if len(uArr) > 0 {
|
||||||
r.udmVOIPRepository.Delete(u.UserName, neId)
|
r.udmVOIPRepository.Delete(username, neId)
|
||||||
return r.udmVOIPRepository.Inserts(uArr)
|
return r.udmVOIPRepository.Inserts(uArr)
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -176,12 +176,12 @@ func (r UDMVolteIMSUser) Delete(imsi, neId string) int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LoadData 重新加载从imsi开始num的数据
|
// LoadData 重新加载从imsi开始num的数据
|
||||||
func (r UDMVolteIMSUser) LoadData(neId, imsi, num string) {
|
func (r UDMVolteIMSUser) LoadData(neId, imsiOrMsisdn, num string) {
|
||||||
startIMSI, _ := strconv.ParseInt(imsi, 10, 64)
|
startIMSIOrMsisdn, _ := strconv.ParseInt(imsiOrMsisdn, 10, 64)
|
||||||
subNum, _ := strconv.ParseInt(num, 10, 64)
|
subNum, _ := strconv.ParseInt(num, 10, 64)
|
||||||
var i int64
|
var i int64
|
||||||
for i = 0; i < subNum; i++ {
|
for i = 0; i < subNum; i++ {
|
||||||
keyIMSI := fmt.Sprintf("%015d", startIMSI+i)
|
keyIMSI := fmt.Sprintf("%d", startIMSIOrMsisdn+i)
|
||||||
// 删除原数据
|
// 删除原数据
|
||||||
r.udmVolteIMSRepository.Delete(keyIMSI, neId)
|
r.udmVolteIMSRepository.Delete(keyIMSI, neId)
|
||||||
// 加载数据
|
// 加载数据
|
||||||
|
|||||||
Reference in New Issue
Block a user