Browse Source

Merge branch 'master' of http://116.63.33.55/git/industry-data-platform

lry 1 year ago
parent
commit
046924da5c

+ 30 - 0
industry-admin/src/api/source/itemGroup.js

@@ -31,6 +31,22 @@ export function getItemGroupById(id) {
 }
 
 /**
+ * 通过组id和项名称,分页模糊查询组下数据信息
+ * @param {*} query
+ * @returns
+ */
+export function getItemValuePageByGroupId(query) {
+  return request({
+    url: '/itemGroup/getItemValuePageByGroupId',
+    headers: {
+      isToken: true
+    },
+    method: 'get',
+    params: query
+  })
+}
+
+/**
  * 删除组配置
  * @param id
  * @returns {AxiosPromise}
@@ -59,6 +75,20 @@ export function getItemValueById(id) {
 }
 
 /**
+ * 查看数据组的实时数据
+ */
+export function getItemValueByIds(data) {
+  return request({
+    url: '/itemGroup/getItemValueByIds',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data
+  })
+}
+
+/**
  * 删除数据组中数据项
  * @param data
  * @returns {AxiosPromise}

+ 80 - 104
industry-admin/src/views/source/itemGroup/item.vue

@@ -4,10 +4,10 @@
         <el-dialog :title="title" width="80%" custom-class="dialog-max" top="10vh" :before-close="dialogClose"
             :visible.sync="visible" @open="dialogOpen" @close="dialogClose">
             <div style="margin-bottom: 10px;">
-                <el-input placeholder="请输入点位名称" v-model="filterItemText" size="mini" style="width: 200px;"
-                    @input="itemChangeEvent" prefix-icon="el-icon-search">
+                <el-input placeholder="请输入点位名称" v-model="queryParams.itemReadName" size="mini" style="width: 200px;"
+                    @blur="itemChangeEvent" prefix-icon="el-icon-search">
                 </el-input>
-                <el-checkbox size="mini" style="margin-left: 20px;" @change="groupRunCheckboxEvent"
+                <el-checkbox size="mini" style="margin-left: 20px;" v-model="runCheckbox" @change="groupRunCheckboxEvent"
                     title="固定每5秒刷新一次数据">实时数据</el-checkbox>
                 <el-button type="danger" size="mini" @click="multipleDelItemEvent" icon="el-icon-delete-solid"
                     style="float: right;">批量删除</el-button>
@@ -22,16 +22,18 @@
                 @receiveCheckedData="receiveCheckedData" @alarmConfig="alarmConfig" @alarmLog="alarmLog"
                 @updateItem="updateItem" @deleteItem="deleteItem">
             </UmyTable>
+            <!-- 分页信息 -->
+          <pagination v-show="tableTotal > 0" small :total="tableTotal" :page.sync="queryParams.page"
+                      :limit.sync="queryParams.limit" align="right" @pagination="itemChangeEvent" />
         </el-dialog>
-
         <!-- 修改数据项 -->
-        <UpdateItem ref="updateItem" @getItemGroupById="getItemGroupById"></UpdateItem>
+        <UpdateItem ref="updateItem" @getItemGroupById="itemChangeEvent"></UpdateItem>
         <!-- 批量设置表达式 -->
-        <MultipleModel ref="multipleModel" @getItemGroupById="getItemGroupById"></MultipleModel>
+        <MultipleModel ref="multipleModel" @getItemGroupById="itemChangeEvent"></MultipleModel>
         <!-- 选择数据项 -->
-        <ItemChoose ref="itemChoose" @getItemGroupById="getItemGroupById"></ItemChoose>
+        <ItemChoose ref="itemChoose" @getItemGroupById="itemChangeEvent"></ItemChoose>
         <!-- 报警配置 -->
-        <AlarmConfig ref="alarmConfig" @getItemGroupById="getItemGroupById"></AlarmConfig>
+        <AlarmConfig ref="alarmConfig" @getItemGroupById="itemChangeEvent"></AlarmConfig>
         <!-- 报警日志 -->
         <AlarmLog ref="alarmLog"></alarmLog>
     </div>
@@ -41,8 +43,7 @@
 import { showLoading, showConfirmWin } from '@/utils/cqcy'
 import UmyTable from '@/components/UmyTable/index.vue'
 import { getAllDataSource } from '@/api/source/dataSource'
-import { getItemGroupById, getItemValueById, deleteItemByIdList } from '@/api/source/itemGroup'
-import { getAlarmLevelPage } from '@/api/system/alarmLevel'
+import { getItemGroupById,getItemValuePageByGroupId, getItemValueById,getItemValueByIds, deleteItemByIdList } from '@/api/source/itemGroup'
 import UpdateItem from './updateItem.vue'
 import MultipleModel from './multipleModel.vue'
 import ItemChoose from './itemChoose.vue'
@@ -63,8 +64,7 @@ export default {
             title: '数据组信息',
             id: null,
             timer: null,
-            filterItemText: null,
-            itemDataListF: [],
+            //filterItemText: null,
             checkItemList: [],
             // 是否展示复选框列
             isShowCheckbox: true,
@@ -166,9 +166,12 @@ export default {
             ],
             queryParams: {
                 page: 1,
-                limit: 10
+                limit: 10,
+                itemReadName: '',
+                itemGroupId: 0
             },
-            tableTotal: 0
+            runCheckbox: false,
+            tableTotal: 0,
         }
     },
     methods: {
@@ -179,34 +182,28 @@ export default {
         /** 打开弹出层事件 */
         dialogOpen() {
             if (this.id) {
-                this.getItemGroupById()
+              this.queryParams.itemGroupId = this.id
+              this.itemChangeEvent()
             }
         },
         /** 关闭弹出层 */
         dialogClose() {
-            this.tableTotal = 0
-            this.tableData = []
-            this.stopTimer()
-            this.visible = false
+          this.queryParams = {
+            page: 1,
+            limit: 10,
+            itemReadName: '',
+            itemGroupId: 0
+          }
+          this.runCheckbox = false
+          this.tableData = []
+          this.stopTimer()
+          this.visible = false
         },
         /** 查看数据组的全部数据项信息 */
-        getItemGroupById() {
-            getItemGroupById(this.id).then(res => {
-                this.itemDataListF = res.data.itemList
-                if (this.filterItemText) {
-                    let value = this.filterItemText
-                    let arr = JSON.parse(JSON.stringify(res.data.itemList))
-                    if (!value || !value.trim()) {
-                        this.tableData = arr
-                        return
-                    }
-                    let filterList = arr.filter(v => {
-                        return (v.itemName.indexOf(value) !== -1) || (v.describe ? v.describe.indexOf(value) !== -1 : false)
-                    })
-                    this.tableData = filterList
-                } else {
-                    this.tableData = res.data.itemList
-                }
+        getItemValuePageByGroupId() {
+          getItemValuePageByGroupId(this.queryParams).then(res => {
+                this.tableTotal = res.data.count
+                this.tableData = res.data.itemList
             })
         },
         /** 报警配置 */
@@ -239,62 +236,48 @@ export default {
             this.$refs.alarmLog.queryParams.itemId = row.id
             this.$refs.alarmLog.visible = true
         },
-        /** 分页获取报警级别 */
-        getAlarmLevelPage() {
-            getAlarmLevelPage(this.queryParams).then(res => {
-                if (!res || !res.data) {
-                    this.$message({
-                        message: '数据查询失败!',
-                        type: 'warning'
-                    })
-                    return
-                }
-                this.tableTotal = res.data.count
-                this.tableData = res.data.alarmLevelList
-            })
-        },
         /** 过滤数据项信息 */
         itemChangeEvent(value) {
-            let arr = JSON.parse(JSON.stringify(this.itemDataListF))
-            if (!value || !value.trim()) {
-                this.tableData = arr
-                return
-            }
-            let filterList = arr.filter(v => {
-                return (v.itemName.indexOf(value) !== -1) || (v.describe ? v.describe.indexOf(value) !== -1 : false)
-            })
-            this.tableData = filterList
+          this.runCheckbox = false
+          this.groupRunCheckboxEvent()
         },
         /** 数据组实时数据按钮事件 */
-        groupRunCheckboxEvent(val) {
-            if (val) {
-                this.tableHeaderTitle = [
-                    {
-                        propName: "itemReadName",
-                        labelName: "点位",
-                    },
-                    {
-                        propName: "operationRuleName",
-                        labelName: "数据计算模型",
-                    }, {
-                        propName: "dataValue",
-                        labelName: "数据值",
-                    },
-                    {
-                        propName: "unit",
-                        labelName: "单位",
-                    },
-                    {
-                        propName: "dataSourceName",
-                        labelName: "数据源",
-                    },
-                    {
-                        propName: "dataTime",
-                        labelName: "取值时间",
-                    }
-                ]
-                this.getRealTimeData();
-                this.tableOperate = []
+        groupRunCheckboxEvent() {
+            if (this.runCheckbox) {
+              let loading = showLoading(this, '数据加载中,请稍候···')
+              this.stopTimer()
+              this.tableHeaderTitle = [
+                  {
+                      propName: "itemReadName",
+                      labelName: "点位",
+                  },
+                  {
+                      propName: "operationRuleName",
+                      labelName: "数据计算模型",
+                  }, {
+                      propName: "dataValue",
+                      labelName: "数据值",
+                  },
+                  {
+                    propName: "countDataValue",
+                    labelName: "计算值",
+                  },
+                  {
+                      propName: "unit",
+                      labelName: "单位",
+                  },
+                  {
+                      propName: "dataSourceName",
+                      labelName: "数据源",
+                  },
+                  {
+                      propName: "dataTime",
+                      labelName: "取值时间",
+                  }
+              ]
+              this.getRealTimeData();
+              this.tableOperate = []
+              loading.close()
             } else {
                 let loading = showLoading(this, '数据加载中,请稍候···')
                 this.stopTimer()
@@ -368,8 +351,7 @@ export default {
                         methodName: "deleteItem",
                     }
                 ]
-                this.getItemGroupById(this.id)
-                this.filterItemText = null
+                this.getItemValuePageByGroupId()
                 loading.close()
             }
         },
@@ -437,24 +419,18 @@ export default {
         },
         /** 查看数据组实时数据 */
         getRealTimeData() {
-            this.getItemValueById(this.id)
+            this.getItemValueById()
             this.timer = setInterval(() => {
-                this.getItemValueById(this.id)
+                this.getItemValueById()
             }, 5000);
         },
         /** 查看数据组实时数据 */
         getItemValueById(id) {
-            getItemValueById(id).then(res => {
+          let ids = Array.from(this.tableData, ({ id }) => id)
+          console.info(ids)
+            getItemValueByIds(ids).then(res => {
                 let arr = JSON.parse(JSON.stringify(res.data))
-                let value = this.filterItemText
-                if (!value || !value.trim()) {
-                    this.tableData = arr
-                    return
-                }
-                let filterList = arr.filter(v => {
-                    return (v.itemName.indexOf(value) !== -1) || (v.describe ? v.describe.indexOf(value) !== -1 : false)
-                })
-                this.tableData = filterList
+                this.tableData = arr
             })
         },
         /** 摧毁定时器 */
@@ -464,7 +440,7 @@ export default {
         /** 通过id数组删除相应的数据项信息 */
         delItemList(ids) {
             showConfirmWin(this, null, '您确定要删除已选择数据项吗?', () => {
-                if (ids.length === this.itemDataListF.length) {
+                if (ids.length === this.tableTotal) {
                     this.$message({
                         message: '至少保留一项数据项信息!',
                         type: 'warning'
@@ -476,7 +452,7 @@ export default {
                         message: '删除成功!',
                         type: 'success'
                     })
-                    this.getItemGroupById(this.id)
+                    this.itemChangeEvent()
                 })
             })
         },

+ 36 - 0
industry-system/industry-da/src/main/java/com/example/opc_da/controller/ItemGroupController.java

@@ -85,6 +85,28 @@ public class ItemGroupController {
         return itemGroupService.getItemGroupById(id, itemType);
     }
 
+
+    /**
+     * 通过id获取数据组,数据组中返回的数据项,如果传入itemType为空,则是获取全部,如果为0,则是附属属性,1基础属性
+     *
+     * @param itemGroupId 组id
+     * @param itemType 项类型,0附属属性,1基础属性
+     * @param itemName 项名称,模糊查询
+     * @param page
+     * @param limit
+     * @return
+     */
+    @GetMapping("/getItemValuePageByGroupId")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
+    public Result getItemValuePageByGroupId(@RequestParam Integer itemGroupId,@RequestParam(required = false) Integer itemType,
+                                            @RequestParam(required = false) String itemReadName, @RequestParam Integer page,
+                                            @RequestParam Integer limit) {
+        if (Blank.isEmpty(page,limit, itemGroupId)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return itemGroupService.getItemValuePageByGroupId(itemGroupId, itemType, itemReadName, page, limit);
+    }
+
     /**
      * 通过id删除数据组
      *
@@ -114,6 +136,20 @@ public class ItemGroupController {
         }
         return itemGroupService.getItemValueById(id);
     }
+    /**
+     * 通过id获取此时item读取的值
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/getItemValueByIds")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
+    public Result getItemValueByIds(@RequestBody List<Integer> idList) {
+        if (Blank.isEmpty(idList)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return itemGroupService.getItemValueByIds(idList);
+    }
 
     /**
      * 修改item的数据模型,事件驱动报表id,描述,单位

+ 9 - 0
industry-system/industry-da/src/main/java/com/example/opc_da/dao/ItemGroupDao.java

@@ -18,6 +18,13 @@ public interface ItemGroupDao {
 
     ItemGroup getItemGroupById(Integer id);
 
+    List<Item> getItemValuePageByGroupId(@Param("itemGroupId") Integer itemGroupId, @Param("itemType") Integer itemType,
+                                         @Param("itemName") String itemName, @Param("startNum") Integer startNum,
+                                         @Param("limitNum") Integer limitNum);
+
+    Integer getItemValueCountByGroupId(@Param("itemGroupId") Integer itemGroupId, @Param("itemType") Integer itemType,
+                                         @Param("itemName") String itemName);
+
     Integer getItemGroupCount(String userId, Integer readMode);
 
     List<ItemGroup> getAllItemGroup(String userId, Integer startNum, Integer limitNum, Integer readMode);
@@ -34,6 +41,8 @@ public interface ItemGroupDao {
 
     List<Item> getItemListByGroupId(Integer itemGroupId, Integer itemType);
 
+    List<Item> getItemValueByIds(List<Integer> idList);
+
     List<Item> getPublicItemList(Integer itemGroupId, List<Item> itemList);
 
     Integer delItemNoPub(Integer itemGroupId, List<Item> itemList);

+ 4 - 0
industry-system/industry-da/src/main/java/com/example/opc_da/service/ItemGroupService.java

@@ -13,12 +13,16 @@ public interface ItemGroupService {
 
     Result getItemGroupById(Integer id, Integer itemType);
 
+    Result getItemValuePageByGroupId(Integer itemGroupId, Integer itemType, String itemName, Integer page, Integer limit);
+
     Result getAllItemGroup(Integer page, Integer limit, Integer readMode);
 
     Result delItemGroupById(Integer id);
 
     Result getItemValueById(Integer id);
 
+    Result getItemValueByIds(List<Integer> idList);
+
     Result updateItem(Item item);
 
     Result getTableItemGroupById(Integer id, Integer itemType);

+ 36 - 0
industry-system/industry-da/src/main/java/com/example/opc_da/service/impl/ItemGroupServiceImpl.java

@@ -175,6 +175,20 @@ public class ItemGroupServiceImpl implements ItemGroupService {
     }
 
     @Override
+    public Result getItemValuePageByGroupId(Integer itemGroupId, Integer itemType, String itemName, Integer page, Integer limit){
+        JSONObject jsonObject = new JSONObject();
+        List<Item> itemList = new ArrayList<>();
+        Integer count = itemGroupDao.getItemValueCountByGroupId(itemGroupId, itemType, itemName);
+        if(count > 0){
+            Integer startNum = (page - 1) * limit;
+            itemList = itemGroupDao.getItemValuePageByGroupId(itemGroupId, itemType, itemName, startNum, limit);
+        }
+        jsonObject.put("count", count);
+        jsonObject.put("itemList", itemList);
+        return Result.ok(jsonObject);
+    }
+
+    @Override
     public Result getAllItemGroup(Integer page, Integer limit, Integer readMode) {
         JSONObject jsonObject = new JSONObject();
         String currentUserId = userUtil.getCurrentUserId();
@@ -216,6 +230,28 @@ public class ItemGroupServiceImpl implements ItemGroupService {
         return Result.ok(allItemList);
     }
 
+    public Result getItemValueByIds(List<Integer> idList) {
+        //得到数据组的所有数据项
+        List<Item> allItemList = itemGroupDao.getItemValueByIds(idList);
+        //获取数据项的所有数据模型
+        List<DataModel> dmListByItemList = dataModelDao.getDmListByItemList(allItemList);
+        Map<Integer, DataModel> dmMap = DataModel.genIntegerMap(allItemList, dmListByItemList);
+        allItemList = (List<Item>) queryServiceUtil.exchangeRealData(allItemList);
+        //赋值计算值
+        for (Item item : allItemList) {
+            String dataValue = item.getDataValue();
+            Integer itemId = item.getId();
+            DataModel dm = dmMap.get(itemId);
+            if (Blank.isNotEmpty(dataValue) && Blank.isNotEmpty(dm)) {
+                // 添加数据校验逻辑
+                item.setCountDataValue(
+                        DataModelValidateFactory.getDataModelValidate(dm.getModelType()).getValue(dm, dataValue)
+                );
+            }
+        }
+        return Result.ok(allItemList);
+    }
+
     @Override
     public synchronized Result updateItem(Item item) {
         Item item1 = itemGroupDao.getItemById(item.getId());

+ 6 - 5
industry-system/industry-da/src/main/java/com/example/opc_da/task/MonitorTemperatureTimerTask.java

@@ -3,6 +3,7 @@ package com.example.opc_da.task;
 import com.example.opc_common.entity.MonitorTemperatureConectSetting;
 import com.example.opc_common.entity.MonitorTemperatureTaskItem;
 import com.example.opc_common.util.DateUtil;
+import com.example.opc_da.config.SpringContextUtils;
 import com.example.opc_da.service.MonitorService;
 import com.example.opc_da.timer.PeriodTimerTask;
 import com.example.opc_da.util.HCNetSDK.HCNetSDKUtil;
@@ -18,13 +19,13 @@ import java.util.Map;
 public class MonitorTemperatureTimerTask extends PeriodTimerTask {
 
     @Resource
-    private MonitorService monitorService;
+    private MonitorService monitorService = SpringContextUtils.getBean(MonitorService.class);;
     @Resource
-    private HCNetSDKUtil hcNetSDKUtil;
+    private HCNetSDKUtil hcNetSDKUtil = SpringContextUtils.getBean(HCNetSDKUtil.class);;
 
     @Override
     protected void runInit(Map<String, Object> map) {
-        log.error("温度监控策略,{},执行开始,执行时间为{}", DateUtil.dateChangeStrYmdhmss(new Date()));
+        //log.info("温度监控策略,{},执行开始,执行时间为{}", DateUtil.dateChangeStrYmdhmss(new Date()));
         // 业务
         MonitorTemperatureConectSetting conectSetting = (MonitorTemperatureConectSetting) map.get("conectSetting");
         Float temperature = hcNetSDKUtil.init().login(
@@ -34,8 +35,8 @@ public class MonitorTemperatureTimerTask extends PeriodTimerTask {
         MonitorTemperatureTaskItem monitorTemperatureTaskItem = new MonitorTemperatureTaskItem();
         monitorTemperatureTaskItem.setTemperature(temperature);
         monitorService.addMonitorTemperatureTaskItem(monitorTemperatureTaskItem);
-        log.info("monitorTemperatureTaskItem.getTemperature=" + monitorTemperatureTaskItem.getTemperature());
+        //log.info("monitorTemperatureTaskItem.getTemperature=" + monitorTemperatureTaskItem.getTemperature());
 
-        log.error("温度监控策略,{},执行结束,执行时间为{}", DateUtil.dateChangeStrYmdhmss(new Date()));
+        //log.info("温度监控策略,{},执行结束,执行时间为{}", DateUtil.dateChangeStrYmdhmss(new Date()));
     }
 }

+ 0 - 34
industry-system/industry-da/src/main/java/com/example/opc_da/task/ScheduledTask.java

@@ -1,13 +1,7 @@
 package com.example.opc_da.task;
 
 import com.cqcy.ei.influxdb.util.SysCronUtil;
-import com.example.opc_common.entity.MonitorTemperatureConectSetting;
-import com.example.opc_common.entity.MonitorTemperatureTaskItem;
-import com.example.opc_common.util.Result;
-import com.example.opc_da.service.MonitorService;
-import com.example.opc_da.util.HCNetSDK.HCNetSDKUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -16,11 +10,6 @@ import org.springframework.stereotype.Component;
 @Component
 public class ScheduledTask {
 
-    @Autowired
-    private MonitorService monitorService;
-    @Autowired
-    private HCNetSDKUtil hcNetSDKUtil;
-
     /**
      * 每天删除,一个月前的文件,且文件不能与数据库匹配的文件
      */
@@ -39,27 +28,4 @@ public class ScheduledTask {
         //执行分库分表操作
         SysCronUtil.exec();
     }
-
-    /**
-     * 每天凌晨一点执行一次
-     */
-    @Async("threadPoolTaskExecutor")
-    @Scheduled(cron = "0/10 * * * * ?")
-    public void monitorTemperatureTask() {
-
-        //定时任务参数
-        //monitorService.get
-
-        // 业务
-        Result result = monitorService.queryMonitorTemperatureConectSettingDtail(null);
-        MonitorTemperatureConectSetting conectSetting = (MonitorTemperatureConectSetting) result.getData();
-        Float temperature = hcNetSDKUtil.init().login(
-                conectSetting.getLoginip(),conectSetting.getLoginport(),conectSetting.getUsername(),conectSetting.getPassword()
-        ).readTemperature().logout().getTemperature();
-        MonitorTemperatureTaskItem monitorTemperatureTaskItem = new MonitorTemperatureTaskItem();
-        monitorTemperatureTaskItem.setTemperature(temperature);
-        monitorService.addMonitorTemperatureTaskItem(monitorTemperatureTaskItem);
-        log.info("monitorTemperatureTaskItem.getId()=" + monitorTemperatureTaskItem.getId());
-
-    }
 }

+ 4 - 4
industry-system/industry-da/src/main/resources/application-dev.yml

@@ -23,11 +23,11 @@ spring:
       # 设置是否自动提交事务,默认为true
       auto-commit: true
       # 设置获取数据库连接的超时时间,最小允许值为250毫秒,默认值为30000ms(30秒)
-      connection-timeout: 30000
+      connection-timeout: 60000
       # 设置连接在连接池中保持空闲的最长时间,最小允许值为10000ms(10秒),默认值为600000ms(10分钟)
-      idle-timeout: 600000
-      # 设置连接在连接池中允许存在的最长时间,最小允许值为30000ms(30秒),默认为1800000ms(30分钟)
-      max-lifetime: 1800000
+      idle-timeout: 60000
+      # 设置连接在连接池中允许存在的最长时间,最小允许值为30000ms(30秒),0不过期,默认为1800000ms(30分钟)
+      max-lifetime: 0
       # 设置连接池中允许的最大连接数,默认为10
       maximum-pool-size: 500
       # 设置连接池中保持的最小空闲连接数,默认为10

+ 4 - 4
industry-system/industry-da/src/main/resources/application-prod.yml

@@ -21,11 +21,11 @@ spring:
       # 设置是否自动提交事务,默认为true
       auto-commit: true
       # 设置获取数据库连接的超时时间,最小允许值为250毫秒,默认值为30000ms(30秒)
-      connection-timeout: 30000
+      connection-timeout: 60000
       # 设置连接在连接池中保持空闲的最长时间,最小允许值为10000ms(10秒),默认值为600000ms(10分钟)
-      idle-timeout: 600000
-      # 设置连接在连接池中允许存在的最长时间,最小允许值为30000ms(30秒),默认为1800000ms(30分钟)
-      max-lifetime: 1800000
+      idle-timeout: 60000
+      # 设置连接在连接池中允许存在的最长时间,最小允许值为30000ms(30秒),0不过期,默认为1800000ms(30分钟)
+      max-lifetime: 0
       # 设置连接池中允许的最大连接数,默认为10
       maximum-pool-size: 500
       # 设置连接池中保持的最小空闲连接数,默认为10

+ 4 - 4
industry-system/industry-da/src/main/resources/application-test.yml

@@ -22,11 +22,11 @@ spring:
       # 设置是否自动提交事务,默认为true
       auto-commit: true
       # 设置获取数据库连接的超时时间,最小允许值为250毫秒,默认值为30000ms(30秒)
-      connection-timeout: 30000
+      connection-timeout: 60000
       # 设置连接在连接池中保持空闲的最长时间,最小允许值为10000ms(10秒),默认值为600000ms(10分钟)
-      idle-timeout: 600000
-      # 设置连接在连接池中允许存在的最长时间,最小允许值为30000ms(30秒),默认为1800000ms(30分钟)
-      max-lifetime: 1800000
+      idle-timeout: 60000
+      # 设置连接在连接池中允许存在的最长时间,最小允许值为30000ms(30秒),0不过期,默认为1800000ms(30分钟)
+      max-lifetime: 0
       # 设置连接池中允许的最大连接数,默认为10
       maximum-pool-size: 500
       # 设置连接池中保持的最小空闲连接数,默认为10

+ 65 - 0
industry-system/industry-da/src/main/resources/mapper/ItemGroupDao.xml

@@ -211,6 +211,36 @@
         ti.item_name
     </select>
 
+
+
+    <select id="getItemValueCountByGroupId" resultType="java.lang.Integer">
+        select count(*)
+        from t_item ti
+        where ti.item_group_id = #{itemGroupId}
+        <if test="itemType != null">
+            and ti.item_type = #{itemType,jdbcType=INTEGER}
+        </if>
+        <if test="itemName != null">
+            and (item_name like concat('%', #{itemName}, '%') or `describe` like concat('%', #{itemName}, '%'))
+        </if>
+    </select>
+
+    <select id="getItemValuePageByGroupId" resultType="com.example.opc_common.entity.Item">
+        select
+        <include refid="item"/>
+        from t_item ti
+        where ti.item_group_id = #{itemGroupId}
+        <if test="itemType != null">
+            and ti.item_type = #{itemType,jdbcType=INTEGER}
+        </if>
+        <if test="itemName != null">
+            and (ti.item_name like concat('%', #{itemName}, '%') or ti.`describe` like concat('%', #{itemName}, '%'))
+        </if>
+        ORDER BY
+        ti.item_name
+        limit #{startNum}, #{limitNum}
+    </select>
+
     <select id="getPublicItemList" resultType="com.example.opc_common.entity.Item">
         select
         <include refid="item"/>
@@ -360,4 +390,39 @@
         </if>
     </select>
 
+
+
+    <select id="getItemValueByIds" resultType="com.example.opc_common.entity.Item">
+        SELECT
+        ti.id,
+        ti.id as item_id,
+        ti.item_group_id,
+        ti.item_name,
+        ti.item_read_name,
+        ti.item_type,
+        ti.node_index,
+        ti.data_type,
+        ti.upper_limit,
+        ti.lower_limit,
+        ti.`describe`,
+        ti.unit,
+        ti.data_model_id,
+        ti.modbus_config,
+        tig.data_source_id,
+        tdm.operation_rule,
+        tdm.remark as operation_rule_name,
+        tds.data_source_name,
+        tac.is_start
+        FROM
+        t_item ti
+        LEFT JOIN t_item_group tig ON ti.item_group_id = tig.id
+        LEFT JOIN t_data_source tds ON tig.data_source_id=tds.id
+        LEFT JOIN t_data_model tdm ON ti.data_model_id = tdm.id
+        LEFT JOIN t_alarm_config tac ON ti.id = tac.item_id
+        where ti.id in
+        <foreach collection="idList" item="id" separator="," open="(" close=")">
+            #{id}
+        </foreach>
+    </select>
+
 </mapper>