| 
						
						
							
								
							
						
						
					 | 
					@ -23,6 +23,7 @@ import com.epmet.support.normalizing.Correlation; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.support.normalizing.ScoreCalculator; | 
					 | 
					 | 
					import com.epmet.support.normalizing.ScoreCalculator; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.support.normalizing.ScoreConstants; | 
					 | 
					 | 
					import com.epmet.support.normalizing.ScoreConstants; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.support.normalizing.batch.BatchScoreCalculator; | 
					 | 
					 | 
					import com.epmet.support.normalizing.batch.BatchScoreCalculator; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.support.normalizing.batch.CalculateResult; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.support.normalizing.batch.IndexInputVO; | 
					 | 
					 | 
					import com.epmet.support.normalizing.batch.IndexInputVO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.support.normalizing.batch.SampleValue; | 
					 | 
					 | 
					import com.epmet.support.normalizing.batch.SampleValue; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
					 | 
					 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -224,7 +225,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        log.info("计算的参数:{}", JSON.toJSONString(indexMap)); | 
					 | 
					 | 
					        log.info("计算的参数:{}", JSON.toJSONString(indexMap)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        HashMap<String, BigDecimal> result = calculateScore(indexMap); | 
					 | 
					 | 
					        HashMap<String, CalculateResult> result = calculateScore(indexMap); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        log.info("计算的结果:{}", result); | 
					 | 
					 | 
					        log.info("计算的结果:{}", result); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //处理结果
 | 
					 | 
					 | 
					        //处理结果
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -244,13 +245,20 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param result | 
					 | 
					 | 
					     * @param result | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public void saveCpcScore(CalculateCommonFormDTO formDTO, Map<String, CpcScoreEntity> indexDetails, String parentIndexCode, HashMap<String, BigDecimal> result) { | 
					 | 
					 | 
					    public void saveCpcScore(CalculateCommonFormDTO formDTO, Map<String, CpcScoreEntity> indexDetails, String parentIndexCode, HashMap<String, CalculateResult> result) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<CpcScoreEntity> list = new ArrayList<>(); | 
					 | 
					 | 
					        List<CpcScoreEntity> list = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        result.forEach((userId, score) -> { | 
					 | 
					 | 
					        result.forEach((userId, score) -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            CpcScoreEntity cpcScoreEntity = indexDetails.get(userId); | 
					 | 
					 | 
					            CpcScoreEntity cpcScoreEntity = indexDetails.get(userId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            cpcScoreEntity.setScore(score); | 
					 | 
					 | 
					            cpcScoreEntity.setScore(score.getTotalScore()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            list.add(cpcScoreEntity); | 
					 | 
					 | 
					            list.add(cpcScoreEntity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            score.getDetails().forEach(o -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                CpcScoreEntity child = ConvertUtils.sourceToTarget(o, CpcScoreEntity.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                child.setIndexCode(o.getIndexCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                child.setScore(o.getScore()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                list.add(child); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }); | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        this.deleteAndInsertBatch(formDTO, list, parentIndexCode); | 
					 | 
					 | 
					        this.deleteAndInsertBatch(formDTO, list, parentIndexCode); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -295,7 +303,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    ScoreConstants.MAX_SCORE, | 
					 | 
					 | 
					                    ScoreConstants.MAX_SCORE, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    Correlation.getCorrelation(index.getCorrelation()) | 
					 | 
					 | 
					                    Correlation.getCorrelation(index.getCorrelation()) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            ); | 
					 | 
					 | 
					            ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            IndexInputVO indexInputVO = new IndexInputVO(index.getIndexCode(), new ArrayList<>(), index.getThreshold(), index.getWeight(), scoreCalculator); | 
					 | 
					 | 
					            IndexInputVO indexInputVO = new IndexInputVO(index.getIndexCode(), index.getAllParentIndexCode(), new ArrayList<>(), index.getThreshold(), index.getWeight(), scoreCalculator); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            map.put(index.getIndexCode(), indexInputVO); | 
					 | 
					 | 
					            map.put(index.getIndexCode(), indexInputVO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return map; | 
					 | 
					 | 
					        return map; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -307,11 +315,11 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param indexMap | 
					 | 
					 | 
					     * @param indexMap | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @return | 
					 | 
					 | 
					     * @return | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    private HashMap<String, BigDecimal> calculateScore(Map<String, IndexInputVO<BigDecimal>> indexMap) { | 
					 | 
					 | 
					    private HashMap<String, CalculateResult> calculateScore(Map<String, IndexInputVO<BigDecimal>> indexMap) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        //构造入参
 | 
					 | 
					 | 
					        //构造入参
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<IndexInputVO> indexInputVOS = indexMap.values().stream().collect(Collectors.toList()); | 
					 | 
					 | 
					        List<IndexInputVO> indexInputVOS = indexMap.values().stream().collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
					 | 
					 | 
					        BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        return batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); | 
					 | 
					 | 
					        return batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |