DataController.java
836 Bytes
package com.viontech.controller;
import com.viontech.model.BaseModel;
import com.viontech.netty.ChannelGroup;
import com.viontech.process.Process;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.sound.sampled.Line;
/**
* .
*
* @author 谢明辉
* @date 2020/8/18
*/
@RestController
@Slf4j
public class DataController {
@PostMapping("/data")
public Object receiveData(@RequestBody String dataStr) throws Exception {
log.info("收到一条繁星发来的消息");
BaseModel data = Process.process(dataStr);
if (data != null) {
ChannelGroup.broadcast(data);
}
return "success";
}
}