@Resource
private CopyWriteUI copyWriteUI;
@Resource
private I18nMessageUI i18nMessageUI;
@Resource
private RestTemplate restTemplate;
@Override
public IResult callPolice(String imei, String onOff) {
String url = copyWriteUI.getSocketUrl() + APITable.CALL_POLICE_WATCH
.replace("{imei}", imei)
.replace("{onOff}", onOff);
IResult result = restTemplate.patchForObject(url, null, Result.class);
if (null == result) {
return CommonTools.errorResult(ResultMessage.ERROR_PROMPT, i18nMessageUI.getNetworkAnomaly());
}
if (result.isSuccessful()) {
return CommonTools.successResult(ResultMessage.STATUS_SUCCESS);
}
return CommonTools.errorResult(ResultMessage.ERROR_PROMPT, i18nMessageUI.getNetworkAnomaly());
}
@Override
public IResult setWatchStepTime(String imei, String times) {
String url = copyWriteUI.getSocketUrl() + APITable.SET_WATCH_STEP_TIME.replace("{imei}", imei);
MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<>();
multiValueMap.add("times", times);
IResult result = restTemplate.postForObject(url, multiValueMap, Result.class);
if (null == result) {
return CommonTools.errorResult(ResultMessage.ERROR_PROMPT, i18nMessageUI.getNetworkAnomaly());
}
if (result.isSuccessful()) {
return CommonTools.successResult(ResultMessage.STATUS_SUCCESS);
}
return CommonTools.errorResult(ResultMessage.ERROR_PROMPT, i18nMessageUI.getNetworkAnomaly());
}