Commit 308bcc9d authored by 莫林毅's avatar 莫林毅

监控运营->告警监控 ->预警和隐患维护 界面

1 增加 ‘关联诊断’ 按钮 2 删除部分 废代码
parent 8f5dfe95
...@@ -10,6 +10,7 @@ import org.springframework.data.repository.query.Param; ...@@ -10,6 +10,7 @@ import org.springframework.data.repository.query.Param;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory; import javax.persistence.EntityManagerFactory;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date;
import java.util.List; import java.util.List;
public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAssociationAnaInfo>, public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAssociationAnaInfo>,
...@@ -33,11 +34,11 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs ...@@ -33,11 +34,11 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
public List<DimAssociationAnaInfo> findDimAssociationAnaInfoByProvince(@Param(value = "province") List<Long> detailProvince); public List<DimAssociationAnaInfo> findDimAssociationAnaInfoByProvince(@Param(value = "province") List<Long> detailProvince);
@Query("select anaInfo from DimAssociationAnaInfo anaInfo where anaInfo.provinceId in (:province) and anaInfo.AssociationType in (:demension)") @Query("select anaInfo from DimAssociationAnaInfo anaInfo where anaInfo.provinceId in (:province) and anaInfo.AssociationType in (:demension)")
public List<DimAssociationAnaInfo> findDimAssociationAnaInfoByProvinceAndDimension(@Param(value = "province") List<Long> detailProvince,@Param(value = "demension") String dimension); public List<DimAssociationAnaInfo> findDimAssociationAnaInfoByProvinceAndDimension(@Param(value = "province") List<Long> detailProvince, @Param(value = "demension") String dimension);
@Query("select anaInfo from DimAssociationAnaInfo anaInfo where anaInfo.associationId = :associationId ") @Query("select anaInfo from DimAssociationAnaInfo anaInfo where anaInfo.associationId = :associationId ")
public DimAssociationAnaInfo findDimassociationAnaInfoByAssociationId(@Param(value = "associationId")Long associationId ); public DimAssociationAnaInfo findDimassociationAnaInfoByAssociationId(@Param(value = "associationId") Long associationId);
@Query(value = "SELECT ASSOCIATION_ID AS associationId ,D.PROVINCE_ID as provinceId,ASSOCIATION_TYPE AS associationType ," + @Query(value = "SELECT ASSOCIATION_ID AS associationId ,D.PROVINCE_ID as provinceId,ASSOCIATION_TYPE AS associationType ," +
"ASSOCIATION_DESC AS associationDesc,d.PROVINCE_NAME AS provinceName,WARNING_BEGIN_TIME AS warningBeginTime," + "ASSOCIATION_DESC AS associationDesc,d.PROVINCE_NAME AS provinceName,WARNING_BEGIN_TIME AS warningBeginTime," +
...@@ -46,8 +47,8 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs ...@@ -46,8 +47,8 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
"TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B ON A.ASSOCIATION_ID=B.ASSOCIATION_ID" + "TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B ON A.ASSOCIATION_ID=B.ASSOCIATION_ID" +
" INNER JOIN CCOLAP.DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID) D LEFT JOIN CCOLAP.xcd_warning_detail_info_v E ON D.PROVINCE_ID=E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID WHERE " + " INNER JOIN CCOLAP.DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID) D LEFT JOIN CCOLAP.xcd_warning_detail_info_v E ON D.PROVINCE_ID=E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID WHERE " +
"OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') " + "OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') " +
"GROUP BY ASSOCIATION_ID,D.PROVINCE_ID,ASSOCIATION_TYPE ,ASSOCIATION_DESC,d.PROVINCE_NAME,WARNING_BEGIN_TIME,WARNING_END_TIME",nativeQuery = true) "GROUP BY ASSOCIATION_ID,D.PROVINCE_ID,ASSOCIATION_TYPE ,ASSOCIATION_DESC,d.PROVINCE_NAME,WARNING_BEGIN_TIME,WARNING_END_TIME", nativeQuery = true)
public List<Object[]> findAssociateDiagosisDetailByWarnTimeBeginAndEnd( String warnBeginTime,String warnEndTime); public List<Object[]> findAssociateDiagosisDetailByWarnTimeBeginAndEnd(String warnBeginTime, String warnEndTime);
@Query(value = "SELECT ASSOCIATION_ID AS associationId ,D.PROVINCE_ID as provinceId,ASSOCIATION_TYPE AS associationType ," + @Query(value = "SELECT ASSOCIATION_ID AS associationId ,D.PROVINCE_ID as provinceId,ASSOCIATION_TYPE AS associationType ," +
"ASSOCIATION_DESC AS associationDesc,d.PROVINCE_NAME AS provinceName,WARNING_BEGIN_TIME AS warningBeginTime," + "ASSOCIATION_DESC AS associationDesc,d.PROVINCE_NAME AS provinceName,WARNING_BEGIN_TIME AS warningBeginTime," +
...@@ -56,88 +57,44 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs ...@@ -56,88 +57,44 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
"TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B ON A.ASSOCIATION_ID=B.ASSOCIATION_ID" + "TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B ON A.ASSOCIATION_ID=B.ASSOCIATION_ID" +
" INNER JOIN CCOLAP.DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID) D LEFT JOIN CCOLAP.xcd_warning_detail_info_v E ON D.PROVINCE_ID=E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID WHERE " + " INNER JOIN CCOLAP.DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID) D LEFT JOIN CCOLAP.xcd_warning_detail_info_v E ON D.PROVINCE_ID=E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID WHERE " +
"OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') " + "OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') " +
"GROUP BY ASSOCIATION_ID,D.PROVINCE_ID,ASSOCIATION_TYPE ,ASSOCIATION_DESC,d.PROVINCE_NAME,WARNING_BEGIN_TIME,WARNING_END_TIME",nativeQuery = true) "GROUP BY ASSOCIATION_ID,D.PROVINCE_ID,ASSOCIATION_TYPE ,ASSOCIATION_DESC,d.PROVINCE_NAME,WARNING_BEGIN_TIME,WARNING_END_TIME", nativeQuery = true)
public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBegin( String warnBeginTime, String warnEndTime); public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBegin(String warnBeginTime, String warnEndTime);
/*@Query(value = "SELECT ASSOCIATION_ID AS associationId ,D.PROVINCE_ID as provinceId,ASSOCIATION_TYPE AS associationType ," +
"ASSOCIATION_DESC AS associationDesc,PROVINCE_NAME AS provinceName,WARNING_BEGIN_TIME AS warningBeginTime," +
"WARNING_END_TIME as warningEndTime,COUNT(E.KPI_ID)AS warningNum FROM " +
"( SELECT A.ASSOCIATION_ID,A.PROVINCE_ID,A.ASSOCIATION_DESC,A.ASSOCIATION_TYPE,B.KPI_ID,C.PROVINCE_NAME,TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME, " +
"TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B ON A.ASSOCIATION_ID=B.ASSOCIATION_ID" +
" INNER JOIN CCOLAP.DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID) D LEFT JOIN CCOLAP.GJFX_WARNING_INFO_T E ON D.PROVINCE_ID=E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID AND WARNING_ID LIKE 'J%' WHERE " +
"OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') " +
"AND A.ASSOCIATION_TYPE = ?3 "+
"AND D.PROVINCE_ID in (?4)"+
"GROUP BY ASSOCIATION_ID,D.PROVINCE_ID,ASSOCIATION_TYPE ,ASSOCIATION_DESC,PROVINCE_NAME,WARNING_BEGIN_TIME,WARNING_END_TIME",nativeQuery = true)*/
@Query(value = "SELECT ASSOCIATION_ID, D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC, PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME," + @Query(value = "SELECT ASSOCIATION_ID, D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC, PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME," +
" COUNT(E.KPI_ID) AS WARNING_NUM FROM (" + " COUNT(E.KPI_ID) AS WARNING_NUM FROM (" +
" SELECT A.ASSOCIATION_ID,A.PROVINCE_ID, A.ASSOCIATION_DESC, A.ASSOCIATION_TYPE, B.KPI_ID, C.PROVINCE_NAME, TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME," + " SELECT A.ASSOCIATION_ID,A.PROVINCE_ID, A.ASSOCIATION_DESC, A.ASSOCIATION_TYPE, B.KPI_ID, C.PROVINCE_NAME, TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME," +
" TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME" + " TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME" +
" FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN DIM_KPI_ASSOCIATION_RELATED_INFO_T B"+ " FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN DIM_KPI_ASSOCIATION_RELATED_INFO_T B" +
" ON A.ASSOCIATION_ID=B.ASSOCIATION_ID INNER JOIN DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID) D"+ " ON A.ASSOCIATION_ID=B.ASSOCIATION_ID INNER JOIN DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID) D" +
" LEFT JOIN GJFX_WARNING_INFO_T E" + " LEFT JOIN GJFX_WARNING_INFO_T E" +
" ON D.PROVINCE_ID = E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID AND WARNING_ID LIKE 'J%'" + " ON D.PROVINCE_ID = E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID AND WARNING_ID LIKE 'J%'" +
" and OCCUR_TIME >= TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS')" + " and OCCUR_TIME >= TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS')" +
" AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') WHERE ASSOCIATION_TYPE = ?3 and D.PROVINCE_ID in (?4) GROUP BY ASSOCIATION_ID,D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC,PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME" " AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') WHERE ASSOCIATION_TYPE = ?3 and D.PROVINCE_ID in (?4) GROUP BY ASSOCIATION_ID,D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC,PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME"
,nativeQuery = true) , nativeQuery = true)
public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, char dimension, List<Long> provincelist); public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, char dimension, List<Long> provincelist);
@Query(value = "SELECT ASSOCIATION_ID, D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC, PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME," +
// @Query(value = "SELECT ASSOCIATION_ID, D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC, PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME," + " COUNT(E.KPI_ID) AS WARNING_NUM FROM (" +
// " COUNT(E.KPI_ID) AS WARNING_NUM FROM (" + " SELECT A.ASSOCIATION_ID,A.PROVINCE_ID, A.ASSOCIATION_DESC, A.ASSOCIATION_TYPE, B.KPI_ID, C.PROVINCE_NAME, TO_TIMESTAMP(?3,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME," +
// " SELECT A.ASSOCIATION_ID,A.PROVINCE_ID, A.ASSOCIATION_DESC, A.ASSOCIATION_TYPE, B.KPI_ID, C.PROVINCE_NAME, TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME," + " TO_TIMESTAMP(?4,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME" +
// " TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME" + " FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN DIM_KPI_ASSOCIATION_RELATED_INFO_T B" +
// " FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN DIM_KPI_ASSOCIATION_RELATED_INFO_T B"+ " ON A.ASSOCIATION_ID=B.ASSOCIATION_ID INNER JOIN (select ASSOCIATION_ID from ccolap.DIM_KPI_ASSOCIATION_RELATED_INFO_T where kpi_id = ?2 ) G" +
// " ON A.ASSOCIATION_ID=B.ASSOCIATION_ID INNER JOIN DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID) D"+ " on A.ASSOCIATION_ID=G.ASSOCIATION_ID INNER JOIN DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID) D" +
// " LEFT JOIN GJFX_WARNING_INFO_T E" + " LEFT JOIN GJFX_WARNING_INFO_T E" +
// " ON D.PROVINCE_ID = E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID AND WARNING_ID LIKE 'J%'" + " ON D.PROVINCE_ID = E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID AND WARNING_ID LIKE 'J%'" +
// " and OCCUR_TIME >= TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS')" + " and OCCUR_TIME >= TO_TIMESTAMP(?3,'YYYY-MM-DD HH24:MI:SS')" +
// " AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') WHERE ASSOCIATION_TYPE = ?3 and D.PROVINCE_ID in (?4) GROUP BY ASSOCIATION_ID,D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC,PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME" " AND OCCUR_TIME <=TO_TIMESTAMP(?4,'YYYY-MM-DD HH24:MI:SS') WHERE " +
// ,nativeQuery = true) " D.PROVINCE_ID = ?1 GROUP BY ASSOCIATION_ID,D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC,PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME", nativeQuery = true)
// public Object[] findAssociateDiagosisDetailByAssociationId(Long associationId); public Object[] findObjByProvinceIdAndKpiIdAndoccurTimeAndCloseTime(/*@Param(value = "provinceId")*/ Long provinceId,
/*@Param(value = "kpiId")*/ Long kpiId,
/*@Param(value = "occurTime")*/ String occurTime,
/*@Param(value = "closeTime")*/ String closeTime);
@Query(value = "SELECT ASSOCIATION_ID, PROVINCE_ID, ASSOCIATION_TYPE , ASSOCIATION_DESC, PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME, KPI_CODE, KPI_NAME, KPI_ID, KPI_WEIGHT, WARNING_NUM, CASE WHEN INFLUENCE_LEVEL>0.8 THEN '高' WHEN INFLUENCE_LEVEL>0.5 AND INFLUENCE_LEVEL<0.5 THEN '中' ELSE '低' END AS INFLUENCE_LEVEL FROM ( SELECT ASSOCIATION_ID, D.PROVINCE_ID, ASSOCIATION_TYPE, ASSOCIATION_DESC, d.PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME, D.KPI_CODE,D.KPI_NAME, D.KPI_ID, KPI_WEIGHT,COUNT(E.KPI_ID)AS WARNING_NUM, KPI_WEIGHT* COUNT(E.KPI_ID) AS INFLUENCE_LEVEL FROM ( SELECT A.ASSOCIATION_ID,A.PROVINCE_ID,A.ASSOCIATION_DESC,A.ASSOCIATION_TYPE, B.KPI_ID, D.KPI_CODE, D.KPI_NAME, B.KPI_WEIGHT, C.PROVINCE_NAME, TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME, TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B ON A.ASSOCIATION_ID=B.ASSOCIATION_ID INNER JOIN CCOLAP.DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID INNER JOIN CCOLAP.DIM_KPI_INFO_T D ON B.KPI_ID=D.KPI_ID) D LEFT JOIN CCOLAP.xcd_warning_detail_info_v E ON D.PROVINCE_ID=E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID AND OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') WHERE ASSOCIATION_ID= ?3 GROUP BY ASSOCIATION_ID, D.PROVINCE_ID, ASSOCIATION_TYPE , ASSOCIATION_DESC, d.PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME, D.KPI_CODE, D.KPI_NAME,D.KPI_ID,KPI_WEIGHT)G" @Query(value = "SELECT ASSOCIATION_ID, PROVINCE_ID, ASSOCIATION_TYPE , ASSOCIATION_DESC, PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME, KPI_CODE, KPI_NAME, KPI_ID, KPI_WEIGHT, WARNING_NUM, CASE WHEN INFLUENCE_LEVEL>0.8 THEN '高' WHEN INFLUENCE_LEVEL>0.5 AND INFLUENCE_LEVEL<0.5 THEN '中' ELSE '低' END AS INFLUENCE_LEVEL FROM ( SELECT ASSOCIATION_ID, D.PROVINCE_ID, ASSOCIATION_TYPE, ASSOCIATION_DESC, PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME, D.KPI_CODE,D.KPI_NAME, D.KPI_ID, KPI_WEIGHT,COUNT(E.KPI_ID)AS WARNING_NUM, KPI_WEIGHT* COUNT(E.KPI_ID) AS INFLUENCE_LEVEL FROM ( SELECT A.ASSOCIATION_ID,A.PROVINCE_ID,A.ASSOCIATION_DESC,A.ASSOCIATION_TYPE, B.KPI_ID, D.KPI_CODE, D.KPI_NAME, B.KPI_WEIGHT, C.PROVINCE_NAME, TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME, TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B ON A.ASSOCIATION_ID=B.ASSOCIATION_ID INNER JOIN CCOLAP.DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID INNER JOIN CCOLAP.DIM_KPI_INFO_T D ON B.KPI_ID=D.KPI_ID) D LEFT JOIN CCOLAP.GJFX_WARNING_INFO_T E ON D.PROVINCE_ID=E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID AND WARNING_ID LIKE 'J%' WHERE OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AND ASSOCIATION_ID= ?3 GROUP BY ASSOCIATION_ID, D.PROVINCE_ID, ASSOCIATION_TYPE , ASSOCIATION_DESC, PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME, D.KPI_CODE, D.KPI_NAME,D.KPI_ID,KPI_WEIGHT)G"
,nativeQuery = true) ,nativeQuery = true)
public List<Object[]> findDetailByAssociationIdAndWarnBeginToEndTime(String beginTime,String endTime,Long associationId); public List<Object[]> findDetailByAssociationIdAndWarnBeginToEndTime(String beginTime,String endTime,Long associationId);
/**
* 数据库查出所有需要关联的点
* @param startTime
* @param endTime
* @param warningId
* @return
*/
// @Query("with d as (SELECT d.kpi_id,d.kpi_code,d.kpi_name,e.warning_id from( SELECT A.ASSOCIATION_ID,A.PROVINCE_ID,A.ASSOCIATION_DESC,A.ASSOCIATION_TYPE,B.KPI_ID,D.KPI_CODE,D.KPI_NAME,B.KPI_WEIGHT,C.PROVINCE_NAME,TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME,TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B ON A.ASSOCIATION_ID=B.ASSOCIATION_ID INNER JOIN CCOLAP.DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID INNER JOIN CCOLAP.DIM_KPI_INFO_T D ON B.KPI_ID=D.KPI_ID) D LEFT JOIN CCOLAP.GJFX_WARNING_INFO_T E ON D.PROVINCE_ID=E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID AND WARNING_ID LIKE 'J%' WHERE OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AND ASSOCIATION_ID=?3) select to_char(kpi_id)as kpi_id,kpi_name ,'normal'as ponit_type from d union all select warning_id as kpi_id,'告警点' as kpi_name ,'small'as ponit_type from d where warning_id is not null union all select ?3 as kpi_id,'关联规则' as kpi_name ,'big'as ponit_type from dual")
// List<Object []> findAllPoint(String startTime,String endTime,String warningId);
/**
* 数据库查出所有的关联信息
* @param startTime
* @param endTime
* @param warningId
* @return
*/
// @Query("SELECT D.KPI_NAME,D.KPI_ID,warning_id FROM(" +
// " SELECT A.ASSOCIATION_ID, A.PROVINCE_ID,A.ASSOCIATION_DESC,A.ASSOCIATION_TYPE,B.KPI_ID,D.KPI_CODE,D.KPI_NAME,B.KPI_WEIGHT,C.PROVINCE_NAME,TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') " +
// "AS WARNING_BEGIN_TIME,TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME " +
// "FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B " +
// "ON A.ASSOCIATION_ID=B.ASSOCIATION_ID INNER JOIN CCOLAP.DIM_PROVINCE_INFO_T C " +
// "ON C.PROVINCE_ID= A.PROVINCE_ID INNER JOIN CCOLAP.DIM_KPI_INFO_T D " +
// "ON B.KPI_ID=D.KPI_ID) D LEFT JOIN CCOLAP.GJFX_WARNING_INFO_T E " +
// "ON D.PROVINCE_ID=E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID AND WARNING_ID LIKE 'J%' " +
// "WHERE OCCUR_TIME >=TO_TIMESTAMP(?1,'YYYY-MM-DD HH24:MI:SS') " +
// "AND OCCUR_TIME <=TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AND ASSOCIATION_ID=?3 " +
// "union select '关联规则' as KPI_NAME,a.ASSOCIATION_ID as KPI_ID,to_char(KPI_ID) as warning_id " +
// "from CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A " +
// "INNER JOIN CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B ON A.ASSOCIATION_ID=B.ASSOCIATION_ID " +
// "WHERE a.ASSOCIATION_ID=?3")
// List<Object []> findRelation(String startTime,String endTime,String warningId);
} }
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
package com.hp.cmsz.repository; package com.hp.cmsz.repository;
/** /**
* @author Wang Feng * @author Wang Feng
*
*/ */
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
...@@ -22,19 +21,21 @@ import com.hp.cmsz.entity.XcdDetailInfoView; ...@@ -22,19 +21,21 @@ import com.hp.cmsz.entity.XcdDetailInfoView;
import com.hp.cmsz.entity.XcdWarningInfoView; import com.hp.cmsz.entity.XcdWarningInfoView;
public interface XcdWarningInfoViewDao extends PagingAndSortingRepository<XcdWarningInfoView,Long>,JpaSpecificationExecutor<XcdWarningInfoView> { public interface XcdWarningInfoViewDao extends PagingAndSortingRepository<XcdWarningInfoView, Long>, JpaSpecificationExecutor<XcdWarningInfoView> {
//根绝筛选条件从视图中去查找符合条件的预警或隐患 //根绝筛选条件从视图中去查找符合条件的预警或隐患
List <XcdWarningInfoView> findByOccurTimeBetweenAndWarningSourceIdInAndRiskEarlyWarningTypeIdInAndDataSourceIdInAndChannelIdInAndBusinessIdInAndProviderIdInAndImportanceLevelIdInAndProvinceIdInAndCloseStatusInAndTypeInAndIfFilterInOrderByWarningSourceIdAscOccurTimeDescDataSourceIdAscChannelIdAscProvinceIdAscKpiIdAsc(Date time1,Date time2,List<Long> warningsource,List<Long>risk,List<Long> dataSource,List<Long> chnnal,List<Long>busines,List<Long>provider,List<Long>level,List<Long>province,String[] status,String[] relStatus,List<Long> filter); List<XcdWarningInfoView> findByOccurTimeBetweenAndWarningSourceIdInAndRiskEarlyWarningTypeIdInAndDataSourceIdInAndChannelIdInAndBusinessIdInAndProviderIdInAndImportanceLevelIdInAndProvinceIdInAndCloseStatusInAndTypeInAndIfFilterInOrderByWarningSourceIdAscOccurTimeDescDataSourceIdAscChannelIdAscProvinceIdAscKpiIdAsc(Date time1, Date time2, List<Long> warningsource, List<Long> risk, List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long> provider, List<Long> level, List<Long> province, String[] status, String[] relStatus, List<Long> filter);
//根绝筛选条件从视图中去查找符合条件的预警或隐患 //根绝筛选条件从视图中去查找符合条件的预警或隐患
List <XcdWarningInfoView> findByOccurTimeBetweenAndWarningSourceIdInAndRiskEarlyWarningTypeIdInAndDataSourceIdInAndChannelIdInAndBusinessIdInAndProviderIdInAndImportanceLevelIdInAndProvinceIdInAndCloseStatusInAndTypeInOrderByWarningSourceIdAscOccurTimeDescDataSourceIdAscChannelIdAscProvinceIdAscKpiIdAsc(Date time1,Date time2,List<Long> warningsource,List<Long>risk,List<Long> dataSource,List<Long> chnnal,List<Long>busines,List<Long>provider,List<Long>level,List<Long>province,String[] status,String[] relStatus); List<XcdWarningInfoView> findByOccurTimeBetweenAndWarningSourceIdInAndRiskEarlyWarningTypeIdInAndDataSourceIdInAndChannelIdInAndBusinessIdInAndProviderIdInAndImportanceLevelIdInAndProvinceIdInAndCloseStatusInAndTypeInOrderByWarningSourceIdAscOccurTimeDescDataSourceIdAscChannelIdAscProvinceIdAscKpiIdAsc(Date time1, Date time2, List<Long> warningsource, List<Long> risk, List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long> provider, List<Long> level, List<Long> province, String[] status, String[] relStatus);
//根据协查单编码获取对应的预警或隐患的记录 //根据协查单编码获取对应的预警或隐患的记录
List <XcdWarningInfoView>findByWorkingOrderCodeOrderByWarningSourceIdAscOccurTimeDescDataSourceIdAscChannelIdAscProvinceIdAscKpiIdAsc(String workingOrderCode); List<XcdWarningInfoView> findByWorkingOrderCodeOrderByWarningSourceIdAscOccurTimeDescDataSourceIdAscChannelIdAscProvinceIdAscKpiIdAsc(String workingOrderCode);
//根据告警ID获取对应的预警或隐患的记录 //根据告警ID获取对应的预警或隐患的记录
List <XcdWarningInfoView> findByWarningId(String warningId); List<XcdWarningInfoView> findByWarningId(String warningId);
//默认页面中查找出所有的预警或隐患并按照occurTime降序排列 //默认页面中查找出所有的预警或隐患并按照occurTime降序排列
@Query("from XcdWarningInfoView where occurTime between TIMESTAMPADD(M,-1,GETDATE()) AND GETDATE() order by occurTime desc, warningSourceId asc, dataSourceId asc, channelId asc, provinceId asc, kpiId asc") @Query("from XcdWarningInfoView where occurTime between TIMESTAMPADD(M,-1,GETDATE()) AND GETDATE() order by occurTime desc, warningSourceId asc, dataSourceId asc, channelId asc, provinceId asc, kpiId asc")
List<XcdWarningInfoView> findAllOrderByTime(); List<XcdWarningInfoView> findAllOrderByTime();
...@@ -45,6 +46,7 @@ public interface XcdWarningInfoViewDao extends PagingAndSortingRepository<XcdWa ...@@ -45,6 +46,7 @@ public interface XcdWarningInfoViewDao extends PagingAndSortingRepository<XcdWa
//根据被选中的告警id去查找所有的告警 //根据被选中的告警id去查找所有的告警
List<XcdWarningInfoView> findByWarningIdIn(List<String> warningId);//这个是针对于生成协查单的时候,提供被选中的告警下载成为word文件 List<XcdWarningInfoView> findByWarningIdIn(List<String> warningId);//这个是针对于生成协查单的时候,提供被选中的告警下载成为word文件
//根据被选中的告警id查找出最大的告警发生时间 //根据被选中的告警id查找出最大的告警发生时间
@Query("select min(occurTime) from XcdWarningInfoView where warningId in(?1)") @Query("select min(occurTime) from XcdWarningInfoView where warningId in(?1)")
Date findMinOccurTimeByWarningIdIn(List<String> warningId); Date findMinOccurTimeByWarningIdIn(List<String> warningId);
...@@ -64,34 +66,56 @@ public interface XcdWarningInfoViewDao extends PagingAndSortingRepository<XcdWa ...@@ -64,34 +66,56 @@ public interface XcdWarningInfoViewDao extends PagingAndSortingRepository<XcdWa
//根据被选中的告警id,以及渠道,查找出对应的业务,以供生成协查单时的协查单描述 //根据被选中的告警id,以及渠道,查找出对应的业务,以供生成协查单时的协查单描述
@Query("select distinct x.businessName from XcdWarningInfoView x where x.warningId in(?1) and x.channelName =?2") @Query("select distinct x.businessName from XcdWarningInfoView x where x.warningId in(?1) and x.channelName =?2")
List<String> findDistinctBusinessByIdAndChannel(List<String>id,String channel); List<String> findDistinctBusinessByIdAndChannel(List<String> id, String channel);
//根据被选中的告警id,查找出平台的对应的指标,以供生成协查单时的协查单描述 //根据被选中的告警id,查找出平台的对应的指标,以供生成协查单时的协查单描述
@Query("select distinct x.kpiName from XcdWarningInfoView x where x.warningId in(?1) and x.channelName=(?2)") @Query("select distinct x.kpiName from XcdWarningInfoView x where x.warningId in(?1) and x.channelName=(?2)")
List<String> findDistinctKpiById(List<String> id,String channel); List<String> findDistinctKpiById(List<String> id, String channel);
//生成协查单时根据告警id查找出对应的省份名字 //生成协查单时根据告警id查找出对应的省份名字
@Query("select provinceName from XcdWarningInfoView where warningId=?1") @Query("select provinceName from XcdWarningInfoView where warningId=?1")
String findProvinceByWarningId(String warningid); String findProvinceByWarningId(String warningid);
//协查单分析页面的折线图默认页面,最近一个月的 //协查单分析页面的折线图默认页面,最近一个月的
@Query(value="SELECT TO_CHAR(DATE_VALUE,'yyyy-mm-dd') AS CATEGORY, COUNT(working_order_id) AS COUNT FROM (SELECT DATE_VALUE FROM dim_date_info_t WHERE DATE_VALUE BETWEEN TIMESTAMPADD(M,-1,date(GETDATE())) AND GETDATE())A left join ( SELECT event_happen_time, working_order_id FROM XCD_WORKING_ORDER_INFO_T WHERE data_Source_Id IS NOT NULL AND provider_Id IS NOT NULL AND channel_Id IS NOT NULL AND prov_code IS NOT NULL)B ON A.DATE_VALUE=CAST(B.event_happen_time AS DATE)GROUP BY CATEGORY ORDER BY CATEGORY",nativeQuery=true) //change by eric 2014-08-13 22:07 外连接了日期 @Query(value = "SELECT TO_CHAR(DATE_VALUE,'yyyy-mm-dd') AS CATEGORY, COUNT(working_order_id) AS COUNT FROM (SELECT DATE_VALUE FROM dim_date_info_t WHERE DATE_VALUE BETWEEN TIMESTAMPADD(M,-1,date(GETDATE())) AND GETDATE())A left join ( SELECT event_happen_time, working_order_id FROM XCD_WORKING_ORDER_INFO_T WHERE data_Source_Id IS NOT NULL AND provider_Id IS NOT NULL AND channel_Id IS NOT NULL AND prov_code IS NOT NULL)B ON A.DATE_VALUE=CAST(B.event_happen_time AS DATE)GROUP BY CATEGORY ORDER BY CATEGORY", nativeQuery = true)
//change by eric 2014-08-13 22:07 外连接了日期
List<Object[]> findXcdAnalysis(); List<Object[]> findXcdAnalysis();
//协查单分析页面的折线,当告警来源和告警级别都全选,不关联协查单查找 //协查单分析页面的折线,当告警来源和告警级别都全选,不关联协查单查找
@Query(value=" select to_char(DATE_VALUE,'yyyy-mm-dd') as CATEGORY,count(working_order_id) as COUNT from(SELECT DATE_VALUE FROM dim_date_info_t WHERE DATE_VALUE between ?4 and ?5 )A left join (select event_happen_time,working_order_id from XCD_WORKING_ORDER_INFO_T where prov_code in(select PROVINCE_CODE from DIM_PROVINCE_INFO_T where PROVINCE_ID in(?1)) and channel_id in(?2) and data_source_id in (?3) and provider_id in(?6))B ON A.DATE_VALUE=CAST(B.event_happen_time AS DATE) group by CATEGORY order by CATEGORY",nativeQuery=true)//change by eric 2014-08-13 22:07 外连接了日期 @Query(value = " select to_char(DATE_VALUE,'yyyy-mm-dd') as CATEGORY,count(working_order_id) as COUNT from(SELECT DATE_VALUE FROM dim_date_info_t WHERE DATE_VALUE between ?4 and ?5 )A left join (select event_happen_time,working_order_id from XCD_WORKING_ORDER_INFO_T where prov_code in(select PROVINCE_CODE from DIM_PROVINCE_INFO_T where PROVINCE_ID in(?1)) and channel_id in(?2) and data_source_id in (?3) and provider_id in(?6))B ON A.DATE_VALUE=CAST(B.event_happen_time AS DATE) group by CATEGORY order by CATEGORY", nativeQuery = true)
List<Object[]> findXcdAnalysisByTwoAll(List<Long> proids,List<Long> channelids,List<Long> sourceids,Date startdate,Date enddate,List<Long> provider); //change by eric 2014-08-13 22:07 外连接了日期
List<Object[]> findXcdAnalysisByTwoAll(List<Long> proids, List<Long> channelids, List<Long> sourceids, Date startdate, Date enddate, List<Long> provider);
//协查单分析页面的折线图,两者有一个不全选或都不全选的时候,就要关联告警进行查找 //协查单分析页面的折线图,两者有一个不全选或都不全选的时候,就要关联告警进行查找
@Query(value="SELECT TO_CHAR(DATE_VALUE,'yyyy-mm-dd') AS CATEGORY,COUNT(working_order_id) AS COUNT FROM(SELECT DATE_VALUE FROM dim_date_info_t WHERE DATE_VALUE between ?6 and ?7 )A left join (SELECT event_happen_time, working_order_id FROM XCD_WORKING_ORDER_INFO_T WHERE working_order_id in(select RELEVANT_WORKING_ORDER_ID from GJFX_WARNING_INFO_T where WARNING_SOURCE_ID in(?1) and IMPORTANCE_LEVEL_ID in(?2)) and prov_code IN ( SELECT PROVINCE_CODE FROM DIM_PROVINCE_INFO_T WHERE PROVINCE_ID IN(?3)) AND channel_id IN(?4) AND data_source_id IN (?5) and provider_id in(?8))B ON A.DATE_VALUE=CAST(B.event_happen_time AS DATE) GROUP BY CATEGORY ORDER BY CATEGORY",nativeQuery=true) //change by eric 2014-08-13 22:07 外连接了日期 @Query(value = "SELECT TO_CHAR(DATE_VALUE,'yyyy-mm-dd') AS CATEGORY,COUNT(working_order_id) AS COUNT FROM(SELECT DATE_VALUE FROM dim_date_info_t WHERE DATE_VALUE between ?6 and ?7 )A left join (SELECT event_happen_time, working_order_id FROM XCD_WORKING_ORDER_INFO_T WHERE working_order_id in(select RELEVANT_WORKING_ORDER_ID from GJFX_WARNING_INFO_T where WARNING_SOURCE_ID in(?1) and IMPORTANCE_LEVEL_ID in(?2)) and prov_code IN ( SELECT PROVINCE_CODE FROM DIM_PROVINCE_INFO_T WHERE PROVINCE_ID IN(?3)) AND channel_id IN(?4) AND data_source_id IN (?5) and provider_id in(?8))B ON A.DATE_VALUE=CAST(B.event_happen_time AS DATE) GROUP BY CATEGORY ORDER BY CATEGORY", nativeQuery = true)
List<Object[]> findXcdAnalysisByAll(List<Long> warnsourceids,List<Long> levelids,List<Long> proids,List<Long> channelids,List<Long> sourceids,Date startdate,Date enddate,List<Long> provider); //change by eric 2014-08-13 22:07 外连接了日期
List<Object[]> findXcdAnalysisByAll(List<Long> warnsourceids, List<Long> levelids, List<Long> proids, List<Long> channelids, List<Long> sourceids, Date startdate, Date enddate, List<Long> provider);
//协查单分析页面中告警来源选择了“其他” //协查单分析页面中告警来源选择了“其他”
@Query(value="SELECT TO_CHAR(DATE_VALUE,'yyyy-mm-dd') AS CATEGORY,COUNT(working_order_id) AS COUNT FROM (SELECT DATE_VALUE FROM dim_date_info_t WHERE DATE_VALUE between ?4 and ?5 )A left join(SELECT event_happen_time, working_order_id FROM XCD_WORKING_ORDER_INFO_T s WHERE not exists(select 1 from GJFX_WARNING_INFO_T where RELEVANT_WORKING_ORDER_ID = s.WORKING_ORDER_ID) and prov_code IN ( SELECT PROVINCE_CODE FROM DIM_PROVINCE_INFO_T WHERE PROVINCE_ID IN(?1)) AND channel_id IN(?2) AND data_source_id IN (?3) and provider_id in(?6))B ON A.DATE_VALUE=CAST(B.event_happen_time AS DATE) GROUP BY CATEGORY ORDER BY CATEGORY",nativeQuery=true)//change by eric 2014-08-13 22:07 外连接了日期 @Query(value = "SELECT TO_CHAR(DATE_VALUE,'yyyy-mm-dd') AS CATEGORY,COUNT(working_order_id) AS COUNT FROM (SELECT DATE_VALUE FROM dim_date_info_t WHERE DATE_VALUE between ?4 and ?5 )A left join(SELECT event_happen_time, working_order_id FROM XCD_WORKING_ORDER_INFO_T s WHERE not exists(select 1 from GJFX_WARNING_INFO_T where RELEVANT_WORKING_ORDER_ID = s.WORKING_ORDER_ID) and prov_code IN ( SELECT PROVINCE_CODE FROM DIM_PROVINCE_INFO_T WHERE PROVINCE_ID IN(?1)) AND channel_id IN(?2) AND data_source_id IN (?3) and provider_id in(?6))B ON A.DATE_VALUE=CAST(B.event_happen_time AS DATE) GROUP BY CATEGORY ORDER BY CATEGORY", nativeQuery = true)
List<Object[]> findXcdAnalysisByAllOther(List<Long> proids,List<Long> channelids,List<Long> sourceids,Date startdate,Date enddate,List<Long> provider); //change by eric 2014-08-13 22:07 外连接了日期
List<Object[]> findXcdAnalysisByAllOther(List<Long> proids, List<Long> channelids, List<Long> sourceids, Date startdate, Date enddate, List<Long> provider);
@Query(value = "select infov from XcdWarningInfoView infov where infov.kpiId = :kpiId and infov.provinceId = :provinceId and infov.occurTime >= :occurTime and infov.occurTime <= :closeTime") @Query(value = "select infov from XcdWarningInfoView infov where infov.kpiId = :kpiId and infov.provinceId = :provinceId and infov.occurTime >= :occurTime and infov.occurTime <= :closeTime")
List<XcdWarningInfoView> findXcdWarningInfoViewByKpiIdAndProvinceIdandBeginToEndTime(@Param(value = "kpiId")Long kpiId,@Param(value = "provinceId")Long provinceId, List<XcdWarningInfoView> findXcdWarningInfoViewByKpiIdAndProvinceIdandBeginToEndTime(@Param(value = "kpiId") Long kpiId, @Param(value = "provinceId") Long provinceId,
@Param(value = "occurTime")Date occurTime,@Param(value = "closeTime") Date closeTime); @Param(value = "occurTime") Date occurTime, @Param(value = "closeTime") Date closeTime);
/*@Query(value = "SELECT ASSOCIATION_ID, D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC, PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME," +
" COUNT(E.KPI_ID) AS WARNING_NUM FROM (" +
" SELECT A.ASSOCIATION_ID,A.PROVINCE_ID, A.ASSOCIATION_DESC, A.ASSOCIATION_TYPE, B.KPI_ID, C.PROVINCE_NAME, TO_TIMESTAMP(?3,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME," +
" TO_TIMESTAMP(?4,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME" +
" FROM CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T A INNER JOIN DIM_KPI_ASSOCIATION_RELATED_INFO_T B" +
" ON A.ASSOCIATION_ID=B.ASSOCIATION_ID INNER JOIN (select ASSOCIATION_ID from ccolap.DIM_KPI_ASSOCIATION_RELATED_INFO_T where kpi_id = ?2 ) G" +
"on A.ASSOCIATION_ID=G.ASSOCIATION_ID INNER JOIN DIM_PROVINCE_INFO_T C ON C.PROVINCE_ID= A.PROVINCE_ID) D" +
" LEFT JOIN GJFX_WARNING_INFO_T E" +
" ON D.PROVINCE_ID = E.PROVINCE_ID AND D.KPI_ID =E.KPI_ID AND WARNING_ID LIKE 'J%'" +
" and OCCUR_TIME >= TO_TIMESTAMP(?3,'YYYY-MM-DD HH24:MI:SS')" +
" AND OCCUR_TIME <=TO_TIMESTAMP(?4,'YYYY-MM-DD HH24:MI:SS') WHERE " +
" D.PROVINCE_ID = ?1 GROUP BY ASSOCIATION_ID,D.PROVINCE_ID, ASSOCIATION_TYPE ,ASSOCIATION_DESC,PROVINCE_NAME, WARNING_BEGIN_TIME, WARNING_END_TIME" , nativeQuery = true)
Object[] findObjByProvinceIdAndKpiIdAndoccurTimeAndCloseTime(@Param(value = "provinceId") Long provinceId,
@Param(value = "kpiId") Long kpiId,
@Param(value = "occurTime") Date occurTime,
@Param(value = "closeTime") Date closeTime);*/
} }
...@@ -14,6 +14,7 @@ import com.hp.cmsz.repository.AssociateDiagosisDetailDao; ...@@ -14,6 +14,7 @@ import com.hp.cmsz.repository.AssociateDiagosisDetailDao;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory; import javax.persistence.EntityManagerFactory;
import java.math.BigInteger;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
...@@ -63,6 +64,26 @@ public class AssociateDiagosisDetailService { ...@@ -63,6 +64,26 @@ public class AssociateDiagosisDetailService {
return dimAssociationAnaInfoDao.findAssociateDiagosisDetailByWarnTimeBeginAndEnd(warnBeginTime, warnEndTime); return dimAssociationAnaInfoDao.findAssociateDiagosisDetailByWarnTimeBeginAndEnd(warnBeginTime, warnEndTime);
} }
public AssociateDiagosisDetail findObjByProvinceIdAndKpiIdAndoccurTimeAndCloseTime(Long provinceId, Long kpiId, String occurTime, String closeTime){
Object[] objects= dimAssociationAnaInfoDao.findObjByProvinceIdAndKpiIdAndoccurTimeAndCloseTime(provinceId, kpiId, occurTime, closeTime);
AssociateDiagosisDetail detail=new AssociateDiagosisDetail();
if(objects==null||objects.length<1){
return null;
}else{
detail.setAssociationId((BigInteger)objects[0]);
detail.setProvinceId((BigInteger)objects[1]);
detail.setAssociationType(objects[2].toString().toCharArray()[0]);
detail.setAssociationDesc((String)objects[3]);
detail.setProvinceName((String)objects[4]);
detail.setWarnBeginTime((Timestamp)objects[5]);
detail.setWarnEndTime((Timestamp)objects[6]);
detail.setWarningNum((BigInteger)objects[7]);
return detail;
}
}
public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, char dimension, List<Long> provincelist){ public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, char dimension, List<Long> provincelist){
return dimAssociationAnaInfoDao.findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime,dimension,provincelist); return dimAssociationAnaInfoDao.findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime,dimension,provincelist);
} }
......
...@@ -82,6 +82,9 @@ public class AssociateDiagosisDetailController { ...@@ -82,6 +82,9 @@ public class AssociateDiagosisDetailController {
@Autowired @Autowired
private AssociateDiagosisDetailService associateDiagosisDetailService; private AssociateDiagosisDetailService associateDiagosisDetailService;
@Autowired
private XcdWarningInfoViewDao xcdWarningInfoViewDao;
@RequestMapping("") @RequestMapping("")
...@@ -200,6 +203,7 @@ public class AssociateDiagosisDetailController { ...@@ -200,6 +203,7 @@ public class AssociateDiagosisDetailController {
} }
List<AssociateDiagosisWarningDetail> adwdl = new ArrayList<AssociateDiagosisWarningDetail>(); List<AssociateDiagosisWarningDetail> adwdl = new ArrayList<AssociateDiagosisWarningDetail>();
if(WarningDetailList !=null){
for (Object[] objects : WarningDetailList) { for (Object[] objects : WarningDetailList) {
AssociateDiagosisWarningDetail adwd = new AssociateDiagosisWarningDetail(); AssociateDiagosisWarningDetail adwd = new AssociateDiagosisWarningDetail();
adwd.setASSOCIATION_ID(String.valueOf(objects[0]) ); adwd.setASSOCIATION_ID(String.valueOf(objects[0]) );
...@@ -215,12 +219,7 @@ public class AssociateDiagosisDetailController { ...@@ -215,12 +219,7 @@ public class AssociateDiagosisDetailController {
adwd.setINFLUENCE_LEVEL(String.valueOf( objects[12])); adwd.setINFLUENCE_LEVEL(String.valueOf( objects[12]));
adwdl.add(adwd); adwdl.add(adwd);
} }
}
map.put("warningDetailList",adwdl); map.put("warningDetailList",adwdl);
...@@ -422,30 +421,57 @@ public class AssociateDiagosisDetailController { ...@@ -422,30 +421,57 @@ public class AssociateDiagosisDetailController {
} }
@RequestMapping("/yinjingyinhuanToguanlianzhenduanmingxi") @RequestMapping("/yinjingyinhuanToguanlianzhenduanmingxi")
public String yinjingyinhuanToguanlianzhenduanmingxi(Map model, ServletRequest request, HttpSession session) public String yinjingyinhuanToguanlianzhenduanmingxi(
@RequestParam(value = "warningId",defaultValue = "") String warningId,
Map model, ServletRequest request, HttpSession session)
throws UnsupportedEncodingException, ParseException { throws UnsupportedEncodingException, ParseException {
List<Province> provinceList =(List<Province>) provinceDao.findProvince(); List<Province> provinceList =(List<Province>) provinceDao.findProvince();
String timestamp1=getLastMonth();//getOld();
String timestamp2=getNow();//getNew();
List<Object[]> diagosisDetailsObj=associateDiagosisDetailService.findAssociateDiagosisDetailByWarnTimeBeginAndEnd(timestamp1,timestamp2);
List<AssociateDiagosisDetail> associateDiagosisDetails=new ArrayList<AssociateDiagosisDetail>();
for (Object[] objects : diagosisDetailsObj) {
AssociateDiagosisDetail detail=new AssociateDiagosisDetail();
detail.setAssociationId((BigInteger)objects[0]);
detail.setProvinceId((BigInteger)objects[1]);
detail.setAssociationType(objects[2].toString().toCharArray()[0]);
detail.setAssociationDesc((String)objects[3]);
detail.setProvinceName((String)objects[4]);
detail.setWarnBeginTime((Timestamp)objects[5]);
detail.setWarnEndTime((Timestamp)objects[6]);
detail.setWarningNum((BigInteger)objects[7]);
associateDiagosisDetails.add(detail);
}
model.put("provinceList", provinceList); model.put("provinceList", provinceList);
List <XcdWarningInfoView> list=xcdWarningInfoViewDao.findByWarningId(warningId);
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String occurTimes="";
String closeTimes="";
if(list==null||list.size()<1){
return PageURLController.AssociateDiagosisDetail;
}else {
XcdWarningInfoView view=list.get(0);
Long provinceId=view.getProvinceId();
Long kpiId=view.getKpiId();
Date occurTime=view.getOccurTime();
Date closeTime=view.getCloseTime();
if(occurTime!=null){
Calendar calendar=Calendar.getInstance();
calendar.setTime(occurTime);
calendar.set(Calendar.HOUR,calendar.get(Calendar.HOUR)-2);
occurTime=calendar.getTime();
occurTimes=format.format(calendar.getTime());
}
if(closeTime == null){
Calendar calendar=Calendar.getInstance();
calendar.setTime(view.getOccurTime());
calendar.set(Calendar.HOUR,calendar.get(Calendar.HOUR)+2);
closeTimes=format.format(calendar.getTime());
}else{
closeTimes=format.format(closeTime);
}
AssociateDiagosisDetail detail=associateDiagosisDetailService.findObjByProvinceIdAndKpiIdAndoccurTimeAndCloseTime(provinceId,kpiId,occurTimes,closeTimes);
List<AssociateDiagosisDetail> list1=new ArrayList();
if(detail !=null){
list1.add(detail);
}
Gson gson=new Gson(); Gson gson=new Gson();
model.put("diagosisDetails", gson.toJson(associateDiagosisDetails)); model.put("diagosisDetails", gson.toJson(list1));
return PageURLController.AssociateDiagosisDetail; return PageURLController.AssociateDiagosisDetail;
} }
}
} }
...@@ -27,10 +27,6 @@ ...@@ -27,10 +27,6 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
// alert(1);
// failureTable();
// initDateDetail();
//$("#businessSelectAreaDetail").hide();
initDate(); initDate();
//初始化界面 //初始化界面
initTable(); initTable();
...@@ -143,10 +139,7 @@ ...@@ -143,10 +139,7 @@
<!--写故障明细列表处--> <!--写故障明细列表处-->
<table class="table table-hover table-striped" <table class="table table-hover table-striped"
id="failureAnalysisDetailTable"> id="failureAnalysisDetailTable">
</table> </table>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -710,12 +710,13 @@ th{ ...@@ -710,12 +710,13 @@ th{
*/ */
$("#guanlian").click(function(){ $("#guanlian").click(function(){
alert(ids[0]); // alert(ids[0]);
if(ids.length>10){ if(ids.length>1){
$.alert("最多只能选一个"); $.alert("最多只能选一个");
return; return;
} }
window.location.href="${ctx}/MonitorOperation/AssociateDiagosisDetail/yinjingyinhuanToguanlianzhenduanmingxi"; //window.location.href="${ctx}/MonitorOperation/AssociateDiagosisDetail/yinjingyinhuanToguanlianzhenduanmingxi?warningId="+ids[0];
window.open("${ctx}/MonitorOperation/AssociateDiagosisDetail/yinjingyinhuanToguanlianzhenduanmingxi?warningId="+ids[0]);
}); });
$(function(){ $(function(){
......
...@@ -4,7 +4,6 @@ function initTable(){ ...@@ -4,7 +4,6 @@ function initTable(){
jsonStr = document.getElementById('gzfxDetail').value; jsonStr = document.getElementById('gzfxDetail').value;
// alert("jsonStr" +jsonStr); // alert("jsonStr" +jsonStr);
var header = new Array(); var header = new Array();
header[0] = ["","1","1%",""]; header[0] = ["","1","1%",""];
header[1] = ["省份","provinceName","5%",""]; header[1] = ["省份","provinceName","5%",""];
header[2] = ["类型","associationType","8%",""]; header[2] = ["类型","associationType","8%",""];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment