Commit 82414d64 authored by linruibiao's avatar linruibiao

接口编写

parent fd40ee3b
......@@ -61,15 +61,15 @@ public class VariableController extends BaseRestController{
Map<String,String> heads = Maps.newHashMap();
heads.put("token","345aa488a820448dbb069ea4295d2b15");
R<List<PanelTreeNodeVo>> newR = new R<>();
ResponseEntity<Map> rest = RestTemplateUtils.get(
"http://localhost:2400/dc/{appId}/equipment/info/name/pull?token={token}&equipment_info_id={equipment_info_id}&customer_id={customer_id}&q_name={q_name}&search_code={search_code}&search_model={search_model}&warranty_status={warranty_status}&page_num={page_num}&page_size={page_size}",
heads,
Map.class,
maps);
if (rest != null){
return rest.getBody();
}
//
// ResponseEntity<Map> rest = RestTemplateUtils.get(
// "http://localhost:2400/dc/{appId}/equipment/info/name/pull?token={token}&equipment_info_id={equipment_info_id}&customer_id={customer_id}&q_name={q_name}&search_code={search_code}&search_model={search_model}&warranty_status={warranty_status}&page_num={page_num}&page_size={page_size}",
// heads,
// Map.class,
// maps);
// if (rest != null){
// return rest.getBody();
// }
return null;
}
......
......@@ -106,11 +106,10 @@ public class BusinessConfigServiceImpl extends ServiceImpl<BusinessConfigMapper,
}
});
});
Map<String, String> heads = Maps.newHashMap();
heads.put("X-Token", user.getToken());
Map<String, String> uriVariables = Maps.newHashMap();
uriVariables.put("appId", user.getAppId());
R<List<Map<String, Object>>> result = RestTemplateUtils.post(uri, heads,dto, new TypeToken<R<List<Map<String, Object>>>>() {}.getType(), uriVariables);
R<List<Map<String, Object>>> result = RestTemplateUtils.post(uri, null,dto, new TypeToken<R<List<Map<String, Object>>>>() {}.getType(), uriVariables);
return result.detach();
}
......@@ -131,7 +130,11 @@ public class BusinessConfigServiceImpl extends ServiceImpl<BusinessConfigMapper,
uriVariables.put("size", size);
uriVariables.put("name", name);
IPage<String> page = new Page<>(current,size);
R<Map<String,Object>> result = RestTemplateUtils.get(uri, new TypeToken<R<Map<String,Object>>>() {}.getType(), uriVariables);
R<Map<String,Object>> result = RestTemplateUtils.get(uri,()->{
Map<String, String> header = Maps.newHashMap();
header.put("X-Token", currentUser.getToken());
return header;
}, new TypeToken<R<Map<String,Object>>>() {}.getType(), uriVariables);
Map<String, Object> resultMaps = result.detach();
if(CollectionUtils.isNotEmpty(resultMaps)){
page.setTotal(new BigDecimal(resultMaps.get("total")+"").longValue());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment