二维码

This commit is contained in:
zt
2025-08-20 11:45:16 +08:00
parent bd382a71bb
commit faff8b81a9
11 changed files with 91 additions and 41 deletions

View File

@ -288,3 +288,6 @@ id-card:
encrypt-key: 7ae260d150a14027d2238a1cf80a48ef encrypt-key: 7ae260d150a14027d2238a1cf80a48ef
recognizer: recognizer:
url: http://192.168.110.5:50070 url: http://192.168.110.5:50070
qrCode:
url: http://192.168.110.151:7788

View File

@ -287,3 +287,6 @@ id-card:
encrypt-key: 7ae260d150a14027d2238a1cf80a48ef encrypt-key: 7ae260d150a14027d2238a1cf80a48ef
recognizer: recognizer:
url: http://192.168.110.5:50070 url: http://192.168.110.5:50070
qrCode:
url: http://192.168.110.151:7788

View File

@ -4,6 +4,8 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
@ -87,7 +89,7 @@ public class BusMaterialbatchdemandplan extends BaseEntity {
/** /**
* 需求数量 * 需求数量
*/ */
private Long demandQuantity; private BigDecimal demandQuantity;
/** /**
* 计划到场时间 * 计划到场时间

View File

@ -9,6 +9,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -90,7 +91,7 @@ public class BusMaterialbatchdemandplanBo extends BaseEntity {
/** /**
* 需求数量 * 需求数量
*/ */
private Long demandQuantity; private BigDecimal demandQuantity;
/** /**
* 计划到场时间 * 计划到场时间

View File

@ -248,30 +248,30 @@ public class PdfBoxQrCodeGenerator {
} }
// public static void main(String[] args) { public static void main(String[] args) {
// String path = "C:\\Users\\YuanJie\\Desktop\\test.pdf"; String path = "C:\\Users\\YuanJie\\Desktop\\test.pdf";
// String outputPath = "C:\\Users\\YuanJie\\Desktop\\test1.pdf"; String outputPath = "C:\\Users\\YuanJie\\Desktop\\test1.pdf";
//
// String params = "ID[" + 11111 + "] finish"; String params = "http://192.168.110.151:7788/codeDetail?id="+"1957649652924448769";
// byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params); byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
//
// try { try {
// System.out.println("二维码字节大小: " + bytes.length + " 字节"); System.out.println("二维码字节大小: " + bytes.length + " 字节");
//
// // 在每一页添加二维码 // 在每一页添加二维码
// ByteArrayOutputStream byteArrayOutputStream = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(path, bytes,true); ByteArrayOutputStream byteArrayOutputStream = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(path, bytes,false);
//
// // 将输出流写入到指定文件 // 将输出流写入到指定文件
// try (FileOutputStream fileOut = new FileOutputStream(outputPath)) { try (FileOutputStream fileOut = new FileOutputStream(outputPath)) {
// byteArrayOutputStream.writeTo(fileOut); byteArrayOutputStream.writeTo(fileOut);
// } }
//
// System.out.println("PDF文件已成功生成到: " + outputPath); System.out.println("PDF文件已成功生成到: " + outputPath);
// System.out.println("生成的PDF大小: " + new File(outputPath).length() + " 字节"); System.out.println("生成的PDF大小: " + new File(outputPath).length() + " 字节");
//
// } catch (Exception e) { } catch (Exception e) {
// e.printStackTrace(); e.printStackTrace();
// System.out.println("图纸管理 => 审核结束,向文件添加二维码失败, 错误"); System.out.println("图纸管理 => 审核结束,向文件添加二维码失败, 错误");
// } }
// } }
} }

View File

@ -12,6 +12,7 @@ import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
import java.util.List; import java.util.List;
@ -101,7 +102,7 @@ public class DesVolumeCatalogVo implements Serializable {
/** /**
* 创建时间 * 创建时间
*/ */
private LocalDate createTime; private Date createTime;
/** /**
* 文件列表 * 文件列表

View File

@ -71,4 +71,13 @@ public class DesVolumeFileCodeVo implements Serializable {
*/ */
private String fileUrl; private String fileUrl;
/**
* 图纸类型(1-过程3-蓝图4-作废)
*/
private String type;
/**
* 是否最新
*/
private Boolean isLatest;
} }

View File

@ -424,7 +424,7 @@ public class DesDesignChangeServiceImpl extends ServiceImpl<DesDesignChangeMappe
String volumeName = req.getVolumeName(); String volumeName = req.getVolumeName();
String volumeNo = req.getVolumeNo(); String volumeNo = req.getVolumeNo();
String status = req.getStatus(); String status = req.getStatus();
lqw.orderByDesc(DesDesignChange::getId); lqw.orderByDesc(DesDesignChange::getCreateTime);
lqw.eq(ObjectUtils.isNotEmpty(projectId), DesDesignChange::getProjectId, projectId); lqw.eq(ObjectUtils.isNotEmpty(projectId), DesDesignChange::getProjectId, projectId);
lqw.eq(ObjectUtils.isNotEmpty(formNo), DesDesignChange::getFormNo, formNo); lqw.eq(ObjectUtils.isNotEmpty(formNo), DesDesignChange::getFormNo, formNo);
lqw.eq(ObjectUtils.isNotEmpty(submitDate), DesDesignChange::getSubmitDate, submitDate); lqw.eq(ObjectUtils.isNotEmpty(submitDate), DesDesignChange::getSubmitDate, submitDate);

View File

@ -40,6 +40,7 @@ import org.dromara.project.service.IBusProjectService;
import org.dromara.system.domain.vo.SysOssVo; import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.service.ISysOssService; import org.dromara.system.service.ISysOssService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
@ -87,6 +88,9 @@ public class DesDrawingServiceImpl extends ServiceImpl<DesDrawingMapper, DesDraw
@Resource @Resource
private IDesVolumeFileService volumeFilesService; private IDesVolumeFileService volumeFilesService;
@Value("${qrCode.url}")
private String qrCodeUrL;
/** /**
* 查询图纸管理 * 查询图纸管理
* *
@ -439,7 +443,7 @@ public class DesDrawingServiceImpl extends ServiceImpl<DesDrawingMapper, DesDraw
} }
SysOssVo ossVo = ossService.getById(fileUrl); SysOssVo ossVo = ossService.getById(fileUrl);
// 整合二维码需要显示的数据 // 整合二维码需要显示的数据
String params = "ID[" + byId.getId() + "] finish"; String params = qrCodeUrL+"/codeDetail?id="+volumeFileId;
byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params); byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
try { try {
ByteArrayOutputStream baos = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(ossVo.getUrl(), bytes,isChangeFile); ByteArrayOutputStream baos = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(ossVo.getUrl(), bytes,isChangeFile);

View File

@ -275,6 +275,7 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
String volumeNumber = req.getVolumeNumber(); String volumeNumber = req.getVolumeNumber();
String documentName = req.getDocumentName(); String documentName = req.getDocumentName();
String auditStatus = req.getAuditStatus(); String auditStatus = req.getAuditStatus();
lqw.orderByDesc(DesVolumeCatalog::getCreateTime);
lqw.like(StringUtils.isNotBlank(documentName), DesVolumeCatalog::getDocumentName, documentName); lqw.like(StringUtils.isNotBlank(documentName), DesVolumeCatalog::getDocumentName, documentName);
lqw.eq(StringUtils.isNotBlank(volumeNumber), DesVolumeCatalog::getVolumeNumber, volumeNumber); lqw.eq(StringUtils.isNotBlank(volumeNumber), DesVolumeCatalog::getVolumeNumber, volumeNumber);
lqw.eq(ObjectUtils.isNotEmpty(projectId), DesVolumeCatalog::getProjectId, projectId); lqw.eq(ObjectUtils.isNotEmpty(projectId), DesVolumeCatalog::getProjectId, projectId);

View File

@ -29,6 +29,7 @@ import org.dromara.design.domain.vo.volumefile.DesVolumeFileCodeVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileJoinVo; import org.dromara.design.domain.vo.volumefile.DesVolumeFileJoinVo;
import org.dromara.design.domain.vo.volumefile.DesVolumeFileVo; import org.dromara.design.domain.vo.volumefile.DesVolumeFileVo;
import org.dromara.design.mapper.DesVolumeFileMapper; import org.dromara.design.mapper.DesVolumeFileMapper;
import org.dromara.design.service.IDesDrawingService;
import org.dromara.design.service.IDesVolumeCatalogService; import org.dromara.design.service.IDesVolumeCatalogService;
import org.dromara.design.service.IDesVolumeFileService; import org.dromara.design.service.IDesVolumeFileService;
import org.dromara.design.service.IDesVolumeFileViewerService; import org.dromara.design.service.IDesVolumeFileViewerService;
@ -37,6 +38,7 @@ import org.dromara.project.service.IBusProjectService;
import org.dromara.system.domain.vo.SysOssVo; import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.service.ISysOssService; import org.dromara.system.service.ISysOssService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -62,13 +64,12 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
@Resource @Resource
private IDesVolumeCatalogService volumeCatalogService; private IDesVolumeCatalogService volumeCatalogService;
@Resource
private IDesVolumeFileViewerService volumeFileViewerService;
@Resource @Resource
private IBusProjectService projectService; private IBusProjectService projectService;
@Lazy
@Resource
private IDesDrawingService self;
/** /**
* 分页查询卷册文件列表 * 分页查询卷册文件列表
* *
@ -114,10 +115,12 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
public DesVolumeFileCodeVo getCodeInfo(Long id) { public DesVolumeFileCodeVo getCodeInfo(Long id) {
DesVolumeFile desVolumeFile = getById(id); DesVolumeFile desVolumeFile = getById(id);
DesVolumeCatalog desVolumeCatalog = volumeCatalogService.getById(desVolumeFile.getVolumeCatalogId()); DesVolumeCatalog desVolumeCatalog = volumeCatalogService.getById(desVolumeFile.getVolumeCatalogId());
DesVolumeFileCodeVo desVolumeFileCodeVo = BeanUtil.copyProperties(desVolumeCatalog, DesVolumeFileCodeVo.class); DesVolumeFileCodeVo desVolumeFileCodeVo = BeanUtil.copyProperties(desVolumeCatalog, DesVolumeFileCodeVo.class);
BusProject byId = projectService.getById(desVolumeCatalog.getProjectId()); BusProject byId = projectService.getById(desVolumeCatalog.getProjectId());
desVolumeFileCodeVo.setProjectName(byId.getProjectName()); desVolumeFileCodeVo.setProjectName(byId.getProjectName());
desVolumeFileCodeVo.setType(desVolumeFile.getType());
//查询过程图纸最新版 //查询过程图纸最新版
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>() List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
@ -127,13 +130,20 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
DesVolumeFile first = existingFiles.getFirst(); DesVolumeFile first = existingFiles.getFirst();
if("4".equals(desVolumeFile.getStatus())){ if("4".equals(desVolumeFile.getType())){
SysOssVo ossVo = ossService.getById(first.getFileId()); SysOssVo ossVo = ossService.getById(first.getFileId());
desVolumeFileCodeVo.setFileUrl(ossVo.getUrl()); desVolumeFileCodeVo.setFileUrl(ossVo.getUrl());
} }
if("1".equals(desVolumeFile.getStatus()) && !first.getId().equals(id)){ if("1".equals(desVolumeFile.getType()) ){
if(!first.getId().equals(id)){
desVolumeFileCodeVo.setIsLatest(false);
SysOssVo ossVo = ossService.getById(first.getFileId()); SysOssVo ossVo = ossService.getById(first.getFileId());
desVolumeFileCodeVo.setFileUrl(ossVo.getUrl()); desVolumeFileCodeVo.setFileUrl(ossVo.getUrl());
}else{
desVolumeFileCodeVo.setIsLatest(true);
}
} }
return desVolumeFileCodeVo; return desVolumeFileCodeVo;
@ -361,14 +371,21 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
} }
desVolumeFile.setAuditStatus(processEvent.getStatus()); desVolumeFile.setAuditStatus(processEvent.getStatus());
//如果完成,以前的图纸类型变为作废图纸,状态改为作废 暂定 //如果完成,以前的图纸类型变为作废图纸,状态改为作废 暂定
// if (processEvent.getStatus().equals("finish")){ if (processEvent.getStatus().equals("finish")){
// this.lambdaUpdate().set(DesVolumeFile::getStatus, "2") // this.lambdaUpdate().set(DesVolumeFile::getStatus, "2")
// .set(DesVolumeFile::getType, "4") // .set(DesVolumeFile::getType, "4")
// .eq(DesVolumeFile::getVolumeCatalogId, desVolumeFile.getVolumeCatalogId()) // .eq(DesVolumeFile::getVolumeCatalogId, desVolumeFile.getVolumeCatalogId())
// .eq(DesVolumeFile::getType, "1") // .eq(DesVolumeFile::getType, "1")
// .ne(DesVolumeFile::getId, desVolumeFile.getId()) // .ne(DesVolumeFile::getId, desVolumeFile.getId())
// .update(); // .update();
// } //异步处理二维码
self.addQRCodeToPDF(desVolumeFile.getId(),false)
.thenAccept(result -> log.info("图纸[{}-{} ]添加二维码成功", desVolumeFile.getFileName(), desVolumeFile.getId()))
.exceptionally(ex -> {
log.error("图纸[{}-{}]添加二维码失败", desVolumeFile.getFileName(), desVolumeFile.getId(), ex);
return null;
});
}
this.updateById(desVolumeFile); this.updateById(desVolumeFile);
} }
@ -418,6 +435,15 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
return; return;
} }
desVolumeFile.setAuditStatus(processEvent.getStatus()); desVolumeFile.setAuditStatus(processEvent.getStatus());
if (processEvent.getStatus().equals("finish")){
//异步处理二维码
self.addQRCodeToPDF(desVolumeFile.getId(),false)
.thenAccept(result -> log.info("图纸[{}-{} ]添加二维码成功", desVolumeFile.getFileName(), desVolumeFile.getId()))
.exceptionally(ex -> {
log.error("图纸[{}-{}]添加二维码失败", desVolumeFile.getFileName(), desVolumeFile.getId(), ex);
return null;
});
}
this.updateById(desVolumeFile); this.updateById(desVolumeFile);
} }