@ -19,7 +19,10 @@ package com.epmet.service.evaluationindex.indexcal.impl; 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					import  com.alibaba.fastjson.JSON ;  
					 
					 
					import  com.alibaba.fastjson.JSON ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  com.epmet.commons.mybatis.service.impl.BaseServiceImpl ;  
					 
					 
					import  com.epmet.commons.mybatis.service.impl.BaseServiceImpl ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  com.epmet.commons.tools.constant.NumConstant ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  com.epmet.commons.tools.constant.StrConstant ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  com.epmet.commons.tools.exception.RenException ;  
					 
					 
					import  com.epmet.commons.tools.exception.RenException ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  com.epmet.constant.IndexCalConstant ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  com.epmet.dao.evaluationindex.indexcal.DeptScoreDao ;  
					 
					 
					import  com.epmet.dao.evaluationindex.indexcal.DeptScoreDao ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyDao ;  
					 
					 
					import  com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyDao ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  com.epmet.dto.indexcal.CalculateCommonFormDTO ;  
					 
					 
					import  com.epmet.dto.indexcal.CalculateCommonFormDTO ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -27,13 +30,26 @@ import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity; 
				
			 
			
		
	
		
		
			
				
					 
					 
					import  com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity ;  
					 
					 
					import  com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  com.epmet.eum.IndexCodeEnum ;  
					 
					 
					import  com.epmet.eum.IndexCodeEnum ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  com.epmet.service.evaluationindex.indexcal.DeptScoreService ;  
					 
					 
					import  com.epmet.service.evaluationindex.indexcal.DeptScoreService ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  com.epmet.service.evaluationindex.indexcal.IndexCodeFieldReService ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  com.epmet.service.evaluationindex.screen.IndexGroupDetailService ;  
					 
					 
					import  com.epmet.service.evaluationindex.screen.IndexGroupDetailService ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  com.epmet.support.normalizing.BigDecimalScoreCalculator ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  com.epmet.support.normalizing.Correlation ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  com.epmet.support.normalizing.ScoreCalculator ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  com.epmet.support.normalizing.ScoreConstants ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  com.epmet.support.normalizing.batch.IndexInputVO ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  com.epmet.support.normalizing.batch.SampleValue ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  lombok.extern.slf4j.Slf4j ;  
					 
					 
					import  lombok.extern.slf4j.Slf4j ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  org.apache.commons.lang3.StringUtils ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  org.springframework.beans.factory.annotation.Autowired ;  
					 
					 
					import  org.springframework.beans.factory.annotation.Autowired ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  org.springframework.stereotype.Service ;  
					 
					 
					import  org.springframework.stereotype.Service ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  org.springframework.util.CollectionUtils ;  
					 
					 
					import  org.springframework.util.CollectionUtils ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  java.math.BigDecimal ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  java.util.ArrayList ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  java.util.HashMap ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					import  java.util.List ;  
					 
					 
					import  java.util.List ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  java.util.Map ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					import  java.util.stream.Collectors ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					/ * *  
					 
					 
					/ * *  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -49,6 +65,8 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor 
				
			 
			
		
	
		
		
			
				
					 
					 
					    private  IndexGroupDetailService  getDetailListByParentCode ;  
					 
					 
					    private  IndexGroupDetailService  getDetailListByParentCode ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    @Autowired  
					 
					 
					    @Autowired  
				
			 
			
		
	
		
		
			
				
					 
					 
					    private  FactIndexGovrnAblityDeptMonthlyDao  factIndexGovrnAblityDeptMonthlyDao ;  
					 
					 
					    private  FactIndexGovrnAblityDeptMonthlyDao  factIndexGovrnAblityDeptMonthlyDao ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    @Autowired  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    private  IndexCodeFieldReService  indexCodeFieldReService ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    / * *  
					 
					 
					    / * *  
				
			 
			
		
	
		
		
			
				
					 
					 
					     *  @param  formDTO  
					 
					 
					     *  @param  formDTO  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -60,15 +78,135 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor 
				
			 
			
		
	
		
		
			
				
					 
					 
					    @Override  
					 
					 
					    @Override  
				
			 
			
		
	
		
		
			
				
					 
					 
					    public  Boolean  calculateDeptCorreLation ( CalculateCommonFormDTO  formDTO )  {  
					 
					 
					    public  Boolean  calculateDeptCorreLation ( CalculateCommonFormDTO  formDTO )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					        //获取指标权重
  
					 
					 
					        //获取指标权重
  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					        List < IndexGroupDetailEntity >  parentIndexDetails   =  getDetailListByParentCode . getDetailListByParentCode ( formDTO . getCustomerId ( ) ,  
					 
					 
					        List < IndexGroupDetailEntity >  indexGroupDetailEntityList   =  getDetailListByParentCode . getDetailListByParentCode ( formDTO . getCustomerId ( ) ,  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					                IndexCodeEnum . QU_ZHI_BU_MEN . getCode ( ) ,  
					 
					 
					                IndexCodeEnum . QU_ZHI_BU_MEN . getCode ( ) ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					                IndexCodeEnum . ZHI_LI_NENG_LI . getCode ( ) ) ;  
					 
					 
					                IndexCodeEnum . ZHI_LI_NENG_LI . getCode ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					        if  ( CollectionUtils . isEmpty ( parentIndexDetails ) )  {  
					 
					 
					        if  ( CollectionUtils . isEmpty ( indexGroupDetailEntityList ) )  {  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					            log . warn ( "calculateDeptCorreLation customerId:{} have not any indexGroupDetail" ,  formDTO . getCustomerId ( ) ) ;  
					 
					 
					            log . warn ( "calculateDeptCorreLation customerId:{} have not any indexGroupDetail" ,  formDTO . getCustomerId ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					            throw  new  RenException ( "客户【区直部门:治理能力】指标权重信息不存在" ) ;  
					 
					 
					            throw  new  RenException ( "客户【区直部门:治理能力】指标权重信息不存在" ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					        }  
					 
					 
					        }  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					        log . info ( JSON . toJSONString ( parentIndexDetails ) ) ;  
					 
					 
					        log . info ( JSON . toJSONString ( indexGroupDetailEntityList ) ) ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					        return  null ;  
					 
					 
					
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        //1、查询总记录数
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        int  total  =  factIndexGovrnAblityDeptMonthlyDao . selectCount ( formDTO ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        if  ( NumConstant . ZERO  = =  total )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            log . warn ( String . format ( "customerId=%s,monthId=%s,fact_index_govrn_ablity_dept_monthly have not any fact record" ,  formDTO . getCustomerId ( ) ,  formDTO . getMonthId ( ) ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            return  Boolean . FALSE ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        }  else  if  ( NumConstant . ONE  = =  total )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            //只有一个网格时
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            log . warn ( String . format ( "customerId:%s,monthId:%s,only one fact_index_party_ablity_grid_monthly record" ,  formDTO . getCustomerId ( ) ,  formDTO . getMonthId ( ) ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            this . handleOneGridScene ( formDTO ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            return  Boolean . TRUE ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        //2、计算最大最小值
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        Map < String ,  Object >  minAndMaxMap  =  factIndexGovrnAblityDeptMonthlyDao . selectExtremeValue ( formDTO ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        if  ( CollectionUtils . isEmpty ( minAndMaxMap ) )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            log . warn ( "calculateDeptCorreLation getExtremeValue customerId:{} fact_index_govrn_ablity_dept_monthly have not any fact record" ,  formDTO . getCustomerId ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            throw  new  RenException ( "【区直部门:治理能力】指标原始数据记录不存在" ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        //3、构造入参 指标集合
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        Map < String ,  IndexInputVO < BigDecimal > >  indexMap  =  buildDeptCorrelationIndexInputVO ( indexGroupDetailEntityList ,  minAndMaxMap ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        //4、分批计算
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        int  pageNo  =  NumConstant . ONE ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        int  pageSize  =  IndexCalConstant . PAGE_SIZE ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        //分页查询 要计算的原始数据
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        List < Map < String ,  Object > >  list  =  null ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        do  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            list  =  factIndexGovrnAblityDeptMonthlyDao . selectListByMonthId ( formDTO . getCustomerId ( ) ,  formDTO . getMonthId ( ) ,  ( pageNo  -  1 )  *  pageSize ,  pageSize ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            if  ( ! CollectionUtils . isEmpty ( list ) )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                //遍历指标分组 计算分数
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                List < Map < String ,  Object > >  crrentFactRecordList  =  list ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                calculateScore ( formDTO , indexMap , crrentFactRecordList ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        }  while  ( ! CollectionUtils . isEmpty ( list )  & &  pageNo + +  >  0 ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        return  true ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    / * *  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @return  void  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @param  formDTO  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @param  indexMap  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @author  yinzuomei  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @description  计算分值并保存结果  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @Date  2020 / 9 / 3  11 : 14  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     * * /  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    private  void  calculateScore ( CalculateCommonFormDTO  formDTO ,  Map < String ,  IndexInputVO < BigDecimal > >  indexMap , List < Map < String ,  Object > >  recordList )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        //遍历每一个网格的记录
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        recordList . forEach ( recordMap  - >  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            //遍历所有的指标
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            indexMap . forEach ( ( key ,  indexInputVO )  - >  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                if  ( StringUtils . isNotBlank ( indexCodeFieldReService . getFieldNameByIndexCode ( key ) ) )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    //对应的数值
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    String  sampleValueStr  =  ( String )  recordMap . get ( indexCodeFieldReService . getFieldNameByIndexCode ( key ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    //构造样本值对象
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    SampleValue < BigDecimal >  currentGridIndexValue  =  new  SampleValue ( ( String )  recordMap . get ( IndexCalConstant . DEPT_ID ) ,  new  BigDecimal ( sampleValueStr ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    indexInputVO . getIndexValueVOs ( ) . add ( currentGridIndexValue ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            } ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        } ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        //保存中间表记录 TODO
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    / * *  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @param  formDTO  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @return  void  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @author  yinzuomei  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @description  TODO  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @Date  2020 / 9 / 3  9 : 35  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     * * /  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    private  void  handleOneGridScene ( CalculateCommonFormDTO  formDTO )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    / * *  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @param  indexList  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @param  minAndMaxMap  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @return  java . util . Map < java . lang . String ,  com . epmet . support . normalizing . batch . IndexInputVO  <  java . math . BigDecimal > >  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @author  yinzuomei  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @description  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     *  @Date  2020 / 9 / 3  9 : 31  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					     * * /  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					    private  Map < String ,  IndexInputVO < BigDecimal > >  buildDeptCorrelationIndexInputVO ( List < IndexGroupDetailEntity >  indexList ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                                                                                   Map < String ,  Object >  minAndMaxMap )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        Map < String ,  IndexInputVO < BigDecimal > >  map  =  new  HashMap < > ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        for  ( IndexGroupDetailEntity  index  :  indexList )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            //获取指标对应的列名
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            String  fieldName  =  indexCodeFieldReService . getFieldNameByIndexCode ( index . getIndexCode ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            if  ( StringUtils . isBlank ( fieldName ) )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                log . error ( "index_code:{} not find field_name" ,  index . getIndexCode ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                continue ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            String  minValueKey  =  fieldName . concat ( StrConstant . UNDER_LINE ) . concat ( StrConstant . MIN ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            String  maxValueKey  =  fieldName . concat ( StrConstant . UNDER_LINE ) . concat ( StrConstant . MAX ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            BigDecimal  minValue  =  new  BigDecimal ( String . valueOf ( minAndMaxMap . get ( minValueKey ) ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            BigDecimal  maxValue  =  new  BigDecimal ( String . valueOf ( minAndMaxMap . get ( maxValueKey ) ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            //有阈值,且最大值>阈值,则最大值赋值为阈值
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            if  ( new  BigDecimal ( NumConstant . ONE_NEG_STR ) . compareTo ( index . getThreshold ( ) )  ! =  NumConstant . ZERO  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    & &  maxValue . compareTo ( index . getThreshold ( ) )  = =  NumConstant . ONE )  {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                maxValue  =  index . getThreshold ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            //分值计算器
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            ScoreCalculator  scoreCalculator  =  new  BigDecimalScoreCalculator ( minValue ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    maxValue ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    ScoreConstants . MIN_SCORE ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    ScoreConstants . MAX_SCORE ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    Correlation . getCorrelation ( index . getCorrelation ( ) )  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            List < SampleValue < BigDecimal > >  sampleValueList  =  new  ArrayList < > ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            IndexInputVO  indexInputVO1  =  new  IndexInputVO ( index . getIndexCode ( ) ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    sampleValueList ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    index . getThreshold ( ) ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					//                    new BigDecimal("-1"),   //FOR TEST
  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    index . getWeight ( ) ,  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    scoreCalculator ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            map . put ( index . getIndexCode ( ) ,  indexInputVO1 ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        return  map ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					    }  
					 
					 
					    }  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					}  
					 
					 
					}