客户端日志上传、前端增加按钮处理

This commit is contained in:
2023-12-13 21:16:20 +08:00
parent 650a835f42
commit e733c442a3
5 changed files with 52 additions and 0 deletions

View File

@@ -214,6 +214,23 @@ public class DeviceService extends BaseServiceImpl {
}
}
public void uploadLog(Integer deviceId){
try {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null,headers);
ResponseDTO responseDTO = null;
responseDTO = restTemplate.postForObject("http://127.0.0.1:8093/uplaod/log/"+deviceId, request, ResponseDTO.class);
Integer code = (Integer) responseDTO.get(ResponseDTO.ERR_CODE);
if(0 != code){
throw new OmsException("上传日志失败,设备离线或者门禁异常!");
}
}catch (Exception e){
logger.error("设备离线或者门禁异常",e);
throw new OmsException("上传日志失败,设备离线或者门禁异常!");
}
}
/**
* find by DeviceName
*/