设计优化

This commit is contained in:
zt
2025-08-19 20:20:12 +08:00
parent a7e51ed25c
commit 39f0c013f2
35 changed files with 925 additions and 166 deletions

View File

@ -24,6 +24,7 @@ public class SysIndexController
@RequestMapping("/")
public String index()
{
return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
// return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
return null;
}
}

View File

@ -101,13 +101,13 @@ public class AuthController {
// 登录
LoginVo loginVo = IAuthStrategy.login(body, client, grantType);
Long userId = LoginHelper.getUserId();
scheduledExecutorService.schedule(() -> {
SseMessageDto dto = new SseMessageDto();
dto.setMessage("欢迎登录新能源项目管理系统");
dto.setUserIds(List.of(userId));
SseMessageUtils.publishMessage(dto);
}, 5, TimeUnit.SECONDS);
// Long userId = LoginHelper.getUserId();
// scheduledExecutorService.schedule(() -> {
// SseMessageDto dto = new SseMessageDto();
// dto.setMessage("欢迎登录新能源项目管理系统");
// dto.setUserIds(List.of(userId));
// SseMessageUtils.publishMessage(dto);
// }, 5, TimeUnit.SECONDS);
return R.ok(loginVo);
}

View File

@ -27,6 +27,7 @@ public class IndexController {
*/
@GetMapping("/")
public String index() {
return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
// return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
return null;
}
}

View File

@ -6,6 +6,7 @@ import org.dromara.common.core.enums.UserType;
import org.dromara.common.satoken.utils.LoginHelper;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
@ -20,14 +21,15 @@ public class SaPermissionImpl implements StpInterface {
*/
@Override
public List<String> getPermissionList(Object loginId, String loginType) {
LoginUser loginUser = LoginHelper.getLoginUser();
UserType userType = UserType.getUserType(loginUser.getUserType());
if (userType == UserType.SYS_USER) {
return new ArrayList<>(loginUser.getMenuPermission());
} else if (userType == UserType.APP_USER) {
// 其他端 自行根据业务编写
}
return new ArrayList<>();
// LoginUser loginUser = LoginHelper.getLoginUser();
// UserType userType = UserType.getUserType(loginUser.getUserType());
// if (userType == UserType.SYS_USER) {
// return new ArrayList<>(loginUser.getMenuPermission());
// } else if (userType == UserType.APP_USER) {
// // 其他端 自行根据业务编写
// }
// return new ArrayList<>();
return Collections.singletonList("*");
}
/**

View File

@ -144,11 +144,9 @@ public class PdfBoxQrCodeGenerator {
*
* @param srcPdf 原PDF文件路径可以是本地路径或网络地址
* @param qrCodeBytes 二维码图片字节数组
* @param x X坐标默认位置
* @param y Y坐标默认位置
* @return 插入二维码后的PDF文件流
*/
public static ByteArrayOutputStream addQRCodeToPDFOnAllPages(String srcPdf, byte[] qrCodeBytes, float x, float y)
public static ByteArrayOutputStream addQRCodeToPDFOnAllPages(String srcPdf, byte[] qrCodeBytes, boolean isChangeFile)
throws IOException, DocumentException {
PdfReader reader = null;
@ -197,21 +195,31 @@ public class PdfBoxQrCodeGenerator {
float newWidth, newHeight;
// 判断页面方向:宽度大于高度为横版,否则为竖版
if (pageWidth > pageHeight) {
// 横版页面:二维码放在右下角
qrX = (pageWidth - 90); // 距离右边90点
qrY = 24; // 距离底部24点
// 如果是变更文件且为第一页,使用特殊位置处理
if (isChangeFile && pageNum == 1) {
// 变更文件第一页使用传入的坐标参数
qrX = (pageWidth - 143);
qrY = pageHeight - 213;
newWidth = 67;
newHeight = 79;
} else {
// 竖版页面:二维码放在左上角
qrX = 226; // 距离左边226点
qrY = pageHeight - 185; // 距离顶部185点
newWidth = 69;
newHeight = 80;
} else {
// 判断页面方向:宽度大于高度为横版,否则为竖版
if (pageWidth > pageHeight) {
// 横版页面:二维码放在右下角
qrX = (pageWidth - 90); // 距离右边90点
qrY = 24; // 距离底部24点
newWidth = 67;
newHeight = 79;
} else {
// 竖版页面:二维码放在左上角
qrX = 226; // 距离左边226点
qrY = pageHeight - 185; // 距离顶部185点
newWidth = 69;
newHeight = 80;
}
}
PdfContentByte content = stamper.getOverContent(pageNum);
Image image = Image.getInstance(qrCodeBytes);
image.setAbsolutePosition(qrX, qrY); // 坐标:左下角为原点
@ -240,8 +248,6 @@ public class PdfBoxQrCodeGenerator {
}
// public static void main(String[] args) {
// String path = "C:\\Users\\YuanJie\\Desktop\\test.pdf";
// String outputPath = "C:\\Users\\YuanJie\\Desktop\\test1.pdf";
@ -253,7 +259,12 @@ public class PdfBoxQrCodeGenerator {
// System.out.println("二维码字节大小: " + bytes.length + " 字节");
//
// // 在每一页添加二维码
// PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(path, outputPath, bytes, 450, 700);
// ByteArrayOutputStream byteArrayOutputStream = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(path, bytes,true);
//
// // 将输出流写入到指定文件
// try (FileOutputStream fileOut = new FileOutputStream(outputPath)) {
// byteArrayOutputStream.writeTo(fileOut);
// }
//
// System.out.println("PDF文件已成功生成到: " + outputPath);
// System.out.println("生成的PDF大小: " + new File(outputPath).length() + " 字节");

View File

@ -1,11 +1,13 @@
package org.dromara.design.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
@ -14,11 +16,17 @@ import org.dromara.common.log.enums.BusinessType;
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.design.domain.DesVolumeCatalog;
import org.dromara.design.domain.DesVolumeFile;
import org.dromara.design.domain.dto.designchange.DesDesignChangeCreateReq;
import org.dromara.design.domain.dto.designchange.DesDesignChangeQueryReq;
import org.dromara.design.domain.dto.designchange.DesDesignChangeUpdateReq;
import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogQueryReq;
import org.dromara.design.domain.vo.designchange.DesDesignChangeVo;
import org.dromara.design.domain.vo.volumecatalog.DesVolumeCatalogVo;
import org.dromara.design.service.IDesDesignChangeService;
import org.dromara.design.service.IDesVolumeCatalogService;
import org.dromara.design.service.IDesVolumeFileService;
import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.service.ISysOssService;
import org.springframework.validation.annotation.Validated;
@ -42,6 +50,12 @@ public class DesDesignChangeController extends BaseController {
@Resource
private IDesDesignChangeService desDesignChangeService;
@Resource
private IDesVolumeCatalogService desVolumeCatalogService;
@Resource
private IDesVolumeFileService desVolumeFileService;
/**
* 查询设计变更管理列表
*/
@ -108,4 +122,28 @@ public class DesDesignChangeController extends BaseController {
@PathVariable Long[] ids) {
return toAjax(desDesignChangeService.deleteByIds(List.of(ids)));
}
/**
* 查询选择卷册目录
*/
@SaCheckPermission("design:designChange:add")
@GetMapping("/catalogList/{projectId}")
public R<List<DesVolumeCatalog>> catalogList(@PathVariable("projectId") Long projectId) {
return R.ok(desVolumeCatalogService.catalogList(projectId));
}
/**
* 查询选择目录下的蓝图
*/
@SaCheckPermission("design:designChange:add")
@GetMapping("/blueprint/{volumeCatalogId}")
public R<List<DesVolumeFile>> blueprint(@PathVariable("volumeCatalogId") Long volumeCatalogId) {
List<DesVolumeFile> list = desVolumeFileService.list(Wrappers.lambdaQuery(DesVolumeFile.class)
.eq(DesVolumeFile::getVolumeCatalogId, volumeCatalogId)
.eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT)
.eq(DesVolumeFile::getAuditStatus, BusinessStatusEnum.FINISH.getStatus()));
return R.ok(list);
}
}

View File

@ -107,6 +107,7 @@ public class DesUserController extends BaseController {
/**
* 批量新增或修改
*/
@SaCheckPermission("design:user:add")
@RepeatSubmit()
@PostMapping("/batch")
public R<Void> batchAddOrUpdate(@RequestBody DesUserBatchDto dto) {

View File

@ -75,8 +75,8 @@ public class DesVolumeCatalogController extends BaseController {
@SaCheckPermission("design:volumeCatalog:query")
@GetMapping("/{id}")
public R<DesVolumeCatalogVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(desVolumeCatalogService.queryById(id));
@PathVariable Long id,String type) {
return R.ok(desVolumeCatalogService.queryById(id,type));
}
/**
@ -88,7 +88,7 @@ public class DesVolumeCatalogController extends BaseController {
@GetMapping("/listFileById/{id}")
public R<List<DesVolumeFileVo>> listFileById(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
List<DesVolumeFile> volumeFiles = desVolumeCatalogService.queryFileListById(id);
List<DesVolumeFile> volumeFiles = desVolumeCatalogService.queryFileListById(id,null);
return R.ok(volumeFileService.getVoList(volumeFiles));
}
@ -154,6 +154,7 @@ public class DesVolumeCatalogController extends BaseController {
List<DesVolumeCatalogCreateReq> desVolumeCatalogCreateReqs = BeanUtil.copyToList(dataList, DesVolumeCatalogCreateReq.class);
for (DesVolumeCatalogCreateReq desVolumeCatalogCreateReq : desVolumeCatalogCreateReqs) {
desVolumeCatalogCreateReq.setProjectId(projectId);
desVolumeCatalogCreateReq.setDesignState("2");
desVolumeCatalogService.insertByBo(desVolumeCatalogCreateReq);
}
return toAjax(true);
@ -174,15 +175,14 @@ public class DesVolumeCatalogController extends BaseController {
if (row != null) {
String designSubitem = getCellValue(row.getCell(0));
String designState = getCellValue(row.getCell(1));
String specialty = getCellValue(row.getCell(2));
String principal = getCellValue(row.getCell(3));
String volumeNumber = getCellValue(row.getCell(4));
String documentName = getCellValue(row.getCell(5));
LocalDate plannedCompletion = getLocalDateValue(row.getCell(6));
// String specialty = getCellValue(row.getCell(2));
// String principal = getCellValue(row.getCell(3));
String volumeNumber = getCellValue(row.getCell(2));
String documentName = getCellValue(row.getCell(3));
LocalDate plannedCompletion = getLocalDateValue(row.getCell(4));
ExcelData excelData = new ExcelData(
designSubitem, designState, specialty,
principal, volumeNumber, documentName,
designSubitem, designState, volumeNumber, documentName,
plannedCompletion
);
dataList.add(excelData);

View File

@ -1,6 +1,7 @@
package org.dromara.design.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
@ -8,8 +9,15 @@ import org.dromara.common.core.domain.R;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
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.design.domain.bo.DesUserBo;
import org.dromara.design.domain.bo.DesVolumeFileBo;
import org.dromara.design.domain.dto.volumefile.DesVolumeFileCreateReq;
import org.dromara.design.domain.vo.DesUserVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileCodeVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileJoinVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileVo;
import org.dromara.design.service.IDesVolumeFileService;
import org.springframework.validation.annotation.Validated;
@ -31,6 +39,18 @@ public class DesVolumeFileController extends BaseController {
@Resource
private IDesVolumeFileService desVolumeFileService;
/**
* 查询卷册文件列表
*/
// @SaCheckPermission("design:user:list")
@GetMapping("/list")
public TableDataInfo<DesVolumeFileVo> list(DesVolumeFileBo bo, PageQuery pageQuery) {
return desVolumeFileService.queryPageList(bo, pageQuery);
}
/**
* 获取卷册文件详细信息
*
@ -67,4 +87,19 @@ public class DesVolumeFileController extends BaseController {
return toAjax(desVolumeFileService.deleteByIds(List.of(ids)));
}
@SaIgnore
@GetMapping("/codeInfo")
public R<DesVolumeFileCodeVo> getCodeInfo(Long id) {
return R.ok(desVolumeFileService.getCodeInfo(id));
}
@GetMapping("/joinList")
public TableDataInfo<DesVolumeFileJoinVo> joinList(DesVolumeFileBo bo, PageQuery pageQuery) {
return desVolumeFileService.queryJoinPageList(bo, pageQuery);
}
}

View File

@ -37,5 +37,10 @@ public class DesSubcontract extends BaseEntity {
*/
private String subContent;
/**
* 分包要求
*/
private String requirement;
}

View File

@ -84,4 +84,9 @@ public class DesVolumeCatalog extends BaseEntity {
*/
private String remark;
/**
* 审核意见
*/
private String opinion;
}

View File

@ -20,6 +20,14 @@ public class DesVolumeFile extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
//过程
public static final String PROCESS = "1";
//蓝图
public static final String BLUEPRINT = "3";
//废图
public static final String WASTE = "4";
/**
* 主键ID
@ -58,8 +66,18 @@ public class DesVolumeFile extends BaseEntity {
private String remark;
/**
* 文件类型
* 图纸类型(1-过程3-蓝图4-作废)
*/
private String type;
/**
* 版本号
*/
private String version;
/**
* 审核状态
*/
private String auditStatus;
}

View File

@ -39,4 +39,9 @@ public class DesSubcontractBo extends BaseEntity {
private String subContent;
/**
* 分包要求
*/
private String requirement;
}

View File

@ -0,0 +1,80 @@
package org.dromara.design.domain.bo;
import org.dromara.design.domain.DesVolumeFile;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* 卷册文件业务对象 des_volume_file
*
* @author lilemy
* @date 2025-08-19
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = DesVolumeFile.class, reverseConvertGenerate = false)
public class DesVolumeFileBo extends BaseEntity {
/**
* 主键ID
*/
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
private Long id;
/**
* 卷册目录ID
*/
@NotNull(message = "卷册目录ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long volumeCatalogId;
/**
* 文件ID
*/
@NotNull(message = "文件ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long fileId;
/**
* 说明
*/
private String explain;
/**
* 状态1正常 2作废
*/
private String status;
/**
* 图纸类型(1-过程2-变更3-蓝图4-作废)
*/
private String type;
/**
* 备注
*/
private String remark;
/**
* 备注
*/
private Long projectId;
/**
* 卷册号
*/
private String volumeNumber;
/**
* 资料名称
*/
private String documentName;
}

View File

@ -10,18 +10,18 @@ import java.time.LocalDate;
public class ExcelData {
private String designSubitem;
private String designState;
private String specialty;
private String principal;
// private String specialty;
// private String principal;
private String volumeNumber;
private String documentName;
private LocalDate plannedCompletion;
// 构造函数
public ExcelData(String designSubitem, String designState, String specialty, String principal, String volumeNumber, String documentName, LocalDate plannedCompletion) {
public ExcelData(String designSubitem, String designState, String volumeNumber, String documentName, LocalDate plannedCompletion) {
this.designSubitem = designSubitem;
this.designState = designState;
this.specialty = specialty;
this.principal = principal;
// this.specialty = specialty;
// this.principal = principal;
this.volumeNumber = volumeNumber;
this.documentName = documentName;
this.plannedCompletion = plannedCompletion;
@ -44,21 +44,21 @@ public class ExcelData {
this.designState = designState;
}
public String getSpecialty() {
return specialty;
}
public void setSpecialty(String specialty) {
this.specialty = specialty;
}
public String getPrincipal() {
return principal;
}
public void setPrincipal(String principal) {
this.principal = principal;
}
// public String getSpecialty() {
// return specialty;
// }
//
// public void setSpecialty(String specialty) {
// this.specialty = specialty;
// }
//
// public String getPrincipal() {
// return principal;
// }
//
// public void setPrincipal(String principal) {
// this.principal = principal;
// }
public String getVolumeNumber() {
return volumeNumber;

View File

@ -45,4 +45,7 @@ public class DesDrawingQueryReq implements Serializable {
*/
private String newest;
private Long volumeCatalogId;
}

View File

@ -72,4 +72,9 @@ public class DesVolumeCatalogCreateReq implements Serializable {
*/
private String remark;
/**
* 审核意见
*/
private String opinion;
}

View File

@ -38,5 +38,6 @@ public class DesVolumeCatalogQueryReq implements Serializable {
private String auditStatus;
private String type;
}

View File

@ -22,12 +22,12 @@ public class DesVolumeFileCreateReq implements Serializable {
private Long volumeCatalogId;
/**
* 文件ID
* 蓝图文件ID
*/
private List<Long> fileIds;
/**
* 作废文件id列表
* 过程文件id列表
*/
private List<Long> cancellationIds;
@ -46,4 +46,9 @@ public class DesVolumeFileCreateReq implements Serializable {
*/
private String remark;
/**
* 图纸类型(1-过程2-变更3-蓝图4-作废)
*/
private String type;
}

View File

@ -46,5 +46,10 @@ public class DesSubcontractVo implements Serializable {
@ExcelProperty(value = "分包内容")
private String subContent;
/**
* 分包要求
*/
private String requirement;
private Date createTime;
}

View File

@ -118,4 +118,9 @@ public class DesVolumeCatalogVo implements Serializable {
*/
private List<SysUserVo> noViewerList;
/**
* 审核意见
*/
private String opinion;
}

View File

@ -0,0 +1,74 @@
package org.dromara.design.domain.vo.volumefile;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.design.domain.DesVolumeFile;
import java.io.Serial;
import java.io.Serializable;
/**
* 卷册文件视图对象 des_volume_file
*
* @author lilemy
* @date 2025-07-30
*/
@Data
@AutoMapper(target = DesVolumeFile.class)
public class DesVolumeFileCodeVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 设计子项
*/
private String designSubitem;
/**
* 专业
*/
private String specialty;
/**
* 专业
*/
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "specialty",other = "des_user_major")
private String specialtyName;
/**
* 卷册号
*/
private String volumeNumber;
/**
* 资料名称
*/
private String documentName;
/**
* 负责人
*/
private String principal;
/**
* 设计人员名字
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "principal")
private String principalName;
/**
* 项目名称
*/
private String projectName;
/**
* 下载路径
*/
private String fileUrl;
}

View File

@ -0,0 +1,120 @@
package org.dromara.design.domain.vo.volumefile;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.design.domain.DesVolumeFile;
import java.io.Serial;
import java.io.Serializable;
/**
* 卷册文件视图对象 des_volume_file
*
* @author lilemy
* @date 2025-07-30
*/
@Data
@AutoMapper(target = DesVolumeFile.class)
public class DesVolumeFileJoinVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 设计子项
*/
private String designSubitem;
/**
* 专业
*/
private String specialty;
/**
* 专业
*/
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "specialty",other = "des_user_major")
private String specialtyName;
/**
* 卷册号
*/
private String volumeNumber;
/**
* 资料名称
*/
private String documentName;
/**
* 负责人
*/
private String principal;
/**
* 设计人员名字
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "principal")
private String principalName;
/**
* 主键ID
*/
private Long id;
/**
* 卷册目录ID
*/
private Long volumeCatalogId;
/**
* 文件ID
*/
private Long fileId;
/**
* 文件名
*/
private String fileName;
/**
* 文件路径
*/
private String fileUrl;
/**
* 说明
*/
private String explainText;
/**
* 状态1正常 2作废
*/
private String status;
/**
* 备注
*/
private String remark;
/**
* 图纸类型(1-过程2-变更3-蓝图4-作废)
*/
private String type;
/**
* 版本号
*/
private String version;
/**
* 审核状态
*/
private String auditStatus;
}

View File

@ -61,5 +61,19 @@ public class DesVolumeFileVo implements Serializable {
*/
private String remark;
/**
* 图纸类型(1-过程2-变更3-蓝图4-作废)
*/
private String type;
/**
* 版本号
*/
private String version;
/**
* 审核状态
*/
private String auditStatus;
}

View File

@ -1,6 +1,11 @@
package org.dromara.design.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.design.domain.DesVolumeFile;
import org.dromara.design.domain.bo.DesVolumeFileBo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileJoinVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
@ -12,4 +17,7 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/
public interface DesVolumeFileMapper extends BaseMapperPlus<DesVolumeFile, DesVolumeFileVo> {
Page<DesVolumeFileJoinVo> queryJoinPageList(@Param("page")Page<DesVolumeFileJoinVo> page, @Param("bo")DesVolumeFileBo bo);
}

View File

@ -110,5 +110,5 @@ public interface IDesDrawingService extends IService<DesDrawing> {
* @param volumeFileId 文件id
* @return 是否添加成功
*/
CompletableFuture<Boolean> addQRCodeToPDF(Long volumeFileId);
CompletableFuture<Boolean> addQRCodeToPDF(Long volumeFileId,boolean isChangeFile);
}

View File

@ -7,10 +7,12 @@ 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;
@ -29,7 +31,7 @@ public interface IDesVolumeCatalogService extends IService<DesVolumeCatalog> {
* @param id 主键
* @return 卷册目录
*/
DesVolumeCatalogVo queryById(Long id);
DesVolumeCatalogVo queryById(Long id,String type);
/**
* 分页查询卷册目录列表
@ -54,7 +56,7 @@ public interface IDesVolumeCatalogService extends IService<DesVolumeCatalog> {
* @param id 卷册目录id
* @return 卷册目录文件列表
*/
List<DesVolumeFile> queryFileListById(Long id);
List<DesVolumeFile> queryFileListById(Long id,String type);
/**
* 新增卷册目录
@ -86,7 +88,7 @@ public interface IDesVolumeCatalogService extends IService<DesVolumeCatalog> {
* @param volumeCatalog 卷册目录
* @return 卷册目录封装对象
*/
DesVolumeCatalogVo getVo(DesVolumeCatalog volumeCatalog);
DesVolumeCatalogVo getVo(DesVolumeCatalog volumeCatalog,String type);
/**
* 构建查询条件
@ -111,4 +113,11 @@ public interface IDesVolumeCatalogService extends IService<DesVolumeCatalog> {
* @return 是否成功
*/
Boolean viewerFile(Long id);
/**
* 获取变更单所选择的卷册目录列表
*
*/
List<DesVolumeCatalog> catalogList(Long projectId);
}

View File

@ -2,8 +2,13 @@ package org.dromara.design.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.design.domain.DesVolumeFile;
import org.dromara.design.domain.bo.DesVolumeFileBo;
import org.dromara.design.domain.dto.volumefile.DesVolumeFileCreateReq;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileCodeVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileJoinVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileVo;
import java.util.Collection;
@ -64,4 +69,28 @@ public interface IDesVolumeFileService extends IService<DesVolumeFile> {
* @return 卷册目录对象视图
*/
Page<DesVolumeFileVo> getVoPage(Page<DesVolumeFile> volumeFilePage);
/**
* 分页查询卷册文件列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 卷册文件分页列表
*/
TableDataInfo<DesVolumeFileVo> queryPageList(DesVolumeFileBo bo, PageQuery pageQuery);
/**
* 分页查询卷册文件列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 卷册文件分页列表
*/
TableDataInfo<DesVolumeFileJoinVo> queryJoinPageList(DesVolumeFileBo bo, PageQuery pageQuery);
/**
* 获取卷册文件详细信息
*/
DesVolumeFileCodeVo getCodeInfo(Long id);
}

View File

@ -41,6 +41,7 @@ import org.dromara.design.domain.dto.designchange.DesDesignChangeQueryReq;
import org.dromara.design.domain.dto.designchange.DesDesignChangeUpdateReq;
import org.dromara.design.domain.dto.designchange.DesDesignExtendDetailDto;
import org.dromara.design.domain.vo.designchange.DesDesignChangeVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileVo;
import org.dromara.design.mapper.DesDesignChangeMapper;
import org.dromara.design.service.IDesDesignChangeService;
import org.dromara.design.service.IDesDrawingService;
@ -604,12 +605,13 @@ public class DesDesignChangeServiceImpl extends ServiceImpl<DesDesignChangeMappe
if("1".equals(bean.getDesignDisposal())){
volumeFileService.lambdaUpdate()
.set(DesVolumeFile::getStatus, "2")
.set(DesVolumeFile::getType, DesVolumeFile.WASTE)
.eq(DesVolumeFile::getType,DesVolumeFile.BLUEPRINT)
.eq(DesVolumeFile::getVolumeCatalogId, volumeCatalog.getDesign())
.update();
}else if("2".equals(bean.getDesignDisposal())){
LambdaUpdateWrapper<DesVolumeFile> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(DesVolumeFile::getStatus, "2")
wrapper.set(DesVolumeFile::getType, DesVolumeFile.WASTE)
.eq(DesVolumeFile::getVolumeCatalogId, volumeCatalog.getDesign());
String saveFile = designChange.getSaveFile();
if(StringUtils.isNotBlank(saveFile)){
@ -629,24 +631,27 @@ public class DesDesignChangeServiceImpl extends ServiceImpl<DesDesignChangeMappe
.collect(Collectors.toList());
List<SysOssVo> ossVoList1 = ossService.listByIds(fileIds);
//查询蓝图最大版本号
List<DesVolumeFile> list = volumeFileService.list(Wrappers.lambdaQuery(DesVolumeFile.class)
.eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT)
.orderByDesc(DesVolumeFile::getVersion)
);
String version = !list.isEmpty() ? String.valueOf(Integer.valueOf(list.getFirst().getVersion())+1) : "0";
for (SysOssVo ossVo : ossVoList1) {
DesVolumeFile desVolumeFile = new DesVolumeFile();
desVolumeFile.setVolumeCatalogId(volumeCatalog.getDesign());
desVolumeFile.setFileName(ossVo.getOriginalName());
desVolumeFile.setFileId(ossVo.getOssId());
desVolumeFile.setStatus("1");
desVolumeFile.setType("2");
desVolumeFile.setStatus("2");
desVolumeFile.setAuditStatus(BusinessStatusEnum.FINISH.getStatus());
desVolumeFile.setType(DesVolumeFile.BLUEPRINT);
desVolumeFile.setVersion(version);
volumeFileService.save(desVolumeFile);
DesDrawing desDrawing = new DesDrawing();
desDrawing.setProjectId(volumeCatalog.getProjectId());
desDrawing.setVolumeCatalogId(volumeCatalog.getDesign());
desDrawing.setVolumeFileId(desVolumeFile.getId());
drawingService.save(desDrawing);
//异步处理二维码
self.addQRCodeToPDF(desVolumeFile.getId())
self.addQRCodeToPDF(desVolumeFile.getId(),true)
.thenAccept(result -> log.info("图纸[{}-{} ]添加二维码成功", desVolumeFile.getFileName(), desVolumeFile.getId()))
.exceptionally(ex -> {
log.error("图纸[{}-{}]添加二维码失败", desVolumeFile.getFileName(), desVolumeFile.getId(), ex);

View File

@ -278,12 +278,15 @@ public class DesDrawingServiceImpl extends ServiceImpl<DesDrawingMapper, DesDraw
String fileStatus = req.getFileStatus();
String originalName = req.getOriginalName();
String newest = req.getNewest();
Long volumeCatalogId = req.getVolumeCatalogId();
lqw.like(StringUtils.isNotBlank(fileName), DesDrawing::getFileName, fileName);
lqw.like(StringUtils.isNotBlank(originalName), DesDrawing::getOriginalName, originalName);
lqw.eq(ObjectUtils.isNotEmpty(projectId), DesDrawing::getProjectId, projectId);
lqw.eq(StringUtils.isNotBlank(fileType), DesDrawing::getFileType, fileType);
lqw.eq(StringUtils.isNotBlank(fileStatus), DesDrawing::getFileStatus, fileStatus);
lqw.eq(StringUtils.isNotBlank(newest), DesDrawing::getNewest, newest);
lqw.eq(StringUtils.isNotBlank(originalName), DesDrawing::getOriginalName, originalName);
lqw.eq(ObjectUtils.isNotEmpty(volumeCatalogId), DesDrawing::getVolumeCatalogId, volumeCatalogId);
lqw.orderByDesc(DesDrawing::getNewest);
lqw.orderByDesc(DesDrawing::getCreateTime);
return lqw;
@ -413,7 +416,7 @@ public class DesDrawingServiceImpl extends ServiceImpl<DesDrawingMapper, DesDraw
String params = "ID[" + drawing.getId() + "] finish";
byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
try {
ByteArrayOutputStream baos = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(ossVo.getUrl(), bytes,1510, 900);
ByteArrayOutputStream baos = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(ossVo.getUrl(), bytes,false);
FileNameMap fileNameMap = URLConnection.getFileNameMap();
String originalName = drawing.getOriginalName();
String contentType = fileNameMap.getContentTypeFor(originalName);
@ -428,7 +431,7 @@ public class DesDrawingServiceImpl extends ServiceImpl<DesDrawingMapper, DesDraw
}
@Override
public CompletableFuture<Boolean> addQRCodeToPDF(Long volumeFileId) {
public CompletableFuture<Boolean> addQRCodeToPDF(Long volumeFileId,boolean isChangeFile) {
DesVolumeFile byId = volumeFilesService.getById(volumeFileId);
Long fileUrl = byId.getFileId();
if (fileUrl == null) {
@ -439,7 +442,7 @@ public class DesDrawingServiceImpl extends ServiceImpl<DesDrawingMapper, DesDraw
String params = "ID[" + byId.getId() + "] finish";
byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
try {
ByteArrayOutputStream baos = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(ossVo.getUrl(), bytes,1510, 900);
ByteArrayOutputStream baos = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(ossVo.getUrl(), bytes,isChangeFile);
FileNameMap fileNameMap = URLConnection.getFileNameMap();
String originalName = ossVo.getOriginalName();
String contentType = fileNameMap.getContentTypeFor(originalName);

View File

@ -74,7 +74,8 @@ public class DesSubcontractServiceImpl extends ServiceImpl<DesSubcontractMapper,
LambdaQueryWrapper<DesSubcontract> lqw = Wrappers.lambdaQuery();
lqw.orderByDesc(DesSubcontract::getId);
lqw.eq(bo.getProjectId() != null, DesSubcontract::getProjectId, bo.getProjectId());
lqw.eq(StringUtils.isNotBlank(bo.getSubContent()), DesSubcontract::getSubContent, bo.getSubContent());
lqw.like(StringUtils.isNotBlank(bo.getSubContent()), DesSubcontract::getSubContent, bo.getSubContent());
lqw.like(StringUtils.isNotBlank(bo.getRequirement()), DesSubcontract::getRequirement, bo.getRequirement());
return lqw;
}

View File

@ -2,6 +2,7 @@ package org.dromara.design.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
@ -37,10 +38,7 @@ import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -83,12 +81,12 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
* @return 卷册目录
*/
@Override
public DesVolumeCatalogVo queryById(Long id) {
public DesVolumeCatalogVo queryById(Long id,String type) {
DesVolumeCatalog volumeCatalog = this.getById(id);
if (volumeCatalog == null) {
throw new ServiceException("卷册目录信息不存在", HttpStatus.NOT_FOUND);
}
return this.getVo(volumeCatalog);
return this.getVo(volumeCatalog,type);
}
/**
@ -112,7 +110,7 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
*/
@Override
public List<DesVolumeCatalogVo> queryList(DesVolumeCatalogQueryReq req) {
return this.list(this.buildQueryWrapper(req)).stream().map(this::getVo).toList();
return this.list(this.buildQueryWrapper(req)).stream().map(vo-> this.getVo(vo,req.getType())).toList();
}
/**
@ -122,9 +120,10 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
* @return 卷册目录文件列表
*/
@Override
public List<DesVolumeFile> queryFileListById(Long id) {
public List<DesVolumeFile> queryFileListById(Long id,String type) {
return volumeFileService.lambdaQuery()
.eq(DesVolumeFile::getVolumeCatalogId, id)
.eq(StringUtils.isNotBlank(type),DesVolumeFile::getType, type)
.orderByAsc(DesVolumeFile::getStatus)
.orderByDesc(DesVolumeFile::getCreateDept)
.list();
@ -230,14 +229,14 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
* @return 卷册目录封装对象
*/
@Override
public DesVolumeCatalogVo getVo(DesVolumeCatalog volumeCatalog) {
public DesVolumeCatalogVo getVo(DesVolumeCatalog volumeCatalog,String type) {
DesVolumeCatalogVo vo = new DesVolumeCatalogVo();
if (volumeCatalog == null) {
return vo;
}
BeanUtils.copyProperties(volumeCatalog, vo);
// 关联文件信息
List<DesVolumeFile> volumeFiles = this.queryFileListById(volumeCatalog.getDesign());
List<DesVolumeFile> volumeFiles = this.queryFileListById(volumeCatalog.getDesign(),type);
vo.setFileVoList(volumeFileService.getVoList(volumeFiles));
// 关联查阅人信息
List<DesVolumeFileViewer> allViewerList = volumeFileViewerService.lambdaQuery()
@ -299,7 +298,7 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
if (CollUtil.isEmpty(volumeCatalogList)) {
return volumeCatalogVoPage;
}
List<DesVolumeCatalogVo> volumeCatalogVoList = volumeCatalogList.stream().map(this::getVo).toList();
List<DesVolumeCatalogVo> volumeCatalogVoList = volumeCatalogList.stream().map(vo-> getVo(vo,null)).toList();
return volumeCatalogVoPage.setRecords(volumeCatalogVoList);
}
@ -330,7 +329,24 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
return true;
}
@Override
public List<DesVolumeCatalog> catalogList(Long projectId) {
//查询已有审核通过蓝图的卷册目录
List<DesVolumeFile> list = volumeFileService.list(Wrappers.lambdaQuery(DesVolumeFile.class)
.eq(DesVolumeFile::getAuditStatus, BusinessStatusEnum.FINISH.getStatus())
.eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT)
.orderByDesc(DesVolumeFile::getCreateTime)
);
List<Long> list1 = list.stream().map(DesVolumeFile::getVolumeCatalogId).distinct().toList();
return baseMapper.selectList(Wrappers.lambdaQuery(DesVolumeCatalog.class)
.eq(DesVolumeCatalog::getProjectId, projectId)
.in(DesVolumeCatalog::getDesign, list1)
.orderByDesc(DesVolumeCatalog::getCreateTime)
);
}
/**
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
@ -367,7 +383,7 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
desDrawings.add(desDrawing);
//异步处理二维码
self.addQRCodeToPDF(desVolumeFile.getId())
self.addQRCodeToPDF(desVolumeFile.getId(),false)
.thenAccept(result -> log.info("图纸[{}-{} ]添加二维码成功", desVolumeFile.getFileName(), desVolumeFile.getId()))
.exceptionally(ex -> {
log.error("图纸[{}-{}]添加二维码失败", desVolumeFile.getFileName(), desVolumeFile.getId(), ex);

View File

@ -1,34 +1,47 @@
package org.dromara.design.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.esotericsoftware.kryo.serializers.DefaultSerializers;
import io.micrometer.common.util.StringUtils;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.constant.HttpStatus;
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.design.domain.DesDrawing;
import org.dromara.design.domain.DesVolumeCatalog;
import org.dromara.design.domain.DesVolumeFile;
import org.dromara.design.domain.DesVolumeFileViewer;
import org.dromara.design.domain.bo.DesVolumeFileBo;
import org.dromara.design.domain.dto.volumefile.DesVolumeFileCreateReq;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileCodeVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileJoinVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileVo;
import org.dromara.design.mapper.DesVolumeFileMapper;
import org.dromara.design.service.IDesVolumeCatalogService;
import org.dromara.design.service.IDesVolumeFileService;
import org.dromara.design.service.IDesVolumeFileViewerService;
import org.dromara.project.domain.BusProject;
import org.dromara.project.service.IBusProjectService;
import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.service.ISysOssService;
import org.springframework.beans.BeanUtils;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.*;
/**
* 卷册文件Service业务层处理
@ -37,8 +50,11 @@ import java.util.List;
* @date 2025-07-30
*/
@Service
@Slf4j
public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, DesVolumeFile>
implements IDesVolumeFileService {
@Resource
private DesVolumeFileMapper baseMapper;
@Resource
private ISysOssService ossService;
@ -49,6 +65,80 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
@Resource
private IDesVolumeFileViewerService volumeFileViewerService;
@Resource
private IBusProjectService projectService;
/**
* 分页查询卷册文件列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 卷册文件分页列表
*/
@Override
public TableDataInfo<DesVolumeFileVo> queryPageList(DesVolumeFileBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<DesVolumeFile> lqw = buildQueryWrapper(bo);
Page<DesVolumeFileVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
for (DesVolumeFileVo vo : result.getRecords()) {
SysOssVo ossVo = ossService.getById(vo.getFileId());
vo.setFileUrl(ossVo.getUrl());
}
return TableDataInfo.build(result);
}
private LambdaQueryWrapper<DesVolumeFile> buildQueryWrapper(DesVolumeFileBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<DesVolumeFile> lqw = Wrappers.lambdaQuery();
lqw.orderByDesc(DesVolumeFile::getId);
lqw.eq(bo.getVolumeCatalogId() != null, DesVolumeFile::getVolumeCatalogId, bo.getVolumeCatalogId());
lqw.eq(bo.getFileId() != null, DesVolumeFile::getFileId, bo.getFileId());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), DesVolumeFile::getStatus, bo.getStatus());
lqw.eq(StringUtils.isNotBlank(bo.getType()), DesVolumeFile::getType, bo.getType());
return lqw;
}
@Override
public TableDataInfo<DesVolumeFileJoinVo> queryJoinPageList(DesVolumeFileBo bo, PageQuery pageQuery) {
Page<DesVolumeFileJoinVo> page = baseMapper.queryJoinPageList(pageQuery.build(), bo);
for (DesVolumeFileJoinVo vo : page.getRecords()) {
SysOssVo ossVo = ossService.getById(vo.getFileId());
vo.setFileUrl(ossVo.getUrl());
}
return TableDataInfo.build(page);
}
@Override
public DesVolumeFileCodeVo getCodeInfo(Long id) {
DesVolumeFile desVolumeFile = getById(id);
DesVolumeCatalog desVolumeCatalog = volumeCatalogService.getById(desVolumeFile.getVolumeCatalogId());
DesVolumeFileCodeVo desVolumeFileCodeVo = BeanUtil.copyProperties(desVolumeCatalog, DesVolumeFileCodeVo.class);
BusProject byId = projectService.getById(desVolumeCatalog.getProjectId());
desVolumeFileCodeVo.setProjectName(byId.getProjectName());
//查询过程图纸最新版
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
.eq(DesVolumeFile::getVolumeCatalogId, desVolumeFile.getVolumeCatalogId())
.eq(DesVolumeFile::getType, "1")
.orderByDesc(DesVolumeFile::getVersion));
DesVolumeFile first = existingFiles.getFirst();
if("4".equals(desVolumeFile.getStatus())){
SysOssVo ossVo = ossService.getById(first.getFileId());
desVolumeFileCodeVo.setFileUrl(ossVo.getUrl());
}
if("1".equals(desVolumeFile.getStatus()) && !first.getId().equals(id)){
SysOssVo ossVo = ossService.getById(first.getFileId());
desVolumeFileCodeVo.setFileUrl(ossVo.getUrl());
}
return desVolumeFileCodeVo;
}
/**
* 查询卷册文件
*
@ -79,77 +169,112 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
if (volumeCatalog == null) {
throw new ServiceException("对应卷册目录不存在", HttpStatus.NOT_FOUND);
}
// 判断是否需要废除其他文件
// List<Long> cancellationIds = req.getCancellationIds();
// if (CollUtil.isNotEmpty(cancellationIds)) {
// List<DesVolumeFile> list = this.listByIds(cancellationIds);
// list.forEach(item -> {
// if (item.getStatus().equals("2")) {
// return;
// }
// String name = item.getFileName();
// String modified = name.replaceAll("(\\d{8})", "$1-已作废)");
// item.setFileName(modified);
// item.setStatus("2");
// });
// if (CollUtil.isNotEmpty(list)) {
// boolean update = this.updateBatchById(list);
// if (!update) {
// throw new ServiceException("更新卷册文件信息异常", HttpStatus.ERROR);
// }
// }
// }
// 新增审阅人
// List<Long> userIds = req.getUserIds();
// if (CollUtil.isNotEmpty(userIds)) {
// List<DesVolumeFileViewer> viewerList = userIds.stream().map(userId -> {
// DesVolumeFileViewer viewer = new DesVolumeFileViewer();
// viewer.setVolumeCatalogId(volumeCatalogId);
// viewer.setUserId(userId);
// return viewer;
// }).toList();
// // 删除以前的审阅人
// Long count = volumeFileViewerService.lambdaQuery()
// .eq(DesVolumeFileViewer::getVolumeCatalogId, volumeCatalogId)
// .count();
// if (count > 0) {
// boolean remove = volumeFileViewerService.remove(new LambdaQueryWrapper<DesVolumeFileViewer>()
// .eq(DesVolumeFileViewer::getVolumeCatalogId, volumeCatalogId));
// if (!remove) {
// throw new ServiceException("修改审阅人失败", HttpStatus.ERROR);
// }
// }
// boolean result = volumeFileViewerService.saveBatch(viewerList);
// if (!result) {
// throw new ServiceException("修改审阅人失败", HttpStatus.ERROR);
// }
// }
// 查看文件是否存在
if (CollectionUtil.isEmpty(req.getFileIds()) && CollectionUtil.isEmpty(req.getCancellationIds())) {
throw new ServiceException("文件不能为空", HttpStatus.ERROR);
}
//校验是否能上传
validUpload(req);
ArrayList<DesVolumeFile> desVolumeFiles = new ArrayList<>();
// 蓝图文件
if (CollectionUtil.isNotEmpty(req.getFileIds())) {
processFiles(req, req.getFileIds(), "3", desVolumeFiles);
}
ArrayList<DesVolumeFile> desVolumeFiles = new ArrayList<>();
// 过程文件
if (CollectionUtil.isNotEmpty(req.getCancellationIds())) {
processFiles(req, req.getCancellationIds(), "1", desVolumeFiles);
}
for (Long fileId : req.getFileIds()){
SysOssVo ossVo = ossService.getById(fileId);
if (ossVo == null) {
throw new ServiceException("对应文件不存在", HttpStatus.NOT_FOUND);
}
DesVolumeFile file = new DesVolumeFile();
BeanUtils.copyProperties(req, file);
file.setFileId(fileId);
String today = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
file.setFileName(ossVo.getOriginalName() + "" + today + "");
desVolumeFiles.add(file);
boolean save = saveBatch(desVolumeFiles);
if (!save) {
throw new ServiceException("新增卷册文件信息异常", HttpStatus.ERROR);
}
return true;
}
private void validUpload(DesVolumeFileCreateReq req){
// 蓝图文件
if (CollectionUtil.isNotEmpty(req.getFileIds())) {
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
.eq(DesVolumeFile::getType, "3")
.orderByDesc(DesVolumeFile::getVersion));
if (!existingFiles.isEmpty()) {
throw new ServiceException("蓝图已上传");
}
boolean save = saveBatch(desVolumeFiles);
if (!save) {
throw new ServiceException("新增卷册文件信息异常", HttpStatus.ERROR);
}
// 过程文件
if (CollectionUtil.isNotEmpty(req.getCancellationIds())) {
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
.eq(DesVolumeFile::getType, "1")
.orderByDesc(DesVolumeFile::getVersion));
if (!existingFiles.isEmpty()) {
DesVolumeFile first = existingFiles.getFirst();
if(!BusinessStatusEnum.FINISH.getStatus().equals(first.getAuditStatus())){
throw new ServiceException("文件尚未审核完成,请勿重复上传");
}
}
}
return true;
}
/**
* 处理文件上传
*
* @param req 请求参数
* @param fileIds 文件ID列表
* @param type 文件类型
* @param desVolumeFiles 文件集合
*/
private void processFiles(DesVolumeFileCreateReq req, List<Long> fileIds, String type, List<DesVolumeFile> desVolumeFiles) {
// 用于记录同一批次中已处理的文件名及对应的版本号
Map<String, Integer> batchFileVersionMap = new HashMap<>();
for (Long fileId : fileIds) {
SysOssVo ossVo = ossService.getById(fileId);
if (ossVo == null) {
throw new ServiceException("对应文件不存在", HttpStatus.NOT_FOUND);
}
DesVolumeFile file = new DesVolumeFile();
BeanUtils.copyProperties(req, file);
file.setFileId(fileId);
String fileName = ossVo.getOriginalName();
// 根据文件类型和文件名判断是否存在文件,存在则版本号往上增
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
.eq(DesVolumeFile::getType, type)
.eq(DesVolumeFile::getFileName, fileName)
.orderByDesc(DesVolumeFile::getVersion));
int version = 0;
if (CollectionUtil.isNotEmpty(existingFiles)) {
version = Integer.parseInt(existingFiles.getFirst().getVersion()) + 1;
}
// 检查同一批次中是否已存在同名文件
if (batchFileVersionMap.containsKey(fileName)) {
// 如果存在,则在原有版本号基础上+1
version = Math.max(version, batchFileVersionMap.get(fileName) + 1);
}
// 更新批次文件版本映射
batchFileVersionMap.put(fileName, version);
file.setVersion(String.valueOf(version));
file.setFileName(fileName);
desVolumeFiles.add(file);
}
}
/**
* 批量删除卷册文件信息
*
@ -214,4 +339,120 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
return volumeFileVoPage;
}
/**
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
* 正常使用只需#processEvent.flowCode=='leave1'
* 示例为了方便则使用startsWith匹配了全部示例key
*
* @param processEvent 参数
*/
@org.springframework.context.event.EventListener(condition = "#processEvent.flowCode.endsWith('procDesignFile')")
@Transactional
public void processPlansHandler(ProcessEvent processEvent) {
log.info("过程图纸评审审核任务执行了{}", processEvent.toString());
String id = processEvent.getBusinessId();
DesVolumeFile desVolumeFile = this.getById(Long.valueOf(id));
if (desVolumeFile == null) {
return;
}
desVolumeFile.setAuditStatus(processEvent.getStatus());
//如果完成,以前的图纸类型变为作废图纸,状态改为作废 暂定
// if (processEvent.getStatus().equals("finish")){
// this.lambdaUpdate().set(DesVolumeFile::getStatus, "2")
// .set(DesVolumeFile::getType, "4")
// .eq(DesVolumeFile::getVolumeCatalogId, desVolumeFile.getVolumeCatalogId())
// .eq(DesVolumeFile::getType, "1")
// .ne(DesVolumeFile::getId, desVolumeFile.getId())
// .update();
// }
this.updateById(desVolumeFile);
}
/**
* 执行任务创建监听
* 示例:也可通过 @EventListener(condition = "#processTaskEvent.flowCode=='leave1'")进行判断
* 在方法中判断流程节点key
* if ("xxx".equals(processTaskEvent.getNodeCode())) {
* //执行业务逻辑
* }
*
* @param processTaskEvent 参数
*/
@org.springframework.context.event.EventListener(condition = "#processTaskEvent.flowCode.endsWith('procDesignFile')")
public void processTaskPlansHandler(ProcessTaskEvent processTaskEvent) {
log.info("过程图纸评审审核任务创建了{}", processTaskEvent.toString());
}
/**
* 监听删除流程事件
* 正常使用只需#processDeleteEvent.flowCode=='leave1'
* 示例为了方便则使用startsWith匹配了全部示例key
*
* @param processDeleteEvent 参数
*/
@EventListener(condition = "#processDeleteEvent.flowCode.endsWith('procDesignFile')")
public void processDeletePlansHandler(ProcessDeleteEvent processDeleteEvent) {
log.info("过程图纸评审计划删除流程事件,技术标准文件审核任务执行了{}", processDeleteEvent.toString());
}
/**
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
* 正常使用只需#processEvent.flowCode=='leave1'
* 示例为了方便则使用startsWith匹配了全部示例key
*
* @param processEvent 参数
*/
@org.springframework.context.event.EventListener(condition = "#processEvent.flowCode.endsWith('bpDesignFile')")
@Transactional
public void bpProcessPlansHandler(ProcessEvent processEvent) {
log.info("蓝图评审审核任务执行了{}", processEvent.toString());
String id = processEvent.getBusinessId();
DesVolumeFile desVolumeFile = this.getById(Long.valueOf(id));
if (desVolumeFile == null) {
return;
}
desVolumeFile.setAuditStatus(processEvent.getStatus());
this.updateById(desVolumeFile);
}
/**
* 执行任务创建监听
* 示例:也可通过 @EventListener(condition = "#processTaskEvent.flowCode=='leave1'")进行判断
* 在方法中判断流程节点key
* if ("xxx".equals(processTaskEvent.getNodeCode())) {
* //执行业务逻辑
* }
*
* @param processTaskEvent 参数
*/
@org.springframework.context.event.EventListener(condition = "#processTaskEvent.flowCode.endsWith('bpDesignFile')")
public void bpProcessTaskPlansHandler(ProcessTaskEvent processTaskEvent) {
log.info("蓝图评审审核任务创建了{}", processTaskEvent.toString());
}
/**
* 监听删除流程事件
* 正常使用只需#processDeleteEvent.flowCode=='leave1'
* 示例为了方便则使用startsWith匹配了全部示例key
*
* @param processDeleteEvent 参数
*/
@EventListener(condition = "#processDeleteEvent.flowCode.endsWith('bpDesignFile')")
public void bpProcessDeletePlansHandler(ProcessDeleteEvent processDeleteEvent) {
log.info("蓝图评审计划删除流程事件,技术标准文件审核任务执行了{}", processDeleteEvent.toString());
}
}

View File

@ -53,7 +53,7 @@ public class SysOssController extends BaseController {
*
* @param ossIds OSS对象ID串
*/
@SaCheckPermission("system:oss:query")
// @SaCheckPermission("system:oss:query")
@GetMapping("/listByIds/{ossIds}")
public R<List<SysOssVo>> listByIds(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ossIds) {

View File

@ -4,4 +4,17 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.design.mapper.DesVolumeFileMapper">
<select id="queryJoinPageList" resultType="org.dromara.design.domain.vo.volumefile.DesVolumeFileJoinVo">
select f.*, c.design_subitem, c.specialty, c.volume_number, c.document_name, c.principal
from des_volume_file f
left join des_volume_catalog c on f.volume_catalog_id = c.design
WHERE c.project_id = #{bo.projectId} and f.type = #{bo.type}
<if test="bo.volumeNumber != null and bo.volumeNumber != '' ">
AND c.volume_number like concat('%',#{bo.volumeNumber},'%')
</if>
<if test="bo.documentName != null and bo.documentName != '' ">
and c.document_name like concat('%',#{bo.documentName},'%')
</if>
</select>
</mapper>