|
|
@@ -141,10 +141,10 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String testRun(PtService ptService) {
|
|
|
+ public String testRun(PtService ptService) throws IOException {
|
|
|
|
|
|
|
|
|
- String tokenUrl = "http://localhost:9002/sh-api/login";
|
|
|
+ /* String tokenUrl = "http://localhost:9002/sh-api/login";
|
|
|
String bodyPar = "{\n" +
|
|
|
" \"username\": \"admin\",\n" +
|
|
|
" \"password\": \"Gw#$1601\"\n" +
|
|
|
@@ -158,18 +158,20 @@ public class PtServiceServiceImpl extends ServiceImpl<PtServiceMapper, PtService
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
HashMap hashMap = JsonUtils.jsonToPojo(token, HashMap.class);
|
|
|
- String token1 = hashMap.get("token").toString();
|
|
|
- System.out.println(token1);
|
|
|
- HashMap<String, String> map = new HashMap<>();
|
|
|
- map.put("authorization",token1);
|
|
|
+ String token1 = hashMap.get("token").toString();*/
|
|
|
+ HashMap<String, String> headers = new HashMap<>();
|
|
|
//List<PtServiceParam> ptServiceParams = ptServiceParamMapper.selectAll(ptService.getSrvId());
|
|
|
//String paramString = ptServiceParams.stream().map(p -> p.getParamCode() + "=" + p.getParamValue()).collect(Collectors.joining());
|
|
|
- String paramString = "pageNum=1&pageSize=20";
|
|
|
+ List<PtServiceParam> params = ptService.getParams();
|
|
|
switch (ptService.getRqtype()) {
|
|
|
case "POST":
|
|
|
- return HttpUtils.sendPost(ptService.getUrl(),paramString);
|
|
|
+ HashMap<String, Object> parMap = new HashMap<>();
|
|
|
+ for (PtServiceParam param : params) {
|
|
|
+ parMap.put(param.getParamCode(),param.getParamObject());
|
|
|
+ }
|
|
|
+ return HttpUtils.sendBodyPost(ptService.getUrl(),parMap,headers);
|
|
|
case "GET":
|
|
|
- return HttpUtils.sendGet(ptService.getUrl(),paramString,map);
|
|
|
+ return HttpUtils.sendGet(ptService.getUrl(),"",headers);
|
|
|
}
|
|
|
return null;
|
|
|
}
|