Search in sources :

Example 1 with ExcelUtil

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("操作成功");
}
Also used : ExcelUtil(com.albedo.java.common.util.ExcelUtil) UserExcelVo(com.albedo.java.modules.sys.domain.vo.UserExcelVo) BigDecimal(java.math.BigDecimal) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 2 with ExcelUtil

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);
}
Also used : ExcelUtil(com.albedo.java.common.util.ExcelUtil) LogOperateDo(com.albedo.java.modules.sys.domain.LogOperateDo) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 3 with ExcelUtil

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);
}
Also used : JobLogExcelVo(com.albedo.java.modules.quartz.domain.vo.JobLogExcelVo) ExcelUtil(com.albedo.java.common.util.ExcelUtil) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 4 with ExcelUtil

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);
}
Also used : ExcelUtil(com.albedo.java.common.util.ExcelUtil) LogLoginDo(com.albedo.java.modules.sys.domain.LogLoginDo) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) LogOperate(com.albedo.java.common.log.annotation.LogOperate) Operation(io.swagger.v3.oas.annotations.Operation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

LogOperate (com.albedo.java.common.log.annotation.LogOperate)4 ExcelUtil (com.albedo.java.common.util.ExcelUtil)4 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)4 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)3 JobLogExcelVo (com.albedo.java.modules.quartz.domain.vo.JobLogExcelVo)1 LogLoginDo (com.albedo.java.modules.sys.domain.LogLoginDo)1 LogOperateDo (com.albedo.java.modules.sys.domain.LogOperateDo)1 UserExcelVo (com.albedo.java.modules.sys.domain.vo.UserExcelVo)1 Operation (io.swagger.v3.oas.annotations.Operation)1 BigDecimal (java.math.BigDecimal)1