1.添加安全登录功能
2.调整部分接口
This commit is contained in:
@@ -6,6 +6,7 @@ import com.njcn.roma.pojo.UpSendPojo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
@@ -78,32 +79,63 @@ public class SendCommandController {
|
||||
} catch (IOException e) {
|
||||
System.out.println("IOException---------------------------");
|
||||
e.printStackTrace();
|
||||
return "执行异常";
|
||||
return e.getMessage();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
System.out.println("NoSuchAlgorithmException---------------------------");
|
||||
e.printStackTrace();
|
||||
return "执行异常";
|
||||
return e.getMessage();
|
||||
} catch (KeyStoreException e) {
|
||||
System.out.println("KeyStoreException---------------------------");
|
||||
e.printStackTrace();
|
||||
return "执行异常";
|
||||
return e.getMessage();
|
||||
} catch (KeyManagementException e) {
|
||||
System.out.println("KeyManagementException---------------------------");
|
||||
e.printStackTrace();
|
||||
return "执行异常";
|
||||
return e.getMessage();
|
||||
}catch (Exception e){
|
||||
System.out.println("Exception---------------------------");
|
||||
e.printStackTrace();
|
||||
return "执行异常";
|
||||
return e.getMessage();
|
||||
}
|
||||
return "执行成功";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("test")
|
||||
public String test(){
|
||||
return "6666";
|
||||
|
||||
|
||||
|
||||
@GetMapping("queryService")
|
||||
public String test(@RequestParam(value = "deviceId",defaultValue = "D2899233167kupZT")String deviceId){
|
||||
//String url = "https://" + sendIp + "/iot/1.0/deviceCommands?appId=" + appId;
|
||||
|
||||
String url = "https://" + sendIp + "/iot/1.0/services?appId=" + appId+"&deviceId="+deviceId;
|
||||
HttpGet httpGet = new HttpGet(url); //创建post请求
|
||||
setSSLHeader(httpGet); //设置请求的header
|
||||
try {
|
||||
org.apache.http.HttpEntity responseEntity = getSSLResponse(httpGet);//获取响应结果
|
||||
return EntityUtils.toString(responseEntity);
|
||||
} catch (IOException e) {
|
||||
System.out.println("IOException---------------------------");
|
||||
e.printStackTrace();
|
||||
return e.getMessage();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
System.out.println("NoSuchAlgorithmException---------------------------");
|
||||
e.printStackTrace();
|
||||
return e.getMessage();
|
||||
} catch (KeyStoreException e) {
|
||||
System.out.println("KeyStoreException---------------------------");
|
||||
e.printStackTrace();
|
||||
return e.getMessage();
|
||||
} catch (KeyManagementException e) {
|
||||
System.out.println("KeyManagementException---------------------------");
|
||||
e.printStackTrace();
|
||||
return e.getMessage();
|
||||
}catch (Exception e){
|
||||
System.out.println("Exception---------------------------");
|
||||
e.printStackTrace();
|
||||
return e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user