liuyongxin 8 месяцев назад
Родитель
Сommit
f649697d7c

+ 3 - 0
cloud-common/cloud-common-entity/src/main/java/com/lutao/entity/PlatformInfo.java

@@ -167,4 +167,7 @@ public class PlatformInfo extends Model<PlatformInfo> {
     @ApiModelProperty(value = "数据更新时间")
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private LocalDateTime updateTime;
+
+    @ApiModelProperty(value = "是否计数,0默认计数,1不计数")
+    private String isCount;
 }

+ 8 - 1
cloud-consume/cloud-consume-biz/src/main/java/com/lutao/cloud/consume/factory/PlatformInfoStrategy.java

@@ -44,6 +44,10 @@ public class PlatformInfoStrategy implements CommandStrategy<PlatformInfo> {
             PlatformInfo platformInfo = JSONUtil.toBean(data.toString(), PlatformInfo.class);
             platformInfo.setAppId(dataAddVO.getAppId());
 
+            if (platformInfo.getIsCount() != null && "1".equals(platformInfo.getIsCount())){
+                platformInfo.setDeleteFlag(1);
+            }
+
             log.info("PlatformInfoStrategy 进行add操作 ......");
             platformInfoStrategy.platformInfoService.saveOrUpdate(platformInfo,
                     Wrappers.lambdaQuery(PlatformInfo.class)
@@ -63,7 +67,10 @@ public class PlatformInfoStrategy implements CommandStrategy<PlatformInfo> {
         } else if (MessageCommandEnum.MESSAGE_upd.getCommand().equals(command)) {
             PlatformInfo platformInfo = JSONUtil.toBean(data.toString(), PlatformInfo.class);
             platformInfo.setAppId(dataAddVO.getAppId());
-
+            if (platformInfo.getIsCount() != null && "1".equals(platformInfo.getIsCount())){
+                //不计数 删除
+                platformInfo.setDeleteFlag(1);
+            }
             log.info("PlatformInfoStrategy 进行upd操作 .......");
             platformInfoStrategy.platformInfoService.update(platformInfo, Wrappers.lambdaQuery(PlatformInfo.class)
                     .eq(PlatformInfo::getAppId, platformInfo.getAppId())

+ 6 - 0
cloud-oil/cloud-oil-biz/src/main/java/com/lutao/cloud/oil/mapper/ProcessParameterTagMapper.java

@@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.lutao.cloud.common.core.util.MessageInfo;
 import com.lutao.cloud.common.data.datascope.CloudBaseMapper;
+import com.lutao.cloud.oil.pojo.param.BaseParam;
 import com.lutao.cloud.oil.pojo.param.ProcessParametersTagVOParam;
+import com.lutao.cloud.oil.pojo.vo.MonitorPointVO;
 import com.lutao.cloud.oil.pojo.vo.ProcessParametersTagVO;
 import com.lutao.entity.ProcessParameterTag;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 @Mapper
 public interface ProcessParameterTagMapper extends CloudBaseMapper<ProcessParameterTag> {
     /**
@@ -20,4 +24,6 @@ public interface ProcessParameterTagMapper extends CloudBaseMapper<ProcessParame
      * @return {@link MessageInfo}<{@link IPage}<{@link ProcessParametersTagVO}>>
      */
     IPage<ProcessParametersTagVO> getProcessParamInfoPage(Page page, @Param("param") ProcessParametersTagVOParam param);
+
+    List<MonitorPointVO> earlyWarningMonitoringPointStatistic(@Param("param") BaseParam param);
 }

+ 18 - 3
cloud-oil/cloud-oil-biz/src/main/java/com/lutao/cloud/oil/service/impl/BusinessEquipmentInfoServiceImpl.java

@@ -188,20 +188,35 @@ public class BusinessEquipmentInfoServiceImpl implements IBusinessEquipmentInfoS
         //中海油设备总数
         long zhongHaiYouEquipmentCount = profEquipmentInfos.stream().filter(i->i.getAppId() != null).filter(i -> i.getAppId().equals("zhonghaiyou")).count();
 
+        //即将过期定检数量
+        Long willExpirePeriodicalInspectZhonghaiyou = equipmentInfoMapper.getWillExpirePeriodicalInspect(param.setAppId("zhonghaiyou"));
+        //即将过期年检数量
+        Long willExpireYearInspectNumberZhonghaiyou = equipmentInfoMapper.getWillExpireYearInspectNumber(param.setAppId("zhonghaiyou"));
+
         //中海油即将过期数
-        long zhongHaiYouWillExpireCount = equipmentInfoMapper.getWillExpireNumber(param.setAppId("zhonghaiyou"));
+        long zhongHaiYouWillExpireCount = willExpirePeriodicalInspectZhonghaiyou+willExpireYearInspectNumberZhonghaiyou;
+
 
         //中石油设备总数
         long zhongShiYouEquipmentCount = profEquipmentInfos.stream().filter(i->i.getAppId() != null).filter(i -> i.getAppId().equals("zhongshiyou")).count();
 
+
+        //即将过期定检数量
+        Long willExpirePeriodicalInspectZhongshiyou = equipmentInfoMapper.getWillExpirePeriodicalInspect(param.setAppId("zhongshiyou"));
+        //即将过期年检数量
+        Long willExpireYearInspectNumberZhongshiyou = equipmentInfoMapper.getWillExpireYearInspectNumber(param.setAppId("zhongshiyou"));
         //中石油即将过期数
-        long zhongShiYouWillExpireCount = equipmentInfoMapper.getWillExpireNumber(param.setAppId("zhongshiyou"));
+        long zhongShiYouWillExpireCount = willExpirePeriodicalInspectZhongshiyou+willExpireYearInspectNumberZhongshiyou;
 
         //中石化设备总数
         long zhongShiHuaEquipmentCount = profEquipmentInfos.stream().filter(i->i.getAppId() != null).filter(i -> i.getAppId().equals("zhongshihua")).count();
 
+        //即将过期定检数量
+        Long willExpirePeriodicalInspectZhongshihua = equipmentInfoMapper.getWillExpirePeriodicalInspect(param.setAppId("zhongshihua"));
+        //即将过期年检数量
+        Long willExpireYearInspectNumberZhongshihua = equipmentInfoMapper.getWillExpireYearInspectNumber(param.setAppId("zhongshihua"));
         //中石化即将过期数
-        long zhongShiHuaWillExpireCount = equipmentInfoMapper.getWillExpireNumber(param.setAppId("zhongshihua"));
+        long zhongShiHuaWillExpireCount = willExpirePeriodicalInspectZhongshihua+willExpireYearInspectNumberZhongshihua;
 
         ScreenDisplayEquipmentBarVO screenDisplayEquipmentBarVO = new ScreenDisplayEquipmentBarVO()
                 .setZhongHaiYouEquipmentCount(zhongHaiYouEquipmentCount)

+ 32 - 30
cloud-oil/cloud-oil-biz/src/main/java/com/lutao/cloud/oil/service/impl/BusinessPerceptionMonitorAlarmServiceImpl.java

@@ -521,37 +521,39 @@ public class BusinessPerceptionMonitorAlarmServiceImpl implements IBusinessPerce
 
     @Override
     public MessageInfo<List<MonitorPointVO>> earlyWarningMonitoringPointStatistic(BaseParam param) {
-        List<MonitorPointVO> monitorPointVOS = new ArrayList<>();
-        List<ProcessParameterTag> processParameterTags = processParameterTagMapper.selectList(Wrappers.lambdaQuery(ProcessParameterTag.class).eq(StringUtil.isNotBlank(param.getAppId()), ProcessParameterTag::getAppId, param.getAppId()));
-        Map<String, List<ProcessParameterTag>> processParameterByAppId = processParameterTags.stream()
-                .filter(processParameterTag -> processParameterTag.getTagType() != null)
-                .filter(processParameterTag -> processParameterTag.getStatus() != null)
-                .filter(processParameterTag -> !processParameterTag.getTagType().equals("6"))
-                .filter(processParameterTag -> !processParameterTag.getTagType().equals("7"))
-                .filter(processParameterTag -> !processParameterTag.getTagType().equals("8"))
-                .filter(processParameterTag -> processParameterTag.getStatus().equals("0"))
-                .collect(Collectors.groupingBy(ProcessParameterTag::getAppId));
-
-        for (Map.Entry<String, List<ProcessParameterTag>> appId : processParameterByAppId.entrySet()) {
-
-            switch (appId.getKey()) {
-                case "zhongshiyou":
-                    MonitorPointVO monitorPointVO = new MonitorPointVO().setAppName("中石油").setPointNum((long) appId.getValue().size());
-                    monitorPointVOS.add(monitorPointVO);
-                    break;
-                case "zhonghaiyou":
-                    MonitorPointVO monitorPointVO1 = new MonitorPointVO().setAppName("中海油").setPointNum((long) appId.getValue().size());
-                    monitorPointVOS.add(monitorPointVO1);
-                    break;
-                case "zhongshihua":
-                    MonitorPointVO monitorPointVO2 = new MonitorPointVO().setAppName("中石化").setPointNum((long) appId.getValue().size());
-                    monitorPointVOS.add(monitorPointVO2);
-                    break;
-                default:
-                    break;
-            }
+//        List<MonitorPointVO> monitorPointVOS = new ArrayList<>();
+//        List<ProcessParameterTag> processParameterTags = processParameterTagMapper.selectList(Wrappers.lambdaQuery(ProcessParameterTag.class).eq(StringUtil.isNotBlank(param.getAppId()), ProcessParameterTag::getAppId, param.getAppId()));
+//        Map<String, List<ProcessParameterTag>> processParameterByAppId = processParameterTags.stream()
+//                .filter(processParameterTag -> processParameterTag.getTagType() != null)
+//                .filter(processParameterTag -> processParameterTag.getStatus() != null)
+//                .filter(processParameterTag -> !processParameterTag.getTagType().equals("6"))
+//                .filter(processParameterTag -> !processParameterTag.getTagType().equals("7"))
+//                .filter(processParameterTag -> !processParameterTag.getTagType().equals("8"))
+//                .filter(processParameterTag -> processParameterTag.getStatus().equals("0"))
+//                .collect(Collectors.groupingBy(ProcessParameterTag::getAppId));
+//
+//        for (Map.Entry<String, List<ProcessParameterTag>> appId : processParameterByAppId.entrySet()) {
+//
+//            switch (appId.getKey()) {
+//                case "zhongshiyou":
+//                    MonitorPointVO monitorPointVO = new MonitorPointVO().setAppName("中石油").setPointNum((long) appId.getValue().size());
+//                    monitorPointVOS.add(monitorPointVO);
+//                    break;
+//                case "zhonghaiyou":
+//                    MonitorPointVO monitorPointVO1 = new MonitorPointVO().setAppName("中海油").setPointNum((long) appId.getValue().size());
+//                    monitorPointVOS.add(monitorPointVO1);
+//                    break;
+//                case "zhongshihua":
+//                    MonitorPointVO monitorPointVO2 = new MonitorPointVO().setAppName("中石化").setPointNum((long) appId.getValue().size());
+//                    monitorPointVOS.add(monitorPointVO2);
+//                    break;
+//                default:
+//                    break;
+//            }
+//
+//        }
+        List<MonitorPointVO> monitorPointVOS = processParameterTagMapper.earlyWarningMonitoringPointStatistic(param);
 
-        }
 
         return MessageInfo.ok(monitorPointVOS);
     }

+ 2 - 2
cloud-oil/cloud-oil-biz/src/main/java/com/lutao/cloud/oil/service/impl/IBusinessSecurityRiskControlServiceImpl.java

@@ -316,8 +316,8 @@ public class IBusinessSecurityRiskControlServiceImpl implements IBusinessSecurit
                             Wrappers.lambdaQuery(HighRiskOperation.class)
                                     .eq(StringUtil.isNotBlank(param.getAppId()), HighRiskOperation::getAppId, param.getAppId())
                                     .eq(StringUtil.isNotBlank(param.getPlatformId()), HighRiskOperation::getPlatformCode, param.getPlatformId())
-                                    .le(HighRiskOperation::getTaskBeginTime, date)
-                                    .ge(HighRiskOperation::getTaskEndTime, date)
+                                    .le(HighRiskOperation::getTaskBeginTime, date+" 23:59:59")
+                                    .ge(HighRiskOperation::getTaskEndTime, date+" 00:00:00")
                     ));
             highRiskOperationsTrendVOS.add(highRiskOperationsTrendVO);
         }

+ 1 - 1
cloud-oil/cloud-oil-biz/src/main/resources/mapper/HighRiskOperationMapper.xml

@@ -227,7 +227,7 @@
                 and hro.task_end_time &gt;= #{param.startTime}
             </if>
             <if test="param.endTime != null">
-                and hro.task_end_time &lt;= #{param.endTime}
+                and hro.task_begin_time &lt;= #{param.endTime}
             </if>
         </where>
         ORDER BY

+ 29 - 4
cloud-oil/cloud-oil-biz/src/main/resources/mapper/ProcessParameterTagMapper.xml

@@ -7,16 +7,19 @@
 
 
     <select id="getProcessParamInfoPage" resultType="com.lutao.cloud.oil.pojo.vo.ProcessParametersTagVO">
-        SELECT pi.platform_name AS platformName,
+        SELECT
+        DISTINCT ppt.tag_code,
+        pi.platform_name AS platformName,
         pi.oil_gas_name AS oilGasName,
         pi.operating_company AS operatingCompany,
         ai.app_name AS appName,
         ppt.tag_type AS tagType,
         ppt.tag_name AS tagName,
-        CONCAT(CONCAT(CONCAT( threshold_lo, '~', threshold_up ),'(',CONCAT( threshold_los, '~', threshold_ups )),')') AS upperLimit,
+        CONCAT(CONCAT(CONCAT( threshold_lo, '~', threshold_up ),'(',CONCAT( threshold_los, '~', threshold_ups )),')') AS
+        upperLimit,
         CONCAT(ppt.threshold_los, '~', ppt.threshold_ups) AS upperUpperLimit,
         ppt.unit,
-        ppt.tag_code,
+
         ROUND(pd.rt_value, 2) AS rtValue,
         ppt.status
         FROM process_parameters_tag ppt
@@ -26,7 +29,7 @@
         <where>
             pi.delete_flag = '0'
             <if test="param.platformId != null and param.platformId != ''">
-               and ppt.platform_code = #{param.platformId}
+                and ppt.platform_code = #{param.platformId}
             </if>
             <if test="param.appId != null and param.appId != ''">
                 and ppt.app_id = #{param.appId}
@@ -57,4 +60,26 @@
         </where>
         ORDER BY rtValue DESC, appName,platformName,oilGasName,operatingCompany,ppt.status ASC
     </select>
+    <select id="earlyWarningMonitoringPointStatistic" resultType="com.lutao.cloud.oil.pojo.vo.MonitorPointVO">
+        SELECT
+        COUNT(*) AS pointNum,
+        ai.app_name AS appName
+        FROM
+        process_parameters_tag ppt
+        LEFT JOIN app_info ai ON ai.id = ppt.app_id
+        LEFT JOIN platform_info pi ON ppt.platform_code = pi.platform_code
+        <where>
+            pi.delete_flag = '0'
+            AND ppt.tag_type IN ( 2, 3, 5 )
+            AND ppt.STATUS = '0'
+            <if test="param.platformId != null and param.platformId != ''">
+                and ppt.platform_code = #{param.platformId}
+            </if>
+            <if test="param.appId != null and param.appId != ''">
+                and ppt.app_id = #{param.appId}
+            </if>
+        </where>
+        GROUP BY ai.app_name
+
+    </select>
 </mapper>

+ 12 - 0
cloud-oil/cloud-oil-biz/src/main/resources/mapper/TagAlarmClmMapper.xml

@@ -61,6 +61,18 @@
                 and alarm_timestamp &gt;= #{param.startDate}
                 and alarm_timestamp &lt;= #{param.endDate}
             </if>
+            <if test="param.platformId != null and param.platformId != ''">
+                and tac.platform_code = #{param.platformId}
+            </if>
+            <if test="param.appId != null and param.appId != ''">
+                and tac.app_id = #{param.appId}
+            </if>
+            <if test="param.operatingCompany != null and param.operatingCompany != ''">
+                and pi.operating_company = #{param.operatingCompany}
+            </if>
+            <if test="param.oilGasName != null and param.oilGasName != ''">
+                and pi.oil_gas_name = #{param.oilGasName}
+            </if>
         </where>
 
         GROUP BY