金马推送URL有非法字符,修改
This commit is contained in:
parent
24da744226
commit
6bcaa85438
@ -15,6 +15,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -64,7 +65,7 @@ public class KingMaForwarder extends Forwarder{
|
||||
boolean updateToken() throws Exception{
|
||||
String jsonLogin = "{\"username\":\""+login_user+"\"," +
|
||||
"\"password\":\""+login_pwd+"\"}";
|
||||
String result = HttpUtils.postJson(login_host, jsonLogin);
|
||||
String result = HttpUtils.postJson(URLEncoder.encode(login_host,"UTF-8"), jsonLogin);
|
||||
if(result == null) return false;
|
||||
|
||||
String token = null;
|
||||
@ -116,14 +117,19 @@ public class KingMaForwarder extends Forwarder{
|
||||
sendNum++;
|
||||
}
|
||||
String json = GsonUtil.toJson(dataList);
|
||||
String result = HttpUtils.postJson(data_host,header,json);
|
||||
logger.info("project " + projectId + ": push calculation result to Kingma");
|
||||
logger.info(json);
|
||||
logger.info("result: "+result);
|
||||
JSONObject obj = (JSONObject) JSONObject.parse(result);
|
||||
String msg = obj.getString("message");
|
||||
if(msg.equals("Success")) return sendNum;
|
||||
else return 0;
|
||||
try {
|
||||
String result = HttpUtils.postJson(URLEncoder.encode(data_host, "UTF-8"), header, json);
|
||||
logger.info("project " + projectId + ": push calculation result to Kingma");
|
||||
logger.info(json);
|
||||
logger.info("result: " + result);
|
||||
JSONObject obj = (JSONObject) JSONObject.parse(result);
|
||||
String msg = obj.getString("message");
|
||||
if (msg.equals("Success")) return sendNum;
|
||||
}
|
||||
catch (Exception e){
|
||||
logger.error(e.toString());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user