public staticSheetconvertDataListToSheetsa(List<Map<String,Object>> dataList){Workbook workbook =newXSSFWorkbook();Sheet sheet = workbook.createSheet();for(int i =0; i <8; i++){
sheet.createRow(i);}
int rowIndex =8;for(Map<String,Object> data : dataList){Row row = sheet.createRow(rowIndex++);
int cellIndex =0;for(Map.Entry<String,Object> entry : data.entrySet()){Cell cell = row.createCell(cellIndex++);setCellValues(cell, entry.getValue());}}return sheet;}
private staticvoidsetCellValues(Cell cell,Object value){if(value instanceof String){
cell.setCellValue((String) value);}elseif(value instanceof Number){
cell.setCellValue(((Number) value).doubleValue());}elseif(value instanceof Boolean){
cell.setCellValue((Boolean) value);}elseif(value instanceof java.util.Date){
cell.setCellValue((java.util.Date) value);}else{
cell.setCellValue(value !=null? value.toString():"");}}
private ChartSmartVogetChartV63(List<List<String>> getdata,String chartValue){List<JSONObject> list =newArrayList<>();List<String> name =newArrayList<>();// Process the input data and construct the list of JSONObjectsfor(int i =0; i < getdata.size(); i++){List<String> strings = getdata.get(i);JSONObject jsonObject =newJSONObject();for(int i1 =0; i1 < strings.size(); i1++){String s = strings.get(i1);if(org.apache.commons.lang3.ObjectUtils.isNotEmpty(s)&&!s.equals("")){if(i1 ==0){
jsonObject.put("name", s);
name.add(s);}elseif(i1 ==1){
jsonObject.put("value",Double.parseDouble(s));}}}
list.add(jsonObject);}// Parse the chartValue JSON stringJSONObject jsonObject = JSON.parseObject(chartValue);// Update the series dataList<JSONObject> series =(List<JSONObject>) jsonObject.get("series");for(JSONObject jsonObject1 : series){
jsonObject1.put("data", list);}// Handle the legend dataObject legendObject = jsonObject.get("legend");if(legendObject instanceof JSONObject){JSONObject legend =(JSONObject) legendObject;
legend.put("data", name);
jsonObject.put("legend", legend);}else{// If "legend" is not a JSONObject, handle the case appropriately// For example, you might want to initialize it as an empty JSONObjectJSONObject legend =newJSONObject();
legend.put("data", name);
jsonObject.put("legend", legend);}// Update the series data and create the ChartSmartVo object
jsonObject.put("series", series);ChartSmartVo chartSmartVo =newChartSmartVo();
chartSmartVo.setConfigValue(JSON.toJSONString(jsonObject));return chartSmartVo;}