Commit 53aa1338 authored by 胡斌's avatar 胡斌

Merge remote-tracking branch 'origin/moly'

parents 2f506a82 308bcc9d
This source diff could not be displayed because it is too large. You can view the blob instead.
/** /**
* *
*/ */
package com.hp.cmsz.entity; package com.hp.cmsz.entity;
...@@ -18,7 +18,7 @@ import javax.persistence.Table; ...@@ -18,7 +18,7 @@ import javax.persistence.Table;
/** /**
* dim_city_info_t琛ㄥ搴旂殑瀹炰綋绫� * dim_city_info_t琛ㄥ搴旂殑瀹炰綋绫�
* *
* @author Guo Xuan * @author Guo Xuan
* *
*/ */
...@@ -26,39 +26,39 @@ import javax.persistence.Table; ...@@ -26,39 +26,39 @@ import javax.persistence.Table;
@Table(name = "dim_city_info_t ") @Table(name = "dim_city_info_t ")
public class City implements Serializable{ public class City implements Serializable{
private Long cityId;//鍦板競ID private Long cityId;//鍦板競ID
private String cityName;//鍦板競鍚嶇О private String cityName;//鍦板競鍚嶇О
private String cityCode;//鍦板競缂栫爜 private String cityCode;//鍦板競缂栫爜
private Long provinceId;//鐪佷唤ID private Long provinceId;//鐪佷唤ID
@Id @Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CitySequence") @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CitySequence")
@SequenceGenerator(name = "CitySequence", sequenceName = "dim_city_info_t_seq", allocationSize=20) @SequenceGenerator(name = "CitySequence", sequenceName = "dim_city_info_t_seq", allocationSize=20)
public String getCityName() { public String getCityName() {
return cityName; return cityName;
} }
public void setCityName(String cityName) { public void setCityName(String cityName) {
this.cityName = cityName; this.cityName = cityName;
} }
public String getCityCode() { public String getCityCode() {
return cityCode; return cityCode;
} }
public void setCityCode(String cityCode) { public void setCityCode(String cityCode) {
this.cityCode = cityCode; this.cityCode = cityCode;
} }
public Long getCityId() { public Long getCityId() {
return cityId; return cityId;
} }
public void setCityId(Long cityId) { public void setCityId(Long cityId) {
this.cityId = cityId; this.cityId = cityId;
} }
public Long getProvinceId() { public Long getProvinceId() {
return provinceId; return provinceId;
} }
public void setProvinceId(Long provinceId) { public void setProvinceId(Long provinceId) {
this.provinceId = provinceId; this.provinceId = provinceId;
} }
} }
...@@ -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,76 +21,101 @@ import com.hp.cmsz.entity.XcdDetailInfoView; ...@@ -22,76 +21,101 @@ 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获取对应的预警或隐患的记录
List <XcdWarningInfoView> findByWarningId(String warningId); //根据告警ID获取对应的预警或隐患的记录
//默认页面中查找出所有的预警或隐患并按照occurTime降序排列 List<XcdWarningInfoView> findByWarningId(String warningId);
@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(); //默认页面中查找出所有的预警或隐患并按照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")
//从首页跳转过来的页面 List<XcdWarningInfoView> findAllOrderByTime();
@Query("from XcdWarningInfoView where warningStatus ='0' order by occurTime desc, warningSourceId asc, dataSourceId asc, channelId asc, provinceId asc, kpiId asc")
List<XcdWarningInfoView> findAllUnConfirmOrderByTime(); //从首页跳转过来的页面
@Query("from XcdWarningInfoView where warningStatus ='0' order by occurTime desc, warningSourceId asc, dataSourceId asc, channelId asc, provinceId asc, kpiId asc")
//根据被选中的告警id去查找所有的告警 List<XcdWarningInfoView> findAllUnConfirmOrderByTime();
List<XcdWarningInfoView> findByWarningIdIn(List<String> warningId);//这个是针对于生成协查单的时候,提供被选中的告警下载成为word文件
//根据被选中的告警id查找出最大的告警发生时间 //根据被选中的告警id去查找所有的告警
@Query("select min(occurTime) from XcdWarningInfoView where warningId in(?1)") List<XcdWarningInfoView> findByWarningIdIn(List<String> warningId);//这个是针对于生成协查单的时候,提供被选中的告警下载成为word文件
Date findMinOccurTimeByWarningIdIn(List<String> warningId);
//根据被选中的告警id查找出最大的告警发生时间
//根据告警id查找对应的riskEarlyWarningTypeId,以供生成协查单是的协查单标题 @Query("select min(occurTime) from XcdWarningInfoView where warningId in(?1)")
Date findMinOccurTimeByWarningIdIn(List<String> warningId);
@Query("select x.riskEarlyWarningTypeId from XcdWarningInfoView x where x.warningId= ?1")
Long findriskWaringIdByWarningId(String warningId); //根据告警id查找对应的riskEarlyWarningTypeId,以供生成协查单是的协查单标题
//根据告警id查找对应的渠道,取第一个的告警的渠道,以供生成协查单时的协查单标题 @Query("select x.riskEarlyWarningTypeId from XcdWarningInfoView x where x.warningId= ?1")
@Query("select x.channelName from XcdWarningInfoView x where x.warningId= ?1") Long findriskWaringIdByWarningId(String warningId);
String findChannelByWarningId(String warningId);
//根据告警id查找对应的渠道,取第一个的告警的渠道,以供生成协查单时的协查单标题
//根据告警id查找出所有的不同的渠道,以供生成协查单时的协查单描述 @Query("select x.channelName from XcdWarningInfoView x where x.warningId= ?1")
@Query("select distinct x.channelName from XcdWarningInfoView x where x.warningId in(?1)") String findChannelByWarningId(String warningId);
List<String> findDistinctChannelByWarningId(List<String> warningId);
//根据告警id查找出所有的不同的渠道,以供生成协查单时的协查单描述
//根据被选中的告警id,以及渠道,查找出对应的业务,以供生成协查单时的协查单描述 @Query("select distinct x.channelName from XcdWarningInfoView x where x.warningId in(?1)")
@Query("select distinct x.businessName from XcdWarningInfoView x where x.warningId in(?1) and x.channelName =?2") List<String> findDistinctChannelByWarningId(List<String> warningId);
List<String> findDistinctBusinessByIdAndChannel(List<String>id,String channel);
//根据被选中的告警id,以及渠道,查找出对应的业务,以供生成协查单时的协查单描述
//根据被选中的告警id,查找出平台的对应的指标,以供生成协查单时的协查单描述 @Query("select distinct x.businessName 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> findDistinctBusinessByIdAndChannel(List<String> id, String channel);
List<String> findDistinctKpiById(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 provinceName from XcdWarningInfoView where warningId=?1") List<String> findDistinctKpiById(List<String> id, String channel);
String findProvinceByWarningId(String warningid);
//生成协查单时根据告警id查找出对应的省份名字
//协查单分析页面的折线图默认页面,最近一个月的 @Query("select provinceName from XcdWarningInfoView where warningId=?1")
@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 外连接了日期 String findProvinceByWarningId(String warningid);
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 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)
@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 外连接了日期 //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); 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 ?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 ?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[]> 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[]> 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 ?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 外连接了日期
List<Object[]> findXcdAnalysisByAllOther(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 infov from XcdWarningInfoView infov where infov.kpiId = :kpiId and infov.provinceId = :provinceId and infov.occurTime >= :occurTime and infov.occurTime <= :closeTime") 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);
List<XcdWarningInfoView> findXcdWarningInfoViewByKpiIdAndProvinceIdandBeginToEndTime(@Param(value = "kpiId")Long kpiId,@Param(value = "provinceId")Long provinceId,
@Param(value = "occurTime")Date occurTime,@Param(value = "closeTime") Date closeTime); //协查单分析页面中告警来源选择了“其他”
@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 外连接了日期
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")
List<XcdWarningInfoView> findXcdWarningInfoViewByKpiIdAndProvinceIdandBeginToEndTime(@Param(value = "kpiId") Long kpiId, @Param(value = "provinceId") Long provinceId,
@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,28 +203,24 @@ public class AssociateDiagosisDetailController { ...@@ -200,28 +203,24 @@ public class AssociateDiagosisDetailController {
} }
List<AssociateDiagosisWarningDetail> adwdl = new ArrayList<AssociateDiagosisWarningDetail>(); List<AssociateDiagosisWarningDetail> adwdl = new ArrayList<AssociateDiagosisWarningDetail>();
for (Object[] objects : WarningDetailList) { if(WarningDetailList !=null){
AssociateDiagosisWarningDetail adwd = new AssociateDiagosisWarningDetail(); for (Object[] objects : WarningDetailList) {
adwd.setASSOCIATION_ID(String.valueOf(objects[0]) ); AssociateDiagosisWarningDetail adwd = new AssociateDiagosisWarningDetail();
adwd.setASSOCIATION_TYPE(objects[2]+""); adwd.setASSOCIATION_ID(String.valueOf(objects[0]) );
adwd.setASSOCIATION_DESC(objects[3]+""); adwd.setASSOCIATION_TYPE(objects[2]+"");
adwd.setPROVINCE_NAME( objects[4]+""); adwd.setASSOCIATION_DESC(objects[3]+"");
adwd.setPROVINCE_ID( objects[1]+""); adwd.setPROVINCE_NAME( objects[4]+"");
adwd.setKPI_CODE(objects[7]+""); adwd.setPROVINCE_ID( objects[1]+"");
adwd.setKPI_NAME(objects[8]+""); adwd.setKPI_CODE(objects[7]+"");
adwd.setKPI_ID(String.valueOf(objects[9])); adwd.setKPI_NAME(objects[8]+"");
adwd.setKPI_WEIGHT(String.valueOf(objects[10])); adwd.setKPI_ID(String.valueOf(objects[9]));
adwd.setWARNING_NUM(String.valueOf( objects[11])); adwd.setKPI_WEIGHT(String.valueOf(objects[10]));
adwd.setINFLUENCE_LEVEL(String.valueOf( objects[12])); adwd.setWARNING_NUM(String.valueOf( objects[11]));
adwdl.add(adwd); adwd.setINFLUENCE_LEVEL(String.valueOf( objects[12]));
adwdl.add(adwd);
}
} }
map.put("warningDetailList",adwdl); map.put("warningDetailList",adwdl);
return PageURLController.AssociateDetails; return PageURLController.AssociateDetails;
...@@ -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);
Gson gson=new Gson();
model.put("diagosisDetails", gson.toJson(associateDiagosisDetails));
return PageURLController.AssociateDiagosisDetail; 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();
model.put("diagosisDetails", gson.toJson(list1));
return PageURLController.AssociateDiagosisDetail;
}
} }
} }
#linux server ip address
linux_server_ip=localhost
#set system parameters for 4A by huach on 20140802 begin
4a.server.ip=172.16.8.121
4a.login.url=http://172.16.8.121:8080/venus4a/TicketloginAction.do?method=appLoginResult
4a.logout.url=http://172.16.8.121:8080/venus4a/TicketloginAction.do?method=appExit
4a.syslog.ip=172.16.8.117
4a.syslog.port=514
local.ip.prefix=192.168
#set system parameters for 4A by huach on 20140802 end
#vertica database setting
#jdbc.driver=com.vertica.jdbc.Driver
#vertica database ip address
jdbc.dbip=hg-computer
jdbc.dbport=5433
jdbc.database=ccolap
#jdbc.url=jdbc\:vertica\://16.162.242.79\:5433/ccolap
#jdbc.username=CCOLAP
#jdbc.password=ccolap-cmsz
#jdbc.driver=com.vertica.jdbc.Driver
#jdbc.driver=oracle.jdbc.driver.OracleDriver
#jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
#jdbc.username=szcm
#jdbc.password=szcm
jdbc.driver=com.vertica.jdbc.Driver
jdbc.url=jdbc:vertica://hg-computer:5433/cmsz_ccolap
jdbc.username=ccolap
jdbc.password=hg.2015
##test
#connection pool settings
jdbc.pool.initialSize=10
jdbc.pool.maxActive=100
jdbc.pool.maxIdle=50
jdbc.pool.minIdle=10
jdbc.pool.suspectTimeout=60
jdbc.pool.timeBetweenEvictionRunsMillis=30000
jdbc.pool.minEvictableIdleTimeMillis=60000
jdbc.pool.removeAbandoned=true
jdbc.pool.removeAbandonedTimeout=60
jdbc.pool.logAbandoned=true
#############
perl.location=/perl/xcd_variable_analysis.pl
insert.script.location=/perl/xcd_variable_analysis.txt
...@@ -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