|
|
|
@ -414,13 +414,15 @@ public class StatBean extends AbstractComponent {
|
|
|
|
|
*/
|
|
|
|
|
public void attachRatioValue(List<StatItem> statItems, StatQuery statQuery) {
|
|
|
|
|
|
|
|
|
|
int decimalPoint = statQuery.getDecimalPoint();
|
|
|
|
|
|
|
|
|
|
String[] aggregateTypes = statQuery.getAggregateType();
|
|
|
|
|
|
|
|
|
|
for(StatItem statItem : statItems) {
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < aggregateTypes.length ; i++) {
|
|
|
|
|
|
|
|
|
|
if(aggregateTypes[i].startsWith("ratioRef=")) {
|
|
|
|
|
if(aggregateTypes[i].startsWith("ratio=")) {
|
|
|
|
|
|
|
|
|
|
int refIndex = Integer.parseInt(aggregateTypes[i].split("=")[1]);
|
|
|
|
|
|
|
|
|
@ -428,7 +430,10 @@ public class StatBean extends AbstractComponent {
|
|
|
|
|
if(totValue == 0) {
|
|
|
|
|
statItem.getNumberValue()[i] = 0;
|
|
|
|
|
} else {
|
|
|
|
|
statItem.getNumberValue()[i] = statItem.getNumberValue()[i] * 100 / totValue;
|
|
|
|
|
int originalValue = statItem.getNumberValue()[i];
|
|
|
|
|
double ratioValue = originalValue / totValue;
|
|
|
|
|
double percent = ratioValue * 100 * (decimalPoint+1);
|
|
|
|
|
statItem.getNumberValue()[i] = (int) Math.floor(percent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|