|
@@ -15,6 +15,7 @@ import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.messaging.handler.annotation.MessageMapping;
|
|
import org.springframework.messaging.handler.annotation.MessageMapping;
|
|
import org.springframework.messaging.handler.annotation.SendTo;
|
|
import org.springframework.messaging.handler.annotation.SendTo;
|
|
|
|
+import org.springframework.messaging.simp.SimpMessagingTemplate;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -36,6 +37,8 @@ public class SoundController extends BaseController {
|
|
private SoundService soundService;
|
|
private SoundService soundService;
|
|
@Autowired
|
|
@Autowired
|
|
private SysUserFeignService sysUserFeignService;
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SimpMessagingTemplate template;
|
|
|
|
|
|
@ApiOperation(value = "评分")
|
|
@ApiOperation(value = "评分")
|
|
@PostMapping("compare")
|
|
@PostMapping("compare")
|
|
@@ -53,7 +56,7 @@ public class SoundController extends BaseController {
|
|
return soundService.measureCompare(musicXmlInfoList, record);
|
|
return soundService.measureCompare(musicXmlInfoList, record);
|
|
}
|
|
}
|
|
|
|
|
|
- @MessageMapping("/hello")
|
|
|
|
|
|
+ @MessageMapping("/soundDate")
|
|
@SendTo("/topic/greetings")
|
|
@SendTo("/topic/greetings")
|
|
public String greeting(String message){
|
|
public String greeting(String message){
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
@@ -64,4 +67,10 @@ public class SoundController extends BaseController {
|
|
return message;
|
|
return message;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @RequestMapping("sendToUser")
|
|
|
|
+ public HttpResponseResult sendToUser(String phone, String message){
|
|
|
|
+ template.convertAndSendToUser(StringUtils.joinWith(":", "username", phone), "/topic/greetings", message);
|
|
|
|
+ return succeed();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|