From 5a584bbd74a5984e7755694feec867c6144ccad7 Mon Sep 17 00:00:00 2001 From: shihao0303 <2936013465@qq.com> Date: Wed, 3 Dec 2025 15:48:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4-step1=20=20=E6=B0=B8?= =?UTF-8?q?=E4=B9=85=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constants/enums/DeleteStatusEnum.java | 30 +++ .../report/ReportProjectController.java | 12 +- .../pojo/entity/InformMessage.java | 3 + .../supervision/pojo/entity/InvertRecord.java | 3 + .../pojo/entity/report/ReportFile.java | 3 + .../pojo/entity/report/ReportFlow.java | 3 + .../pojo/entity/report/ReportProject.java | 4 + .../pojo/entity/report/ReportReview.java | 3 + .../pojo/entity/warning/WarningContent.java | 3 + .../pojo/entity/warning/WarningRecord.java | 2 + .../pojo/param/Report/ReportDeleteParam.java | 23 ++ .../service/Report/ReportProjectService.java | 228 +++++++++++------- 12 files changed, 223 insertions(+), 94 deletions(-) create mode 100644 src/main/java/com/biutag/supervision/constants/enums/DeleteStatusEnum.java create mode 100644 src/main/java/com/biutag/supervision/pojo/param/Report/ReportDeleteParam.java diff --git a/src/main/java/com/biutag/supervision/constants/enums/DeleteStatusEnum.java b/src/main/java/com/biutag/supervision/constants/enums/DeleteStatusEnum.java new file mode 100644 index 0000000..8a24f0e --- /dev/null +++ b/src/main/java/com/biutag/supervision/constants/enums/DeleteStatusEnum.java @@ -0,0 +1,30 @@ +package com.biutag.supervision.constants.enums; + +/** + * @Auther: sh + * @Version 1.0 + * @Description: 是否删除枚举 + */ +public enum DeleteStatusEnum { + + YES(1, "是"), + NO(0, "否"), + ; + private final int code; + private final String desc; + + DeleteStatusEnum(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public int getCode() { + return code; + } + + public String getDesc() { + return desc; + } + +} + diff --git a/src/main/java/com/biutag/supervision/controller/report/ReportProjectController.java b/src/main/java/com/biutag/supervision/controller/report/ReportProjectController.java index 3a5244d..0c80e67 100644 --- a/src/main/java/com/biutag/supervision/controller/report/ReportProjectController.java +++ b/src/main/java/com/biutag/supervision/controller/report/ReportProjectController.java @@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.supervision.common.UserContextHolder; import com.biutag.supervision.constants.AppConstants; +import com.biutag.supervision.constants.enums.DeleteStatusEnum; import com.biutag.supervision.constants.enums.FlowNodeEnum; import com.biutag.supervision.constants.enums.RoleCodeEnum; import com.biutag.supervision.mapper.Recessed.RecessedLogMapper; @@ -29,6 +30,7 @@ import com.biutag.supervision.pojo.entity.report.ReportReview; import com.biutag.supervision.pojo.enums.FlowEnum; import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.pojo.param.Recessed.RecessedParam; +import com.biutag.supervision.pojo.param.Report.ReportDeleteParam; import com.biutag.supervision.pojo.param.Report.ReportProjectQueryParam; import com.biutag.supervision.pojo.param.entryWindow.EntryWindowQueryParam; import com.biutag.supervision.pojo.param.statement.StatementQueryParam; @@ -328,9 +330,13 @@ public class ReportProjectController { @DeleteMapping("/{id}") - public Result delDetail(@PathVariable("id")String id){ - reportProjectService.removeById(id); - return Result.success(); + public Result delDetail(@PathVariable("id")String id){ + ReportDeleteParam reportDeleteParam = new ReportDeleteParam(); + reportDeleteParam.setId(id); + reportDeleteParam.setIsDel(DeleteStatusEnum.YES.getCode()); + return reportProjectService.delete(reportDeleteParam); +// reportProjectService.removeById(id); +// return Result.success(); } diff --git a/src/main/java/com/biutag/supervision/pojo/entity/InformMessage.java b/src/main/java/com/biutag/supervision/pojo/entity/InformMessage.java index cd447a6..06672a8 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/InformMessage.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/InformMessage.java @@ -2,11 +2,14 @@ package com.biutag.supervision.pojo.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.time.LocalDateTime; @Data +@TableName("inform_message") public class InformMessage { @TableId diff --git a/src/main/java/com/biutag/supervision/pojo/entity/InvertRecord.java b/src/main/java/com/biutag/supervision/pojo/entity/InvertRecord.java index 0b130d9..8910b89 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/InvertRecord.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/InvertRecord.java @@ -3,11 +3,14 @@ package com.biutag.supervision.pojo.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.time.LocalDateTime; @Data +@TableName("invert_record") public class InvertRecord { @TableId diff --git a/src/main/java/com/biutag/supervision/pojo/entity/report/ReportFile.java b/src/main/java/com/biutag/supervision/pojo/entity/report/ReportFile.java index 2307204..e5249d9 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/report/ReportFile.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/report/ReportFile.java @@ -2,8 +2,10 @@ package com.biutag.supervision.pojo.entity.report; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.biutag.supervision.pojo.vo.FileVo; import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; import org.springframework.format.annotation.DateTimeFormat; @@ -15,6 +17,7 @@ import java.time.LocalDateTime; */ //报审项目附件 @Getter @Setter +@TableName("report_file") public class ReportFile { @TableId private String id; diff --git a/src/main/java/com/biutag/supervision/pojo/entity/report/ReportFlow.java b/src/main/java/com/biutag/supervision/pojo/entity/report/ReportFlow.java index e7b6e22..6c56769 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/report/ReportFlow.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/report/ReportFlow.java @@ -2,6 +2,8 @@ package com.biutag.supervision.pojo.entity.report; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.Getter; import lombok.Setter; @@ -11,6 +13,7 @@ import java.time.LocalDateTime; @Getter @Setter +@TableName("report_flow") public class ReportFlow { @TableId private String id; diff --git a/src/main/java/com/biutag/supervision/pojo/entity/report/ReportProject.java b/src/main/java/com/biutag/supervision/pojo/entity/report/ReportProject.java index 0f4169a..efb03cd 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/report/ReportProject.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/report/ReportProject.java @@ -2,7 +2,10 @@ package com.biutag.supervision.pojo.entity.report; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.biutag.supervision.constants.enums.DeleteStatusEnum; import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; import org.springframework.cglib.core.Local; @@ -15,6 +18,7 @@ import java.util.List; //报审项目 @Getter @Setter +@TableName("report_project") public class ReportProject { @TableId diff --git a/src/main/java/com/biutag/supervision/pojo/entity/report/ReportReview.java b/src/main/java/com/biutag/supervision/pojo/entity/report/ReportReview.java index 1a46e68..809d593 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/report/ReportReview.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/report/ReportReview.java @@ -2,7 +2,9 @@ package com.biutag.supervision.pojo.entity.report; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; import org.springframework.cglib.core.Local; @@ -14,6 +16,7 @@ import java.time.LocalDateTime; //报审信息 @Getter @Setter +@TableName("report_review") public class ReportReview { @TableId private String id; diff --git a/src/main/java/com/biutag/supervision/pojo/entity/warning/WarningContent.java b/src/main/java/com/biutag/supervision/pojo/entity/warning/WarningContent.java index 9d95346..ba01d93 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/warning/WarningContent.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/warning/WarningContent.java @@ -2,9 +2,12 @@ package com.biutag.supervision.pojo.entity.warning; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @Data +@TableName("warning_content") public class WarningContent { @TableId private String id; diff --git a/src/main/java/com/biutag/supervision/pojo/entity/warning/WarningRecord.java b/src/main/java/com/biutag/supervision/pojo/entity/warning/WarningRecord.java index 846f18d..4122bf4 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/warning/WarningRecord.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/warning/WarningRecord.java @@ -2,6 +2,7 @@ package com.biutag.supervision.pojo.entity.warning; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.biutag.supervision.pojo.entity.InvertRecord; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; @@ -10,6 +11,7 @@ import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; @Data +@TableName("warning_record") public class WarningRecord { @TableId private String id; diff --git a/src/main/java/com/biutag/supervision/pojo/param/Report/ReportDeleteParam.java b/src/main/java/com/biutag/supervision/pojo/param/Report/ReportDeleteParam.java new file mode 100644 index 0000000..4db668a --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/param/Report/ReportDeleteParam.java @@ -0,0 +1,23 @@ +package com.biutag.supervision.pojo.param.Report; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @Auther: sh + * @Version 1.0 + * @Description: 删除参数 + */ +@Data +public class ReportDeleteParam { + + //项目id + private String id; + + /** + * @see com.biutag.supervision.constants.enums.DeleteStatusEnum + */ + @Schema(description = "是否删除") + private int isDel; +} + diff --git a/src/main/java/com/biutag/supervision/service/Report/ReportProjectService.java b/src/main/java/com/biutag/supervision/service/Report/ReportProjectService.java index 7cf7654..7a8fc7a 100644 --- a/src/main/java/com/biutag/supervision/service/Report/ReportProjectService.java +++ b/src/main/java/com/biutag/supervision/service/Report/ReportProjectService.java @@ -4,63 +4,62 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import com.alibaba.excel.EasyExcel; -import com.alibaba.excel.ExcelWriter; -import com.alibaba.excel.write.metadata.WriteSheet; -import com.alibaba.excel.write.metadata.fill.FillConfig; -import com.alibaba.excel.write.metadata.fill.FillWrapper; +import com.alibaba.excel.util.StringUtils; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.biutag.supervision.common.UserContextHolder; import com.biutag.supervision.constants.AppConstants; import com.biutag.supervision.constants.enums.RoleCodeEnum; +import com.biutag.supervision.mapper.InformMessageMapper; +import com.biutag.supervision.mapper.Invest.InvertRecordMapper; import com.biutag.supervision.mapper.Report.ReportFileMapper; +import com.biutag.supervision.mapper.Report.ReportFlowMapper; import com.biutag.supervision.mapper.Report.ReportProjectMapper; +import com.biutag.supervision.mapper.Report.ReportReviewMapper; +import com.biutag.supervision.mapper.Warning.WarningContentMapper; +import com.biutag.supervision.mapper.Warning.WarningRecordMapper; import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.entity.InformMessage; +import com.biutag.supervision.pojo.entity.InvertRecord; import com.biutag.supervision.pojo.entity.report.ReportFile; import com.biutag.supervision.pojo.entity.report.ReportFlow; import com.biutag.supervision.pojo.entity.report.ReportProject; import com.biutag.supervision.pojo.entity.report.ReportReview; +import com.biutag.supervision.pojo.entity.warning.WarningContent; +import com.biutag.supervision.pojo.entity.warning.WarningRecord; import com.biutag.supervision.pojo.enums.FlowEnum; import com.biutag.supervision.pojo.enums.FlowStateEnum; import com.biutag.supervision.pojo.model.UserAuth; +import com.biutag.supervision.pojo.param.Report.ReportDeleteParam; import com.biutag.supervision.pojo.param.Report.ReportProjectQueryParam; import com.biutag.supervision.pojo.param.Work.ProjectWorkQueryParam; -import com.biutag.supervision.pojo.param.entryWindow.EntryWindowQueryParam; import com.biutag.supervision.pojo.vo.FileVo; import com.biutag.supervision.pojo.vo.entryWindow.EntryWindowVo; -import com.biutag.supervision.pojo.vo.excel.ExcelControlPriceVo; import com.biutag.supervision.pojo.vo.report.ReportFileVo; import com.biutag.supervision.pojo.vo.report.ReportHomeVo; import com.biutag.supervision.pojo.vo.report.ReportProjectVo; import com.biutag.supervision.pojo.vo.statement.ConditionVo; import com.biutag.supervision.pojo.vo.work.ProjectTabWorkVo; import com.biutag.supervision.pojo.vo.work.ProjectWorkVo; -import io.swagger.v3.core.util.Json; -import jakarta.servlet.ServletOutputStream; -import jakarta.servlet.http.HttpServletResponse; +import jakarta.annotation.Resource; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.apache.poi.util.IOUtils; -import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; - -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.net.http.HttpResponse; + import java.time.LocalDateTime; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; @@ -78,45 +77,66 @@ public class ReportProjectService extends ServiceImpl getPage(Page page, QueryWrapper lambdaQueryWrapper){ - return baseMapper.queryPage(page,lambdaQueryWrapper); + @Resource + private WarningRecordMapper warningRecordMapper; + + @Resource + private InvertRecordMapper invertRecordMapper; + + + public Page getPage(Page page, QueryWrapper lambdaQueryWrapper) { + return baseMapper.queryPage(page, lambdaQueryWrapper); } - public Page getPageWarning(Page page, QueryWrapper lambdaQueryWrapper,String warningState){ - return baseMapper.queryPageWarning(page,lambdaQueryWrapper,warningState); + public Page getPageWarning(Page page, QueryWrapper lambdaQueryWrapper, String warningState) { + return baseMapper.queryPageWarning(page, lambdaQueryWrapper, warningState); } /** * 获取数据 - * */ - public Page getConditionPage(Page page,QueryWrapper lambdaQueryWrapper){ - return baseMapper.queryPageCondition(page,lambdaQueryWrapper); + */ + public Page getConditionPage(Page page, QueryWrapper lambdaQueryWrapper) { + return baseMapper.queryPageCondition(page, lambdaQueryWrapper); } /** * 获取数据详情 - * */ - public List getProjectList(ReportProjectQueryParam queryParam){ + */ + public List getProjectList(ReportProjectQueryParam queryParam) { UserAuth user = UserContextHolder.getCurrentUser(); - LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper() - .like(StrUtil.isNotBlank(queryParam.getName()),ReportProject::getReportName,queryParam.getName()).last("limit 100") + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .like(StrUtil.isNotBlank(queryParam.getName()), ReportProject::getReportName, queryParam.getName()).last("limit 100") .orderByDesc(ReportProject::getCrtTime); // 权限 if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && !user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode())) { - queryWrapper.eq(ReportProject::getApplicantId,user.getUserName()); + queryWrapper.eq(ReportProject::getApplicantId, user.getUserName()); } - return baseMapper.selectList(queryWrapper); + return baseMapper.selectList(queryWrapper); } + /** * 获取报审项目详情 - * */ - public ReportProjectVo getDetail(String id){ - ReportProjectVo vo =new ReportProjectVo(); + */ + public ReportProjectVo getDetail(String id) { + ReportProjectVo vo = new ReportProjectVo(); //项目信息 ReportProject project = baseMapper.selectById(id); - if(ObjectUtil.isNotEmpty(project.getServiceStartTime()) && ObjectUtil.isNotEmpty(project.getServiceEndTime())){ + if (ObjectUtil.isNotEmpty(project.getServiceStartTime()) && ObjectUtil.isNotEmpty(project.getServiceEndTime())) { List dateTimes = new ArrayList<>(); dateTimes.add(project.getServiceStartTime()); dateTimes.add(project.getServiceEndTime()); @@ -124,45 +144,45 @@ public class ReportProjectService extends ServiceImpl().eq(ReportReview::getReportId,id)); - if(ObjectUtil.isNotEmpty(review)){ + ReportReview review = reportReviewService.getOne(new LambdaQueryWrapper().eq(ReportReview::getReportId, id)); + if (ObjectUtil.isNotEmpty(review)) { vo.setReview(review); - }else{ - review =new ReportReview(); + } else { + review = new ReportReview(); vo.setReview(review); } //项目附件 - List reportFiles = fileService.list(new LambdaQueryWrapper().eq(ReportFile::getReportId,id)); - List reportFileVos = reportFiles.stream().map(s->{ + List reportFiles = fileService.list(new LambdaQueryWrapper().eq(ReportFile::getReportId, id)); + List reportFileVos = reportFiles.stream().map(s -> { ReportFileVo vos = new ReportFileVo(); - BeanUtil.copyProperties(s,vos); - vos.setFileData(JSON.parseArray(s.getFiles(),FileVo.class)); + BeanUtil.copyProperties(s, vos); + vos.setFileData(JSON.parseArray(s.getFiles(), FileVo.class)); return vos; }).toList(); //判断有无附件 - if(CollectionUtil.isNotEmpty(reportFileVos)){ - Map> reportFileMap= reportFileVos.stream() + if (CollectionUtil.isNotEmpty(reportFileVos)) { + Map> reportFileMap = reportFileVos.stream() .collect(Collectors.groupingBy(ReportFileVo::getFileNode)); vo.setFiles(reportFileMap); - }else{ - Map> reportFileMap =new HashMap<>(); + } else { + Map> reportFileMap = new HashMap<>(); vo.setFiles(reportFileMap); } // - List flows =reportFlowService.list(new LambdaQueryWrapper().eq(ReportFlow::getReportId,id).eq(ReportFlow::getType,"report")); - flows=flows.stream().filter(s->!s.getApproverState().equals(FlowStateEnum.Reject.getLabel()) && isFileFlow(project.getNode()).contains(s.getReportLink())) + List flows = reportFlowService.list(new LambdaQueryWrapper().eq(ReportFlow::getReportId, id).eq(ReportFlow::getType, "report")); + flows = flows.stream().filter(s -> !s.getApproverState().equals(FlowStateEnum.Reject.getLabel()) && isFileFlow(project.getNode()).contains(s.getReportLink())) .collect(Collectors.toMap( ReportFlow::getReportCode, Function.identity(), (existing, replacement) -> existing )).values().stream().toList(); - if(CollectionUtil.isNotEmpty(flows)){ + if (CollectionUtil.isNotEmpty(flows)) { vo.setFlows(flows); } - return vo; + return vo; } - public List isFileFlow(String node){ + public List isFileFlow(String node) { return switch (node) { case "review" -> List.of("initial"); case "first" -> List.of("review", "initial"); @@ -170,25 +190,25 @@ public class ReportProjectService extends ServiceImpl List.of("second", "review", "initial", "first"); case "Lead" -> List.of("second", "review", "initial", "first", "third"); case "original" -> List.of("second", "review", "initial", "first", "third", "Lead"); - case "audit" -> List.of( "original", "second", "review", "initial", "first", "third", "Lead"); + case "audit" -> List.of("original", "second", "review", "initial", "first", "third", "Lead"); case "end" -> List.of("audit", "original", "second", "review", "initial", "first", "third", "Lead"); default -> new ArrayList<>(); }; } - public ReportHomeVo getReportHomeVo(String id){ - ReportHomeVo vo=new ReportHomeVo(); - ReportProject project=baseMapper.selectOne(new LambdaQueryWrapper().eq(ReportProject::getId,id).orderByDesc(ReportProject::getCrtTime)); - BeanUtil.copyProperties(project,vo); - List flows =reportFlowService.list(new LambdaQueryWrapper().eq(ReportFlow::getReportId,id).eq(ReportFlow::getType,"report")); - flows=flows.stream().filter(s->!s.getApproverState().equals(FlowStateEnum.Reject.getLabel()) && isFileFlow(project.getNode()).contains(s.getReportLink())) + public ReportHomeVo getReportHomeVo(String id) { + ReportHomeVo vo = new ReportHomeVo(); + ReportProject project = baseMapper.selectOne(new LambdaQueryWrapper().eq(ReportProject::getId, id).orderByDesc(ReportProject::getCrtTime)); + BeanUtil.copyProperties(project, vo); + List flows = reportFlowService.list(new LambdaQueryWrapper().eq(ReportFlow::getReportId, id).eq(ReportFlow::getType, "report")); + flows = flows.stream().filter(s -> !s.getApproverState().equals(FlowStateEnum.Reject.getLabel()) && isFileFlow(project.getNode()).contains(s.getReportLink())) .collect(Collectors.toMap( ReportFlow::getReportCode, Function.identity(), (existing, replacement) -> existing )).values().stream().toList(); - if(CollectionUtil.isNotEmpty(flows)){ + if (CollectionUtil.isNotEmpty(flows)) { vo.setFlows(flows); } return vo; @@ -196,16 +216,16 @@ public class ReportProjectService extends ServiceImpl serviceTime = queryParam.getProject().getServiceTime(); queryParam.getProject().setServiceStartTime(serviceTime.get(0)); queryParam.getProject().setServiceEndTime(serviceTime.get(1)); } - if(!StrUtil.isNotEmpty(queryParam.getProject().getId()) ){ + if (!StrUtil.isNotEmpty(queryParam.getProject().getId())) { baseMapper.insertOrUpdate(queryParam.getProject()); ReportFlow flow = new ReportFlow(); flow.setReportId(queryParam.getProject().getId()); @@ -218,30 +238,30 @@ public class ReportProjectService extends ServiceImpl reportFiles =fileService.list(new LambdaQueryWrapper().eq(ReportFile::getReportId,queryParam.getProject().getId())); - if(CollectionUtil.isNotEmpty(reportFiles)){ + List reportFiles = fileService.list(new LambdaQueryWrapper().eq(ReportFile::getReportId, queryParam.getProject().getId())); + if (CollectionUtil.isNotEmpty(reportFiles)) { fileService.removeBatchByIds(reportFiles.stream().map(ReportFile::getId).toList()); } - if(ObjectUtil.isNotEmpty(queryParam.getReview())){ + if (ObjectUtil.isNotEmpty(queryParam.getReview())) { queryParam.getReview().setReportId(queryParam.getProject().getId()); reportReviewService.saveOrUpdate(queryParam.getReview()); } - if(CollectionUtil.isNotEmpty(queryParam.getFiles())){ + if (CollectionUtil.isNotEmpty(queryParam.getFiles())) { - for (String key : queryParam.getFiles().keySet()){ - List files =new ArrayList<>(); - queryParam.getFiles().get(key).forEach(s->{ - ReportFile file =new ReportFile(); + for (String key : queryParam.getFiles().keySet()) { + List files = new ArrayList<>(); + queryParam.getFiles().get(key).forEach(s -> { + ReportFile file = new ReportFile(); s.setFileNode(key); s.setReportId(queryParam.getProject().getId()); - BeanUtil.copyProperties(s,file); + BeanUtil.copyProperties(s, file); file.setFiles(JSONObject.toJSONString(s.getFileData())); files.add(file); }); @@ -251,36 +271,62 @@ public class ReportProjectService extends ServiceImpl 0; + return baseMapper.deleteById(queryParam.getId()) > 0; } - public List getProjectWork(ProjectWorkQueryParam queryParam){ + public List getProjectWork(ProjectWorkQueryParam queryParam) { return baseMapper.getProjectWorkVoList(queryParam); } - public ProjectTabWorkVo getProjectTabWorkVo(ProjectWorkQueryParam queryParam){ + public ProjectTabWorkVo getProjectTabWorkVo(ProjectWorkQueryParam queryParam) { return baseMapper.getProjectTabWorkVo(queryParam); } + public boolean upFinalizationPath(ReportProjectQueryParam queryParam) { + return reportReviewService.update(new LambdaUpdateWrapper() + .set(ReportReview::getFinalizationPath, queryParam.getReview().getFinalizationPath()) + .eq(ReportReview::getId, queryParam.getReview().getId()) + ); - public boolean upFinalizationPath(ReportProjectQueryParam queryParam){ + } - return reportReviewService.update(new LambdaUpdateWrapper() - .set(ReportReview::getFinalizationPath,queryParam.getReview().getFinalizationPath()) - .eq(ReportReview::getId,queryParam.getReview().getId()) - ) ; + @Transactional(rollbackFor = Exception.class) + public Result delete(ReportDeleteParam reportDeleteParam) { + String id = reportDeleteParam.getId(); + if (StringUtils.isBlank(id)) { + return Result.failed("项目id不能为空"); + } + this.removeById(id); + deleteByColumn(reviewMapper, ReportReview::getReportId, id); + deleteByColumn(reportFileMapper, ReportFile::getReportId, id); + deleteByColumn(reportFlowMapper, ReportFlow::getReportId, id); + deleteByColumn(informMessageMapper, InformMessage::getReportId, id); + deleteByColumn(warningContentMapper, WarningContent::getWarningId, id); + deleteByColumn(warningRecordMapper, WarningRecord::getReportId, id); + deleteByColumn(invertRecordMapper, InvertRecord::getReportId, id); + return Result.success(); } + + private void deleteByColumn (BaseMapper mapper, SFunction column, String id ){ + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery().eq(column, id); + mapper.delete(wrapper); + } + + } + +