|
@@ -56,7 +56,25 @@ public class SalesDetailController {
|
|
|
}
|
|
|
|
|
|
private Result getRemoteSaleHistory(Map<String, String> paramsMap) {
|
|
|
- return null;
|
|
|
+ HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
+ MediaType type = MediaType.parseMediaType("application/json;charset=UTF-8");
|
|
|
+ httpHeaders.setContentType(type);
|
|
|
+// MultiValueMap<String, Object> map=new LinkedMultiValueMap<>();
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
+ map.put("farmCode", paramsMap.get("farmCode"));
|
|
|
+ map.put("months", paramsMap.get("months"));
|
|
|
+// System.out.println("远程调用参数="+map);
|
|
|
+ HttpEntity<Map<String, Object>> objectHttpEntity = new HttpEntity<>(map, httpHeaders);
|
|
|
+ //读取真实数据
|
|
|
+ String remoteUrl = "http://123.60.134.84:10001/breed/api/v1.0.0/sales/getSaleList";
|
|
|
+ ResponseEntity<String> entity = restTemplate.postForEntity(remoteUrl, objectHttpEntity, String.class);
|
|
|
+ System.out.println("body="+entity.getBody());
|
|
|
+ if(entity.getStatusCode().toString().contains("200")){
|
|
|
+ String body = entity.getBody();
|
|
|
+ return new Result(ResultCode.SUCCESS,JSONArray.parseArray(JSON.parseObject(body).getString("data")));
|
|
|
+ }else{
|
|
|
+ return new Result(ResultCode.FAIL,"调取远程数据出错.");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//查询
|