fix: ue ims user
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"be.ems/features/ue/model"
|
||||||
|
"be.ems/features/ue/service"
|
||||||
"be.ems/src/framework/constants/uploadsubpath"
|
"be.ems/src/framework/constants/uploadsubpath"
|
||||||
"be.ems/src/framework/i18n"
|
"be.ems/src/framework/i18n"
|
||||||
"be.ems/src/framework/telnet"
|
"be.ems/src/framework/telnet"
|
||||||
@@ -14,24 +16,22 @@ import (
|
|||||||
"be.ems/src/framework/utils/parse"
|
"be.ems/src/framework/utils/parse"
|
||||||
"be.ems/src/framework/vo/result"
|
"be.ems/src/framework/vo/result"
|
||||||
neService "be.ems/src/modules/network_element/service"
|
neService "be.ems/src/modules/network_element/service"
|
||||||
"be.ems/features/ue/service"
|
|
||||||
"be.ems/features/ue/model"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/gin-gonic/gin/binding"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 实例化控制层 IMSUserController 结构体
|
// 实例化控制层 IMSUserController 结构体
|
||||||
var NewIMSUserController = &IMSUserController{
|
var NewIMSUserController = &IMSUserController{
|
||||||
imsUserService: service.NewIMSUserService,
|
imsUserService: service.NewIMSUserService,
|
||||||
neInfoService: neService.NewNeInfo,
|
neInfoService: neService.NewNeInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
// IMS用户信息 控制层处理
|
// IMS用户信息 控制层处理
|
||||||
//
|
//
|
||||||
// @Description IMS用户信息 控制层处理
|
// @Description IMS用户信息 控制层处理
|
||||||
type IMSUserController struct {
|
type IMSUserController struct {
|
||||||
imsUserService *service.IMSUserService // IMS User信息服务
|
imsUserService *service.IMSUserService // IMS User信息服务
|
||||||
neInfoService *neService.NeInfo // 网元信息服务
|
neInfoService *neService.NeInfo // 网元信息服务
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *IMSUserController) ResetData(c *gin.Context) {
|
func (s *IMSUserController) ResetData(c *gin.Context) {
|
||||||
@@ -46,7 +46,6 @@ func (s *IMSUserController) ResetData(c *gin.Context) {
|
|||||||
c.JSON(200, result.OkData(data))
|
c.JSON(200, result.OkData(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (s *IMSUserController) List(c *gin.Context) {
|
func (s *IMSUserController) List(c *gin.Context) {
|
||||||
querys := ctx.QueryMap(c)
|
querys := ctx.QueryMap(c)
|
||||||
// querys["userName"] = ctx.LoginUserToUserName(c)
|
// querys["userName"] = ctx.LoginUserToUserName(c)
|
||||||
@@ -116,7 +115,7 @@ func (s *IMSUserController) Add(c *gin.Context) {
|
|||||||
|
|
||||||
var body model.IMSUser
|
var body model.IMSUser
|
||||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||||
if err != nil || len(body.IMSI) < model.IMSI_MAX_LENGTH {
|
if err != nil || (len(body.IMSI) < model.IMSI_MAX_LENGTH && body.VoLTE == model.TAG_VoLTE) {
|
||||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -163,7 +162,7 @@ func (s *IMSUserController) Adds(c *gin.Context) {
|
|||||||
|
|
||||||
var body model.IMSUser
|
var body model.IMSUser
|
||||||
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
err := c.ShouldBindBodyWith(&body, binding.JSON)
|
||||||
if err != nil || len(body.IMSI) < model.IMSI_MAX_LENGTH {
|
if err != nil || (len(body.IMSI) < model.IMSI_MAX_LENGTH && body.VoLTE == model.TAG_VoLTE) {
|
||||||
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -376,7 +375,7 @@ func (s *IMSUserController) Export(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 文件名
|
// 文件名
|
||||||
fileName := fmt.Sprintf("udm_volte_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType)
|
fileName := fmt.Sprintf("u_ims_user_export_%s_%d.%s", neId, time.Now().UnixMilli(), fileType)
|
||||||
filePath := filepath.Join(file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
filePath := filepath.Join(file.ParseUploadFileDir(uploadsubpath.EXPORT), fileName)
|
||||||
|
|
||||||
if fileType == "csv" {
|
if fileType == "csv" {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ const (
|
|||||||
IMSI_MAX_LENGTH = 15
|
IMSI_MAX_LENGTH = 15
|
||||||
// MSISDN 号码长度
|
// MSISDN 号码长度
|
||||||
MSISDN_MAX_LENGTH = 15
|
MSISDN_MAX_LENGTH = 15
|
||||||
|
TAG_VoLTE = "1" // VoLTE标记
|
||||||
|
TAG_VOIP = "0" // VoIP标记
|
||||||
)
|
)
|
||||||
|
|
||||||
// @Description VoLTE用户信息
|
// @Description VoLTE用户信息
|
||||||
@@ -13,8 +15,8 @@ type IMSUser struct {
|
|||||||
NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识
|
NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识
|
||||||
IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID
|
IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID
|
||||||
MSISDN string `json:"msisdn" gorm:"column:msisdn"` // 用户电话号码
|
MSISDN string `json:"msisdn" gorm:"column:msisdn"` // 用户电话号码
|
||||||
VoLTE string `json:"volte" gorm:"column:volte"` // VoLTE
|
VoLTE string `json:"volte" gorm:"column:volte"` // VoLTE
|
||||||
VNI string `json:"vni" gorm:"column:vni"` // VNI
|
VNI string `json:"vni" gorm:"column:vni"` // VNI
|
||||||
|
|
||||||
TenantID string `json:"tenantID" gorm:"column:tenant_id"`
|
TenantID string `json:"tenantID" gorm:"column:tenant_id"`
|
||||||
TenantName string `json:"tenantName" gorm:"-"`
|
TenantName string `json:"tenantName" gorm:"-"`
|
||||||
|
|||||||
@@ -97,17 +97,22 @@ func (r *IMSUserService) ResetData(neId string) int64 {
|
|||||||
func (r *IMSUserService) ParseInfo(imsi, neId string, data map[string]string) model.IMSUser {
|
func (r *IMSUserService) ParseInfo(imsi, neId string, data map[string]string) model.IMSUser {
|
||||||
u := r.imsUserRepository.SelectByIMSIAndNeID(imsi, neId)
|
u := r.imsUserRepository.SelectByIMSIAndNeID(imsi, neId)
|
||||||
|
|
||||||
msisdn := data["MSISDN"]
|
msisdn := data["msisdn"]
|
||||||
if imsMsisdnLen := strings.Index(msisdn, ","); imsMsisdnLen != -1 {
|
if imsMsisdnLen := strings.Index(msisdn, ","); imsMsisdnLen != -1 {
|
||||||
msisdn = msisdn[:imsMsisdnLen]
|
msisdn = msisdn[:imsMsisdnLen]
|
||||||
}
|
}
|
||||||
|
var vni string = "-"
|
||||||
|
impiParts := strings.Split(data["impi"], "@")
|
||||||
|
if len(impiParts) > 1 {
|
||||||
|
vni = impiParts[1] // 输出: ims.mnc001.mcc110.3gppnetwork.org
|
||||||
|
}
|
||||||
|
|
||||||
// 用于更新
|
// 用于更新
|
||||||
u.NeId = neId
|
u.NeId = neId
|
||||||
u.IMSI = imsi
|
u.IMSI = imsi
|
||||||
u.MSISDN = msisdn
|
u.MSISDN = msisdn
|
||||||
u.VoLTE = data["VoLTE"]
|
u.VoLTE = data["volte_tag"]
|
||||||
u.VNI = data["VNI"]
|
u.VNI = vni
|
||||||
return u
|
return u
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ pprof:
|
|||||||
rest:
|
rest:
|
||||||
- ipv4: 0.0.0.0
|
- ipv4: 0.0.0.0
|
||||||
ipv6:
|
ipv6:
|
||||||
port: 33030
|
port: 43030
|
||||||
- ipv4: 0.0.0.0
|
- ipv4: 0.0.0.0
|
||||||
ipv6:
|
ipv6:
|
||||||
port: 33443
|
port: 43443
|
||||||
schema: https
|
schema: https
|
||||||
clientAuthType: 0
|
clientAuthType: 0
|
||||||
caFile: ./etc/certs/omc-ca.crt
|
caFile: ./etc/certs/omc-ca.crt
|
||||||
|
|||||||
Reference in New Issue
Block a user