新增订单推送

dev-discount
袁野 3 years ago
parent 3791f2279a
commit 852eb1dc53
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  3. 2
      hai-msg/src/main/java/com/msg/config/AuthConfig.java
  4. 31
      hai-msg/src/main/java/com/msg/controller/HighMegController.java
  5. BIN
      hai-msg/target/classes/com/msg/config/AuthConfig.class
  6. BIN
      hai-msg/target/classes/com/msg/controller/HighMegController.class
  7. BIN
      hai-msg/target/hai-msg-1.0-SNAPSHOT.jar
  8. BIN
      hai-msg/target/hai-msg-1.0-SNAPSHOT.jar.original

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -89,7 +89,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/**/api-docs")
.excludePathPatterns("/**/springfox-swagger-ui/**")
.excludePathPatterns("/**/swagger-ui.html")
.excludePathPatterns("/test/*")
.excludePathPatterns("/websocket/*")
;
}

@ -1,22 +1,24 @@
package com.msg.controller;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.model.ResponseData;
import com.hai.service.WebSocket;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping(value = "/test")
@Api(value = "订单接口")
@RequestMapping(value = "/websocket")
@Api(value = "订单推送")
public class HighMegController {
@Autowired
@ -24,16 +26,21 @@ public class HighMegController {
private static Logger log = LoggerFactory.getLogger(HighMegController.class);
@RequestMapping(value = "/websocket", method = RequestMethod.GET)
@RequestMapping(value = "/websocket", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "websocket")
public ResponseData websocket(
@RequestParam(name = "userId", required = true) String userId,
@RequestParam(name = "message", required = true) String message
) {
public ResponseData websocket(@RequestBody JSONObject object) {
try {
webSocket.SenderMessage(userId ,message);
if (StringUtils.isBlank(object.getString("userId")) ||
StringUtils.isBlank(object.getString("message"))
) {
log.error("websocket error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
webSocket.SenderMessage(object.getString("userId") , object.getString("message"));
return ResponseMsgUtil.success("成功");
} catch (Exception e) {

Loading…
Cancel
Save