diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesCollectServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesCollectServiceImpl.java index a06ebbb0..2c270859 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesCollectServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesCollectServiceImpl.java @@ -284,13 +284,11 @@ public class DesCollectServiceImpl extends ServiceImpl userIdToNameMapByDept = sysUserService.getUserIdToNameMapByDept(deptId); + if (userIdToNameMapByDept.isEmpty()) { + throw new ServiceException("部门下人员为空!!"); + } - // 2. 设置响应头 - // 设置响应头,指定Excel格式和下载文件名 - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setCharacterEncoding("utf-8"); - response.setHeader("Content-Disposition", "attachment; filename="+URLEncoder.encode("收资清单模板.xlsx", StandardCharsets.UTF_8)); Workbook workbook = new XSSFWorkbook(); // 创建主 Sheet 和隐藏 Sheet @@ -375,6 +373,11 @@ public class DesCollectServiceImpl extends ServiceImpl uniqueMajors = desUserService.getUserMajor(desUserBo); + if (uniqueMajors == null || uniqueMajors.isEmpty()) { + throw new ServiceException("请完成专业配置!!",502); + } Map userList = desUserService.getUserList(desUserBo); - - // 2. 设置响应头 - // 设置响应头,指定Excel格式和下载文件名 - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setCharacterEncoding("utf-8"); - response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("卷册目录模板.xlsx", StandardCharsets.UTF_8)); + if (userList == null || userList.isEmpty()) { + throw new ServiceException("请完成人员任命!",502); + } Workbook workbook = new XSSFWorkbook(); // 创建主 Sheet 和隐藏 Sheet @@ -556,7 +557,11 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl projectStructureMap = projectService.getStructureAsList(projectId); + if (projectStructureMap.isEmpty()) { + throw new ServiceException("获取项目列表失败,项目为空!!!"); + } List dictDataVos = dictDataService.selectByDictType("project_construction_status"); + if (dictDataVos == null || dictDataVos.isEmpty()) { + throw new ServiceException("项目施工状态为空!!"); + } Map statusMap = new HashMap<>(); for (SysDictDataVo vo : dictDataVos) { statusMap.put(vo.getDictValue(), vo.getDictLabel()); } - // 2. 设置响应头 - // 设置响应头,指定Excel格式和下载文件名 - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setCharacterEncoding("utf-8"); - response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("施工里程碑计划模版.xlsx", StandardCharsets.UTF_8)); - Workbook workbook = new XSSFWorkbook(); // 创建主 Sheet 和隐藏 Sheet Sheet mainSheet = workbook.createSheet("施工里程碑计划模版"); @@ -345,6 +345,12 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl