|
|
@@ -2,6 +2,7 @@ package com.usoftchina.bi.server.service.chart;
|
|
|
|
|
|
import com.usoftchina.bi.core.base.RepCode;
|
|
|
import com.usoftchina.bi.core.base.RepEntity;
|
|
|
+import com.usoftchina.bi.core.utils.CalculationJudgeUtil;
|
|
|
import com.usoftchina.bi.server.dao.chart.ChartsConfigMapper;
|
|
|
import com.usoftchina.bi.server.dao.chart.ShowChartsMapper;
|
|
|
import com.usoftchina.bi.server.model.bo.Screen;
|
|
|
@@ -49,11 +50,11 @@ public class ShowIndicatorService {
|
|
|
String sort = indicatorConfigInfo.getSort();
|
|
|
String condition = getCondition(filters, indicatorConfigInfo.getxField().getColumnRename(), indicatorConfigInfo.getyField().getColumnRename());
|
|
|
String tableName = chartsUtilService.getSqlStr(token, indicatorConfigInfo.getId(), 0);
|
|
|
- String operate = indicatorConfigInfo.getyField().getShowDataType();
|
|
|
+ String operate = CalculationJudgeUtil.Judge(indicatorConfigInfo.getyField().getShowDataType());
|
|
|
if (ObjectUtils.isEmpty(indicatorConfigInfo.getxField())) {
|
|
|
- fields += StringUtils.isEmpty(operate) ? indicatorConfigInfo.getyField().getColumnRename() + " as \"value\" " : operate + "(" + indicatorConfigInfo.getyField().getColumnRename() + ") as \"value\" ";
|
|
|
+ fields += operate.contains("distinct") ? " count(" + indicatorConfigInfo.getyField().getColumnRename() + ") as \"value\" " : operate + "(" + indicatorConfigInfo.getyField().getColumnRename() + ") as \"value\" ";
|
|
|
}else {
|
|
|
- fields += indicatorConfigInfo.getxField().getColumnRename() + " as \"name\"," + (StringUtils.isEmpty(operate) ? indicatorConfigInfo.getyField().getColumnRename() + " as \"value\" " : operate + "(" + indicatorConfigInfo.getyField().getColumnRename() + ") as \"value\" ");
|
|
|
+ fields += indicatorConfigInfo.getxField().getColumnRename() + " as \"name\"," + (operate.contains("distinct") ? " count(" + indicatorConfigInfo.getyField().getColumnRename() + ") as \"value\" " : operate + "(" + indicatorConfigInfo.getyField().getColumnRename() + ") as \"value\" ");
|
|
|
condition += " group by " + indicatorConfigInfo.getxField().getColumnRename();
|
|
|
}
|
|
|
if (indicatorConfigInfo.getyField().getColumnRename().equalsIgnoreCase(sort)) {
|
|
|
@@ -61,6 +62,9 @@ public class ShowIndicatorService {
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(indicatorConfigInfo.getOtherColumn())) {
|
|
|
fields += "," + String.join(",", indicatorConfigInfo.getOtherColumn());
|
|
|
+ if (operate.contains("distinct")) {
|
|
|
+ condition += "," + indicatorConfigInfo.getyField().getColumnRename();
|
|
|
+ }
|
|
|
condition += "," + String.join(",", indicatorConfigInfo.getOtherColumn());
|
|
|
}
|
|
|
List<Map<String, Object>> indicatorSeriesMapList = showChartsMapper.getIndicatorValue(fields, tableName, condition, sort, indicatorConfigInfo.getRule(), indicatorConfigInfo.getThreshold());
|