|
@@ -3,13 +3,14 @@ package com.usoftchina.smartschool.device.biometric;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import com.usoftchina.smartschool.device.context.SpringContextHolder;
|
|
import com.usoftchina.smartschool.device.context.SpringContextHolder;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
-import java.time.LocalDateTime;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author yingp
|
|
* @author yingp
|
|
@@ -19,6 +20,8 @@ import java.time.LocalDateTime;
|
|
|
@RequestMapping("/DeviceManageService")
|
|
@RequestMapping("/DeviceManageService")
|
|
|
public class DeviceManageController {
|
|
public class DeviceManageController {
|
|
|
|
|
|
|
|
|
|
+ private final Logger logger = LoggerFactory.getLogger(DeviceManageController.class);
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 接收心跳
|
|
* 接收心跳
|
|
|
*
|
|
*
|
|
@@ -28,14 +31,14 @@ public class DeviceManageController {
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/ACSServer")
|
|
@PostMapping("/ACSServer")
|
|
|
@Deprecated
|
|
@Deprecated
|
|
|
- public ResultPo deviceHeart(HttpServletRequest request) throws IOException {
|
|
|
|
|
- System.out.println(LocalDateTime.now() + " ACSServer " + request.getReader().readLine());
|
|
|
|
|
|
|
+ public ResultPo deviceHeartbeat(HttpServletRequest request) throws IOException {
|
|
|
String body = request.getReader().readLine();
|
|
String body = request.getReader().readLine();
|
|
|
|
|
+ logger.debug(body);
|
|
|
if (null != body && body.startsWith("{")) {
|
|
if (null != body && body.startsWith("{")) {
|
|
|
RequestPo<HealthInfo> req = JSON.parseObject(body, new TypeReference<RequestPo<HealthInfo>>() {
|
|
RequestPo<HealthInfo> req = JSON.parseObject(body, new TypeReference<RequestPo<HealthInfo>>() {
|
|
|
});
|
|
});
|
|
|
SpringContextHolder.getContext().publishEvent(new HeartbeatEvent(req.getResponseBody().getDeviceCode(), this));
|
|
SpringContextHolder.getContext().publishEvent(new HeartbeatEvent(req.getResponseBody().getDeviceCode(), this));
|
|
|
}
|
|
}
|
|
|
- return ResultPo.success().setHoldRequests("0");
|
|
|
|
|
|
|
+ return ResultPo.success();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|