提交代码
parent
5f6a91007c
commit
3e15ecfb58
|
@ -10,5 +10,5 @@ public class ApiConstants {
|
|||
/**
|
||||
* IOT配电箱数据获取HOST&&萨达
|
||||
*/
|
||||
public static final String IOT_SD_HOST = "https://api.e.v1.i-sada.net";
|
||||
public static final String IOT_SD_HOST = "http://api.e.v1.i-sada.net";
|
||||
}
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
package com.ruoyi.common.utils.http;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
@ -189,6 +184,59 @@ public class HttpUtils
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
* @param reqUrl 发送请求的 URL
|
||||
* @param reqJson 请求参数,请求参数应该是 JSON 的形式。
|
||||
* @param headerMap 请求头部,头部参数应该是 MAPS 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendJSONPost(String reqUrl, String reqJson, Map<String, String> headerMap) throws IOException {
|
||||
// 创建URL对象
|
||||
URL url = new URL(reqUrl);
|
||||
|
||||
// 打开连接
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
// 设置请求方法为POST
|
||||
connection.setRequestMethod("POST");
|
||||
|
||||
// headers不为空,设置请求头
|
||||
if (headerMap != null) {
|
||||
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
||||
connection.setRequestProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// 允许输入输出流
|
||||
connection.setDoOutput(true);
|
||||
connection.setDoInput(true);
|
||||
// 设置请求头
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setRequestProperty("Accept", "application/json");
|
||||
|
||||
// 发送JSON数据
|
||||
try (OutputStream os = connection.getOutputStream()) {
|
||||
byte[] input = reqJson.getBytes("utf-8");
|
||||
os.write(input, 0, input.length);
|
||||
}
|
||||
|
||||
// 获取响应代码
|
||||
int responseCode = connection.getResponseCode();
|
||||
// 获取响应实体
|
||||
StringBuilder responseBody = new StringBuilder();
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"))) {
|
||||
String inputLine;
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
responseBody.append(inputLine);
|
||||
}
|
||||
}
|
||||
// 关闭连接
|
||||
connection.disconnect();
|
||||
// 返回响应结果
|
||||
return responseBody.toString();
|
||||
}
|
||||
|
||||
public static String sendSSLPost(String url, String param)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
|
|
@ -184,6 +184,7 @@ public class SadaHzDataTask {
|
|||
params.put("username",signalName);
|
||||
params.put("password",signalCode);
|
||||
String resStr = HttpUtils.sendPost(ApiConstants.IOT_SD_HOST+"/v2/api-token-auth", JSON.toJSONString(params));
|
||||
System.out.println(resStr);
|
||||
JSONObject result = JSONObject.parseObject(resStr).getJSONObject("result");
|
||||
JSONObject accountJson = result.getJSONObject("account");
|
||||
if(StringUtils.isNotEmpty(accountJson.getString("canViewProjects"))){
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.8 MiB |
|
@ -144,7 +144,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!--监理单位/总包公司/分包单位-->
|
||||
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> left join sur_project_unit_info spui on spui.projectId = sp.id and spui.del_flag=0</if>
|
||||
<where>
|
||||
and ssp.isDel=0
|
||||
<if test="projectId != null "> and ssp.projectId = #{projectId}</if>
|
||||
<if test="infoType != null "> and ssp.infoType = #{infoType}</if>
|
||||
<if test="problemType != null "> and ssp.problemType = #{problemType}</if>
|
||||
|
@ -186,8 +185,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test='activeName == "fj"'> and ssp.checkState = 1 </if>
|
||||
<if test='activeName == "ycl"'> and ssp.checkState = 4 </if>
|
||||
<if test='activeName == "zgcs"'> and (date(NOW())<![CDATA[ > ]]> date(ssp.nickedTime) and (ssp.updateTime is null or date(ssp.updateTime) <![CDATA[ > ]]> date(ssp.nickedTime))) </if>
|
||||
and ssp.isDel=0
|
||||
</where>
|
||||
order by sort,ssp.createTime desc
|
||||
<if test="activeName != null ">
|
||||
<if test='activeName == "dzg"'> order by sort,ssp.id desc</if>
|
||||
<if test='activeName != "dzg"'> order by ssp.id desc </if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="findGroupCountByProjectId" parameterType="SmzSspProblemmodify" resultType="map">
|
||||
|
|
Loading…
Reference in New Issue