Parcourir la source

Merge branch 'master' of http://116.63.33.55/git/read_opc

Zt il y a 1 an
Parent
commit
86681cecd4

+ 4 - 0
chaunyi_opc/opc_common/src/main/java/com/example/opc_common/entity/ReportTableItem.java

@@ -24,6 +24,10 @@ public class ReportTableItem implements Serializable {
      */
     private String itemName;
     /**
+     * 数据项名,虚拟字段
+     */
+    private String itemReadName;
+    /**
      * 数据项备注,虚拟字段
      */
     private String describe;

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

@@ -4,10 +4,9 @@ import com.example.opc_common.entity.DataSource;
 import com.example.opc_common.entity.DataSourceType;
 import com.example.opc_common.entity.ItemGroup;
 import com.example.opc_common.entity.ReportTable;
-import com.example.opc_common.enums.ResultEnum;
-import com.example.opc_common.exception.CustomException;
 import com.example.opc_common.util.Blank;
 import com.example.opc_common.util.ConstantStr;
+import com.example.opc_common.util.DateUtil;
 import com.example.opc_common.util.OpcUtil;
 import com.example.opc_da.dao.DataSourceDao;
 import com.example.opc_da.dao.ItemGroupDao;
@@ -17,6 +16,8 @@ import com.example.opc_da.task.ReportTableTask;
 import com.example.opc_da.util.OpcDaUtil;
 import com.example.opc_da.util.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.openscada.opc.lib.da.Server;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.SchedulingConfigurer;
 import org.springframework.scheduling.config.ScheduledTaskRegistrar;
@@ -42,6 +43,9 @@ public class DynamicScheduleConfig implements SchedulingConfigurer {
     @Resource
     private CronTaskRegister cronTaskRegister;
 
+    @Autowired
+    private OpcDaTask opcDaTask;
+
     @Resource
     private RedisUtil redisUtil;
 
@@ -65,28 +69,66 @@ public class DynamicScheduleConfig implements SchedulingConfigurer {
         if (Blank.isNotEmpty(itemGroupList)) {
             for (ItemGroup itemGroup : itemGroupList) {
                 String readWeek = itemGroup.getReadWeek();
+                Integer id = itemGroup.getId();
                 DataSource dataSource = DataSource.convertPassword(dataSourceDao.getDataSourceById(itemGroup.getDataSourceId()));
                 String clsId = dataSource.getClsId().toUpperCase();
                 DataSourceType dataSourceType = dataSourceDao.getDataSourceTypeById(dataSource.getTypeId());
                 if (OpcUtil.isOpcDa(dataSourceType.getDataSourceTypeKey())) {
                     if (itemGroup.getRunState() == ConstantStr.START_UP || itemGroup.getRunState() == ConstantStr.EXCEPT_STOP_UP) {
                         if (Blank.isEmpty(dataSource.getIpAddress(), dataSource.getIpUserName(), dataSource.getIpPassword())) {
-                            throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组配置的数据源的ip地址,帐户,密码都不能为空");
+                            //如果数据组配置的数据源的ip地址,帐户,密码其中一个为空,直接关停数据组
+                            itemGroupDao.stopItemGroupById(id, ConstantStr.STOP_IT);
+                            redisUtil.del(ConstantStr.ITEM_GROUP + id);
                         }
-                        Integer id = itemGroup.getId();
                         if (OpcDaUtil.isAdapterClsId(clsId)) {
-                            redisUtil.set(ConstantStr.ITEM_GROUP + id, true);
+                            //如果opc服务未启动,数据组连接不上,直接将这个数据组设为停止状态
+                            //如果opc服务启动好了,数据组连接不上,直接将数据组设置为停止状态
+                            //如果opc服务启动好了,我们能连接上,将数据组设置为启动状态,并重新运行
+                            Server server = null;
+                            try {
+                                server = OpcDaUtil.createServer(dataSource);
+                                if (Blank.isEmpty(server)) {
+                                    itemGroupDao.stopItemGroupById(id, ConstantStr.STOP_IT);
+                                    redisUtil.del(ConstantStr.ITEM_GROUP + id);
+                                    continue;
+                                }
+                                server.connect();
+                            } catch (Exception e) {
+                                itemGroupDao.stopItemGroupById(id, ConstantStr.STOP_IT);
+                                redisUtil.del(ConstantStr.ITEM_GROUP + id);
+                                continue;
+                            } finally {
+                                if (Blank.isNotEmpty(server)) {
+                                    server.dispose();
+                                }
+                            }
                             //新增定时器任务
-                            String cron = "0 0 0 ? * " +
-                                    (Blank.isEmpty(readWeek) ? "MON,TUE,WED,THU,FRI,SAT,SUN" : itemGroup.getReadWeek());
                             String cronId = Blank.isEmpty(itemGroup.getCronId()) ?
                                     UUID.randomUUID().toString().replace("-", "") :
                                     itemGroup.getCronId();
+                            String cron = "0 0 0 ? * ";
+                            if (Blank.isEmpty(readWeek)) {
+                                cron = cron + "MON,TUE,WED,THU,FRI,SAT,SUN";
+                                //立即执行一次Timer
+                                opcDaTask.opcDaTask(itemGroup, dataSource, cronId);
+                            } else {
+                                cron = cron + readWeek;
+                                for (String str : readWeek.split(",")) {
+                                    if (str.equals(DateUtil.getCurrentWeekEn())) {
+                                        //立即执行一次Timer
+                                        opcDaTask.opcDaTask(itemGroup, dataSource, cronId);
+                                        break;
+                                    }
+                                }
+                            }
                             SchedulingRunnable task = new SchedulingRunnable(OpcDaTask.class, "opcDaTask", new Object[]{itemGroup, dataSource, cronId});
                             cronTaskRegister.addCronTask(task, cronId, cron);
                             itemGroupDao.runItemGroupById(id, ConstantStr.START_UP, cronId);
+                            redisUtil.set(ConstantStr.ITEM_GROUP + id, true);
                         } else {
-                            throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "目前未适配此种驱动类型");
+                            //如果目前未适配此种驱动类型,直接关停数据组
+                            itemGroupDao.stopItemGroupById(id, ConstantStr.STOP_IT);
+                            redisUtil.del(ConstantStr.ITEM_GROUP + id);
                         }
                     }
                 }

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

@@ -143,11 +143,11 @@ public class ItemGroupServiceImpl implements ItemGroupService {
             if (Blank.isNotEmpty(itemList1)) {
                 Long tttiCount = reportTableDao.getTttiCountByItemId(itemList1);
                 if (tttiCount > 0) {
-                    return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组在报表中配置了相应的数据项无法删除");
+                    return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组在报表中配置了相应的数据项无法修改");
                 }
                 Long ttciCount =reportTableDao.getTtciCountByItemId(itemList1);
                 if (ttciCount > 0) {
-                    return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组在报表中配置了相应的数据项无法删除");
+                    return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组在报表中配置了相应的数据项无法修改");
                 }
             }
             List<Item> itemList = itemGroup.getItemList();

+ 36 - 8
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/AsyncAsyncTask.java

@@ -32,12 +32,13 @@ public class AsyncAsyncTask {
 
     /**
      * 通过主报表,生成子报表
+     *
      * @param reportTable
      * @param chReportTableId
      * @param reportTableType
      * @param sum
      */
-    public void addHaveKeyChReport(ReportTable reportTable, String chReportTableId,Integer reportTableType,Integer sum) {
+    public void addHaveKeyChReport(ReportTable reportTable, String chReportTableId, Integer reportTableType, Integer sum) {
         Date date = new Date();
         ReportTable chReportTable = new ReportTable(chReportTableId,
                 reportTableType, reportTable.getTableTemplateId(), reportTable.getUserId(),
@@ -46,10 +47,10 @@ public class AsyncAsyncTask {
         );
         reportTableDao.addHaveKeyReport(chReportTable);
         //添加新的子报表的日志和用户组(使用异步节约时间)
-        addLogAndUserGroup(reportTable.getId(),chReportTableId, reportTable.getUserGroupList());
+        addLogAndUserGroup(reportTable.getId(), chReportTableId, reportTable.getUserGroupList());
     }
 
-    public void addHaveKeyReport(TableTemplate tableTemplate,String id){
+    public void addHaveKeyReport(TableTemplate tableTemplate, String id) {
         ReportTable reportTable = new ReportTable(id,
                 tableTemplate.getTemplateType(), tableTemplate.getId(), tableTemplate.getUserId(), tableTemplate.getTemplateName(),
                 tableTemplate.getTemplateData(), ConstantStr.DEFAULT_VERSION, tableTemplate.getCreateTime()
@@ -57,18 +58,45 @@ public class AsyncAsyncTask {
         reportTableDao.addHaveKeyReport(reportTable);
     }
 
+    /**
+     * 如果数据库有此数据项信息,则更新,否则新增
+     *
+     * @param reportTableItem
+     */
+    public void addReportTableItem(ReportTableItem reportTableItem) {
+        if (Blank.isNotEmpty(reportTableItem)) {
+            String reportTableId = reportTableItem.getReportTableId();
+            Integer itemId = reportTableItem.getItemId();
+            Integer timeItemType = reportTableItem.getTimeItemType();
+            ReportTableItem isExistReportTableItem = reportTableDao.getReportTableItem(reportTableId, itemId, timeItemType);
+            if (Blank.isEmpty(isExistReportTableItem)) {
+                reportTableDao.addReportTableItem(reportTableItem);
+            } else {
+                reportTableDao.updateReportTableItem(new ReportTableItem(isExistReportTableItem.getId(),
+                        reportTableItem.getValueList(), reportTableItem.getValueTimeList(), reportTableItem.getValueIndexList()));
+            }
+        }
+    }
 
     /**
      * 设备报表数据增量速度不高,数据每次过来,
+     *
      * @param reportTableItemList
      */
     public void addReportTableItemList(List<ReportTableItem> reportTableItemList) {
         if (Blank.isNotEmpty(reportTableItemList)) {
-//            for (ReportTableItem reportTableItem:reportTableItemList
-//                 ) {
-//
-//            }
-            reportTableDao.addReportTableItemList(reportTableItemList);
+            for (ReportTableItem reportTableItem : reportTableItemList) {
+                String reportTableId = reportTableItem.getReportTableId();
+                Integer itemId = reportTableItem.getItemId();
+                Integer timeItemType = reportTableItem.getTimeItemType();
+                ReportTableItem isExistReportTableItem = reportTableDao.getReportTableItem(reportTableId, itemId, timeItemType);
+                if (Blank.isEmpty(isExistReportTableItem)) {
+                    reportTableDao.addReportTableItem(reportTableItem);
+                } else {
+                    reportTableDao.updateReportTableItem(new ReportTableItem(isExistReportTableItem.getId(),
+                            reportTableItem.getValueList(), reportTableItem.getValueTimeList(), reportTableItem.getValueIndexList()));
+                }
+            }
         }
     }
 

+ 39 - 10
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/OpcAsyncTask.java

@@ -7,6 +7,7 @@ import com.example.opc_common.enums.ResultEnum;
 import com.example.opc_common.exception.CustomException;
 import com.example.opc_common.util.Blank;
 import com.example.opc_common.util.ConstantStr;
+import com.example.opc_common.util.DateUtil;
 import com.example.opc_da.dao.ItemGroupDao;
 import com.example.opc_da.dao.RawDataDao;
 import com.example.opc_da.dao.ReportTableDao;
@@ -490,11 +491,12 @@ public class OpcAsyncTask {
     public ReportTableItem genDeviceItem(Integer tableTemplateId, String itemReadName, String dataValue, String dataTime, Long index, Integer timeItemType) {
         if (Blank.isNotEmpty(timeItemType)) {
             ReportTableItem reportTableItem =
-                    (ReportTableItem) redisUtil.get(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + itemReadName + timeItemType);
+                    (ReportTableItem) redisUtil.get(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + itemReadName + ConstantStr.REPORT_TABLE_ITEM + timeItemType);
             reportTableItem.setValueList(reportTableItem.getValueList() + "," + dataValue);
             reportTableItem.setValueTimeList(reportTableItem.getValueTimeList() + "," + dataTime);
             reportTableItem.setValueIndexList(reportTableItem.getValueIndexList() + "," + index);
-            redisUtil.set(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + itemReadName + timeItemType, reportTableItem);
+            asyncAsyncTask.addReportTableItem(reportTableItem);
+            redisUtil.set(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + itemReadName + ConstantStr.REPORT_TABLE_ITEM + timeItemType, reportTableItem);
             return reportTableItem;
         } else {
             ReportTableItem reportTableItem =
@@ -502,11 +504,13 @@ public class OpcAsyncTask {
             reportTableItem.setValueList(reportTableItem.getValueList() + "," + dataValue);
             reportTableItem.setValueTimeList(reportTableItem.getValueTimeList() + "," + dataTime);
             reportTableItem.setValueIndexList(reportTableItem.getValueIndexList() + "," + index);
+            asyncAsyncTask.addReportTableItem(reportTableItem);
             redisUtil.set(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + itemReadName, reportTableItem);
             return reportTableItem;
         }
     }
 
+    //设备报表因为开关变化一次时间很长,所以redis中数据如果更新,考虑将数据更新到数据库,防止数据丢失
     public void packDeviceTable(List<CursorRawData> cursorRawDataList, List<TableTemplate> tableTemplateList,
                                 Map<Integer, Map<String, TableTemplateTableItem>> ttIdMap, Map<Integer, String> itemReadMap,
                                 Map<Integer, ReportTable> reportTableMap, Long index) {
@@ -518,6 +522,9 @@ public class OpcAsyncTask {
                 Integer eventNum = tableTemplate.getEventNum();
                 Integer tableTemplateId = tableTemplate.getId();
                 String startItemName = itemReadMap.get(startItemId);
+                Integer endItemId = tableTemplate.getEndItemId();
+                String endValue = tableTemplate.getEndValue();
+                String endItemName = itemReadMap.get(endItemId);
                 //获取开始数据项的数据
                 CursorRawData startCrData = dataMap.get(startItemName);
                 //如果开始数据项的数据等于,设定的开始值
@@ -535,6 +542,17 @@ public class OpcAsyncTask {
                     }
                     //如果开始时间的长度和结束时间的长度一样,则符合添加开始时间
                     if (startNum == endNum) {
+                        //将异常的数据去掉
+                        ReportTableItem endReportTableItem =
+                                (ReportTableItem) redisUtil.get(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + endItemName + ConstantStr.REPORT_TABLE_ITEM + ConstantStr.END_TIME_ITEM);
+                        if (Blank.isNotEmpty(endReportTableItem)) {
+                            //获取到结束时间最后一个时间项
+                            String valueTimeList = endReportTableItem.getValueTimeList();
+                            String[] split = valueTimeList.split(",");
+                            if ((DateUtil.strYmdhmssChangeDate(startCrData.getDataValueTime()).getTime() - DateUtil.strYmdhmssChangeDate(split[split.length - 1]).getTime()) < 10000) {
+                                continue;
+                            }
+                        }
                         //如果值为0,则需要新增一张报表
                         if (startNum == 0) {
                             //获取此模板的主报表
@@ -552,7 +570,8 @@ public class OpcAsyncTask {
                                     id, startItemId, tttItem.getItemName(), tttItem.getDescribe(), ConstantStr.START_TIME_ITEM, tttItem.getValueType(), tttItem.getXaxis(), tttItem.getYaxis(),
                                     tttItem.getStandby(), startValue, startCrData.getDataValueTime(), index.toString()
                             );
-                            redisUtil.set(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + startItemName + ConstantStr.START_TIME_ITEM, reportTableItem);
+                            asyncAsyncTask.addReportTableItem(reportTableItem);
+                            redisUtil.set(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + startItemName + ConstantStr.REPORT_TABLE_ITEM + ConstantStr.START_TIME_ITEM, reportTableItem);
                         } else {
                             //开始时间长度不为0,则长度加1,更新开始时间项在redis中的值
                             redisUtil.set(ConstantStr.START_NUM + tableTemplateId, startNum + 1);
@@ -562,9 +581,6 @@ public class OpcAsyncTask {
                         }
                     }
                 }
-                Integer endItemId = tableTemplate.getEndItemId();
-                String endValue = tableTemplate.getEndValue();
-                String endItemName = itemReadMap.get(endItemId);
                 //获取结束数据项的数据
                 CursorRawData endCrData = dataMap.get(endItemName);
                 if (endCrData.getDataValue().equals(endValue)) {
@@ -581,6 +597,17 @@ public class OpcAsyncTask {
                     }
                     //如果开始时间的长度大于结束时间的长度,才满足添加结束时间
                     if (startNum > endNum) {
+                        //将异常的数据去掉
+                        ReportTableItem startReportTableItem =
+                                (ReportTableItem) redisUtil.get(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + startItemName + ConstantStr.REPORT_TABLE_ITEM + ConstantStr.START_TIME_ITEM);
+                        if (Blank.isNotEmpty(startReportTableItem)) {
+                            //获取到结束时间最后一个时间项
+                            String valueTimeList = startReportTableItem.getValueTimeList();
+                            String[] split = valueTimeList.split(",");
+                            if ((DateUtil.strYmdhmssChangeDate(endCrData.getDataValueTime()).getTime() - DateUtil.strYmdhmssChangeDate(split[split.length - 1]).getTime()) < 10000) {
+                                continue;
+                            }
+                        }
                         //如果结束的长度为0,则为结束时间项
                         if (endNum == 0) {
                             //获取子报表中的报表主键
@@ -596,7 +623,8 @@ public class OpcAsyncTask {
                                                 id, endItemId, tttItem.getItemName(), tttItem.getDescribe(), ConstantStr.END_TIME_ITEM, tttItem.getValueType(), tttItem.getXaxis(), tttItem.getYaxis(),
                                                 tttItem.getStandby(), endValue, endCrData.getDataValueTime(), index.toString()
                                         );
-                                        redisUtil.set(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + endItemName + ConstantStr.END_TIME_ITEM, reportTableItem);
+                                        asyncAsyncTask.addReportTableItem(reportTableItem);
+                                        redisUtil.set(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + endItemName + ConstantStr.REPORT_TABLE_ITEM + ConstantStr.END_TIME_ITEM, reportTableItem);
                                     }
                                 } else {
                                     //更新redis中其他数据项信息
@@ -606,6 +634,7 @@ public class OpcAsyncTask {
                                             id, tttItem.getItemId(), tttItem.getItemName(), tttItem.getDescribe(), null, tttItem.getValueType(), tttItem.getXaxis(), tttItem.getYaxis(),
                                             tttItem.getStandby(), cursorRawData.getDataValue(), cursorRawData.getDataValueTime(), index.toString()
                                     );
+                                    asyncAsyncTask.addReportTableItem(reportTableItem);
                                     redisUtil.set(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + tttItem.getItemReadName(), reportTableItem);
                                 }
                             }
@@ -625,7 +654,7 @@ public class OpcAsyncTask {
                                             reportTableItemList.add(reportTableItem);
                                         } else if (timeItemType.equals(ConstantStr.START_TIME_ITEM)) {
                                             //获取redis中开始时间项信息
-                                            reportTableItemList.add((ReportTableItem) redisUtil.get(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + startItemName + ConstantStr.START_TIME_ITEM));
+                                            reportTableItemList.add((ReportTableItem) redisUtil.get(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + startItemName + ConstantStr.REPORT_TABLE_ITEM + ConstantStr.START_TIME_ITEM));
                                         }
                                     } else {
                                         //更新redis中其他数据项信息
@@ -639,8 +668,8 @@ public class OpcAsyncTask {
                                 //将所有数据项信息存入到数据库
                                 asyncAsyncTask.addReportTableItemList(reportTableItemList);
 
-                                redisUtil.set(ConstantStr.START_NUM + tableTemplateId, 0);
-                                redisUtil.set(ConstantStr.END_NUM + tableTemplateId, 0);
+                                redisUtil.del(ConstantStr.START_NUM + tableTemplateId);
+                                redisUtil.del(ConstantStr.END_NUM + tableTemplateId);
                                 redisUtil.del(ConstantStr.TABLE_ID + tableTemplateId);
                                 //将数据存入数据库归档,删除相应redis的值,并将数据存入数据库
                             } else {

+ 46 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/task/OpcDaTask.java

@@ -82,6 +82,52 @@ public class OpcDaTask {
             Map<String, DataModel> basicMap = DataModel.genMap(basicItemList, dmBasicItemList);
             //查看此数据组是否在设备报表中被配置
             List<TableTemplate> tableTemplateList = reportTableDao.getDeviceTtByItemList(basicItemList, ConstantStr.DEVICE_REPORT);
+            if (Blank.isNotEmpty(tableTemplateList)) {
+                for (TableTemplate tableTemplate : tableTemplateList) {
+                    Integer tableTemplateId = tableTemplate.getId();
+                    Integer eventNum = tableTemplate.getEventNum();
+                    //根据模板id查询出最新一条的设备报表
+                    ReportTable reportTable = reportTableDao.getReportTableByTemplate(tableTemplate);
+                    String chTableId = reportTableDao.getEventChTableId(reportTable.getId());
+                    if (Blank.isNotEmpty(chTableId)) {
+                        ReportTable chReportTable = reportTableDao.getReportTableById(chTableId);
+                        List<ReportTableItem> chReportTableItemList = reportTableDao.getTableItemListById(chTableId);
+                        if (Blank.isNotEmpty(chReportTableItemList)) {
+                            for (ReportTableItem reportTableItem : chReportTableItemList) {
+                                Integer timeItemType = reportTableItem.getTimeItemType();
+                                String itemReadName = reportTableItem.getItemReadName();
+                                if (Blank.isNotEmpty(timeItemType)) {
+                                    if (timeItemType.equals(ConstantStr.END_TIME_ITEM)) {
+                                        String valueIndexList = reportTableItem.getValueIndexList();
+                                        int length = valueIndexList.split(",").length;
+                                        if (eventNum == length) {
+                                            redisUtil.set(ConstantStr.START_NUM + tableTemplateId,0);
+                                        } else {
+                                            redisUtil.set(ConstantStr.END_NUM + tableTemplateId, length);
+                                            redisUtil.set(ConstantStr.TABLE_ID + tableTemplateId, chTableId);
+                                        }
+                                    }
+                                    if (timeItemType.equals(ConstantStr.START_TIME_ITEM)) {
+                                        String valueIndexList = reportTableItem.getValueIndexList();
+                                        int length = valueIndexList.split(",").length;
+                                        if (eventNum == length) {
+                                            Object start0 = redisUtil.get(ConstantStr.START_NUM + tableTemplateId);
+                                            if (Blank.isEmpty(start0)) {
+                                                redisUtil.set(ConstantStr.START_NUM + tableTemplateId, length);
+                                            }
+                                        } else {
+                                            redisUtil.set(ConstantStr.START_NUM + tableTemplateId, length);
+                                        }
+                                    }
+                                    redisUtil.set(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + itemReadName + ConstantStr.REPORT_TABLE_ITEM + timeItemType, reportTableItem);
+                                } else {
+                                    redisUtil.set(tableTemplateId + ConstantStr.REPORT_TABLE_ITEM + itemReadName, reportTableItem);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
             List<ReportTable> reportTableList = new ArrayList<>();
             if (Blank.isNotEmpty(tableTemplateList)) {
                 reportTableList = reportTableDao.getDeviceRtByttList(tableTemplateList, ConstantStr.DEVICE_REPORT);

+ 1 - 0
chaunyi_opc/opc_da/src/main/resources/mapper/ReportTableDao.xml

@@ -770,6 +770,7 @@
              , trti.time_item_type
              , trti.value_type
              , ti.item_name
+             , ti.item_read_name
              , ti.describe
              , trti.xaxis
              , trti.yaxis