@ApiOperation("图表渐变主题列表p")
@GetMapping("/theme/getGradients")
public AjaxResult themeList(Integer colorNum) {
List<ChartTheme> chartThemes = redisCache.getCacheObject(CHART_THEME);
for (int i = 0; i < chartThemes.size(); i++) {
ChartTheme chartTheme = chartThemes.get(i);
String themeValue = chartTheme.getThemeValue();
JSONObject jsonObject = JSONObject.parseObject(themeValue);
List<String> colors = (List<String>) jsonObject.get("color");
if (colorNum > colors.size()) {
List<String> gradientColors = ColorUtils.generateGradientColors(colors, colorNum);
jsonObject.put("color", gradientColors);
chartTheme.setThemeValue(JSONObject.toJSONString(jsonObject));
}
}
return AjaxResult.success(chartThemes);
}