|
@@ -31,19 +31,20 @@ public class ApiServiceLocalTestController {
|
|
|
@Autowired
|
|
|
private RestTemplate restTemplate;
|
|
|
|
|
|
- private static final String PREFIX = "http://115.238.57.190:8020/pig/";
|
|
|
+ @Value("${local.test.url}")
|
|
|
+ private String prefix;
|
|
|
|
|
|
@Value("${local.token}")
|
|
|
private String accessToken;
|
|
|
|
|
|
@RequestMapping("/testGetPigInfo")
|
|
|
public R testGetPigInfo(@NotBlank(message = "耳标号不能为空!") @RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
- return restTemplate.getForObject(PREFIX + "getPigInfo?accessToken=" + accessToken + "&pigEarTagNo=" + pigEarTagNo, R.class);
|
|
|
+ return restTemplate.getForObject(prefix + "getPigInfo?accessToken=" + accessToken + "&pigEarTagNo=" + pigEarTagNo, R.class);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/testGetImage")
|
|
|
public R testGetImage(@NotBlank(message = "耳标号不能为空!") @RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
- return restTemplate.getForObject(PREFIX + "getImage?accessToken=" + accessToken + "&pigEarTagNo=" + pigEarTagNo, R.class);
|
|
|
+ return restTemplate.getForObject(prefix + "getImage?accessToken=" + accessToken + "&pigEarTagNo=" + pigEarTagNo, R.class);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/testGetListByBreed")
|
|
@@ -51,7 +52,7 @@ public class ApiServiceLocalTestController {
|
|
|
@RequestParam(value = "currentPage", defaultValue = "1") Integer currentPage,
|
|
|
@Range(min = 1, max = 1000, message = "每页条数的范围为1-1000") @RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize,
|
|
|
@RequestParam(value = "period", required = false) String period) {
|
|
|
- String url = PREFIX + "getListByBreed?accessToken=" + accessToken + "&breedName=" + breedName + "¤tPage=" + currentPage + "&pageSize=" + pageSize;
|
|
|
+ String url = prefix + "getListByBreed?accessToken=" + accessToken + "&breedName=" + breedName + "¤tPage=" + currentPage + "&pageSize=" + pageSize;
|
|
|
if (StringUtils.isNotEmpty(period)) {
|
|
|
url = url + "&period=" + period;
|
|
|
}
|
|
@@ -60,17 +61,17 @@ public class ApiServiceLocalTestController {
|
|
|
|
|
|
@RequestMapping("/testGetIndoorEnv")
|
|
|
public R testGetIndoorEnv(@NotBlank(message = "耳标号不能为空!") @RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
- return restTemplate.getForObject(PREFIX + "getIndoorEnv?accessToken=" + accessToken + "&pigEarTagNo=" + pigEarTagNo, R.class);
|
|
|
+ return restTemplate.getForObject(prefix + "getIndoorEnv?accessToken=" + accessToken + "&pigEarTagNo=" + pigEarTagNo, R.class);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/testAdopt")
|
|
|
public R testAdopt(@NotBlank(message = "耳标号不能为空!") @RequestParam("pigEarTagNo") String pigEarTagNo) {
|
|
|
- return restTemplate.getForObject(PREFIX + "adopt?accessToken=" + accessToken + "&pigEarTagNo=" + pigEarTagNo, R.class);
|
|
|
+ return restTemplate.getForObject(prefix + "adopt?accessToken=" + accessToken + "&pigEarTagNo=" + pigEarTagNo, R.class);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/testOutFence")
|
|
|
public R testOutFence(@NotBlank(message = "耳标号不能为空!") @RequestParam("pigEarTagNo") String pigEarTagNo,
|
|
|
@NotNull(message = "出栏状态不能为空!") @ListValue(vals = {1, 2, 3}) @RequestParam("status") Integer status) {
|
|
|
- return restTemplate.getForObject(PREFIX + "outFence?accessToken=" + accessToken + "&pigEarTagNo=" + pigEarTagNo + "&status=" + status, R.class);
|
|
|
+ return restTemplate.getForObject(prefix + "outFence?accessToken=" + accessToken + "&pigEarTagNo=" + pigEarTagNo + "&status=" + status, R.class);
|
|
|
}
|
|
|
}
|