卡新增imei字段
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m10s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m10s
This commit is contained in:
@@ -123,7 +123,9 @@ type CardStatusReq struct {
|
|||||||
type CardStatusResp struct {
|
type CardStatusResp struct {
|
||||||
ICCID string `json:"iccid" description:"ICCID"`
|
ICCID string `json:"iccid" description:"ICCID"`
|
||||||
CardStatus string `json:"cardStatus" description:"卡状态(准备、正常、停机;仅正常表示开机)"`
|
CardStatus string `json:"cardStatus" description:"卡状态(准备、正常、停机;仅正常表示开机)"`
|
||||||
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
// IMEI 为插拔卡业务中网关上报的设备 IMEI,非设备自身 IMEI,仅用于数据同步落库,无业务使用
|
||||||
|
IMEI string `json:"imei,omitempty" description:"插拔卡业务 IMEI(网关同步,无业务含义)"`
|
||||||
|
Extend string `json:"extend,omitempty" description:"扩展字段(广电国网特殊参数)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlowQueryReq 是查询流量使用的请求
|
// FlowQueryReq 是查询流量使用的请求
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ type StandaloneIotCardResponse struct {
|
|||||||
NetworkStatus int `json:"network_status" description:"网络状态 (0:停机, 1:开机)"`
|
NetworkStatus int `json:"network_status" description:"网络状态 (0:停机, 1:开机)"`
|
||||||
NetworkStatusName string `json:"network_status_name" description:"网络状态名称(中文)"`
|
NetworkStatusName string `json:"network_status_name" description:"网络状态名称(中文)"`
|
||||||
GatewayExtend string `json:"gateway_extend" description:"Gateway 卡状态扩展字段,原样返回上游 extend,用于展示运营商侧实际停机原因"`
|
GatewayExtend string `json:"gateway_extend" description:"Gateway 卡状态扩展字段,原样返回上游 extend,用于展示运营商侧实际停机原因"`
|
||||||
|
GatewayCardIMEI string `json:"gateway_card_imei" description:"插拔卡业务 IMEI(由 Gateway 卡状态接口同步,非设备自身 IMEI,无业务含义,仅供查看)"`
|
||||||
DataUsageMB int64 `json:"data_usage_mb" description:"累计流量使用(MB)"`
|
DataUsageMB int64 `json:"data_usage_mb" description:"累计流量使用(MB)"`
|
||||||
CurrentMonthUsageMB float64 `json:"current_month_usage_mb" description:"系统自然月累计流量(MB,不等于运营商周期口径)"`
|
CurrentMonthUsageMB float64 `json:"current_month_usage_mb" description:"系统自然月累计流量(MB,不等于运营商周期口径)"`
|
||||||
LastGatewayReadingMB float64 `json:"last_gateway_reading_mb" description:"运营商当前周期累计流量读数(MB,展示运营商口径时使用)"`
|
LastGatewayReadingMB float64 `json:"last_gateway_reading_mb" description:"运营商当前周期累计流量读数(MB,展示运营商口径时使用)"`
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ type IotCard struct {
|
|||||||
DeviceVirtualNo string `gorm:"column:device_virtual_no;type:varchar(100);not null;default:'';comment:绑定设备的虚拟号快照(未绑定时为空字符串)" json:"device_virtual_no"`
|
DeviceVirtualNo string `gorm:"column:device_virtual_no;type:varchar(100);not null;default:'';comment:绑定设备的虚拟号快照(未绑定时为空字符串)" json:"device_virtual_no"`
|
||||||
LastGatewayReadingMB float64 `gorm:"column:last_gateway_reading_mb;type:float;not null;default:0;comment:运营商当前周期累计流量读数(MB,来自网关)" json:"last_gateway_reading_mb"`
|
LastGatewayReadingMB float64 `gorm:"column:last_gateway_reading_mb;type:float;not null;default:0;comment:运营商当前周期累计流量读数(MB,来自网关)" json:"last_gateway_reading_mb"`
|
||||||
GatewayExtend string `gorm:"column:gateway_extend;type:text;not null;default:'';comment:Gateway 卡状态扩展字段,原样保存上游 extend,用于展示运营商侧实际停机原因" json:"gateway_extend"`
|
GatewayExtend string `gorm:"column:gateway_extend;type:text;not null;default:'';comment:Gateway 卡状态扩展字段,原样保存上游 extend,用于展示运营商侧实际停机原因" json:"gateway_extend"`
|
||||||
|
// GatewayCardIMEI 为插拔卡业务中网关上报的设备 IMEI,非设备自身 IMEI,仅用于数据同步落库
|
||||||
|
GatewayCardIMEI string `gorm:"column:gateway_card_imei;type:varchar(50);not null;default:'';comment:插拔卡业务 IMEI,网关卡状态接口同步,非设备 IMEI" json:"gateway_card_imei"`
|
||||||
RealnamePolicy string `gorm:"column:realname_policy;type:varchar(20);default:'after_order';not null;comment:实名认证策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)" json:"realname_policy"`
|
RealnamePolicy string `gorm:"column:realname_policy;type:varchar(20);default:'after_order';not null;comment:实名认证策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)" json:"realname_policy"`
|
||||||
|
|
||||||
// ICCID 双列存储,用于支持 19/20 位 ICCID 精确路由查询
|
// ICCID 双列存储,用于支持 19/20 位 ICCID 精确路由查询
|
||||||
|
|||||||
@@ -377,6 +377,7 @@ func (s *Service) toStandaloneResponse(card *model.IotCard, shopMap map[uint]str
|
|||||||
NetworkStatus: card.NetworkStatus,
|
NetworkStatus: card.NetworkStatus,
|
||||||
NetworkStatusName: constants.GetNetworkStatusName(card.NetworkStatus),
|
NetworkStatusName: constants.GetNetworkStatusName(card.NetworkStatus),
|
||||||
GatewayExtend: card.GatewayExtend,
|
GatewayExtend: card.GatewayExtend,
|
||||||
|
GatewayCardIMEI: card.GatewayCardIMEI,
|
||||||
DataUsageMB: card.DataUsageMB,
|
DataUsageMB: card.DataUsageMB,
|
||||||
CurrentMonthUsageMB: card.CurrentMonthUsageMB,
|
CurrentMonthUsageMB: card.CurrentMonthUsageMB,
|
||||||
LastGatewayReadingMB: card.LastGatewayReadingMB,
|
LastGatewayReadingMB: card.LastGatewayReadingMB,
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ func (h *PollingCardStatusHandler) Handle(ctx context.Context, t *asynq.Task) er
|
|||||||
newNetworkStatus := card.NetworkStatus
|
newNetworkStatus := card.NetworkStatus
|
||||||
gatewayCardStatus := ""
|
gatewayCardStatus := ""
|
||||||
gatewayExtend := card.GatewayExtend
|
gatewayExtend := card.GatewayExtend
|
||||||
|
gatewayCardIMEI := ""
|
||||||
statusQueried := false
|
statusQueried := false
|
||||||
if h.gateway != nil {
|
if h.gateway != nil {
|
||||||
result, gwErr := h.gateway.QueryCardStatus(ctx, &gateway.CardStatusReq{CardNo: card.ICCID})
|
result, gwErr := h.gateway.QueryCardStatus(ctx, &gateway.CardStatusReq{CardNo: card.ICCID})
|
||||||
@@ -78,6 +79,7 @@ func (h *PollingCardStatusHandler) Handle(ctx context.Context, t *asynq.Task) er
|
|||||||
}
|
}
|
||||||
gatewayCardStatus = result.CardStatus
|
gatewayCardStatus = result.CardStatus
|
||||||
gatewayExtend = strings.TrimSpace(result.Extend)
|
gatewayExtend = strings.TrimSpace(result.Extend)
|
||||||
|
gatewayCardIMEI = strings.TrimSpace(result.IMEI)
|
||||||
statusQueried = true
|
statusQueried = true
|
||||||
parsedStatus, ok := gateway.ParseCardNetworkStatus(result.CardStatus, gatewayExtend)
|
parsedStatus, ok := gateway.ParseCardNetworkStatus(result.CardStatus, gatewayExtend)
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -108,6 +110,9 @@ func (h *PollingCardStatusHandler) Handle(ctx context.Context, t *asynq.Task) er
|
|||||||
if statusQueried {
|
if statusQueried {
|
||||||
fields["gateway_extend"] = gatewayExtend
|
fields["gateway_extend"] = gatewayExtend
|
||||||
fields["last_sync_time"] = now
|
fields["last_sync_time"] = now
|
||||||
|
if gatewayCardIMEI != "" {
|
||||||
|
fields["gateway_card_imei"] = gatewayCardIMEI
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if statusChanged {
|
if statusChanged {
|
||||||
fields["network_status"] = newNetworkStatus
|
fields["network_status"] = newNetworkStatus
|
||||||
|
|||||||
Reference in New Issue
Block a user