From cccbfadcb6e96c23a33c40c0687a27c2f6efa1db Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 09 十一月 2026 13:16:42 +0800
Subject: [PATCH] feat(seal): 添加印章详情及图片预览功能
---
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pd/seal/PdSealService.java | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pd/seal/PdSealService.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pd/seal/PdSealService.java
index a8f4255..ec17cb6 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pd/seal/PdSealService.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pd/seal/PdSealService.java
@@ -30,6 +30,11 @@
public List<Map<String,Object>> seals(boolean activeOnly) {
return jdbc.queryForList("SELECT id,name,enabled,create_time FROM pd_seal WHERE tenant_id=? AND deleted=0" + (activeOnly ? " AND enabled=1" : "") + " ORDER BY id DESC", tenant());
}
+ public byte[] getImage(long id) {
+ var rows = jdbc.queryForList("SELECT image_data FROM pd_seal WHERE id=? AND tenant_id=? AND deleted=0", id, tenant());
+ if (rows.isEmpty()) throw fail("鍗扮珷涓嶅瓨鍦�");
+ return (byte[]) rows.get(0).get("image_data");
+ }
public long upload(String name, MultipartFile file, Long userId) throws Exception {
if (name == null || name.isBlank() || name.length() > 100) throw fail("鍗扮珷鍚嶇О涓嶈兘涓虹┖涓斾笉鑳借秴杩�100瀛�");
if (file == null || file.isEmpty() || file.getSize() > 2 * 1024 * 1024) throw fail("璇蜂笂浼犱笉瓒呰繃2MB鐨凱NG鍗扮珷鍥剧墖");
@@ -80,11 +85,11 @@
if (instance == null || instance.isBlank()) throw fail("瀹℃壒璁板綍涓嶅畬鏁达紝鏃犳硶涓嬭浇");
boolean humanApproval = taskService.getTaskListByProcessInstanceId(instance, true).stream().anyMatch(task -> {
var vars = task.getTaskLocalVariables();
- if (vars == null || !Integer.valueOf(2).equals(vars.get("TASK_STATUS")) || task.getAssignee() == null || task.getAssignee().equals(String.valueOf(userId))) return false;
+ if (vars == null || !Integer.valueOf(2).equals(vars.get("TASK_STATUS")) || task.getAssignee() == null) return false;
Object reason = vars.get("TASK_REASON");
return Arrays.stream(cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum.values()).noneMatch(item -> Objects.equals(item.getReason(), reason));
});
- if (!humanApproval) throw fail("鏈壘鍒板叾浠栧鎵逛汉鐨勪汉宸ラ�氳繃璁板綍锛屾棤娉曚笅杞�");
+ if (!humanApproval) throw fail("鏈壘鍒颁汉宸ュ鎵归�氳繃璁板綍锛屾棤娉曚笅杞�");
byte[] snapshot=(byte[])rows.get(0).get("document_snapshot"), image=(byte[])rows.get(0).get("seal_image");
var out=new ByteArrayOutputStream(); boolean found=false;
try(var zin=new ZipInputStream(new ByteArrayInputStream(snapshot)); var zout=new ZipOutputStream(out)) { ZipEntry entry; while((entry=zin.getNextEntry())!=null){byte[] bytes=zin.readAllBytes(); if(entry.getName().equals("word/media/seal.png")){bytes=image;found=true;} zout.putNextEntry(new ZipEntry(entry.getName())); zout.write(bytes); zout.closeEntry();} }
--
Gitblit v1.9.3