feat: new
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
package psap_ticket_monitor
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
ueCallBackTicket "be.ems/features/ue/mf_callback_ticket"
|
||||
"be.ems/lib/log"
|
||||
"be.ems/src/framework/cron"
|
||||
"be.ems/src/framework/logger"
|
||||
neService "be.ems/src/modules/network_element/service"
|
||||
)
|
||||
|
||||
var NewProcessor = &PsapTicketMonitor{
|
||||
@@ -92,7 +97,32 @@ func (s *PsapTicketMonitor) handleTimeoutTickets(status string, timeoutMicros in
|
||||
// 更新超时工单状态
|
||||
var updatedCount int
|
||||
for _, ticket := range tickets {
|
||||
if err := s.callbackTicketService.UpdateTicketToTimeout(&ticket, status); err != nil {
|
||||
// 获取网元信息
|
||||
neInfo := neService.NewNeInfo.SelectNeInfoByRmuid(ticket.RmUid)
|
||||
// 构造网元MF的API地址
|
||||
url := fmt.Sprintf("http://%s:%d/ne/config/data?neType=%s&neId=%s¶mName=agents",
|
||||
neInfo.IP, neInfo.Port, neInfo.NeType, neInfo.NeId)
|
||||
// 发送HTTP请求获取座席列表
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
log.Error("Failed to get MF agents", err)
|
||||
continue
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
// 解析座席列表响应
|
||||
var agentResp struct {
|
||||
Code int `json:"code"`
|
||||
Data []ueCallBackTicket.AgentInfo `json:"data"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
if err := json.NewDecoder(resp.Body).Decode(&agentResp); err != nil {
|
||||
log.Error("Failed to decode MF agents response", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if err := s.callbackTicketService.UpdateTicketToTimeout(&ticket, status, agentResp.Data); err != nil {
|
||||
log.Errorf("更新工单 %d 状态失败: %v", ticket.TicketId, err)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ func (r NeInfo) neListSort(arr []model.NeInfo) []model.NeInfo {
|
||||
// neListSort 网元列表预设排序
|
||||
var list = []string{
|
||||
"OMC",
|
||||
"CBC",
|
||||
"MF",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user