瀏覽代碼

调整统计

guoqiang 7 月之前
父節點
當前提交
ef226ef63b

+ 11 - 5
jeecg-module-gather/src/main/java/org/jeecg/modules/fpgJob/LeanModelStatistics.java

@@ -118,10 +118,10 @@ public class LeanModelStatistics {
         //遍历设备集合
         fpgLeanModellist.forEach(fpgLeanModeInfo -> {
             LambdaQueryWrapper<FpgGatherData> fpgGatherQuery = new LambdaQueryWrapper<FpgGatherData>().eq(FpgGatherData::getFpgModelState, "0");
-            // 检测是否配置设备条件
-//            if(fpgLeanModeInfo.ge){
-//
-//            }
+            // 检测是否配置设备特殊条件
+            if(!fpgLeanModeInfo.getDeviceInformationIds().isEmpty()){
+                fpgGatherQuery.in(FpgGatherData::getDeviceInformationId, Arrays.asList(fpgLeanModeInfo.getDeviceInformationIds().split(",")));
+            }
             List<FpgGatherData> fpgGatherList = fpgGatherDataService.list(fpgGatherQuery);
             // 处理数据业务逻辑
             fpgGatherList.forEach(fpgGatherData -> { // 循环处理采集数据处理
@@ -170,7 +170,13 @@ public class LeanModelStatistics {
                     // 重组对象
                     FpgStatiscsModelData fpgStatiscsModelData = new FpgStatiscsModelData(fpgGatherData, fpgLeanModeInfo, finalDatestr, dayDate, classs, curentDate, curentDate);
                     Query query = new Query();
-                    query.addCriteria(Criteria.where("deviceRegionId").is(fpgGatherData.getDeviceRegionId())).addCriteria(Criteria.where("deviceInformationId").is(fpgGatherData.getDeviceInformationId())).addCriteria(Criteria.where("devicePointId").is(fpgGatherData.getDevicePointId())).addCriteria(Criteria.where("dates").is(dayDate)).addCriteria(Criteria.where("datestr").is(finalDatestr));
+                    query.addCriteria(Criteria.where("devicePointId").is(fpgGatherData.getDevicePointId())).addCriteria(Criteria.where("dates").is(dayDate)).addCriteria(Criteria.where("datestr").is(finalDatestr));
+                    if(fpgGatherData.getDeviceRegionId() != null && !fpgGatherData.getDeviceRegionId().isEmpty()){ // 区域特殊处理
+                        query.addCriteria(Criteria.where("deviceRegionId").is(fpgGatherData.getDeviceRegionId()));
+                    }
+                    if(fpgGatherData.getDeviceInformationId() != null && !fpgGatherData.getDeviceInformationId().isEmpty()){ // 设备特殊处理
+                        query.addCriteria(Criteria.where("deviceInformationId").is(fpgGatherData.getDeviceInformationId()));
+                    }
                     if(!classs.isEmpty()){ // 增加班次条件
                         query.addCriteria(Criteria.where("classs").is(classs));
                     }

+ 6 - 2
jeecg-module-gather/src/main/java/org/jeecg/modules/gatherData/entity/FpgStatiscsModelData.java

@@ -127,8 +127,12 @@ public class FpgStatiscsModelData{
     // 峰平谷精益模型数据统计
     public FpgStatiscsModelData(FpgGatherData fpgGather, FpgLeanModel fpgLeanModel, String datestr, String dates, String classs, Date createTime, Date updateTime) {
         // 基础信息配置
-        this.deviceRegionId = fpgGather.getDeviceRegionId(); // 区域id
-        this.deviceInformationId = fpgGather.getDeviceInformationId(); // 设备id
+        if(fpgGather.getDeviceRegionId() != null && !fpgGather.getDeviceRegionId().isEmpty()) { // 区域特殊处理
+            this.deviceRegionId = fpgGather.getDeviceRegionId(); // 区域id
+        }
+        if(fpgGather.getDeviceInformationId() != null && !fpgGather.getDeviceInformationId().isEmpty()) { // 区域特殊处理
+            this.deviceInformationId = fpgGather.getDeviceInformationId(); // 设备id
+        }
         this.devicePointId = fpgGather.getDevicePointId(); // 采集点id
         this.ingTime = new BigDecimal("0.00"); // 累计时长
         this.power = new BigDecimal("0.00"); // 累计功率