|
@@ -587,14 +587,24 @@ public class RestUtil {
|
|
|
if (time_to.getTime() - time_from.getTime() < 1000L * 60 * 60 * 6) {
|
|
|
time_from = new Date(time_from.getTime() - (1000L * 60 * 60 * 12));
|
|
|
}
|
|
|
- JSONObject parseObject = JSON.parseObject(param);
|
|
|
- String objId = parseObject.getString("objId");
|
|
|
- String code = parseObject.getString("code");
|
|
|
- String pointString = RepositoryBase.info2point.get(objId).get(code);
|
|
|
- int index_ = pointString.lastIndexOf('-');
|
|
|
- String meter = pointString.substring(0, index_);
|
|
|
- int funcid = Integer.parseInt(pointString.substring(index_ + 1));
|
|
|
- String result = fjd_query_history(meter, funcid, sdf.format(time_from), sdf.format(time_to));
|
|
|
+ String result;
|
|
|
+ try {
|
|
|
+ JSONObject parseObject = JSON.parseObject(param);
|
|
|
+ String objId = parseObject.getString("objId");
|
|
|
+ String code = parseObject.getString("code");
|
|
|
+ String pointString = RepositoryBase.info2point.get(objId).get(code);
|
|
|
+ int index_ = pointString.lastIndexOf('-');
|
|
|
+ String meter = pointString.substring(0, index_);
|
|
|
+ int funcid = Integer.parseInt(pointString.substring(index_ + 1));
|
|
|
+ result = fjd_query_history(meter, funcid, sdf.format(time_from), sdf.format(time_to));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ JSONObject tmpResult = new JSONObject();
|
|
|
+ tmpResult.put("Result", "failure");
|
|
|
+ tmpResult.put("ResultMsg", LogUtil.GetExceptionStackTrace(e));
|
|
|
+ tmpResult.put("ResultCode", 250);
|
|
|
+ result = tmpResult.toJSONString();
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|