diff --git a/src/main/java/com/msdw/tms/common/utils/R.java b/src/main/java/com/msdw/tms/common/utils/R.java index 4fcc3a4..dc42fcd 100644 --- a/src/main/java/com/msdw/tms/common/utils/R.java +++ b/src/main/java/com/msdw/tms/common/utils/R.java @@ -22,8 +22,8 @@ public class R extends HashMap { private static final long serialVersionUID = 1L; public R() { - put("code", 0); - put("msg", "success"); + put("status", 200); + put("errmessage", "success"); } public static R error() { @@ -36,14 +36,14 @@ public class R extends HashMap { public static R error(int code, String msg) { R r = new R(); - r.put("code", code); - r.put("msg", msg); + r.put("status", code); + r.put("errmessage", msg); return r; } public static R ok(String msg) { R r = new R(); - r.put("msg", msg); + r.put("errmessage", msg); return r; } diff --git a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java index 74d40a1..78e9dad 100644 --- a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java @@ -2,6 +2,7 @@ package com.msdw.tms.service.impl; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -601,22 +602,18 @@ public class QuestionsServiceImpl extends ServiceImpl parse = (List) JSON.parse(record); + + List parse = JSON.parseObject(record, new TypeReference>() { + }); + parse.sort(Comparator.comparing(QuestionsImportFailureVO::getIndex)); -// Collections.sort(parse, new Comparator() { -// @Override -// public int compare(QuestionsImportFailureVO o1, QuestionsImportFailureVO o2) { -// //升序 -// return o1.getIndex().compareTo(o2.getIndex()); -// } -// }); //2.加载模板流数据 org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/试题导入失败数据导出模板.xlsx"); FileInputStream fis = new FileInputStream(resource.getFile()); //3、通过工具类下载文件 - new ExcelExportUtil(QuestionsImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). + new ExcelExportUtil(QuestionsImportFailureVO.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). export(response, fis, parse, "导入失败数据表.xlsx"); }