diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java index 13ba9d26..94047429 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java @@ -1,6 +1,5 @@ package org.dromara.contractor.controller.app; -import cn.dev33.satoken.annotation.SaCheckPermission; import jakarta.annotation.Resource; import jakarta.validation.constraints.NotNull; import org.dromara.common.core.domain.R; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserFileAppController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserFileAppController.java index 9b798fa1..c5794a19 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserFileAppController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserFileAppController.java @@ -2,14 +2,15 @@ package org.dromara.contractor.controller.app; import jakarta.annotation.Resource; import org.dromara.common.core.domain.R; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; import org.dromara.common.web.core.BaseController; import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileQueryReq; +import org.dromara.contractor.domain.dto.constructionuserfile.SubConstructionUserFileSaveReq; import org.dromara.contractor.domain.vo.constructionuserfile.SubConstructionUserFileVo; import org.dromara.contractor.service.ISubConstructionUserFileService; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -35,4 +36,13 @@ public class SubConstructionUserFileAppController extends BaseController { return R.ok(constructionUserFileService.queryList(req)); } + /** + * 保存施工人员文件存储详情信息 + */ + @Log(title = "施工人员文件存储", businessType = BusinessType.INSERT) + @PostMapping("/save") + public R save(@RequestBody SubConstructionUserFileSaveReq req) { + return R.ok(constructionUserFileService.saveFileList(req)); + } + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuser/SubConstructionUserVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuser/SubConstructionUserVo.java index 348dcf9c..5cf21ba6 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuser/SubConstructionUserVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuser/SubConstructionUserVo.java @@ -47,6 +47,7 @@ public class SubConstructionUserVo implements Serializable { * 人脸照 url */ @ExcelProperty(value = "人脸照 url") + @Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "facePic") private String facePicUrl; /** diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuserfile/SubConstructionUserFileVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuserfile/SubConstructionUserFileVo.java index befb2152..cbb0911a 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuserfile/SubConstructionUserFileVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/domain/vo/constructionuserfile/SubConstructionUserFileVo.java @@ -10,6 +10,7 @@ import org.dromara.contractor.domain.SubConstructionUserFile; import java.io.Serial; import java.io.Serializable; +import java.util.Date; /** @@ -51,6 +52,26 @@ public class SubConstructionUserFileVo implements Serializable { @ExcelProperty(value = "文件路径") private String path; + /** + * 文件访问地址 + */ + private String url; + + /** + * 文件名 + */ + private String fileName; + + /** + * 文件大小 + */ + private String fileSize; + + /** + * 创建时间 + */ + private Date createTime; + /** * 备注 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java index 0486ff1e..3aef3eb4 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserFileServiceImpl.java @@ -31,10 +31,13 @@ import org.dromara.project.domain.BusConstructionBlacklist; import org.dromara.project.domain.BusProject; import org.dromara.project.service.IBusConstructionBlacklistService; import org.dromara.project.service.IBusProjectService; +import org.dromara.safety.domain.WgzQuestionSavePdf; +import org.dromara.safety.service.IWgzQuestionSavePdfService; import org.dromara.system.domain.vo.SysDictDataVo; import org.dromara.system.domain.vo.SysOssVo; import org.dromara.system.service.ISysDictTypeService; import org.dromara.system.service.ISysOssService; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -43,10 +46,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; import java.util.zip.ZipEntry; @@ -78,6 +78,9 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl queryList(SubConstructionUserFileQueryReq req) { LambdaQueryWrapper lqw = buildQueryWrapper(req); - return baseMapper.selectVoList(lqw); + List list = baseMapper.selectVoList(lqw); + if (CollUtil.isEmpty(list)) { + return List.of(); + } + // 获取oss文件信息 + List files = list.stream().map(SubConstructionUserFileVo::getPath) + .filter(Objects::nonNull) + .flatMap(s -> Arrays.stream(s.split(","))) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .map(Long::parseLong) + .toList(); + List ossVoList = ossService.listByIds(files); + Map ossVoMap = ossVoList.stream() + .collect(Collectors.toMap(SysOssVo::getOssId, Function.identity())); + + List listVo = new ArrayList<>(); + for (SubConstructionUserFileVo file : list) { + if (Objects.equals(file.getFileType(), "11")) { + // 安全考试 + WgzQuestionSavePdf wgzQuestionSavePdf = wgzQuestionSavePdfService.queryByUserId(file.getUserId()); + if (wgzQuestionSavePdf != null) { + List ossVos = ossService.listByIds(Arrays.stream(wgzQuestionSavePdf + .getPath() + .split(",")) + .map(Long::parseLong) + .toList()); + for (SysOssVo ossVo : ossVos) { + SubConstructionUserFileVo vo = new SubConstructionUserFileVo(); + BeanUtils.copyProperties(file, vo); + vo.setUrl(ossVo.getUrl()); + vo.setFileName(ossVo.getOriginalName()); + vo.setFileSize(ossService.formatFileSize(ossVo.getFileSize())); + listVo.add(vo); + } + } + } else if (Objects.equals(file.getFileType(), "12")) { + // 特种工作证 + SubConstructionUser constructionUser = constructionUserService.getBySysUserId(file.getUserId()); + List ossVos = ossService.listByIds(Arrays.stream(constructionUser + .getSpecialWorkPic() + .split(",")) + .map(Long::parseLong).toList()); + for (SysOssVo ossVo : ossVos) { + SubConstructionUserFileVo vo = new SubConstructionUserFileVo(); + BeanUtils.copyProperties(file, vo); + vo.setUrl(ossVo.getUrl()); + vo.setFileName(ossVo.getOriginalName()); + vo.setFileSize(ossService.formatFileSize(ossVo.getFileSize())); + listVo.add(vo); + } + } else { + List ossIds = Arrays.stream(file.getPath().split(",")).map(Long::parseLong).toList(); + for (Long ossId : ossIds) { + SubConstructionUserFileVo vo = new SubConstructionUserFileVo(); + if (ossVoMap.containsKey(ossId)) { + BeanUtils.copyProperties(file, vo); + SysOssVo ossVo = ossVoMap.get(ossId); + vo.setUrl(ossVo.getUrl()); + vo.setFileName(ossVo.getOriginalName()); + vo.setFileSize(ossService.formatFileSize(ossVo.getFileSize())); + } + listVo.add(vo); + } + } + } + return listVo; } /** diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java index c588ed74..2cf5a9a4 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java @@ -683,11 +683,6 @@ public class SubConstructionUserServiceImpl extends ServiceImpl blackUserIdList; if (projectId != null) { - List blackUserIdList = constructionBlacklistService.queryIdListByProjectId(projectId); - // 查询结果移除黑名单人员 - if (CollUtil.isNotEmpty(blackUserIdList)) { - lqw.notIn(SubConstructionUser::getSysUserId, blackUserIdList); - } + blackUserIdList = constructionBlacklistService.queryIdListByProjectId(projectId); + } else { + blackUserIdList = constructionBlacklistService.queryIdListByProjectId(null); + } + if (CollUtil.isNotEmpty(blackUserIdList)) { + lqw.notIn(SubConstructionUser::getSysUserId, blackUserIdList); } lqw.ne(StringUtils.isNotBlank(notUserRole), SubConstructionUser::getUserRole, notUserRole); if (StringUtils.isNotBlank(entryDate)) { @@ -1036,8 +1033,6 @@ public class SubConstructionUserServiceImpl extends ServiceImpl readExcel(@RequestParam("file") MultipartFile file, Long projectId) { List list = pgsConstructionSchedulePlanService.readExcel(file, projectId); if (CollUtil.isNotEmpty(list)) { - List planList = list.stream().map(dto -> { - PgsConstructionSchedulePlan plan = new PgsConstructionSchedulePlan(); - BeanUtils.copyProperties(dto, plan); - return plan; - }).toList(); + List planList = pgsConstructionSchedulePlanService.convertToEntities(list); return toAjax(pgsConstructionSchedulePlanService.saveBatch(planList)); } return toAjax(true); @@ -112,7 +105,7 @@ public class PgsConstructionSchedulePlanController extends BaseController { @Log(title = "施工进度计划", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() - public R add(@Validated(AddGroup.class) @RequestBody PgsConstructionSchedulePlanCreateReq req) { + public R add(@Validated @RequestBody PgsConstructionSchedulePlanCreateReq req) { return R.ok(pgsConstructionSchedulePlanService.insertByBo(req)); } @@ -123,7 +116,7 @@ public class PgsConstructionSchedulePlanController extends BaseController { @Log(title = "施工进度计划", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping() - public R edit(@Validated(EditGroup.class) @RequestBody PgsConstructionSchedulePlanUpdateReq req) { + public R edit(@Validated @RequestBody PgsConstructionSchedulePlanUpdateReq req) { return toAjax(pgsConstructionSchedulePlanService.updateByBo(req)); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanDetailController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanDetailController.java index 314fd9e1..be675a67 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanDetailController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanDetailController.java @@ -8,13 +8,17 @@ import org.dromara.common.idempotent.annotation.RepeatSubmit; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.web.core.BaseController; -import org.dromara.progress.domain.dto.progressplandetail.*; +import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateReq; +import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq; +import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailQueryReq; +import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailRemoveReq; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailVo; import org.dromara.progress.service.IPgsProgressPlanDetailService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; /** * 进度计划详情 @@ -60,14 +64,12 @@ public class PgsProgressPlanDetailController extends BaseController { } /** - * 新增进度计划详情(数量设施) + * 新增进度计划详情(AI 填报) */ -/* @SaCheckPermission("progress:progressPlanDetail:insertNumber") - @RepeatSubmit() - @PostMapping("/insert/number") - public R insertNumberDetail(@Validated @RequestBody PgsProgressPlanDetailNumberCreateReq req) { - return toAjax(pgsProgressPlanDetailService.insertNumberDetail(req)); - }*/ + @PostMapping("/insert/numberAI") + public R insertNumberDetailByAI(@RequestPart("file") MultipartFile file) { + return toAjax(pgsProgressPlanDetailService.insertNumberDetailByAI(file)); + } /** * 获取进度计划详情已完成设施详细信息 diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/constructionscheduleplan/PgsConstructionSchedulePlanExcelDto.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/constructionscheduleplan/PgsConstructionSchedulePlanExcelDto.java index 92fc6b8e..39edfa36 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/constructionscheduleplan/PgsConstructionSchedulePlanExcelDto.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/constructionscheduleplan/PgsConstructionSchedulePlanExcelDto.java @@ -13,16 +13,16 @@ import java.time.LocalDate; @AllArgsConstructor public class PgsConstructionSchedulePlanExcelDto { + /** + * 编号(1, 1.1, 1.1.1) + */ + private String number; + /** * 项目ID */ private Long projectId; - /** - * 父ID - */ - private Long parentId; - /** * 节点名称 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/constructionscheduleplan/PgsConstructionSchedulePlanUpdateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/constructionscheduleplan/PgsConstructionSchedulePlanUpdateReq.java index c0975bc7..8c3051a0 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/constructionscheduleplan/PgsConstructionSchedulePlanUpdateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/constructionscheduleplan/PgsConstructionSchedulePlanUpdateReq.java @@ -36,6 +36,16 @@ public class PgsConstructionSchedulePlanUpdateReq implements Serializable { */ private String projectStructureName; + /** + * 预计开始时间 + */ + private LocalDate planStartDate; + + /** + * 预计结束时间 + */ + private LocalDate planEndDate; + /** * 实际开始时间 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsConstructionSchedulePlanService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsConstructionSchedulePlanService.java index 0a8a2270..0adee6b3 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsConstructionSchedulePlanService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsConstructionSchedulePlanService.java @@ -101,4 +101,12 @@ public interface IPgsConstructionSchedulePlanService extends IService readExcel(MultipartFile file, Long projectId); + + /** + * 将Excel数据转换为实体列表 + * + * @param excelList Excel数据列表 + * @return 实体列表 + */ + List convertToEntities(List excelList); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanDetailService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanDetailService.java index cc3a49c9..d727d0f6 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanDetailService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanDetailService.java @@ -6,14 +6,15 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.progress.domain.PgsProgressPlanDetail; -import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq; import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateReq; +import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq; import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailQueryReq; import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailRemoveReq; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailVo; +import org.springframework.web.multipart.MultipartFile; import java.time.LocalDate; import java.util.List; @@ -51,14 +52,6 @@ public interface IPgsProgressPlanDetailService extends IService queryNumberList(PgsProgressPlanDetailQueryReq req); + + /** + * 使用AI识别计划详情设施数量 + * + * @param file 文件 + * @return 是否成功 + */ + Boolean insertNumberDetailByAI(MultipartFile file); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsConstructionSchedulePlanServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsConstructionSchedulePlanServiceImpl.java index eb61ebc8..fcbe82eb 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsConstructionSchedulePlanServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsConstructionSchedulePlanServiceImpl.java @@ -1,6 +1,7 @@ package org.dromara.progress.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; @@ -173,7 +174,7 @@ public class PgsConstructionSchedulePlanServiceImpl extends ServiceImpl convertToEntities(List excelList) { + List result = new ArrayList<>(); + Map numberIdMap = new HashMap<>(); + + for (PgsConstructionSchedulePlanExcelDto dto : excelList) { + PgsConstructionSchedulePlan entity = new PgsConstructionSchedulePlan(); + + LocalDate planStartDate = dto.getPlanStartDate(); + LocalDate planEndDate = dto.getPlanEndDate(); + if (planStartDate == null || planEndDate == null || planStartDate.isAfter(planEndDate)) { + throw new ServiceException("计划开始时间和计划结束时间不能为空,且计划开始时间不能大于计划结束时间", HttpStatus.BAD_REQUEST); + } + + // 生成主键 + Long id = IdWorker.getId(); + entity.setId(id); + + entity.setProjectId(dto.getProjectId()); + entity.setNodeName(dto.getNodeName()); + entity.setProjectStructure(dto.getProjectStructure()); + entity.setProjectStructureName(dto.getProjectStructureName()); + entity.setPlanStartDate(planStartDate); + entity.setPlanEndDate(planEndDate); + entity.setPracticalStartDate(dto.getPracticalStartDate()); + entity.setPracticalEndDate(dto.getPracticalEndDate()); + entity.setStatus(dto.getStatus()); + entity.setRemark(dto.getRemark()); + // 确定父ID + String number = dto.getNumber(); + if (number != null && number.contains("-")) { + String parentNumber = number.substring(0, number.lastIndexOf("-")); + Long parentId = numberIdMap.get(parentNumber); + if (parentId == null) { + throw new ServiceException("未找到父编号:" + parentNumber, HttpStatus.BAD_REQUEST); + } + entity.setParentId(parentId); + } else { + entity.setParentId(0L); // 顶级节点 + } + + // 保存当前编号对应的id + numberIdMap.put(number, entity.getId()); + result.add(entity); + } + + return result; + } + private static boolean hasValidData(Row row) { // 遍历行中的所有单元格 for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) { diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java index aca3a939..3d427564 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java @@ -143,8 +143,11 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl queryListByParent(PgsProgressCategoryQueryByParentReq req) { Long parentId = req.getParentId(); String name = req.getName(); + if (parentId == null) { + return List.of(); + } QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.apply(parentId != null, "FIND_IN_SET({0}, ancestors)", parentId); + queryWrapper.apply("FIND_IN_SET({0}, ancestors)", parentId); queryWrapper.like(StringUtils.isNotBlank(name), "name", name); return this.getVoList(this.list(queryWrapper)); } @@ -524,6 +527,21 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl 0) { - throw new ServiceException("总完成数量不能超过计划数量", HttpStatus.BAD_REQUEST); - } - // 更新 detail - progressPlanDetail.setFinishedNumber(finishedNumber); - boolean update = this.updateById(progressPlanDetail); - if (!update) { - throw new ServiceException("更新进度计划详情异常", HttpStatus.ERROR); - } - // 更新 plan - progressPlan.setFinishedNumber(newFinishedNumberTotal); - boolean result = progressPlanService.updateById(progressPlan); - if (!result) { - throw new ServiceException("更新进度计划异常", HttpStatus.ERROR); - } - // 更新 category - BigDecimal completed = progressCategory.getCompleted(); - BigDecimal completedTotal = completed.subtract(number).add(finishedNumber); - progressCategory.setCompleted(completedTotal); - // 如果完成数量 >= 总数量,标记为完成 - if (completedTotal.compareTo(progressCategory.getTotal()) >= 0) { - progressCategory.setStatus(PgsFinishStatusEnum.FINISH.getValue()); - } - // 判断当前是否已完成计划数量 - BigDecimal nowFinishedNumber = progressPlan.getFinishedNumber(); - if (oldFinishedNumberTotal.compareTo(progressPlan.getPlanNumber()) < 0 - && nowFinishedNumber.compareTo(progressPlan.getPlanNumber()) >= 0) { - progressCategory.setPlanTotal(progressCategory.getPlanTotal().subtract(progressPlan.getPlanNumber())); - } - boolean updateCategory = progressCategoryService.updateById(progressCategory); - if (!updateCategory) { - throw new ServiceException("更新进度分类异常", HttpStatus.ERROR); - } - return true; - }*/ - /** * 分页查询进度计划详情设施列表 * @@ -954,6 +886,17 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl updateExitRecord(@Validated @RequestBody BusConstructionUserExitUpdateReq req) { + return toAjax(constructionUserExitService.updateRecord(req)); + } + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionuserexit/BusConstructionUserExitUpdateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionuserexit/BusConstructionUserExitUpdateReq.java index 53af2fdb..2547cc93 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionuserexit/BusConstructionUserExitUpdateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/domain/dto/constructionuserexit/BusConstructionUserExitUpdateReq.java @@ -18,10 +18,10 @@ public class BusConstructionUserExitUpdateReq implements Serializable { private static final long serialVersionUID = 6818895534694076391L; /** - * 主键 + * 用户id */ - @NotNull(message = "主键不能为空") - private Long id; + @NotNull(message = "用户id不能为空") + private Long userId; /** * 工资发放凭证 diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionUserExitServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionUserExitServiceImpl.java index 890acd3c..0235257b 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionUserExitServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusConstructionUserExitServiceImpl.java @@ -13,6 +13,7 @@ import org.dromara.common.core.utils.ObjectUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.utils.IdCardEncryptorUtil; import org.dromara.contractor.domain.SubConstructionUser; import org.dromara.contractor.service.ISubConstructionUserService; import org.dromara.project.domain.BusConstructionUserExit; @@ -55,6 +56,9 @@ public class BusConstructionUserExitServiceImpl extends ServiceImpl luw = new LambdaUpdateWrapper<>(); + luw.eq(SubConstructionUser::getSysUserId, constructionUserExit.getUserId()) + .set(SubConstructionUser::getExitStatus, "2"); + boolean resultUser = constructionUserService.update(luw); if (!resultUser) { throw new ServiceException("施工人员入场退场记录修改失败", HttpStatus.ERROR); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusProjectTeamMemberServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusProjectTeamMemberServiceImpl.java index 9f3e53e6..afc894d3 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusProjectTeamMemberServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/project/service/impl/BusProjectTeamMemberServiceImpl.java @@ -306,7 +306,7 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl queryPageList(HseSafetyInspectionQueryReq req, PageQuery pageQuery) { - Page result = this.page(pageQuery.build(), buildQueryWrapper(req)); + LambdaQueryWrapper lqw = this.buildQueryWrapper(req); + Long userId = LoginHelper.getUserId(); + if (userId != null) { + BusProjectTeamMember one = projectTeamMemberService.lambdaQuery() + .eq(BusProjectTeamMember::getMemberId, userId) + .eq(BusProjectTeamMember::getPostId, "0") + .one(); + if (one != null) { + lqw.eq(HseSafetyInspection::getCorrectorId, userId); + } + } + Page result = this.page(pageQuery.build(), lqw); return TableDataInfo.build(this.getVoPage(result)); } @@ -359,13 +373,6 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl userIdList = Stream.concat( - safetyInspectionList.stream().map(HseSafetyInspection::getCorrectorId), - safetyInspectionList.stream().map(HseSafetyInspection::getCreateBy) - ).distinct().toList(); - List userVoList = userService.selectUserByIds(userIdList, null); - Map userMap = userVoList.stream().collect(Collectors.toMap(SysUserVo::getUserId, SysUserVo::getNickName)); // 对象列表 => 封装对象列表 List safetyInspectionVoList = safetyInspectionList.stream().map(inspection -> { HseSafetyInspectionVo qualityInspectionVo = new HseSafetyInspectionVo(); @@ -463,10 +470,9 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl queryPageList(HseViolationRecordQueryReq req, PageQuery pageQuery) { - Page violationRecordPage = this.page(pageQuery.build(), this.buildQueryWrapper(req)); + LambdaQueryWrapper lqw = this.buildQueryWrapper(req); + Long userId = LoginHelper.getUserId(); + if (userId != null) { + BusProjectTeamMember one = projectTeamMemberService.lambdaQuery() + .eq(BusProjectTeamMember::getMemberId, userId) + .eq(BusProjectTeamMember::getPostId, "0") + .one(); + if (one != null) { + lqw.eq(HseViolationRecord::getCorrectorId, userId); + } + } + Page violationRecordPage = this.page(pageQuery.build(), lqw); return TableDataInfo.build(this.getVoPage(violationRecordPage)); } @@ -247,8 +264,10 @@ public class HseViolationRecordServiceImpl extends ServiceImpl