|
@@ -7,6 +7,7 @@ import com.bizmatics.common.core.exception.BusinessException;
|
|
|
import com.bizmatics.common.core.util.Arith;
|
|
|
import com.bizmatics.common.core.util.BeanMapperUtils;
|
|
|
import com.bizmatics.common.core.util.DateUtils;
|
|
|
+import com.bizmatics.common.core.util.StringUtils;
|
|
|
import com.bizmatics.common.mvc.base.AbstractCrudService;
|
|
|
import com.bizmatics.common.spring.util.JsonUtils;
|
|
|
import com.bizmatics.model.*;
|
|
@@ -19,10 +20,12 @@ import com.bizmatics.service.util.FieldEscapeUtils;
|
|
|
import com.bizmatics.service.util.SecurityUtils;
|
|
|
import com.bizmatics.service.vo.*;
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
+import lombok.SneakyThrows;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
+import java.lang.reflect.Method;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -324,12 +327,14 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
List<HtAnalogDataVo> yearOnYearList = null;
|
|
|
List<DataManagementVO> dataManagementVOList = new ArrayList<>();
|
|
|
List<String> newListOne = new ArrayList<>();
|
|
|
+ List<String> newListTwo = 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]);
|
|
|
}
|
|
|
Set set = new HashSet();
|
|
|
List<DataManagementVO> newList = new ArrayList();
|
|
@@ -341,6 +346,11 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
set1.addAll(newListOne);
|
|
|
list.addAll(set1);
|
|
|
|
|
|
+ Set set2 = new HashSet();
|
|
|
+ List<String> monitor_list = new ArrayList();
|
|
|
+ set2.addAll(newListTwo);
|
|
|
+ monitor_list.addAll(set2);
|
|
|
+
|
|
|
if (dataManagementOneVO.getType() == 1) {
|
|
|
if (dataManagementOneVO.getValueCalculation() == 1) {
|
|
|
yearOnYearList = baseMapper.yearOnYearOne(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime());
|
|
@@ -364,44 +374,75 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
|
|
|
} else {
|
|
|
yearOnYearList = baseMapper.yearOnYearThree(newList, dataManagementOneVO.getStartTime(), dataManagementOneVO.getEndTime());
|
|
|
}
|
|
|
- List<Map<String,Object>> returnList = new ArrayList<>();
|
|
|
- for (HtAnalogDataVo htAnalogDataVo:yearOnYearList) {
|
|
|
- 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 {
|
|
|
- map.put(fields[2].get(htAnalogDataVo)+"_"+fiied,fields[i].get(htAnalogDataVo));
|
|
|
- }
|
|
|
- }catch (Exception e){
|
|
|
-
|
|
|
+ FieldEscapeUtils.remove1(list);
|
|
|
+ List<CommonIcoVO> reListOne = new ArrayList<>();
|
|
|
+ if (yearOnYearList!=null && !yearOnYearList.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 < yearOnYearList.size(); k++) {
|
|
|
+ String variable_one = list.get(j) + "_" + monitor_list.get(i);
|
|
|
+ String variable_two = list.get(j)+"_"+yearOnYearList.get(k).getDeviceAttributeId();
|
|
|
+ System.out.println("variable_one:"+variable_one+"---variable_two:"+variable_two);
|
|
|
+ if (variable_one.equals(variable_two)){
|
|
|
+ String variable_three = yearOnYearList.get(k).getDeviceName()+"_"+list.get(j)+"_"+yearOnYearList.get(k).getDeviceAttributeId();
|
|
|
+// System.out.println("variable_one_a:"+dataManagementOneVO.getDisplayField()+"---variable_two_b:"+variable_three+"value"+dataManagementOneVO.getDisplayField().contains(variable_three));
|
|
|
+// if (dataManagementOneVO.getDisplayField().contains(variable_three)){
|
|
|
+ name = yearOnYearList.get(k).getMonitorDeviceName() + "/" + FieldEscapeUtils.fieldEscapeUtils(list.get(j));
|
|
|
+ time.add(yearOnYearList.get(k).getDataTime());
|
|
|
+// System.out.println();
|
|
|
+ data.add(FieldEscapeUtils.transformation(yearOnYearList.get(k),list.get(j)));
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
+ 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());
|
|
|
}
|
|
|
- return reList;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// List<Map<String,Object>> returnList = new ArrayList<>();
|
|
|
+// for (HtAnalogDataVo htAnalogDataVo:yearOnYearList) {
|
|
|
+// 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 {
|
|
|
+// map.put(fields[2].get(htAnalogDataVo)+"_"+fiied,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());
|
|
|
+// }
|
|
|
+ return reListOne;
|
|
|
}
|
|
|
|
|
|
|