|
|
@@ -1,11 +1,17 @@
|
|
|
package com.nb.admin;
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.nb.app.assistant.delay.UnEvalNotifyConfig;
|
|
|
+import com.nb.app.assistant.delay.UnEvalNotifyDelayMessageHandler;
|
|
|
+import com.nb.app.assistant.listener.AssistPatientInfoListener;
|
|
|
import com.nb.app.doctor.service.LocalAppDoctorUserService;
|
|
|
+import com.nb.common.queue.delay.message.DelayMessage;
|
|
|
+import com.nb.core.SimpleValue;
|
|
|
import com.nb.im.entity.ImMsgEntity;
|
|
|
import com.nb.im.enums.SponsorEnum;
|
|
|
import com.nb.im.event.ImMsgEvent;
|
|
|
import com.nb.im.service.LocalImMsgService;
|
|
|
+import com.nb.web.api.event.PatientInfoEvent;
|
|
|
import com.nb.web.service.bus.job.DeviceFlowStatsJob;
|
|
|
import com.nb.common.config.notice.msg.DiskMsg;
|
|
|
import com.nb.common.config.notice.wechat.EnterpriseWeChatNotify;
|
|
|
@@ -15,6 +21,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.actuate.system.DiskSpaceHealthIndicator;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+import org.tio.core.ChannelContext;
|
|
|
+import org.tio.core.Tio;
|
|
|
+import org.tio.server.ServerTioConfig;
|
|
|
+import org.tio.utils.lock.SetWithLock;
|
|
|
+import org.tio.websocket.starter.TioWebSocketServerBootstrap;
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -31,7 +42,7 @@ public class NotifyTest {
|
|
|
@Autowired(required = false)
|
|
|
EnterpriseWeChatNotify notify;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Autowired(required = false)
|
|
|
DeviceFlowStatsJob flowStatsJob;
|
|
|
|
|
|
@Autowired
|
|
|
@@ -40,8 +51,28 @@ public class NotifyTest {
|
|
|
@Autowired
|
|
|
LocalAppDoctorUserService appDoctorUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ AssistPatientInfoListener patientInfoListener;
|
|
|
+
|
|
|
@Autowired
|
|
|
LocalImMsgService imMsgService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ UnEvalNotifyDelayMessageHandler messageHandler;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TioWebSocketServerBootstrap serverBootstrap;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void unEval(){
|
|
|
+ String json="{\"msgId\":\"38889af7-84bf-4bf3-b49c-7da6a9a58e35\",\"body\":{\"nativeValue\":{\"clinicId\":\"1596397025410744323\",\"patientId\":\"1596397025410744322\",\"assistId\":\"1585920194379317249\"}},\"handlerId\":\"unEval\",\"properties\":{\"expire\":24,\"timeUnit\":\"HOURS\"}}";
|
|
|
+ String body="{\"clinicId\":\"1596397025410744323\",\"patientId\":\"1596397025410744322\",\"assistId\":\"1585920194379317249\"}" +
|
|
|
+ "";
|
|
|
+
|
|
|
+ DelayMessage delayMessage = JSONUtil.toBean(json, DelayMessage.class);
|
|
|
+ delayMessage.setBody(SimpleValue.of(JSONUtil.toBean(body, UnEvalNotifyConfig.class)));
|
|
|
+ messageHandler.handle(delayMessage);
|
|
|
+ }
|
|
|
@Test
|
|
|
public void autoApply(){
|
|
|
ImMsgEntity byId = imMsgService.getById("1580015983344975874");
|
|
|
@@ -52,6 +83,19 @@ public class NotifyTest {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void assistPatientInfoChange(){
|
|
|
+ PatientInfoEvent patientInfoEvent = new PatientInfoEvent(this, "1567321213870600194","321000000");
|
|
|
+ patientInfoEvent.setPatientName("测试");
|
|
|
+ patientInfoListener.patientInfoAssist(patientInfoEvent);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void wsOnline(){
|
|
|
+ SetWithLock<ChannelContext> byUserid = Tio.getByUserid(serverBootstrap.getServerTioConfig(), "1q23");
|
|
|
+ System.out.println(byUserid);
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void test(){
|
|
|
flowStatsJob.flowStats();
|