消息
This commit is contained in:
@ -224,6 +224,21 @@ public class PdfBoxQrCodeGenerator {
|
||||
// 二维码大小比例(页面宽高中较小值的20%)
|
||||
private static final float QR_SIZE_RATIO = 0.2f;
|
||||
|
||||
// 二维码大小比例(页面宽高中较小值的20%)
|
||||
private static final float QR_SIZE = 60.0f;
|
||||
|
||||
// 竖坐标
|
||||
private static final float V_QR_X = 232.0f;
|
||||
|
||||
// 竖坐标
|
||||
private static final float V_QR_Y = 679.5f;
|
||||
|
||||
// 横坐标
|
||||
private static final float H_QR_X = 1116.5f;
|
||||
|
||||
// 横坐标
|
||||
private static final float H_QR_Y = 34.0f;
|
||||
|
||||
public static ByteArrayOutputStream addQRCodeToPDFOnAllPages(String srcPdf, byte[] qrCodeBytes, boolean isChangeFile)
|
||||
throws IOException {
|
||||
|
||||
@ -256,6 +271,10 @@ public class PdfBoxQrCodeGenerator {
|
||||
int numberOfPages = pdfDoc.getNumberOfPages();
|
||||
|
||||
for (int pageNum = 1; pageNum <= numberOfPages; pageNum++) {
|
||||
if (pageNum == 1 && isChangeFile) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PdfPage page = pdfDoc.getPage(pageNum);
|
||||
|
||||
// 获取页面的所有边界框信息
|
||||
@ -266,25 +285,33 @@ public class PdfBoxQrCodeGenerator {
|
||||
Rectangle visibleArea = (cropBox != null) ? cropBox : mediaBox;
|
||||
|
||||
// 计算页面宽高中较小的值
|
||||
float minDimension = Math.min(visibleArea.getWidth(), visibleArea.getHeight());
|
||||
// float minDimension = Math.min(visibleArea.getWidth(), visibleArea.getHeight());
|
||||
|
||||
// 动态计算二维码大小(页面宽高中较小值的20%)
|
||||
float qrSize = minDimension * QR_SIZE_RATIO;
|
||||
// float qrSize = minDimension * QR_SIZE_RATIO;
|
||||
|
||||
// 输出页面尺寸信息
|
||||
System.out.println("页面 " + pageNum + " 尺寸: " + visibleArea.getWidth() + "x" + visibleArea.getHeight());
|
||||
System.out.println("页面 " + pageNum + " 二维码大小 (点): " + qrSize);
|
||||
// System.out.println("页面 " + pageNum + " 尺寸: " + visibleArea.getWidth() + "x" + visibleArea.getHeight());
|
||||
// System.out.println("页面 " + pageNum + " 二维码大小 (点): " + qrSize);
|
||||
|
||||
// 计算左上角的位置(PDF坐标系:原点在左下角)
|
||||
float qrX = visibleArea.getLeft() + MARGIN;
|
||||
float qrY = visibleArea.getTop() - qrSize - MARGIN;
|
||||
// float qrX = visibleArea.getLeft() + MARGIN;
|
||||
// float qrY = visibleArea.getTop() - qrSize - MARGIN;
|
||||
|
||||
// 打印二维码位置信息
|
||||
System.out.println("页面 " + pageNum + " 左上角二维码位置: x=" + qrX + ", y=" + qrY);
|
||||
|
||||
// System.out.println("页面 " + pageNum + " 左上角二维码位置: x=" + qrX + ", y=" + qrY);
|
||||
float qrX;
|
||||
float qrY;
|
||||
if (visibleArea.getWidth() > visibleArea.getHeight()) {
|
||||
qrX = H_QR_X;
|
||||
qrY = H_QR_Y;
|
||||
} else {
|
||||
qrX = V_QR_X;
|
||||
qrY = V_QR_Y;
|
||||
}
|
||||
try {
|
||||
// 使用Canvas API添加左上角二维码
|
||||
addQRCodeWithCanvas(pdfDoc, page, qrCodeBytes, qrX, qrY, qrSize);
|
||||
addQRCodeWithCanvas(pdfDoc, page, qrCodeBytes, qrX, qrY, QR_SIZE);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("在页面 " + pageNum + " 添加二维码时出错: " + e.getMessage());
|
||||
|
@ -205,7 +205,7 @@ public class WorkflowGlobalListener implements GlobalListener {
|
||||
//给处理人发消息重新统计数据
|
||||
|
||||
if (task != null) {
|
||||
flwCommonService.sendCountMessage(task.getId());
|
||||
flwCommonService.sendCountMessage(task);
|
||||
}
|
||||
// 只有办理或者退回的时候才执行消息通知和抄送
|
||||
if (TaskStatusEnum.PASS.getStatus().equals(flowParams.getHisStatus())
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.workflow.service;
|
||||
|
||||
import org.dromara.warm.flow.core.entity.Task;
|
||||
import org.dromara.workflow.domain.bo.FlowCopyBo;
|
||||
|
||||
import java.util.List;
|
||||
@ -32,7 +33,7 @@ public interface IFlwCommonService {
|
||||
/**
|
||||
* 发送统计消息
|
||||
*/
|
||||
void sendCountMessage(Long taskId);
|
||||
void sendCountMessage(Task task);
|
||||
|
||||
/**
|
||||
* 发送抄送消息
|
||||
|
@ -15,21 +15,30 @@ import org.dromara.common.sse.config.SseProperties;
|
||||
import org.dromara.common.sse.dto.SeeMessageContentDto;
|
||||
import org.dromara.common.sse.dto.SseMessageDto;
|
||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||
import org.dromara.warm.flow.core.FlowEngine;
|
||||
import org.dromara.warm.flow.core.entity.Definition;
|
||||
import org.dromara.warm.flow.core.entity.Node;
|
||||
import org.dromara.warm.flow.core.entity.Task;
|
||||
import org.dromara.warm.flow.core.enums.SkipType;
|
||||
import org.dromara.warm.flow.core.service.DefService;
|
||||
import org.dromara.warm.flow.core.service.NodeService;
|
||||
import org.dromara.warm.flow.core.service.UserService;
|
||||
import org.dromara.warm.flow.orm.entity.FlowDefinition;
|
||||
import org.dromara.warm.flow.orm.entity.FlowNode;
|
||||
import org.dromara.warm.flow.orm.entity.FlowTask;
|
||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||
import org.dromara.workflow.common.enums.MessageTypeEnum;
|
||||
import org.dromara.workflow.domain.bo.FlowCopyBo;
|
||||
import org.dromara.workflow.service.IFlwCommonService;
|
||||
import org.dromara.workflow.service.IFlwDefinitionService;
|
||||
import org.dromara.workflow.service.IFlwTaskAssigneeService;
|
||||
import org.dromara.workflow.service.IFlwTaskService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@ -126,11 +135,28 @@ public class FlwCommonServiceImpl implements IFlwCommonService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendCountMessage(Long taskId) {
|
||||
@Override
|
||||
public void sendCountMessage(Task task) {
|
||||
IFlwTaskService flwTaskService = SpringUtils.getBean(IFlwTaskService.class);
|
||||
IFlwTaskAssigneeService flwTaskAssigneeService = SpringUtils.getBean(IFlwTaskAssigneeService.class);
|
||||
|
||||
DefService defService = FlowEngine.defService();
|
||||
Definition definition = defService.getById(task.getDefinitionId());
|
||||
|
||||
FlowNode byNodeCode = flwTaskService.getByNodeCode(task.getNodeCode(), task.getDefinitionId());
|
||||
String permissionFlag = byNodeCode.getPermissionFlag();
|
||||
if(permissionFlag == null){
|
||||
return;
|
||||
}
|
||||
|
||||
permissionFlag = permissionFlag.replace("@@", ",");
|
||||
String flowCode = definition.getFlowCode();
|
||||
String projectId = flowCode.split("_")[0];
|
||||
List<UserDTO> users = flwTaskAssigneeService.fetchUsersByStorageIds(permissionFlag, Long.valueOf(projectId));
|
||||
|
||||
|
||||
List<UserDTO> userList = new ArrayList<>();
|
||||
List<UserDTO> users = flwTaskService.currentTaskAllUser(taskId);
|
||||
|
||||
if (CollUtil.isNotEmpty(users)) {
|
||||
userList.addAll(users);
|
||||
}
|
||||
@ -145,7 +171,6 @@ public class FlwCommonServiceImpl implements IFlwCommonService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void sendCopyMessage(String flowName, String flowCode, List<FlowCopyBo> flowCopyList) {
|
||||
if (CollUtil.isEmpty(flowCopyList)) {
|
||||
|
Reference in New Issue
Block a user