|
|
@@ -47,22 +47,15 @@ public class DashboardsToChartsUtilService {
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
|
- private int chartId;
|
|
|
-
|
|
|
- private Lock lock = new ReentrantLock();
|
|
|
-
|
|
|
public RepEntity getChartsInDash(ChartsToDashInfo chartsToDashInfo, String token) throws SQLException {
|
|
|
if (StringUtils.isEmpty(token)) {
|
|
|
User user = userService.getUserById(chartsToDashInfo.getDashboardCreatorId()).getData();
|
|
|
LoginInfo loginInfo = new LoginInfo(user.getUserName(), EncryUtil.decryptPassword(user.getPassWord()));
|
|
|
token = userService.login(loginInfo).getData().getToken();
|
|
|
}
|
|
|
- lock.lock();
|
|
|
- try {
|
|
|
- chartId = chartsToDashInfo.getChartId();
|
|
|
- } finally {
|
|
|
- lock.unlock();
|
|
|
- }
|
|
|
+
|
|
|
+ int chartId = chartsToDashInfo.getChartId();
|
|
|
+
|
|
|
//拿到图表配置
|
|
|
ChartsConfigToDash chartsConfigToDash = chartsConfigMapper.getChartConfigToDash(chartId);
|
|
|
if (chartsConfigToDash == null || "".equals(chartsConfigToDash)){
|
|
|
@@ -70,6 +63,7 @@ public class DashboardsToChartsUtilService {
|
|
|
}
|
|
|
String chartType = chartsConfigToDash.getChartType();
|
|
|
String fetchConfig = chartsConfigToDash.getFetchConfig();
|
|
|
+ String styleConfig = chartsConfigToDash.getStyleConfig();
|
|
|
if (fetchConfig == null || "".equals(fetchConfig)){
|
|
|
return new RepEntity(RepCode.Null);
|
|
|
}
|
|
|
@@ -77,27 +71,26 @@ public class DashboardsToChartsUtilService {
|
|
|
//判断图表类型
|
|
|
List<Screen> filters = chartsToDashInfo.getFilters();
|
|
|
if ("Pie".equals(chartType)){
|
|
|
- return getPie(fetchConfig, token, filters);
|
|
|
-
|
|
|
+ return getPie(fetchConfig, token, filters, chartId, styleConfig);
|
|
|
}else if ("Histogram".equals(chartType)){
|
|
|
- return getHistogram(fetchConfig, token, filters);
|
|
|
+ return getHistogram(fetchConfig, token, filters, chartId, styleConfig);
|
|
|
|
|
|
}else if ("Line".equals(chartType)){
|
|
|
- return getLine(fetchConfig, token, filters);
|
|
|
+ return getLine(fetchConfig, token, filters, chartId, styleConfig);
|
|
|
|
|
|
}else if ("population".equals(chartType)){
|
|
|
- return getPopulation(fetchConfig, token, filters);
|
|
|
+ return getPopulation(fetchConfig, token, filters, chartId, styleConfig);
|
|
|
|
|
|
}else if ("individual".equals(chartType)){
|
|
|
- return getIndividual(fetchConfig, token, filters, chartsToDashInfo.getTestPage());
|
|
|
+ return getIndividual(fetchConfig, token, filters, chartsToDashInfo.getTestPage(), chartId, styleConfig);
|
|
|
|
|
|
}else if("scatter".equals(chartType)){
|
|
|
- return getScatter(fetchConfig, token, filters);
|
|
|
+ return getScatter(fetchConfig, token, filters, chartId, styleConfig);
|
|
|
}
|
|
|
return new RepEntity(RepCode.success);
|
|
|
}
|
|
|
|
|
|
- public RepEntity getHistogram(String fetchConfig, String token, List<Screen> filters){
|
|
|
+ public RepEntity getHistogram(String fetchConfig, String token, List<Screen> filters, int chartId, String styleConfig){
|
|
|
HistogramConfigInfo histogramConfigInfo = new HistogramConfigInfo();
|
|
|
try {
|
|
|
histogramConfigInfo = objectMapper.readValue(fetchConfig,HistogramConfigInfo.class);
|
|
|
@@ -105,10 +98,10 @@ public class DashboardsToChartsUtilService {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return showHistogramService.showHistogram(histogramConfigInfo, token, chartId);
|
|
|
+ return showHistogramService.showHistogram(histogramConfigInfo, token, chartId, styleConfig);
|
|
|
}
|
|
|
|
|
|
- public RepEntity getScatter(String fetchConfig, String token, List<Screen> filters){
|
|
|
+ public RepEntity getScatter(String fetchConfig, String token, List<Screen> filters, int chartId, String styleConfig){
|
|
|
ScatterConfigInfo scatterConfigInfo = new ScatterConfigInfo();
|
|
|
try {
|
|
|
scatterConfigInfo = objectMapper.readValue(fetchConfig,ScatterConfigInfo.class);
|
|
|
@@ -116,10 +109,10 @@ public class DashboardsToChartsUtilService {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return showScatterService.showScatter(scatterConfigInfo, token, chartId);
|
|
|
+ return showScatterService.showScatter(scatterConfigInfo, token, chartId, styleConfig);
|
|
|
}
|
|
|
|
|
|
- public RepEntity getLine(String fetchConfig, String token, List<Screen> filters){
|
|
|
+ public RepEntity getLine(String fetchConfig, String token, List<Screen> filters, int chartId, String styleConfig){
|
|
|
LineConfigInfo lineConfigInfo = new LineConfigInfo();
|
|
|
try {
|
|
|
lineConfigInfo = objectMapper.readValue(fetchConfig,LineConfigInfo.class);
|
|
|
@@ -127,10 +120,10 @@ public class DashboardsToChartsUtilService {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return showLineService.showLine(lineConfigInfo, token, chartId);
|
|
|
+ return showLineService.showLine(lineConfigInfo, token, chartId, styleConfig);
|
|
|
}
|
|
|
|
|
|
- public RepEntity getPopulation(String fetchConfig, String token, List<Screen> filters) throws SQLException {
|
|
|
+ public RepEntity getPopulation(String fetchConfig, String token, List<Screen> filters, int chartId, String styleConfig) throws SQLException {
|
|
|
PopulationInfo populationInfo = new PopulationInfo();
|
|
|
try {
|
|
|
populationInfo = objectMapper.readValue(fetchConfig,PopulationInfo.class);
|
|
|
@@ -141,7 +134,7 @@ public class DashboardsToChartsUtilService {
|
|
|
return showPopulationService.showPopulation(populationInfo, token, chartId);
|
|
|
}
|
|
|
|
|
|
- public RepEntity getIndividual(String fetchConfig, String token, List<Screen> filters, TestPage testPage) throws SQLException {
|
|
|
+ public RepEntity getIndividual(String fetchConfig, String token, List<Screen> filters, TestPage testPage, int chartId, String styleConfig) throws SQLException {
|
|
|
IndividualConfigInfo individualConfigInfo = new IndividualConfigInfo();
|
|
|
try {
|
|
|
individualConfigInfo = objectMapper.readValue(fetchConfig,IndividualConfigInfo.class);
|
|
|
@@ -153,7 +146,7 @@ public class DashboardsToChartsUtilService {
|
|
|
return showIndividualService.showIndividual(individualConfigInfo, token, chartId);
|
|
|
}
|
|
|
|
|
|
- public RepEntity getPie(String fetchConfig, String token, List<Screen> filters){
|
|
|
+ public RepEntity getPie(String fetchConfig, String token, List<Screen> filters, int chartId, String styleConfig){
|
|
|
PieConfigInfo pieConfigInfo = new PieConfigInfo();
|
|
|
try {
|
|
|
pieConfigInfo = objectMapper.readValue(fetchConfig,PieConfigInfo.class);
|
|
|
@@ -161,7 +154,7 @@ public class DashboardsToChartsUtilService {
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return showPieService.showPie(pieConfigInfo, token, chartId);
|
|
|
+ return showPieService.showPie(pieConfigInfo, token, chartId, styleConfig);
|
|
|
}
|
|
|
|
|
|
}
|