From fa625aff6d32406750dbbe66eb3d65b34d22f70b Mon Sep 17 00:00:00 2001 From: lcj <2331845269@qq.com> Date: Sun, 28 Sep 2025 12:30:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SubConstructionUserController.java | 50 ++++++++----------- .../DesVolumeCatalogController.java | 41 +++++++++------ .../DesVolumeCatalogQueryReq.java | 7 ++- .../service/IDesVolumeCatalogService.java | 16 ++++-- .../impl/DesVolumeCatalogServiceImpl.java | 24 +++++++-- .../controller/system/SysOssController.java | 4 +- 6 files changed, 86 insertions(+), 56 deletions(-) diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/SubConstructionUserController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/SubConstructionUserController.java index a0e7d7af..0708a10c 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/SubConstructionUserController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/SubConstructionUserController.java @@ -1,14 +1,11 @@ package org.dromara.contractor.controller; import cn.dev33.satoken.annotation.SaCheckPermission; -import cn.dev33.satoken.annotation.SaMode; -import cn.hutool.core.bean.BeanUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.beust.ah.A; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; @@ -19,7 +16,6 @@ import org.dromara.common.core.domain.R; import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.validate.AddGroup; import org.dromara.common.core.validate.EditGroup; -import org.dromara.common.excel.utils.ExcelUtil; import org.dromara.common.idempotent.annotation.RepeatSubmit; import org.dromara.common.log.annotation.Log; import org.dromara.common.log.enums.BusinessType; @@ -30,10 +26,7 @@ import org.dromara.common.web.core.BaseController; import org.dromara.contractor.domain.SubConstructionUser; import org.dromara.contractor.domain.SubConstructionUserFile; import org.dromara.contractor.domain.dto.constructionuser.*; -import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileQueryReq; -import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo; import org.dromara.contractor.domain.vo.constructionuser.*; -import org.dromara.contractor.domain.vo.constructionuserfile.SubConstructionUserFileVo; import org.dromara.contractor.service.ISubConstructionUserFileService; import org.dromara.contractor.service.ISubConstructionUserService; import org.dromara.project.domain.dto.project.BusProjectQueryReq; @@ -81,6 +74,7 @@ public class SubConstructionUserController extends BaseController { private final IBusProjectService projectService; private final IdCardEncryptorUtil idCardEncryptorUtil; private final ISubConstructionUserFileService constructionUserFileService; + /** * 查询施工人员列表 */ @@ -90,6 +84,7 @@ public class SubConstructionUserController extends BaseController { return constructionUserService.queryPageList(req, pageQuery); } + /** * 新人池 */ @@ -110,7 +105,6 @@ public class SubConstructionUserController extends BaseController { } - /** * 查询每个施工人员总的考勤列表 */ @@ -187,7 +181,7 @@ public class SubConstructionUserController extends BaseController { /** * 修改施工人员工资 */ - @SaCheckPermission("contractor:constructionUser:salary") + @SaCheckPermission("contractor:constructionUser:edit") @Log(title = "施工人员", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping("/salary") @@ -198,7 +192,7 @@ public class SubConstructionUserController extends BaseController { /** * 修改施工人员打卡状态 */ - @SaCheckPermission("contractor:constructionUser:clock") + @SaCheckPermission("contractor:constructionUser:edit") @Log(title = "施工人员", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping("/clock") @@ -209,7 +203,7 @@ public class SubConstructionUserController extends BaseController { /** * 批量修改施工人员状态 */ - @SaCheckPermission("contractor:constructionUser:batchStatus") + @SaCheckPermission("contractor:constructionUser:edit") @Log(title = "施工人员", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping("/batch/status") @@ -220,7 +214,7 @@ public class SubConstructionUserController extends BaseController { /** * 根据项目id批量修改施工人员打卡状态 */ - @SaCheckPermission("contractor:constructionUser:batchClock") + @SaCheckPermission("contractor:constructionUser:edit") @Log(title = "施工人员", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping("/batch/clock") @@ -231,7 +225,7 @@ public class SubConstructionUserController extends BaseController { /** * 施工人员迁移 */ - @SaCheckPermission("contractor:constructionUser:changeProject") + @SaCheckPermission("contractor:constructionUser:edit") @Log(title = "施工人员", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping("/change/project") @@ -311,8 +305,6 @@ public class SubConstructionUserController extends BaseController { } - - @Log(title = "施工人员导出", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(SubConstructionUserQueryReq req, HttpServletResponse response) { @@ -328,7 +320,7 @@ public class SubConstructionUserController extends BaseController { List userIds = list.stream().map(SubConstructionUser::getSysUserId).toList(); List fileList = new ArrayList<>(); - if(CollectionUtils.isNotEmpty(userIds)){ + if (CollectionUtils.isNotEmpty(userIds)) { fileList = constructionUserFileService.list(Wrappers.lambdaQuery(SubConstructionUserFile.class) .in(SubConstructionUserFile::getUserId, userIds)); } @@ -359,12 +351,12 @@ public class SubConstructionUserController extends BaseController { // 每个Sheet必须指定唯一的sheetNo和sheetName WriteSheet writeSheet = EasyExcel.writerSheet(i, teamMap.get(teamId)).build(); i++; - List list1 = list.stream().filter(user -> user.getTeamId()!=null && user.getTeamId().equals(teamId)).toList(); + List list1 = list.stream().filter(user -> user.getTeamId() != null && user.getTeamId().equals(teamId)).toList(); ArrayList dataList = new ArrayList<>(); int order = 1; for (SubConstructionUser user : list1) { SubConstructionUserExportVo vo = new SubConstructionUserExportVo(); - BeanUtils.copyProperties(user,vo,"leaveDate","entryDate"); + BeanUtils.copyProperties(user, vo, "leaveDate", "entryDate"); vo.setOrder(order); if (user.getLeaveDate() != null) { vo.setLeaveDate(DateUtils.formatDateTime(user.getLeaveDate())); @@ -377,7 +369,7 @@ public class SubConstructionUserController extends BaseController { vo.setSex("男"); } else if (sex != null && sex.equals("2")) { vo.setSex("女"); - }else { + } else { vo.setSex("未知"); } String sfzNumber = vo.getSfzNumber(); @@ -389,11 +381,11 @@ public class SubConstructionUserController extends BaseController { List list2 = fileList.stream() .filter(file -> file.getUserId().equals(user.getSysUserId()) && StringUtils.isNotBlank(file.getPath())) .toList(); - if(list2.isEmpty()){ + if (list2.isEmpty()) { vo.setUploadFile("未上传"); - }else if (list2.size() >= 6){ + } else if (list2.size() >= 6) { vo.setUploadFile("已上传"); - }else { + } else { vo.setUploadFile("部分上传"); } dataList.add(vo); @@ -403,13 +395,13 @@ public class SubConstructionUserController extends BaseController { } //无班组的写入 WriteSheet writeSheet = EasyExcel.writerSheet(i, "无班组").build(); - List noList = list.stream().filter(user -> user.getTeamId()==null).toList(); - if(CollectionUtils.isNotEmpty(noList)){ + List noList = list.stream().filter(user -> user.getTeamId() == null).toList(); + if (CollectionUtils.isNotEmpty(noList)) { int order = 1; ArrayList dataList = new ArrayList<>(); for (SubConstructionUser user : noList) { SubConstructionUserExportVo vo = new SubConstructionUserExportVo(); - BeanUtils.copyProperties(user,vo,"leaveDate","entryDate"); + BeanUtils.copyProperties(user, vo, "leaveDate", "entryDate"); vo.setOrder(order); if (user.getLeaveDate() != null) { vo.setLeaveDate(DateUtils.formatDateTime(user.getLeaveDate())); @@ -422,7 +414,7 @@ public class SubConstructionUserController extends BaseController { vo.setSex("男"); } else if (sex != null && sex.equals("2")) { vo.setSex("女"); - }else { + } else { vo.setSex("未知"); } String sfzNumber = vo.getSfzNumber(); @@ -434,11 +426,11 @@ public class SubConstructionUserController extends BaseController { List list2 = fileList.stream() .filter(file -> file.getUserId().equals(user.getSysUserId()) && StringUtils.isNotBlank(file.getPath())) .toList(); - if(list2.isEmpty()){ + if (list2.isEmpty()) { vo.setUploadFile("未上传"); - }else if (list2.size() >= 6){ + } else if (list2.size() >= 6) { vo.setUploadFile("已上传"); - }else { + } else { vo.setUploadFile("部分上传"); } dataList.add(vo); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesVolumeCatalogController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesVolumeCatalogController.java index b77efa67..b46d5a9a 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesVolumeCatalogController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/controller/DesVolumeCatalogController.java @@ -6,8 +6,10 @@ import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.dromara.common.core.domain.R; @@ -39,8 +41,6 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.time.LocalDate; @@ -70,7 +70,7 @@ public class DesVolumeCatalogController extends BaseController { private IDesVolumeFileService volumeFileService; @Resource - private IDesUserService desUserService; + private IDesUserService desUserService; @Resource private ISysUserService sysUserService; @@ -92,8 +92,8 @@ public class DesVolumeCatalogController extends BaseController { @SaCheckPermission("design:volumeCatalog:query") @GetMapping("/{id}") public R getInfo(@NotNull(message = "主键不能为空") - @PathVariable Long id,String type) { - return R.ok(desVolumeCatalogService.queryById(id,type)); + @PathVariable Long id, String type) { + return R.ok(desVolumeCatalogService.queryById(id, type)); } /** @@ -105,10 +105,21 @@ public class DesVolumeCatalogController extends BaseController { @GetMapping("/listFileById/{id}") public R> listFileById(@NotNull(message = "主键不能为空") @PathVariable Long id) { - List volumeFiles = desVolumeCatalogService.queryFileListById(id,null); + List volumeFiles = desVolumeCatalogService.queryFileListById(id, null); return R.ok(volumeFileService.getVoList(volumeFiles)); } + /** + * 获取卷册目录设计子项列表 + * + * @param projectId 项目ID + */ + @GetMapping("/listDesignSubitem/{projectId}") + public R> listDesignSubitem(@NotNull(message = "项目主键不能为空") + @PathVariable Long projectId) { + return R.ok(desVolumeCatalogService.listDesignSubitem(projectId)); + } + /** * 用户查看文件 * @@ -162,19 +173,18 @@ public class DesVolumeCatalogController extends BaseController { @SaCheckPermission("design:volumeCatalog:exportExcel") @Log(title = "收资清单", businessType = BusinessType.EXPORT) @PostMapping("/exportExcel") - public void exportExcelByProjectId(@RequestParam("projectId") Long projectId, HttpServletResponse response){ + public void exportExcelByProjectId(@RequestParam("projectId") Long projectId, HttpServletResponse response) { desVolumeCatalogService.exportExcelByProjectId(projectId, response); } - /** * 导入卷册目录 */ @SaCheckPermission("design:volumeCatalog:importData") @Log(title = "导入卷册目录", businessType = BusinessType.IMPORT) @PostMapping("/importData") - public R importData(@RequestParam("file") MultipartFile file,Long projectId) throws IOException { + public R importData(@RequestParam("file") MultipartFile file, Long projectId) throws IOException { if (projectId == null) { return R.fail("项目ID不能为空"); } @@ -249,7 +259,7 @@ public class DesVolumeCatalogController extends BaseController { LocalDate plannedCompletion = getLocalDateValue(row.getCell(7)); ExcelData excelData = new ExcelData( - designSubitem,specialtyId,principalId, volumeNumber, documentName, + designSubitem, specialtyId, principalId, volumeNumber, documentName, plannedCompletion ); dataList.add(excelData); @@ -259,6 +269,7 @@ public class DesVolumeCatalogController extends BaseController { return dataList; } + private static boolean hasValidData(Row row) { // 遍历行中的所有单元格 for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) { @@ -335,10 +346,12 @@ public class DesVolumeCatalogController extends BaseController { // 如果 Excel 是 yyyy/MM/dd 或 yyyy.MM.dd,可以额外处理 try { return LocalDate.parse(text, java.time.format.DateTimeFormatter.ofPattern("yyyy/MM/dd")); - } catch (Exception ignored) {} + } catch (Exception ignored) { + } try { return LocalDate.parse(text, java.time.format.DateTimeFormatter.ofPattern("yyyy.MM.dd")); - } catch (Exception ignored) {} + } catch (Exception ignored) { + } return null; // 不识别的格式就返回 null } } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/volumecatalog/DesVolumeCatalogQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/volumecatalog/DesVolumeCatalogQueryReq.java index 021f5ba1..750602b9 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/volumecatalog/DesVolumeCatalogQueryReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/domain/dto/volumecatalog/DesVolumeCatalogQueryReq.java @@ -1,11 +1,9 @@ package org.dromara.design.domain.dto.volumecatalog; -import com.baomidou.mybatisplus.annotation.TableId; import lombok.Data; import java.io.Serial; import java.io.Serializable; -import java.time.LocalDate; /** * @author lilemy @@ -43,4 +41,9 @@ public class DesVolumeCatalogQueryReq implements Serializable { private String isUpload; + /** + * 设计子项 + */ + private String designSubitem; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/IDesVolumeCatalogService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/IDesVolumeCatalogService.java index 3cbfef6d..a5e5cb04 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/IDesVolumeCatalogService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/IDesVolumeCatalogService.java @@ -8,12 +8,10 @@ import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.design.domain.DesVolumeCatalog; import org.dromara.design.domain.DesVolumeFile; -import org.dromara.design.domain.bo.DesVolumeFileBo; import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogCreateReq; import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogQueryReq; import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogUpdateReq; import org.dromara.design.domain.vo.volumecatalog.DesVolumeCatalogVo; -import org.dromara.design.domain.vo.volumefile.DesVolumeFileVo; import java.util.Collection; import java.util.List; @@ -32,7 +30,7 @@ public interface IDesVolumeCatalogService extends IService { * @param id 主键 * @return 卷册目录 */ - DesVolumeCatalogVo queryById(Long id,String type); + DesVolumeCatalogVo queryById(Long id, String type); /** * 分页查询卷册目录列表 @@ -57,7 +55,7 @@ public interface IDesVolumeCatalogService extends IService { * @param id 卷册目录id * @return 卷册目录文件列表 */ - List queryFileListById(Long id,String type); + List queryFileListById(Long id, String type); /** * 新增卷册目录 @@ -89,7 +87,7 @@ public interface IDesVolumeCatalogService extends IService { * @param volumeCatalog 卷册目录 * @return 卷册目录封装对象 */ - DesVolumeCatalogVo getVo(DesVolumeCatalog volumeCatalog,String type); + DesVolumeCatalogVo getVo(DesVolumeCatalog volumeCatalog, String type); /** * 构建查询条件 @@ -124,4 +122,12 @@ public interface IDesVolumeCatalogService extends IService { void exportExcelByProjectId(Long projectId, HttpServletResponse response); void insertBatchByBo(List list); + + /** + * 获取项目下所有设计子项 + * + * @param projectId 项目id + * @return 设计子项列表 + */ + List listDesignSubitem(Long projectId); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesVolumeCatalogServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesVolumeCatalogServiceImpl.java index 636240d3..9996b7cd 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesVolumeCatalogServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/design/service/impl/DesVolumeCatalogServiceImpl.java @@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; -import org.apache.poi.ss.formula.FormulaParseException; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -221,6 +220,22 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl listDesignSubitem(Long projectId) { + List list = this.lambdaQuery() + .eq(DesVolumeCatalog::getProjectId, projectId) + .groupBy(DesVolumeCatalog::getDesignSubitem) + .select(DesVolumeCatalog::getDesignSubitem) + .list(); + return list.stream().map(DesVolumeCatalog::getDesignSubitem).toList(); + } + /** * 修改卷册目录 * @@ -336,15 +351,16 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl list(@Validated(QueryGroup.class) SysOssBo bo, PageQuery pageQuery) { return ossService.queryPageList(bo, pageQuery); @@ -127,7 +127,7 @@ public class SysOssController extends BaseController { * * @param ossIds OSS对象ID串 */ - @SaCheckPermission("system:oss:remove") +// @SaCheckPermission("system:oss:remove") @Log(title = "OSS对象存储", businessType = BusinessType.DELETE) @DeleteMapping("/{ossIds}") public R remove(@NotEmpty(message = "主键不能为空")