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

2017年12月03 关联配置

parent 50f4355d
......@@ -2,6 +2,7 @@ package com.hp.cmsz.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -13,6 +14,8 @@ import java.util.List;
@Entity
@Table(name = "DIM_ASSOCIATION_ANALYSIS_INFO_T",schema = "CCOLAP")
public class DimAssociationAnaInfo implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="DimAssociationAnaInfoSequence")
@SequenceGenerator(name = "DimAssociationAnaInfoSequence", sequenceName = "ASSOCIATION_SEQ", initialValue = 1,allocationSize=1)
......@@ -28,7 +31,7 @@ public class DimAssociationAnaInfo implements Serializable {
private String AssoicationDesc;//描述
@OneToMany(fetch = FetchType.EAGER,cascade = {CascadeType.ALL},mappedBy = "dimAssociationAnaInfo")
private transient List<DimKpiAssociationRelInfo> items;
private List<DimKpiAssociationRelInfo> items;//=new ArrayList<DimKpiAssociationRelInfo>();
public Long getAssociationId() {
return associationId;
......
......@@ -18,7 +18,7 @@ import javax.persistence.Table;
*/
@Entity
@Table(name = "etl.dim_kpi_t")
@Table(name = "dim_kpi_t",schema = "ETL")
public class DimKpi implements Serializable{
/**
......
......@@ -14,23 +14,23 @@ import java.math.BigDecimal;
@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;
private transient DimAssociationAnaInfo dimAssociationAnaInfo;
@Id
@GeneratedValue(strategy= GenerationType.SEQUENCE, generator="DimKpiAssociationRelInfoSequence")//作用:为一个实体生成一个唯一标识的主键
@SequenceGenerator(name = "DimKpiAssociationRelInfoSequence", sequenceName = "KPI_ASSOCIATION_RELATED_SEQ",initialValue = 1,allocationSize=1)
public Long getKpiAssociationRelatedId() {
return kpiAssociationRelatedId;
}
......@@ -39,6 +39,7 @@ public class DimKpiAssociationRelInfo implements Serializable {
this.kpiAssociationRelatedId = kpiAssociationRelatedId;
}
@Column(name = "KPI_ID")
public Long getKpiId() {
return kpiId;
}
......@@ -47,6 +48,8 @@ public class DimKpiAssociationRelInfo implements Serializable {
this.kpiId = kpiId;
}
@ManyToOne(cascade = {CascadeType.ALL},fetch = FetchType.EAGER,optional = false)// optional :代表外键字段是否可以为空。true可以为空,false不可以为空
@JoinColumn(name = "ASSOCIATION_ID")
public DimAssociationAnaInfo getDimAssociationAnaInfo() {
return dimAssociationAnaInfo;
}
......@@ -55,6 +58,7 @@ public class DimKpiAssociationRelInfo implements Serializable {
this.dimAssociationAnaInfo = dimAssociationAnaInfo;
}
@Column(name = "KPI_WEIGHT")
public BigDecimal getKpiWeight() {
return kpiWeight;
}
......
......@@ -9,16 +9,17 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import com.hp.cmsz.entity.Business;
/**
*
* @author Liu Ying
*
*/
public interface BusinessDao extends JpaSpecificationExecutor<Business>,
PagingAndSortingRepository<Business, Long> {
List<Business> findByChannelDataSourceMapIdIn(List<Long> channelDataSourceMapIdList);
List<Business> findByChannelDataSourceMapIdIn(Collection<Long> channelDataSourceMapIdList);
List<Business> findByBusinessIdIn(List<Long> businessIds);
//加入isActive=N || add by August 2014-3-27
......@@ -28,23 +29,23 @@ public interface BusinessDao extends JpaSpecificationExecutor<Business>,
//加入isActive=N || add by August 2014-3-27
//由数据来源和渠道得到业务
@Query("select business.businessId, business.businessName from Business business,ChannelDataSourceMap channelDataSourceMap where business.channelDataSourceMapId=channelDataSourceMap.channelDataSourceMapId and channelDataSourceMap.channelId IN (:channelIdList) and channelDataSourceMap.dataSourceId IN (:datasourceIdList) and business.isActive = 'Y' and business.businessId >= 0 order by business.businessId ")
List<Object[]> findAllBusinessIdAndBusinessNameByDataSourceIdAndChannelId(@Param("channelIdList") List<Long> channelIdList,@Param("datasourceIdList") List<Long> datasourceIdList);
List<Object[]> findAllBusinessIdAndBusinessNameByDataSourceIdAndChannelId(@Param("channelIdList") List<Long> channelIdList, @Param("datasourceIdList") List<Long> datasourceIdList);
//加入business_id<>899 || add by Charmy 2014-8-24
//由数据来源和渠道得到业务
@Query("select business.businessId, business.businessName from Business business,ChannelDataSourceMap channelDataSourceMap where business.channelDataSourceMapId=channelDataSourceMap.channelDataSourceMapId and channelDataSourceMap.channelId IN (:channelIdList) and channelDataSourceMap.dataSourceId IN (:datasourceIdList) and business.isActive = 'Y' and business.businessId >= 0 and business_id<>899 order by business.businessId ")
List<Object[]> findBusinessByDataSourceIdAndChannelIdNot899(@Param("channelIdList") List<Long> channelIdList,@Param("datasourceIdList") List<Long> datasourceIdList);
List<Object[]> findBusinessByDataSourceIdAndChannelIdNot899(@Param("channelIdList") List<Long> channelIdList, @Param("datasourceIdList") List<Long> datasourceIdList);
//由单个数据来源ID和单个渠道ID得到业务
@Query("select business.businessId, business.businessName from Business business,ChannelDataSourceMap channelDataSourceMap where business.channelDataSourceMapId=channelDataSourceMap.channelDataSourceMapId and channelDataSourceMap.channelId = :channelIdList and channelDataSourceMap.dataSourceId =:datasourceIdList and business.businessId >= 0 order by business.businessId")
List<Object[]> findBusinessIdAndBusinessNameByDataSourceIdAndChannelId(@Param("channelIdList") Long channelIdList,@Param("datasourceIdList") Long datasourceIdList);
List<Object[]> findBusinessIdAndBusinessNameByDataSourceIdAndChannelId(@Param("channelIdList") Long channelIdList, @Param("datasourceIdList") Long datasourceIdList);
//由单个数据来源ID和单个渠道ID得到业务,加入isActive=N
@Query("select business.businessId, business.businessName from Business business,ChannelDataSourceMap channelDataSourceMap where business.isActive = 'Y' and business.channelDataSourceMapId=channelDataSourceMap.channelDataSourceMapId and channelDataSourceMap.channelId = :channelId and channelDataSourceMap.dataSourceId =:datasourceId and business.businessId >= 0 order by business.businessId")
List<Object[]> findBusinessIdAndBusinessNameByDataSourceIdAndChannelIdWithIsActive(@Param("channelId") Long channelId,@Param("datasourceId") Long datasourceId);
List<Object[]> findBusinessIdAndBusinessNameByDataSourceIdAndChannelIdWithIsActive(@Param("channelId") Long channelId, @Param("datasourceId") Long datasourceId);
@Query("select business.businessId, business.businessName from Business business,ChannelDataSourceMap channelDataSourceMap,Channel channel where channel.channelId=channelDataSourceMap.channelId and business.channelDataSourceMapId=channelDataSourceMap.channelDataSourceMapId and channel.channelName=:channelName and business.businessId >= 0 order by business.businessId")
List<Object[]> findBusinessByChannelName(@Param("channelName")String channelName);
List<Object[]> findBusinessByChannelName(@Param("channelName") String channelName);
//竞品分析部分"竞品业务"筛选项取值
@Query("select business.businessId,business.businessName from Business business,ChannelDataSourceMap channelDataSourceMap where business.channelDataSourceMapId=channelDataSourceMap.channelDataSourceMapId and business.ifCompetitionBusiness='Y' and business.isActive = 'Y' and channelDataSourceMap.dataSourceId = '1' and channelDataSourceMap.channelId IN (:channelIdList) and business.businessId >= 0 order by business.businessId")
......@@ -53,6 +54,24 @@ public interface BusinessDao extends JpaSpecificationExecutor<Business>,
//加入isActive=Y || add by Sophia
//由数据来源和渠道得到业务
@Query("select business.businessId, business.businessName from Business business,AnalysisTypeDsCMap analysisTypeDsCMap where business.channelDataSourceMapId=analysisTypeDsCMap.channelDataSourceMapId and analysisTypeDsCMap.channelId IN (:channelIdList) and analysisTypeDsCMap.dataSourceId IN (:datasourceIdList) and business.isActive = 'Y' and business.businessId >= 0 order by business.businessId")
List<Object[]> findYwglBusinessIdAndBusinessNameByDataSourceIdAndChannelId(@Param("datasourceIdList") List<Long> datasourceIdList,@Param("channelIdList") List<Long> channelIdList);
List<Object[]> findYwglBusinessIdAndBusinessNameByDataSourceIdAndChannelId(@Param("datasourceIdList") List<Long> datasourceIdList, @Param("channelIdList") List<Long> channelIdList);
//by molinyi
@Query("select business from Business business where business.channelDataSourceMapId= :channelDataSourceMapId")
public List<Business> findBusinessListBychannelDataSourceMapId(@Param(value = "channelDataSourceMapId") Long channelDataSourceMapId);
@Query("select business from Business business where business.channelDataSourceMapId in (:channelDataSourceMapIdList)")
public List<Business> findBusinessListBychannelDataSourceMapIdList(@Param(value = "channelDataSourceMapIdList") List<Long> channelDataSourceMapIdList);
@Query("select business.businessId from Business business where business.channelDataSourceMapId= :channelDataSourceMapId")
public List<Object> findBusinessIdListBychannelDataSourceMapId(@Param(value = "channelDataSourceMapId") Long channelDataSourceMapId);
@Query("select business.businessId from Business business where business.channelDataSourceMapId in (:channelDataSourceMapIdList)")
public List<Object> findBusinessIdListBychannelDataSourceMapIdList(@Param(value = "channelDataSourceMapIdList") List<Long> channelDataSourceMapIdList);
@Query("select business from Business business where business.isActive = :isActived and business.channelDataSourceMapId in (:channelDataSourceMapIdList)")
public List<Business> findBusinessListBychannelDataSourceMapIdListAndIsActived(@Param(value = "channelDataSourceMapIdList") List<Long>channelDataSourceMapIdList,@Param(value = "isActived") String isActived);
}
......@@ -7,9 +7,11 @@ import java.util.Collection;
import java.util.List;
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.ChannelDataSourceMap;
import org.springframework.data.repository.query.Param;
/**
* ChannelDataSourceMap实体类对应的Dao层实现
......@@ -26,4 +28,11 @@ public interface ChannelDataSourceMapDao extends PagingAndSortingRepository<Chan
//by Liu Ying
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;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.hp.cmsz.entity.DimAssociationAnaInfo;
import org.springframework.data.repository.query.Param;
import java.util.List;
......@@ -19,4 +20,19 @@ public interface DimAssociationAnaInfoDao extends JpaSpecificationExecutor<DimAs
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;
import com.hp.cmsz.entity.DimKpiAssociationRelInfo;
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.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
......@@ -24,4 +25,9 @@ public interface DimKpiAssociationRelInfoDao extends JpaSpecificationExecutor<Di
@Query("select relInfo from DimKpiAssociationRelInfo relInfo where relInfo.dimAssociationAnaInfo.provinceId in (: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;
import java.util.List;
import org.mozilla.javascript.tools.debugger.Dim;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
......@@ -14,11 +15,23 @@ public interface DimKpiDao extends JpaSpecificationExecutor<DimKpi>,
PagingAndSortingRepository<DimKpi, Long>{
//通过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);
//通过kpiTypeId修改数据采集频率
@Modifying
@Query("update from DimKpi dk set dk.calCycle=:calCycle where dk.kpiTypeId=: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;
import com.hp.cmsz.entity.DimAssociationAnaInfo;
import com.hp.cmsz.entity.DimKpiAssociationRelInfo;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.*;
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.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
......@@ -19,35 +17,196 @@ import java.util.List;
public class AssociateDiagosisConfigurationService {
@Autowired
private DimKpiDao dimKpiDao;
@Autowired
private DimKpiAssociationRelInfoDao dimKpiAssociationRelInfoDao;
@Autowired
private DimAssociationAnaInfoDao dimAssociationAnaInfoDao;
public void test(){
DimKpiAssociationRelInfo d=dimKpiAssociationRelInfoDao.findOne(1L);
@Autowired
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());
DimAssociationAnaInfo info= dimAssociationAnaInfoDao.findOne(1l);
System.out.println(info.getItems().get(0).getKpiWeight());
System.out.println(info.getItems().get(1).getKpiWeight());
DimAssociationAnaInfo info = dimAssociationAnaInfoDao.findOne(1l);
System.out.println(d.toString());
System.out.println(info.toString());
}
public List<DimKpiAssociationRelInfo> findAllDimKpiAssociationRelInfo(){
public List<DimKpiAssociationRelInfo> findAllDimKpiAssociationRelInfo() {
return dimKpiAssociationRelInfoDao.findAllDimKpiAssociationRelInfo();
}
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByDimension(String demension){
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> findDimKpiAssociationRelInfoByDimensionAndProvince(String dimension, List<Long> detailProvince) {
return dimKpiAssociationRelInfoDao.findDimKpiAssociationRelInfoByDimensionAndProvince(dimension, detailProvince);
}
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByProvince(List<Long> detailProvince){
public List<DimKpiAssociationRelInfo> findDimKpiAssociationRelInfoByProvince(List<Long> 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 {
//监控运营>告警关联诊>关联诊断配置> 新建指标
public static String CreateDiagosis="MonitorOperation/CreateDiagosis";
//监控运营>告警关联诊>关联诊断配置> 修改指标
public static String AssociateDiagosisConfiguration_UpdateAnaInfo="MonitorOperation/UpdateAnaInfo";
//分析支撑下的集成商分析
//通过ProviderAnalysis映射到WEB-INF/views下的AnalysisSupport/ProviderFailureAnalysis.jsp页面
public static String ProviderFailureAnalysis="AnalysisSupport/ProviderFailureAnalysis";
......
......@@ -2,33 +2,34 @@ 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.entity.*;
import com.hp.cmsz.repository.DimAssociationAnaInfoDao;
import com.hp.cmsz.repository.DimKpiAssociationRelInfoDao;
import com.hp.cmsz.repository.DimKpiDao;
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.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* AssociateDiagosisConfigurationController 监控运营>告警关联诊>关联诊断配置
*
* @author Molinyi
*
*/
@Controller
@RequestMapping(value = "/MonitorOperation/AssociateDiagosisConfiguration")
public class AssociateDiagosisConfigurationController {
@Autowired
private ProvinceDao provinceDao;
@Autowired
......@@ -36,56 +37,563 @@ public class AssociateDiagosisConfigurationController {
@Autowired
private DimKpiAssociationRelInfoDao dimKpiAssociationRelInfoDao;
@Autowired
private DimAssociationAnaInfoDao dimAssociationAnaInfoDao;
@Autowired
private DimKpiDao dimKpiDao;
@RequestMapping("")
public String list(Map model,
@RequestParam(defaultValue = "",value = "detailProvince")String detailProvince,
@RequestParam(defaultValue = "",value = "dimension")String dimension
){
@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();
List<DimAssociationAnaInfo> listDim = new ArrayList<DimAssociationAnaInfo>();
// List<DimKpi>listDimKpi=new ArrayList<DimKpi>();
if (detailProvince.equalsIgnoreCase("") && dimension.equalsIgnoreCase("")) {//查找所有
listDim = associateDiagosisConfigurationService.findAllDimAssociationAnaInfo();
}
if(detailProvince.equalsIgnoreCase("")&&(!dimension.equalsIgnoreCase(""))){
list=associateDiagosisConfigurationService.findDimKpiAssociationRelInfoByDimension(dimension);
if (detailProvince.equalsIgnoreCase("") && (!dimension.equalsIgnoreCase(""))) {
listDim = associateDiagosisConfigurationService.findDimAssociationAnaInfoByDimension(dimension);
}
if((!detailProvince.equalsIgnoreCase(""))&&(!dimension.equalsIgnoreCase(""))){
String[]arrProvice=detailProvince.split(",");
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++){
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);
listDim = associateDiagosisConfigurationService.findDimAssociationAnaInfoByProvinceAndDimension(listProvice, 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++){
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);
listDim = associateDiagosisConfigurationService.findDimAssociationAnaInfoByProvince(listProvice);
}
Gson gson = new Gson();
Gson gsonP = new Gson();
List<Province> provinceList =(List<Province>) provinceDao.findProvince();
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));//所有指标
// model.put("listDimKpi", gson.toJson(listDimKpi));//所有指标
model.put("gzfxDetailInfos", gson.toJson(listDim));
model.put("provinces", gsonP.toJson(provinceList));
model.put("indicatorsAll", gsonP.toJson(provinceList));//所有指标
System.out.println(")))"+gsonP.toJson(provinceList));
return PageURLController.AssociateDiagosisConfiguration;
}
@RequestMapping("/getTableData")
@ResponseBody
public /*List<DimAssociationAnaInfo>*/String getTableData(@RequestParam(defaultValue = "", value = "detailProvince") String detailProvince,
@RequestParam(defaultValue = "", value = "dimension") String dimension) {
List<DimAssociationAnaInfo> listDim = new ArrayList<DimAssociationAnaInfo>();
if (detailProvince.equalsIgnoreCase("") && dimension.equalsIgnoreCase("")) {//查找所有
listDim = associateDiagosisConfigurationService.findAllDimAssociationAnaInfo();
}
if (detailProvince.equalsIgnoreCase("") && (!dimension.equalsIgnoreCase(""))) {
listDim = associateDiagosisConfigurationService.findDimAssociationAnaInfoByDimension(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]));
}
listDim = associateDiagosisConfigurationService.findDimAssociationAnaInfoByProvinceAndDimension(listProvice, 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]));
}
listDim = associateDiagosisConfigurationService.findDimAssociationAnaInfoByProvince(listProvice);
}
Gson gson = new Gson();
return gson.toJson(listDim);
}
@RequestMapping("/createDiagosis")
public String createDiagosis(Map model) {
List<Province> listProvice = new ArrayList<Province>();
List<String> dimensionList = new ArrayList<String>();
dimensionList.add("c");
dimensionList.add("y");
listProvice = (List<Province>) provinceDao.findProvince();
model.put("proviceList", listProvice);
model.put("dimensionList", dimensionList);
//数据源
List<DataSource> dataSourceList = new ArrayList<DataSource>();
dataSourceList = associateDiagosisConfigurationService.findAllDataSource();
model.put("dataSourceList", dataSourceList);
//频道
List<Channel> channelList = new ArrayList<Channel>();
channelList = associateDiagosisConfigurationService.findAllChannel();
model.put("channelList", channelList);
return PageURLController.CreateDiagosis;
}
@RequestMapping("/getAanaInfo")
public String getTableData(Map model, @RequestParam(defaultValue = "", value = "associationId") String associationId) {
DimAssociationAnaInfo anaInfo = new DimAssociationAnaInfo();
if (!associationId.equalsIgnoreCase("")) {
Long associationIdL = Long.parseLong(associationId);
anaInfo = dimAssociationAnaInfoDao.findDimassociationAnaInfoByAssociationId(associationIdL);
}
List<Province> listProvice = new ArrayList<Province>();
List<Map<String,String>> dimensionList = new ArrayList<Map<String,String>>();
listProvice = (List<Province>) provinceDao.findProvince();
Map<String,String>mapC=new HashMap<String, String>();
mapC.put("name","渠道");
mapC.put("value","c");
Map<String,String>mapY=new HashMap<String, String>();
mapY.put("name","业务");
mapY.put("value","y");
dimensionList.add(mapC);
dimensionList.add(mapY);
/*dimensionList.add("c");
dimensionList.add("y");*/
//数据源
List<DataSource> dataSourceList = new ArrayList<DataSource>();
dataSourceList = associateDiagosisConfigurationService.findAllDataSource();
//频道
List<Channel> channelList = new ArrayList<Channel>();
channelList = associateDiagosisConfigurationService.findAllChannel();
//选择的 指标
List<DimKpi> dimKpiSelectedList = new ArrayList<DimKpi>();
List<Long> kpiIdList = new ArrayList<Long>();
for (DimKpiAssociationRelInfo relInfo : anaInfo.getItems()) {
kpiIdList.add(relInfo.getKpiId());
}
if(kpiIdList.size()>0){
dimKpiSelectedList = dimKpiDao.findDimKpiListBykpiIdList(kpiIdList);
}
model.put("proviceList", listProvice);
model.put("dimensionList", dimensionList);
model.put("channelList", channelList);
model.put("dataSourceList", dataSourceList);
model.put("dimKpiSelectedList", dimKpiSelectedList);
model.put("anaInfo", anaInfo);
return PageURLController.AssociateDiagosisConfiguration_UpdateAnaInfo;
}
@RequestMapping("/findADimKpiById")
@ResponseBody
public String findADimKpiById(@RequestParam(defaultValue = "", value = "kpiId") String kpiId) {
DimKpi dimKpi = new DimKpi();
if (!"".equalsIgnoreCase(kpiId)) {
dimKpi = associateDiagosisConfigurationService.findADimKpiById(Long.valueOf(kpiId));
}
Gson gson = new Gson();
return gson.toJson(dimKpi);
}
@RequestMapping("/getBusinessByChannelIdListAndDataSourceIdList")
@ResponseBody
public String getBusinessByChannelIdListAndDataSourceIdList(@RequestParam(value = "dataSourceId", defaultValue = "") String dataSourceIdList,
@RequestParam(value = "channelId", defaultValue = "") String channelIdList) {
String str = "";
if ("".equalsIgnoreCase(dataSourceIdList)) {
return str;
}
if ("".equalsIgnoreCase(channelIdList)) {
return str;
}
String[] arrdataSourceId = dataSourceIdList.split(",");
String[] arrchannelId = channelIdList.split(",");
List<Long> dataSourceList = new CopyOnWriteArrayList<Long>();
List<Long> channelList = new CopyOnWriteArrayList<Long>();
for (int i = 0; i < arrdataSourceId.length; i++) {
dataSourceList.add(Long.parseLong(arrdataSourceId[i]));
}
for (int i = 0; i < arrchannelId.length; i++) {
channelList.add(Long.parseLong(arrchannelId[i]));
}
List<Long> channelDataSourceMapIdList = associateDiagosisConfigurationService.
findChannelDataSourceMapIdListByChannelIdListAndDataSourceIdList(dataSourceList, channelList);
if (channelDataSourceMapIdList == null || channelDataSourceMapIdList.size() < 1) {
return str;
}
List<Business> businessList = associateDiagosisConfigurationService.findBusinessListBychannelDataSourceMapIdListAndIsActived(channelDataSourceMapIdList, "Y");
Gson gson = new Gson();
return gson.toJson(businessList);
}
@RequestMapping("/getDimKpiListByBusinessIdList")
@ResponseBody
public String getDimKpiListByBusinessIdList(@RequestParam(value = "businessIdList", defaultValue = "") String businessIdList
) {
String str = "";
if ("".equalsIgnoreCase(businessIdList)) {
return str;
}
String[] businessIdarr = businessIdList.split(",");
List<Long> businessIdlist = new CopyOnWriteArrayList<Long>();
for (int i = 0; i < businessIdarr.length; i++) {
businessIdlist.add(Long.parseLong(businessIdarr[i]));
}
List<DimKpi> dimKpiList = associateDiagosisConfigurationService.findDimKpiListBybusnameIdList(businessIdlist);
Gson gson = new Gson();
return gson.toJson(dimKpiList);
}
@RequestMapping("/getDimKpiListByDataSourceIdAndChannelId")
@ResponseBody
public String findDimKpiByDataSourceIdAndChannelId(@RequestParam(value = "dataSourceId", defaultValue = "") String dataSourceId,
@RequestParam(value = "channelId", defaultValue = "") String channelId) {
String str = "";
if ("".equalsIgnoreCase(dataSourceId)) {
return str;
}
if ("".equalsIgnoreCase(channelId)) {
return str;
}
String[] arrdataSourceId = dataSourceId.split(",");
String[] arrchannelId = channelId.split(",");
List<Long> dataSourceList = new CopyOnWriteArrayList<Long>();
List<Long> channelList = new CopyOnWriteArrayList<Long>();
for (int i = 0; i < arrdataSourceId.length; i++) {
dataSourceList.add(Long.parseLong(arrdataSourceId[i]));
}
for (int i = 0; i < arrchannelId.length; i++) {
channelList.add(Long.parseLong(arrchannelId[i]));
}
List<Long> channelDataSourceMapIdList = associateDiagosisConfigurationService.
findChannelDataSourceMapIdListByChannelIdListAndDataSourceIdList(dataSourceList, channelList);
if (channelDataSourceMapIdList == null || channelDataSourceMapIdList.size() < 1) {
return str;
}
List<Long> businessIdList = associateDiagosisConfigurationService.findBusinessIdListBychannelDataSourceMapIdList(channelDataSourceMapIdList);
if (businessIdList == null || businessIdList.size() == 0) {
return str;
}
List<DimKpi> dimKpiList = associateDiagosisConfigurationService.findDimKpiListBybusnameIdList(businessIdList);
Gson gson = new Gson();
return gson.toJson(dimKpiList);
}
/* @RequestMapping(value = "/updateAssociDigConfig", method = RequestMethod.GET)
@ResponseBody
public String updateAssociDigConfig(
@RequestParam(value = "associationId", defaultValue = "") String associationId,
@RequestParam(value = "proviceTdSelected", defaultValue = "") String proviceTdSelected,
@RequestParam(value = "dimensionTdSelected", defaultValue = "") String dimensionTdSelected,
@RequestParam(value = "descTdV", defaultValue = "") String descTdV,
@RequestParam(value = "arrIdAndWeightDimKpiChecked", defaultValue = "") String arrIdAndWeightDimKpiChecked
*//*@RequestParam(value = "dimKpiSelSelected", defaultValue = "") String dimKpiSelSelectedarr,
@RequestParam(value = "kpiWeightTdV", defaultValue = "") String kpiWeightTdV*//*) {
String strR = "更新失败";
if ("".equalsIgnoreCase(proviceTdSelected) || ("".equalsIgnoreCase(dimensionTdSelected))
|| ("".equalsIgnoreCase(arrIdAndWeightDimKpiChecked)) || ("".equalsIgnoreCase(descTdV)) || ("".equalsIgnoreCase(associationId))) {
return strR;
} else {
try {
*//*String[] dimKpiSelSelectedArr = dimKpiSelSelectedarr.split(",");
List<Long> dimKpiSelSelectedList = new ArrayList<Long>();//指标名称 ID
for (String s : dimKpiSelSelectedArr) {
dimKpiSelSelectedList.add(Long.parseLong(s));
}*//*
Long associationIdL=Long.parseLong(associationId);//associationId
Long proviceTdSelectedL = Long.valueOf(proviceTdSelected);//省份ID
// Double kpiWeightTdVL = Double.parseDouble(kpiWeightTdV);//权重
//配置表对象
DimAssociationAnaInfo dimAssociationAnaInfo = new DimAssociationAnaInfo();
dimAssociationAnaInfo.setProvinceId(proviceTdSelectedL);
dimAssociationAnaInfo.setAssociationType(dimensionTdSelected);
dimAssociationAnaInfo.setAssoicationDesc(descTdV);
dimAssociationAnaInfo.setAssociationId(associationIdL);
// 指标表对象
List<DimKpiAssociationRelInfo> dimKpiAssociationRelInfoList = new ArrayList<DimKpiAssociationRelInfo>();
String[] strIdAndWeightDimKpiChecked=arrIdAndWeightDimKpiChecked.split(",");
List<Map<String,String>> idAndWeight=new ArrayList<Map<String,String>>();
for (String s : strIdAndWeightDimKpiChecked) {
Map<String,String> map=new HashMap<String,String>();
map.put("kpiId",s.split("_")[0]);
map.put("weight",s.split("_")[1]);
idAndWeight.add(map);
}
for (Map<String, String> stringLongMap : idAndWeight) {
DimKpiAssociationRelInfo relInfo = new DimKpiAssociationRelInfo();
relInfo.setKpiAssociationRelatedId(-1L);
relInfo.setKpiId(Long.parseLong(stringLongMap.get("kpiId")));
relInfo.setKpiWeight(new BigDecimal(stringLongMap.get("weight")));
relInfo.setDimAssociationAnaInfo(dimAssociationAnaInfo);
dimKpiAssociationRelInfoList.add(relInfo);
}
*//*for (Long aLong : dimKpiSelSelectedList) {
DimKpiAssociationRelInfo relInfo = new DimKpiAssociationRelInfo();
relInfo.setKpiAssociationRelatedId(-1L);
relInfo.setKpiId(aLong);
relInfo.setKpiWeight(BigDecimal.valueOf(kpiWeightTdVL));
relInfo.setDimAssociationAnaInfo(dimAssociationAnaInfo);
dimKpiAssociationRelInfoList.add(relInfo);
}*//*
// dimAssociationAnaInfo.setItems(dimKpiAssociationRelInfoList);
associateDiagosisConfigurationService.updateAssociDigConfig(associationIdL,dimKpiAssociationRelInfoList);
strR = "更新成功";
} catch (Exception e) {
e.printStackTrace();
}
}
return strR;
}*/
@RequestMapping(value = "/updateAssociDigConfig", method = RequestMethod.GET)
@ResponseBody
public String updateAssociDigConfig(
@RequestParam(value = "associationId", defaultValue = "") String associationId,
@RequestParam(value = "proviceTdSelected", defaultValue = "") String proviceTdSelected,
@RequestParam(value = "dimensionTdSelected", defaultValue = "") String dimensionTdSelected,
@RequestParam(value = "descTdV", defaultValue = "") String descTdV,
@RequestParam(value = "kpiId_weight", defaultValue = "") String kpiId_weight
) {
String strR = "更新失败";
if ("".equalsIgnoreCase(proviceTdSelected) || ("".equalsIgnoreCase(dimensionTdSelected))
|| ("".equalsIgnoreCase(kpiId_weight)) || ("".equalsIgnoreCase(descTdV)) || ("".equalsIgnoreCase(associationId))) {
return strR;
} else {
try {
/*String[] dimKpiSelSelectedArr = dimKpiSelSelectedarr.split(",");
List<Long> dimKpiSelSelectedList = new ArrayList<Long>();//指标名称 ID
for (String s : dimKpiSelSelectedArr) {
dimKpiSelSelectedList.add(Long.parseLong(s));
}*/
Long associationIdL=Long.parseLong(associationId);//associationId
Long proviceTdSelectedL = Long.valueOf(proviceTdSelected);//省份ID
// Double kpiWeightTdVL = Double.parseDouble(kpiWeightTdV);//权重
//配置表对象
DimAssociationAnaInfo dimAssociationAnaInfo = new DimAssociationAnaInfo();
dimAssociationAnaInfo.setProvinceId(proviceTdSelectedL);
dimAssociationAnaInfo.setAssociationType(dimensionTdSelected);
dimAssociationAnaInfo.setAssoicationDesc(descTdV);
dimAssociationAnaInfo.setAssociationId(associationIdL);
// 指标表对象
List<DimKpiAssociationRelInfo> dimKpiAssociationRelInfoList = new ArrayList<DimKpiAssociationRelInfo>();
String[] strIdAndWeightDimKpiChecked=kpiId_weight.split(",");
List<Map<String,String>> idAndWeight=new ArrayList<Map<String,String>>();
for (String s : strIdAndWeightDimKpiChecked) {
Map<String,String> map=new HashMap<String,String>();
map.put("kpiId",s.split("_")[0]);
map.put("weight",s.split("_")[1]);
idAndWeight.add(map);
}
for (Map<String, String> stringLongMap : idAndWeight) {
DimKpiAssociationRelInfo relInfo = new DimKpiAssociationRelInfo();
relInfo.setKpiAssociationRelatedId(-1L);
relInfo.setKpiId(Long.parseLong(stringLongMap.get("kpiId")));
relInfo.setKpiWeight(new BigDecimal(stringLongMap.get("weight")));
relInfo.setDimAssociationAnaInfo(dimAssociationAnaInfo);
dimKpiAssociationRelInfoList.add(relInfo);
}
/*for (Long aLong : dimKpiSelSelectedList) {
DimKpiAssociationRelInfo relInfo = new DimKpiAssociationRelInfo();
relInfo.setKpiAssociationRelatedId(-1L);
relInfo.setKpiId(aLong);
relInfo.setKpiWeight(BigDecimal.valueOf(kpiWeightTdVL));
relInfo.setDimAssociationAnaInfo(dimAssociationAnaInfo);
dimKpiAssociationRelInfoList.add(relInfo);
}*/
// dimAssociationAnaInfo.setItems(dimKpiAssociationRelInfoList);
associateDiagosisConfigurationService.updateAssociDigConfig(associationIdL,dimKpiAssociationRelInfoList);
strR = "更新成功";
} catch (Exception e) {
e.printStackTrace();
}
}
return strR;
}
@RequestMapping(value = "/createAssociDigConfig", method = RequestMethod.GET)
@ResponseBody
/*public String createAssociDigConfig(
*//*@RequestParam(value = "proviceTdSelected", defaultValue = "") String proviceTdSelected,*//*
@RequestParam(value = "proviceSelected", defaultValue = "") String proviceSelectedarr,
@RequestParam(value = "dimensionTdSelected", defaultValue = "") String dimensionTdSelected,
@RequestParam(value = "dimKpiSelSelected", defaultValue = "") String dimKpiSelSelectedarr,
@RequestParam(value = "descTdV", defaultValue = "") String descTdV,
@RequestParam(value = "kpiWeightTdV", defaultValue = "") String kpiWeightTdV) {*/
public String createAssociDigConfig(
@RequestParam(value = "proviceSelected", defaultValue = "") String proviceSelectedarr,
@RequestParam(value = "dimensionTdSelected", defaultValue = "") String dimensionTdSelected,
@RequestParam(value = "anainfoShallSaveArr", defaultValue = "") String anainfoShallSaveArr,
@RequestParam(value = "descTdV", defaultValue = "") String descTdV) {
//proviceTdSelected 省份ID
//dimensionTdSelected 维度
//anainfoShallSaveArr 指标名称_权重
//descTdV 描述
String strR = "创建失败";
if (/*"".equalsIgnoreCase(proviceTdSelected) */"".equalsIgnoreCase(proviceSelectedarr)|| ("".equalsIgnoreCase(dimensionTdSelected))
|| ("".equalsIgnoreCase(anainfoShallSaveArr)) || ("".equalsIgnoreCase(descTdV)) ) {
return strR;
} else {
try {
String[] anainfoShallSavearr = anainfoShallSaveArr.split(",");//指标 参数 数组
List<Map<String,String>> kpiIdAndKpiWeight=new ArrayList<Map<String,String>>();
for(String str : anainfoShallSavearr){
Map<String,String> map=new HashMap<String, String>();
String[]id_weight=str.split("_");
/*map.put("id",Double.valueOf(id_weight[0]).longValue());
map.put("weight",Double.valueOf(id_weight[1]).longValue());*/
map.put("id",id_weight[0]);
map.put("weight",id_weight[1]);
kpiIdAndKpiWeight.add(map);
}
long ll=1l;
// 指标表对象 指标对象 多对一 配置对象
List<DimKpiAssociationRelInfo> dimKpiAssociationRelInfoList = new ArrayList<DimKpiAssociationRelInfo>();
for (Map<String, String> stringLongMap : kpiIdAndKpiWeight) {
DimKpiAssociationRelInfo relInfo = new DimKpiAssociationRelInfo();
relInfo.setKpiId(Long.parseLong(stringLongMap.get("id")));
relInfo.setKpiWeight(new BigDecimal(stringLongMap.get("weight")));
dimKpiAssociationRelInfoList.add(relInfo);
}
List<Long> proviceSelectedList=new ArrayList<Long>();//省份 参数 列表
String[]proviceSelectedArr=proviceSelectedarr.split(",");
for (String s : proviceSelectedArr) {
proviceSelectedList.add(Long.parseLong(s));
}
//配置表对象
List<DimAssociationAnaInfo> anaInfoList=new ArrayList<DimAssociationAnaInfo>();
for (Long aLong : proviceSelectedList) {
DimAssociationAnaInfo dimAssociationAnaInfo = new DimAssociationAnaInfo();
dimAssociationAnaInfo.setProvinceId(aLong);
dimAssociationAnaInfo.setAssociationType(dimensionTdSelected);
dimAssociationAnaInfo.setAssoicationDesc(descTdV);
anaInfoList.add(dimAssociationAnaInfo);
}
associateDiagosisConfigurationService.pathSave( anaInfoList, dimKpiAssociationRelInfoList);
strR = "创建成功";
} catch (Exception e) {
e.printStackTrace();
}
}
return strR;
}
@RequestMapping(value = "/deleteAssociDigConfig",method = RequestMethod.GET)
@ResponseBody
public String deleteAssociDigConfig( @RequestParam(value = "associationId", defaultValue = "") String associationId){
String strR="删除失败";
try {
Long associationIdL=Long.parseLong(associationId);//associationId
associateDiagosisConfigurationService.deleteAssociDigConfig(associationIdL);
strR="删除成功";
}catch (Exception e){
e.printStackTrace();
}
return strR;
}
}
......@@ -13,8 +13,8 @@
<div class="slide-select">
<label for="">关联维度:</label>
<select name="xcdStatus" id="xcdStatusSelect" class="slide-menu-select" onChange="judge=false;">
<option value="yewu">业务</option>
<option value="qudao" selected>渠道</option>
<option value="y">业务</option>
<option value="c" selected>渠道</option>
<%--<c:forEach var="workingOrderStatus" items="${workingOrderStatusList}">
<option value="${workingOrderStatus}" id="xcdStatus">
${workingOrderStatus}
......@@ -268,8 +268,11 @@
// reset province
function detail_Province_Reset() {
$("#allProvinceDetail").removeAttr("checked");
$("#provinceDetail").removeAttr("checked");
$("#allProvinceDetail").attr("checked","checked");
$(".provinceDetail").attr("checked","checked");
detailProvinceCheckedValues=$(".provinceDetail");
}
// reset dimension
function detail_Dimension_Reset(){
......
......@@ -27,13 +27,15 @@
<script type="text/javascript">
$(document).ready(function() {
var jso = document.getElementById('gzfxDetail').value;
// alert(jso);
// failureTable();
// initDateDetail();//初始化 时间范围
initTable();//初始化 主面板
// $("#businessSelectAreaDetail").hide();
});
</script>
<style>
th,td {text-align:center; /*设置水平居中*/vertical-align:middle;/*设置垂直居中*/}
</style>
</head>
<body>
......@@ -85,7 +87,7 @@
<span class="glyphicon glyphicon-list"></span>
</button>
<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"
data-placement="bottom"></span>
<span id="detailDemensionTag" class="label label-info"
......@@ -94,12 +96,12 @@
data-placement="bottom"></span>
</div>
<div class="bt-list-import">
<%--<div class="bt-list-import">
<a href="#" id="downloadEecel" class="">
<span class="glyphicon glyphicon-import"></span>
<span class="glyphicon-class">导出Excel</span>
</a>
</div>
</div>--%>
</div>
<div class="row">
......@@ -111,11 +113,11 @@
style="top: -6px;float: right;height: 0px;position: relative;">
<button id="createIndicatorsBtn"
class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog"
onclick="createIndicators()">新建指标
onclick="createIndicators()">新建关联配置
</button>
<button id="updateIndicatorsBtn"
class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog"
onclick="updateIndicators()">修改指标
class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" disabled
>修改关联配置
</button>
</div>
</shiro:hasAnyRoles>
......@@ -138,12 +140,15 @@
</div>
<form action="#" method="get" id="listForm"></form>
<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="indicatorsAll" name="indicatorsAll" value='${indicatorsAll}' />
<input type="hidden" id="anaInfoSelected" name="anaInfoSelected" value='' />
</div>
</div>
</div>
</div>
<script type="text/javascript">
function detailSubmit(){
var detailProvinceSum = getDetailProvinceCheckedValues().length;
......@@ -151,12 +156,9 @@
$.alert("省份的选择不能为空");
}else {
var detailProvince = getDetailProvinceCheckedValueString();
alert(detailProvince);
var dimension = getDetailCheckeddDimension();
dimension="yc";
alert(dimension);
// var detailTime = getDetailPeriodStr();
$.ajax({
type : 'GET',
contentType : 'application/json',
......@@ -166,21 +168,20 @@
beforeSend: function(data) {
},
success: function(data) {
alert("-0-"+data+"=");
$("#gzfxDetail").val(data);
// failureTable();
// checkFailureIds=[];
// $("#deleteFailureBtn").attr("disabled", true);
//toggleMenu('slidePushMenus2');//隐藏筛选项
toggleMenu('slidePushMenus2');//隐藏筛选项
initTable();
}
});
}
toggleMenu('slidePushMenus2');//隐藏筛选项
$("#updateIndicatorsBtn").attr("disabled","true");
updateTags(true);//更新 tags显示
initTable();
}
function updateTags(flag){
......@@ -206,7 +207,6 @@
function getDetailProvinceTag(){
var str="";
$(".provinceDetail:input:checkbox:checked").each(function(){
//alert($(this).text());
str+=$(this).attr("title")+" ";
});
return str;
......@@ -221,14 +221,13 @@
//重置detail中的筛选项
function detailReset(){
initDateDetail();
//initDateDetail();
detail_Dimension_Reset();
detail_Province_Reset();
updateTags(false);
// judge = true;
}
$("#downloadEecel").click(function(){
alert("downloadExcel");
var listForm=$("#listForm");
listForm.attr("method","post");
listForm.attr("action","${ctx}/ModelManage/ModelResult/uploadModel");
......@@ -240,7 +239,7 @@
$.dialog({
title: "提醒",
content:"确定新建指标?",
ok: function(){location.href="${ctx}/MonitorOperation/AssociateDiagosisDetail/createDiagosis";},
ok: function(){location.href="${ctx}/MonitorOperation/AssociateDiagosisConfiguration/createDiagosis";},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
......@@ -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>
</body>
</html>
......@@ -35,7 +35,7 @@
/* .file-box{ position:relative;width:340px}
.txt{ height:22px; border:1px solid #cdcdcd; width:180px;}
.btn{ background-color:#FFF; border:1px solid #CDCDCD;height:24px; width:70px;}
.file{ position:absolute; top:0; right:80px; height:24px; filter:alpha(opacity:0);opacity: 0;width:260px } */
.file{ position:absolute; top:0; right:80px; height:24px; filter:alpha(opacity:0);opacity: 0;width:260px }
</style>
</head>
......@@ -48,6 +48,7 @@
<li class="active">告警关联诊断</li>
</ol>
</div>
<div id="main-container main-tab-container">
<div id="content" class="container">
<div class="section">
......@@ -59,62 +60,127 @@
<div class="table-header">新建指标</div>
<form action="#" class="form-horizontal" id="modelMaintainForm" method="post" enctype="multipart/form-data">
<table id="modelMaintainTable" class="table-null">
<tr><td>指标名称(<font color="red">必填</font>):</td><td><input type="text" class="form-control" name="dataModelName" id="dataModelName" style="display: inline;" /><span id="writeWarningInf" style="color:red;display: inline;padding-left:10px;"></span></td></tr>
<tr><td>指标权重:</td><td><input type="text" class="form-control" name="modelDesc" id="modelDesc" style="display:inline;" /></td></tr>
<tr><td>关联描述:</td><td><input type="text" class="form-control" name="ruleDefinition" id="ruleDefinition"/></td></tr>
<tr><td>省份:</td><td><input type="text" class="form-control" name="evaluationMethod" id="evaluationMethod" style="display: inline;" /></td></tr>
<tr><td>评判标准:</td><td><input type="text" class="form-control" name="evaluationStandard" id="evaluationStandard" style="display: inline;" /></td></tr>
<tr><td>模型执行脚本(<font color="red">必填</font>):</td><td>
<div class="file-box">
<input type='text' id='modelExeScriptName' class="form-control" style="display: inline;"/>
<input type='button' class="btn btn-default" value='浏 览' style="width:70px"/>
<input type="file" name="uploadFile" class="file" id="fileField" onchange="document.getElementById('modelExeScriptName').value=this.value" />
<tr>
<td>省份:</td>
<td>
<%--<select class="form-control" name="proviceTd" id="proviceTd" >
<c:forEach var="provice" items="${proviceList}">
<option value="${provice.provinceId}">${provice.provinceName}</option>
</c:forEach>
</select>--%>
<c:forEach var="provice" items="${proviceList}">
<div class="checkbox-inline">
<label>
<input type="checkbox" name="provinceDetail" class="provinceDetail" title="${provice.provinceName}" value="${provice.provinceId}" />${provice.provinceName}
</label>
</div>
</td></tr>
<tr><td>关联维度:</td>
<td><select class="form-control" name="modelType" id="modelType" >
<c:forEach var="modelType" items="${dataModelTypeList}">
<option value="${modelType.dataModelTypeId}">${modelType.dataModelTypeName}</option>
</c:forEach>
</select></td></tr>
<tr><td>部署服务器:</td>
<td><select class="form-control" name="deployedServer" id="deployedServer">
<c:forEach var="deployedServers" items="${deployedServerList}">
<option value="${deployedServers.serverId}">${deployedServers.serverName}</option>
</td>
</tr>
<tr>
<td>维度:</td>
<td><select class="form-control" name="dimensionTd" id="dimensionTd" >
<c:forEach var="modelType" items="${dimensionList}">
<c:choose>
<c:when test="${modelType == 'c' }">
<option value="${modelType}">渠道</option>
</c:when>
<c:when test="${modelType == 'y'}">
<option value="${modelType}">业务</option>
</c:when>
<c:otherwise>
<option value="ex">异常</option>
</c:otherwise>
</c:choose>
</c:forEach>
</select></td></tr>
<tr><td>模型状态:</td>
<td><select class="form-control" name="modelStatus" id="modelStatus">
<option value="1">正常</option>
<option value="0">失效</option>
</select></td></tr>
<tr><td>数据类型(<font color="red">必填</font>):</td>
<td><select class="form-control" name="kpiTypeId" id="kpiTypeId">
<option value="1">时长类</option>
<option value="2">业务量类</option>
<option value="3">百分比类</option>
</select></td></tr>
<!-- <tr><td>模型运行频度分钟数(<font color="red">只能是数字</font>):</td><td><input name="cycleMinutes" type="text" class="form-control" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9]+/,'');}).call(this)" onblur="this.v();"/></td></tr> -->
<tr><td>业务结束时间(<font color="red">必填</font>):</td><td><input type="text" class="form-control" id="businessEndTime" name="businessEndTime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'businessStartTime\')}'})" /></td></tr>
<tr><td>业务开始时间(<font color="red">必填</font>):</td><td><input id="businessStartTime" name="businessStartTime" class="form-control" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'businessEndTime\')}'})"> </td></tr>
<tr><td>已添加参数:</td>
</select></td>
</tr>
<tr>
<td>描述(<font color="red">必填</font>):</td>
<td><input type="text" class="form-control" name="descTd" id="descTd" style="display: inline;" />
<span id="writeWarningInf" style="color:red;display: inline;padding-left:10px;"></span></td>
</tr>
<tr>
<td>已添加指标:</td>
<td><table class="table table-hover table-striped" id="displayParam">
<thead>
<tr><th>参数名</th><th>参数值</th><th>参数类型</th><th><a href="javascript:deleteAllTr()">删除所有参数</a></th></tr>
<tr><th>指标名称</th><th>权重值</th><th><a href="javascript:deleteAllTr()">删除所有</a></th></tr>
</thead>
<tbody id="addTr"></tbody>
</table></td></tr>
<tr><td>参数数据类型:</td>
<td><select class="form-control" id="paramDataType" name="paramDataType">
<c:forEach var="dataTypes" items="${dataTypeList}">
<option value="${dataTypes.dataTypeName}">${dataTypes.dataTypeName}</option>
<tr>
<tr>
<td>数据源:</td>
<td>
<%--<select class="form-control" name="dataSourceList" id="dataSourceListTd" >--%>
<c:forEach items="${dataSourceList}" var="dataSource">
<div class="checkbox-inline">
<label>
<input type="checkbox" onclick="dataSourceRadioClick()" name="dataSourceRadio" class="provinceDetail" title="${dataSource.dataSourceName}" value="${dataSource.dataSourceId}" />${dataSource.dataSourceName}
</label>
</div>
</c:forEach>
</select></td></tr>
<tr><td>参数名:</td><td><input type="text" class="form-control" name="paramName" id="paramName"/></td></tr>
<tr><td>参数值:</td><td id="addParamVal"></td></tr>
</td>
</tr>
<tr>
<td>渠道:</td>
<td>
<%--<div class="checkbox-inline"><label><input type="checkbox" name="channelList" id="channelList" title="allSelect" checked />全选</label></div>--%>
<div id="">
<c:forEach items="${channelList}" var="channel">
<div class="checkbox-inline">
<label>
<input type="checkbox" onclick="channelRadioClick()" name="channelRadio" class="provinceDetail" title="${channel.channelId}" value="${channel.channelId}" />${channel.channelName}
</label>
</div>
</c:forEach>
</div>
</td>
</tr>
<tr>
<td>业务:</td>
<td id="businessActivedListTd">
</td>
</tr>
<tr>
<td>指标:</td>
<td id="dimKpiListTd">
</td>
</tr>
<tr><td></td>
<td><button type="button" id="addParam" class="btn btn-primary">添加参数</button></td></tr>
<tr><td></td><td><button type="button" id="modelSubmit" class="btn btn-primary">确定</button>
<%--<td><button type="button" id="selectAnaInfo" class="btn btn-primary btn-small">查找指标</button>--%>
<%--<button type="button" id="selectBusiness" class="btn btn-info- btn-small">查找业务</button></td>--%>
<%--<td><button type="button" id="addAnaInfo" class="btn btn-primary">添加指标</button></td>--%>
</tr>
<tr>
<td>权重(<font color="red">必填</font>):</td>
<td><input type="number" class="form-control" name="descTd" id="kpiWeightTd" style="display: inline;" />
<span id="writeWarningInfTd" style="color:red;display: inline;padding-left:10px;"></span></td>
</tr>
<tr><td></td><td>
<button type="button" id="UPDATEAnaInfo" class="btn btn-primary">修改指标</button>
</td></tr>
<tr><td></td><td>
<button type="button" id="addAnaInfo" class="btn btn-info">添加勾选指标</button>
<button type="button" id="modelSubmit" class="btn btn-primary">确定</button>
<button type="reset" class="btn btn-default" id="modelReset">清空</button>
<button type="reset" class="btn btn-warning" id="modelBack">返回</button>
</td></tr>
......@@ -126,10 +192,12 @@
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#UPDATEAnaInfo").hide();
if($("#paramDataType").val()=="字符"){
var addDataValue = $("<input type='text' class='form-control name=paramValue' id='paramValue'/>");
$("#addParamVal").append(addDataValue);
......@@ -194,6 +262,7 @@
//删除所有参数
function deleteAllTr(){
$("#addTr").empty();
dimKpiSelected.splice(0,dimKpiSelected.length);
}
//修改一条参数
......@@ -219,7 +288,7 @@
$.alert("参数名不能为空");
}else{
if($("#addTr").find("tr.orange-tr").html()==null){
var addRow = $("<tr><td>"+paramName+"</td><td>"+paramValue+"</td><td>"+paramDataType+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>");
var addRow = $("<tr><td>"+paramName+"</td><td id='paramValue_'+paramValue>"+paramValue+"</td><td>"+paramDataType+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>");
$("#addTr").append(addRow);
$("#paramName").attr("value","");
$("#paramValue").attr("value","");
......@@ -234,113 +303,404 @@
}
});
//修改一条参数
function updateRow(e){
var pro=prompt("请输入",$(e).parent().prev()[0].innerHTML);
pro=$.trim(pro);
if($.isNumeric(pro)){
pro=parseFloat(pro);
if(pro >0){
$(e).parent().prev()[0].innerHTML=parseFloat(pro);
}
}
}
//删除一条参数
function deleteRow(elementTag){
$(elementTag).parent().parent().remove();
function deleteRow(e){
var id=Number(e.title);
dimKpiSelected.splice($.inArray(id,dimKpiSelected),1);
$(e).parent().parent().remove();
}
//form表单重置
$("#modelReset").click(function(){
$("#businessActivedListTd").empty();
$("#dimKpiListTd").empty();
deleteAllTr();
});
//返回 选中的省份
function getDetailProvinceCheckedValues(){
var provinceArray=new Array();
$("input[name='provinceDetail']").each(function(){
if($(this).attr("checked")){
provinceArray.push($(this).val());
}
});
return provinceArray;
}
//form表单提交
$("#modelSubmit").click(function(){
if($.trim($("#dataModelName").val())==""){
$.alert("数据模型名称不能为空");
}else if($("#modelExeScriptName").val()==""){
$.alert("模型执行脚本不能为空");
}else if($("#businessStartTime").val()==""){
$.alert("业务开始时间不能为空");
}else if($("#businessEndTime").val()==""){
$.alert("业务结束时间不能为空");
}else{
if($.trim($("#paramName").val())!=""){
$.dialog({
title: "提醒",
content: "有参数尚未添加,确定提交",
ok: function(){
$("#modelSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size();
var anainfoShallSaveArr= getAnainfoShallSave();
var arrDimKpiChecked=getArrDimKpiChecked();
var provinceDetailChecked=getDetailProvinceCheckedValues();
if(provinceDetailChecked.length < 1){
$.alert("省份需选");
}else if($.trim($("#descTd").val())==""){
$.alert("描述不能为空");
}
/*else if ($.trim($("#kpiWeightTd").val())==""){
$.alert("权重不能为空");
}*//*else if (arrDimKpiChecked.length < 1){
$.alert("指标需选");
}*/else if(anainfoShallSaveArr.length < 1){
$.alert("指标需选");
}
else{
var proviceTdSelected=$("#proviceTd option:selected").val();
var dimensionTdSelected=$("#dimensionTd option:selected").val();
var descTdV=$("#descTd").val();
var kpiWeightTdV=$("#kpiWeightTd").val();
if(i==0){
var createForm=$("#modelMaintainForm");
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm");
createForm.submit();
createForm.attr("action","#");
}else{
$("#addTr").find("tr").each(function(){
//alert($(this).find("td").eq(0).html());
var paramName = $(this).find("td").eq(0).html();
var paramValue = $(this).find("td").eq(1).html();
var paramType = $(this).find("td").eq(2).html();
$.ajax({
type : "GET",
contentType : "application/json",
url: "${ctx}/ModelManage/ModelMaintain/createModelParam?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
dataType : "text",
async: false,
beforeSend: function(data) {},
success: function(){
i--;
if(i==0){
var createForm=$("#modelMaintainForm");
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm");
createForm.submit();
createForm.attr("action","#");
type : 'GET',
async : true,
contentType : 'application/json',
data : {/*proviceTdSelected : proviceTdSelected,*/dimensionTdSelected:dimensionTdSelected,descTdV:descTdV/*,kpiWeightTdV:kpiWeightTdV*/},
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/createAssociDigConfig?anainfoShallSaveArr="+anainfoShallSaveArr+"&proviceSelected="+provinceDetailChecked,
dataType : 'text',
success: function(data){
$.alert(data);
setTimeout(function () {
location.href="${ctx}/MonitorOperation/AssociateDiagosisConfiguration";
},2000);
}
});
}
});
$("#modelBack").click(function(){
location.href="${ctx}/MonitorOperation/AssociateDiagosisConfiguration";
});
// 查找 指标
$("#selectAnaInfo").click(function () {
$("#dimKpiListTd").empty();
//获取选择的 业务
var businessSelectedArr=[];
$("input[name='BusinessCheck']").each(function(e){
if($(this).attr("checked")){
businessSelectedArr.push($(this).context.id.split("_")[1]);
}
},
okValue: "确定",
cancel: function(){},
cancelValue: "取消",
});
}else{
$("#modelSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size();
if(i==0){
var createForm=$("#modelMaintainForm");
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm");
createForm.submit();
createForm.attr("action","#");
}else{
$("#addTr").find("tr").each(function(){
//alert($(this).find("td").eq(0).html());
var paramName = $(this).find("td").eq(0).html();
var paramValue = $(this).find("td").eq(1).html();
var paramType = $(this).find("td").eq(2).html();
$.ajax({
type : "GET",
contentType : "application/json",
url: "${ctx}/ModelManage/ModelMaintain/createModelParam?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType),
dataType : "text",
async: false,
beforeSend: function(data) {},
success: function(){
i--;
if(i==0){
var createForm=$("#modelMaintainForm");
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm");
createForm.submit();
createForm.attr("action","#");
type : 'GET',
async : true,
contentType : 'application/json',
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/getDimKpiListByBusinessIdList?businessIdList="+businessSelectedArr,
dataType : 'text',
success: function(data){
var jsonDa=eval('('+data+')');
for(var i=0;i<jsonDa.length;i++){
var strInput="<input type='checkbox' id=dimKpiCheck_"+jsonDa[i].kpiId+" name='dimKpiCheck' class='provinceDetail' title='"+jsonDa[i].name+" value='"+jsonDa[i].kpiId+"'>"+jsonDa[i].name+"</input>";
$("#dimKpiListTd").append(strInput);
}
}
});
});
//渠道 复选框 点击 事件
function channelRadioClick(){
$("#businessActivedListTd").empty();
var channelId=$("input[name='channelRadio']:checked").val();
var dataSourceId=$("input[name='dataSourceRadio']:checked").val();
var channelArray=new Array();// 存放 所选 频道
var i=0;
$("input[name='channelRadio']:checked").each(function(){
channelArray[i]=$(this).val();
i++;
});
var dataSourceArray=new Array();// 存放 所选数据源
var j=0;
$("input[name='dataSourceRadio']:checked").each(function(){
dataSourceArray[j]=$(this).val();
j++;
});
if(channelArray.length< 0|| dataSourceArray.length < 0){
return;
}
$.ajax({
type : 'GET',
async : true,
contentType : 'application/json',
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/getBusinessByChannelIdListAndDataSourceIdList?dataSourceId="+dataSourceArray+"&channelId="+channelArray,
dataType : 'text',
success: function(data){
var jsonDa=eval('('+data+')');
// var jsonDa=data;
var strcheckBox="";
for(var i=0;i<jsonDa.length;i++){
var strInput="<input type='checkbox' onClick='BusinessCheckClick()' id=BusinessCheck_"+jsonDa[i].businessId+" name='BusinessCheck' class='provinceDetail' title='"+jsonDa[i].businessName+" value='"+jsonDa[i].businessId+"'/>"+jsonDa[i].businessName;
strcheckBox+=strInput;
}
$("#businessActivedListTd").append(strcheckBox);
}
});
$("#modelBack").click(function(){
location.href="${ctx}/MonitorOperation/AssociateDiagosisConfiguration";
}
//数据源 复选框 点击 事件
function dataSourceRadioClick(){
$("#businessActivedListTd").empty();
var channelId=$("input[name='channelRadio']:checked").val();
var dataSourceId=$("input[name='dataSourceRadio']:checked").val();
var channelArray=new Array();// 存放 所选 频道
var i=0;
$("input[name='channelRadio']:checked").each(function(){
channelArray[i]=$(this).val();
i++;
});
var dataSourceArray=new Array();// 存放 所选数据源
var j=0;
$("input[name='dataSourceRadio']:checked").each(function(){
dataSourceArray[j]=$(this).val();
j++;
});
if(channelArray.length< 0|| dataSourceArray.length < 0){
return;
}
$.ajax({
type : 'GET',
async : true,
contentType : 'application/json',
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/getBusinessByChannelIdListAndDataSourceIdList?dataSourceId="+dataSourceArray+"&channelId="+channelArray,
dataType : 'text',
success: function(data){
var jsonDa=eval('('+data+')');
var strcheckBox="";
for(var i=0;i<jsonDa.length;i++){
var strInput="<input type='checkbox' onClick='BusinessCheckClick()' id=BusinessCheck_"+jsonDa[i].businessId+" name='BusinessCheck' class='provinceDetail' title='"+jsonDa[i].businessName+" value='"+jsonDa[i].businessId+"'/>"+jsonDa[i].businessName;
strcheckBox+=strInput;
}
$("#businessActivedListTd").append(strcheckBox);
}
});
}
// 业务 复选框 点击事件
function BusinessCheckClick() {
//$("#dimKpiListTd").empty();
// 重置 指标 一栏 筛选保留原有的 和已选择的 指标
$("input[name='dimKpiCheck']").each(function(e){
if(!$(this).attr("checked")){
$(this).next().remove();
$(this).remove();
}
});
//获取选择的 业务
var businessSelectedArr=[];
$("input[name='BusinessCheck']").each(function(e){
if($(this).attr("checked")){
businessSelectedArr.push($(this).context.id.split("_")[1]);
}
});
$.ajax({
type : 'GET',
async : true,
contentType : 'application/json',
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/getDimKpiListByBusinessIdList?businessIdList="+businessSelectedArr,
dataType : 'text',
success: function(data){
var jsonDa=eval('('+data+')');
for(var i=0;i<jsonDa.length;i++){
if($.inArray(jsonDa[i].kpiId,dimKpiSelected) < 0){
var strInput="<input type='checkbox' id=dimKpiCheck_"+jsonDa[i].kpiId+" name='dimKpiCheck' class='provinceDetail' title='"+jsonDa[i].name+"' value='"+jsonDa[i].kpiId+"'/><font>"+jsonDa[i].name+"</font>";
$("#dimKpiListTd").append(strInput);
}
}
}
});
}
// 查找 业务
$("#selectBusiness").click(function(){
$("#businessActivedListTd").empty();
var channelId=$("input[name='channelRadio']:checked").val();
var dataSourceId=$("input[name='dataSourceRadio']:checked").val();
var channelArray=new Array();// 存放 所选 频道
var i=0;
$("input[name='channelRadio']:checked").each(function(){
channelArray[i]=$(this).val();
i++;
});
var dataSourceArray=new Array();// 存放 所选数据源
var j=0;
$("input[name='dataSourceRadio']:checked").each(function(){
dataSourceArray[j]=$(this).val();
j++;
});
$.ajax({
type : 'GET',
async : true,
contentType : 'application/json',
url: "${ctx}/MonitorOperation/AssociateDiagosisConfiguration/getBusinessByChannelIdListAndDataSourceIdList?dataSourceId="+dataSourceArray+"&channelId="+channelArray,
dataType : 'text',
success: function(data){
var jsonDa=eval('('+data+')');
var strcheckBox="";
for(var i=0;i<jsonDa.length;i++){
var strInput="<input type='checkbox' id=BusinessCheck_"+jsonDa[i].businessId+" name='BusinessCheck' class='provinceDetail' title='"+jsonDa[i].businessName+" value='"+jsonDa[i].businessId+"'/>"+jsonDa[i].businessName;
strcheckBox+=strInput;
}
$("#businessActivedListTd").append(strcheckBox);
}
});
});
// 添加 '勾选指标指标'按钮 点击事件
$("#addAnaInfo").click(function(){
var arrDimKpiChecked=getArrDimKpiChecked();
if(arrDimKpiChecked.length <1){
$.alert("需选指标");
return;
}
var kpiWeightTdVal=$.trim($("#kpiWeightTd").val());
if (kpiWeightTdVal == "" || kpiWeightTdVal ==0){
$.alert("权重不能为空");
return;
}
if (kpiWeightTdVal < 0){
$.alert("权重不能为负");
return;
}
// 勾选指标 的 名称 和 value
var arrDimKpiidAndNameChecked=getArrDimKpiidAndNameChecked();
//向 已添加指标 添加
for(var i=0;i<arrDimKpiidAndNameChecked.length;i++){
var id_name=arrDimKpiidAndNameChecked[i];
var addRow = $("<tr class='"+id_name.split("_")[0]+"_"+kpiWeightTdVal+"'><td>"+id_name.split("_")[1]+"</td><td>"+kpiWeightTdVal+"</td><td><a href='javascript:;' title='"+id_name.split("_")[0]+"' onclick='deleteRow(this)'>删除</a>&nbsp;&nbsp;<a href='javascript:;' onclick='updateRow(this)'>修改</a></td></tr>");
$("#addTr").append(addRow);
dimKpiSelected.push(Number(id_name.split("_")[0]));
}
// 指标项中 去除 已添加指标 已有的指标
$("input[name='dimKpiCheck']").each(function(e){
var id=Number($(this).context.id.split("_")[1]);
if($.inArray(id,dimKpiSelected) >= 0){
$(this).next().remove();
$(this).remove();
}
});
$("#kpiWeightTd").val('');
});
dimKpiSelected=new Array();
function getAnainfoShallSave(){
var anainfoShallSaveArr=new Array();
$("#addTr").find("tr").each(function(){
var claz=$(this).attr("class");
anainfoShallSaveArr.push(claz);
});
return anainfoShallSaveArr;
}
// 获取勾选指标的 数据 格式 id_名称
function getArrDimKpiidAndNameChecked(){
var arrDimKpiChecked=[];
$("input[name='dimKpiCheck']").each(function(e){
if($(this).attr("checked")){
var id_name=$(this).context.id.split("_")[1]+"_"+$(this).context.title;
arrDimKpiChecked.push(id_name);
}
});
return arrDimKpiChecked;
}
function getArrDimKpiChecked(){
var arrDimKpiChecked=[];
$("input[name='dimKpiCheck']").each(function(e){
if($(this).attr("checked")){
arrDimKpiChecked.push($(this).context.id.split("_")[1]);
}
});
return arrDimKpiChecked;
}
</script>
</body>
......
function initTable(){
jsonStr = document.getElementById('gzfxDetail').value;
// alert(jsonStr);
var header = new Array();
//provinceToArr();
header[0] = ["","<input type='radio' name='update'id='update' onclick='javascript:radioChoose(this);'/>","1%",""];
header[1] = ["指标名称","kpiId","10%",""];
header[2] = ["关联维度","AssociationType","10%","16"];
header[3] = ["指标权重","kpiWeight","5%",""];
header[4] = ["省份","provinceId","8%",""];
header[5] = ["关联描述","AssoicationDesc","8%",""];
window.pagging = new table_pagging({limit:11,tableId:'failureAnalysisDetailTable',header:header});
header[0] = ["","associationId","1%",""];
header[1] = ["省份","provinceId","10%",""];
header[2] = ["维度","AssociationType","10%","16"];
header[3] = ["描述","AssoicationDesc","5%",""];
header[4] = ["指标列表","items","8%",""];
/*header[5] = ["关联描述","AssoicationDesc","8%",""];*/
window.pagging = new table_pagging({limit:10,tableId:'failureAnalysisDetailTable',header:header});
pagging.pagging(jsonStr);
}
//删除明细
......@@ -21,6 +21,15 @@ function failureDelete(){
alert()
}
// 点击单选按钮时 触发
function radioChoose(e){
$("#updateIndicatorsBtn").removeAttr("disabled");
$("#anaInfoSelected").val(e.id);
console.log(e.id);
}
//将省份转换为 数组
function provinceToArr(){
var str=document.getElementById('provinceAll').value;
......@@ -32,6 +41,7 @@ function provinceToArr(){
return arrProvince;
}
// 将 指标转换为 数组
function indicatorsToArr(){
var str=document.getElementById('indicatorsAll').value;
......@@ -40,6 +50,8 @@ function indicatorsToArr(){
return arrProvince;
}
var table_pagging = function(){
this.init.apply(this, arguments);
}
......@@ -179,7 +191,7 @@ table_pagging.prototype={
var tdTitle="";
if(this.header[k][1]){
var reg = /\%\{([\d\w.]+)\}\%/g;
if (k != 0) {
if (k > 0 && k < 4) {
if (result = reg.exec(this.header[k][1])) {
// var result = reg.exec(this.header[k][1]);
var context = this.header[k][1];
......@@ -193,27 +205,36 @@ table_pagging.prototype={
tdContext = context;
} else {
if(k==1 ||k==3){
console.log(this.objectlist)
tdContext = this.getData(this.objectlist[i],this.header[k][1])
console.log(this.objectlist);
if(k==1){
tdContext = this.getProviceData(this.objectlist[i],this.header[k][1]);
}else if(k == 2){
var dimensionddd=this.getData(this.objectlist[i],this.header[k][1]);
if(dimensionddd == 'y'){
tdContext = '业务';
}else if(dimensionddd == 'c'){
tdContext = '渠道';
}else{
if(k==4){
tdContext=this.getProviceData(this.objectlist[i]["dimAssociationAnaInfo"],this.header[k][1])
tdContext='';
}
}else{
tdContext=this.getData(this.objectlist[i]["dimAssociationAnaInfo"],this.header[k][1])
tdContext = this.getData(this.objectlist[i],this.header[k][1]);
}
}
}
if(k==0) {
tdContext="<input type='radio' name='update'id='"+this.getData(this.objectlist[i],this.header[0][1])+"' onclick='radioChoose(this);'/>";
console.log(tdContext)
}
} else {
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>";
// tdContext="<input type='checkbox' name='failureBox"+i+"' class='failureBox' onclick='javascript:checkFailureIdsChoose(this);'/>"+"<span style='display:none'>"+i+"</span>";
// for ( var t = 0; t < checkFailureIds.length; t++) {
// 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;
// }
// }
}
} else {
tdContext = "&nbsp;";
......
......@@ -570,6 +570,7 @@ table_pagging.prototype = {
}
function radioChoose(clickObj){
alert();
var obj = eval("(" + jsonData + ")");
//alert(obj);
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