Commit 357f410a authored by 莫林毅's avatar 莫林毅

2017年11月24 智能分析平台提交内容

监控运营->告警关联诊断模块
parent e7202c9c
package com.hp.cmsz.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
/**
*CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T对应的实体类 一对多 CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T
*
* @author Molinyi
*
*/
@Entity
@Table(name = "DIM_ASSOCIATION_ANALYSIS_INFO_T",schema = "CCOLAP")
public class DimAssociationAnaInfo implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="DimAssociationAnaInfoSequence")
@SequenceGenerator(name = "DimAssociationAnaInfoSequence", sequenceName = "ASSOCIATION_SEQ", initialValue = 1,allocationSize=1)
private Long associationId;
@Column(name = "PROVINCE_ID")
private Long provinceId;//省份ID
@Column(name = "ASSOCIATION_TYPE")
private String AssociationType;//维度
@Column(name = "ASSOCIATION_DESC")
private String AssoicationDesc;//描述
@OneToMany(fetch = FetchType.EAGER,cascade = {CascadeType.ALL},mappedBy = "dimAssociationAnaInfo")
private transient List<DimKpiAssociationRelInfo> items;
public Long getAssociationId() {
return associationId;
}
public void setAssociationId(Long associationId) {
this.associationId = associationId;
}
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
public String getAssociationType() {
return AssociationType;
}
public void setAssociationType(String associationType) {
AssociationType = associationType;
}
public String getAssoicationDesc() {
return AssoicationDesc;
}
public void setAssoicationDesc(String assoicationDesc) {
AssoicationDesc = assoicationDesc;
}
public List<DimKpiAssociationRelInfo> getItems() {
return items;
}
public void setItems(List<DimKpiAssociationRelInfo> items) {
this.items = items;
}
@Override
public String toString() {
return "DimAssociationAnaInfo{" +
"associationId=" + associationId +
", provinceId=" + provinceId +
", AssociationType='" + AssociationType + '\'' +
", AssoicationDesc='" + AssoicationDesc + '\'' +
", items=" + items +
'}';
}
}
package com.hp.cmsz.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*CCOLAP.DIM_KPI_ASSOCIATION_RELATED_INFO_T对应的实体类 多对一 CCOLAP.DIM_ASSOCIATION_ANALYSIS_INFO_T
*
* @author Molinyi
*
*/
@Entity
@Table(name = "DIM_KPI_ASSOCIATION_RELATED_INFO_T",schema = "CCOLAP")
public class DimKpiAssociationRelInfo implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="DimKpiAssociationRelInfoSequence")//作用:为一个实体生成一个唯一标识的主键
@SequenceGenerator(name = "DimKpiAssociationRelInfoSequence", sequenceName = "KPI_ASSOCIATION_RELATED_SEQ",initialValue = 1,allocationSize=1)
private Long kpiAssociationRelatedId;//
@Column(name = "KPI_ID")
private Long kpiId;//指标名称
@Column(name = "KPI_WEIGHT")
private BigDecimal kpiWeight;//权重
@ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.EAGER,optional = false)// optional :代表外键字段是否可以为空。true可以为空,false不可以为空
@JoinColumn(name = "ASSOCIATION_ID")
private DimAssociationAnaInfo dimAssociationAnaInfo;
public Long getKpiAssociationRelatedId() {
return kpiAssociationRelatedId;
}
public void setKpiAssociationRelatedId(Long kpiAssociationRelatedId) {
this.kpiAssociationRelatedId = kpiAssociationRelatedId;
}
public Long getKpiId() {
return kpiId;
}
public void setKpiId(Long kpiId) {
this.kpiId = kpiId;
}
public DimAssociationAnaInfo getDimAssociationAnaInfo() {
return dimAssociationAnaInfo;
}
public void setDimAssociationAnaInfo(DimAssociationAnaInfo dimAssociationAnaInfo) {
this.dimAssociationAnaInfo = dimAssociationAnaInfo;
}
public BigDecimal getKpiWeight() {
return kpiWeight;
}
public void setKpiWeight(BigDecimal kpiWeight) {
this.kpiWeight = kpiWeight;
}
}
package com.hp.cmsz.repository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.hp.cmsz.entity.DimAssociationAnaInfo;
import java.util.List;
public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAssociationAnaInfo>,
PagingAndSortingRepository<DimAssociationAnaInfo, Long> {
/*@Query("from DimAssociationAnaInfo ")
public List<DimAssociationAnaInfo> findAllDimAssociationAnaInfo();
public List<DimAssociationAnaInfo> findAllDimAssociationAnaInfoByProvince(String province);
public List<DimAssociationAnaInfo> findAllDimAssociationAnaInfoByDemension(String demension);*/
}
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.DimKpiAssociationRelInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface DimKpiAssociationRelInfoDao extends JpaSpecificationExecutor<DimKpiAssociationRelInfo>,
PagingAndSortingRepository<DimKpiAssociationRelInfo, Long> {
@Query("from DimKpiAssociationRelInfo ")
List<DimKpiAssociationRelInfo> findAllDimKpiAssociationRelInfo();
@Query("select relInfo from DimKpiAssociationRelInfo relInfo where relInfo.dimAssociationAnaInfo.AssociationType in (:demension)")
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByDimension(@Param(value = "demension") String demension);
@Query("select relInfo from DimKpiAssociationRelInfo relInfo where relInfo.dimAssociationAnaInfo.AssociationType in (:dimension) and relInfo.dimAssociationAnaInfo.provinceId in (:detailProvince)")
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByDimensionAndProvince(@Param(value = "dimension") String dimension,@Param(value = "detailProvince") List<Long> detailProvince);
@Query("select relInfo from DimKpiAssociationRelInfo relInfo where relInfo.dimAssociationAnaInfo.provinceId in (:detailProvince)")
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByProvince(@Param(value = "detailProvince")List<Long> detailProvince);
}
package com.hp.cmsz.service.monitoroperation;
import com.hp.cmsz.entity.DimAssociationAnaInfo;
import com.hp.cmsz.entity.DimKpiAssociationRelInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.hp.cmsz.repository.DimKpiAssociationRelInfoDao;
import com.hp.cmsz.repository.DimAssociationAnaInfoDao;
import java.util.ArrayList;
import java.util.List;
@Component
@Transactional
public class AssociateDiagosisConfigurationService {
@Autowired
private DimKpiAssociationRelInfoDao dimKpiAssociationRelInfoDao;
@Autowired
private DimAssociationAnaInfoDao dimAssociationAnaInfoDao;
public void test(){
DimKpiAssociationRelInfo d=dimKpiAssociationRelInfoDao.findOne(1L);
System.out.println(d.getDimAssociationAnaInfo().getAssociationType());
DimAssociationAnaInfo info= dimAssociationAnaInfoDao.findOne(1l);
System.out.println(info.getItems().get(0).getKpiWeight());
System.out.println(info.getItems().get(1).getKpiWeight());
System.out.println(d.toString());
System.out.println(info.toString());
}
public List<DimKpiAssociationRelInfo> findAllDimKpiAssociationRelInfo(){
return dimKpiAssociationRelInfoDao.findAllDimKpiAssociationRelInfo();
}
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByDimension(String demension){
return dimKpiAssociationRelInfoDao.findDimKpiAssociationRelInfoByDimension(demension);
}
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByDimensionAndProvince(String dimension,List<Long> detailProvince){
return dimKpiAssociationRelInfoDao.findDimKpiAssociationRelInfoByDimensionAndProvince(dimension,detailProvince);
}
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByProvince(List<Long> detailProvince){
return dimKpiAssociationRelInfoDao.findDimKpiAssociationRelInfoByProvince(detailProvince);
}
}
...@@ -79,7 +79,18 @@ public class PageURLController { ...@@ -79,7 +79,18 @@ public class PageURLController {
//监控运营下的故障创建 //监控运营下的故障创建
//FailureCreate映射到WEB-INF/views下的MonitorOperation/FailureCreate.jsp页面 //FailureCreate映射到WEB-INF/views下的MonitorOperation/FailureCreate.jsp页面
public static String FailureCreate="MonitorOperation/FailureCreate"; public static String FailureCreate="MonitorOperation/FailureCreate";
//监控运营>告警关联诊>关联诊断明细
//AssociateDiagosisDetail映射到WEB-INF/views下的MonitorOperation/AssociateDiagosisDetail.jsp页面
public static String AssociateDiagosisDetail="MonitorOperation/AssociateDiagosisDetail";
//监控运营>告警关联诊>关联诊断配置
//AssociateDiagosisConfiguration-INF/views下的MonitorOperation/AssociateDiagosisConfiguration.jsp页面
public static String AssociateDiagosisConfiguration="MonitorOperation/AssociateDiagosisConfiguration";
//监控运营>告警关联诊>关联诊断配置> 新建指标
public static String CreateDiagosis="MonitorOperation/CreateDiagosis";
//分析支撑下的集成商分析 //分析支撑下的集成商分析
//通过ProviderAnalysis映射到WEB-INF/views下的AnalysisSupport/ProviderFailureAnalysis.jsp页面 //通过ProviderAnalysis映射到WEB-INF/views下的AnalysisSupport/ProviderFailureAnalysis.jsp页面
public static String ProviderFailureAnalysis="AnalysisSupport/ProviderFailureAnalysis"; public static String ProviderFailureAnalysis="AnalysisSupport/ProviderFailureAnalysis";
......
package com.hp.cmsz.web.monitoroperation;
import com.google.gson.Gson;
import com.hp.cmsz.entity.DimKpiAssociationRelInfo;
import com.hp.cmsz.entity.Province;
import com.hp.cmsz.repository.DimKpiAssociationRelInfoDao;
import com.hp.cmsz.repository.ProvinceDao;
import com.hp.cmsz.service.monitoroperation.AssociateDiagosisConfigurationService;
import com.hp.cmsz.web.PageURLController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* AssociateDiagosisConfigurationController 监控运营>告警关联诊>关联诊断配置
*
* @author Molinyi
*
*/
@Controller
@RequestMapping(value = "/MonitorOperation/AssociateDiagosisConfiguration")
public class AssociateDiagosisConfigurationController {
@Autowired
private ProvinceDao provinceDao;
@Autowired
private AssociateDiagosisConfigurationService associateDiagosisConfigurationService;
@Autowired
private DimKpiAssociationRelInfoDao dimKpiAssociationRelInfoDao;
@RequestMapping("")
public String list(Map model,
@RequestParam(defaultValue = "",value = "detailProvince")String detailProvince,
@RequestParam(defaultValue = "",value = "dimension")String dimension
){
System.out.printf("detailProvince "+detailProvince);
System.out.printf("dimension "+dimension);
List<DimKpiAssociationRelInfo>list=new ArrayList();
if(detailProvince.equalsIgnoreCase("")&&dimension.equalsIgnoreCase("")){//查找所有
list= associateDiagosisConfigurationService.findAllDimKpiAssociationRelInfo();
}
if(detailProvince.equalsIgnoreCase("")&&(!dimension.equalsIgnoreCase(""))){
list=associateDiagosisConfigurationService.findDimKpiAssociationRelInfoByDimension(dimension);
}
if((!detailProvince.equalsIgnoreCase(""))&&(!dimension.equalsIgnoreCase(""))){
String[]arrProvice=detailProvince.split(",");
List<Long>listProvice=new CopyOnWriteArrayList<Long>();
int length=arrProvice.length;
for(int i=0;i<length;i++){
listProvice.add(Long.parseLong(arrProvice[i]));
}
list=associateDiagosisConfigurationService.findDimKpiAssociationRelInfoByDimensionAndProvince(dimension,listProvice);
}
if((!detailProvince.equalsIgnoreCase(""))&&dimension.equalsIgnoreCase("")){
String[]arrProvice=detailProvince.split(",");
List<Long>listProvice=new CopyOnWriteArrayList<Long>();
int length=arrProvice.length;
for(int i=0;i<length;i++){
listProvice.add(Long.parseLong(arrProvice[i]));
}
list=associateDiagosisConfigurationService.findDimKpiAssociationRelInfoByProvince(listProvice);
}
Gson gson = new Gson();
Gson gsonP = new Gson();
List<Province> provinceList =(List<Province>) provinceDao.findProvince();
model.put("provinceList", provinceList);
model.put("gzfxDetailInfos",gson.toJson(list));
model.put("provinces",gsonP.toJson(provinceList));
model.put("indicatorsAll",gsonP.toJson(provinceList));//所有指标
System.out.println(")))"+gsonP.toJson(provinceList));
return PageURLController.AssociateDiagosisConfiguration;
}
}
This diff is collapsed.
<%@tag pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<%--省份筛选项 --%>
<div id="provinceDetail" class="slide-menu-option">
<label for="">省份</label>
<div class="checkbox-inline"><label><input type="checkbox" name="allProvinceDetail" id="allProvinceDetail" title="allSelect" checked />全选</label></div>
<br/>
<c:forEach items="${provinceList}" var="provinces">
<div class="checkbox-inline">
<label>
<input type="checkbox" name="provinceDetail" class="provinceDetail" title="${provinces.provinceName}" value="${provinces.provinceId}" checked/>${provinces.provinceName}
</label>
</div>
</c:forEach>
</div>
<script type="text/javascript">
$("#allProvinceDetail").click(function(){
alert(21)
});
</script>
\ No newline at end of file
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
</div> </div>
</c:forEach> </c:forEach>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var detailProvinceCheckedValues=$(".provinceDetail:checked"); var detailProvinceCheckedValues=$(".provinceDetail:checked");
//全选和不全选所有的省 //全选和不全选所有的省
$("#allProvinceDetail").click(function(){ $("#allProvinceDetail").click(function(){
if($("#allProvinceDetail").attr("checked") == "checked"){//全选 if($("#allProvinceDetail").attr("checked")
== "checked"){//全选
$(".provinceDetail").attr("checked","checked"); $(".provinceDetail").attr("checked","checked");
detailProvinceCheckedValues=$(".provinceDetail:checked"); detailProvinceCheckedValues=$(".provinceDetail:checked");
}else{//不全选 }else{//不全选
......
This diff is collapsed.
This diff is collapsed.
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