Commit 746fcd2e authored by 莫林毅's avatar 莫林毅

监控运营 ->告警关联诊断 ->关联诊断明细 界面

更换 SQL语句
parent 33c97c81
...@@ -40,14 +40,56 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs ...@@ -40,14 +40,56 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
@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," +
"WARNING_END_TIME as warningEndTime,COUNT(E.KPI_ID)AS warningNum FROM " + "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, " + "( 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" + "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)*/
@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) 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)
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 ," +
...@@ -61,7 +103,7 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs ...@@ -61,7 +103,7 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBegin(String warnBeginTime, String warnEndTime); public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBegin(String warnBeginTime, String warnEndTime);
@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" +
...@@ -71,7 +113,49 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs ...@@ -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%'" + " 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)*/
@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 " +
" 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)
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);
...@@ -87,14 +171,149 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs ...@@ -87,14 +171,149 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
" and OCCUR_TIME >= TO_TIMESTAMP(?3,'YYYY-MM-DD HH24:MI:SS')" + " 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 " + " 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) " 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[] findObjByProvinceIdAndKpiIdAndoccurTimeAndCloseTime(/*@Param(value = "provinceId")*/ Long provinceId, public Object[] findObjByProvinceIdAndKpiIdAndoccurTimeAndCloseTime( Long provinceId,
/*@Param(value = "kpiId")*/ Long kpiId, Long kpiId,
/*@Param(value = "occurTime")*/ String occurTime, String occurTime,
/*@Param(value = "closeTime")*/ String 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, 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" @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);
@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, " +
" C.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, CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T B , " +
" CCOLAP.DIM_PROVINCE_INFO_T C, CCOLAP.DIM_KPI_INFO_T D " +
" WHERE " +
" A.ASSOCIATION_ID=B.ASSOCIATION_ID " +
" and C.PROVINCE_ID=?4 " +
" and " +
" 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 " +
" 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, " +
" d.PROVINCE_NAME, " +
" WARNING_BEGIN_TIME, " +
" WARNING_END_TIME, " +
" D.KPI_CODE, " +
" D.KPI_NAME, " +
" D.KPI_ID, " +
" KPI_WEIGHT)G",
nativeQuery = true)
public List<Object[]>findDetailByBeginTimeAndEndTimeAndAssociationIdAndProvinceId(String beginTime,String endTime,
Long associationId,Long provinceId);
@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(?2,'YYYY-MM-DD HH24:MI:SS') AS WARNING_BEGIN_TIME, " +
" TO_TIMESTAMP(?3,'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 C.PROVINCE_ID =?1 ) 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(?2,'YYYY-MM-DD HH24:MI:SS') " +
" AND OCCUR_TIME <=TO_TIMESTAMP(?3,'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)
public List<Object[]> findObjByProvinceIdAndoccurTimeAndCloseTime( Long provinceId,
String occurTime,
String closeTime);
} }
...@@ -51,4 +51,7 @@ public interface ProvinceDao extends JpaSpecificationExecutor<Province>, ...@@ -51,4 +51,7 @@ public interface ProvinceDao extends JpaSpecificationExecutor<Province>,
//由集成商Ids得到省份信息 //由集成商Ids得到省份信息
@Query("select province from Province province , ProvinceVersionConfig provinceVersionConfig where provinceVersionConfig.provinceId=province.provinceId and provinceVersionConfig.bossProviderId in (:bossProviderIds) order by province.provinceId") @Query("select province from Province province , ProvinceVersionConfig provinceVersionConfig where provinceVersionConfig.provinceId=province.provinceId and provinceVersionConfig.bossProviderId in (:bossProviderIds) order by province.provinceId")
List<Province> findProvinceByProviderIds(@Param("bossProviderIds")List<Long> bossProviderIds); List<Province> findProvinceByProviderIds(@Param("bossProviderIds")List<Long> bossProviderIds);
@Query("select provinceId from Province where provinceName= ?1")
public Long findProvinceIdByProvinceName(String provinceName);
} }
...@@ -2,6 +2,7 @@ package com.hp.cmsz.service.monitoroperation; ...@@ -2,6 +2,7 @@ package com.hp.cmsz.service.monitoroperation;
import com.hp.cmsz.entity.AssociateDiagosisDetail; import com.hp.cmsz.entity.AssociateDiagosisDetail;
import com.hp.cmsz.entity.AssociateDiagosisWarningDetail;
import com.hp.cmsz.entity.XcdWarningInfoView; import com.hp.cmsz.entity.XcdWarningInfoView;
import com.hp.cmsz.repository.DimAssociationAnaInfoDao; import com.hp.cmsz.repository.DimAssociationAnaInfoDao;
import com.hp.cmsz.repository.XcdWarningInfoViewDao; import com.hp.cmsz.repository.XcdWarningInfoViewDao;
...@@ -17,6 +18,7 @@ import javax.persistence.EntityManagerFactory; ...@@ -17,6 +18,7 @@ import javax.persistence.EntityManagerFactory;
import java.math.BigInteger; import java.math.BigInteger;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -33,30 +35,8 @@ public class AssociateDiagosisDetailService { ...@@ -33,30 +35,8 @@ public class AssociateDiagosisDetailService {
@Autowired @Autowired
private XcdWarningInfoViewDao xcdWarningInfoViewDao; private XcdWarningInfoViewDao xcdWarningInfoViewDao;
/*
public List<AssociateDiagosisDetail> findLastDiagosisDetail() {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd:HH:mm:ss");
Calendar calendar = Calendar.getInstance();
System.out.println(format.format(calendar.getTime()));
calendar.add(Calendar.MONTH, -1);
System.out.println(format.format(calendar.getTime()));
List<AssociateDiagosisDetail> list = associateDiagosisDetailDao.findByWarnBeginTimeGreaterThanEqual(new Timestamp(calendar.getTimeInMillis()));
System.out.println(list);
return null;// associateDiagosisDetailDao.findByWarnBeginTimeGreaterThanEqual(new Timestamp(calendar.getTimeInMillis()));
}
public List<AssociateDiagosisDetail> findByBeginToEndTimeAndAssociationTypeAndProvinceId(Timestamp beginTime, Timestamp endTime,
String type,List<Long> proviceIdList) {
return associateDiagosisDetailDao.findByBeginToEndTimeAndAssociationTypeAndProvinceId(beginTime, endTime, type, proviceIdList);
}
*/
public List<Object[]> findAssociateDiagosisDetailByWarnTimeBeginAndEnd( String warnBeginTime, String warnEndTime){
return dimAssociationAnaInfoDao.findAssociateDiagosisDetailByWarnTimeBeginAndEnd(warnBeginTime, warnEndTime);
}
public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBegin( String warnBeginTime){ public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBegin( String warnBeginTime){
Calendar calendar=Calendar.getInstance(); Calendar calendar=Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -84,13 +64,54 @@ public class AssociateDiagosisDetailService { ...@@ -84,13 +64,54 @@ public class AssociateDiagosisDetailService {
} }
} }
public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, char dimension, List<Long> provincelist){ public List<AssociateDiagosisDetail> findAssociateDiagosisDetailByWarnTimeBeginAndEnd( String warnBeginTime, String warnEndTime){
return dimAssociationAnaInfoDao.findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime,dimension,provincelist); List<Object[]> list= dimAssociationAnaInfoDao.findAssociateDiagosisDetailByWarnTimeBeginAndEnd(warnBeginTime, warnEndTime);
List<AssociateDiagosisDetail>diagosisDetails=new ArrayList<AssociateDiagosisDetail>();
if(null!=list){
for (Object[] objects : list) {
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]);
diagosisDetails.add(detail);
}
}
return diagosisDetails;
// return dimAssociationAnaInfoDao.findAssociateDiagosisDetailByWarnTimeBeginAndEnd(warnBeginTime, warnEndTime);
}
public List<AssociateDiagosisDetail> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, char dimension, List<Long> provincelist){
List<Object[]> list=dimAssociationAnaInfoDao.findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime,dimension,provincelist);
List<AssociateDiagosisDetail>diagosisDetails=new ArrayList<AssociateDiagosisDetail>();
if(null!=list){
for (Object[] objects : list) {
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]);
diagosisDetails.add(detail);
}
}
return diagosisDetails;
// return dimAssociationAnaInfoDao.findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime,dimension,provincelist);
} }
// public Object[] findDetailByAssociationIdAndWarnBeginToEndTime(String beginTime,String endTime,Long associationId){
// return dimAssociationAnaInfoDao.findDetailByAssociationIdAndWarnBeginToEndTime(beginTime,endTime,associationId);
// }
public List<Object[]> findByWarningListDetail(String beginTime,String endTime,Long associationId){ public List<Object[]> findByWarningListDetail(String beginTime,String endTime,Long associationId){
...@@ -110,5 +131,55 @@ public class AssociateDiagosisDetailService { ...@@ -110,5 +131,55 @@ public class AssociateDiagosisDetailService {
return null; return null;
} }
public List<AssociateDiagosisWarningDetail>findDetailByBeginTimeAndEndTimeAndAssociationIdAndProvinceId(String beginTime,String endTime,
Long associationId,Long provinceId){
List<Object[]>list= dimAssociationAnaInfoDao.findDetailByBeginTimeAndEndTimeAndAssociationIdAndProvinceId(beginTime, endTime, associationId, provinceId);
List<AssociateDiagosisWarningDetail> adwdl = new ArrayList<AssociateDiagosisWarningDetail>();
if(list!=null&&list.size()>0){
if(list !=null){
for (Object[] objects : list) {
AssociateDiagosisWarningDetail adwd = new AssociateDiagosisWarningDetail();
adwd.setASSOCIATION_ID(String.valueOf(objects[0]) );
adwd.setASSOCIATION_TYPE(objects[2]+"");
adwd.setASSOCIATION_DESC(objects[3]+"");
adwd.setPROVINCE_NAME( objects[4]+"");
adwd.setPROVINCE_ID( objects[1]+"");
adwd.setKPI_CODE(objects[7]+"");
adwd.setKPI_NAME(objects[8]+"");
adwd.setKPI_ID(String.valueOf(objects[9]));
adwd.setKPI_WEIGHT(String.valueOf(objects[10]));
adwd.setWARNING_NUM(String.valueOf( objects[11]));
adwd.setINFLUENCE_LEVEL(String.valueOf( objects[12]));
adwdl.add(adwd);
}
}
}
return adwdl;
}
public List<AssociateDiagosisDetail> findDetailByProvinceIdAndoccurTimeAndCloseTime( Long provinceId,
String occurTime,
String closeTime){
List<Object[]>list= dimAssociationAnaInfoDao.findObjByProvinceIdAndoccurTimeAndCloseTime(provinceId, occurTime, closeTime);
List<AssociateDiagosisDetail> associateDiagosisDetails = new ArrayList<AssociateDiagosisDetail>();
if(list!=null&&list.size()>0){
for (Object[] objects : list) {
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);
}
}
return associateDiagosisDetails;
}
} }
...@@ -37,7 +37,6 @@ import sun.rmi.transport.ObjectTable; ...@@ -37,7 +37,6 @@ import sun.rmi.transport.ObjectTable;
* AssociateDiagosisDetailControllerr 监控运营>告警关联诊>关联诊断明细 * AssociateDiagosisDetailControllerr 监控运营>告警关联诊>关联诊断明细
* *
* @author Molinyi * @author Molinyi
*
*/ */
@Controller @Controller
@RequestMapping(value = "/MonitorOperation/AssociateDiagosisDetail") @RequestMapping(value = "/MonitorOperation/AssociateDiagosisDetail")
...@@ -86,30 +85,16 @@ public class AssociateDiagosisDetailController { ...@@ -86,30 +85,16 @@ public class AssociateDiagosisDetailController {
private XcdWarningInfoViewDao xcdWarningInfoViewDao; private XcdWarningInfoViewDao xcdWarningInfoViewDao;
@RequestMapping("") @RequestMapping("")
public String lis(Map model, ServletRequest request, HttpSession session) public String lis(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 timestamp1 = getLastMonth();//getOld();
String timestamp2=getNow();//getNew(); String timestamp2 = getNow();//getNew();
List<Object[]> diagosisDetailsObj=associateDiagosisDetailService.findAssociateDiagosisDetailByWarnTimeBeginAndEnd(timestamp1,timestamp2); List<AssociateDiagosisDetail> associateDiagosisDetails = 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(); Gson gson = new Gson();
model.put("diagosisDetails", gson.toJson(associateDiagosisDetails)); model.put("diagosisDetails", gson.toJson(associateDiagosisDetails));
return PageURLController.AssociateDiagosisDetail; return PageURLController.AssociateDiagosisDetail;
} }
...@@ -117,111 +102,86 @@ public class AssociateDiagosisDetailController { ...@@ -117,111 +102,86 @@ public class AssociateDiagosisDetailController {
@RequestMapping("/tableList") @RequestMapping("/tableList")
@ResponseBody @ResponseBody
public String tableList(@RequestParam(value = "detailtime",defaultValue = "") String detailtime, public String tableList(@RequestParam(value = "detailtime", defaultValue = "") String detailtime,
@RequestParam(value = "dimension",defaultValue = "")String dimension, @RequestParam(value = "dimension", defaultValue = "") String dimension,
@RequestParam(value = "detailProvince",defaultValue = "")String detailProvince){ @RequestParam(value = "detailProvince", defaultValue = "") String detailProvince) {
String str=""; String str = "";
if(detailtime.equalsIgnoreCase("") if (detailtime.equalsIgnoreCase("")
||dimension.equalsIgnoreCase("")||detailProvince.equalsIgnoreCase("")){ || dimension.equalsIgnoreCase("") || detailProvince.equalsIgnoreCase("")) {
return str; return str;
} }
String[]provinceStr=detailProvince.split(","); String[] provinceStr = detailProvince.split(",");
List<Long>provinceList=new ArrayList<Long>(); List<Long> provinceList = new ArrayList<Long>();
String[] times = detailtime.split("~"); String[] times = detailtime.split("~");
String warnBeginTime=""; String warnBeginTime = "";
String warnEndTime=""; String warnEndTime = "";
warnBeginTime = times[0]; warnBeginTime = times[0];
warnBeginTime.replaceAll("%"," "); warnBeginTime.replaceAll("%", " ");
warnEndTime = times[1]; warnEndTime = times[1];
warnEndTime.replaceAll("%"," "); warnEndTime.replaceAll("%", " ");
char dimensionc='d'; char dimensionc = 'd';
try { try {
for (String s : provinceStr) { for (String s : provinceStr) {
provinceList.add(Long.parseLong(s)); provinceList.add(Long.parseLong(s));
} }
dimensionc=dimension.charAt(0); dimensionc = dimension.charAt(0);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
format.parse(warnBeginTime); format.parse(warnBeginTime);
format.parse(warnEndTime); format.parse(warnEndTime);
}catch (Exception e){ } catch (Exception e) {
e.getMessage(); e.getMessage();
System.out.println(e.getMessage()); System.out.println(e.getMessage());
return str; return str;
} }
List<Object[]>diagosisDetailsObj=associateDiagosisDetailService. List<AssociateDiagosisDetail> diagosisDetails = associateDiagosisDetailService.
findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime,warnEndTime,dimensionc,provinceList); findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime, dimensionc, provinceList);
List<AssociateDiagosisDetail>diagosisDetails=new ArrayList<AssociateDiagosisDetail>();
for (Object[] objects : diagosisDetailsObj) { Gson gson = new Gson();
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]);
diagosisDetails.add(detail);
}
Gson gson=new Gson();
System.out.println("gson.toJson(diagosisDetails) "+gson.toJson(diagosisDetails));
return gson.toJson(diagosisDetails); return gson.toJson(diagosisDetails);
} }
@RequestMapping(value ={"/details"}) // 详情超链接
@RequestMapping(value = {"/details"})
public String details( public String details(
@RequestParam(value = "associationId",defaultValue = "") String associationId, @RequestParam(value = "associationId", defaultValue = "") String associationId,
@RequestParam(value = "provinceName",defaultValue = "") String provinceName, @RequestParam(value = "provinceName", defaultValue = "") String provinceName,
@RequestParam(value = "associationType",defaultValue = "") String associationType, @RequestParam(value = "associationType", defaultValue = "") String associationType,
@RequestParam(value = "associationDesc",defaultValue = "") String associationDesc, @RequestParam(value = "associationDesc", defaultValue = "") String associationDesc,
@RequestParam(value = "warningNum",defaultValue = "") String warningNum, @RequestParam(value = "warningNum", defaultValue = "") String warningNum,
@RequestParam(value = "beginTime",defaultValue = "") String beginTime, @RequestParam(value = "beginTime", defaultValue = "") String beginTime,
@RequestParam(value = "endTime",defaultValue = "") String endTime, @RequestParam(value = "endTime", defaultValue = "") String endTime,
Map map){ Map map) {
map.put("associationId",associationId); map.put("associationId", associationId);
map.put("beginTime",beginTime); map.put("beginTime", beginTime);
map.put("endTime",endTime); map.put("endTime", endTime);
map.put("provinceName",provinceName); map.put("provinceName", provinceName);
map.put("associationType",associationType); map.put("associationType", associationType);
map.put("associationDesc",associationDesc); map.put("associationDesc", associationDesc);
map.put("warningNum",warningNum); map.put("warningNum", warningNum);
List<Object []> WarningDetailList= null; List<Object[]> WarningDetailList = null;
List<Object []> point = null; List<Object[]> point = null;
List<Object []> relation = null; List<Object[]> relation = null;
if("".equalsIgnoreCase(associationId)||"".equalsIgnoreCase(beginTime)||"".equalsIgnoreCase(endTime)){
}else{
Long associationIdL=Long.parseLong(associationId);
WarningDetailList = associateDiagosisDetailService.findByWarningListDetail(beginTime,endTime,associationIdL);
point = associateDiagosisDetailService.findAllPoint(beginTime,endTime,associationId);
relation = associateDiagosisDetailService.findRelation(beginTime,endTime,associationId);
}
List<AssociateDiagosisWarningDetail> adwdl = new ArrayList<AssociateDiagosisWarningDetail>(); List<AssociateDiagosisWarningDetail> adwdl = new ArrayList<AssociateDiagosisWarningDetail>();
if ("".equalsIgnoreCase(associationId) || "".equalsIgnoreCase(beginTime) || "".equalsIgnoreCase(endTime)) {
} else {
Long provinceId = provinceDao.findProvinceIdByProvinceName(provinceName);
Long associationIdL = Long.parseLong(associationId);
// WarningDetailList = associateDiagosisDetailService.findByWarningListDetail(beginTime,endTime,associationIdL);
point = associateDiagosisDetailService.findAllPoint(beginTime, endTime, associationId);
relation = associateDiagosisDetailService.findRelation(beginTime, endTime, associationId);
adwdl = associateDiagosisDetailService.
findDetailByBeginTimeAndEndTimeAndAssociationIdAndProvinceId(beginTime, endTime, associationIdL, provinceId);
if(WarningDetailList !=null){
for (Object[] objects : WarningDetailList) {
AssociateDiagosisWarningDetail adwd = new AssociateDiagosisWarningDetail();
adwd.setASSOCIATION_ID(String.valueOf(objects[0]) );
adwd.setASSOCIATION_TYPE(objects[2]+"");
adwd.setASSOCIATION_DESC(objects[3]+"");
adwd.setPROVINCE_NAME( objects[4]+"");
adwd.setPROVINCE_ID( objects[1]+"");
adwd.setKPI_CODE(objects[7]+"");
adwd.setKPI_NAME(objects[8]+"");
adwd.setKPI_ID(String.valueOf(objects[9]));
adwd.setKPI_WEIGHT(String.valueOf(objects[10]));
adwd.setWARNING_NUM(String.valueOf( objects[11]));
adwd.setINFLUENCE_LEVEL(String.valueOf( objects[12]));
adwdl.add(adwd);
}
} }
map.put("warningDetailList",adwdl);
map.put("warningDetailList", adwdl);
return PageURLController.AssociateDetails; return PageURLController.AssociateDetails;
} }
...@@ -229,184 +189,107 @@ public class AssociateDiagosisDetailController { ...@@ -229,184 +189,107 @@ public class AssociateDiagosisDetailController {
@RequestMapping("/getDetail") @RequestMapping("/getDetail")
@ResponseBody @ResponseBody
public String getDetail(@RequestParam(value = "kpiId", defaultValue = "") String kpiId, public String getDetail(@RequestParam(value = "kpiId", defaultValue = "") String kpiId,
@RequestParam(value = "provinceId", defaultValue = "")String provinceId, @RequestParam(value = "provinceId", defaultValue = "") String provinceId,
@RequestParam(value = "beginTime", defaultValue = "")String beginTime, @RequestParam(value = "beginTime", defaultValue = "") String beginTime,
@RequestParam(value = "endTime", defaultValue = "")String endTime){ @RequestParam(value = "endTime", defaultValue = "") String endTime) {
if("".equalsIgnoreCase(kpiId.trim())||"".equalsIgnoreCase(provinceId.trim())|| if ("".equalsIgnoreCase(kpiId.trim()) || "".equalsIgnoreCase(provinceId.trim()) ||
"".equalsIgnoreCase(beginTime.trim())||"".equalsIgnoreCase(endTime.trim())){ "".equalsIgnoreCase(beginTime.trim()) || "".equalsIgnoreCase(endTime.trim())) {
return ""; return "";
} }
Long kpiIdl=null; Long kpiIdl = null;
Long proviceIdl=null; Long proviceIdl = null;
Date beginTimeD=null; Date beginTimeD = null;
Date endTimeD=null; Date endTimeD = null;
try{ try {
kpiIdl=Long.parseLong(kpiId.trim()); kpiIdl = Long.parseLong(kpiId.trim());
proviceIdl=Long.parseLong(provinceId.trim()); proviceIdl = Long.parseLong(provinceId.trim());
beginTimeD=strToDate(beginTime.trim()); beginTimeD = strToDate(beginTime.trim());
endTimeD=strToDate(endTime.trim()); endTimeD = strToDate(endTime.trim());
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return ""; return "";
} }
List<XcdWarningInfoView> list =associateDiagosisDetailService. List<XcdWarningInfoView> list = associateDiagosisDetailService.
findXcdWarningInfoViewByKpiIdAndProvinceIdandBeginToEndTime(kpiIdl,proviceIdl,beginTimeD,endTimeD); findXcdWarningInfoViewByKpiIdAndProvinceIdandBeginToEndTime(kpiIdl, proviceIdl, beginTimeD, endTimeD);
Gson gson=new Gson(); Gson gson = new Gson();
System.out.println(list);
return gson.toJson(list); return gson.toJson(list);
} }
public static Date strToDate(String str) throws Exception{
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
Date d=new Date();
try {
d=sdf.parse(str);
}catch (Exception e){
throw new Exception("日期格式不对");
}
return d;
}
public static String getOld(){ @RequestMapping("/createDiagosis")
Calendar calendar=Calendar.getInstance(); public String createDiagosis() {
calendar.add(Calendar.YEAR,-4);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(calendar.getTime().getTime());
}
public static String getNew(){
Calendar calendar=Calendar.getInstance();
calendar.add(Calendar.YEAR,-2);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(calendar.getTime().getTime());
}
public static String getLastMonth(){
Calendar calendar=Calendar.getInstance();
calendar.add(Calendar.MONTH,-1);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(calendar.getTime().getTime());
}
public static String getNow(){
Calendar calendar=Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(calendar.getTime().getTime());
}
private static Timestamp strToTimestamp(String str) throws Exception { return PageURLController.CreateDiagosis;
String tsStr = "2011-05-09 11:49:45";
Timestamp timestamp=new Timestamp(0L);
timestamp.valueOf(tsStr);
return timestamp;
} }
@RequestMapping("/yinjingyinhuanToguanlianzhenduanmingxi")
public String yinjingyinhuanToguanlianzhenduanmingxi(
@RequestParam(value = "warningId", defaultValue = "") String warningId,
Map model, ServletRequest request, HttpSession session)
throws UnsupportedEncodingException, ParseException {
List<Province> provinceList = (List<Province>) provinceDao.findProvince();
private static void changeTimestampStyle(List<AssociateDiagosisDetail> diagosisDetails){ model.put("provinceList", provinceList);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int len=diagosisDetails.size();
for(int i=0;i<len;i++){
long timeWarnBeginTimel=diagosisDetails.get(i).getWarnBeginTime().getTime();
Date date=new Date(timeWarnBeginTimel);
String timeWarnBeginTimes=df.format(date);
diagosisDetails.get(i).setWarnBeginTime(Timestamp.valueOf(timeWarnBeginTimes));
long timeWarnEndTimel=diagosisDetails.get(i).getWarnEndTime().getTime();
date.setTime(timeWarnEndTimel);
diagosisDetails.get(i).setWarnEndTime(Timestamp.valueOf(df.format(date)));
}
}
//把关联诊断明细统计列表导出为Excel格式 List<XcdWarningInfoView> list = xcdWarningInfoViewDao.findByWarningId(warningId);
@RequestMapping(value = "/upLoadGzfxDetailExcel", method = RequestMethod.POST)
public void getFailuresExcel(HttpServletRequest request, HttpServletResponse response, HttpSession session, ModelMap model) throws Exception{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date =new Date(); String occurTimes = "";
String fileName = "关联诊断明细列表"+format.format(date); String closeTimes = "";
try{ if (list == null || list.size() < 1) {
fileName = new String(fileName.getBytes("gb2312"), "ISO-8859-1"); return PageURLController.AssociateDiagosisDetail;
}catch(UnsupportedEncodingException e1){ } else {
e1.printStackTrace(); 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();
HSSFWorkbook wb = new HSSFWorkbook(); occurTimes = format.format(calendar.getTime());
HSSFSheet sheet = wb.createSheet();
ExportExcelUtil exportExcel = new ExportExcelUtil(wb, sheet);
//创建列标头LIST
List<String> fialList = new ArrayList<String>();
fialList.add("故障ID");
fialList.add("故障标题");
fialList.add("省份");
fialList.add("渠道");
fialList.add("数据来源");
fialList.add("故障来源");
fialList.add("集成商");
fialList.add("开始时间");
fialList.add("结束时间");
fialList.add("详细原因");
fialList.add("解决方案");
//该报表的列数
int number = fialList.size();
//给工作表列定义列宽
for(int i = 0; i<number; i++){
sheet.setColumnWidth(i, 5500);
} }
//创建单元格样式 if (closeTime == null) {
HSSFCellStyle cellStyle = wb.createCellStyle(); Calendar calendar = Calendar.getInstance();
calendar.setTime(view.getOccurTime());
//指定单元格居中对齐 calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) + 2);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); closeTimes = format.format(calendar.getTime());
} else {
//指定单元格垂直居中对齐 closeTimes = format.format(closeTime);
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); }
// AssociateDiagosisDetail detail=associateDiagosisDetailService.findObjByProvinceIdAndKpiIdAndoccurTimeAndCloseTime(provinceId,kpiId,occurTimes,closeTimes);
//指定当单元格内容显示不下时自动换行 List<AssociateDiagosisDetail> list1 = new ArrayList();
cellStyle.setWrapText(true); /*if(detail !=null){
list1.add(detail);
//设置单元格字体 }*/
HSSFFont font = wb.createFont(); list1 = associateDiagosisDetailService.findDetailByProvinceIdAndoccurTimeAndCloseTime(provinceId, occurTimes, closeTimes);
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); Gson gson = new Gson();
font.setFontName("宋体"); model.put("diagosisDetails", gson.toJson(list1));
font.setFontHeight((short) 220); return PageURLController.AssociateDiagosisDetail;
cellStyle.setFont(font); }
//创建报表头部
exportExcel.createNormalHead("关联诊断明细列表", number - 1);
//创建第二行
HSSFRow row2 = sheet.createRow(1);
//设置行高
row2.setHeight((short) 500);
//单元格
HSSFCell row2Cell = null;
//创建不同的LIST的列标题
for(int i = 0; i< number; i++){
row2Cell = row2.createCell(i);
row2Cell.setCellStyle(cellStyle);
row2Cell.setCellValue(new HSSFRichTextString(fialList.get(i).toString()));
}
} }
public static String getOld() {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.YEAR, -4);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(calendar.getTime().getTime());
}
//将string数据类型转换成List<Long>类型 //将string数据类型转换成List<Long>类型
public List<Long> changeStringToList(String str){ public List<Long> changeStringToList(String str) {
List<Long> list = new ArrayList<Long>(); List<Long> list = new ArrayList<Long>();
for(int i=0;i<str.split(",").length;i++){ for (int i = 0; i < str.split(",").length; i++) {
if(!str.split(",")[i].equals("")){ if (!str.split(",")[i].equals("")) {
list.add(Long.parseLong(str.split(",")[i])); list.add(Long.parseLong(str.split(",")[i]));
} }
...@@ -414,64 +297,59 @@ public class AssociateDiagosisDetailController { ...@@ -414,64 +297,59 @@ public class AssociateDiagosisDetailController {
return list; return list;
} }
@RequestMapping("/createDiagosis") private static void changeTimestampStyle(List<AssociateDiagosisDetail> diagosisDetails) {
public String createDiagosis(){
return PageURLController.CreateDiagosis;
}
@RequestMapping("/yinjingyinhuanToguanlianzhenduanmingxi")
public String yinjingyinhuanToguanlianzhenduanmingxi(
@RequestParam(value = "warningId",defaultValue = "") String warningId,
Map model, ServletRequest request, HttpSession session)
throws UnsupportedEncodingException, ParseException {
List<Province> provinceList =(List<Province>) provinceDao.findProvince();
model.put("provinceList", provinceList);
List <XcdWarningInfoView> list=xcdWarningInfoViewDao.findByWarningId(warningId); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); int len = diagosisDetails.size();
String occurTimes=""; for (int i = 0; i < len; i++) {
String closeTimes=""; long timeWarnBeginTimel = diagosisDetails.get(i).getWarnBeginTime().getTime();
if(list==null||list.size()<1){ Date date = new Date(timeWarnBeginTimel);
return PageURLController.AssociateDiagosisDetail; String timeWarnBeginTimes = df.format(date);
}else { diagosisDetails.get(i).setWarnBeginTime(Timestamp.valueOf(timeWarnBeginTimes));
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(); long timeWarnEndTimel = diagosisDetails.get(i).getWarnEndTime().getTime();
occurTimes=format.format(calendar.getTime()); date.setTime(timeWarnEndTimel);
diagosisDetails.get(i).setWarnEndTime(Timestamp.valueOf(df.format(date)));
} }
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); public static String getNow() {
List<AssociateDiagosisDetail> list1=new ArrayList(); Calendar calendar = Calendar.getInstance();
if(detail !=null){ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
list1.add(detail); return format.format(calendar.getTime().getTime());
} }
Gson gson=new Gson();
model.put("diagosisDetails", gson.toJson(list1)); private static Timestamp strToTimestamp(String str) throws Exception {
return PageURLController.AssociateDiagosisDetail; String tsStr = "2011-05-09 11:49:45";
Timestamp timestamp = new Timestamp(0L);
timestamp.valueOf(tsStr);
return timestamp;
}
public static String getNew() {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.YEAR, -2);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(calendar.getTime().getTime());
} }
public static String getLastMonth() {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -1);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(calendar.getTime().getTime());
}
public static Date strToDate(String str) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date d = new Date();
try {
d = sdf.parse(str);
} catch (Exception e) {
throw new Exception("日期格式不对");
}
return d;
} }
} }
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