|
@@ -457,26 +457,33 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
// List<HtAnalogDataVo> lastPeriodRingRatioList = null;
|
|
|
List<DataManagementVO> dataManagementVOList = new ArrayList<>();
|
|
|
List<String> newListOne = new ArrayList<>();
|
|
|
+ List<String> newListTwo = new ArrayList<>();
|
|
|
+ List<String> newListThree = new ArrayList<>();
|
|
|
newListOne.add("dataTime");
|
|
|
+
|
|
|
for (int i = 0; i < dataManagementOneVO.getDisplayField().size(); i++) {
|
|
|
DataManagementVO dataManagementVO = new DataManagementVO();
|
|
|
dataManagementVO.setDisplayField(dataManagementOneVO.getDisplayField().get(i).split("_")[0]);
|
|
|
dataManagementVOList.add(dataManagementVO);
|
|
|
newListOne.add(dataManagementOneVO.getDisplayField().get(i).split("_")[1]);
|
|
|
+ newListTwo.add(dataManagementOneVO.getDisplayField().get(i).split("_")[2]);
|
|
|
+ newListThree.add(dataManagementOneVO.getDisplayField().get(i).split("_")[1]+"_"+dataManagementOneVO.getDisplayField().get(i).split("_")[2]);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- //设备
|
|
|
Set set = new HashSet();
|
|
|
List<DataManagementVO> newList = new ArrayList();
|
|
|
set.addAll(dataManagementVOList);
|
|
|
newList.addAll(set);
|
|
|
- //字段
|
|
|
+
|
|
|
Set set1 = new HashSet();
|
|
|
List<String> list = new ArrayList();
|
|
|
set1.addAll(newListOne);
|
|
|
list.addAll(set1);
|
|
|
|
|
|
+ Set set2 = new HashSet();
|
|
|
+ List<String> monitor_list = new ArrayList();
|
|
|
+ set2.addAll(newListTwo);
|
|
|
+ monitor_list.addAll(set2);
|
|
|
+
|
|
|
//旧数据时间计算
|
|
|
SimpleDateFormat sfOne = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
long startLong = DateUtils.toDate(DateUtils.toLocalDateTime(dataManagementOneVO.getStartTime(), "yyyy-MM-dd HH:mm:ss")).getTime();
|
|
@@ -507,67 +514,98 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
currentPeriodRingRatioList = baseMapper.yearOnYearThree(newList, lastPeriodStartTime, dataManagementOneVO.getEndTime());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- List<Map<String,Object>> returnList = new ArrayList<>();
|
|
|
- for (HtAnalogDataVo htAnalogDataVo:currentPeriodRingRatioList) {
|
|
|
- Field[] fields = htAnalogDataVo.getClass().getDeclaredFields();
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- for (String fiied:list) {
|
|
|
- for (int i = 0; i < fields.length; i++) {
|
|
|
- fields[i].setAccessible(true);
|
|
|
- if (fiied.equals(fields[i].getName())){
|
|
|
- try {
|
|
|
- if (fiied.equals("dataTime")){
|
|
|
- map.put(fiied,fields[i].get(htAnalogDataVo));
|
|
|
- }else {
|
|
|
- String targetValue = fields[2].get(htAnalogDataVo) + "_" + fields[i].getName();
|
|
|
- if (dataManagementOneVO.getDisplayField().contains(targetValue)){
|
|
|
- map.put(targetValue,fields[i].get(htAnalogDataVo));
|
|
|
- }
|
|
|
+ FieldEscapeUtils.remove1(list);
|
|
|
+ List<CommonIcoVO> reListOne = new ArrayList<>();
|
|
|
+ if (currentPeriodRingRatioList!=null && !currentPeriodRingRatioList.isEmpty()){
|
|
|
+ for (int i = 0; i < monitor_list.size(); i++) {
|
|
|
+ for (int j = 0; j < list.size(); j++) {
|
|
|
+ List<Object> data = new ArrayList<>();
|
|
|
+ String name = null;
|
|
|
+ List<Object> time = new ArrayList<>();
|
|
|
+ for (int k = 0; k < currentPeriodRingRatioList.size(); k++) {
|
|
|
+ String variable_one = list.get(j) + "_" + monitor_list.get(i);
|
|
|
+ String variable_two = list.get(j)+"_"+currentPeriodRingRatioList.get(k).getDeviceAttributeId();
|
|
|
+ System.out.println("variable_one:"+variable_one+"---variable_two:"+variable_two);
|
|
|
+ if (variable_one.equals(variable_two)){
|
|
|
+ String variable_three = list.get(j)+"_"+currentPeriodRingRatioList.get(k).getDeviceAttributeId();
|
|
|
+ System.out.println("variable_one_a:"+newListThree+"---variable_two_b:"+variable_three+"---value:"+newListThree.contains(variable_three));
|
|
|
+ if (newListThree.contains(variable_three)){
|
|
|
+ name = currentPeriodRingRatioList.get(k).getMonitorDeviceName() + "/" + FieldEscapeUtils.fieldEscapeUtils(list.get(j));
|
|
|
+ time.add(currentPeriodRingRatioList.get(k).getDataTime());
|
|
|
+// System.out.println();
|
|
|
+ data.add(FieldEscapeUtils.transformation(currentPeriodRingRatioList.get(k),list.get(j)));
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
+ if (data!=null && !data.isEmpty()){
|
|
|
+ reListOne.add(CommonIcoVO.builder().name(name).list(data).listDate(time).build());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- Map<String,Object> deviceMap = new HashMap<>();
|
|
|
- deviceMap.put("deviceName",htAnalogDataVo.getDeviceName());
|
|
|
- deviceMap.put("monitorDeviceName",htAnalogDataVo.getMonitorDeviceName());
|
|
|
- deviceMap.put("deviceAttributeId",htAnalogDataVo.getDeviceAttributeId());
|
|
|
- deviceMap.put("data",map);
|
|
|
- returnList.add(deviceMap);
|
|
|
}
|
|
|
|
|
|
- List<CommonIcoVO> reList = new ArrayList<>();
|
|
|
- Map<String, List<Map<String, Object>>> glist = returnList.stream().collect(Collectors.groupingBy(e -> e.get("deviceAttributeId").toString()));
|
|
|
- for (String key:glist.keySet()) {
|
|
|
- List<Object> objectList = new ArrayList<>();
|
|
|
- List<Map<String, Object>> maps = glist.get(key);
|
|
|
- for (Map<String,Object> map:maps) {
|
|
|
- objectList.add(map.get("data"));
|
|
|
- }
|
|
|
- reList.add(CommonIcoVO.builder().name(key).list(objectList).listDate(objectList).build());
|
|
|
- }
|
|
|
|
|
|
- List<CommonIcoVO> reListOne = new ArrayList<>();
|
|
|
- for (int i = 0; i < dataManagementOneVO.getDisplayField().size(); i++) {
|
|
|
- String fieldValue = dataManagementOneVO.getDisplayField().get(i).split("_")[1];
|
|
|
- String name = FieldEscapeUtils.fieldEscapeUtils(fieldValue);
|
|
|
- for (int j = 0; j < reList.size(); j++) {
|
|
|
- List<Object> a = new ArrayList<>();
|
|
|
- List<Object> time = new ArrayList<>();
|
|
|
- for (int k = 0; k < ((List) reList.get(j).getList()).size(); k++) {
|
|
|
- if (((List<Map<String,Object>>) reList.get(j).getList()).get(k).containsKey(dataManagementOneVO.getDisplayField().get(i))){
|
|
|
- a.add(((List<Map<String,Object>>) reList.get(j).getList()).get(k).get(dataManagementOneVO.getDisplayField().get(i)));
|
|
|
- time.add(((List<Map<String,Object>>) reList.get(j).getList()).get(k).get("dataTime"));
|
|
|
- }
|
|
|
- }
|
|
|
- if (a.size()>0){
|
|
|
- reListOne.add(CommonIcoVO.builder().name(name).list(a).listDate(time).build());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// List<Map<String,Object>> returnList = new ArrayList<>();
|
|
|
+// for (HtAnalogDataVo htAnalogDataVo:currentPeriodRingRatioList) {
|
|
|
+// Field[] fields = htAnalogDataVo.getClass().getDeclaredFields();
|
|
|
+// Map<String,Object> map = new HashMap<>();
|
|
|
+// for (String fiied:list) {
|
|
|
+// for (int i = 0; i < fields.length; i++) {
|
|
|
+// fields[i].setAccessible(true);
|
|
|
+// if (fiied.equals(fields[i].getName())){
|
|
|
+// try {
|
|
|
+// if (fiied.equals("dataTime")){
|
|
|
+// map.put(fiied,fields[i].get(htAnalogDataVo));
|
|
|
+// }
|
|
|
+// String targetValue = fields[2].get(htAnalogDataVo) + "_" + fields[i].getName();
|
|
|
+// if (dataManagementOneVO.getDisplayField().contains(targetValue)){
|
|
|
+// map.put(targetValue,fields[i].get(htAnalogDataVo));
|
|
|
+// }
|
|
|
+//
|
|
|
+// }catch (Exception e){
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// Map<String,Object> deviceMap = new HashMap<>();
|
|
|
+// deviceMap.put("deviceName",htAnalogDataVo.getDeviceName());
|
|
|
+// deviceMap.put("monitorDeviceName",htAnalogDataVo.getMonitorDeviceName());
|
|
|
+// deviceMap.put("deviceAttributeId",htAnalogDataVo.getDeviceAttributeId());
|
|
|
+// deviceMap.put("data",map);
|
|
|
+// returnList.add(deviceMap);
|
|
|
+// }
|
|
|
+//
|
|
|
+// List<CommonIcoVO> reList = new ArrayList<>();
|
|
|
+// Map<String, List<Map<String, Object>>> glist = returnList.stream().collect(Collectors.groupingBy(e -> e.get("deviceAttributeId").toString()));
|
|
|
+// for (String key:glist.keySet()) {
|
|
|
+// List<Object> objectList = new ArrayList<>();
|
|
|
+// List<Map<String, Object>> maps = glist.get(key);
|
|
|
+// for (Map<String,Object> map:maps) {
|
|
|
+// objectList.add(map.get("data"));
|
|
|
+// }
|
|
|
+// reList.add(CommonIcoVO.builder().name(key).list(objectList).listDate(objectList).build());
|
|
|
+// }
|
|
|
+//
|
|
|
+// List<CommonIcoVO> reListOne = new ArrayList<>();
|
|
|
+// for (int i = 0; i < dataManagementOneVO.getDisplayField().size(); i++) {
|
|
|
+// String fieldValue = dataManagementOneVO.getDisplayField().get(i).split("_")[1];
|
|
|
+// String name = FieldEscapeUtils.fieldEscapeUtils(fieldValue);
|
|
|
+// for (int j = 0; j < reList.size(); j++) {
|
|
|
+// List<Object> a = new ArrayList<>();
|
|
|
+// List<Object> time = new ArrayList<>();
|
|
|
+// for (int k = 0; k < ((List) reList.get(j).getList()).size(); k++) {
|
|
|
+// if (((List<Map<String,Object>>) reList.get(j).getList()).get(k).containsKey(dataManagementOneVO.getDisplayField().get(i))){
|
|
|
+// a.add(((List<Map<String,Object>>) reList.get(j).getList()).get(k).get(dataManagementOneVO.getDisplayField().get(i)));
|
|
|
+// time.add(((List<Map<String,Object>>) reList.get(j).getList()).get(k).get("dataTime"));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (a.size()>0){
|
|
|
+// reListOne.add(CommonIcoVO.builder().name(name).list(a).listDate(time).build());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
return reListOne;
|
|
|
}
|
|
|
|