Commit bb205033 authored by 莫林毅's avatar 莫林毅

2017年12月03 关联配置

parent 50f4355d
...@@ -2,6 +2,7 @@ package com.hp.cmsz.entity; ...@@ -2,6 +2,7 @@ package com.hp.cmsz.entity;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -13,6 +14,8 @@ import java.util.List; ...@@ -13,6 +14,8 @@ import java.util.List;
@Entity @Entity
@Table(name = "DIM_ASSOCIATION_ANALYSIS_INFO_T",schema = "CCOLAP") @Table(name = "DIM_ASSOCIATION_ANALYSIS_INFO_T",schema = "CCOLAP")
public class DimAssociationAnaInfo implements Serializable { public class DimAssociationAnaInfo implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="DimAssociationAnaInfoSequence") @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="DimAssociationAnaInfoSequence")
@SequenceGenerator(name = "DimAssociationAnaInfoSequence", sequenceName = "ASSOCIATION_SEQ", initialValue = 1,allocationSize=1) @SequenceGenerator(name = "DimAssociationAnaInfoSequence", sequenceName = "ASSOCIATION_SEQ", initialValue = 1,allocationSize=1)
...@@ -28,7 +31,7 @@ public class DimAssociationAnaInfo implements Serializable { ...@@ -28,7 +31,7 @@ public class DimAssociationAnaInfo implements Serializable {
private String AssoicationDesc;//描述 private String AssoicationDesc;//描述
@OneToMany(fetch = FetchType.EAGER,cascade = {CascadeType.ALL},mappedBy = "dimAssociationAnaInfo") @OneToMany(fetch = FetchType.EAGER,cascade = {CascadeType.ALL},mappedBy = "dimAssociationAnaInfo")
private transient List<DimKpiAssociationRelInfo> items; private List<DimKpiAssociationRelInfo> items;//=new ArrayList<DimKpiAssociationRelInfo>();
public Long getAssociationId() { public Long getAssociationId() {
return associationId; return associationId;
......
...@@ -18,7 +18,7 @@ import javax.persistence.Table; ...@@ -18,7 +18,7 @@ import javax.persistence.Table;
*/ */
@Entity @Entity
@Table(name = "etl.dim_kpi_t") @Table(name = "dim_kpi_t",schema = "ETL")
public class DimKpi implements Serializable{ public class DimKpi implements Serializable{
/** /**
......
...@@ -14,23 +14,23 @@ import java.math.BigDecimal; ...@@ -14,23 +14,23 @@ import java.math.BigDecimal;
@Table(name = "DIM_KPI_ASSOCIATION_RELATED_INFO_T",schema = "CCOLAP") @Table(name = "DIM_KPI_ASSOCIATION_RELATED_INFO_T",schema = "CCOLAP")
public class DimKpiAssociationRelInfo implements Serializable { 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;// private Long kpiAssociationRelatedId;//
@Column(name = "KPI_ID")
private Long kpiId;//指标名称 private Long kpiId;//指标名称
@Column(name = "KPI_WEIGHT")
private BigDecimal kpiWeight;//权重 private BigDecimal kpiWeight;//权重
@ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.EAGER,optional = false)// optional :代表外键字段是否可以为空。true可以为空,false不可以为空
@JoinColumn(name = "ASSOCIATION_ID") private transient DimAssociationAnaInfo dimAssociationAnaInfo;
private DimAssociationAnaInfo dimAssociationAnaInfo;
@Id
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="DimKpiAssociationRelInfoSequence")//作用:为一个实体生成一个唯一标识的主键
@SequenceGenerator(name = "DimKpiAssociationRelInfoSequence", sequenceName = "KPI_ASSOCIATION_RELATED_SEQ",initialValue = 1,allocationSize=1)
public Long getKpiAssociationRelatedId() { public Long getKpiAssociationRelatedId() {
return kpiAssociationRelatedId; return kpiAssociationRelatedId;
} }
...@@ -39,6 +39,7 @@ public class DimKpiAssociationRelInfo implements Serializable { ...@@ -39,6 +39,7 @@ public class DimKpiAssociationRelInfo implements Serializable {
this.kpiAssociationRelatedId = kpiAssociationRelatedId; this.kpiAssociationRelatedId = kpiAssociationRelatedId;
} }
@Column(name = "KPI_ID")
public Long getKpiId() { public Long getKpiId() {
return kpiId; return kpiId;
} }
...@@ -47,6 +48,8 @@ public class DimKpiAssociationRelInfo implements Serializable { ...@@ -47,6 +48,8 @@ public class DimKpiAssociationRelInfo implements Serializable {
this.kpiId = kpiId; this.kpiId = kpiId;
} }
@ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.EAGER,optional = false)// optional :代表外键字段是否可以为空。true可以为空,false不可以为空
@JoinColumn(name = "ASSOCIATION_ID")
public DimAssociationAnaInfo getDimAssociationAnaInfo() { public DimAssociationAnaInfo getDimAssociationAnaInfo() {
return dimAssociationAnaInfo; return dimAssociationAnaInfo;
} }
...@@ -55,6 +58,7 @@ public class DimKpiAssociationRelInfo implements Serializable { ...@@ -55,6 +58,7 @@ public class DimKpiAssociationRelInfo implements Serializable {
this.dimAssociationAnaInfo = dimAssociationAnaInfo; this.dimAssociationAnaInfo = dimAssociationAnaInfo;
} }
@Column(name = "KPI_WEIGHT")
public BigDecimal getKpiWeight() { public BigDecimal getKpiWeight() {
return kpiWeight; return kpiWeight;
} }
......
...@@ -7,9 +7,11 @@ import java.util.Collection; ...@@ -7,9 +7,11 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 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.PagingAndSortingRepository;
import com.hp.cmsz.entity.ChannelDataSourceMap; import com.hp.cmsz.entity.ChannelDataSourceMap;
import org.springframework.data.repository.query.Param;
/** /**
* ChannelDataSourceMap实体类对应的Dao层实现 * ChannelDataSourceMap实体类对应的Dao层实现
...@@ -25,5 +27,12 @@ public interface ChannelDataSourceMapDao extends PagingAndSortingRepository<Chan ...@@ -25,5 +27,12 @@ public interface ChannelDataSourceMapDao extends PagingAndSortingRepository<Chan
//by Liu Ying //by Liu Ying
List<ChannelDataSourceMap> findByDataSourceIdInAndChannelIdIn(Collection<Long> datasourceIdList, Collection<Long> channelIdList); List<ChannelDataSourceMap> findByDataSourceIdInAndChannelIdIn(Collection<Long> datasourceIdList, Collection<Long> channelIdList);
//by molinyi
@Query("select sourceMap.channelDataSourceMapId from ChannelDataSourceMap sourceMap where sourceMap.channelId = :channelId and sourceMap.dataSourceId = :dataSourceId")
public Object findChannelDataSourceMapIdByChannelIdAndDataSourceId(@Param(value = "channelId") Long channelId, @Param(value = "dataSourceId") long dataSourceId);
@Query("select sourceMap.channelDataSourceMapId from ChannelDataSourceMap sourceMap where sourceMap.channelId in (:channelList) and sourceMap.dataSourceId in (:dataSourceList)")
public List<Object>findChannelDataSourceMapIdByChannelIdListAndDataSourceIdList(@Param(value = "dataSourceList") List<Long> dataSourceList, @Param(value = "channelList") List<Long> channelList);
} }
...@@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.Query; ...@@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.PagingAndSortingRepository;
import com.hp.cmsz.entity.DimAssociationAnaInfo; import com.hp.cmsz.entity.DimAssociationAnaInfo;
import org.springframework.data.repository.query.Param;
import java.util.List; import java.util.List;
...@@ -19,4 +20,19 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs ...@@ -19,4 +20,19 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
public List<DimAssociationAnaInfo> findAllDimAssociationAnaInfoByDemension(String demension);*/ public List<DimAssociationAnaInfo> findAllDimAssociationAnaInfoByDemension(String demension);*/
@Query("from DimAssociationAnaInfo ")
public List<DimAssociationAnaInfo> findAllDimAssociationAnaInfo();
@Query("select anaInfo from DimAssociationAnaInfo anaInfo where anaInfo.AssociationType in (:demension)")
public List<DimAssociationAnaInfo> findDimAssociationAnaInfoByDimension(@Param(value = "demension") String demension);
@Query("select anaInfo from DimAssociationAnaInfo anaInfo where anaInfo.provinceId in (:province)")
public List<DimAssociationAnaInfo> findDimAssociationAnaInfoByProvince(@Param(value = "province") List<Long> detailProvince);
@Query("select anaInfo from DimAssociationAnaInfo anaInfo where anaInfo.provinceId in (:province) and anaInfo.AssociationType in (:demension)")
public List<DimAssociationAnaInfo> findDimAssociationAnaInfoByProvinceAndDimension(@Param(value = "province") List<Long> detailProvince,@Param(value = "demension") String dimension);
@Query("select anaInfo from DimAssociationAnaInfo anaInfo where anaInfo.associationId = :associationId ")
public DimAssociationAnaInfo findDimassociationAnaInfoByAssociationId(@Param(value = "associationId")Long associationId );
} }
...@@ -2,6 +2,7 @@ package com.hp.cmsz.repository; ...@@ -2,6 +2,7 @@ package com.hp.cmsz.repository;
import com.hp.cmsz.entity.DimKpiAssociationRelInfo; import com.hp.cmsz.entity.DimKpiAssociationRelInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
...@@ -24,4 +25,9 @@ public interface DimKpiAssociationRelInfoDao extends JpaSpecificationExecutor<Di ...@@ -24,4 +25,9 @@ public interface DimKpiAssociationRelInfoDao extends JpaSpecificationExecutor<Di
@Query("select relInfo from DimKpiAssociationRelInfo relInfo where relInfo.dimAssociationAnaInfo.provinceId in (:detailProvince)") @Query("select relInfo from DimKpiAssociationRelInfo relInfo where relInfo.dimAssociationAnaInfo.provinceId in (:detailProvince)")
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByProvince(@Param(value = "detailProvince")List<Long> detailProvince); public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByProvince(@Param(value = "detailProvince")List<Long> detailProvince);
@Modifying
@Query("delete from DimKpiAssociationRelInfo relInfo where relInfo.dimAssociationAnaInfo.associationId in (:associationIdL)")
public int deleteByAssociationId(@Param(value = "associationIdL") Long associationIdL);
} }
...@@ -2,6 +2,7 @@ package com.hp.cmsz.repository; ...@@ -2,6 +2,7 @@ package com.hp.cmsz.repository;
import java.util.List; import java.util.List;
import org.mozilla.javascript.tools.debugger.Dim;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
...@@ -14,11 +15,23 @@ public interface DimKpiDao extends JpaSpecificationExecutor<DimKpi>, ...@@ -14,11 +15,23 @@ public interface DimKpiDao extends JpaSpecificationExecutor<DimKpi>,
PagingAndSortingRepository<DimKpi, Long>{ PagingAndSortingRepository<DimKpi, Long>{
//通过kpiTypeId查找数据采集频率 //通过kpiTypeId查找数据采集频率
@Query("select dk.calCycle from DimKpi dk where dk.kpiTypeId = ?1") @Query("select dk.calCycle from DimKpi dk where dk.kpiTypeId = :kpiTypeId")
List<String> findCayCycleByKpiTypeIdIn(@Param("kpiTypeId")Long kpiTypeId); List<String> findCayCycleByKpiTypeIdIn(@Param("kpiTypeId")Long kpiTypeId);
//通过kpiTypeId修改数据采集频率 //通过kpiTypeId修改数据采集频率
@Modifying @Modifying
@Query("update from DimKpi dk set dk.calCycle=:calCycle where dk.kpiTypeId=:kpiTypeId") @Query("update from DimKpi dk set dk.calCycle=:calCycle where dk.kpiTypeId=:kpiTypeId")
void updateDimKpiByKpiTypeId(@Param("calCycle")String calCycle,@Param("kpiTypeId")Long kpiTypeId); void updateDimKpiByKpiTypeId(@Param("calCycle")String calCycle,@Param("kpiTypeId")Long kpiTypeId);
@Query("select dimKpi from DimKpi dimKpi")
List<DimKpi> findAllDimKpi();
@Query("select dimKpi from DimKpi dimKpi where dimKpi.busnameId in (:busnameIdList)")
public List<DimKpi> findDimKpiListBybusnameIdList(@Param(value = "busnameIdList") List<Long>busnameIdList);
@Query("select dimKpi from DimKpi dimKpi where dimKpi.kpiId in (:kpiIdList)")
public List<DimKpi> findDimKpiListBykpiIdList(@Param(value = "kpiIdList") List<Long>kpiIdList);
} }
package com.hp.cmsz.service.monitoroperation; package com.hp.cmsz.service.monitoroperation;
import com.hp.cmsz.entity.DimAssociationAnaInfo; import com.hp.cmsz.entity.*;
import com.hp.cmsz.entity.DimKpiAssociationRelInfo; import com.hp.cmsz.repository.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.hp.cmsz.repository.DimKpiAssociationRelInfoDao; import java.math.BigDecimal;
import com.hp.cmsz.repository.DimAssociationAnaInfoDao;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -19,35 +17,196 @@ import java.util.List; ...@@ -19,35 +17,196 @@ import java.util.List;
public class AssociateDiagosisConfigurationService { public class AssociateDiagosisConfigurationService {
@Autowired @Autowired
private DimKpiDao dimKpiDao;
@Autowired
private DimKpiAssociationRelInfoDao dimKpiAssociationRelInfoDao; private DimKpiAssociationRelInfoDao dimKpiAssociationRelInfoDao;
@Autowired @Autowired
private DimAssociationAnaInfoDao dimAssociationAnaInfoDao; private DimAssociationAnaInfoDao dimAssociationAnaInfoDao;
public void test(){ @Autowired
DimKpiAssociationRelInfo d=dimKpiAssociationRelInfoDao.findOne(1L); private ChannelDao channelDao;
@Autowired
private DataSourceDao dataSourceDao;
@Autowired
private ChannelDataSourceMapDao channelDataSourceMapDao;
@Autowired
private BusinessDao businessDao;
public void test() {
DimKpiAssociationRelInfo d = dimKpiAssociationRelInfoDao.findOne(1L);
System.out.println(d.getDimAssociationAnaInfo().getAssociationType()); System.out.println(d.getDimAssociationAnaInfo().getAssociationType());
DimAssociationAnaInfo info= dimAssociationAnaInfoDao.findOne(1l); 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(d.toString());
System.out.println(info.toString()); System.out.println(info.toString());
} }
public List<DimKpiAssociationRelInfo> findAllDimKpiAssociationRelInfo(){ public List<DimKpiAssociationRelInfo> findAllDimKpiAssociationRelInfo() {
return dimKpiAssociationRelInfoDao.findAllDimKpiAssociationRelInfo(); return dimKpiAssociationRelInfoDao.findAllDimKpiAssociationRelInfo();
} }
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByDimension(String demension){
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByDimension(String demension) {
return dimKpiAssociationRelInfoDao.findDimKpiAssociationRelInfoByDimension(demension); return dimKpiAssociationRelInfoDao.findDimKpiAssociationRelInfoByDimension(demension);
} }
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByDimensionAndProvince(String dimension,List<Long> detailProvince){ public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByDimensionAndProvince(String dimension, List<Long> detailProvince) {
return dimKpiAssociationRelInfoDao.findDimKpiAssociationRelInfoByDimensionAndProvince(dimension,detailProvince); return dimKpiAssociationRelInfoDao.findDimKpiAssociationRelInfoByDimensionAndProvince(dimension, detailProvince);
} }
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByProvince(List<Long> detailProvince){
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByProvince(List<Long> detailProvince) {
return dimKpiAssociationRelInfoDao.findDimKpiAssociationRelInfoByProvince(detailProvince); return dimKpiAssociationRelInfoDao.findDimKpiAssociationRelInfoByProvince(detailProvince);
} }
public List<DimAssociationAnaInfo> findAllDimAssociationAnaInfo() {
return dimAssociationAnaInfoDao.findAllDimAssociationAnaInfo();
}
public List<DimAssociationAnaInfo> findDimAssociationAnaInfoByDimension(String demension) {
return dimAssociationAnaInfoDao.findDimAssociationAnaInfoByDimension(demension);
}
public List<DimAssociationAnaInfo> findDimAssociationAnaInfoByProvince(List<Long> detailProvince) {
return dimAssociationAnaInfoDao.findDimAssociationAnaInfoByProvince(detailProvince);
}
public List<DimAssociationAnaInfo> findDimAssociationAnaInfoByProvinceAndDimension(List<Long> detailProvince, String dimension) {
return dimAssociationAnaInfoDao.findDimAssociationAnaInfoByProvinceAndDimension(detailProvince, dimension);
}
public List<DimKpi> findAllDimKpi() {
return (List<DimKpi>) dimKpiDao.findAll();
}
public DimKpi findADimKpiById(Long id) {
return dimKpiDao.findOne(id);
}
// 查找DIM_CHANNEL_INFO_T
public List<Channel> findAllChannel() {
return (List<Channel>) channelDao.findAll();
}
// 查找DIM_DATA_SOURCE_INFO_T
public List<DataSource> findAllDataSource() {
return (List<DataSource>) dataSourceDao.findAll();
}
//DIM_CHANNEL_DATA_SOURCE_MAP_T CHANNEL_DATA_SOURCE_MAP_ID
public Long findChannelDataSourceMapIdByChannelIdAndDataSourceId(Long channelId, long dataSourceId) {
return (Long) channelDataSourceMapDao.findChannelDataSourceMapIdByChannelIdAndDataSourceId(channelId, dataSourceId);
}
public List<Long> findChannelDataSourceMapIdListByChannelIdListAndDataSourceIdList(List<Long> dataSourceList, List<Long> channelList) {
List<Long> longList = new ArrayList<Long>();
List<Object> objectList = channelDataSourceMapDao.findChannelDataSourceMapIdByChannelIdListAndDataSourceIdList(dataSourceList, channelList);
if (objectList == null || objectList.size() < 1) {
return longList;
} else {
for (Object o : objectList) {
longList.add((Long) o);
}
}
return longList;
}
//
public List<Business> findBusinessListBychannelDataSourceMapId(Long channelDataSourceMapId) {
return businessDao.findBusinessListBychannelDataSourceMapId(channelDataSourceMapId);
}
public List<Business> findBusinessListBychannelDataSourceMapIdList(List<Long> channelDataSourceMapIdList) {
return businessDao.findBusinessListBychannelDataSourceMapIdList(channelDataSourceMapIdList);
}
public List<Long> findBusinessIdListBychannelDataSourceMapId(Long channelDataSourceMapId) {
List<Object> objList = businessDao.findBusinessIdListBychannelDataSourceMapId(channelDataSourceMapId);
List<Long> longList = new ArrayList<Long>();
System.out.println(objList == null ? "null" : "size " + objList.size());
for (Object o : objList) {
longList.add((Long) o);
}
return longList;
}
public List<Long> findBusinessIdListBychannelDataSourceMapIdList(List<Long> channelDataSourceMapIdList) {
List<Object> objList = businessDao.findBusinessIdListBychannelDataSourceMapIdList(channelDataSourceMapIdList);
List<Long> longList = new ArrayList<Long>();
for (Object o : objList) {
longList.add((Long) o);
}
return longList;
}
//
public List<DimKpi> findDimKpiListBybusnameIdList(List<Long> busnameIdList) {
return dimKpiDao.findDimKpiListBybusnameIdList(busnameIdList);
}
public List<Business> findBusinessListBychannelDataSourceMapIdListAndIsActived(List<Long> channelDataSourceMapIdList, String isActived) {
return businessDao.findBusinessListBychannelDataSourceMapIdListAndIsActived(channelDataSourceMapIdList, isActived);
}
public void updateAssociDigConfig(Long associationIdL, List<DimKpiAssociationRelInfo> dimKpiAssociationRelInfoList) {
//1 删除 指标表 数据
int n = dimKpiAssociationRelInfoDao.deleteByAssociationId(associationIdL);
System.out.println("n==" + n);
//更新 指标表和 配置表
List<DimKpiAssociationRelInfo> relInfos = (List<DimKpiAssociationRelInfo>) dimKpiAssociationRelInfoDao.save(dimKpiAssociationRelInfoList);
System.out.println("*** " + relInfos.size());
}
public void updateAssociDigConfig(Long associationIdL, DimAssociationAnaInfo dimAssociationAnaInfo) {
//1 删除 指标表 数据
// int n=dimKpiAssociationRelInfoDao.deleteByAssociationId(associationIdL);
// System.out.println("n===="+n);
//更新 指标表和 配置表
DimAssociationAnaInfo info = dimAssociationAnaInfoDao.save(dimAssociationAnaInfo);
System.out.println("_-_ " + info.getAssociationId());
}
public void deleteAssociDigConfig(Long associationId) {
dimAssociationAnaInfoDao.delete(associationId);
System.out.println("delete---");
}
public void pathSave(List<DimAssociationAnaInfo> anaInfoList, List<DimKpiAssociationRelInfo> dimKpiAssociationRelInfoList) {
for (DimAssociationAnaInfo dimAssociationAnaInfo : anaInfoList) {
DimAssociationAnaInfo copyDimAssociationAnaInfo = new DimAssociationAnaInfo();
copyDimAssociationAnaInfo.setProvinceId(dimAssociationAnaInfo.getProvinceId());
copyDimAssociationAnaInfo.setAssoicationDesc(dimAssociationAnaInfo.getAssoicationDesc());
copyDimAssociationAnaInfo.setAssociationType(dimAssociationAnaInfo.getAssociationType());
List<DimKpiAssociationRelInfo> copyDimKpiAssociationRelInfoList = new ArrayList<DimKpiAssociationRelInfo>();
copyDimKpiAssociationRelInfoList.clear();
for (int i = 0; i < dimKpiAssociationRelInfoList.size(); i++) {
DimKpiAssociationRelInfo relInfo = new DimKpiAssociationRelInfo();
relInfo.setKpiId(dimKpiAssociationRelInfoList.get(i).getKpiId());
relInfo.setKpiWeight(dimKpiAssociationRelInfoList.get(i).getKpiWeight());
relInfo.setDimAssociationAnaInfo(copyDimAssociationAnaInfo);
copyDimKpiAssociationRelInfoList.add(relInfo);
}
dimKpiAssociationRelInfoDao.save(copyDimKpiAssociationRelInfoList);
}
}
} }
...@@ -91,6 +91,8 @@ public class PageURLController { ...@@ -91,6 +91,8 @@ public class PageURLController {
//监控运营>告警关联诊>关联诊断配置> 新建指标 //监控运营>告警关联诊>关联诊断配置> 新建指标
public static String CreateDiagosis="MonitorOperation/CreateDiagosis"; public static String CreateDiagosis="MonitorOperation/CreateDiagosis";
//监控运营>告警关联诊>关联诊断配置> 修改指标
public static String AssociateDiagosisConfiguration_UpdateAnaInfo="MonitorOperation/UpdateAnaInfo";
//分析支撑下的集成商分析 //分析支撑下的集成商分析
//通过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";
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
<div class="slide-select"> <div class="slide-select">
<label for="">关联维度:</label> <label for="">关联维度:</label>
<select name="xcdStatus" id="xcdStatusSelect" class="slide-menu-select" onChange="judge=false;"> <select name="xcdStatus" id="xcdStatusSelect" class="slide-menu-select" onChange="judge=false;">
<option value="yewu">业务</option> <option value="y">业务</option>
<option value="qudao" selected>渠道</option> <option value="c" selected>渠道</option>
<%--<c:forEach var="workingOrderStatus" items="${workingOrderStatusList}"> <%--<c:forEach var="workingOrderStatus" items="${workingOrderStatusList}">
<option value="${workingOrderStatus}" id="xcdStatus"> <option value="${workingOrderStatus}" id="xcdStatus">
${workingOrderStatus} ${workingOrderStatus}
...@@ -268,8 +268,11 @@ ...@@ -268,8 +268,11 @@
// reset province // reset province
function detail_Province_Reset() { function detail_Province_Reset() {
$("#allProvinceDetail").removeAttr("checked");
$("#provinceDetail").removeAttr("checked");
$("#allProvinceDetail").attr("checked","checked"); $("#allProvinceDetail").attr("checked","checked");
$(".provinceDetail").attr("checked","checked"); $(".provinceDetail").attr("checked","checked");
detailProvinceCheckedValues=$(".provinceDetail");
} }
// reset dimension // reset dimension
function detail_Dimension_Reset(){ function detail_Dimension_Reset(){
......
...@@ -27,13 +27,15 @@ ...@@ -27,13 +27,15 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
var jso = document.getElementById('gzfxDetail').value; var jso = document.getElementById('gzfxDetail').value;
// alert(jso);
// failureTable(); // failureTable();
// initDateDetail();//初始化 时间范围 // initDateDetail();//初始化 时间范围
initTable();//初始化 主面板 initTable();//初始化 主面板
// $("#businessSelectAreaDetail").hide(); // $("#businessSelectAreaDetail").hide();
}); });
</script> </script>
<style>
th,td {text-align:center; /*设置水平居中*/vertical-align:middle;/*设置垂直居中*/}
</style>
</head> </head>
<body> <body>
...@@ -85,7 +87,7 @@ ...@@ -85,7 +87,7 @@
<span class="glyphicon glyphicon-list"></span> <span class="glyphicon glyphicon-list"></span>
</button> </button>
<div class="slide-menu-tags"> <div class="slide-menu-tags">
<span id="detailPeriodTag" class="label label-info" data-placement="bottom">最近一个月</span> <span id="detailPeriodTag" class="label label-info" data-placement="bottom"></span>
<span id="detailTimeTag" class="label label-info" <span id="detailTimeTag" class="label label-info"
data-placement="bottom"></span> data-placement="bottom"></span>
<span id="detailDemensionTag" class="label label-info" <span id="detailDemensionTag" class="label label-info"
...@@ -94,12 +96,12 @@ ...@@ -94,12 +96,12 @@
data-placement="bottom"></span> data-placement="bottom"></span>
</div> </div>
<div class="bt-list-import"> <%--<div class="bt-list-import">
<a href="#" id="downloadEecel" class=""> <a href="#" id="downloadEecel" class="">
<span class="glyphicon glyphicon-import"></span> <span class="glyphicon glyphicon-import"></span>
<span class="glyphicon-class">导出Excel</span> <span class="glyphicon-class">导出Excel</span>
</a> </a>
</div> </div>--%>
</div> </div>
<div class="row"> <div class="row">
...@@ -111,11 +113,11 @@ ...@@ -111,11 +113,11 @@
style="top: -6px;float: right;height: 0px;position: relative;"> style="top: -6px;float: right;height: 0px;position: relative;">
<button id="createIndicatorsBtn" <button id="createIndicatorsBtn"
class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog"
onclick="createIndicators()">新建指标 onclick="createIndicators()">新建关联配置
</button> </button>
<button id="updateIndicatorsBtn" <button id="updateIndicatorsBtn"
class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" disabled
onclick="updateIndicators()">修改指标 >修改关联配置
</button> </button>
</div> </div>
</shiro:hasAnyRoles> </shiro:hasAnyRoles>
...@@ -138,12 +140,15 @@ ...@@ -138,12 +140,15 @@
</div> </div>
<form action="#" method="get" id="listForm"></form> <form action="#" method="get" id="listForm"></form>
<input type="hidden" id="gzfxDetail" name="gzfxDetail" value='${gzfxDetailInfos}' /> <input type="hidden" id="gzfxDetail" name="gzfxDetail" value='${gzfxDetailInfos}' />
<%-- <input type="hidden" id="listDimKpi" name="listDimKpi" value='${listDimKpi}' />--%><%-- 所有指标--%>
<input type="hidden" id="provinceAll" name="provinceAll" value='${provinces}' /> <input type="hidden" id="provinceAll" name="provinceAll" value='${provinces}' />
<input type="hidden" id="indicatorsAll" name="indicatorsAll" value='${indicatorsAll}' /> <input type="hidden" id="indicatorsAll" name="indicatorsAll" value='${indicatorsAll}' />
<input type="hidden" id="anaInfoSelected" name="anaInfoSelected" value='' />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
function detailSubmit(){ function detailSubmit(){
var detailProvinceSum = getDetailProvinceCheckedValues().length; var detailProvinceSum = getDetailProvinceCheckedValues().length;
...@@ -151,12 +156,9 @@ ...@@ -151,12 +156,9 @@
$.alert("省份的选择不能为空"); $.alert("省份的选择不能为空");
}else { }else {
var detailProvince = getDetailProvinceCheckedValueString(); var detailProvince = getDetailProvinceCheckedValueString();
alert(detailProvince);
var dimension = getDetailCheckeddDimension(); var dimension = getDetailCheckeddDimension();
dimension="yc";
alert(dimension);
// var detailTime = getDetailPeriodStr();
$.ajax({ $.ajax({
type : 'GET', type : 'GET',
contentType : 'application/json', contentType : 'application/json',
...@@ -166,21 +168,20 @@ ...@@ -166,21 +168,20 @@
beforeSend: function(data) { beforeSend: function(data) {
}, },
success: function(data) { success: function(data) {
alert("-0-"+data+"=");
$("#gzfxDetail").val(data); $("#gzfxDetail").val(data);
// failureTable();
// checkFailureIds=[]; toggleMenu('slidePushMenus2');//隐藏筛选项
// $("#deleteFailureBtn").attr("disabled", true); initTable();
//toggleMenu('slidePushMenus2');//隐藏筛选项
} }
}); });
} }
toggleMenu('slidePushMenus2');//隐藏筛选项
$("#updateIndicatorsBtn").attr("disabled","true");
updateTags(true);//更新 tags显示 updateTags(true);//更新 tags显示
initTable();
} }
function updateTags(flag){ function updateTags(flag){
...@@ -206,7 +207,6 @@ ...@@ -206,7 +207,6 @@
function getDetailProvinceTag(){ function getDetailProvinceTag(){
var str=""; var str="";
$(".provinceDetail:input:checkbox:checked").each(function(){ $(".provinceDetail:input:checkbox:checked").each(function(){
//alert($(this).text());
str+=$(this).attr("title")+" "; str+=$(this).attr("title")+" ";
}); });
return str; return str;
...@@ -221,14 +221,13 @@ ...@@ -221,14 +221,13 @@
//重置detail中的筛选项 //重置detail中的筛选项
function detailReset(){ function detailReset(){
initDateDetail(); //initDateDetail();
detail_Dimension_Reset(); detail_Dimension_Reset();
detail_Province_Reset(); detail_Province_Reset();
updateTags(false); updateTags(false);
// judge = true; // judge = true;
} }
$("#downloadEecel").click(function(){ $("#downloadEecel").click(function(){
alert("downloadExcel");
var listForm=$("#listForm"); var listForm=$("#listForm");
listForm.attr("method","post"); listForm.attr("method","post");
listForm.attr("action","${ctx}/ModelManage/ModelResult/uploadModel"); listForm.attr("action","${ctx}/ModelManage/ModelResult/uploadModel");
...@@ -240,7 +239,7 @@ ...@@ -240,7 +239,7 @@
$.dialog({ $.dialog({
title: "提醒", title: "提醒",
content:"确定新建指标?", content:"确定新建指标?",
ok: function(){location.href="${ctx}/MonitorOperation/AssociateDiagosisDetail/createDiagosis";}, ok: function(){location.href="${ctx}/MonitorOperation/AssociateDiagosisConfiguration/createDiagosis";},
okValue:"确定", okValue:"确定",
cancel: function(){}, cancel: function(){},
cancelValue:"取消", cancelValue:"取消",
...@@ -248,6 +247,78 @@ ...@@ -248,6 +247,78 @@
}); });
}); });
//详情
function aClick(e){
$.dialog({
title:"",
content:"<div id='paramList'>"+
"<div class='col-xs-12'><div class='panel panel-default' ><div class='panel-heading' >指标列表</div><div class='panel-body'> <table class='table table-hover table-striped'> <thead> <tr> <th width='20%'>指标ID</th><th width='30%'>指标编码</th> <th width='30%' >指标名称</th> <th width='20%'>指标权值</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>"+
"</div>",
lock:true,
width:700,
initialize:function(){
var paramTbody = $('#paramList tbody');
var itemJson=eval('('+jsonStr+')');
for(var i=0;i<itemJson.length;i++){
var associationId=itemJson[i].associationId;
if(associationId == e.name){
var jsonItem=itemJson[i].items;
for(var j=0;j<jsonItem.length;j++){
var kpiId=jsonItem[j].kpiId; //kpiId
var kpiWeight=jsonItem[j].kpiWeight; //kpiWeight
$.ajax({
type : 'GET',
async : false,
contentType : 'application/json',
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/findADimKpiById?kpiId="+kpiId,
dataType : 'text',
success: function(data){
var jsonDa=eval('('+data+')');
dipistr=jsonDa.name;
paramTbody.append($("<tr></tr>").append("<td>"+kpiId+"</td>")
.append("<td>"+jsonDa.code+"</td>")
.append("<td>"+jsonDa.name+"</td>")
.append("<td>"+kpiWeight+"</td>"));
}
});
}
}
}
}
});
}
//更新按钮点击
$("#updateIndicatorsBtn").click(function(){
var associationId= $("#anaInfoSelected").val();
$.dialog({
title: "提醒",
content:"确定修改模型?",
ok: function(){location.href="${ctx}/MonitorOperation/AssociateDiagosisConfiguration/getAanaInfo?associationId="+associationId;},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
lock:true
});
/* $.confirm("确定修改模型?",
function(){location.href="${ctx}/ModelManage/ModelParameterConfiguration?dataModelId="+modelId;},
function(){}); */
});
</script> </script>
</body> </body>
</html> </html>
function initTable(){ function initTable(){
jsonStr = document.getElementById('gzfxDetail').value; jsonStr = document.getElementById('gzfxDetail').value;
// alert(jsonStr);
var header = new Array(); var header = new Array();
//provinceToArr(); //provinceToArr();
header[0] = ["","<input type='radio' name='update'id='update' onclick='javascript:radioChoose(this);'/>","1%",""]; header[0] = ["","associationId","1%",""];
header[1] = ["指标名称","kpiId","10%",""]; header[1] = ["省份","provinceId","10%",""];
header[2] = ["关联维度","AssociationType","10%","16"]; header[2] = ["维度","AssociationType","10%","16"];
header[3] = ["指标权重","kpiWeight","5%",""]; header[3] = ["描述","AssoicationDesc","5%",""];
header[4] = ["省份","provinceId","8%",""]; header[4] = ["指标列表","items","8%",""];
header[5] = ["关联描述","AssoicationDesc","8%",""]; /*header[5] = ["关联描述","AssoicationDesc","8%",""];*/
window.pagging = new table_pagging({limit:11,tableId:'failureAnalysisDetailTable',header:header});
window.pagging = new table_pagging({limit:10,tableId:'failureAnalysisDetailTable',header:header});
pagging.pagging(jsonStr); pagging.pagging(jsonStr);
} }
//删除明细 //删除明细
...@@ -21,6 +21,15 @@ function failureDelete(){ ...@@ -21,6 +21,15 @@ function failureDelete(){
alert() alert()
} }
// 点击单选按钮时 触发
function radioChoose(e){
$("#updateIndicatorsBtn").removeAttr("disabled");
$("#anaInfoSelected").val(e.id);
console.log(e.id);
}
//将省份转换为 数组 //将省份转换为 数组
function provinceToArr(){ function provinceToArr(){
var str=document.getElementById('provinceAll').value; var str=document.getElementById('provinceAll').value;
...@@ -32,6 +41,7 @@ function provinceToArr(){ ...@@ -32,6 +41,7 @@ function provinceToArr(){
return arrProvince; return arrProvince;
} }
// 将 指标转换为 数组 // 将 指标转换为 数组
function indicatorsToArr(){ function indicatorsToArr(){
var str=document.getElementById('indicatorsAll').value; var str=document.getElementById('indicatorsAll').value;
...@@ -40,6 +50,8 @@ function indicatorsToArr(){ ...@@ -40,6 +50,8 @@ function indicatorsToArr(){
return arrProvince; return arrProvince;
} }
var table_pagging = function(){ var table_pagging = function(){
this.init.apply(this, arguments); this.init.apply(this, arguments);
} }
...@@ -179,7 +191,7 @@ table_pagging.prototype={ ...@@ -179,7 +191,7 @@ table_pagging.prototype={
var tdTitle=""; var tdTitle="";
if(this.header[k][1]){ if(this.header[k][1]){
var reg = /\%\{([\d\w.]+)\}\%/g; var reg = /\%\{([\d\w.]+)\}\%/g;
if (k != 0) { if (k > 0 && k < 4) {
if (result = reg.exec(this.header[k][1])) { if (result = reg.exec(this.header[k][1])) {
// var result = reg.exec(this.header[k][1]); // var result = reg.exec(this.header[k][1]);
var context = this.header[k][1]; var context = this.header[k][1];
...@@ -193,27 +205,36 @@ table_pagging.prototype={ ...@@ -193,27 +205,36 @@ table_pagging.prototype={
tdContext = context; tdContext = context;
} else { } else {
if(k==1 ||k==3){ console.log(this.objectlist);
console.log(this.objectlist)
tdContext = this.getData(this.objectlist[i],this.header[k][1]) if(k==1){
}else{ tdContext = this.getProviceData(this.objectlist[i],this.header[k][1]);
if(k==4){ }else if(k == 2){
tdContext=this.getProviceData(this.objectlist[i]["dimAssociationAnaInfo"],this.header[k][1]) var dimensionddd=this.getData(this.objectlist[i],this.header[k][1]);
if(dimensionddd == 'y'){
tdContext = '业务';
}else if(dimensionddd == 'c'){
tdContext = '渠道';
}else{ }else{
tdContext=this.getData(this.objectlist[i]["dimAssociationAnaInfo"],this.header[k][1]) tdContext='';
} }
}else{
tdContext = this.getData(this.objectlist[i],this.header[k][1]);
} }
} }
} else { }
if(k==0) {
// tdContext="<input type='checkbox' name='failureBox"+i+"' class='failureBox' onclick='javascript:checkFailureIdsChoose(this);'/>"+"<span style='display:none'>"+i+"</span>"; tdContext="<input type='radio' name='update'id='"+this.getData(this.objectlist[i],this.header[0][1])+"' onclick='radioChoose(this);'/>";
// for ( var t = 0; t < checkFailureIds.length; t++) { console.log(tdContext)
// if (checkFailureIds[t] == this.getData(this.objectlist[i], "failureId")){
// tdContext="<input type='checkbox' name='failureBox"+i+"' class='failureBox' checked onclick='javascript:checkFailureIdsChoose(this);'/>"+"<span style='display:none'>"+i+"</span>"; }
// break; if(k==4){
// } var items=this.getData(this.objectlist[i],this.header[k][1]);
// } // alert(items);
tdContext="<a name='"+this.getData(this.objectlist[i],this.header[0][1])+"' onclick='aClick(this)'>详情</a>";
} }
} else { } else {
tdContext = "&nbsp;"; tdContext = "&nbsp;";
......
...@@ -570,6 +570,7 @@ table_pagging.prototype = { ...@@ -570,6 +570,7 @@ table_pagging.prototype = {
} }
function radioChoose(clickObj){ function radioChoose(clickObj){
alert();
var obj = eval("(" + jsonData + ")"); var obj = eval("(" + jsonData + ")");
//alert(obj); //alert(obj);
if(clickObj.checked){ if(clickObj.checked){
......
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