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

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

更换 SQL语句
parent 33c97c81
...@@ -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;
}
} }
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