修改bug

This commit is contained in:
lcj
2025-09-28 12:30:21 +08:00
parent e64897246a
commit fa625aff6d
6 changed files with 86 additions and 56 deletions

View File

@ -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<Long> userIds = list.stream().map(SubConstructionUser::getSysUserId).toList();
List<SubConstructionUserFile> 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<SubConstructionUser> list1 = list.stream().filter(user -> user.getTeamId()!=null && user.getTeamId().equals(teamId)).toList();
List<SubConstructionUser> list1 = list.stream().filter(user -> user.getTeamId() != null && user.getTeamId().equals(teamId)).toList();
ArrayList<SubConstructionUserExportVo> 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<SubConstructionUserFile> 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<SubConstructionUser> noList = list.stream().filter(user -> user.getTeamId()==null).toList();
if(CollectionUtils.isNotEmpty(noList)){
List<SubConstructionUser> noList = list.stream().filter(user -> user.getTeamId() == null).toList();
if (CollectionUtils.isNotEmpty(noList)) {
int order = 1;
ArrayList<SubConstructionUserExportVo> 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<SubConstructionUserFile> 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);

View File

@ -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<DesVolumeCatalogVo> 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<List<DesVolumeFileVo>> listFileById(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
List<DesVolumeFile> volumeFiles = desVolumeCatalogService.queryFileListById(id,null);
List<DesVolumeFile> volumeFiles = desVolumeCatalogService.queryFileListById(id, null);
return R.ok(volumeFileService.getVoList(volumeFiles));
}
/**
* 获取卷册目录设计子项列表
*
* @param projectId 项目ID
*/
@GetMapping("/listDesignSubitem/{projectId}")
public R<List<String>> 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<Void> importData(@RequestParam("file") MultipartFile file,Long projectId) throws IOException {
public R<Void> 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
}
}

View File

@ -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;
}

View File

@ -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<DesVolumeCatalog> {
* @param id 主键
* @return 卷册目录
*/
DesVolumeCatalogVo queryById(Long id,String type);
DesVolumeCatalogVo queryById(Long id, String type);
/**
* 分页查询卷册目录列表
@ -57,7 +55,7 @@ public interface IDesVolumeCatalogService extends IService<DesVolumeCatalog> {
* @param id 卷册目录id
* @return 卷册目录文件列表
*/
List<DesVolumeFile> queryFileListById(Long id,String type);
List<DesVolumeFile> queryFileListById(Long id, String type);
/**
* 新增卷册目录
@ -89,7 +87,7 @@ public interface IDesVolumeCatalogService extends IService<DesVolumeCatalog> {
* @param volumeCatalog 卷册目录
* @return 卷册目录封装对象
*/
DesVolumeCatalogVo getVo(DesVolumeCatalog volumeCatalog,String type);
DesVolumeCatalogVo getVo(DesVolumeCatalog volumeCatalog, String type);
/**
* 构建查询条件
@ -124,4 +122,12 @@ public interface IDesVolumeCatalogService extends IService<DesVolumeCatalog> {
void exportExcelByProjectId(Long projectId, HttpServletResponse response);
void insertBatchByBo(List<DesVolumeCatalogCreateReq> list);
/**
* 获取项目下所有设计子项
*
* @param projectId 项目id
* @return 设计子项列表
*/
List<String> listDesignSubitem(Long projectId);
}

View File

@ -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<DesVolumeCatalogMap
RedisUtils.setCacheObject("DesVolumeCatalog:serialNumber", serialNumber);
}
/**
* 获取项目下所有设计子项
*
* @param projectId 项目id
* @return 设计子项列表
*/
@Override
public List<String> listDesignSubitem(Long projectId) {
List<DesVolumeCatalog> 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<DesVolumeCatalogMap
String documentName = req.getDocumentName();
String auditStatus = req.getAuditStatus();
String isUpload = req.getIsUpload();
String designSubitem = req.getDesignSubitem();
// lqw.orderByDesc(DesVolumeCatalog::getCreateTime);
lqw.orderByAsc(DesVolumeCatalog::getSerialNumber);
lqw.like(StringUtils.isNotBlank(documentName), DesVolumeCatalog::getDocumentName, documentName);
lqw.like(StringUtils.isNotBlank(designSubitem), DesVolumeCatalog::getDesignSubitem, designSubitem);
lqw.eq(StringUtils.isNotBlank(volumeNumber), DesVolumeCatalog::getVolumeNumber, volumeNumber);
lqw.eq(ObjectUtils.isNotEmpty(projectId), DesVolumeCatalog::getProjectId, projectId);
lqw.eq(StringUtils.isNotBlank(auditStatus), DesVolumeCatalog::getAuditStatus, auditStatus);
lqw.exists("1".equals(isUpload),"SELECT 1 FROM des_volume_file WHERE volume_catalog_id = des_volume_catalog.design");
lqw.notExists("0".equals(isUpload),"SELECT 1 FROM des_volume_file WHERE volume_catalog_id = des_volume_catalog.design");
lqw.exists("1".equals(isUpload), "SELECT 1 FROM des_volume_file WHERE volume_catalog_id = des_volume_catalog.design");
lqw.notExists("0".equals(isUpload), "SELECT 1 FROM des_volume_file WHERE volume_catalog_id = des_volume_catalog.design");
return lqw;
}

View File

@ -42,7 +42,7 @@ public class SysOssController extends BaseController {
/**
* 查询OSS对象存储列表
*/
@SaCheckPermission("system:oss:list")
// @SaCheckPermission("system:oss:list")
@GetMapping("/list")
public TableDataInfo<SysOssVo> 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<Void> remove(@NotEmpty(message = "主键不能为空")