Эх сурвалжийг харах

修改数据组获取所有数据组接口,添加类型搜索,通过id获取数据组下面的数据项信息,添加数据项类型筛选,
修改统计图生成数据报错问题
修改报表和统计图生成数据,排除附属属性问题

zhoupeng 1 жил өмнө
parent
commit
801aa1d085

+ 11 - 9
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/ItemGroupController.java

@@ -42,28 +42,30 @@ public class ItemGroupController {
 
 
     /**
     /**
      * 获取当前登录人的所有数据组
      * 获取当前登录人的所有数据组
+     * 读取模式;0频率,1变化时读取,2超过或者等于设定值读取。不传则获取所有;传0或者1,则获取0和1的全部,传入2则获取2
      *
      *
      * @return
      * @return
      */
      */
     @GetMapping("/getAllItemGroup")
     @GetMapping("/getAllItemGroup")
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
-    public Result getAllItemGroup() {
-        return itemGroupService.getAllItemGroup();
+    public Result getAllItemGroup(Integer readMode) {
+        return itemGroupService.getAllItemGroup(readMode);
     }
     }
 
 
     /**
     /**
-     * 通过id获取数据组
+     * 通过id获取数据组,数据组中返回的数据项,如果传入itemType为空,则是获取全部,如果为0,则是附属属性,1基础属性
+     * 项类型,0附属属性,1基础属性
      *
      *
      * @param id
      * @param id
      * @return
      * @return
      */
      */
-    @GetMapping("/getItemGroupById/{id}")
+    @GetMapping("/getItemGroupById")
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
-    public Result getItemGroupById(@PathVariable Integer id) {
+    public Result getItemGroupById(Integer id, Integer itemType) {
         if (Blank.isEmpty(id)) {
         if (Blank.isEmpty(id)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
         }
         }
-        return itemGroupService.getItemGroupById(id);
+        return itemGroupService.getItemGroupById(id, itemType);
     }
     }
 
 
     /**
     /**
@@ -162,13 +164,13 @@ public class ItemGroupController {
      * @param id
      * @param id
      * @return
      * @return
      */
      */
-    @GetMapping("/getTableItemGroupById/{id}")
+    @GetMapping("/getTableItemGroupById")
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
-    public Result getTableItemGroupById(@PathVariable Integer id) {
+    public Result getTableItemGroupById(Integer id, Integer itemType) {
         if (Blank.isEmpty(id)) {
         if (Blank.isEmpty(id)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
         }
         }
-        return itemGroupService.getTableItemGroupById(id);
+        return itemGroupService.getTableItemGroupById(id, itemType);
     }
     }
 
 
     /**
     /**

+ 4 - 2
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/ItemGroupDao.java

@@ -15,7 +15,7 @@ public interface ItemGroupDao {
 
 
     ItemGroup getItemGroupById(Integer id);
     ItemGroup getItemGroupById(Integer id);
 
 
-    List<ItemGroup> getAllItemGroup(String userId);
+    List<ItemGroup> getAllItemGroup(String userId, Integer readMode);
 
 
     ItemGroup getItemGroupByNameNoId(Integer id, String userId, String groupName);
     ItemGroup getItemGroupByNameNoId(Integer id, String userId, String groupName);
 
 
@@ -27,7 +27,7 @@ public interface ItemGroupDao {
 
 
     Integer delItemGroupById(Integer id);
     Integer delItemGroupById(Integer id);
 
 
-    List<Item> getItemListByGroupId(Integer itemGroupId);
+    List<Item> getItemListByGroupId(Integer itemGroupId, Integer itemType);
 
 
     List<Item> getPublicItemList(Integer itemGroupId, List<Item> itemList);
     List<Item> getPublicItemList(Integer itemGroupId, List<Item> itemList);
 
 
@@ -58,4 +58,6 @@ public interface ItemGroupDao {
     Integer updateItemByName(Item item);
     Integer updateItemByName(Item item);
 
 
     List<Item> getAttributesItemList(Integer itemGroupId, Integer itemType);
     List<Item> getAttributesItemList(Integer itemGroupId, Integer itemType);
+
+    List<ItemGroup> getAllItemGroup1(String userId, Integer readMode);
 }
 }

+ 1 - 1
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/DynamicScheduleConfig.java

@@ -61,7 +61,7 @@ public class DynamicScheduleConfig implements SchedulingConfigurer {
             }
             }
         }
         }
 
 
-        List<ItemGroup> itemGroupList = itemGroupDao.getAllItemGroup(null);
+        List<ItemGroup> itemGroupList = itemGroupDao.getAllItemGroup(null, null);
         if (Blank.isNotEmpty(itemGroupList)) {
         if (Blank.isNotEmpty(itemGroupList)) {
             for (ItemGroup itemGroup : itemGroupList) {
             for (ItemGroup itemGroup : itemGroupList) {
                 String readWeek = itemGroup.getReadWeek();
                 String readWeek = itemGroup.getReadWeek();

+ 3 - 3
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/ItemGroupService.java

@@ -9,9 +9,9 @@ import java.util.List;
 public interface ItemGroupService {
 public interface ItemGroupService {
     Result addItemGroup(ItemGroup itemGroup);
     Result addItemGroup(ItemGroup itemGroup);
 
 
-    Result getItemGroupById(Integer id);
+    Result getItemGroupById(Integer id, Integer itemType);
 
 
-    Result getAllItemGroup();
+    Result getAllItemGroup(Integer readMode);
 
 
     Result delItemGroupById(Integer id);
     Result delItemGroupById(Integer id);
 
 
@@ -21,7 +21,7 @@ public interface ItemGroupService {
 
 
     Result updateItem(Item item);
     Result updateItem(Item item);
 
 
-    Result getTableItemGroupById(Integer id);
+    Result getTableItemGroupById(Integer id, Integer itemType);
 
 
     Result deleteItemByIdList(List<Integer> idList);
     Result deleteItemByIdList(List<Integer> idList);
 
 

+ 50 - 80
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/ChartServiceImpl.java

@@ -94,107 +94,77 @@ public class ChartServiceImpl implements ChartService {
                 if (Blank.isEmpty(item)) {
                 if (Blank.isEmpty(item)) {
                     continue;
                     continue;
                 }
                 }
-                Integer itemType = item.getItemType();
                 long startTimeTime = startTime.getTime();
                 long startTimeTime = startTime.getTime();
                 long endTimeTime;
                 long endTimeTime;
-                if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                    AttachRawData attachRawData = rawDataDao.getAttachRawData(itemGroupId, dataSourceId, itemName);
-                    String dataType = attachRawData.getDataType();
+                String startBelongTime;
+                String endBelongTime;
+                List<RawData> rawDataList = new ArrayList<>();
+                if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
+                    startBelongTime = DateUtil.dateChangeStrYmdhms(startTime).substring(0, ConstantStr.TIME_DAY_STR.length());
+                    endBelongTime = DateUtil.dateChangeStrYmdhms(endTime).substring(0, ConstantStr.TIME_DAY_STR.length());
+                    rawDataList = rawDataDao.getTableDataByDay(itemGroupId, remainder, dataSourceId, itemName, startBelongTime, endBelongTime);
+                } else {
+                    startBelongTime = DateUtil.dateChangeStrYmdhms(startTime).substring(0, ConstantStr.TIME_HOUR_STR.length());
+                    endBelongTime = DateUtil.dateChangeStrYmdhms(endTime).substring(0, ConstantStr.TIME_HOUR_STR.length());
+                    rawDataList = rawDataDao.getTableData(itemGroupId, remainder, dataSourceId, itemName, startBelongTime, endBelongTime);
+                }
+                List<String> sqlCurrentYmdhList = rawDataDao.getCursorYmdh(itemGroupId, dataSourceId, itemName, startBelongTime, endBelongTime);
+                if (Blank.isNotEmpty(sqlCurrentYmdhList)) {
+                    for (String sqlCurrentYmdh : sqlCurrentYmdhList) {
+                        List<CursorRawData> cursorRawDataList = rawDataDao.getTableCursorData(itemGroupId, dataSourceId, itemName, sqlCurrentYmdh);
+                        rawDataList = ReportTask.genRawAddCursor(rawDataList, cursorRawDataList, itemGroupId, dataSourceId, sqlCurrentYmdh);
+                    }
+                }
+                if (Blank.isNotEmpty(rawDataList)) {
+                    String dataType = rawDataList.get(0).getDataType();
                     if (!dataType.toLowerCase().equals("boolean")) {
                     if (!dataType.toLowerCase().equals("boolean")) {
                         try {
                         try {
+                            List<BigDecimal> orgRawList = new ArrayList<>();
+                            List<BigDecimal> rawList = new ArrayList<>();
+                            List<String> rawTimeList = new ArrayList<>();
+                            for (int j = 0; j < rawDataList.size(); j++) {
+                                RawData rawData = rawDataList.get(j);
+                                orgRawList.addAll(new ArrayList<>(Arrays.asList(JSON.parseObject(rawData.getOrgDataValue(), BigDecimal[].class))));
+                                rawList.addAll(new ArrayList<>(Arrays.asList(JSON.parseObject(rawData.getDataValue(), BigDecimal[].class))));
+                                rawTimeList.addAll(new ArrayList<>(Arrays.asList(JSON.parseObject(rawData.getDataValueTime(), String[].class))));
+                            }
+                            List<BigDecimal> orgValueList = new ArrayList<>();
                             List<BigDecimal> valueList = new ArrayList<>();
                             List<BigDecimal> valueList = new ArrayList<>();
                             List<String> valueTimeList = new ArrayList<>();
                             List<String> valueTimeList = new ArrayList<>();
                             List<Long> valueIndexList = new ArrayList<>();
                             List<Long> valueIndexList = new ArrayList<>();
-                            BigDecimal bigDecimal = JSON.parseObject(flage ? attachRawData.getDataValue() : attachRawData.getOrgDataValue(), BigDecimal.class);
                             for (int j = 0; j < timeLength; j++) {
                             for (int j = 0; j < timeLength; j++) {
-                                if (i != timeLength - 1) {
+                                List<BigDecimal> orgList = new ArrayList<>();
+                                List<BigDecimal> list = new ArrayList<>();
+                                if (j != timeLength - 1) {
                                     endTimeTime = DateUtil.addTimeStamp(startTimeTime, pattern, bucketValue);
                                     endTimeTime = DateUtil.addTimeStamp(startTimeTime, pattern, bucketValue);
                                 } else {
                                 } else {
                                     endTimeTime = endTime.getTime();
                                     endTimeTime = endTime.getTime();
                                 }
                                 }
-                                valueList.add(bigDecimal);
+                                for (int k = 0; k < rawTimeList.size(); k++) {
+                                    long time = DateUtil.strYmdhmssChangeDate(rawTimeList.get(k)).getTime();
+                                    if (startTimeTime <= time) {
+                                        orgList.add(orgRawList.get(k));
+                                        list.add(rawList.get(k));
+                                    }
+                                    if (time > endTimeTime) {
+                                        break;
+                                    }
+                                }
+                                orgValueList.add(ReportTask.genBigDecimalValue(orgList, valueTakingMode));
+                                valueList.add(ReportTask.genBigDecimalValue(list, valueTakingMode));
                                 valueTimeList.add(DateUtil.dateChangeStrYmdhmss(new Date(startTimeTime)));
                                 valueTimeList.add(DateUtil.dateChangeStrYmdhmss(new Date(startTimeTime)));
-                                valueIndexList.add((long) j);
+                                valueIndexList.add(((long) j));
                                 startTimeTime = endTimeTime;
                                 startTimeTime = endTimeTime;
+                                orgList = new ArrayList<>();
+                                list = new ArrayList<>();
                             }
                             }
-                            chartItem.setValueList(valueList);
+                            chartItem.setValueList(flage ? valueList : orgValueList);
                             chartItem.setValueTimeList(valueTimeList);
                             chartItem.setValueTimeList(valueTimeList);
                             chartItem.setValueIndexList(valueIndexList);
                             chartItem.setValueIndexList(valueIndexList);
                         } catch (Exception e) {
                         } catch (Exception e) {
 
 
                         }
                         }
                     }
                     }
-                } else {
-                    String startBelongTime;
-                    String endBelongTime;
-                    List<RawData> rawDataList = new ArrayList<>();
-                    if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
-                        startBelongTime = DateUtil.dateChangeStrYmdhms(startTime).substring(0, ConstantStr.TIME_DAY_STR.length());
-                        endBelongTime = DateUtil.dateChangeStrYmdhms(endTime).substring(0, ConstantStr.TIME_DAY_STR.length());
-                        rawDataList = rawDataDao.getTableDataByDay(itemGroupId, remainder, dataSourceId, itemName, startBelongTime, endBelongTime);
-                    } else {
-                        startBelongTime = DateUtil.dateChangeStrYmdhms(startTime).substring(0, ConstantStr.TIME_HOUR_STR.length());
-                        endBelongTime = DateUtil.dateChangeStrYmdhms(endTime).substring(0, ConstantStr.TIME_HOUR_STR.length());
-                        rawDataList = rawDataDao.getTableData(itemGroupId, remainder, dataSourceId, itemName, startBelongTime, endBelongTime);
-                    }
-                    List<String> sqlCurrentYmdhList = rawDataDao.getCursorYmdh(itemGroupId, dataSourceId, itemName, startBelongTime, endBelongTime);
-                    if (Blank.isNotEmpty(sqlCurrentYmdhList)) {
-                        for (String sqlCurrentYmdh : sqlCurrentYmdhList) {
-                            List<CursorRawData> cursorRawDataList = rawDataDao.getTableCursorData(itemGroupId, dataSourceId, itemName, sqlCurrentYmdh);
-                            rawDataList = ReportTask.genRawAddCursor(rawDataList, cursorRawDataList, itemGroupId, dataSourceId, sqlCurrentYmdh);
-                        }
-                    }
-                    if (Blank.isNotEmpty(rawDataList)) {
-                        String dataType = rawDataList.get(0).getDataType();
-                        if (!dataType.toLowerCase().equals("boolean")) {
-                            try {
-                                List<BigDecimal> orgRawList = new ArrayList<>();
-                                List<BigDecimal> rawList = new ArrayList<>();
-                                List<String> rawTimeList = new ArrayList<>();
-                                for (int j = 0; j < rawDataList.size(); j++) {
-                                    RawData rawData = rawDataList.get(j);
-                                    orgRawList.addAll(new ArrayList<>(Arrays.asList(JSON.parseObject(rawData.getOrgDataValue(), BigDecimal[].class))));
-                                    rawList.addAll(new ArrayList<>(Arrays.asList(JSON.parseObject(rawData.getDataValue(), BigDecimal[].class))));
-                                    rawTimeList.addAll(new ArrayList<>(Arrays.asList(JSON.parseObject(rawData.getDataValueTime(), String[].class))));
-                                }
-                                List<BigDecimal> orgValueList = new ArrayList<>();
-                                List<BigDecimal> valueList = new ArrayList<>();
-                                List<String> valueTimeList = new ArrayList<>();
-                                List<Long> valueIndexList = new ArrayList<>();
-                                for (int j = 0; j < timeLength; j++) {
-                                    List<BigDecimal> orgList = new ArrayList<>();
-                                    List<BigDecimal> list = new ArrayList<>();
-                                    if (j != timeLength - 1) {
-                                        endTimeTime = DateUtil.addTimeStamp(startTimeTime, pattern, bucketValue);
-                                    } else {
-                                        endTimeTime = endTime.getTime();
-                                    }
-                                    for (int k = 0; k < rawTimeList.size(); k++) {
-                                        long time = DateUtil.strYmdhmssChangeDate(rawTimeList.get(j)).getTime();
-                                        if (startTimeTime <= time) {
-                                            orgList.add(orgRawList.get(j));
-                                            list.add(rawList.get(j));
-                                        }
-                                        if (time > endTimeTime) {
-                                            break;
-                                        }
-                                    }
-                                    orgValueList.add(ReportTask.genBigDecimalValue(orgList, valueTakingMode));
-                                    valueList.add(ReportTask.genBigDecimalValue(list, valueTakingMode));
-                                    valueTimeList.add(DateUtil.dateChangeStrYmdhmss(new Date(startTimeTime)));
-                                    valueIndexList.add(((long) j));
-                                    startTimeTime = endTimeTime;
-                                    orgList = new ArrayList<>();
-                                    list = new ArrayList<>();
-                                }
-                                chartItem.setValueList(flage ? valueList : orgValueList);
-                                chartItem.setValueTimeList(valueTimeList);
-                                chartItem.setValueIndexList(valueIndexList);
-                            } catch (Exception e) {
-
-                            }
-                        }
-                    }
                 }
                 }
             }
             }
         }
         }

+ 13 - 7
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/ItemGroupServiceImpl.java

@@ -213,7 +213,7 @@ public class ItemGroupServiceImpl implements ItemGroupService {
     }
     }
 
 
     @Override
     @Override
-    public Result getItemGroupById(Integer id) {
+    public Result getItemGroupById(Integer id, Integer itemType) {
         ItemGroup itemGroup = itemGroupDao.getItemGroupById(id);
         ItemGroup itemGroup = itemGroupDao.getItemGroupById(id);
         if (Blank.isEmpty(itemGroup)) {
         if (Blank.isEmpty(itemGroup)) {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "不存在此itemGroup,请重试");
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "不存在此itemGroup,请重试");
@@ -222,7 +222,7 @@ public class ItemGroupServiceImpl implements ItemGroupService {
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组的数据源不存在,请刷新重试");
             return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组的数据源不存在,请刷新重试");
         }
         }
         DataSource dataSource = dataSourceDao.getDataSourceById(itemGroup.getDataSourceId());
         DataSource dataSource = dataSourceDao.getDataSourceById(itemGroup.getDataSourceId());
-        List<Item> itemList = itemGroupDao.getItemListByGroupId(id);
+        List<Item> itemList = itemGroupDao.getItemListByGroupId(id, itemType);
         if (Blank.isNotEmpty(itemList)) {
         if (Blank.isNotEmpty(itemList)) {
             for (Item item : itemList) {
             for (Item item : itemList) {
                 item.setDataSourceName(dataSource.getDataSourceName());
                 item.setDataSourceName(dataSource.getDataSourceName());
@@ -233,9 +233,15 @@ public class ItemGroupServiceImpl implements ItemGroupService {
     }
     }
 
 
     @Override
     @Override
-    public Result getAllItemGroup() {
+    public Result getAllItemGroup(Integer readMode) {
         String userId = userUtil.getCurrentUserId();
         String userId = userUtil.getCurrentUserId();
-        return Result.ok(itemGroupDao.getAllItemGroup(userId));
+        if (Blank.isEmpty(userId)) {
+            throw new CustomException(ResultEnum.UNAUTHORIZED.getRespCode(), ResultEnum.UNAUTHORIZED.getRespMsg());
+        }
+        if (Blank.isNotEmpty(readMode) && !readMode.equals(ConstantStr.EXCEED_SET_VALUE)) {
+            return Result.ok(itemGroupDao.getAllItemGroup1(userId, ConstantStr.EXCEED_SET_VALUE));
+        }
+        return Result.ok(itemGroupDao.getAllItemGroup(userId, readMode));
     }
     }
 
 
     @Override
     @Override
@@ -340,7 +346,7 @@ public class ItemGroupServiceImpl implements ItemGroupService {
             //读取数据并返回
             //读取数据并返回
             return restTemplate.postForObject(opcUaUrl + "/itemGroup/getItemValueById/" + id, new HttpEntity<>(null, new HttpHeaders()), Result.class);
             return restTemplate.postForObject(opcUaUrl + "/itemGroup/getItemValueById/" + id, new HttpEntity<>(null, new HttpHeaders()), Result.class);
         } else if (OpcUtil.isOpcDa(dataSourceType.getDataSourceTypeKey())) {
         } else if (OpcUtil.isOpcDa(dataSourceType.getDataSourceTypeKey())) {
-            List<Item> allItemList = itemGroupDao.getItemListByGroupId(id);
+            List<Item> allItemList = itemGroupDao.getItemListByGroupId(id, null);
             List<DataModel> dmListByItemList = dataModelDao.getDmListByItemList(allItemList);
             List<DataModel> dmListByItemList = dataModelDao.getDmListByItemList(allItemList);
             Map<String, DataModel> map = DataModel.genMap(allItemList, dmListByItemList);
             Map<String, DataModel> map = DataModel.genMap(allItemList, dmListByItemList);
             if (Blank.isEmpty(dataSource.getIpAddress(), dataSource.getIpUserName(), dataSource.getIpPassword())) {
             if (Blank.isEmpty(dataSource.getIpAddress(), dataSource.getIpUserName(), dataSource.getIpPassword())) {
@@ -369,14 +375,14 @@ public class ItemGroupServiceImpl implements ItemGroupService {
     }
     }
 
 
     @Override
     @Override
-    public Result getTableItemGroupById(Integer id) {
+    public Result getTableItemGroupById(Integer id, Integer itemType) {
         ItemGroup itemGroup = itemGroupDao.getItemGroupById(id);
         ItemGroup itemGroup = itemGroupDao.getItemGroupById(id);
         DataSource dataSource = dataSourceDao.getDataSourceById(itemGroup.getDataSourceId());
         DataSource dataSource = dataSourceDao.getDataSourceById(itemGroup.getDataSourceId());
         DataSourceType dataSourceType = dataSourceDao.getDataSourceTypeById(dataSource.getTypeId());
         DataSourceType dataSourceType = dataSourceDao.getDataSourceTypeById(dataSource.getTypeId());
         String dataSourceTypeKey = dataSourceType.getDataSourceTypeKey();
         String dataSourceTypeKey = dataSourceType.getDataSourceTypeKey();
         List<Item> itemList = new ArrayList<>();
         List<Item> itemList = new ArrayList<>();
         if (OpcUtil.isOpc(dataSourceTypeKey)) {
         if (OpcUtil.isOpc(dataSourceTypeKey)) {
-            itemList = itemGroupDao.getItemListByGroupId(id);
+            itemList = itemGroupDao.getItemListByGroupId(id, itemType);
         } else {
         } else {
             throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "目前还没有此种类型的连接方式");
             throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "目前还没有此种类型的连接方式");
         }
         }

+ 0 - 44
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/OpcAsyncTask.java

@@ -129,11 +129,7 @@ public class OpcAsyncTask {
                                     for (TableTemplateTableItem t : tableTemplateItemList) {
                                     for (TableTemplateTableItem t : tableTemplateItemList) {
                                         Integer itemId = t.getItemId();
                                         Integer itemId = t.getItemId();
                                         Integer valueType = t.getValueType();
                                         Integer valueType = t.getValueType();
-                                        Integer itemType = t.getItemType();
                                         Boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
                                         Boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
-                                        if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                            continue;
-                                        }
                                         List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, realIndexList);
                                         List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, realIndexList);
                                         if (Blank.isNotEmpty(cursorRawDataList)) {
                                         if (Blank.isNotEmpty(cursorRawDataList)) {
                                             Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
                                             Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
@@ -178,10 +174,6 @@ public class OpcAsyncTask {
                                                 if (Blank.isEmpty(item)) {
                                                 if (Blank.isEmpty(item)) {
                                                     continue;
                                                     continue;
                                                 }
                                                 }
-                                                Integer itemType = item.getItemType();
-                                                if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                                    continue;
-                                                }
                                                 List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, dataIndexList);
                                                 List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, dataIndexList);
                                                 if (Blank.isNotEmpty(cursorRawDataList)) {
                                                 if (Blank.isNotEmpty(cursorRawDataList)) {
                                                     Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
                                                     Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
@@ -225,10 +217,6 @@ public class OpcAsyncTask {
                                                 if (Blank.isEmpty(item)) {
                                                 if (Blank.isEmpty(item)) {
                                                     continue;
                                                     continue;
                                                 }
                                                 }
-                                                Integer itemType = item.getItemType();
-                                                if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                                    continue;
-                                                }
                                                 List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, dataIndexList);
                                                 List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, dataIndexList);
                                                 if (Blank.isNotEmpty(cursorRawDataList)) {
                                                 if (Blank.isNotEmpty(cursorRawDataList)) {
                                                     Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
                                                     Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
@@ -269,10 +257,6 @@ public class OpcAsyncTask {
                                             if (Blank.isEmpty(item)) {
                                             if (Blank.isEmpty(item)) {
                                                 continue;
                                                 continue;
                                             }
                                             }
-                                            Integer itemType = item.getItemType();
-                                            if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                                continue;
-                                            }
                                             List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, realIndexList);
                                             List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, realIndexList);
                                             if (Blank.isNotEmpty(cursorRawDataList)) {
                                             if (Blank.isNotEmpty(cursorRawDataList)) {
                                                 Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
                                                 Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
@@ -314,10 +298,6 @@ public class OpcAsyncTask {
                                                     if (Blank.isEmpty(item)) {
                                                     if (Blank.isEmpty(item)) {
                                                         continue;
                                                         continue;
                                                     }
                                                     }
-                                                    Integer itemType = item.getItemType();
-                                                    if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                                        continue;
-                                                    }
                                                     List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, dataIndexList);
                                                     List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, dataIndexList);
                                                     if (Blank.isNotEmpty(cursorRawDataList)) {
                                                     if (Blank.isNotEmpty(cursorRawDataList)) {
                                                         Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
                                                         Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
@@ -361,10 +341,6 @@ public class OpcAsyncTask {
                                                     if (Blank.isEmpty(item)) {
                                                     if (Blank.isEmpty(item)) {
                                                         continue;
                                                         continue;
                                                     }
                                                     }
-                                                    Integer itemType = item.getItemType();
-                                                    if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                                        continue;
-                                                    }
                                                     List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, dataIndexList);
                                                     List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, dataIndexList);
                                                     if (Blank.isNotEmpty(cursorRawDataList)) {
                                                     if (Blank.isNotEmpty(cursorRawDataList)) {
                                                         Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
                                                         Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
@@ -392,10 +368,6 @@ public class OpcAsyncTask {
                                             if (Blank.isEmpty(item)) {
                                             if (Blank.isEmpty(item)) {
                                                 continue;
                                                 continue;
                                             }
                                             }
-                                            Integer itemType = item.getItemType();
-                                            if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                                continue;
-                                            }
                                             ReportTableItem reportTableItem = reportTableDao.getReportTableItem(chTableId, itemId);
                                             ReportTableItem reportTableItem = reportTableDao.getReportTableItem(chTableId, itemId);
                                             List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, realIndexList);
                                             List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, realIndexList);
                                             if (Blank.isNotEmpty(cursorRawDataList)) {
                                             if (Blank.isNotEmpty(cursorRawDataList)) {
@@ -428,10 +400,6 @@ public class OpcAsyncTask {
                                             if (Blank.isEmpty(item)) {
                                             if (Blank.isEmpty(item)) {
                                                 continue;
                                                 continue;
                                             }
                                             }
-                                            Integer itemType = item.getItemType();
-                                            if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                                continue;
-                                            }
                                             ReportTableItem reportTableItem = reportTableDao.getReportTableItem(chTableId, itemId);
                                             ReportTableItem reportTableItem = reportTableDao.getReportTableItem(chTableId, itemId);
                                             List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, oldIndexList);
                                             List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, oldIndexList);
                                             if (Blank.isNotEmpty(cursorRawDataList)) {
                                             if (Blank.isNotEmpty(cursorRawDataList)) {
@@ -465,10 +433,6 @@ public class OpcAsyncTask {
                                                 if (Blank.isEmpty(item)) {
                                                 if (Blank.isEmpty(item)) {
                                                     continue;
                                                     continue;
                                                 }
                                                 }
-                                                Integer itemType = item.getItemType();
-                                                if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                                    continue;
-                                                }
                                                 List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, newIndexList);
                                                 List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, newIndexList);
                                                 if (Blank.isNotEmpty(cursorRawDataList)) {
                                                 if (Blank.isNotEmpty(cursorRawDataList)) {
                                                     Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
                                                     Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
@@ -510,10 +474,6 @@ public class OpcAsyncTask {
                                                         if (Blank.isEmpty(item)) {
                                                         if (Blank.isEmpty(item)) {
                                                             continue;
                                                             continue;
                                                         }
                                                         }
-                                                        Integer itemType = item.getItemType();
-                                                        if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                                            continue;
-                                                        }
                                                         List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, newIndexList);
                                                         List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, newIndexList);
                                                         if (Blank.isNotEmpty(cursorRawDataList)) {
                                                         if (Blank.isNotEmpty(cursorRawDataList)) {
                                                             Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
                                                             Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
@@ -557,10 +517,6 @@ public class OpcAsyncTask {
                                                         if (Blank.isEmpty(item)) {
                                                         if (Blank.isEmpty(item)) {
                                                             continue;
                                                             continue;
                                                         }
                                                         }
-                                                        Integer itemType = item.getItemType();
-                                                        if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                                                            continue;
-                                                        }
                                                         List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, dataIndexList);
                                                         List<CursorRawData> cursorRawDataList = rawDataDao.getEventDataList(itemGroupId, dataSourceId, itemId, dataIndexList);
                                                         if (Blank.isNotEmpty(cursorRawDataList)) {
                                                         if (Blank.isNotEmpty(cursorRawDataList)) {
                                                             Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);
                                                             Map<String, String> map = ReportTask.genEventCursor(cursorRawDataList);

+ 0 - 268
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/ReportTableTask.java

@@ -665,81 +665,11 @@ public class ReportTableTask {
                 String standby = t.getStandby();
                 String standby = t.getStandby();
                 String itemName = t.getItemName();
                 String itemName = t.getItemName();
                 Integer dataSourceId = t.getDataSourceId();
                 Integer dataSourceId = t.getDataSourceId();
-                Integer itemType = t.getItemType();
                 Integer valueTakingMode = t.getValueTakingMode();
                 Integer valueTakingMode = t.getValueTakingMode();
                 Integer valueType = t.getValueType();
                 Integer valueType = t.getValueType();
                 Integer bucketType = t.getBucketType();
                 Integer bucketType = t.getBucketType();
                 Integer bucketValue = t.getBucketValue();
                 Integer bucketValue = t.getBucketValue();
                 boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
                 boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
-                if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                    AttachRawData attachRawData = rawDataDao.getAttachRawData(itemGroupId, dataSourceId, itemName);
-                    String dataType = attachRawData.getDataType();
-                    String pattern = null;
-                    if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
-                        pattern = ConstantStr.TIME_DAY_STR;
-                    } else if (bucketType.equals(ConstantStr.PERIOD_TIME_HOUR)) {
-                        pattern = ConstantStr.TIME_HOUR_STR;
-                    } else if (bucketType.equals(ConstantStr.PERIOD_TIME_MINUTE)) {
-                        pattern = ConstantStr.TIME_MINUTE_STR;
-                    } else if (bucketType.equals(ConstantStr.PERIOD_TIME_SECOND)) {
-                        pattern = ConstantStr.TIME_SECOND_STR;
-                    }
-                    int timeLength = DateUtil.timeDifference(startTime, endTime, pattern, bucketValue);
-                    String dataValueTime = attachRawData.getDataValueTime();
-                    if (dataType.toLowerCase().equals("boolean")) {
-                        List<Boolean> valueList = new ArrayList<>();
-                        List<Boolean> orgValueList = new ArrayList<>();
-                        List<String> valueTimeList = new ArrayList<>();
-                        Boolean dataBoolean = JSON.parseObject(attachRawData.getDataValue(), Boolean.class);
-                        Boolean orgBoolean = JSON.parseObject(attachRawData.getOrgDataValue(), Boolean.class);
-                        for (int i = 0; i < timeLength; i++) {
-                            valueList.add(dataBoolean);
-                            orgValueList.add(orgBoolean);
-                            valueTimeList.add(dataValueTime);
-                        }
-                        reportTableItemList.add(new ReportTableItem(
-                                reportTableId, itemId, valueType, xaxis, yaxis, standby,
-                                flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList), ArrayUtil.listToStr(valueTimeList), null
-                        ));
-                    } else {
-                        try {
-                            List<BigDecimal> valueList = new ArrayList<>();
-                            List<BigDecimal> orgValueList = new ArrayList<>();
-                            List<String> valueTimeList = new ArrayList<>();
-                            BigDecimal dataBigDecimal = JSON.parseObject(attachRawData.getDataValue(), BigDecimal.class);
-                            BigDecimal orgBigDecimal = JSON.parseObject(attachRawData.getOrgDataValue(), BigDecimal.class);
-                            for (int i = 0; i < timeLength; i++) {
-                                valueList.add(dataBigDecimal);
-                                orgValueList.add(orgBigDecimal);
-                                valueTimeList.add(dataValueTime);
-                            }
-                            reportTableItemList.add(new ReportTableItem(
-                                    reportTableId, itemId, valueType, xaxis, yaxis, standby,
-                                    flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList), ArrayUtil.listToStr(valueTimeList), null
-                            ));
-                        } catch (Exception e) {
-                            List<String> valueList = new ArrayList<>();
-                            List<String> orgValueList = new ArrayList<>();
-                            List<String> valueTimeList = new ArrayList<>();
-                            String dataValue = attachRawData.getDataValue();
-                            String orgDataValue = attachRawData.getOrgDataValue();
-                            for (int i = 0; i < timeLength; i++) {
-                                valueList.add(dataValue);
-                                orgValueList.add(orgDataValue);
-                                valueTimeList.add(dataValueTime);
-                            }
-                            reportTableItemList.add(new ReportTableItem(
-                                    reportTableId, itemId, valueType, xaxis, yaxis, standby,
-                                    flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList), ArrayUtil.listToStr(valueTimeList), null
-                            ));
-                        }
-                    }
-                    reportTableItemList.add(new ReportTableItem(
-                            reportTableId, itemId, valueType, xaxis, yaxis, standby,
-                            flage ? attachRawData.getDataValue() : attachRawData.getOrgDataValue(), attachRawData.getDataValueTime(), null
-                    ));
-                    continue;
-                }
                 String valueList = null;
                 String valueList = null;
                 String valueTimeList = null;
                 String valueTimeList = null;
                 String valueIndexList = null;
                 String valueIndexList = null;
@@ -817,72 +747,6 @@ public class ReportTableTask {
                         Integer itemId = ttci.getItemId();
                         Integer itemId = ttci.getItemId();
                         String itemName = ttci.getItemName();
                         String itemName = ttci.getItemName();
                         Integer dataSourceId = ttci.getDataSourceId();
                         Integer dataSourceId = ttci.getDataSourceId();
-                        Integer itemType = ttci.getItemType();
-                        if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                            AttachRawData attachRawData = rawDataDao.getAttachRawData(itemGroupId, dataSourceId, itemName);
-                            String dataType = attachRawData.getDataType();
-                            String pattern = null;
-                            if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
-                                pattern = ConstantStr.TIME_DAY_STR;
-                            } else if (bucketType.equals(ConstantStr.PERIOD_TIME_HOUR)) {
-                                pattern = ConstantStr.TIME_HOUR_STR;
-                            } else if (bucketType.equals(ConstantStr.PERIOD_TIME_MINUTE)) {
-                                pattern = ConstantStr.TIME_MINUTE_STR;
-                            } else if (bucketType.equals(ConstantStr.PERIOD_TIME_SECOND)) {
-                                pattern = ConstantStr.TIME_SECOND_STR;
-                            }
-                            int timeLength = DateUtil.timeDifference(startTime, endTime, pattern, bucketValue);
-                            String dataValueTime = attachRawData.getDataValueTime();
-                            if (dataType.toLowerCase().equals("boolean")) {
-                                List<Boolean> valueList = new ArrayList<>();
-                                List<Boolean> orgValueList = new ArrayList<>();
-                                List<String> valueTimeList = new ArrayList<>();
-                                Boolean dataBoolean = JSON.parseObject(attachRawData.getDataValue(), Boolean.class);
-                                Boolean orgBoolean = JSON.parseObject(attachRawData.getOrgDataValue(), Boolean.class);
-                                for (int i = 0; i < timeLength; i++) {
-                                    valueList.add(dataBoolean);
-                                    orgValueList.add(orgBoolean);
-                                    valueTimeList.add(dataValueTime);
-                                }
-                                reportChartItemList.add(new ReportChartItem(
-                                        reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
-                                        ArrayUtil.listToStr(valueTimeList), null
-                                ));
-                            } else {
-                                try {
-                                    List<BigDecimal> valueList = new ArrayList<>();
-                                    List<BigDecimal> orgValueList = new ArrayList<>();
-                                    List<String> valueTimeList = new ArrayList<>();
-                                    BigDecimal dataBigDecimal = JSON.parseObject(attachRawData.getDataValue(), BigDecimal.class);
-                                    BigDecimal orgBigDecimal = JSON.parseObject(attachRawData.getOrgDataValue(), BigDecimal.class);
-                                    for (int i = 0; i < timeLength; i++) {
-                                        valueList.add(dataBigDecimal);
-                                        orgValueList.add(orgBigDecimal);
-                                        valueTimeList.add(dataValueTime);
-                                    }
-                                    reportChartItemList.add(new ReportChartItem(
-                                            reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
-                                            ArrayUtil.listToStr(valueTimeList), null
-                                    ));
-                                } catch (Exception e) {
-                                    List<String> valueList = new ArrayList<>();
-                                    List<String> orgValueList = new ArrayList<>();
-                                    List<String> valueTimeList = new ArrayList<>();
-                                    String dataValue = attachRawData.getDataValue();
-                                    String orgDataValue = attachRawData.getOrgDataValue();
-                                    for (int i = 0; i < timeLength; i++) {
-                                        valueList.add(dataValue);
-                                        orgValueList.add(orgDataValue);
-                                        valueTimeList.add(dataValueTime);
-                                    }
-                                    reportChartItemList.add(new ReportChartItem(
-                                            reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
-                                            ArrayUtil.listToStr(valueTimeList), null
-                                    ));
-                                }
-                            }
-                            continue;
-                        }
                         String valueList = null;
                         String valueList = null;
                         String valueTimeList = null;
                         String valueTimeList = null;
                         String valueIndexList = null;
                         String valueIndexList = null;
@@ -1048,77 +912,11 @@ public class ReportTableTask {
                 String standby = t.getStandby();
                 String standby = t.getStandby();
                 String itemName = t.getItemName();
                 String itemName = t.getItemName();
                 Integer dataSourceId = t.getDataSourceId();
                 Integer dataSourceId = t.getDataSourceId();
-                Integer itemType = t.getItemType();
                 Integer valueTakingMode = t.getValueTakingMode();
                 Integer valueTakingMode = t.getValueTakingMode();
                 Integer valueType = t.getValueType();
                 Integer valueType = t.getValueType();
                 Integer bucketType = t.getBucketType();
                 Integer bucketType = t.getBucketType();
                 Integer bucketValue = t.getBucketValue();
                 Integer bucketValue = t.getBucketValue();
                 boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
                 boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
-                if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                    AttachRawData attachRawData = rawDataDao.getAttachRawData(itemGroupId, dataSourceId, itemName);
-                    String dataType = attachRawData.getDataType();
-                    String pattern = null;
-                    if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
-                        pattern = ConstantStr.TIME_DAY_STR;
-                    } else if (bucketType.equals(ConstantStr.PERIOD_TIME_HOUR)) {
-                        pattern = ConstantStr.TIME_HOUR_STR;
-                    } else if (bucketType.equals(ConstantStr.PERIOD_TIME_MINUTE)) {
-                        pattern = ConstantStr.TIME_MINUTE_STR;
-                    } else if (bucketType.equals(ConstantStr.PERIOD_TIME_SECOND)) {
-                        pattern = ConstantStr.TIME_SECOND_STR;
-                    }
-                    int timeLength = DateUtil.timeDifference(startTime, endTime, pattern, bucketValue);
-                    String dataValueTime = attachRawData.getDataValueTime();
-                    if (dataType.toLowerCase().equals("boolean")) {
-                        List<Boolean> valueList = new ArrayList<>();
-                        List<Boolean> orgValueList = new ArrayList<>();
-                        List<String> valueTimeList = new ArrayList<>();
-                        Boolean dataBoolean = JSON.parseObject(attachRawData.getDataValue(), Boolean.class);
-                        Boolean orgBoolean = JSON.parseObject(attachRawData.getOrgDataValue(), Boolean.class);
-                        for (int i = 0; i < timeLength; i++) {
-                            valueList.add(dataBoolean);
-                            orgValueList.add(orgBoolean);
-                            valueTimeList.add(dataValueTime);
-                        }
-                        reportTableDao.addReportTableItem(new ReportTableItem(
-                                id, itemId, valueType, xaxis, yaxis, standby,
-                                flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList), ArrayUtil.listToStr(valueTimeList), null
-                        ));
-                    } else {
-                        try {
-                            List<BigDecimal> valueList = new ArrayList<>();
-                            List<BigDecimal> orgValueList = new ArrayList<>();
-                            List<String> valueTimeList = new ArrayList<>();
-                            BigDecimal dataBigDecimal = JSON.parseObject(attachRawData.getDataValue(), BigDecimal.class);
-                            BigDecimal orgBigDecimal = JSON.parseObject(attachRawData.getOrgDataValue(), BigDecimal.class);
-                            for (int i = 0; i < timeLength; i++) {
-                                valueList.add(dataBigDecimal);
-                                orgValueList.add(orgBigDecimal);
-                                valueTimeList.add(dataValueTime);
-                            }
-                            reportTableDao.addReportTableItem(new ReportTableItem(
-                                    id, itemId, valueType, xaxis, yaxis, standby,
-                                    flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList), ArrayUtil.listToStr(valueTimeList), null
-                            ));
-                        } catch (Exception e) {
-                            List<String> valueList = new ArrayList<>();
-                            List<String> orgValueList = new ArrayList<>();
-                            List<String> valueTimeList = new ArrayList<>();
-                            String dataValue = attachRawData.getDataValue();
-                            String orgDataValue = attachRawData.getOrgDataValue();
-                            for (int i = 0; i < timeLength; i++) {
-                                valueList.add(dataValue);
-                                orgValueList.add(orgDataValue);
-                                valueTimeList.add(dataValueTime);
-                            }
-                            reportTableDao.addReportTableItem(new ReportTableItem(
-                                    id, itemId, valueType, xaxis, yaxis, standby,
-                                    flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList), ArrayUtil.listToStr(valueTimeList), null
-                            ));
-                        }
-                    }
-                    continue;
-                }
                 String valueList = null;
                 String valueList = null;
                 String valueTimeList = null;
                 String valueTimeList = null;
                 String valueIndexList = null;
                 String valueIndexList = null;
@@ -1194,72 +992,6 @@ public class ReportTableTask {
                         Integer itemId = ttci.getItemId();
                         Integer itemId = ttci.getItemId();
                         String itemName = ttci.getItemName();
                         String itemName = ttci.getItemName();
                         Integer dataSourceId = ttci.getDataSourceId();
                         Integer dataSourceId = ttci.getDataSourceId();
-                        Integer itemType = ttci.getItemType();
-                        if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
-                            AttachRawData attachRawData = rawDataDao.getAttachRawData(itemGroupId, dataSourceId, itemName);
-                            String dataType = attachRawData.getDataType();
-                            String pattern = null;
-                            if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
-                                pattern = ConstantStr.TIME_DAY_STR;
-                            } else if (bucketType.equals(ConstantStr.PERIOD_TIME_HOUR)) {
-                                pattern = ConstantStr.TIME_HOUR_STR;
-                            } else if (bucketType.equals(ConstantStr.PERIOD_TIME_MINUTE)) {
-                                pattern = ConstantStr.TIME_MINUTE_STR;
-                            } else if (bucketType.equals(ConstantStr.PERIOD_TIME_SECOND)) {
-                                pattern = ConstantStr.TIME_SECOND_STR;
-                            }
-                            int timeLength = DateUtil.timeDifference(startTime, endTime, pattern, bucketValue);
-                            String dataValueTime = attachRawData.getDataValueTime();
-                            if (dataType.toLowerCase().equals("boolean")) {
-                                List<Boolean> valueList = new ArrayList<>();
-                                List<Boolean> orgValueList = new ArrayList<>();
-                                List<String> valueTimeList = new ArrayList<>();
-                                Boolean dataBoolean = JSON.parseObject(attachRawData.getDataValue(), Boolean.class);
-                                Boolean orgBoolean = JSON.parseObject(attachRawData.getOrgDataValue(), Boolean.class);
-                                for (int j = 0; j < timeLength; j++) {
-                                    valueList.add(dataBoolean);
-                                    orgValueList.add(orgBoolean);
-                                    valueTimeList.add(dataValueTime);
-                                }
-                                reportChartItemList.add(new ReportChartItem(
-                                        reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
-                                        ArrayUtil.listToStr(valueTimeList), null
-                                ));
-                            } else {
-                                try {
-                                    List<BigDecimal> valueList = new ArrayList<>();
-                                    List<BigDecimal> orgValueList = new ArrayList<>();
-                                    List<String> valueTimeList = new ArrayList<>();
-                                    BigDecimal dataBigDecimal = JSON.parseObject(attachRawData.getDataValue(), BigDecimal.class);
-                                    BigDecimal orgBigDecimal = JSON.parseObject(attachRawData.getOrgDataValue(), BigDecimal.class);
-                                    for (int j = 0; j < timeLength; j++) {
-                                        valueList.add(dataBigDecimal);
-                                        orgValueList.add(orgBigDecimal);
-                                        valueTimeList.add(dataValueTime);
-                                    }
-                                    reportChartItemList.add(new ReportChartItem(
-                                            reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
-                                            ArrayUtil.listToStr(valueTimeList), null
-                                    ));
-                                } catch (Exception e) {
-                                    List<String> valueList = new ArrayList<>();
-                                    List<String> orgValueList = new ArrayList<>();
-                                    List<String> valueTimeList = new ArrayList<>();
-                                    String dataValue = attachRawData.getDataValue();
-                                    String orgDataValue = attachRawData.getOrgDataValue();
-                                    for (int j = 0; j < timeLength; j++) {
-                                        valueList.add(dataValue);
-                                        orgValueList.add(orgDataValue);
-                                        valueTimeList.add(dataValueTime);
-                                    }
-                                    reportChartItemList.add(new ReportChartItem(
-                                            reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
-                                            ArrayUtil.listToStr(valueTimeList), null
-                                    ));
-                                }
-                            }
-                            continue;
-                        }
                         String valueList = null;
                         String valueList = null;
                         String valueTimeList = null;
                         String valueTimeList = null;
                         String valueIndexList = null;
                         String valueIndexList = null;

+ 32 - 12
chaunyi_opc/opc_da/src/main/resources/mapper/ItemGroupDao.xml

@@ -134,8 +134,12 @@
         select
         select
         <include refid="itemGroup"/>
         <include refid="itemGroup"/>
         from t_item_group
         from t_item_group
+        where 1=1
         <if test="userId != null and userId != ''">
         <if test="userId != null and userId != ''">
-            where user_id = #{userId}
+            AND user_id = #{userId}
+        </if>
+        <if test="readMode != null and readMode != ''">
+            AND read_mode = #{readMode}
         </if>
         </if>
     </select>
     </select>
 
 
@@ -150,19 +154,22 @@
 
 
     <select id="getItemListByGroupId" resultType="com.example.opc_common.entity.Item">
     <select id="getItemListByGroupId" resultType="com.example.opc_common.entity.Item">
         select ti.id,
         select ti.id,
-               ti.item_group_id,
-               ti.item_name,
-               ti.item_read_name,
-               ti.item_type,
-               ti.node_index,
-               ti.data_type,
-               ti.`describe`,
-               ti.data_model_id,
-               ti.is_driver_item,
-               tdm.operation_rule
+        ti.item_group_id,
+        ti.item_name,
+        ti.item_read_name,
+        ti.item_type,
+        ti.node_index,
+        ti.data_type,
+        ti.`describe`,
+        ti.data_model_id,
+        ti.is_driver_item,
+        tdm.operation_rule
         FROM t_item ti
         FROM t_item ti
-                 LEFT JOIN t_data_model tdm ON ti.data_model_id = tdm.id
+        LEFT JOIN t_data_model tdm ON ti.data_model_id = tdm.id
         where ti.item_group_id = #{itemGroupId}
         where ti.item_group_id = #{itemGroupId}
+        <if test="itemType != null and itemType != ''">
+            and ti.item_type = #{itemType}
+        </if>
         order by ti.is_driver_item DESC, ti.item_name
         order by ti.is_driver_item DESC, ti.item_name
     </select>
     </select>
 
 
@@ -247,4 +254,17 @@
         order by ti.is_driver_item DESC, ti.item_name
         order by ti.is_driver_item DESC, ti.item_name
     </select>
     </select>
 
 
+    <select id="getAllItemGroup1" resultType="com.example.opc_common.entity.ItemGroup">
+        select
+        <include refid="itemGroup"/>
+        from t_item_group
+        where 1=1
+        <if test="userId != null and userId != ''">
+            AND user_id = #{userId}
+        </if>
+        <if test="readMode != null and readMode != ''">
+            AND read_mode &lt;&gt; #{readMode}
+        </if>
+    </select>
+
 </mapper>
 </mapper>