refactor(system): 重构系统模块中的导出功能实现
This commit is contained in:
+101
@@ -0,0 +1,101 @@
|
||||
package cn.odboy.util.xlsx;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.idev.excel.EasyExcel;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* EasyExcel 导出增强工具类 (支持普通/分页模式)
|
||||
*
|
||||
* @author https://mp.weixin.qq.com/s/gnrKCUzHg24sBSDp4IyAvg
|
||||
*/
|
||||
public class KitExcelExporter {
|
||||
|
||||
private static int calculateOptimalPageSize(Class<?> clazz) {
|
||||
// 1. 估算单条数据大小 (字节) - 根据业务模型调整逻辑
|
||||
// 保守估计500字节/行
|
||||
long approxBytesPerRow = 500;
|
||||
// 2. 获取当前JVM可用内存 (转成字节)
|
||||
long freeMemoryBytes = Runtime.getRuntime().freeMemory();
|
||||
// 3. 【安全策略】仅使用一部分可用内存 (例如 40%)
|
||||
long safeMemoryToUse = (long) (freeMemoryBytes * 0.4);
|
||||
// 4. 计算建议分页条数
|
||||
int suggestedPageSize = (int) (safeMemoryToUse / approxBytesPerRow);
|
||||
// 5. 设置合理范围 (防止太大或太小)
|
||||
// 限制在1000~10000条/页
|
||||
return Math.max(1000, Math.min(suggestedPageSize, 10000));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页写入 (大数据量首选)
|
||||
*
|
||||
* @param response /
|
||||
* @param fileName 下载文件名
|
||||
* @param dataModel 数据类 (User.class)
|
||||
* @param totalCount 总条数
|
||||
* @param pageSupplier 分页查询逻辑
|
||||
*/
|
||||
public static <T> void exportByPage(HttpServletResponse response, String fileName, Class<T> dataModel, long totalCount, PageQuerySupplier<T> pageSupplier) {
|
||||
int pageSize = calculateOptimalPageSize(dataModel);
|
||||
String sheetName = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN);
|
||||
setupResponse(response, fileName, sheetName);
|
||||
try (OutputStream out = response.getOutputStream()) {
|
||||
KitExcelPageWriteHelper.writeByPage(out, dataModel, sheetName, pageSize, totalCount, pageSupplier);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("导出失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通导出 (小数据量)
|
||||
*
|
||||
* @param response /
|
||||
* @param fileName 下载文件名
|
||||
* @param dataModel 数据类 (User.class)
|
||||
* @param dataList 全量数据List
|
||||
*/
|
||||
public static <T> void exportSimple(HttpServletResponse response, String fileName, Class<T> dataModel, List<T> dataList) {
|
||||
String sheetName = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN);
|
||||
setupResponse(response, fileName, sheetName);
|
||||
try (OutputStream out = response.getOutputStream()) {
|
||||
EasyExcel.write(out, dataModel)
|
||||
.sheet(sheetName)
|
||||
// 全量写入
|
||||
.doWrite(dataList);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("导出失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置响应头
|
||||
*/
|
||||
private static void setupResponse(HttpServletResponse response, String title, String sheetName) {
|
||||
try {
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = URLEncoder.encode(sheetName + "_" + title, StandardCharsets.UTF_8);
|
||||
response.setHeader("Content-disposition",
|
||||
"attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("设置响应头失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询供应商
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface PageQuerySupplier<T> {
|
||||
|
||||
List<T> getPage(long pageNum, long pageSize); // 函数式接口
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package cn.odboy.util.xlsx;
|
||||
|
||||
import cn.idev.excel.EasyExcel;
|
||||
import cn.idev.excel.ExcelWriter;
|
||||
import cn.idev.excel.write.metadata.WriteSheet;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分页写入Excel工具 - 专治各种不服(OOM)
|
||||
*/
|
||||
public class KitExcelPageWriteHelper {
|
||||
|
||||
/**
|
||||
* 执行分页写入
|
||||
*
|
||||
* @param outputStream 输出流 (响应OutputStream)
|
||||
* @param head 数据模型Class (如 User.class)
|
||||
* @param sheetName 表格名称
|
||||
* @param pageSize 【重要】每批次处理条数 (建议 1000~5000)
|
||||
* @param totalCount 总数据量 (用于计算总页数)
|
||||
* @param supplier 分页数据提供器 (你的业务查询逻辑)
|
||||
*/
|
||||
public static <T> void writeByPage(OutputStream outputStream, Class<T> head, String sheetName, long pageSize, long totalCount, KitExcelExporter.PageQuerySupplier<T> supplier) {
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(outputStream, head).build()) {
|
||||
// 默认Sheet
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(sheetName).build();
|
||||
int totalPage = totalCount > 0 ? (int) Math.ceil((double) totalCount / pageSize) : 1;
|
||||
for (int pageNum = 1; pageNum <= totalPage; pageNum++) {
|
||||
List<T> pageData = supplier.getPage(pageNum, pageSize);
|
||||
excelWriter.write(pageData, writeSheet);
|
||||
pageData.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -6,13 +6,13 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.idev.excel.FastExcel;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
|
||||
+1
-12
@@ -15,17 +15,13 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.constant.SystemZhConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateDeptArgs;
|
||||
import cn.odboy.system.dal.model.SystemDeptExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryDeptArgs;
|
||||
import cn.odboy.system.service.SystemDeptService;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
@@ -54,14 +50,7 @@ public class SystemDeptController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dept:list')")
|
||||
public void exportDept(HttpServletResponse response, SystemQueryDeptArgs args) throws Exception {
|
||||
List<SystemDeptTb> systemDeptTbs = systemDeptService.queryAllDeptByArgs(args, false);
|
||||
KitXlsxExportUtil.exportFile(response, "部门数据", systemDeptTbs, SystemDeptExportRowVo.class, (dataObject) -> {
|
||||
SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
return CollUtil.newArrayList(rowVo);
|
||||
});
|
||||
systemDeptService.exportDeptXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询部门")
|
||||
|
||||
+1
-29
@@ -15,22 +15,17 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateDictArgs;
|
||||
import cn.odboy.system.dal.model.SystemDictDetailVo;
|
||||
import cn.odboy.system.dal.model.SystemDictExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryDictArgs;
|
||||
import cn.odboy.system.service.SystemDictDetailService;
|
||||
import cn.odboy.system.service.SystemDictService;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -58,30 +53,7 @@ public class SystemDictController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
public void exportDict(HttpServletResponse response, SystemQueryDictArgs args) throws IOException {
|
||||
List<SystemDictTb> systemDictTbs = systemDictService.queryDictByArgs(args);
|
||||
KitXlsxExportUtil.exportFile(response, "字典数据", systemDictTbs, SystemDictExportRowVo.class, (dataObject) -> {
|
||||
List<SystemDictDetailVo> dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName());
|
||||
if (CollUtil.isEmpty(dictDetails)) {
|
||||
SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVo.setLabel("");
|
||||
rowVo.setValue("");
|
||||
return CollUtil.newArrayList(rowVo);
|
||||
}
|
||||
List<SystemDictExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemDictDetailVo dictDetail : dictDetails) {
|
||||
SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVo.setLabel(dictDetail.getLabel());
|
||||
rowVo.setValue(dictDetail.getValue());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
return rowVos;
|
||||
});
|
||||
systemDictService.exportDictXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
|
||||
+1
-12
@@ -15,20 +15,16 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemJobExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryJobArgs;
|
||||
import cn.odboy.system.service.SystemJobService;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -53,14 +49,7 @@ public class SystemJobController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('job:list')")
|
||||
public void exportJob(HttpServletResponse response, SystemQueryJobArgs args) throws IOException {
|
||||
List<SystemJobTb> systemJobTbs = systemJobService.queryJobByArgs(args);
|
||||
KitXlsxExportUtil.exportFile(response, "岗位数据", systemJobTbs, SystemJobExportRowVo.class, (dataObject) -> {
|
||||
SystemJobExportRowVo rowVo = new SystemJobExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用");
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
return CollUtil.newArrayList(rowVo);
|
||||
});
|
||||
systemJobService.exportJobXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询岗位")
|
||||
|
||||
+1
-8
@@ -15,20 +15,15 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemLocalStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemLocalStorageExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.service.SystemLocalStorageService;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -63,9 +58,7 @@ public class SystemLocalStorageController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public void exportFile(HttpServletResponse response, SystemQueryStorageArgs args) throws IOException {
|
||||
List<SystemLocalStorageTb> systemLocalStorageTbs = localStorageService.queryLocalStorageByArgs(args);
|
||||
KitXlsxExportUtil.exportFile(response, "文件上传记录数据", systemLocalStorageTbs, SystemLocalStorageExportRowVo.class,
|
||||
(dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemLocalStorageExportRowVo.class)));
|
||||
localStorageService.exportLocalStorageXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
|
||||
+1
-16
@@ -15,18 +15,14 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.constant.SystemYesOrNoChConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.model.SystemMenuExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryMenuArgs;
|
||||
import cn.odboy.system.service.SystemMenuService;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
@@ -55,18 +51,7 @@ public class SystemMenuController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public void exportMenu(HttpServletResponse response, SystemQueryMenuArgs args) throws Exception {
|
||||
List<SystemMenuTb> systemMenuTbs = systemMenuService.queryAllMenu(args, false);
|
||||
KitXlsxExportUtil.exportFile(response, "菜单数据", systemMenuTbs, SystemMenuExportRowVo.class, (dataObject -> {
|
||||
SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo();
|
||||
rowVo.setTitle(dataObject.getTitle());
|
||||
rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮");
|
||||
rowVo.setPermission(dataObject.getPermission());
|
||||
rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR);
|
||||
rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
return CollUtil.newArrayList(rowVo);
|
||||
}));
|
||||
systemMenuService.exportMenuXlsx(response, args);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/buildMenus")
|
||||
|
||||
+2
-10
@@ -15,20 +15,14 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.model.SystemUserOnlineExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemUserOnlineVo;
|
||||
import cn.odboy.system.dal.redis.SystemUserOnlineInfoDAO;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -61,10 +55,8 @@ public class SystemOnlineController {
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check()")
|
||||
public void exportOnlineUser(HttpServletResponse response, String username) throws IOException {
|
||||
List<SystemUserOnlineVo> userOnlineVos = systemUserOnlineInfoDAO.queryUserOnlineModelListByUsername(username);
|
||||
KitXlsxExportUtil.exportFile(response, "在线用户数据", userOnlineVos, SystemUserOnlineExportRowVo.class,
|
||||
(dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemUserOnlineExportRowVo.class)));
|
||||
public void exportOnlineUser(HttpServletResponse response, String username) {
|
||||
systemUserOnlineInfoDAO.exportOnlineUserXlsx(response, username);
|
||||
}
|
||||
|
||||
@ApiOperation("踢出用户")
|
||||
|
||||
+1
-8
@@ -15,21 +15,16 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemOssStorageExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemOssStorageVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.service.SystemOssStorageService;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -66,9 +61,7 @@ public class SystemOssStorageController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public void exportFile(HttpServletResponse response, SystemQueryStorageArgs args) throws IOException {
|
||||
List<SystemOssStorageVo> systemOssStorageVos = systemOssStorageService.queryOssStorage(args);
|
||||
KitXlsxExportUtil.exportFile(response, "OSS文件上传记录数据", systemOssStorageVos, SystemOssStorageExportRowVo.class,
|
||||
(dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemOssStorageExportRowVo.class)));
|
||||
systemOssStorageService.exportOssStorageXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
|
||||
+4
-37
@@ -15,22 +15,16 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzLogTb;
|
||||
import cn.odboy.system.dal.model.SystemQuartzJobExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQuartzLogExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateQuartzJobArgs;
|
||||
import cn.odboy.system.service.SystemQuartzJobService;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -67,42 +61,15 @@ public class SystemQuartzJobController {
|
||||
@ApiOperation("导出任务数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public void exportQuartzJob(HttpServletResponse response, SystemQueryQuartzJobArgs args) throws IOException {
|
||||
List<SystemQuartzJobTb> systemQuartzJobTbs = systemQuartzJobService.queryQuartzJobByArgs(args);
|
||||
KitXlsxExportUtil.exportFile(response, "定时任务数据", systemQuartzJobTbs, SystemQuartzJobExportRowVo.class,
|
||||
(dataObject) -> {
|
||||
SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo();
|
||||
rowVo.setJobName(dataObject.getJobName());
|
||||
rowVo.setBeanName(dataObject.getBeanName());
|
||||
rowVo.setMethodName(dataObject.getMethodName());
|
||||
rowVo.setParams(dataObject.getParams());
|
||||
rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中");
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
return CollUtil.newArrayList(rowVo);
|
||||
});
|
||||
public void exportQuartzJob(HttpServletResponse response, SystemQueryQuartzJobArgs args) {
|
||||
systemQuartzJobService.exportQuartzJobXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("导出日志数据")
|
||||
@GetMapping(value = "/logs/download")
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public void exportQuartzJobLog(HttpServletResponse response, SystemQueryQuartzJobArgs args) throws IOException {
|
||||
List<SystemQuartzLogTb> systemQuartzLogTbs = systemQuartzJobService.queryQuartzLogByArgs(args);
|
||||
KitXlsxExportUtil.exportFile(response, "定时任务日志数据", systemQuartzLogTbs, SystemQuartzLogExportRowVo.class,
|
||||
(dataObject) -> {
|
||||
SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo();
|
||||
rowVo.setJobName(dataObject.getJobName());
|
||||
rowVo.setBeanName(dataObject.getBeanName());
|
||||
rowVo.setMethodName(dataObject.getMethodName());
|
||||
rowVo.setParams(dataObject.getParams());
|
||||
rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
rowVo.setExceptionDetail(dataObject.getExceptionDetail());
|
||||
rowVo.setTime(dataObject.getTime());
|
||||
rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败");
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
return CollUtil.newArrayList(rowVo);
|
||||
});
|
||||
public void exportQuartzJobLog(HttpServletResponse response, SystemQueryQuartzJobArgs args) {
|
||||
systemQuartzJobService.exportQuartzLogXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务执行日志")
|
||||
|
||||
+1
-12
@@ -15,17 +15,14 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemRoleExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemRoleVo;
|
||||
import cn.odboy.system.service.SystemRoleService;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -62,15 +59,7 @@ public class SystemRoleController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('role:list')")
|
||||
public void exportRole(HttpServletResponse response, SystemQueryRoleArgs args) throws IOException {
|
||||
List<SystemRoleVo> systemRoleVos = systemRoleService.queryRoleByArgs(args);
|
||||
KitXlsxExportUtil.exportFile(response, "角色数据", systemRoleVos, SystemRoleExportRowVo.class, (dataObject) -> {
|
||||
SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setLevel(dataObject.getLevel());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
return CollUtil.newArrayList(rowVo);
|
||||
});
|
||||
systemRoleService.exportRoleXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("返回全部的角色")
|
||||
|
||||
+2
-23
@@ -15,28 +15,20 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.base.KitSelectOptionVo;
|
||||
import cn.odboy.system.constant.SystemZhConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateUserPasswordArgs;
|
||||
import cn.odboy.system.dal.model.SystemUserExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemUserVo;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.system.service.SystemUserService;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -63,21 +55,8 @@ public class SystemUserController {
|
||||
@ApiOperation("导出用户数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public void exportUserExcel(HttpServletResponse response, SystemQueryUserArgs args) throws IOException {
|
||||
List<SystemUserVo> systemUserVos = systemUserService.queryUserVoByArgs(args);
|
||||
KitXlsxExportUtil.exportFile(response, "用户数据", systemUserVos, SystemUserExportRowVo.class, (dataObject) -> {
|
||||
SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
rowVo.setUsername(dataObject.getUsername());
|
||||
rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setDept(dataObject.getDept().getName());
|
||||
rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setEmail(dataObject.getEmail());
|
||||
rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
rowVo.setMobile(dataObject.getPhone());
|
||||
rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
return CollUtil.newArrayList(rowVo);
|
||||
});
|
||||
public void exportUserExcel(HttpServletResponse response, SystemQueryUserArgs args) {
|
||||
systemUserService.exportUserXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户")
|
||||
|
||||
+1
@@ -9,6 +9,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemDictExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("字典名称")
|
||||
private String name;
|
||||
@ExcelProperty("字典描述")
|
||||
|
||||
+1
@@ -9,6 +9,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemQuartzLogExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("任务名称")
|
||||
private String jobName;
|
||||
@ExcelProperty("Bean名称")
|
||||
|
||||
+1
@@ -9,6 +9,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemRoleExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("角色名称")
|
||||
private String name;
|
||||
@ExcelProperty("角色级别")
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
+12
-2
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.system.dal.redis;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
@@ -12,9 +13,8 @@ import cn.odboy.util.KitDesEncryptUtil;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitIPUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -24,6 +24,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -166,4 +168,12 @@ public class SystemUserOnlineInfoDAO {
|
||||
this.logoutByToken(token);
|
||||
}
|
||||
}
|
||||
|
||||
public void exportOnlineUserXlsx(HttpServletResponse response, String username) {
|
||||
List<SystemUserOnlineVo> userOnlineVos = this.queryUserOnlineModelListByUsername(username);
|
||||
// KitXlsxExportUtil.exportFile(response, "在线用户数据", userOnlineVos, SystemUserOnlineExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemUserOnlineExportRowVo.class)));
|
||||
List<SystemUserOnlineVo> rowVos = BeanUtil.copyToList(userOnlineVos, SystemUserOnlineVo.class);
|
||||
KitExcelExporter.exportSimple(response, "在线用户数据", SystemUserOnlineVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -23,14 +23,17 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import cn.odboy.system.constant.SystemZhConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateDeptArgs;
|
||||
import cn.odboy.system.dal.model.SystemDeptExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemProductLineTreeVo;
|
||||
import cn.odboy.system.dal.model.SystemProductLineVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryDeptArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemDeptMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitClassUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
@@ -43,6 +46,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -464,4 +468,24 @@ public class SystemDeptService {
|
||||
wrapper.eq(SystemDeptTb::getPid, pid);
|
||||
return systemDeptMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
public void exportDeptXlsx(HttpServletResponse response, SystemQueryDeptArgs args) throws Exception {
|
||||
List<SystemDeptTb> systemDeptTbs = this.queryAllDeptByArgs(args, false);
|
||||
// KitXlsxExportUtil.exportFile(response, "部门数据", systemDeptTbs, SystemDeptExportRowVo.class, (dataObject) -> {
|
||||
// SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemDeptExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemDeptTb dataObject : systemDeptTbs) {
|
||||
SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "部门数据", SystemDeptExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+57
@@ -16,17 +16,23 @@
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateDictArgs;
|
||||
import cn.odboy.system.dal.model.SystemDictDetailVo;
|
||||
import cn.odboy.system.dal.model.SystemDictExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryDictArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemDictMapper;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -101,4 +107,55 @@ public class SystemDictService {
|
||||
injectQueryParams(args, wrapper);
|
||||
return systemDictMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
public void exportDictXlsx(HttpServletResponse response, SystemQueryDictArgs args) {
|
||||
List<SystemDictTb> systemDictTbs = this.queryDictByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "字典数据", systemDictTbs, SystemDictExportRowVo.class, (dataObject) -> {
|
||||
// List<SystemDictDetailVo> dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName());
|
||||
// if (CollUtil.isEmpty(dictDetails)) {
|
||||
// SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVo.setLabel("");
|
||||
// rowVo.setValue("");
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// }
|
||||
// List<SystemDictExportRowVo> rowVos = new ArrayList<>();
|
||||
// for (SystemDictDetailVo dictDetail : dictDetails) {
|
||||
// SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVo.setLabel(dictDetail.getLabel());
|
||||
// rowVo.setValue(dictDetail.getValue());
|
||||
// rowVos.add(rowVo);
|
||||
// }
|
||||
// return rowVos;
|
||||
// });
|
||||
List<SystemDictExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemDictTb dataObject : systemDictTbs) {
|
||||
List<SystemDictDetailVo> dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName());
|
||||
if (CollUtil.isEmpty(dictDetails)) {
|
||||
SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVo.setLabel("");
|
||||
rowVo.setValue("");
|
||||
rowVos.add(rowVo);
|
||||
continue;
|
||||
}
|
||||
for (SystemDictDetailVo dictDetail : dictDetails) {
|
||||
SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVo.setLabel(dictDetail.getLabel());
|
||||
rowVo.setValue(dictDetail.getValue());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "字典数据", SystemDictExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -22,13 +22,17 @@ import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemJobExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryJobArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemJobMapper;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -133,4 +137,24 @@ public class SystemJobService {
|
||||
}
|
||||
wrapper.orderByDesc(SystemJobTb::getJobSort, SystemJobTb::getId);
|
||||
}
|
||||
|
||||
public void exportJobXlsx(HttpServletResponse response, SystemQueryJobArgs args) {
|
||||
List<SystemJobTb> systemJobTbs = this.queryJobByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "岗位数据", systemJobTbs, SystemJobExportRowVo.class, (dataObject) -> {
|
||||
// SystemJobExportRowVo rowVo = new SystemJobExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用");
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemJobExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemJobTb dataObject : systemJobTbs) {
|
||||
SystemJobExportRowVo rowVo = new SystemJobExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用");
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "岗位数据", SystemJobExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
@@ -27,15 +28,18 @@ import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.server.core.KitFileLocalUploadHelper;
|
||||
import cn.odboy.system.dal.dataobject.SystemLocalStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemLocalStorageExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemLocalStorageMapper;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -164,4 +168,12 @@ public class SystemLocalStorageService {
|
||||
}
|
||||
return KitSpringBeanHolder.getBean(SystemLocalStorageService.class).uploadFile(null, file);
|
||||
}
|
||||
|
||||
public void exportLocalStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) {
|
||||
List<SystemLocalStorageTb> systemLocalStorageTbs = this.queryLocalStorageByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "文件上传记录数据", systemLocalStorageTbs, SystemLocalStorageExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemLocalStorageExportRowVo.class)));
|
||||
List<SystemLocalStorageExportRowVo> rowVos = BeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class);
|
||||
KitExcelExporter.exportSimple(response, "文件上传记录数据", SystemLocalStorageExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+32
@@ -21,10 +21,12 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.framework.context.KitSpringBeanHolder;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.constant.SystemYesOrNoChConst;
|
||||
import cn.odboy.system.constant.TransferProtocolConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.SystemMenuExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemMenuMetaVo;
|
||||
import cn.odboy.system.dal.model.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryMenuArgs;
|
||||
@@ -33,6 +35,7 @@ import cn.odboy.system.dal.mysql.SystemMenuMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMenuMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitClassUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -44,6 +47,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -464,4 +468,32 @@ public class SystemMenuService {
|
||||
}
|
||||
return systemMenuTbs;
|
||||
}
|
||||
|
||||
public void exportMenuXlsx(HttpServletResponse response, SystemQueryMenuArgs args) throws Exception {
|
||||
List<SystemMenuTb> systemMenuTbs = this.queryAllMenu(args, false);
|
||||
// KitXlsxExportUtil.exportFile(response, "菜单数据", systemMenuTbs, SystemMenuExportRowVo.class, (dataObject -> {
|
||||
// SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo();
|
||||
// rowVo.setTitle(dataObject.getTitle());
|
||||
// rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮");
|
||||
// rowVo.setPermission(dataObject.getPermission());
|
||||
// rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
// rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR);
|
||||
// rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// }));
|
||||
List<SystemMenuExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemMenuTb dataObject : systemMenuTbs) {
|
||||
SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo();
|
||||
rowVo.setTitle(dataObject.getTitle());
|
||||
rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮");
|
||||
rowVo.setPermission(dataObject.getPermission());
|
||||
rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR);
|
||||
rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "菜单数据", SystemMenuExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -21,7 +21,6 @@ import cn.odboy.system.dal.model.SystemOssStorageVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -40,9 +39,9 @@ public interface SystemOssStorageService extends IService<SystemOssStorageTb> {
|
||||
|
||||
List<SystemOssStorageVo> queryOssStorage(SystemQueryStorageArgs args);
|
||||
|
||||
void exportOssStorageExcel(List<SystemOssStorageVo> list, HttpServletResponse response) throws IOException;
|
||||
|
||||
String uploadFile(MultipartFile file);
|
||||
|
||||
void deleteFileByIds(Long[] ids);
|
||||
|
||||
void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args);
|
||||
}
|
||||
|
||||
+69
@@ -25,17 +25,22 @@ import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.redis.KitRedisHelper;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzLogTb;
|
||||
import cn.odboy.system.dal.model.SystemQuartzJobExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQuartzLogExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateQuartzJobArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemQuartzJobMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemQuartzLogMapper;
|
||||
import cn.odboy.system.framework.quartz.QuartzManage;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.quartz.CronExpression;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -274,4 +279,68 @@ public class SystemQuartzJobService {
|
||||
wrapper.eq(SystemQuartzJobTb::getIsPause, 0);
|
||||
return systemQuartzJobMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
public void exportQuartzJobXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) {
|
||||
List<SystemQuartzJobTb> systemQuartzJobTbs = this.queryQuartzJobByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "定时任务数据", systemQuartzJobTbs, SystemQuartzJobExportRowVo.class,
|
||||
// (dataObject) -> {
|
||||
// SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo();
|
||||
// rowVo.setJobName(dataObject.getJobName());
|
||||
// rowVo.setBeanName(dataObject.getBeanName());
|
||||
// rowVo.setMethodName(dataObject.getMethodName());
|
||||
// rowVo.setParams(dataObject.getParams());
|
||||
// rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
// rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中");
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemQuartzJobExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemQuartzJobTb dataObject : systemQuartzJobTbs) {
|
||||
SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo();
|
||||
rowVo.setJobName(dataObject.getJobName());
|
||||
rowVo.setBeanName(dataObject.getBeanName());
|
||||
rowVo.setMethodName(dataObject.getMethodName());
|
||||
rowVo.setParams(dataObject.getParams());
|
||||
rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中");
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "定时任务数据", SystemQuartzJobExportRowVo.class, rowVos);
|
||||
}
|
||||
|
||||
public void exportQuartzLogXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) {
|
||||
List<SystemQuartzLogTb> systemQuartzLogTbs = this.queryQuartzLogByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "定时任务日志数据", systemQuartzLogTbs, SystemQuartzLogExportRowVo.class,
|
||||
// (dataObject) -> {
|
||||
// SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo();
|
||||
// rowVo.setJobName(dataObject.getJobName());
|
||||
// rowVo.setBeanName(dataObject.getBeanName());
|
||||
// rowVo.setMethodName(dataObject.getMethodName());
|
||||
// rowVo.setParams(dataObject.getParams());
|
||||
// rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
// rowVo.setExceptionDetail(dataObject.getExceptionDetail());
|
||||
// rowVo.setTime(dataObject.getTime());
|
||||
// rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败");
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemQuartzLogExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemQuartzLogTb dataObject : systemQuartzLogTbs) {
|
||||
SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo();
|
||||
rowVo.setJobName(dataObject.getJobName());
|
||||
rowVo.setBeanName(dataObject.getBeanName());
|
||||
rowVo.setMethodName(dataObject.getMethodName());
|
||||
rowVo.setParams(dataObject.getParams());
|
||||
rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
rowVo.setExceptionDetail(dataObject.getExceptionDetail());
|
||||
rowVo.setTime(dataObject.getTime());
|
||||
rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败");
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "定时任务日志数据", SystemQuartzLogExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -28,17 +28,21 @@ import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemRoleCodeVo;
|
||||
import cn.odboy.system.dal.model.SystemRoleExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemRoleVo;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -271,4 +275,26 @@ public class SystemRoleService {
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
||||
public void exportRoleXlsx(HttpServletResponse response, SystemQueryRoleArgs args) {
|
||||
List<SystemRoleVo> systemRoleVos = this.queryRoleByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "角色数据", systemRoleVos, SystemRoleExportRowVo.class, (dataObject) -> {
|
||||
// SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setLevel(dataObject.getLevel());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemRoleExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemRoleVo dataObject : systemRoleVos) {
|
||||
SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setLevel(dataObject.getLevel());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "部门数据", SystemRoleExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+72
-11
@@ -26,6 +26,7 @@ import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.server.core.KitFileLocalUploadHelper;
|
||||
import cn.odboy.system.constant.SystemCaptchaBizEnum;
|
||||
import cn.odboy.system.constant.SystemZhConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
@@ -34,6 +35,7 @@ import cn.odboy.system.dal.dataobject.SystemUserRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateUserPasswordArgs;
|
||||
import cn.odboy.system.dal.model.SystemUserExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemUserVo;
|
||||
import cn.odboy.system.dal.mysql.SystemDeptMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemJobMapper;
|
||||
@@ -47,10 +49,12 @@ import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.KitRsaEncryptUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -59,6 +63,7 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -348,18 +353,23 @@ public class SystemUserService {
|
||||
return KitPageUtil.toPage(userVos, userPage.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部不分页
|
||||
*
|
||||
* @param args 条件
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemUserVo> queryUserVoByArgs(SystemQueryUserArgs args) {
|
||||
// 查询用户基本信息
|
||||
// /**
|
||||
// * 查询全部不分页
|
||||
// *
|
||||
// * @param args 条件
|
||||
// * @return /
|
||||
// */
|
||||
// public List<SystemUserVo> queryUserVoByArgs(SystemQueryUserArgs args) {
|
||||
// // 查询用户基本信息
|
||||
// LambdaQueryWrapper<SystemUserTb> wrapper = buildUserQueryWrapper(args);
|
||||
// List<SystemUserTb> users = systemUserMapper.selectList(wrapper);
|
||||
// // 转换为SystemUserVo并关联查询
|
||||
// return users.stream().map(this::convertToUserVo).collect(Collectors.toList());
|
||||
// }
|
||||
|
||||
public long countUserByArgs(SystemQueryUserArgs args) {
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = buildUserQueryWrapper(args);
|
||||
List<SystemUserTb> users = systemUserMapper.selectList(wrapper);
|
||||
// 转换为SystemUserVo并关联查询
|
||||
return users.stream().map(this::convertToUserVo).collect(Collectors.toList());
|
||||
return systemUserMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -544,4 +554,55 @@ public class SystemUserService {
|
||||
}
|
||||
return KitPageUtil.emptyData();
|
||||
}
|
||||
|
||||
public void exportUserXlsx(HttpServletResponse response, SystemQueryUserArgs args) {
|
||||
// List<SystemUserVo> systemUserVos = systemUserService.queryUserVoByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "用户数据", systemUserVos, SystemUserExportRowVo.class, (dataObject) -> {
|
||||
// SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
// rowVo.setUsername(dataObject.getUsername());
|
||||
// rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setDept(dataObject.getDept().getName());
|
||||
// rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setEmail(dataObject.getEmail());
|
||||
// rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setMobile(dataObject.getPhone());
|
||||
// rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
// List<SystemUserExportRowVo> rowVos = new ArrayList<>();
|
||||
// for (SystemUserVo dataObject : systemUserVos) {
|
||||
// SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
// rowVo.setUsername(dataObject.getUsername());
|
||||
// rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setDept(dataObject.getDept().getName());
|
||||
// rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setEmail(dataObject.getEmail());
|
||||
// rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setMobile(dataObject.getPhone());
|
||||
// rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVos.add(rowVo);
|
||||
// }
|
||||
// KitExcelExporter.exportSimple(response, "用户数据", SystemUserExportRowVo.class, rowVos);
|
||||
long totalCount = this.countUserByArgs(args);
|
||||
KitExcelExporter.exportByPage(response, "用户数据", SystemUserExportRowVo.class, totalCount, (long pageNum, long pageSize) -> {
|
||||
KitPageResult<SystemUserVo> pageResult = this.searchUserByArgs(args, new Page<>(pageNum, pageSize));
|
||||
List<SystemUserExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemUserVo dataObject : pageResult.getContent()) {
|
||||
SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
rowVo.setUsername(dataObject.getUsername());
|
||||
rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setDept(dataObject.getDept().getName());
|
||||
rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setEmail(dataObject.getEmail());
|
||||
rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
rowVo.setMobile(dataObject.getPhone());
|
||||
rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
return rowVos;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+11
-23
@@ -24,6 +24,7 @@ import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.properties.model.StorageOSSModel;
|
||||
import cn.odboy.framework.server.core.KitFileLocalUploadHelper;
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemOssStorageExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemOssStorageVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemOssStorageMapper;
|
||||
@@ -32,16 +33,13 @@ import cn.odboy.system.service.SystemOssStorageService;
|
||||
import cn.odboy.util.KitDateUtil;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -106,25 +104,6 @@ public class SystemMinioStorageServiceImpl extends ServiceImpl<SystemOssStorageM
|
||||
return searchOssStorage(args, page).getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportOssStorageExcel(List<SystemOssStorageVo> ossStorages, HttpServletResponse response)
|
||||
throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemOssStorageVo ossStorage : ossStorages) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("服务类型", ossStorage.getServiceType());
|
||||
map.put("服务地址", ossStorage.getEndpoint());
|
||||
map.put("存储桶名称", ossStorage.getBucketName());
|
||||
map.put("文件名称", ossStorage.getFileName());
|
||||
map.put("文件大小", ossStorage.getFileSizeDesc());
|
||||
map.put("文件类型", ossStorage.getFileMime());
|
||||
map.put("创建人", ossStorage.getCreateBy());
|
||||
map.put("创建日期", ossStorage.getCreateTime());
|
||||
list.add(map);
|
||||
}
|
||||
KitFileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String uploadFile(MultipartFile file) {
|
||||
@@ -174,6 +153,15 @@ public class SystemMinioStorageServiceImpl extends ServiceImpl<SystemOssStorageM
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) {
|
||||
List<SystemOssStorageVo> systemOssStorageVos = this.queryOssStorage(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "OSS文件上传记录数据", systemOssStorageVos, SystemOssStorageExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemOssStorageExportRowVo.class)));
|
||||
List<SystemOssStorageExportRowVo> rowVos = BeanUtil.copyToList(systemOssStorageVos, SystemOssStorageExportRowVo.class);
|
||||
KitExcelExporter.exportSimple(response, "OSS文件上传记录数据", SystemOssStorageExportRowVo.class, rowVos);
|
||||
}
|
||||
|
||||
private SystemOssStorageTb getOssStorageByMd5(String md5) {
|
||||
return lambdaQuery().eq(SystemOssStorageTb::getFileMd5, md5).one();
|
||||
}
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
package cn.odboy.system.constant;
|
||||
|
||||
public interface SystemYesOrNoChConst {
|
||||
|
||||
String YES_STR = "是";
|
||||
String NO_STR = "否";
|
||||
}
|
||||
|
||||
+1
-21
@@ -17,17 +17,13 @@ package cn.odboy.system.controller;
|
||||
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.constant.SystemZhConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateDeptArgs;
|
||||
import cn.odboy.system.dal.model.SystemDeptExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryDeptArgs;
|
||||
import cn.odboy.system.service.SystemDeptService;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -54,23 +50,7 @@ public class SystemDeptController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dept:list')")
|
||||
public void exportDept(HttpServletResponse response, SystemQueryDeptArgs args) throws Exception {
|
||||
List<SystemDeptTb> systemDeptTbs = systemDeptService.queryAllDeptByArgs(args, false);
|
||||
// KitXlsxExportUtil.exportFile(response, "部门数据", systemDeptTbs, SystemDeptExportRowVo.class, (dataObject) -> {
|
||||
// SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemDeptExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemDeptTb dataObject : systemDeptTbs) {
|
||||
SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "部门数据", SystemDeptExportRowVo.class, rowVos);
|
||||
systemDeptService.exportDeptXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询部门")
|
||||
|
||||
+1
-53
@@ -15,22 +15,17 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateDictArgs;
|
||||
import cn.odboy.system.dal.model.SystemDictDetailVo;
|
||||
import cn.odboy.system.dal.model.SystemDictExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryDictArgs;
|
||||
import cn.odboy.system.service.SystemDictDetailService;
|
||||
import cn.odboy.system.service.SystemDictService;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -58,54 +53,7 @@ public class SystemDictController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
public void exportDict(HttpServletResponse response, SystemQueryDictArgs args) throws IOException {
|
||||
List<SystemDictTb> systemDictTbs = systemDictService.queryDictByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "字典数据", systemDictTbs, SystemDictExportRowVo.class, (dataObject) -> {
|
||||
// List<SystemDictDetailVo> dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName());
|
||||
// if (CollUtil.isEmpty(dictDetails)) {
|
||||
// SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVo.setLabel("");
|
||||
// rowVo.setValue("");
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// }
|
||||
// List<SystemDictExportRowVo> rowVos = new ArrayList<>();
|
||||
// for (SystemDictDetailVo dictDetail : dictDetails) {
|
||||
// SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVo.setLabel(dictDetail.getLabel());
|
||||
// rowVo.setValue(dictDetail.getValue());
|
||||
// rowVos.add(rowVo);
|
||||
// }
|
||||
// return rowVos;
|
||||
// });
|
||||
List<SystemDictExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemDictTb dataObject : systemDictTbs) {
|
||||
List<SystemDictDetailVo> dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName());
|
||||
if (CollUtil.isEmpty(dictDetails)) {
|
||||
SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVo.setLabel("");
|
||||
rowVo.setValue("");
|
||||
rowVos.add(rowVo);
|
||||
continue;
|
||||
}
|
||||
for (SystemDictDetailVo dictDetail : dictDetails) {
|
||||
SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVo.setLabel(dictDetail.getLabel());
|
||||
rowVo.setValue(dictDetail.getValue());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "字典数据", SystemDictExportRowVo.class, rowVos);
|
||||
systemDictService.exportDictXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
|
||||
+1
-21
@@ -19,16 +19,12 @@ import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemJobExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryJobArgs;
|
||||
import cn.odboy.system.service.SystemJobService;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -53,23 +49,7 @@ public class SystemJobController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('job:list')")
|
||||
public void exportJob(HttpServletResponse response, SystemQueryJobArgs args) throws IOException {
|
||||
List<SystemJobTb> systemJobTbs = systemJobService.queryJobByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "岗位数据", systemJobTbs, SystemJobExportRowVo.class, (dataObject) -> {
|
||||
// SystemJobExportRowVo rowVo = new SystemJobExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用");
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemJobExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemJobTb dataObject : systemJobTbs) {
|
||||
SystemJobExportRowVo rowVo = new SystemJobExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用");
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "岗位数据", SystemJobExportRowVo.class, rowVos);
|
||||
systemJobService.exportJobXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询岗位")
|
||||
|
||||
+1
-9
@@ -15,19 +15,15 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemLocalStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemLocalStorageExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.service.SystemLocalStorageService;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -62,11 +58,7 @@ public class SystemLocalStorageController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public void exportFile(HttpServletResponse response, SystemQueryStorageArgs args) throws IOException {
|
||||
List<SystemLocalStorageTb> systemLocalStorageTbs = localStorageService.queryLocalStorageByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "文件上传记录数据", systemLocalStorageTbs, SystemLocalStorageExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemLocalStorageExportRowVo.class)));
|
||||
List<SystemLocalStorageExportRowVo> rowVos = BeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class);
|
||||
KitExcelExporter.exportSimple(response, "文件上传记录数据", SystemLocalStorageExportRowVo.class, rowVos);
|
||||
localStorageService.exportLocalStorageXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
|
||||
+1
-29
@@ -18,17 +18,13 @@ package cn.odboy.system.controller;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.constant.SystemYesOrNoChConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.model.SystemMenuExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryMenuArgs;
|
||||
import cn.odboy.system.service.SystemMenuService;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -55,31 +51,7 @@ public class SystemMenuController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public void exportMenu(HttpServletResponse response, SystemQueryMenuArgs args) throws Exception {
|
||||
List<SystemMenuTb> systemMenuTbs = systemMenuService.queryAllMenu(args, false);
|
||||
// KitXlsxExportUtil.exportFile(response, "菜单数据", systemMenuTbs, SystemMenuExportRowVo.class, (dataObject -> {
|
||||
// SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo();
|
||||
// rowVo.setTitle(dataObject.getTitle());
|
||||
// rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮");
|
||||
// rowVo.setPermission(dataObject.getPermission());
|
||||
// rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
// rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR);
|
||||
// rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// }));
|
||||
List<SystemMenuExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemMenuTb dataObject : systemMenuTbs) {
|
||||
SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo();
|
||||
rowVo.setTitle(dataObject.getTitle());
|
||||
rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮");
|
||||
rowVo.setPermission(dataObject.getPermission());
|
||||
rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR);
|
||||
rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "菜单数据", SystemMenuExportRowVo.class, rowVos);
|
||||
systemMenuService.exportMenuXlsx(response, args);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/buildMenus")
|
||||
|
||||
+2
-14
@@ -15,22 +15,14 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.model.SystemLocalStorageExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemUserOnlineExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemUserOnlineVo;
|
||||
import cn.odboy.system.dal.redis.SystemUserOnlineInfoDAO;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -63,12 +55,8 @@ public class SystemOnlineController {
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check()")
|
||||
public void exportOnlineUser(HttpServletResponse response, String username) throws IOException {
|
||||
List<SystemUserOnlineVo> userOnlineVos = systemUserOnlineInfoDAO.queryUserOnlineModelListByUsername(username);
|
||||
// KitXlsxExportUtil.exportFile(response, "在线用户数据", userOnlineVos, SystemUserOnlineExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemUserOnlineExportRowVo.class)));
|
||||
List<SystemUserOnlineVo> rowVos = BeanUtil.copyToList(userOnlineVos, SystemUserOnlineVo.class);
|
||||
KitExcelExporter.exportSimple(response, "在线用户数据", SystemUserOnlineVo.class, rowVos);
|
||||
public void exportOnlineUser(HttpServletResponse response, String username) {
|
||||
systemUserOnlineInfoDAO.exportOnlineUserXlsx(response, username);
|
||||
}
|
||||
|
||||
@ApiOperation("踢出用户")
|
||||
|
||||
+1
-12
@@ -15,23 +15,16 @@
|
||||
*/
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemOssStorageExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemOssStorageVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.dal.model.SystemUserOnlineVo;
|
||||
import cn.odboy.system.service.SystemOssStorageService;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import cn.odboy.util.xlsx.KitXlsxExportUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -68,11 +61,7 @@ public class SystemOssStorageController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public void exportFile(HttpServletResponse response, SystemQueryStorageArgs args) throws IOException {
|
||||
List<SystemOssStorageVo> systemOssStorageVos = systemOssStorageService.queryOssStorage(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "OSS文件上传记录数据", systemOssStorageVos, SystemOssStorageExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemOssStorageExportRowVo.class)));
|
||||
List<SystemOssStorageExportRowVo> rowVos = BeanUtil.copyToList(systemOssStorageVos, SystemOssStorageExportRowVo.class);
|
||||
KitExcelExporter.exportSimple(response, "OSS文件上传记录数据", SystemOssStorageExportRowVo.class, rowVos);
|
||||
systemOssStorageService.exportOssStorageXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
|
||||
+4
-66
@@ -19,18 +19,12 @@ import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzLogTb;
|
||||
import cn.odboy.system.dal.model.SystemQuartzJobExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQuartzLogExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateQuartzJobArgs;
|
||||
import cn.odboy.system.service.SystemQuartzJobService;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -67,71 +61,15 @@ public class SystemQuartzJobController {
|
||||
@ApiOperation("导出任务数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public void exportQuartzJob(HttpServletResponse response, SystemQueryQuartzJobArgs args) throws IOException {
|
||||
List<SystemQuartzJobTb> systemQuartzJobTbs = systemQuartzJobService.queryQuartzJobByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "定时任务数据", systemQuartzJobTbs, SystemQuartzJobExportRowVo.class,
|
||||
// (dataObject) -> {
|
||||
// SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo();
|
||||
// rowVo.setJobName(dataObject.getJobName());
|
||||
// rowVo.setBeanName(dataObject.getBeanName());
|
||||
// rowVo.setMethodName(dataObject.getMethodName());
|
||||
// rowVo.setParams(dataObject.getParams());
|
||||
// rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
// rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中");
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemQuartzJobExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemQuartzJobTb dataObject : systemQuartzJobTbs) {
|
||||
SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo();
|
||||
rowVo.setJobName(dataObject.getJobName());
|
||||
rowVo.setBeanName(dataObject.getBeanName());
|
||||
rowVo.setMethodName(dataObject.getMethodName());
|
||||
rowVo.setParams(dataObject.getParams());
|
||||
rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中");
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "定时任务数据", SystemQuartzJobExportRowVo.class, rowVos);
|
||||
public void exportQuartzJob(HttpServletResponse response, SystemQueryQuartzJobArgs args) {
|
||||
systemQuartzJobService.exportQuartzJobXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("导出日志数据")
|
||||
@GetMapping(value = "/logs/download")
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public void exportQuartzJobLog(HttpServletResponse response, SystemQueryQuartzJobArgs args) throws IOException {
|
||||
List<SystemQuartzLogTb> systemQuartzLogTbs = systemQuartzJobService.queryQuartzLogByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "定时任务日志数据", systemQuartzLogTbs, SystemQuartzLogExportRowVo.class,
|
||||
// (dataObject) -> {
|
||||
// SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo();
|
||||
// rowVo.setJobName(dataObject.getJobName());
|
||||
// rowVo.setBeanName(dataObject.getBeanName());
|
||||
// rowVo.setMethodName(dataObject.getMethodName());
|
||||
// rowVo.setParams(dataObject.getParams());
|
||||
// rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
// rowVo.setExceptionDetail(dataObject.getExceptionDetail());
|
||||
// rowVo.setTime(dataObject.getTime());
|
||||
// rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败");
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemQuartzLogExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemQuartzLogTb dataObject : systemQuartzLogTbs) {
|
||||
SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo();
|
||||
rowVo.setJobName(dataObject.getJobName());
|
||||
rowVo.setBeanName(dataObject.getBeanName());
|
||||
rowVo.setMethodName(dataObject.getMethodName());
|
||||
rowVo.setParams(dataObject.getParams());
|
||||
rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
rowVo.setExceptionDetail(dataObject.getExceptionDetail());
|
||||
rowVo.setTime(dataObject.getTime());
|
||||
rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败");
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "定时任务日志数据", SystemQuartzLogExportRowVo.class, rowVos);
|
||||
public void exportQuartzJobLog(HttpServletResponse response, SystemQueryQuartzJobArgs args) {
|
||||
systemQuartzJobService.exportQuartzLogXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务执行日志")
|
||||
|
||||
+1
-22
@@ -21,15 +21,12 @@ import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemRoleExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemRoleVo;
|
||||
import cn.odboy.system.service.SystemRoleService;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -62,25 +59,7 @@ public class SystemRoleController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('role:list')")
|
||||
public void exportRole(HttpServletResponse response, SystemQueryRoleArgs args) throws IOException {
|
||||
List<SystemRoleVo> systemRoleVos = systemRoleService.queryRoleByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "角色数据", systemRoleVos, SystemRoleExportRowVo.class, (dataObject) -> {
|
||||
// SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setLevel(dataObject.getLevel());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemRoleExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemRoleVo dataObject : systemRoleVos) {
|
||||
SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setLevel(dataObject.getLevel());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "部门数据", SystemRoleExportRowVo.class, rowVos);
|
||||
systemRoleService.exportRoleXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("返回全部的角色")
|
||||
|
||||
+1
-55
@@ -18,24 +18,17 @@ package cn.odboy.system.controller;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.base.KitSelectOptionVo;
|
||||
import cn.odboy.system.constant.SystemZhConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateUserPasswordArgs;
|
||||
import cn.odboy.system.dal.model.SystemUserExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemUserVo;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.system.service.SystemUserService;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -63,54 +56,7 @@ public class SystemUserController {
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public void exportUserExcel(HttpServletResponse response, SystemQueryUserArgs args) {
|
||||
// List<SystemUserVo> systemUserVos = systemUserService.queryUserVoByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "用户数据", systemUserVos, SystemUserExportRowVo.class, (dataObject) -> {
|
||||
// SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
// rowVo.setUsername(dataObject.getUsername());
|
||||
// rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setDept(dataObject.getDept().getName());
|
||||
// rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setEmail(dataObject.getEmail());
|
||||
// rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setMobile(dataObject.getPhone());
|
||||
// rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
// List<SystemUserExportRowVo> rowVos = new ArrayList<>();
|
||||
// for (SystemUserVo dataObject : systemUserVos) {
|
||||
// SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
// rowVo.setUsername(dataObject.getUsername());
|
||||
// rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setDept(dataObject.getDept().getName());
|
||||
// rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setEmail(dataObject.getEmail());
|
||||
// rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setMobile(dataObject.getPhone());
|
||||
// rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVos.add(rowVo);
|
||||
// }
|
||||
// KitExcelExporter.exportSimple(response, "用户数据", SystemUserExportRowVo.class, rowVos);
|
||||
long totalCount = systemUserService.countUserByArgs(args);
|
||||
KitExcelExporter.exportByPage(response, "用户数据", SystemUserExportRowVo.class, totalCount, (long pageNum, long pageSize) -> {
|
||||
KitPageResult<SystemUserVo> pageResult = systemUserService.searchUserByArgs(args, new Page<>(pageNum, pageSize));
|
||||
List<SystemUserExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemUserVo dataObject : pageResult.getContent()) {
|
||||
SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
rowVo.setUsername(dataObject.getUsername());
|
||||
rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setDept(dataObject.getDept().getName());
|
||||
rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setEmail(dataObject.getEmail());
|
||||
rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
rowVo.setMobile(dataObject.getPhone());
|
||||
rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
return rowVos;
|
||||
});
|
||||
systemUserService.exportUserXlsx(response, args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户")
|
||||
|
||||
+1
@@ -9,6 +9,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemDictExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("字典名称")
|
||||
private String name;
|
||||
@ExcelProperty("字典描述")
|
||||
|
||||
+1
@@ -9,6 +9,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemQuartzLogExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("任务名称")
|
||||
private String jobName;
|
||||
@ExcelProperty("Bean名称")
|
||||
|
||||
+1
@@ -9,6 +9,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemRoleExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("角色名称")
|
||||
private String name;
|
||||
@ExcelProperty("角色级别")
|
||||
|
||||
-1
@@ -3,7 +3,6 @@ package cn.odboy.system.dal.model;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
+10
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.system.dal.redis;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
@@ -12,6 +13,7 @@ import cn.odboy.util.KitDesEncryptUtil;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitIPUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -166,4 +168,12 @@ public class SystemUserOnlineInfoDAO {
|
||||
this.logoutByToken(token);
|
||||
}
|
||||
}
|
||||
|
||||
public void exportOnlineUserXlsx(HttpServletResponse response, String username) {
|
||||
List<SystemUserOnlineVo> userOnlineVos = this.queryUserOnlineModelListByUsername(username);
|
||||
// KitXlsxExportUtil.exportFile(response, "在线用户数据", userOnlineVos, SystemUserOnlineExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemUserOnlineExportRowVo.class)));
|
||||
List<SystemUserOnlineVo> rowVos = BeanUtil.copyToList(userOnlineVos, SystemUserOnlineVo.class);
|
||||
KitExcelExporter.exportSimple(response, "在线用户数据", SystemUserOnlineVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+24
@@ -23,14 +23,17 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import cn.odboy.system.constant.SystemZhConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateDeptArgs;
|
||||
import cn.odboy.system.dal.model.SystemDeptExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemProductLineTreeVo;
|
||||
import cn.odboy.system.dal.model.SystemProductLineVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryDeptArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemDeptMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitClassUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
@@ -43,6 +46,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -464,4 +468,24 @@ public class SystemDeptService {
|
||||
wrapper.eq(SystemDeptTb::getPid, pid);
|
||||
return systemDeptMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
public void exportDeptXlsx(HttpServletResponse response, SystemQueryDeptArgs args) throws Exception {
|
||||
List<SystemDeptTb> systemDeptTbs = this.queryAllDeptByArgs(args, false);
|
||||
// KitXlsxExportUtil.exportFile(response, "部门数据", systemDeptTbs, SystemDeptExportRowVo.class, (dataObject) -> {
|
||||
// SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemDeptExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemDeptTb dataObject : systemDeptTbs) {
|
||||
SystemDeptExportRowVo rowVo = new SystemDeptExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setEnabled(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "部门数据", SystemDeptExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+57
@@ -16,17 +16,23 @@
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateDictArgs;
|
||||
import cn.odboy.system.dal.model.SystemDictDetailVo;
|
||||
import cn.odboy.system.dal.model.SystemDictExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryDictArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemDictMapper;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -101,4 +107,55 @@ public class SystemDictService {
|
||||
injectQueryParams(args, wrapper);
|
||||
return systemDictMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
public void exportDictXlsx(HttpServletResponse response, SystemQueryDictArgs args) {
|
||||
List<SystemDictTb> systemDictTbs = this.queryDictByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "字典数据", systemDictTbs, SystemDictExportRowVo.class, (dataObject) -> {
|
||||
// List<SystemDictDetailVo> dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName());
|
||||
// if (CollUtil.isEmpty(dictDetails)) {
|
||||
// SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVo.setLabel("");
|
||||
// rowVo.setValue("");
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// }
|
||||
// List<SystemDictExportRowVo> rowVos = new ArrayList<>();
|
||||
// for (SystemDictDetailVo dictDetail : dictDetails) {
|
||||
// SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVo.setLabel(dictDetail.getLabel());
|
||||
// rowVo.setValue(dictDetail.getValue());
|
||||
// rowVos.add(rowVo);
|
||||
// }
|
||||
// return rowVos;
|
||||
// });
|
||||
List<SystemDictExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemDictTb dataObject : systemDictTbs) {
|
||||
List<SystemDictDetailVo> dictDetails = systemDictDetailService.listDictDetailByName(dataObject.getName());
|
||||
if (CollUtil.isEmpty(dictDetails)) {
|
||||
SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVo.setLabel("");
|
||||
rowVo.setValue("");
|
||||
rowVos.add(rowVo);
|
||||
continue;
|
||||
}
|
||||
for (SystemDictDetailVo dictDetail : dictDetails) {
|
||||
SystemDictExportRowVo rowVo = new SystemDictExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVo.setLabel(dictDetail.getLabel());
|
||||
rowVo.setValue(dictDetail.getValue());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "字典数据", SystemDictExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+22
-4
@@ -22,17 +22,15 @@ import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemJobExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryJobArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemJobMapper;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -139,4 +137,24 @@ public class SystemJobService {
|
||||
}
|
||||
wrapper.orderByDesc(SystemJobTb::getJobSort, SystemJobTb::getId);
|
||||
}
|
||||
|
||||
public void exportJobXlsx(HttpServletResponse response, SystemQueryJobArgs args) {
|
||||
List<SystemJobTb> systemJobTbs = this.queryJobByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "岗位数据", systemJobTbs, SystemJobExportRowVo.class, (dataObject) -> {
|
||||
// SystemJobExportRowVo rowVo = new SystemJobExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用");
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemJobExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemJobTb dataObject : systemJobTbs) {
|
||||
SystemJobExportRowVo rowVo = new SystemJobExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setEnabled(dataObject.getEnabled() ? "启用" : "停用");
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "岗位数据", SystemJobExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-4
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
@@ -27,19 +28,17 @@ import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.server.core.KitFileLocalUploadHelper;
|
||||
import cn.odboy.system.dal.dataobject.SystemLocalStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemLocalStorageExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemLocalStorageMapper;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -169,4 +168,12 @@ public class SystemLocalStorageService {
|
||||
}
|
||||
return KitSpringBeanHolder.getBean(SystemLocalStorageService.class).uploadFile(null, file);
|
||||
}
|
||||
|
||||
public void exportLocalStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) {
|
||||
List<SystemLocalStorageTb> systemLocalStorageTbs = this.queryLocalStorageByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "文件上传记录数据", systemLocalStorageTbs, SystemLocalStorageExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemLocalStorageExportRowVo.class)));
|
||||
List<SystemLocalStorageExportRowVo> rowVos = BeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class);
|
||||
KitExcelExporter.exportSimple(response, "文件上传记录数据", SystemLocalStorageExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+32
@@ -21,10 +21,12 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.framework.context.KitSpringBeanHolder;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.constant.SystemYesOrNoChConst;
|
||||
import cn.odboy.system.constant.TransferProtocolConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.SystemMenuExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemMenuMetaVo;
|
||||
import cn.odboy.system.dal.model.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryMenuArgs;
|
||||
@@ -33,6 +35,7 @@ import cn.odboy.system.dal.mysql.SystemMenuMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMenuMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitClassUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -44,6 +47,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -464,4 +468,32 @@ public class SystemMenuService {
|
||||
}
|
||||
return systemMenuTbs;
|
||||
}
|
||||
|
||||
public void exportMenuXlsx(HttpServletResponse response, SystemQueryMenuArgs args) throws Exception {
|
||||
List<SystemMenuTb> systemMenuTbs = this.queryAllMenu(args, false);
|
||||
// KitXlsxExportUtil.exportFile(response, "菜单数据", systemMenuTbs, SystemMenuExportRowVo.class, (dataObject -> {
|
||||
// SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo();
|
||||
// rowVo.setTitle(dataObject.getTitle());
|
||||
// rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮");
|
||||
// rowVo.setPermission(dataObject.getPermission());
|
||||
// rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
// rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR);
|
||||
// rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// }));
|
||||
List<SystemMenuExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemMenuTb dataObject : systemMenuTbs) {
|
||||
SystemMenuExportRowVo rowVo = new SystemMenuExportRowVo();
|
||||
rowVo.setTitle(dataObject.getTitle());
|
||||
rowVo.setType(dataObject.getType() == null ? "目录" : dataObject.getType() == 1 ? "菜单" : "按钮");
|
||||
rowVo.setPermission(dataObject.getPermission());
|
||||
rowVo.setIFrame(dataObject.getIFrame() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
rowVo.setHidden(dataObject.getHidden() ? SystemYesOrNoChConst.NO_STR : SystemYesOrNoChConst.YES_STR);
|
||||
rowVo.setCache(dataObject.getCache() ? SystemYesOrNoChConst.YES_STR : SystemYesOrNoChConst.NO_STR);
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "菜单数据", SystemMenuExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -21,7 +21,6 @@ import cn.odboy.system.dal.model.SystemOssStorageVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -40,9 +39,9 @@ public interface SystemOssStorageService extends IService<SystemOssStorageTb> {
|
||||
|
||||
List<SystemOssStorageVo> queryOssStorage(SystemQueryStorageArgs args);
|
||||
|
||||
void exportOssStorageExcel(List<SystemOssStorageVo> list, HttpServletResponse response) throws IOException;
|
||||
|
||||
String uploadFile(MultipartFile file);
|
||||
|
||||
void deleteFileByIds(Long[] ids);
|
||||
|
||||
void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args);
|
||||
}
|
||||
|
||||
+67
-4
@@ -25,21 +25,20 @@ import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.redis.KitRedisHelper;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzLogTb;
|
||||
import cn.odboy.system.dal.model.SystemQuartzJobExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQuartzLogExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateQuartzJobArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemQuartzJobMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemQuartzLogMapper;
|
||||
import cn.odboy.system.framework.quartz.QuartzManage;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.quartz.CronExpression;
|
||||
@@ -280,4 +279,68 @@ public class SystemQuartzJobService {
|
||||
wrapper.eq(SystemQuartzJobTb::getIsPause, 0);
|
||||
return systemQuartzJobMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
public void exportQuartzJobXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) {
|
||||
List<SystemQuartzJobTb> systemQuartzJobTbs = this.queryQuartzJobByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "定时任务数据", systemQuartzJobTbs, SystemQuartzJobExportRowVo.class,
|
||||
// (dataObject) -> {
|
||||
// SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo();
|
||||
// rowVo.setJobName(dataObject.getJobName());
|
||||
// rowVo.setBeanName(dataObject.getBeanName());
|
||||
// rowVo.setMethodName(dataObject.getMethodName());
|
||||
// rowVo.setParams(dataObject.getParams());
|
||||
// rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
// rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中");
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemQuartzJobExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemQuartzJobTb dataObject : systemQuartzJobTbs) {
|
||||
SystemQuartzJobExportRowVo rowVo = new SystemQuartzJobExportRowVo();
|
||||
rowVo.setJobName(dataObject.getJobName());
|
||||
rowVo.setBeanName(dataObject.getBeanName());
|
||||
rowVo.setMethodName(dataObject.getMethodName());
|
||||
rowVo.setParams(dataObject.getParams());
|
||||
rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
rowVo.setIsPause(dataObject.getIsPause() ? "暂停中" : "运行中");
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "定时任务数据", SystemQuartzJobExportRowVo.class, rowVos);
|
||||
}
|
||||
|
||||
public void exportQuartzLogXlsx(HttpServletResponse response, SystemQueryQuartzJobArgs args) {
|
||||
List<SystemQuartzLogTb> systemQuartzLogTbs = this.queryQuartzLogByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "定时任务日志数据", systemQuartzLogTbs, SystemQuartzLogExportRowVo.class,
|
||||
// (dataObject) -> {
|
||||
// SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo();
|
||||
// rowVo.setJobName(dataObject.getJobName());
|
||||
// rowVo.setBeanName(dataObject.getBeanName());
|
||||
// rowVo.setMethodName(dataObject.getMethodName());
|
||||
// rowVo.setParams(dataObject.getParams());
|
||||
// rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
// rowVo.setExceptionDetail(dataObject.getExceptionDetail());
|
||||
// rowVo.setTime(dataObject.getTime());
|
||||
// rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败");
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemQuartzLogExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemQuartzLogTb dataObject : systemQuartzLogTbs) {
|
||||
SystemQuartzLogExportRowVo rowVo = new SystemQuartzLogExportRowVo();
|
||||
rowVo.setJobName(dataObject.getJobName());
|
||||
rowVo.setBeanName(dataObject.getBeanName());
|
||||
rowVo.setMethodName(dataObject.getMethodName());
|
||||
rowVo.setParams(dataObject.getParams());
|
||||
rowVo.setCronExpression(dataObject.getCronExpression());
|
||||
rowVo.setExceptionDetail(dataObject.getExceptionDetail());
|
||||
rowVo.setTime(dataObject.getTime());
|
||||
rowVo.setStatus(dataObject.getIsSuccess() ? "成功" : "失败");
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "定时任务日志数据", SystemQuartzLogExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+24
-4
@@ -28,20 +28,18 @@ import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemRoleCodeVo;
|
||||
import cn.odboy.system.dal.model.SystemRoleExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemRoleVo;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -277,4 +275,26 @@ public class SystemRoleService {
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
||||
public void exportRoleXlsx(HttpServletResponse response, SystemQueryRoleArgs args) {
|
||||
List<SystemRoleVo> systemRoleVos = this.queryRoleByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "角色数据", systemRoleVos, SystemRoleExportRowVo.class, (dataObject) -> {
|
||||
// SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
// rowVo.setName(dataObject.getName());
|
||||
// rowVo.setLevel(dataObject.getLevel());
|
||||
// rowVo.setDescription(dataObject.getDescription());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
List<SystemRoleExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemRoleVo dataObject : systemRoleVos) {
|
||||
SystemRoleExportRowVo rowVo = new SystemRoleExportRowVo();
|
||||
rowVo.setName(dataObject.getName());
|
||||
rowVo.setLevel(dataObject.getLevel());
|
||||
rowVo.setDescription(dataObject.getDescription());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "部门数据", SystemRoleExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+56
@@ -26,6 +26,7 @@ import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.server.core.KitFileLocalUploadHelper;
|
||||
import cn.odboy.system.constant.SystemCaptchaBizEnum;
|
||||
import cn.odboy.system.constant.SystemZhConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
@@ -34,6 +35,7 @@ import cn.odboy.system.dal.dataobject.SystemUserRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateUserPasswordArgs;
|
||||
import cn.odboy.system.dal.model.SystemUserExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemUserVo;
|
||||
import cn.odboy.system.dal.mysql.SystemDeptMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemJobMapper;
|
||||
@@ -47,10 +49,12 @@ import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.KitRsaEncryptUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -59,6 +63,7 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -549,4 +554,55 @@ public class SystemUserService {
|
||||
}
|
||||
return KitPageUtil.emptyData();
|
||||
}
|
||||
|
||||
public void exportUserXlsx(HttpServletResponse response, SystemQueryUserArgs args) {
|
||||
// List<SystemUserVo> systemUserVos = systemUserService.queryUserVoByArgs(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "用户数据", systemUserVos, SystemUserExportRowVo.class, (dataObject) -> {
|
||||
// SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
// rowVo.setUsername(dataObject.getUsername());
|
||||
// rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setDept(dataObject.getDept().getName());
|
||||
// rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setEmail(dataObject.getEmail());
|
||||
// rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setMobile(dataObject.getPhone());
|
||||
// rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// return CollUtil.newArrayList(rowVo);
|
||||
// });
|
||||
// List<SystemUserExportRowVo> rowVos = new ArrayList<>();
|
||||
// for (SystemUserVo dataObject : systemUserVos) {
|
||||
// SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
// rowVo.setUsername(dataObject.getUsername());
|
||||
// rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setDept(dataObject.getDept().getName());
|
||||
// rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
// rowVo.setEmail(dataObject.getEmail());
|
||||
// rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
// rowVo.setMobile(dataObject.getPhone());
|
||||
// rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
// rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
// rowVos.add(rowVo);
|
||||
// }
|
||||
// KitExcelExporter.exportSimple(response, "用户数据", SystemUserExportRowVo.class, rowVos);
|
||||
long totalCount = this.countUserByArgs(args);
|
||||
KitExcelExporter.exportByPage(response, "用户数据", SystemUserExportRowVo.class, totalCount, (long pageNum, long pageSize) -> {
|
||||
KitPageResult<SystemUserVo> pageResult = this.searchUserByArgs(args, new Page<>(pageNum, pageSize));
|
||||
List<SystemUserExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemUserVo dataObject : pageResult.getContent()) {
|
||||
SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
rowVo.setUsername(dataObject.getUsername());
|
||||
rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setDept(dataObject.getDept().getName());
|
||||
rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setEmail(dataObject.getEmail());
|
||||
rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
rowVo.setMobile(dataObject.getPhone());
|
||||
rowVo.setUpdatePwdTime(dataObject.getPwdResetTime());
|
||||
rowVo.setCreateTime(dataObject.getCreateTime());
|
||||
rowVos.add(rowVo);
|
||||
}
|
||||
return rowVos;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+11
-23
@@ -24,6 +24,7 @@ import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.properties.model.StorageOSSModel;
|
||||
import cn.odboy.framework.server.core.KitFileLocalUploadHelper;
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemOssStorageExportRowVo;
|
||||
import cn.odboy.system.dal.model.SystemOssStorageVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemOssStorageMapper;
|
||||
@@ -32,16 +33,13 @@ import cn.odboy.system.service.SystemOssStorageService;
|
||||
import cn.odboy.util.KitDateUtil;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -106,25 +104,6 @@ public class SystemMinioStorageServiceImpl extends ServiceImpl<SystemOssStorageM
|
||||
return searchOssStorage(args, page).getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportOssStorageExcel(List<SystemOssStorageVo> ossStorages, HttpServletResponse response)
|
||||
throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemOssStorageVo ossStorage : ossStorages) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("服务类型", ossStorage.getServiceType());
|
||||
map.put("服务地址", ossStorage.getEndpoint());
|
||||
map.put("存储桶名称", ossStorage.getBucketName());
|
||||
map.put("文件名称", ossStorage.getFileName());
|
||||
map.put("文件大小", ossStorage.getFileSizeDesc());
|
||||
map.put("文件类型", ossStorage.getFileMime());
|
||||
map.put("创建人", ossStorage.getCreateBy());
|
||||
map.put("创建日期", ossStorage.getCreateTime());
|
||||
list.add(map);
|
||||
}
|
||||
KitFileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String uploadFile(MultipartFile file) {
|
||||
@@ -174,6 +153,15 @@ public class SystemMinioStorageServiceImpl extends ServiceImpl<SystemOssStorageM
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) {
|
||||
List<SystemOssStorageVo> systemOssStorageVos = this.queryOssStorage(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "OSS文件上传记录数据", systemOssStorageVos, SystemOssStorageExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(BeanUtil.copyProperties(dataObject, SystemOssStorageExportRowVo.class)));
|
||||
List<SystemOssStorageExportRowVo> rowVos = BeanUtil.copyToList(systemOssStorageVos, SystemOssStorageExportRowVo.class);
|
||||
KitExcelExporter.exportSimple(response, "OSS文件上传记录数据", SystemOssStorageExportRowVo.class, rowVos);
|
||||
}
|
||||
|
||||
private SystemOssStorageTb getOssStorageByMd5(String md5) {
|
||||
return lambdaQuery().eq(SystemOssStorageTb::getFileMd5, md5).one();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user