Explorar o código

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

Zt hai 1 ano
pai
achega
d0ba4681e5

+ 3 - 0
cqcy-ei/cqcy-ei-da/src/main/java/com/example/opc_da/dao/ReportTableDao.java

@@ -218,4 +218,7 @@ public interface ReportTableDao {
 
     Integer delTableUserGroupList(List<String> tableIdList);
 
+    //通过子报表id查看相应的主报表
+    ReportTable getMainTableBychTableId(String chTableId);
+
 }

+ 2 - 2
cqcy-ei/cqcy-ei-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(), "数据组在报表中配置了相应的数据项无法修改");
+                    throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组在报表中配置了相应的数据项无法修改");
                 }
                 Long ttciCount = reportTableDao.getTtciCountByItemId(itemList1);
                 if (ttciCount > 0) {
-                    return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组在报表中配置了相应的数据项无法修改");
+                    throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据组在报表中配置了相应的数据项无法修改");
                 }
             }
             List<Item> itemList = itemGroup.getItemList();

+ 12 - 0
cqcy-ei/cqcy-ei-da/src/main/java/com/example/opc_da/service/impl/PrintServiceImpl.java

@@ -3,6 +3,7 @@ package com.example.opc_da.service.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.example.opc_common.entity.Print;
 import com.example.opc_common.entity.PrintConfig;
+import com.example.opc_common.entity.ReportTable;
 import com.example.opc_common.enums.ResultEnum;
 import com.example.opc_common.util.Blank;
 import com.example.opc_common.util.ConstantStr;
@@ -126,6 +127,17 @@ public class PrintServiceImpl implements PrintService {
 
     @Override
     public Result getPrintConfigByTableId(String reportTableId) {
+        ReportTable reportTable = reportTableDao.getReportTableById(reportTableId);
+        if (Blank.isEmpty(reportTable)) {
+            return Result.ok(new PrintConfig());
+        }
+        Integer reportTableType = reportTable.getReportTableType();
+        if (reportTableType.equals(ConstantStr.AUTOMATIC_GENERATE_REPORT) ||
+                reportTableType.equals(ConstantStr.EVENT_GENERATE_REPORT) ||
+                reportTableType.equals(ConstantStr.DEVICE_GENERATE_REPORT)) {
+            ReportTable mainReportTable = reportTableDao.getMainTableBychTableId(reportTableId);
+            reportTableId = mainReportTable.getId();
+        }
         Print print = printDao.getPrintByReportId(reportTableId);
         if (Blank.isEmpty(print)) {
             return Result.ok(new PrintConfig());

+ 7 - 0
cqcy-ei/cqcy-ei-da/src/main/resources/mapper/ReportTableDao.xml

@@ -1127,4 +1127,11 @@
         </foreach>
     </select>
 
+    <select id="getMainTableBychTableId" resultType="com.example.opc_common.entity.ReportTable">
+        select
+        <include refid="reportTableCron"/>
+        from t_report_table
+        where id = (select auto_table_id from t_table_auto_log where auto_ch_table_id=#{chTableId})
+    </select>
+
 </mapper>