Browse Source

删除-step1 永久删除

master
shihao0303 2 months ago
parent
commit
5a584bbd74
  1. 30
      src/main/java/com/biutag/supervision/constants/enums/DeleteStatusEnum.java
  2. 12
      src/main/java/com/biutag/supervision/controller/report/ReportProjectController.java
  3. 3
      src/main/java/com/biutag/supervision/pojo/entity/InformMessage.java
  4. 3
      src/main/java/com/biutag/supervision/pojo/entity/InvertRecord.java
  5. 3
      src/main/java/com/biutag/supervision/pojo/entity/report/ReportFile.java
  6. 3
      src/main/java/com/biutag/supervision/pojo/entity/report/ReportFlow.java
  7. 4
      src/main/java/com/biutag/supervision/pojo/entity/report/ReportProject.java
  8. 3
      src/main/java/com/biutag/supervision/pojo/entity/report/ReportReview.java
  9. 3
      src/main/java/com/biutag/supervision/pojo/entity/warning/WarningContent.java
  10. 2
      src/main/java/com/biutag/supervision/pojo/entity/warning/WarningRecord.java
  11. 23
      src/main/java/com/biutag/supervision/pojo/param/Report/ReportDeleteParam.java
  12. 228
      src/main/java/com/biutag/supervision/service/Report/ReportProjectService.java

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

12
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<Void> 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();
}

3
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

3
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

3
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;

3
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;

4
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

3
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;

3
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;

2
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;

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

228
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<ReportProjectMapper, Repor
private final ReportFlowService reportFlowService;
@Resource
private ReportReviewMapper reviewMapper;
@Resource
private ReportFileMapper reportFileMapper;
@Resource
private ReportFlowMapper reportFlowMapper;
@Resource
private InformMessageMapper informMessageMapper;
@Resource
private WarningContentMapper warningContentMapper;
public Page<EntryWindowVo> getPage(Page<ReportProject> page, QueryWrapper<ReportProject> lambdaQueryWrapper){
return baseMapper.queryPage(page,lambdaQueryWrapper);
@Resource
private WarningRecordMapper warningRecordMapper;
@Resource
private InvertRecordMapper invertRecordMapper;
public Page<EntryWindowVo> getPage(Page<ReportProject> page, QueryWrapper<ReportProject> lambdaQueryWrapper) {
return baseMapper.queryPage(page, lambdaQueryWrapper);
}
public Page<EntryWindowVo> getPageWarning(Page<ReportProject> page, QueryWrapper<ReportProject> lambdaQueryWrapper,String warningState){
return baseMapper.queryPageWarning(page,lambdaQueryWrapper,warningState);
public Page<EntryWindowVo> getPageWarning(Page<ReportProject> page, QueryWrapper<ReportProject> lambdaQueryWrapper, String warningState) {
return baseMapper.queryPageWarning(page, lambdaQueryWrapper, warningState);
}
/**
* 获取数据
* */
public Page<ConditionVo> getConditionPage(Page<ReportProject> page,QueryWrapper<ReportProject> lambdaQueryWrapper){
return baseMapper.queryPageCondition(page,lambdaQueryWrapper);
*/
public Page<ConditionVo> getConditionPage(Page<ReportProject> page, QueryWrapper<ReportProject> lambdaQueryWrapper) {
return baseMapper.queryPageCondition(page, lambdaQueryWrapper);
}
/**
* 获取数据详情
* */
public List<ReportProject> getProjectList(ReportProjectQueryParam queryParam){
*/
public List<ReportProject> getProjectList(ReportProjectQueryParam queryParam) {
UserAuth user = UserContextHolder.getCurrentUser();
LambdaQueryWrapper<ReportProject> queryWrapper=new LambdaQueryWrapper<ReportProject>()
.like(StrUtil.isNotBlank(queryParam.getName()),ReportProject::getReportName,queryParam.getName()).last("limit 100")
LambdaQueryWrapper<ReportProject> queryWrapper = new LambdaQueryWrapper<ReportProject>()
.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<LocalDateTime> dateTimes = new ArrayList<>();
dateTimes.add(project.getServiceStartTime());
dateTimes.add(project.getServiceEndTime());
@ -124,45 +144,45 @@ public class ReportProjectService extends ServiceImpl<ReportProjectMapper, Repor
}
vo.setProject(project);
//审核信息
ReportReview review = reportReviewService.getOne(new LambdaQueryWrapper<ReportReview>().eq(ReportReview::getReportId,id));
if(ObjectUtil.isNotEmpty(review)){
ReportReview review = reportReviewService.getOne(new LambdaQueryWrapper<ReportReview>().eq(ReportReview::getReportId, id));
if (ObjectUtil.isNotEmpty(review)) {
vo.setReview(review);
}else{
review =new ReportReview();
} else {
review = new ReportReview();
vo.setReview(review);
}
//项目附件
List<ReportFile> reportFiles = fileService.list(new LambdaQueryWrapper<ReportFile>().eq(ReportFile::getReportId,id));
List<ReportFileVo> reportFileVos = reportFiles.stream().map(s->{
List<ReportFile> reportFiles = fileService.list(new LambdaQueryWrapper<ReportFile>().eq(ReportFile::getReportId, id));
List<ReportFileVo> 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<String,List<ReportFileVo>> reportFileMap= reportFileVos.stream()
if (CollectionUtil.isNotEmpty(reportFileVos)) {
Map<String, List<ReportFileVo>> reportFileMap = reportFileVos.stream()
.collect(Collectors.groupingBy(ReportFileVo::getFileNode));
vo.setFiles(reportFileMap);
}else{
Map<String,List<ReportFileVo>> reportFileMap =new HashMap<>();
} else {
Map<String, List<ReportFileVo>> reportFileMap = new HashMap<>();
vo.setFiles(reportFileMap);
}
//
List<ReportFlow> flows =reportFlowService.list(new LambdaQueryWrapper<ReportFlow>().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<ReportFlow> flows = reportFlowService.list(new LambdaQueryWrapper<ReportFlow>().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<String> isFileFlow(String node){
public List<String> 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<ReportProjectMapper, Repor
case "third" -> 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<ReportProject>().eq(ReportProject::getId,id).orderByDesc(ReportProject::getCrtTime));
BeanUtil.copyProperties(project,vo);
List<ReportFlow> flows =reportFlowService.list(new LambdaQueryWrapper<ReportFlow>().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<ReportProject>().eq(ReportProject::getId, id).orderByDesc(ReportProject::getCrtTime));
BeanUtil.copyProperties(project, vo);
List<ReportFlow> flows = reportFlowService.list(new LambdaQueryWrapper<ReportFlow>().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<ReportProjectMapper, Repor
/**
* 新增或修改
* */
*/
@Transactional(rollbackFor = Exception.class)
public ReportProjectVo addOrUpdate(ReportProjectQueryParam queryParam){
public ReportProjectVo addOrUpdate(ReportProjectQueryParam queryParam) {
UserAuth user = UserContextHolder.getCurrentUser();
if(CollectionUtil.isNotEmpty(queryParam.getProject().getServiceTime())){
if (CollectionUtil.isNotEmpty(queryParam.getProject().getServiceTime())) {
List<LocalDateTime> 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<ReportProjectMapper, Repor
flow.setType("report");
flow.setIsInit("1");
reportFlowService.save(flow);
}else{
} else {
queryParam.getProject().setCrtTime(LocalDateTime.now());
baseMapper.insertOrUpdate(queryParam.getProject());
}
List<ReportFile> reportFiles =fileService.list(new LambdaQueryWrapper<ReportFile>().eq(ReportFile::getReportId,queryParam.getProject().getId()));
if(CollectionUtil.isNotEmpty(reportFiles)){
List<ReportFile> reportFiles = fileService.list(new LambdaQueryWrapper<ReportFile>().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<ReportFile> files =new ArrayList<>();
queryParam.getFiles().get(key).forEach(s->{
ReportFile file =new ReportFile();
for (String key : queryParam.getFiles().keySet()) {
List<ReportFile> 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<ReportProjectMapper, Repor
}
return getDetail(queryParam.getProject().getId());
}
/**
* 删除报审项目
* */
public Boolean delData(ReportProjectQueryParam queryParam){
if(CollectionUtil.isNotEmpty(queryParam.getFiles())){
for (String key : queryParam.getFiles().keySet()){
*/
public Boolean delData(ReportProjectQueryParam queryParam) {
if (CollectionUtil.isNotEmpty(queryParam.getFiles())) {
for (String key : queryParam.getFiles().keySet()) {
fileService.removeBatchByIds(queryParam.getFiles().get(key));
}
}
return baseMapper.deleteById(queryParam.getId()) > 0;
return baseMapper.deleteById(queryParam.getId()) > 0;
}
public List<ProjectWorkVo> getProjectWork(ProjectWorkQueryParam queryParam){
public List<ProjectWorkVo> 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<ReportReview>()
.set(ReportReview::getFinalizationPath, queryParam.getReview().getFinalizationPath())
.eq(ReportReview::getId, queryParam.getReview().getId())
);
public boolean upFinalizationPath(ReportProjectQueryParam queryParam){
}
return reportReviewService.update(new LambdaUpdateWrapper<ReportReview>()
.set(ReportReview::getFinalizationPath,queryParam.getReview().getFinalizationPath())
.eq(ReportReview::getId,queryParam.getReview().getId())
) ;
@Transactional(rollbackFor = Exception.class)
public Result<Void> 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 <T> void deleteByColumn (BaseMapper<T> mapper, SFunction<T, ?> column, String id ){
LambdaQueryWrapper<T> wrapper = Wrappers.<T>lambdaQuery().eq(column, id);
mapper.delete(wrapper);
}
}

Loading…
Cancel
Save