zhangjinli 3 years ago
parent 42c8702cd8
commit ab02a1dd11

@ -91,12 +91,12 @@ public class UtilsController {
file.transferTo(dest); file.transferTo(dest);
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
int fileTypeNum = FileTypeUtil.getcontentTypeNum((fileName.substring(fileName.lastIndexOf(".")))); int fileTypeNum = FileTypeUtil.getcontentTypeNum((fileName.substring(fileName.lastIndexOf("."))));
res.put("fileUrl", "/upload/" + newFileName);
res.put("fileName", fileName); res.put("fileName", fileName);
res.put("duration", new MultimediaObject(dest).getInfo().getDuration());
res.put("fileType", FileTypeUtil.getcontentType((fileName.substring(fileName.lastIndexOf("."))))); res.put("fileType", FileTypeUtil.getcontentType((fileName.substring(fileName.lastIndexOf(".")))));
res.put("fileTypeNum", fileTypeNum); res.put("fileTypeNum", fileTypeNum);
if (fileTypeNum == 1) { if (fileTypeNum == 1) {
res.put("fileUrl", "/upload/" + newFileName); res.put("duration", new MultimediaObject(dest).getInfo().getDuration());
} }
return Result.success(res, "上传完成"); return Result.success(res, "上传完成");
} catch (Exception e) { } catch (Exception e) {

@ -30,10 +30,17 @@ public class ExcelUtil {
sheet.autoSizeColumn(0); sheet.autoSizeColumn(0);
// 在sheet中添加标题行// 行数从0开始 // 在sheet中添加标题行// 行数从0开始
Row row = sheet.createRow((int) 0); Row row = sheet.createRow((int) 0);
for (int i = 0; i < array.length; i++) { // for (int i = 0; i < array.length; i++) {
Cell cell = row.createCell(i); // Cell cell = row.createCell(i);
cell.setCellValue(array[i]); // cell.setCellValue(array[i]);
// cell.setCellStyle(titleStyle);
// }
int titleIndex = 0;
for (Object key : list.get(0).keySet()) {
Cell cell = row.createCell(titleIndex);
cell.setCellValue((String) list.get(0).get(key));
cell.setCellStyle(titleStyle); cell.setCellStyle(titleStyle);
titleIndex += 1;
} }
// 数据样式 因为标题和数据样式不同 需要分开设置 不然会覆盖 // 数据样式 因为标题和数据样式不同 需要分开设置 不然会覆盖
CellStyle dataStyle = wb.createCellStyle(); CellStyle dataStyle = wb.createCellStyle();

Loading…
Cancel
Save