use of com.albedo.java.common.util.ExcelUtil in project albedo by somowhere.
the class UserResource method uploadData.
/**
* @param dataFile
* @param response
* @return
* @throws Exception
*/
@PostMapping(value = "/upload")
@PreAuthorize("@pms.hasPermission('sys_user_upload')")
@LogOperate(value = "用户管理导入")
public ResponseEntity<Result> uploadData(@RequestParam("uploadFile") MultipartFile dataFile, HttpServletResponse response) throws Exception {
if (dataFile.isEmpty()) {
return ResponseEntityBuilder.buildFail("上传文件为空");
}
ExcelUtil<UserExcelVo> util = new ExcelUtil(UserExcelVo.class);
List<UserExcelVo> dataList = util.importExcel(dataFile.getInputStream());
for (UserExcelVo userExcelVo : dataList) {
if (userExcelVo.getPhone().length() != 11) {
BigDecimal bd = new BigDecimal(userExcelVo.getPhone());
userExcelVo.setPhone(bd.toPlainString());
}
userService.save(userExcelVo);
}
return ResponseEntityBuilder.buildOk("操作成功");
}
use of com.albedo.java.common.util.ExcelUtil in project albedo by somowhere.
the class LogOperateResource method download.
@LogOperate(value = "操作日志导出")
@GetMapping(value = "/download")
@PreAuthorize("@pms.hasPermission('sys_logOperate_export')")
public void download(LogOperateQueryCriteria logOperateQueryCriteria, HttpServletResponse response) {
QueryWrapper wrapper = QueryWrapperUtil.getWrapper(logOperateQueryCriteria);
ExcelUtil<LogOperateDo> util = new ExcelUtil(LogOperateDo.class);
util.exportExcel(logOperateService.list(wrapper), "操作日志", response);
}
use of com.albedo.java.common.util.ExcelUtil in project albedo by somowhere.
the class JobLogResource method download.
@LogOperate(value = "任务日志导出")
@GetMapping(value = "/download")
@PreAuthorize("@pms.hasPermission('quartz_jobLog_export')")
public void download(JobLogQueryCriteria jobLogQueryCriteria, HttpServletResponse response) {
QueryWrapper wrapper = QueryWrapperUtil.getWrapper(jobLogQueryCriteria);
ExcelUtil<JobLogExcelVo> util = new ExcelUtil(JobLogExcelVo.class);
util.exportExcel(jobLogService.findExcelVo(wrapper), "任务调度日志", response);
}
use of com.albedo.java.common.util.ExcelUtil in project albedo by somowhere.
the class LogLoginResource method download.
@LogOperate(value = "登录日志导出")
@Operation(summary = "登录日志导出")
@GetMapping(value = "/download")
@PreAuthorize("@pms.hasPermission('sys_logOperate_export')")
public void download(LogLoginQueryCriteria logOperateQueryCriteria, HttpServletResponse response) {
QueryWrapper wrapper = QueryWrapperUtil.getWrapper(logOperateQueryCriteria);
ExcelUtil<LogLoginDo> util = new ExcelUtil(LogLoginDo.class);
util.exportExcel(service.list(wrapper), "登录日志", response);
}
Aggregations