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;
} }
......
...@@ -9,50 +9,69 @@ import org.springframework.data.repository.PagingAndSortingRepository; ...@@ -9,50 +9,69 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import com.hp.cmsz.entity.Business; import com.hp.cmsz.entity.Business;
/** /**
*
* @author Liu Ying * @author Liu Ying
*
*/ */
public interface BusinessDao extends JpaSpecificationExecutor<Business>, public interface BusinessDao extends JpaSpecificationExecutor<Business>,
PagingAndSortingRepository<Business, Long> { PagingAndSortingRepository<Business, Long> {
List<Business> findByChannelDataSourceMapIdIn(List<Long> channelDataSourceMapIdList); List<Business> findByChannelDataSourceMapIdIn(List<Long> channelDataSourceMapIdList);
List<Business> findByChannelDataSourceMapIdIn(Collection<Long> channelDataSourceMapIdList);
List<Business> findByBusinessIdIn(List<Long> businessIds); List<Business> findByChannelDataSourceMapIdIn(Collection<Long> channelDataSourceMapIdList);
//加入isActive=N || add by August 2014-3-27 List<Business> findByBusinessIdIn(List<Long> businessIds);
@Query("select business.businessId, business.businessName from Business business where business.isActive = 'Y' and business.businessId >= 0 order by business.businessId")
List<Object[]> findAllBusinessIdAndBusinessName(); //加入isActive=N || add by August 2014-3-27
@Query("select business.businessId, business.businessName from Business business where business.isActive = 'Y' and business.businessId >= 0 order by business.businessId")
//加入isActive=N || add by August 2014-3-27 List<Object[]> findAllBusinessIdAndBusinessName();
//由数据来源和渠道得到业务
@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 ") //加入isActive=N || add by August 2014-3-27
List<Object[]> findAllBusinessIdAndBusinessNameByDataSourceIdAndChannelId(@Param("channelIdList") List<Long> channelIdList,@Param("datasourceIdList") List<Long> datasourceIdList); //由数据来源和渠道得到业务
@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 ")
//加入business_id<>899 || add by Charmy 2014-8-24 List<Object[]> findAllBusinessIdAndBusinessNameByDataSourceIdAndChannelId(@Param("channelIdList") List<Long> channelIdList, @Param("datasourceIdList") List<Long> datasourceIdList);
//由数据来源和渠道得到业务
@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 ") //加入business_id<>899 || add by Charmy 2014-8-24
List<Object[]> findBusinessByDataSourceIdAndChannelIdNot899(@Param("channelIdList") List<Long> channelIdList,@Param("datasourceIdList") List<Long> datasourceIdList); //由数据来源和渠道得到业务
@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 ")
//由单个数据来源ID和单个渠道ID得到业务 List<Object[]> findBusinessByDataSourceIdAndChannelIdNot899(@Param("channelIdList") List<Long> channelIdList, @Param("datasourceIdList") List<Long> datasourceIdList);
@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); //由单个数据来源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")
//由单个数据来源ID和单个渠道ID得到业务,加入isActive=N List<Object[]> findBusinessIdAndBusinessNameByDataSourceIdAndChannelId(@Param("channelIdList") Long channelIdList, @Param("datasourceIdList") Long datasourceIdList);
@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); //由单个数据来源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")
@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[]> findBusinessIdAndBusinessNameByDataSourceIdAndChannelIdWithIsActive(@Param("channelId") Long channelId, @Param("datasourceId") Long datasourceId);
List<Object[]> findBusinessByChannelName(@Param("channelName")String channelName);
@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);
@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")
List<Object[]> findCompetitorsBusiness(@Param("channelIdList") List<Long> channelIdList);
//加入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);
//竞品分析部分"竞品业务"筛选项取值
@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")
List<Object[]> findCompetitorsBusiness(@Param("channelIdList") List<Long> channelIdList);
//加入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);
//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; ...@@ -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";
......
...@@ -2,33 +2,34 @@ package com.hp.cmsz.web.monitoroperation; ...@@ -2,33 +2,34 @@ package com.hp.cmsz.web.monitoroperation;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.hp.cmsz.entity.DimKpiAssociationRelInfo; import com.hp.cmsz.entity.*;
import com.hp.cmsz.entity.Province; import com.hp.cmsz.repository.DimAssociationAnaInfoDao;
import com.hp.cmsz.repository.DimKpiAssociationRelInfoDao; import com.hp.cmsz.repository.DimKpiAssociationRelInfoDao;
import com.hp.cmsz.repository.DimKpiDao;
import com.hp.cmsz.repository.ProvinceDao; import com.hp.cmsz.repository.ProvinceDao;
import com.hp.cmsz.service.monitoroperation.AssociateDiagosisConfigurationService; import com.hp.cmsz.service.monitoroperation.AssociateDiagosisConfigurationService;
import com.hp.cmsz.web.PageURLController; import com.hp.cmsz.web.PageURLController;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList; import java.math.BigDecimal;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
/** /**
* AssociateDiagosisConfigurationController 监控运营>告警关联诊>关联诊断配置 * AssociateDiagosisConfigurationController 监控运营>告警关联诊>关联诊断配置
* *
* @author Molinyi * @author Molinyi
*
*/ */
@Controller @Controller
@RequestMapping(value = "/MonitorOperation/AssociateDiagosisConfiguration") @RequestMapping(value = "/MonitorOperation/AssociateDiagosisConfiguration")
public class AssociateDiagosisConfigurationController { public class AssociateDiagosisConfigurationController {
@Autowired @Autowired
private ProvinceDao provinceDao; private ProvinceDao provinceDao;
@Autowired @Autowired
...@@ -36,56 +37,563 @@ public class AssociateDiagosisConfigurationController { ...@@ -36,56 +37,563 @@ public class AssociateDiagosisConfigurationController {
@Autowired @Autowired
private DimKpiAssociationRelInfoDao dimKpiAssociationRelInfoDao; private DimKpiAssociationRelInfoDao dimKpiAssociationRelInfoDao;
@Autowired
private DimAssociationAnaInfoDao dimAssociationAnaInfoDao;
@Autowired
private DimKpiDao dimKpiDao;
@RequestMapping("") @RequestMapping("")
public String list(Map model, public String list(Map model,
@RequestParam(defaultValue = "",value = "detailProvince")String detailProvince, @RequestParam(defaultValue = "", value = "detailProvince") String detailProvince,
@RequestParam(defaultValue = "",value = "dimension")String dimension @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<DimAssociationAnaInfo> listDim = new ArrayList<DimAssociationAnaInfo>();
list= associateDiagosisConfigurationService.findAllDimKpiAssociationRelInfo(); // List<DimKpi>listDimKpi=new ArrayList<DimKpi>();
if (detailProvince.equalsIgnoreCase("") && dimension.equalsIgnoreCase("")) {//查找所有
listDim = associateDiagosisConfigurationService.findAllDimAssociationAnaInfo();
} }
if(detailProvince.equalsIgnoreCase("")&&(!dimension.equalsIgnoreCase(""))){ if (detailProvince.equalsIgnoreCase("") && (!dimension.equalsIgnoreCase(""))) {
list=associateDiagosisConfigurationService.findDimKpiAssociationRelInfoByDimension(dimension); listDim = associateDiagosisConfigurationService.findDimAssociationAnaInfoByDimension(dimension);
} }
if((!detailProvince.equalsIgnoreCase(""))&&(!dimension.equalsIgnoreCase(""))){ if ((!detailProvince.equalsIgnoreCase("")) && (!dimension.equalsIgnoreCase(""))) {
String[]arrProvice=detailProvince.split(","); String[] arrProvice = detailProvince.split(",");
List<Long>listProvice=new CopyOnWriteArrayList<Long>(); List<Long> listProvice = new CopyOnWriteArrayList<Long>();
int length=arrProvice.length; int length = arrProvice.length;
for(int i=0;i<length;i++){ for (int i = 0; i < length; i++) {
listProvice.add(Long.parseLong(arrProvice[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>(); if ((!detailProvince.equalsIgnoreCase("")) && dimension.equalsIgnoreCase("")) {
int length=arrProvice.length; String[] arrProvice = detailProvince.split(",");
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])); listProvice.add(Long.parseLong(arrProvice[i]));
} }
list=associateDiagosisConfigurationService.findDimKpiAssociationRelInfoByProvince(listProvice); listDim = associateDiagosisConfigurationService.findDimAssociationAnaInfoByProvince(listProvice);
} }
Gson gson = new Gson(); Gson gson = new Gson();
Gson gsonP = 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("provinceList", provinceList);
model.put("gzfxDetailInfos",gson.toJson(list)); // model.put("listDimKpi", gson.toJson(listDimKpi));//所有指标
model.put("provinces",gsonP.toJson(provinceList)); model.put("gzfxDetailInfos", gson.toJson(listDim));
model.put("indicatorsAll",gsonP.toJson(provinceList));//所有指标 model.put("provinces", gsonP.toJson(provinceList));
model.put("indicatorsAll", gsonP.toJson(provinceList));//所有指标
System.out.println(")))"+gsonP.toJson(provinceList));
return PageURLController.AssociateDiagosisConfiguration; 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 @@ ...@@ -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>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
/* .file-box{ position:relative;width:340px} /* .file-box{ position:relative;width:340px}
.txt{ height:22px; border:1px solid #cdcdcd; width:180px;} .txt{ height:22px; border:1px solid #cdcdcd; width:180px;}
.btn{ background-color:#FFF; border:1px solid #CDCDCD;height:24px; width:70px;} .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> </style>
</head> </head>
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
<li class="active">告警关联诊断</li> <li class="active">告警关联诊断</li>
</ol> </ol>
</div> </div>
<div id="main-container main-tab-container"> <div id="main-container main-tab-container">
<div id="content" class="container"> <div id="content" class="container">
<div class="section"> <div class="section">
...@@ -59,62 +60,127 @@ ...@@ -59,62 +60,127 @@
<div class="table-header">新建指标</div> <div class="table-header">新建指标</div>
<form action="#" class="form-horizontal" id="modelMaintainForm" method="post" enctype="multipart/form-data"> <form action="#" class="form-horizontal" id="modelMaintainForm" method="post" enctype="multipart/form-data">
<table id="modelMaintainTable" class="table-null"> <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>
<tr><td>指标权重:</td><td><input type="text" class="form-control" name="modelDesc" id="modelDesc" style="display:inline;" /></td></tr> <td>省份:</td>
<tr><td>关联描述:</td><td><input type="text" class="form-control" name="ruleDefinition" id="ruleDefinition"/></td></tr> <td>
<tr><td>省份:</td><td><input type="text" class="form-control" name="evaluationMethod" id="evaluationMethod" style="display: inline;" /></td></tr> <%--<select class="form-control" name="proviceTd" id="proviceTd" >
<tr><td>评判标准:</td><td><input type="text" class="form-control" name="evaluationStandard" id="evaluationStandard" style="display: inline;" /></td></tr> <c:forEach var="provice" items="${proviceList}">
<tr><td>模型执行脚本(<font color="red">必填</font>):</td><td> <option value="${provice.provinceId}">${provice.provinceName}</option>
<div class="file-box"> </c:forEach>
<input type='text' id='modelExeScriptName' class="form-control" style="display: inline;"/> </select>--%>
<input type='button' class="btn btn-default" value='浏 览' style="width:70px"/> <c:forEach var="provice" items="${proviceList}">
<input type="file" name="uploadFile" class="file" id="fileField" onchange="document.getElementById('modelExeScriptName').value=this.value" /> <div class="checkbox-inline">
</div> <label>
</td></tr> <input type="checkbox" name="provinceDetail" class="provinceDetail" title="${provice.provinceName}" value="${provice.provinceId}" />${provice.provinceName}
<tr><td>关联维度:</td> </label>
<td><select class="form-control" name="modelType" id="modelType" > </div>
<c:forEach var="modelType" items="${dataModelTypeList}"> </c:forEach>
<option value="${modelType.dataModelTypeId}">${modelType.dataModelTypeName}</option> </td>
</c:forEach> </tr>
</select></td></tr>
<tr><td>部署服务器:</td> <tr>
<td><select class="form-control" name="deployedServer" id="deployedServer"> <td>维度:</td>
<c:forEach var="deployedServers" items="${deployedServerList}"> <td><select class="form-control" name="dimensionTd" id="dimensionTd" >
<option value="${deployedServers.serverId}">${deployedServers.serverName}</option> <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> </c:forEach>
</select></td></tr> </select></td>
<tr><td>模型状态:</td> </tr>
<td><select class="form-control" name="modelStatus" id="modelStatus"> <tr>
<option value="1">正常</option> <td>描述(<font color="red">必填</font>):</td>
<option value="0">失效</option> <td><input type="text" class="form-control" name="descTd" id="descTd" style="display: inline;" />
</select></td></tr> <span id="writeWarningInf" style="color:red;display: inline;padding-left:10px;"></span></td>
<tr><td>数据类型(<font color="red">必填</font>):</td> </tr>
<td><select class="form-control" name="kpiTypeId" id="kpiTypeId"> <tr>
<option value="1">时长类</option> <td>已添加指标:</td>
<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>
<td><table class="table table-hover table-striped" id="displayParam"> <td><table class="table table-hover table-striped" id="displayParam">
<thead> <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> </thead>
<tbody id="addTr"></tbody> <tbody id="addTr"></tbody>
</table></td></tr> </table></td></tr>
<tr><td>参数数据类型:</td> <tr>
<td><select class="form-control" id="paramDataType" name="paramDataType"> <tr>
<c:forEach var="dataTypes" items="${dataTypeList}"> <td>数据源:</td>
<option value="${dataTypes.dataTypeName}">${dataTypes.dataTypeName}</option> <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> </c:forEach>
</select></td></tr>
<tr><td>参数名:</td><td><input type="text" class="form-control" name="paramName" id="paramName"/></td></tr> </td>
<tr><td>参数值:</td><td id="addParamVal"></td></tr> </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> <tr><td></td>
<td><button type="button" id="addParam" class="btn btn-primary">添加参数</button></td></tr> <%--<td><button type="button" id="selectAnaInfo" class="btn btn-primary btn-small">查找指标</button>--%>
<tr><td></td><td><button type="button" id="modelSubmit" class="btn btn-primary">确定</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-default" id="modelReset">清空</button>
<button type="reset" class="btn btn-warning" id="modelBack">返回</button> <button type="reset" class="btn btn-warning" id="modelBack">返回</button>
</td></tr> </td></tr>
...@@ -126,10 +192,12 @@ ...@@ -126,10 +192,12 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$("#UPDATEAnaInfo").hide();
if($("#paramDataType").val()=="字符"){ if($("#paramDataType").val()=="字符"){
var addDataValue = $("<input type='text' class='form-control name=paramValue' id='paramValue'/>"); var addDataValue = $("<input type='text' class='form-control name=paramValue' id='paramValue'/>");
$("#addParamVal").append(addDataValue); $("#addParamVal").append(addDataValue);
...@@ -194,6 +262,7 @@ ...@@ -194,6 +262,7 @@
//删除所有参数 //删除所有参数
function deleteAllTr(){ function deleteAllTr(){
$("#addTr").empty(); $("#addTr").empty();
dimKpiSelected.splice(0,dimKpiSelected.length);
} }
//修改一条参数 //修改一条参数
...@@ -219,7 +288,7 @@ ...@@ -219,7 +288,7 @@
$.alert("参数名不能为空"); $.alert("参数名不能为空");
}else{ }else{
if($("#addTr").find("tr.orange-tr").html()==null){ 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); $("#addTr").append(addRow);
$("#paramName").attr("value",""); $("#paramName").attr("value","");
$("#paramValue").attr("value",""); $("#paramValue").attr("value","");
...@@ -234,113 +303,404 @@ ...@@ -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){ function deleteRow(e){
$(elementTag).parent().parent().remove();
var id=Number(e.title);
dimKpiSelected.splice($.inArray(id,dimKpiSelected),1);
$(e).parent().parent().remove();
} }
//form表单重置 //form表单重置
$("#modelReset").click(function(){ $("#modelReset").click(function(){
$("#businessActivedListTd").empty();
$("#dimKpiListTd").empty();
deleteAllTr(); deleteAllTr();
}); });
//返回 选中的省份
function getDetailProvinceCheckedValues(){
var provinceArray=new Array();
$("input[name='provinceDetail']").each(function(){
if($(this).attr("checked")){
provinceArray.push($(this).val());
}
});
return provinceArray;
}
//form表单提交 //form表单提交
$("#modelSubmit").click(function(){ $("#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 anainfoShallSaveArr= getAnainfoShallSave();
var i = $("#addTr").find("tr").size(); var arrDimKpiChecked=getArrDimKpiChecked();
var provinceDetailChecked=getDetailProvinceCheckedValues();
if(i==0){ if(provinceDetailChecked.length < 1){
var createForm=$("#modelMaintainForm"); $.alert("省份需选");
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm"); }else if($.trim($("#descTd").val())==""){
createForm.submit(); $.alert("描述不能为空");
createForm.attr("action","#"); }
}else{ /*else if ($.trim($("#kpiWeightTd").val())==""){
$("#addTr").find("tr").each(function(){ $.alert("权重不能为空");
//alert($(this).find("td").eq(0).html()); }*//*else if (arrDimKpiChecked.length < 1){
var paramName = $(this).find("td").eq(0).html(); $.alert("指标需选");
var paramValue = $(this).find("td").eq(1).html(); }*/else if(anainfoShallSaveArr.length < 1){
var paramType = $(this).find("td").eq(2).html(); $.alert("指标需选");
$.ajax({ }
type : "GET", else{
contentType : "application/json",
url: "${ctx}/ModelManage/ModelMaintain/createModelParam?paramName="+encodeURIComponent(paramName)+"&paramValue="+encodeURIComponent(paramValue)+"&paramType="+encodeURIComponent(paramType), var proviceTdSelected=$("#proviceTd option:selected").val();
dataType : "text", var dimensionTdSelected=$("#dimensionTd option:selected").val();
async: false,
beforeSend: function(data) {}, var descTdV=$("#descTd").val();
success: function(){ var kpiWeightTdV=$("#kpiWeightTd").val();
i--;
if(i==0){
var createForm=$("#modelMaintainForm"); $.ajax({
createForm.attr("action","${ctx}/ModelManage/ModelMaintain/saveModelDataForm"); type : 'GET',
createForm.submit(); async : true,
createForm.attr("action","#"); 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);
okValue: "确定", setTimeout(function () {
cancel: function(){}, location.href="${ctx}/MonitorOperation/AssociateDiagosisConfiguration";
cancelValue: "取消", },2000);
});
}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","#");
}
}
});
});
} }
}
});
} }
}); });
$("#modelBack").click(function(){ $("#modelBack").click(function(){
location.href="${ctx}/MonitorOperation/AssociateDiagosisConfiguration"; 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]);
}
});
$.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++){
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);
}
});
}
//数据源 复选框 点击 事件
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> </script>
</body> </body>
......
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