chenken 6 лет назад
Родитель
Сommit
7657a1c182

+ 19 - 0
examcloud-core-oe-websocket-api-client/pom.xml

@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <parent>
+	<groupId>cn.com.qmth.examcloud.rmi</groupId>
+	<artifactId>examcloud-rmi</artifactId>
+	<version>2.0-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>examcloud-core-oe-websocket-api-client</artifactId>
+  
+  <dependencies>
+        <dependency>
+            <groupId>cn.com.qmth.examcloud.rmi</groupId>
+            <artifactId>examcloud-core-oe-websocket-api</artifactId>
+            <version>${examcloud.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 16 - 0
examcloud-core-oe-websocket-api-client/src/main/java/cn/com/qmth/examcloud/core/oe/websocket/api/client/BasicCloudClientSupport.java

@@ -0,0 +1,16 @@
+package cn.com.qmth.examcloud.core.oe.websocket.api.client;
+
+import cn.com.qmth.examcloud.commons.web.support.CloudClientSupport;
+
+/**
+ * @author WANGWEI
+ *
+ */
+public abstract class BasicCloudClientSupport extends CloudClientSupport {
+
+	@Override
+	public String getUrlPrefix() {
+		return "http://EC_CORE_OE_WEBSOCKET/api/oe/websocket/";
+	}
+
+}

+ 41 - 0
examcloud-core-oe-websocket-api-client/src/main/java/cn/com/qmth/examcloud/core/oe/websocket/api/client/WebsocketCloudServiceClient.java

@@ -0,0 +1,41 @@
+package cn.com.qmth.examcloud.core.oe.websocket.api.client;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import cn.com.qmth.examcloud.commons.web.redis.RedisClient;
+import cn.com.qmth.examcloud.core.oe.websocket.api.WebsocketCloudService;
+import cn.com.qmth.examcloud.core.oe.websocket.api.request.SendMessageReq;
+
+
+@Service("websocketCloudService")
+public class WebsocketCloudServiceClient extends BasicCloudClientSupport implements WebsocketCloudService{
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -183204183805080432L;
+
+	@Autowired
+    private RestTemplate restTemplate;
+	
+    @Autowired
+    private RedisClient redisClient;
+	
+	@Override
+	protected RestTemplate getRestTemplate() {
+		return restTemplate;
+	}
+
+	@Override
+	protected RedisClient getRedisClient() {
+		return redisClient;
+	}
+
+	@Override
+	public void sendMessage(SendMessageReq sendMessageReq) {
+		post("sendMessage",sendMessageReq,null);
+	}
+
+}

+ 19 - 0
examcloud-core-oe-websocket-api/pom.xml

@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <parent>
+		<groupId>cn.com.qmth.examcloud.rmi</groupId>
+		<artifactId>examcloud-rmi</artifactId>
+		<version>2.0-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>examcloud-core-oe-websocket-api</artifactId>
+  
+  <dependencies>
+		<dependency>
+			<groupId>cn.com.qmth.examcloud.commons</groupId>
+			<artifactId>examcloud-commons-web</artifactId>
+			<version>${examcloud.version}</version>
+		</dependency>
+	</dependencies>
+</project>

+ 11 - 0
examcloud-core-oe-websocket-api/src/main/java/cn/com/qmth/examcloud/core/oe/websocket/api/WebsocketCloudService.java

@@ -0,0 +1,11 @@
+package cn.com.qmth.examcloud.core.oe.websocket.api;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.CloudService;
+import cn.com.qmth.examcloud.core.oe.websocket.api.request.SendMessageReq;
+
+
+public interface WebsocketCloudService extends CloudService{
+
+	public void sendMessage(SendMessageReq sendMessageReq);
+	
+}

+ 32 - 0
examcloud-core-oe-websocket-api/src/main/java/cn/com/qmth/examcloud/core/oe/websocket/api/request/SendMessageReq.java

@@ -0,0 +1,32 @@
+package cn.com.qmth.examcloud.core.oe.websocket.api.request;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.BaseRequest;
+
+public class SendMessageReq extends BaseRequest{
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 3147167204808636817L;
+
+	private Long id;
+	
+	private String json;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getJson() {
+		return json;
+	}
+
+	public void setJson(String json) {
+		this.json = json;
+	}
+	
+}

+ 3 - 0
pom.xml

@@ -35,6 +35,9 @@
         
         <module>examcloud-core-oe-student-api</module>
         <module>examcloud-core-oe-student-api-client</module>
+        
+        <module>examcloud-core-oe-websocket-api</module>
+        <module>examcloud-core-oe-websocket-api-client</module>
     </modules>
 
 </project>