diff --git a/business/jxstore/cms/api_print.go b/business/jxstore/cms/api_print.go index a4c3b8a8e..797c63e4e 100644 --- a/business/jxstore/cms/api_print.go +++ b/business/jxstore/cms/api_print.go @@ -383,6 +383,15 @@ func DoPrintMsg(appID int, msgID, printNo, content string, orderNo string) (err t, ok := event.PrintObject[printNo] if ok { + t.Lock() + defer t.Unlock() + t.MsgMap[printNo] <- printMsg + printMsg.Status = event.PrintMsgAlreadyLoad + } else { + t = event.NewTcpClient() + event.BuildAllMap(t, printNo) + event.PrintObject[printNo] = t + t.Lock() defer t.Unlock() t.MsgMap[printNo] <- printMsg diff --git a/business/jxstore/event/event_tcp_utils.go b/business/jxstore/event/event_tcp_utils.go index 4f32198b3..7cbce3942 100644 --- a/business/jxstore/event/event_tcp_utils.go +++ b/business/jxstore/event/event_tcp_utils.go @@ -202,6 +202,10 @@ func buildAllMap(t *TcpClient, key string) { t.TimeoutMap[key] = true } +func BuildAllMap(t *TcpClient, key string) { + buildAllMap(t, key) +} + func (t *TcpClient) getPrintStatus(key string) int { t.RLock() defer t.RUnlock()