Browse Source

Merge remote-tracking branch 'origin/dev_screen_data' into dev_temp

dev_shibei_match
zxc 5 years ago
parent
commit
e4960d532c
  1. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java
  2. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/DoubleScoreCalculator.java
  3. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/IntegerScoreCalculator.java
  4. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreCalculator.java

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java

@ -46,7 +46,11 @@ public class AgencyServiceImpl implements AgencyService {
if (null == rootAgency){
return new TreeResultDTO();
}
List<TreeResultDTO> departmentList = this.getDepartmentList(("".equals(rootAgency.getPids()) ? "" : rootAgency.getPids() + ",") + rootAgency.getValue());
String sub = null;
if ("".equals(rootAgency.getPids()) || rootAgency.getPids().equals("0")){
sub = rootAgency.getValue();
}
List<TreeResultDTO> departmentList = this.getDepartmentList(sub);
rootAgency.setChildren(departmentList);
return rootAgency;
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/DoubleScoreCalculator.java

@ -1,6 +1,7 @@
package com.epmet.support.normalizing;
import java.math.BigDecimal;
import java.util.List;
/**
* Double的分值计算
@ -24,6 +25,14 @@ public class DoubleScoreCalculator extends ScoreCalculator {
this.prepare();
}
public DoubleScoreCalculator(List<Double> sourceArray, BigDecimal minScore, BigDecimal maxScore, Correlation correlation) {
this.sourceArrary = sourceArray.toArray();
this.minScore = minScore;
this.maxScore = maxScore;
this.correlation = correlation;
this.prepare();
}
@Override
public BigDecimal getMaxFromSourceArray() {
Double[] doubleSourceArrary = (Double[]) this.sourceArrary;

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/IntegerScoreCalculator.java

@ -1,6 +1,7 @@
package com.epmet.support.normalizing;
import java.math.BigDecimal;
import java.util.List;
/**
* Integer的分值计算
@ -26,6 +27,15 @@ public class IntegerScoreCalculator extends ScoreCalculator {
}
public IntegerScoreCalculator(List<Integer> sourceList, BigDecimal minScore, BigDecimal maxScore, Correlation correlation) {
this.sourceArrary = sourceList.toArray();
this.minScore = minScore;
this.maxScore = maxScore;
this.correlation = correlation;
this.prepare();
System.out.println("最小值:"+minScore+";最大值:"+maxScore);
}
@Override
public BigDecimal getMaxFromSourceArray() {
Integer[] intSourceArrary = (Integer[]) this.sourceArrary;

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreCalculator.java

@ -3,6 +3,8 @@ package com.epmet.support.normalizing;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 所有数据类型计算器的父类实现算法骨架数据类型转换方法则由子类实现
@ -93,6 +95,15 @@ public abstract class ScoreCalculator<T> {
return scores;
}
/**
* 批量归一算法返回List
* @param sourceValues
* @return
*/
public List<BigDecimal> normalize(List<T> sourceValues) {
return sourceValues.stream().map(s -> normalize(s)).collect(Collectors.toList());
}
/**
* 批量归一算法带权重
* @param sourceValues
@ -110,6 +121,15 @@ public abstract class ScoreCalculator<T> {
return scores;
}
/**
* 批量归一算法返回List
* @param sourceValues
* @return
*/
public List<BigDecimal> normalize(List<T> sourceValues, BigDecimal weight) {
return sourceValues.stream().map(s -> normalize(s).multiply(weight)).collect(Collectors.toList());
}
/**
* 校验数组
* @param sourceArray

Loading…
Cancel
Save