二维码
This commit is contained in:
@ -288,3 +288,6 @@ id-card:
|
||||
encrypt-key: 7ae260d150a14027d2238a1cf80a48ef
|
||||
recognizer:
|
||||
url: http://192.168.110.5:50070
|
||||
|
||||
qrCode:
|
||||
url: http://192.168.110.151:7788
|
||||
|
@ -287,3 +287,6 @@ id-card:
|
||||
encrypt-key: 7ae260d150a14027d2238a1cf80a48ef
|
||||
recognizer:
|
||||
url: http://192.168.110.5:50070
|
||||
|
||||
qrCode:
|
||||
url: http://192.168.110.151:7788
|
||||
|
@ -4,6 +4,8 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
@ -87,7 +89,7 @@ public class BusMaterialbatchdemandplan extends BaseEntity {
|
||||
/**
|
||||
* 需求数量
|
||||
*/
|
||||
private Long demandQuantity;
|
||||
private BigDecimal demandQuantity;
|
||||
|
||||
/**
|
||||
* 计划到场时间
|
||||
|
@ -9,6 +9,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -90,7 +91,7 @@ public class BusMaterialbatchdemandplanBo extends BaseEntity {
|
||||
/**
|
||||
* 需求数量
|
||||
*/
|
||||
private Long demandQuantity;
|
||||
private BigDecimal demandQuantity;
|
||||
|
||||
/**
|
||||
* 计划到场时间
|
||||
|
@ -248,30 +248,30 @@ 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";
|
||||
//
|
||||
// String params = "ID:[" + 11111 + "] finish";
|
||||
// byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
|
||||
//
|
||||
// try {
|
||||
// System.out.println("二维码字节大小: " + bytes.length + " 字节");
|
||||
//
|
||||
// // 在每一页添加二维码
|
||||
// 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() + " 字节");
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// System.out.println("图纸管理 => 审核结束,向文件添加二维码失败, 错误");
|
||||
// }
|
||||
// }
|
||||
public static void main(String[] args) {
|
||||
String path = "C:\\Users\\YuanJie\\Desktop\\test.pdf";
|
||||
String outputPath = "C:\\Users\\YuanJie\\Desktop\\test1.pdf";
|
||||
|
||||
String params = "http://192.168.110.151:7788/codeDetail?id="+"1957649652924448769";
|
||||
byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
|
||||
|
||||
try {
|
||||
System.out.println("二维码字节大小: " + bytes.length + " 字节");
|
||||
|
||||
// 在每一页添加二维码
|
||||
ByteArrayOutputStream byteArrayOutputStream = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(path, bytes,false);
|
||||
|
||||
// 将输出流写入到指定文件
|
||||
try (FileOutputStream fileOut = new FileOutputStream(outputPath)) {
|
||||
byteArrayOutputStream.writeTo(fileOut);
|
||||
}
|
||||
|
||||
System.out.println("PDF文件已成功生成到: " + outputPath);
|
||||
System.out.println("生成的PDF大小: " + new File(outputPath).length() + " 字节");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("图纸管理 => 审核结束,向文件添加二维码失败, 错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -101,7 +102,7 @@ public class DesVolumeCatalogVo implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDate createTime;
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 文件列表
|
||||
|
@ -71,4 +71,13 @@ public class DesVolumeFileCodeVo implements Serializable {
|
||||
*/
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 图纸类型(1-过程,3-蓝图,4-作废)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 是否最新
|
||||
*/
|
||||
private Boolean isLatest;
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ public class DesDesignChangeServiceImpl extends ServiceImpl<DesDesignChangeMappe
|
||||
String volumeName = req.getVolumeName();
|
||||
String volumeNo = req.getVolumeNo();
|
||||
String status = req.getStatus();
|
||||
lqw.orderByDesc(DesDesignChange::getId);
|
||||
lqw.orderByDesc(DesDesignChange::getCreateTime);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), DesDesignChange::getProjectId, projectId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(formNo), DesDesignChange::getFormNo, formNo);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(submitDate), DesDesignChange::getSubmitDate, submitDate);
|
||||
|
@ -40,6 +40,7 @@ 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.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
@ -87,6 +88,9 @@ public class DesDrawingServiceImpl extends ServiceImpl<DesDrawingMapper, DesDraw
|
||||
@Resource
|
||||
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);
|
||||
// 整合二维码需要显示的数据
|
||||
String params = "ID:[" + byId.getId() + "] finish";
|
||||
String params = qrCodeUrL+"/codeDetail?id="+volumeFileId;
|
||||
byte[] bytes = PdfBoxQrCodeGenerator.generateQRCodeBytes(params);
|
||||
try {
|
||||
ByteArrayOutputStream baos = PdfBoxQrCodeGenerator.addQRCodeToPDFOnAllPages(ossVo.getUrl(), bytes,isChangeFile);
|
||||
|
@ -275,6 +275,7 @@ public class DesVolumeCatalogServiceImpl extends ServiceImpl<DesVolumeCatalogMap
|
||||
String volumeNumber = req.getVolumeNumber();
|
||||
String documentName = req.getDocumentName();
|
||||
String auditStatus = req.getAuditStatus();
|
||||
lqw.orderByDesc(DesVolumeCatalog::getCreateTime);
|
||||
lqw.like(StringUtils.isNotBlank(documentName), DesVolumeCatalog::getDocumentName, documentName);
|
||||
lqw.eq(StringUtils.isNotBlank(volumeNumber), DesVolumeCatalog::getVolumeNumber, volumeNumber);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), DesVolumeCatalog::getProjectId, projectId);
|
||||
|
@ -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.DesVolumeFileVo;
|
||||
import org.dromara.design.mapper.DesVolumeFileMapper;
|
||||
import org.dromara.design.service.IDesDrawingService;
|
||||
import org.dromara.design.service.IDesVolumeCatalogService;
|
||||
import org.dromara.design.service.IDesVolumeFileService;
|
||||
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.service.ISysOssService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -62,13 +64,12 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
@Resource
|
||||
private IDesVolumeCatalogService volumeCatalogService;
|
||||
|
||||
@Resource
|
||||
private IDesVolumeFileViewerService volumeFileViewerService;
|
||||
|
||||
@Resource
|
||||
private IBusProjectService projectService;
|
||||
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private IDesDrawingService self;
|
||||
/**
|
||||
* 分页查询卷册文件列表
|
||||
*
|
||||
@ -114,10 +115,12 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
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());
|
||||
desVolumeFileCodeVo.setType(desVolumeFile.getType());
|
||||
|
||||
//查询过程图纸最新版
|
||||
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
@ -127,13 +130,20 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
|
||||
DesVolumeFile first = existingFiles.getFirst();
|
||||
|
||||
if("4".equals(desVolumeFile.getStatus())){
|
||||
if("4".equals(desVolumeFile.getType())){
|
||||
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());
|
||||
if("1".equals(desVolumeFile.getType()) ){
|
||||
|
||||
if(!first.getId().equals(id)){
|
||||
desVolumeFileCodeVo.setIsLatest(false);
|
||||
SysOssVo ossVo = ossService.getById(first.getFileId());
|
||||
desVolumeFileCodeVo.setFileUrl(ossVo.getUrl());
|
||||
}else{
|
||||
desVolumeFileCodeVo.setIsLatest(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return desVolumeFileCodeVo;
|
||||
@ -361,14 +371,21 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
}
|
||||
desVolumeFile.setAuditStatus(processEvent.getStatus());
|
||||
//如果完成,以前的图纸类型变为作废图纸,状态改为作废 暂定
|
||||
// if (processEvent.getStatus().equals("finish")){
|
||||
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();
|
||||
// }
|
||||
//异步处理二维码
|
||||
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);
|
||||
}
|
||||
|
||||
@ -418,6 +435,15 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
return;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user