|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.ibeetl.jlw.web;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
@ -15,6 +16,7 @@ import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
|
import com.ibeetl.admin.core.file.FileService;
|
|
|
|
|
import com.ibeetl.admin.core.service.CorePlatformService;
|
|
|
|
|
import com.ibeetl.admin.core.service.CoreUserService;
|
|
|
|
|
import com.ibeetl.admin.core.util.BeanCopyUtil;
|
|
|
|
|
import com.ibeetl.admin.core.util.PlatformException;
|
|
|
|
|
import com.ibeetl.admin.core.util.TimeTool;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
@ -51,6 +53,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static cn.jlw.token.TokenService.getMap;
|
|
|
|
|
import static cn.jlw.token.TokenService.updateByIds;
|
|
|
|
|
import static com.ibeetl.admin.core.util.ExcelUtil.convertData;
|
|
|
|
|
import static com.ibeetl.admin.core.util.ExcelUtil.write;
|
|
|
|
|
import static com.ibeetl.jlw.web.IpAddressController.ipAddressMap;
|
|
|
|
|
|
|
|
|
@ -2100,6 +2103,39 @@ public class StudentController extends BaseController{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(MODEL + "/export.json")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public void export(StudentQuery condition, @SCoreUser CoreUser coreUser) throws IOException {
|
|
|
|
|
|
|
|
|
|
Assert.isFalse(coreUser.isStudent(), "学生无法访问改接口!");
|
|
|
|
|
|
|
|
|
|
PageQuery<Student> pageQuery = studentService.queryByCondition(condition.getPageQuery());
|
|
|
|
|
|
|
|
|
|
List<Student> list = pageQuery.getList();
|
|
|
|
|
CollectionUtil.emptyIfNull(list).stream().parallel().forEach(item -> {
|
|
|
|
|
String universitySystem = item.getSchoolClass().getOrDefault("universitySystemIdText", "").toString();
|
|
|
|
|
item.set("universitySystemIdText", universitySystem);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/** 构建表头 */
|
|
|
|
|
Map<String, String> header = new LinkedHashMap<>(11);
|
|
|
|
|
header.put("studentName", "学生姓名");
|
|
|
|
|
header.put("studentSn", "学号");
|
|
|
|
|
header.put("universitiesCollegesName", "所属院校");
|
|
|
|
|
header.put("universitySystemIdText", "所属专业");
|
|
|
|
|
header.put("className", "所属班级");
|
|
|
|
|
header.put("studentMobile", "电话");
|
|
|
|
|
header.put("studentEmail", "邮箱");
|
|
|
|
|
header.put("studentWeixinInfo", "微信号");
|
|
|
|
|
header.put("codeFrom", "账号来源");
|
|
|
|
|
header.put("addTime", "创建时间");
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> maps = BeanCopyUtil.baseEntity2MapWithParallel(list);
|
|
|
|
|
|
|
|
|
|
String filename = StrUtil.format("学生列表导出{}.xlsx", DateUtil.now());
|
|
|
|
|
write(response, filename, "Sheet1", header.values(), convertData(header.keySet(), maps));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping(MODEL + "/add.json")
|
|
|
|
|
@Function("student.add")
|
|
|
|
|
@ResponseBody
|
|
|
|
@ -2607,7 +2643,7 @@ public class StudentController extends BaseController{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//导出信息
|
|
|
|
|
@GetMapping(MODEL + "/export.json")
|
|
|
|
|
@GetMapping(MODEL + "/export1.json")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public void export(HttpServletResponse response,StudentQuery studentQuery) {
|
|
|
|
|
HSSFWorkbook workbook = null;
|
|
|
|
|