Sfoglia il codice sorgente

发送保存面谈笔录事件

humuyu 2 anni fa
parent
commit
c3579c61e4

+ 5 - 2
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/NotaryNoteController.java

@@ -7,6 +7,8 @@ import me.zhengjie.annotation.rest.AnonymousGetMapping;
 import me.zhengjie.application.admin.controller.vo.NotaryNoteVo;
 import me.zhengjie.application.admin.service.NotaryNoteService;
 import me.zhengjie.base.AppBaseResponse;
+import me.zhengjie.base.websocket.AppPcBindSocketIo;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -18,7 +20,8 @@ import javax.validation.Valid;
 public class NotaryNoteController {
 	@Autowired
 	NotaryNoteService notaryNoteService;
-
+	@Autowired
+	AppPcBindSocketIo appPcBindSocketIo;
 	/**
 	 * 查询面谈笔录
 	 *
@@ -40,7 +43,7 @@ public class NotaryNoteController {
 	@PostMapping("/save")
 	public AppBaseResponse<?> save(@Valid @RequestBody NotaryNoteVo notary) {
 		AppBaseResponse<?> result = notaryNoteService.saveNotaryNote(notary);
-		
+		appPcBindSocketIo.sendAppEvent(notary.getBusinessNo(), "saveNote", "saveNote");
 		return result;
 	}
 

+ 8 - 1
eladmin-system/src/main/java/me/zhengjie/base/websocket/AppPcBindSocketIo.java

@@ -106,7 +106,14 @@ public class AppPcBindSocketIo {
 			});
 		}
 	}
-
+	public void sendAppEvent(String businessNo,String eventName,String eventVal) {
+		HashMap<UUID, SocketIOClient> appSocketIo = AppSocketClientCache.getAppUserClient(businessNo);
+		if (MapUtils.isNotEmpty(appSocketIo)) {
+			appSocketIo.forEach((uuid, socketIOClient) -> {
+				socketIOClient.sendEvent(eventName,eventVal);
+			});
+		}
+	}
 	public void removeNotary(String businessNo, String username) {
 		if (StringUtils.isBlank(businessNo)) {
 			return;