|
@@ -10,6 +10,10 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import org.springframework.core.io.FileSystemResource;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -33,6 +37,7 @@ import com.persagy.ibms.data.sdk.util.Constant;
|
|
|
import com.persagy.ibms.data.sdk.util.ControlUtil;
|
|
|
import com.persagy.ibms.data.sdk.util.DrawUtil;
|
|
|
import com.persagy.ibms.data.sdk.util.ExeclReadEquipStaticInfoUtil;
|
|
|
+import com.persagy.ibms.data.sdk.util.ExportUtil;
|
|
|
import com.persagy.ibms.data.sdk.util.HttpClientUtil;
|
|
|
import com.persagy.ibms.data.sdk.util.RWDAlarmUtil;
|
|
|
import com.persagy.ibms.data.sdk.util.RepositoryContainer;
|
|
@@ -507,26 +512,8 @@ public class RestUtil {
|
|
|
public static String fjd_query_history_batch(String param) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
try {
|
|
|
- RepositoryImpl Repository = RepositoryContainer.instance;
|
|
|
JSONArray parseArray = JSON.parseArray(param);
|
|
|
- for (int i = 0; i < parseArray.size(); i++) {
|
|
|
- JSONObject parseObject = parseArray.getJSONObject(i);
|
|
|
- String objId = parseObject.getString("objId");
|
|
|
- String code = parseObject.getString("code");
|
|
|
- String pointString = Repository.info2point.get(objId).get(code);
|
|
|
- int index_ = pointString.lastIndexOf('-');
|
|
|
- String meter = pointString.substring(0, index_);
|
|
|
- int funcid = Integer.parseInt(pointString.substring(index_ + 1));
|
|
|
- String data_type = parseObject.getString("data_type");
|
|
|
- String time_period = parseObject.getString("time_period");
|
|
|
- if (time_period == null) {
|
|
|
- time_period = "15min";
|
|
|
- }
|
|
|
- String time_from = parseObject.getString("time_from");
|
|
|
- String time_to = parseObject.getString("time_to");
|
|
|
- JSONArray dataArray = fjd_query_inner(meter, funcid, data_type, time_period, time_from, time_to);
|
|
|
- parseObject.put("datas", dataArray);
|
|
|
- }
|
|
|
+ fjd_query_history_batch_fill(parseArray);
|
|
|
result.put("Content", parseArray);
|
|
|
result.put("Result", "success");
|
|
|
} catch (Exception e) {
|
|
@@ -540,6 +527,35 @@ public class RestUtil {
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
|
|
|
+ public static ResponseEntity<FileSystemResource> fjd_query_history_batch_export(String param, HttpServletResponse response) throws Exception {
|
|
|
+ JSONArray parseArray = JSON.parseArray(param);
|
|
|
+ fjd_query_history_batch_fill(parseArray);
|
|
|
+ ResponseEntity<FileSystemResource> fsr = ExportUtil.fjd_export(parseArray);
|
|
|
+ return fsr;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void fjd_query_history_batch_fill(JSONArray parseArray) throws Exception {
|
|
|
+ RepositoryImpl Repository = RepositoryContainer.instance;
|
|
|
+ for (int i = 0; i < parseArray.size(); i++) {
|
|
|
+ JSONObject parseObject = parseArray.getJSONObject(i);
|
|
|
+ String objId = parseObject.getString("objId");
|
|
|
+ String code = parseObject.getString("code");
|
|
|
+ String pointString = Repository.info2point.get(objId).get(code);
|
|
|
+ int index_ = pointString.lastIndexOf('-');
|
|
|
+ String meter = pointString.substring(0, index_);
|
|
|
+ int funcid = Integer.parseInt(pointString.substring(index_ + 1));
|
|
|
+ String data_type = parseObject.getString("data_type");
|
|
|
+ String time_period = parseObject.getString("time_period");
|
|
|
+ if (time_period == null) {
|
|
|
+ time_period = "15min";
|
|
|
+ }
|
|
|
+ String time_from = parseObject.getString("time_from");
|
|
|
+ String time_to = parseObject.getString("time_to");
|
|
|
+ JSONArray dataArray = fjd_query_inner(meter, funcid, data_type, time_period, time_from, time_to);
|
|
|
+ parseObject.put("datas", dataArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static String fjd_query_history(String meter, int funcid, String data_type, String time_period, String time_from, String time_to) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
try {
|