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

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

更换 SQL语句
parent 33c97c81
......@@ -40,14 +40,56 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
@Query("select anaInfo from DimAssociationAnaInfo anaInfo where anaInfo.associationId = :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," +
"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 , " +
" 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);
@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
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 (" +
" 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" +
......@@ -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 " +
" 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);
......@@ -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(?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)
public Object[] findObjByProvinceIdAndKpiIdAndoccurTimeAndCloseTime(/*@Param(value = "provinceId")*/ Long provinceId,
/*@Param(value = "kpiId")*/ Long kpiId,
/*@Param(value = "occurTime")*/ String occurTime,
/*@Param(value = "closeTime")*/ String closeTime);
public Object[] findObjByProvinceIdAndKpiIdAndoccurTimeAndCloseTime( Long provinceId,
Long kpiId,
String occurTime,
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"
,nativeQuery = true)
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>,
//由集成商Ids得到省份信息
@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);
@Query("select provinceId from Province where provinceName= ?1")
public Long findProvinceIdByProvinceName(String provinceName);
}
......@@ -2,6 +2,7 @@ package com.hp.cmsz.service.monitoroperation;
import com.hp.cmsz.entity.AssociateDiagosisDetail;
import com.hp.cmsz.entity.AssociateDiagosisWarningDetail;
import com.hp.cmsz.entity.XcdWarningInfoView;
import com.hp.cmsz.repository.DimAssociationAnaInfoDao;
import com.hp.cmsz.repository.XcdWarningInfoViewDao;
......@@ -17,6 +18,7 @@ import javax.persistence.EntityManagerFactory;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
......@@ -33,30 +35,8 @@ public class AssociateDiagosisDetailService {
@Autowired
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){
Calendar calendar=Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -84,13 +64,54 @@ public class AssociateDiagosisDetailService {
}
}
public List<Object[]> findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(String warnBeginTime, String warnEndTime, char dimension, List<Long> provincelist){
return dimAssociationAnaInfoDao.findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime,dimension,provincelist);
public List<AssociateDiagosisDetail> findAssociateDiagosisDetailByWarnTimeBeginAndEnd( String warnBeginTime, String warnEndTime){
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){
......@@ -110,5 +131,55 @@ public class AssociateDiagosisDetailService {
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;
* AssociateDiagosisDetailControllerr 监控运营>告警关联诊>关联诊断明细
*
* @author Molinyi
*
*/
@Controller
@RequestMapping(value = "/MonitorOperation/AssociateDiagosisDetail")
......@@ -86,30 +85,16 @@ public class AssociateDiagosisDetailController {
private XcdWarningInfoViewDao xcdWarningInfoViewDao;
@RequestMapping("")
public String lis(Map model, ServletRequest request, HttpSession session)
throws UnsupportedEncodingException, ParseException {
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);
}
List<Province> provinceList = (List<Province>) provinceDao.findProvince();
String timestamp1 = getLastMonth();//getOld();
String timestamp2 = getNow();//getNew();
List<AssociateDiagosisDetail> associateDiagosisDetails = associateDiagosisDetailService.findAssociateDiagosisDetailByWarnTimeBeginAndEnd(timestamp1, timestamp2);
model.put("provinceList", provinceList);
Gson gson=new Gson();
Gson gson = new Gson();
model.put("diagosisDetails", gson.toJson(associateDiagosisDetails));
return PageURLController.AssociateDiagosisDetail;
}
......@@ -117,111 +102,86 @@ public class AssociateDiagosisDetailController {
@RequestMapping("/tableList")
@ResponseBody
public String tableList(@RequestParam(value = "detailtime",defaultValue = "") String detailtime,
@RequestParam(value = "dimension",defaultValue = "")String dimension,
@RequestParam(value = "detailProvince",defaultValue = "")String detailProvince){
String str="";
if(detailtime.equalsIgnoreCase("")
||dimension.equalsIgnoreCase("")||detailProvince.equalsIgnoreCase("")){
public String tableList(@RequestParam(value = "detailtime", defaultValue = "") String detailtime,
@RequestParam(value = "dimension", defaultValue = "") String dimension,
@RequestParam(value = "detailProvince", defaultValue = "") String detailProvince) {
String str = "";
if (detailtime.equalsIgnoreCase("")
|| dimension.equalsIgnoreCase("") || detailProvince.equalsIgnoreCase("")) {
return str;
}
String[]provinceStr=detailProvince.split(",");
List<Long>provinceList=new ArrayList<Long>();
String[] provinceStr = detailProvince.split(",");
List<Long> provinceList = new ArrayList<Long>();
String[] times = detailtime.split("~");
String warnBeginTime="";
String warnEndTime="";
String warnBeginTime = "";
String warnEndTime = "";
warnBeginTime = times[0];
warnBeginTime.replaceAll("%"," ");
warnBeginTime.replaceAll("%", " ");
warnEndTime = times[1];
warnEndTime.replaceAll("%"," ");
char dimensionc='d';
warnEndTime.replaceAll("%", " ");
char dimensionc = 'd';
try {
for (String s : provinceStr) {
provinceList.add(Long.parseLong(s));
}
dimensionc=dimension.charAt(0);
dimensionc = dimension.charAt(0);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
format.parse(warnBeginTime);
format.parse(warnEndTime);
}catch (Exception e){
} catch (Exception e) {
e.getMessage();
System.out.println(e.getMessage());
return str;
}
List<Object[]>diagosisDetailsObj=associateDiagosisDetailService.
findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime,warnEndTime,dimensionc,provinceList);
List<AssociateDiagosisDetail>diagosisDetails=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]);
diagosisDetails.add(detail);
}
Gson gson=new Gson();
System.out.println("gson.toJson(diagosisDetails) "+gson.toJson(diagosisDetails));
List<AssociateDiagosisDetail> diagosisDetails = associateDiagosisDetailService.
findLastMathAssociateDiagosisDetailByWarnTimeBeginAndEndAndDimesionAndProvinceList(warnBeginTime, warnEndTime, dimensionc, provinceList);
Gson gson = new Gson();
return gson.toJson(diagosisDetails);
}
@RequestMapping(value ={"/details"})
// 详情超链接
@RequestMapping(value = {"/details"})
public String details(
@RequestParam(value = "associationId",defaultValue = "") String associationId,
@RequestParam(value = "provinceName",defaultValue = "") String provinceName,
@RequestParam(value = "associationType",defaultValue = "") String associationType,
@RequestParam(value = "associationDesc",defaultValue = "") String associationDesc,
@RequestParam(value = "warningNum",defaultValue = "") String warningNum,
@RequestParam(value = "beginTime",defaultValue = "") String beginTime,
@RequestParam(value = "endTime",defaultValue = "") String endTime,
Map map){
map.put("associationId",associationId);
map.put("beginTime",beginTime);
map.put("endTime",endTime);
map.put("provinceName",provinceName);
map.put("associationType",associationType);
map.put("associationDesc",associationDesc);
map.put("warningNum",warningNum);
List<Object []> WarningDetailList= null;
List<Object []> point = 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);
}
@RequestParam(value = "associationId", defaultValue = "") String associationId,
@RequestParam(value = "provinceName", defaultValue = "") String provinceName,
@RequestParam(value = "associationType", defaultValue = "") String associationType,
@RequestParam(value = "associationDesc", defaultValue = "") String associationDesc,
@RequestParam(value = "warningNum", defaultValue = "") String warningNum,
@RequestParam(value = "beginTime", defaultValue = "") String beginTime,
@RequestParam(value = "endTime", defaultValue = "") String endTime,
Map map) {
map.put("associationId", associationId);
map.put("beginTime", beginTime);
map.put("endTime", endTime);
map.put("provinceName", provinceName);
map.put("associationType", associationType);
map.put("associationDesc", associationDesc);
map.put("warningNum", warningNum);
List<Object[]> WarningDetailList = null;
List<Object[]> point = null;
List<Object[]> relation = null;
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;
}
......@@ -229,184 +189,107 @@ public class AssociateDiagosisDetailController {
@RequestMapping("/getDetail")
@ResponseBody
public String getDetail(@RequestParam(value = "kpiId", defaultValue = "") String kpiId,
@RequestParam(value = "provinceId", defaultValue = "")String provinceId,
@RequestParam(value = "beginTime", defaultValue = "")String beginTime,
@RequestParam(value = "endTime", defaultValue = "")String endTime){
@RequestParam(value = "provinceId", defaultValue = "") String provinceId,
@RequestParam(value = "beginTime", defaultValue = "") String beginTime,
@RequestParam(value = "endTime", defaultValue = "") String endTime) {
if("".equalsIgnoreCase(kpiId.trim())||"".equalsIgnoreCase(provinceId.trim())||
"".equalsIgnoreCase(beginTime.trim())||"".equalsIgnoreCase(endTime.trim())){
if ("".equalsIgnoreCase(kpiId.trim()) || "".equalsIgnoreCase(provinceId.trim()) ||
"".equalsIgnoreCase(beginTime.trim()) || "".equalsIgnoreCase(endTime.trim())) {
return "";
}
Long kpiIdl=null;
Long proviceIdl=null;
Date beginTimeD=null;
Date endTimeD=null;
try{
kpiIdl=Long.parseLong(kpiId.trim());
proviceIdl=Long.parseLong(provinceId.trim());
beginTimeD=strToDate(beginTime.trim());
endTimeD=strToDate(endTime.trim());
}catch (Exception e){
Long kpiIdl = null;
Long proviceIdl = null;
Date beginTimeD = null;
Date endTimeD = null;
try {
kpiIdl = Long.parseLong(kpiId.trim());
proviceIdl = Long.parseLong(provinceId.trim());
beginTimeD = strToDate(beginTime.trim());
endTimeD = strToDate(endTime.trim());
} catch (Exception e) {
e.printStackTrace();
return "";
}
List<XcdWarningInfoView> list =associateDiagosisDetailService.
findXcdWarningInfoViewByKpiIdAndProvinceIdandBeginToEndTime(kpiIdl,proviceIdl,beginTimeD,endTimeD);
Gson gson=new Gson();
System.out.println(list);
List<XcdWarningInfoView> list = associateDiagosisDetailService.
findXcdWarningInfoViewByKpiIdAndProvinceIdandBeginToEndTime(kpiIdl, proviceIdl, beginTimeD, endTimeD);
Gson gson = new Gson();
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(){
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());
}
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());
}
@RequestMapping("/createDiagosis")
public String createDiagosis() {
private static Timestamp strToTimestamp(String str) throws Exception {
String tsStr = "2011-05-09 11:49:45";
Timestamp timestamp=new Timestamp(0L);
timestamp.valueOf(tsStr);
return timestamp;
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();
private static void changeTimestampStyle(List<AssociateDiagosisDetail> diagosisDetails){
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));
model.put("provinceList", provinceList);
long timeWarnEndTimel=diagosisDetails.get(i).getWarnEndTime().getTime();
date.setTime(timeWarnEndTimel);
diagosisDetails.get(i).setWarnEndTime(Timestamp.valueOf(df.format(date)));
}
}
//把关联诊断明细统计列表导出为Excel格式
@RequestMapping(value = "/upLoadGzfxDetailExcel", method = RequestMethod.POST)
public void getFailuresExcel(HttpServletRequest request, HttpServletResponse response, HttpSession session, ModelMap model) throws Exception{
List<XcdWarningInfoView> list = xcdWarningInfoViewDao.findByWarningId(warningId);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date =new Date();
String fileName = "关联诊断明细列表"+format.format(date);
try{
fileName = new String(fileName.getBytes("gb2312"), "ISO-8859-1");
}catch(UnsupportedEncodingException e1){
e1.printStackTrace();
}
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);
//创建工作薄
HSSFWorkbook wb = new HSSFWorkbook();
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);
occurTime = calendar.getTime();
occurTimes = format.format(calendar.getTime());
}
//创建单元格样式
HSSFCellStyle cellStyle = wb.createCellStyle();
//指定单元格居中对齐
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//指定单元格垂直居中对齐
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
//指定当单元格内容显示不下时自动换行
cellStyle.setWrapText(true);
//设置单元格字体
HSSFFont font = wb.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setFontName("宋体");
font.setFontHeight((short) 220);
cellStyle.setFont(font);
//创建报表头部
exportExcel.createNormalHead("关联诊断明细列表", number - 1);
//创建第二行
HSSFRow row2 = sheet.createRow(1);
//设置行高
row2.setHeight((short) 500);
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);
}*/
list1 = associateDiagosisDetailService.findDetailByProvinceIdAndoccurTimeAndCloseTime(provinceId, occurTimes, closeTimes);
Gson gson = new Gson();
model.put("diagosisDetails", gson.toJson(list1));
return PageURLController.AssociateDiagosisDetail;
}
//单元格
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>类型
public List<Long> changeStringToList(String str){
public List<Long> changeStringToList(String str) {
List<Long> list = new ArrayList<Long>();
for(int i=0;i<str.split(",").length;i++){
if(!str.split(",")[i].equals("")){
for (int i = 0; i < str.split(",").length; i++) {
if (!str.split(",")[i].equals("")) {
list.add(Long.parseLong(str.split(",")[i]));
}
......@@ -414,64 +297,59 @@ public class AssociateDiagosisDetailController {
return list;
}
@RequestMapping("/createDiagosis")
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);
private static void changeTimestampStyle(List<AssociateDiagosisDetail> diagosisDetails) {
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");
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);
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));
occurTime=calendar.getTime();
occurTimes=format.format(calendar.getTime());
long timeWarnEndTimel = diagosisDetails.get(i).getWarnEndTime().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);
List<AssociateDiagosisDetail> list1=new ArrayList();
if(detail !=null){
list1.add(detail);
public static String getNow() {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(calendar.getTime().getTime());
}
Gson gson=new Gson();
model.put("diagosisDetails", gson.toJson(list1));
return PageURLController.AssociateDiagosisDetail;
private static Timestamp strToTimestamp(String str) throws Exception {
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