|
@@ -1,6 +1,7 @@
|
|
|
package thyyxxk.webserver.http.websocket;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.Header;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.json.JSONObject;
|
|
@@ -12,6 +13,7 @@ import thyyxxk.webserver.config.envionment.Other;
|
|
|
import thyyxxk.webserver.constants.Message;
|
|
|
import thyyxxk.webserver.http.websocket.dto.*;
|
|
|
import thyyxxk.webserver.utils.SocketMsg;
|
|
|
+import thyyxxk.webserver.utils.ValidatorUtils;
|
|
|
|
|
|
import javax.validation.ConstraintViolation;
|
|
|
import javax.validation.Validation;
|
|
@@ -24,6 +26,7 @@ import java.util.Set;
|
|
|
@RequiredArgsConstructor
|
|
|
public class SocketV2 {
|
|
|
private final Other other;
|
|
|
+ private final ValidatorUtils validatorUtils;
|
|
|
|
|
|
public HttpRequest getPostApi(String business) {
|
|
|
return HttpRequest.post(other.getSocketV2Url() + "/send" + business)
|
|
@@ -59,10 +62,7 @@ public class SocketV2 {
|
|
|
}
|
|
|
|
|
|
public void sendTask(SocketTask task) {
|
|
|
- ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
|
|
|
- Set<ConstraintViolation<SocketTask>> validate = vf.getValidator().validate(task);
|
|
|
-
|
|
|
-
|
|
|
+ validatorUtils.validate(task);
|
|
|
|
|
|
JSONObject js = new JSONObject();
|
|
|
js.set("mode", "SINGLE");
|