From 283d4479f5294a84dedebbdc4312dc6b5ce2c8dc Mon Sep 17 00:00:00 2001 From: chenxing Date: Sat, 10 Oct 2026 15:19:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(apply):=20=E5=8A=9E=E4=BB=B6=E5=BF=AB?= =?UTF-8?q?=E7=85=A7=E5=A2=9E=20summaryFields=20=E7=BA=A6=E5=AE=9A?= =?UTF-8?q?=E9=94=AE=E2=80=94=E2=80=94=E8=AE=A9=E5=B5=8C=E5=85=A5=E9=A1=B5?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E3=80=8C=E4=B8=9A=E5=8A=A1=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E3=80=8D=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit itemSnapshotJson 两个重载各加形参 submitterName(提交人在 ServiceItem 上取不到,必须外传); 快照末尾追加约定键 summaryFields(申请人/所属部门/办结时限/联系电话,label 逐字保序), 只 append 值非空白的行,四项全空则不写该键 ⇒ 嵌入页不出现 "-" 行也不出现空块。 原 6 键 itemTitle/summary/deptName/handleTimeLimit/contactPhone/attachmentNames 一字未动, flow-center 侧 bizSnapshot 原样透传,前端零改动即可渲染。 表单类字段本轮不做:svc-hall 是通用事项平台,取表单值需解析 formSchemaJson,超出本任务范围。 --- .../service/impl/ServiceApplyService.java | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/yunhai/svchall/service/impl/ServiceApplyService.java b/src/main/java/com/yunhai/svchall/service/impl/ServiceApplyService.java index 6ee0c5e..4409f3c 100644 --- a/src/main/java/com/yunhai/svchall/service/impl/ServiceApplyService.java +++ b/src/main/java/com/yunhai/svchall/service/impl/ServiceApplyService.java @@ -22,7 +22,6 @@ import com.yunhai.svchall.service.SiteGuard; import com.yunhai.svchall.utils.FormValidator; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; @@ -68,10 +67,6 @@ public class ServiceApplyService { private final ObjectMapper objectMapper; private final org.springframework.transaction.support.TransactionTemplate transactionTemplate; - /** 办事大厅前端对外地址(bizUrl 落地页用;projman 注入,本地默认 dev server) */ - @Value("${svchall.front.base-url:http://localhost:8087}") - private String frontBaseUrl; - // ===== 用户面(CAS)===== /** @@ -118,7 +113,7 @@ public class ServiceApplyService { apply.setItemId(item.getId()); apply.setItemCode(item.getItemCode()); apply.setItemTitle(item.getTitle()); - apply.setItemSnapshotJson(itemSnapshotJson(item)); + apply.setItemSnapshotJson(itemSnapshotJson(item, user.getName())); apply.setFormVersion(form == null ? null : form.getVersion()); apply.setFormDataJson(req.getFormData()); apply.setSubmitterId(user.getId()); @@ -128,7 +123,7 @@ public class ServiceApplyService { // 办件材料绑定(必须落库拿到 applyId 之后再绑) attachmentService.bindApply(site.getSchId(), apply.getId(), req.getAttachments()); - apply.setItemSnapshotJson(itemSnapshotJson(item, attachmentService + apply.setItemSnapshotJson(itemSnapshotJson(item, apply.getSubmitterName(), attachmentService .applyAttachments(site.getSchId(), apply.getId()))); apply = applyRepository.save(apply); @@ -458,9 +453,11 @@ public class ServiceApplyService { SvcFlowCallbackHandler.BIZ_TYPE, String.valueOf(apply.getId()), apply.getSubmitterName() + "的" + apply.getItemTitle(), - // 前端详情页是 hash 路由 + query 传参(routes.ts path="/apply-detail"、 + // 办件落地页传裸相对路径(2026-09-26 自指地址优化 Phase 2):绝对化由接收方 + // 按页面归属(flow-center 代发时 jumpApp=本 bizType)查基址承担,本应用零地址配置。 + // 路径形态仍须 hash 路由 + query 传参(routes.ts path="/apply-detail"、 // Apply.vue router.replace("/apply-detail?id=")):路径参数形态会 no-match 空白页 - frontBaseUrl + "/#/apply-detail?id=" + apply.getId(), + "/apply-detail?id=" + apply.getId(), apply.getItemSnapshotJson(), apply.getSubmitterId(), apply.getSubmitterName(), @@ -502,11 +499,12 @@ public class ServiceApplyService { } /** 事项要点快照(= biz_snapshot 内容源;附件清单仅文件名——flow-center biz_snapshot 内容边界) */ - private String itemSnapshotJson(ServiceItem item) { - return itemSnapshotJson(item, new ArrayList<>()); + private String itemSnapshotJson(ServiceItem item, String submitterName) { + return itemSnapshotJson(item, submitterName, new ArrayList<>()); } - private String itemSnapshotJson(ServiceItem item, List attachments) { + private String itemSnapshotJson(ServiceItem item, String submitterName, + List attachments) { Map snapshot = new LinkedHashMap<>(); snapshot.put("itemTitle", item.getTitle()); snapshot.put("summary", item.getSummary()); @@ -518,6 +516,17 @@ public class ServiceApplyService { names.add(a.getFileName()); } snapshot.put("attachmentNames", names); + + // 约定键:嵌入页「业务信息」唯一渲染源,只保留有值行 + List> summaryFields = new ArrayList<>(); + appendSummaryField(summaryFields, "申请人", submitterName); + appendSummaryField(summaryFields, "所属部门", item.getDeptName()); + appendSummaryField(summaryFields, "办结时限", item.getHandleTimeLimit()); + appendSummaryField(summaryFields, "联系电话", item.getContactPhone()); + if (!summaryFields.isEmpty()) { + snapshot.put("summaryFields", summaryFields); + } + try { return objectMapper.writeValueAsString(snapshot); } catch (Exception e) { @@ -526,6 +535,17 @@ public class ServiceApplyService { } } + /** 值为空白则不追加(避免嵌入页出现 "-" 行;四项全空则不写 summaryFields 键) */ + private void appendSummaryField(List> fields, String label, String value) { + if (!StringUtils.hasText(value)) { + return; + } + Map field = new LinkedHashMap<>(); + field.put("label", label); + field.put("value", value); + fields.add(field); + } + private Long userSchId(BoaUser user) { if (user == null || user.getCurrentRole() == null || user.getCurrentRole().getSchId() == null) { throw new BizException(ErrorCode.PARAM_ERROR, "当前用户无学校归属,无法操作办件");