@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," +
"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.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') " +
"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)*/
@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 ,"+
" WARNING_END_TIME AS warningEndTime ,"+
" COUNT(E.KPI_ID) AS warningNum "+
"FROM "+
" ( "+
" SELECT "+
" A.ASSOCIATION_ID, "+
" C.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, CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B , "+
" TO_TIMESTAMP(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_END_TIME" +
...
...
@@ -71,7 +113,49 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
" 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(?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)*/
@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 ,"+
" WARNING_END_TIME AS warningEndTime ,"+
" COUNT(E.KPI_ID) AS warningNum "+
" FROM "+
" ( "+
" SELECT "+
" A.ASSOCIATION_ID, "+
" C.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, CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B , "+
" CCOLAP.DIM_PROVINCE_INFO_T C "+
"WHERE "+
" A.ASSOCIATION_ID=B.ASSOCIATION_ID and A.ASSOCIATION_TYPE=?3 and C.PROVINCE_ID in(?4)) D "+
@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"
@@ -51,4 +51,7 @@ public interface ProvinceDao extends JpaSpecificationExecutor<Province>,
//由集成商Ids得到省份信息
@Query("select province from Province province , ProvinceVersionConfig provinceVersionConfig where provinceVersionConfig.provinceId=province.provinceId and provinceVersionConfig.bossProviderId in (:bossProviderIds) order by province.provinceId")
@@ -42,5 +42,14 @@ public interface XcdChangeOrderDao extends JpaSpecificationExecutor<XcdChangeOrd
//根据告警id得到变更单信息 Add by Charmy
@Query(value="select change_order_code , change_order_title , change_start_time, change_end_time from xcd_change_order_info_t cross join (select occur_time,warning_id,cast(parameter_value as number) parameter_value,province_id from gjfx_warning_info_t, dim_system_parameter_info_t where warning_id=:warningID and parameter_name='CHANGE_ORDER_SEARCH_HOURS') gjfx_warning_info_t where (change_start_time>occur_time-parameter_value/24 and change_start_time<occur_time+parameter_value/24 or change_end_time>occur_time-parameter_value/24 and change_end_time<occur_time+parameter_value/24) and gjfx_warning_info_t.province_id=xcd_change_order_info_t.province_id order by change_end_time desc",nativeQuery=true)