Browse Source

1、数据组模块 处理数据组添加点位时复合筛选不起作用问题。
2、数据组模块 修改点位小数位数代码
3、数据组模块 新增、修改保存添加等待进度
2、策略模块 解决修改功能切换点位后保存失败问题。
3、报表生成模块 处理事件驱动报表基础数据项数据回填功能。
3、报表生成模块 修改保留小数位数代码。

lhy 11 months ago
parent
commit
56a5c98d56
17 changed files with 132 additions and 82 deletions
  1. 7 1
      industry-admin/src/views/report/reportTablePolicy/reportDataPolicy.vue
  2. 23 0
      industry-admin/src/views/source/itemGroup/item.vue
  3. 4 3
      industry-admin/src/views/source/itemGroup/updateItem.vue
  4. 3 2
      industry-system/industry-da/src/main/java/com/example/opc_da/policy/EventReportTableTask.java
  5. 3 2
      industry-system/industry-da/src/main/java/com/example/opc_da/service/impl/ReportDataPolicyServiceImpl.java
  6. 8 7
      industry-system/industry-da/src/main/java/com/example/opc_da/task/AsyncTask.java
  7. 1 1
      industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/AverageCalculate.java
  8. 1 1
      industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/InstantaneousCalculate.java
  9. 1 1
      industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/MaxCalculate.java
  10. 1 1
      industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/MinCalculate.java
  11. 1 1
      industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/SumCalculate.java
  12. 1 1
      industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportDataPolicy/EventReportDataPolicyValidate.java
  13. 2 1
      industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/AutomaticMaReportTableValidate.java
  14. 0 52
      industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/EventChReportTableValidate.java
  15. 1 1
      industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/EventMaReportTableValidate.java
  16. 73 6
      industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/EventReportTableValidate.java
  17. 2 1
      industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/ManualReportTableValidate.java

+ 7 - 1
industry-admin/src/views/report/reportTablePolicy/reportDataPolicy.vue

@@ -556,7 +556,7 @@ export default {
         this.reportDataPolicyRateForm.readModeType = data.readModeType;
         let policyItemList = data.policyItemList;
         for (let i = 0; i < policyItemList.length; i++) {
-          if (policyItemList[i].itemId == this.reportDataPolicyRateForm.eventItemId) {
+          if (policyItemList[i].id == this.reportDataPolicyRateForm.eventItemId) {
             this.reportDataPolicyRateForm.eventItemName = policyItemList[i].itemReadName
           }
         }
@@ -599,7 +599,9 @@ export default {
     },
     /** 新增报表数据策略 */
     addReportDataPolicy(params) {
+      const loading = showLoading(this, "保存中,请稍候···");
       addReportDataPolicy(params).then((res) => {
+        loading.close()
         if (res.data) {
           this.$message({
             message: '新增成功!',
@@ -608,6 +610,8 @@ export default {
           this.handleClose()
           this.$emit("getReportDataPolicyPage")
         }
+      }).catch(e => {
+        loading.close()
       })
     },
     /** 修改报表数据策略 */
@@ -623,6 +627,8 @@ export default {
           this.handleClose()
           this.$emit("getReportDataPolicyPage")
         }
+      }).catch(e => {
+        loading.close()
       })
     },
     /** 弹出确认修改报表数据策略弹窗 */

+ 23 - 0
industry-admin/src/views/source/itemGroup/item.vue

@@ -186,6 +186,18 @@ export default {
       runCheckbox: false,
       clientStatusType: -1,
       tableTotal: 0,
+      scaleList:[
+        {value : null, label: '默认'},
+        {value : '0', label: '0'},
+        {value : '1', label: '1'},
+        {value : '2', label: '2'},
+        {value : '3', label: '3'},
+        {value : '4', label: '4'},
+        {value : '5', label: '5'},
+        {value : '6', label: '6'},
+        {value : '7', label: '7'},
+        {value : '8', label: '8'}
+      ]
     }
   },
   methods: {
@@ -327,6 +339,16 @@ export default {
           {
             propName: "scale",
             labelName: "小数位数",
+            formatter: (row, column, cellValue, index) => {
+              let label = ''
+              this.scaleList.forEach(d => {
+                if(d.value == cellValue){
+                  label = d.label
+                  return
+                }
+              })
+              return label
+            },
             align: "left"
           },
           {
@@ -559,6 +581,7 @@ export default {
       this.$refs.updateItem.itemForm.describe = row.describe
       this.$refs.updateItem.itemForm.unit = row.unit
       this.$refs.updateItem.itemForm.scale = row.scale
+      this.$refs.updateItem.scaleList = this.scaleList
     },
     /** 表格操作按钮删除点位 */
     deleteItem(row) {

+ 4 - 3
industry-admin/src/views/source/itemGroup/updateItem.vue

@@ -25,8 +25,8 @@
 <!--            <el-input v-model.trim='itemForm.scale' type="number" min="0" max="8" auto-complete="off" show-word-limit maxlength="20"
                       placeholder="请输入小数位数"></el-input>-->
             <el-select v-model="itemForm.scale" filterable clearable placeholder="请选择小数位数" style="width: 100%;">
-              <el-option v-for="(v,index) in [,0,1,2,3,4,5,6,7,8]" :key="index" :label="v"
-                         :value="v">
+              <el-option v-for="(d,index) in scaleList" :key="index" :label="d.label"
+                         :value="d.value">
               </el-option>
             </el-select>
           </el-form-item>
@@ -66,7 +66,8 @@ export default {
                 describe: null,
                 unit: null,
                 scale:null,
-            }
+            },
+            scaleList:[]
         }
     },
     created() {

+ 3 - 2
industry-system/industry-da/src/main/java/com/example/opc_da/policy/EventReportTableTask.java

@@ -123,7 +123,7 @@ public class EventReportTableTask implements DisposableBean {
      */
     public void generateReportTable() {
         //将解析完的子报表,异步存入到数据库中
-        asyncTask.updateReportTableDataById(this.currentReportTableId
+        asyncTask.updateReportTableDataById(this.reportTable.getId(),this.currentReportTableId
                 , this.currentReportTableData, new HashMap<>(this.itemDataMap));
     }
 
@@ -177,7 +177,8 @@ public class EventReportTableTask implements DisposableBean {
         //得到sheet数据
         JSONObject sheet = reportTableData.getJSONObject("sheet");
         JSONArray sheetData = sheet.getJSONArray("data");
-        EventReportTableValidate.echoSheetAll(sheetData, this.itemDataMap);
+        System.err.println("getReportTableDataStr");
+        EventReportTableValidate.echoSheetAll(this.reportTable.getId(), sheetData, this.itemDataMap);
         sheet.put("data", sheetData);
         return reportTableData.toJSONString();
     }

+ 3 - 2
industry-system/industry-da/src/main/java/com/example/opc_da/service/impl/ReportDataPolicyServiceImpl.java

@@ -1,6 +1,7 @@
 package com.example.opc_da.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.convert.Convert;
 import com.alibaba.fastjson.JSONObject;
 import com.example.opc_common.entity.DictType;
 import com.example.opc_common.entity.ReportDataPolicy;
@@ -255,7 +256,7 @@ public class ReportDataPolicyServiceImpl implements ReportDataPolicyService {
             }
             Boolean eventFlag = false;
             for (ReportDataPolicyItem policyItem : policyItemList) {
-                if (policyItem.getItemId() == eventItemId) {
+                if (policyItem.getId().equals(eventItemId)) {
                     eventFlag = true;
                 }
             }
@@ -355,7 +356,7 @@ public class ReportDataPolicyServiceImpl implements ReportDataPolicyService {
 
         // 数据组未配置点位数据的小数位数,从字典中获取默认小数位数
         DictType dictType = dictDao.queryDictTypeByKeyType("item_scale", null);
-        Integer defaultScale = Integer.parseInt(dictType.getDictKeyValue());
+        Integer defaultScale = Convert.toInt(dictType.getDictKeyValue());
 
         if (Blank.isNotEmpty(chartType) && chartType.equals(ConstantStr.PIE_CHART)) {
             //limit在饼图中不生效

+ 8 - 7
industry-system/industry-da/src/main/java/com/example/opc_da/task/AsyncTask.java

@@ -14,7 +14,7 @@ import com.example.opc_common.util.DateUtil;
 import com.example.opc_da.dao.AlarmConfigDao;
 import com.example.opc_da.dao.PrintDao;
 import com.example.opc_da.dao.ReportTableDao;
-import com.example.opc_da.validate.reportTable.EventChReportTableValidate;
+import com.example.opc_da.validate.reportTable.EventReportTableValidate;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -123,13 +123,14 @@ public class AsyncTask {
      * @param reportTableDataStr
      * @param itemDataMap
      */
-    public void updateReportTableDataById(String reportTableId, String reportTableDataStr, Map<String, List<Item>> itemDataMap) {
+    public void updateReportTableDataById(String mainReportTableId, String reportTableId, String reportTableDataStr, Map<String, List<Item>> itemDataMap) {
         //解析事件驱动报表结构
         JSONObject reportTableData = JSONObject.parseObject(reportTableDataStr);
         //得到sheet数据
         JSONObject sheet = reportTableData.getJSONObject("sheet");
         JSONArray sheetData = sheet.getJSONArray("data");
-        EventChReportTableValidate.echoSheet(sheetData, itemDataMap);
+        System.err.println("updateReportTableDataById");
+        EventReportTableValidate.echoSheetAll(mainReportTableId, sheetData, itemDataMap);
         sheet.put("data", sheetData);
         reportTableDao.updateReportTableDataById(reportTableId, reportTableData.toJSONString());
 
@@ -155,22 +156,22 @@ public class AsyncTask {
         //生成报表请求地址
         String printConfigStr = "";
         try {
-            printConfigStr = URLEncoder.encode(JSONObject.toJSONString(printConfig),"utf-8");
+            printConfigStr = URLEncoder.encode(JSONObject.toJSONString(printConfig), "utf-8");
         } catch (UnsupportedEncodingException e) {
             throw new RuntimeException(e);
         }
-        if(StrUtil.isEmpty(autoReportTableExcelUrl)){
+        if (StrUtil.isEmpty(autoReportTableExcelUrl)) {
             autoReportTableExcelUrl = "http://{{clientIP}}:8084/api/printReportTable";
         }
         autoReportTableExcelUrl = autoReportTableExcelUrl.replace("{{clientIP}}", printIp);
         log.info("runPrint.autoReportTableExcelUrl:" + autoReportTableExcelUrl);
-        if(StrUtil.isEmpty(autoReportTablePageUrl)){
+        if (StrUtil.isEmpty(autoReportTablePageUrl)) {
             autoReportTablePageUrl = "http://{{severIp}}:8081/reportSheet/report-history.html?id={{autoReportTableId}}&printType=task" +
                     "&printConfig={{printConfig}}&serverUrl=http://{{severIp}}:8081&printUrl=http://{{clientIP}}:8084/api/printFile";
         }
         autoReportTablePageUrl = autoReportTablePageUrl.replace("{{autoReportTableId}}", reportTableId)
                 .replace("{{clientIP}}", printIp)
-                .replace("{{printConfig}}",printConfigStr);
+                .replace("{{printConfig}}", printConfigStr);
         log.info("runPrint.autoReportTablePageUrl:" + autoReportTablePageUrl);
         try {
             Map<String, Object> params = new HashMap<>();

+ 1 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/AverageCalculate.java

@@ -26,7 +26,7 @@ public class AverageCalculate implements CalculateData {
                 if(Blank.isEmpty(scale)){
                     scale = defaultScale;
                 }
-                if("-1".equals(scale)){
+                if(scale == null || scale == -1){
                     return String.valueOf(average.getAsDouble()); // 返回计算得到的平均值
                 }
                 BigDecimal original  = new BigDecimal(average.getAsDouble());

+ 1 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/InstantaneousCalculate.java

@@ -21,7 +21,7 @@ public class InstantaneousCalculate implements CalculateData {
             if(Blank.isEmpty(scale)){
                 scale = defaultScale;
             }
-            if("-1".equals(scale)){
+            if(scale == null || scale == -1){
                 return value; // 返回计算得到的平均值
             }
             BigDecimal original = new BigDecimal(value);

+ 1 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/MaxCalculate.java

@@ -25,7 +25,7 @@ public class MaxCalculate implements CalculateData {
                     if(Blank.isEmpty(scale)){
                         scale = defaultScale;
                     }
-                    if("-1".equals(scale)){
+                    if(scale == null || scale == -1){
                         return String.valueOf(maxValue.getAsDouble()); // 返回计算得到的平均值
                     }
                     BigDecimal original  = new BigDecimal(maxValue.getAsDouble());

+ 1 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/MinCalculate.java

@@ -22,7 +22,7 @@ public class MinCalculate implements CalculateData {
                 if(Blank.isEmpty(scale)){
                     scale = defaultScale;
                 }
-                if("-1".equals(scale)){
+                if(scale == null || scale == -1){
                     return String.valueOf(minValue.getAsDouble()); // 返回计算得到的平均值
                 }
                 BigDecimal original  = new BigDecimal(minValue.getAsDouble());

+ 1 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/util/calculate/SumCalculate.java

@@ -27,7 +27,7 @@ public class SumCalculate implements CalculateData {
         if(Blank.isEmpty(scale)){
             scale = defaultScale;
         }
-        if("-1".equals(scale)){
+        if(scale == null || scale == -1){
             return sum.toString(); // 返回计算得到的平均值
         }
         BigDecimal rounded = sum.setScale(scale, RoundingMode.HALF_UP);

+ 1 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportDataPolicy/EventReportDataPolicyValidate.java

@@ -29,7 +29,7 @@ public class EventReportDataPolicyValidate implements ReportDataPolicyValidate {
         if (Blank.isEmpty(policyItemList)) {
             throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "报表采集策略的点位不能为空");
         }
-        if (policyItemList.stream().noneMatch(p -> p.getItemId().equals(eventItemId))) {
+        if (policyItemList.stream().noneMatch(p -> p.getId().equals(eventItemId))) {
             throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "报表采集策略配置事件驱动项不存在于选择的点位中");
         }
     }

+ 2 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/AutomaticMaReportTableValidate.java

@@ -1,5 +1,6 @@
 package com.example.opc_da.validate.reportTable;
 
+import cn.hutool.core.convert.Convert;
 import cn.hutool.extra.servlet.ServletUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -37,7 +38,7 @@ public class AutomaticMaReportTableValidate extends AutomaticReportTableValidate
         if (ConstantStr.START_UP.equals(runState)) {
             // 数据组未配置点位数据的小数位数,从字典中获取默认小数位数
             DictType dictType = dictDao.queryDictTypeByKeyType("item_scale", null);
-            Integer defaultScale = Integer.parseInt(dictType.getDictKeyValue());
+            Integer defaultScale = Convert.toInt(dictType.getDictKeyValue());
             List<ReportDataPolicyItem> itemScaleList = reportTableDao.getItemScaleByReportTableIdOrPolicyIdOrItemId(reportTable.getId(), null, null);
             //待完成。。。
             return reportTable.setReportTableData(resolveAutoTableData(reportTable.getReportTableData(), LocalDateTime.now(), itemScaleList, defaultScale));

+ 0 - 52
industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/EventChReportTableValidate.java

@@ -35,56 +35,4 @@ public class EventChReportTableValidate extends EventReportTableValidate {
     public Result setAutoTableTime(ReportTable reportTable, HttpServletRequest request) {
         throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "事件驱动报表子报表不允许配置");
     }
-
-    /**
-     * 回填表格数据
-     *
-     * @param sheetData
-     * @param itemDataMap
-     */
-    public static void echoSheet(JSONArray sheetData, Map<String, List<Item>> itemDataMap) {
-        for (int i = 0; i < sheetData.size(); i++) {
-            JSONArray row = sheetData.getJSONArray(i);
-            for (int j = 0; j < row.size(); j++) {
-                JSONObject rowCol = row.getJSONObject(j);
-                if (Blank.isNotEmpty(rowCol)) {
-                    //能解析的数据才赋值
-                    try {
-                        JSONObject rowColJson = JSONObject.parseObject(rowCol.getString("celldata"));
-                        String type = rowColJson.getString("type");
-                        //如果类型为数据,则存入数据
-                        if (type.equals("data")) {
-                            JSONObject rowColData = rowColJson.getJSONObject("data");
-                            String itemId = rowColData.getString("itemId");
-                            if (Blank.isNotEmpty(itemId)) {
-                                List<Item> itemList = itemDataMap.get(itemId);
-                                if (itemList != null && !itemList.isEmpty()) {
-                                    String value = itemList.get(0).getValue();
-                                    rowCol.put("v", value);
-                                    rowCol.put("m", value);
-                                    itemList.remove(0);
-                                } else {
-                                    rowCol.put("v", null);
-                                    rowCol.put("m", null);
-                                }
-                            }
-                            //如果类型为时间,则存入时间
-                        } else if (type.equals("datatime") && !itemDataMap.isEmpty()) {
-                            List<Item> itemList = itemDataMap.entrySet().stream().findFirst().map(Map.Entry::getValue).orElse(new ArrayList<>()); // 使用map处理可能为空的情况
-                            if (!itemList.isEmpty()) {
-                                String time = itemList.get(0).getTime();
-                                rowCol.put("v", time);
-                                rowCol.put("m", time);
-                            } else {
-                                rowCol.put("v", null);
-                                rowCol.put("m", null);
-                            }
-                        }
-                    } catch (Exception e) {
-
-                    }
-                }
-            }
-        }
-    }
 }

+ 1 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/EventMaReportTableValidate.java

@@ -36,7 +36,7 @@ public class EventMaReportTableValidate extends EventReportTableValidate {
             //得到sheet数据
             JSONObject sheet = reportTableDataJson.getJSONObject("sheet");
             JSONArray sheetData = sheet.getJSONArray("data");
-            echoSheetAll(sheetData, null);
+            echoSheetAll(reportTable.getId(), sheetData, null);
             sheet.put("data", sheetData);
             reportTableDataJson.put("sheet", sheet);
             return reportTable.setReportTableData(reportTableDataJson.toJSONString());

+ 73 - 6
industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/EventReportTableValidate.java

@@ -1,23 +1,66 @@
 package com.example.opc_da.validate.reportTable;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.convert.Convert;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.cqcy.ei.influxdb.entity.Item;
+import com.example.opc_common.entity.DictType;
+import com.example.opc_common.entity.ReportDataPolicyItem;
 import com.example.opc_common.util.Blank;
 import com.example.opc_da.config.SpringContextUtils;
+import com.example.opc_da.dao.DictDao;
+import com.example.opc_da.dao.ReportTableDao;
 import com.example.opc_da.policy.EventReportDataPolicyTaskRegister;
+import com.example.opc_da.task.ReportTableBasicItemEnum;
+import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
 
 /**
  * 事件报表验证抽象类
  */
+@Slf4j
 public abstract class EventReportTableValidate implements ReportTableValidate {
 
-    EventReportDataPolicyTaskRegister eventReportDataPolicyTaskRegister = SpringContextUtils.getBean(EventReportDataPolicyTaskRegister.class);
+    public EventReportDataPolicyTaskRegister eventReportDataPolicyTaskRegister = SpringContextUtils.getBean(EventReportDataPolicyTaskRegister.class);
+    private static ReportTableDao reportTableDao = SpringContextUtils.getBean(ReportTableDao.class);
+    private static DictDao dictDao = SpringContextUtils.getBean(DictDao.class);
+
+
+    /**
+     *
+     * @param value 原值
+     * @param policyItemId 策略点位ID
+     * @param itemScaleList 点位小数位数集合
+     * @param defaultScale 默认小数位数
+     * @return
+     */
+    private static String replaceValueByScale(String value,String policyItemId,List<ReportDataPolicyItem> itemScaleList, Integer defaultScale){
+        log.info("事件驱动报表:EventReportTableValidate.itemScaleList=" + itemScaleList.toString() + ",policyItemId=" + policyItemId);
+        Optional<ReportDataPolicyItem> first = itemScaleList.stream()
+                .filter((item) -> policyItemId.equals(item.getId().toString()))
+                .findFirst();
+        Integer scale = null;
+        if (first.isPresent()) {
+            scale = first.get().getScale();
+            log.info("事件驱动报表:EventReportTableValidate.scale=" + scale);
+        }
+        if(Blank.isEmpty(scale)){
+            scale = defaultScale;
+        }
+        if(!(scale == null || scale == -1)){
+            BigDecimal original  = new BigDecimal(value);
+            BigDecimal rounded = original.setScale(scale, RoundingMode.HALF_UP);
+            value = String.valueOf(rounded);
+        }
+        return value;
+    }
 
     /**
      * 回填表格数据,如果没得数据回填,则全部为空
@@ -25,7 +68,16 @@ public abstract class EventReportTableValidate implements ReportTableValidate {
      * @param sheetData
      * @param itemDataMap
      */
-    public static void echoSheetAll(JSONArray sheetData, Map<String, List<Item>> itemDataMap) {
+    public static void echoSheetAll(String reportTableId, JSONArray sheetData, Map<String, List<Item>> itemDataMap) {
+        log.info("事件驱动报表:EventReportTableValidate.reportTableId=" + reportTableId);
+        Integer defaultScale = null;
+        List<ReportDataPolicyItem> itemScaleList = null;
+        if(CollUtil.isNotEmpty(itemDataMap)){
+            // 数据组未配置点位数据的小数位数,从字典中获取默认小数位数
+            DictType dictType = dictDao.queryDictTypeByKeyType("item_scale", null);
+            defaultScale = Convert.toInt(dictType.getDictKeyValue());
+            itemScaleList = reportTableDao.getItemScaleByReportTableIdOrPolicyIdOrItemId(reportTableId, null, null);
+        }
         for (int i = 0; i < sheetData.size(); i++) {
             JSONArray row = sheetData.getJSONArray(i);
             for (int j = 0; j < row.size(); j++) {
@@ -47,6 +99,7 @@ public abstract class EventReportTableValidate implements ReportTableValidate {
                                 List<Item> itemList = itemDataMap.get(itemId);
                                 if (CollUtil.isNotEmpty(itemList)) {
                                     String value = itemList.get(0).getValue();
+                                    value = replaceValueByScale(value, itemId, itemScaleList, defaultScale);
                                     rowCol.put("v", value);
                                     rowCol.put("m", value);
                                     itemList.remove(0);
@@ -77,7 +130,21 @@ public abstract class EventReportTableValidate implements ReportTableValidate {
                             }
                         }
                     } catch (Exception e) {
-
+                        String v = rowCol.getString("v");
+                        String regex = "^\\$\\{.*\\}$";
+                        //赋值基础数据项
+                        if (v != null && v.matches(regex)) {
+                            if (Arrays.stream(ReportTableBasicItemEnum.values())
+                                    .filter(b -> b.name().equals(v.substring(2, v.length() - 1))).findFirst().orElse(null) != null) {
+                                String value = Objects.requireNonNull(Arrays.stream(ReportTableBasicItemEnum.values())
+                                        .filter(b -> b.name().equals(v.substring(2, v.length() - 1))).findFirst().orElse(null)).getValue();
+                                rowCol.put("v", value);
+                                rowCol.put("m", value);
+                            } else {
+                                rowCol.put("v", null);
+                                rowCol.put("m", null);
+                            }
+                        }
                     }
                 }
             }

+ 2 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/validate/reportTable/ManualReportTableValidate.java

@@ -1,6 +1,7 @@
 package com.example.opc_da.validate.reportTable;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.convert.Convert;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.cqcy.ei.influxdb.entity.Item;
@@ -49,7 +50,7 @@ public class ManualReportTableValidate implements ReportTableValidate {
     public ReportTable getData(ReportTable reportTable) {
         // 数据组未配置点位数据的小数位数,从字典中获取默认小数位数
         DictType dictType = dictDao.queryDictTypeByKeyType("item_scale", null);
-        Integer defaultScale = Integer.parseInt(dictType.getDictKeyValue());
+        Integer defaultScale = Convert.toInt(dictType.getDictKeyValue());
         List<ReportDataPolicyItem> itemScaleList = reportTableDao.getItemScaleByReportTableIdOrPolicyIdOrItemId(reportTable.getId(), null, null);
         //待完成。。。
         return reportTable.setReportTableData(resolveAutoTableData(reportTable.getReportTableData(), LocalDateTime.now(), itemScaleList, defaultScale));