feat(apply): 办件快照增 summaryFields 约定键——让嵌入页出现「业务信息」块
build / build-push (push) Successful in 2m46s

itemSnapshotJson 两个重载各加形参 submitterName(提交人在 ServiceItem 上取不到,必须外传);
快照末尾追加约定键 summaryFields(申请人/所属部门/办结时限/联系电话,label 逐字保序),
只 append 值非空白的行,四项全空则不写该键 ⇒ 嵌入页不出现 "-" 行也不出现空块。
原 6 键 itemTitle/summary/deptName/handleTimeLimit/contactPhone/attachmentNames 一字未动,
flow-center 侧 bizSnapshot 原样透传,前端零改动即可渲染。

表单类字段本轮不做:svc-hall 是通用事项平台,取表单值需解析 formSchemaJson,超出本任务范围。
This commit is contained in:
chenxing
2026-10-10 15:19:59 +08:00
parent f84ce9c822
commit 283d4479f5
@@ -22,7 +22,6 @@ import com.yunhai.svchall.service.SiteGuard;
import com.yunhai.svchall.utils.FormValidator; import com.yunhai.svchall.utils.FormValidator;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@@ -68,10 +67,6 @@ public class ServiceApplyService {
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
private final org.springframework.transaction.support.TransactionTemplate transactionTemplate; private final org.springframework.transaction.support.TransactionTemplate transactionTemplate;
/** 办事大厅前端对外地址(bizUrl 落地页用;projman 注入,本地默认 dev server) */
@Value("${svchall.front.base-url:http://localhost:8087}")
private String frontBaseUrl;
// ===== 用户面(CAS)===== // ===== 用户面(CAS)=====
/** /**
@@ -118,7 +113,7 @@ public class ServiceApplyService {
apply.setItemId(item.getId()); apply.setItemId(item.getId());
apply.setItemCode(item.getItemCode()); apply.setItemCode(item.getItemCode());
apply.setItemTitle(item.getTitle()); apply.setItemTitle(item.getTitle());
apply.setItemSnapshotJson(itemSnapshotJson(item)); apply.setItemSnapshotJson(itemSnapshotJson(item, user.getName()));
apply.setFormVersion(form == null ? null : form.getVersion()); apply.setFormVersion(form == null ? null : form.getVersion());
apply.setFormDataJson(req.getFormData()); apply.setFormDataJson(req.getFormData());
apply.setSubmitterId(user.getId()); apply.setSubmitterId(user.getId());
@@ -128,7 +123,7 @@ public class ServiceApplyService {
// 办件材料绑定(必须落库拿到 applyId 之后再绑) // 办件材料绑定(必须落库拿到 applyId 之后再绑)
attachmentService.bindApply(site.getSchId(), apply.getId(), req.getAttachments()); 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()))); .applyAttachments(site.getSchId(), apply.getId())));
apply = applyRepository.save(apply); apply = applyRepository.save(apply);
@@ -458,9 +453,11 @@ public class ServiceApplyService {
SvcFlowCallbackHandler.BIZ_TYPE, SvcFlowCallbackHandler.BIZ_TYPE,
String.valueOf(apply.getId()), String.valueOf(apply.getId()),
apply.getSubmitterName() + "的" + apply.getItemTitle(), 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 空白页 // Apply.vue router.replace("/apply-detail?id=")):路径参数形态会 no-match 空白页
frontBaseUrl + "/#/apply-detail?id=" + apply.getId(), "/apply-detail?id=" + apply.getId(),
apply.getItemSnapshotJson(), apply.getItemSnapshotJson(),
apply.getSubmitterId(), apply.getSubmitterId(),
apply.getSubmitterName(), apply.getSubmitterName(),
@@ -502,11 +499,12 @@ public class ServiceApplyService {
} }
/** 事项要点快照(= biz_snapshot 内容源;附件清单仅文件名——flow-center biz_snapshot 内容边界) */ /** 事项要点快照(= biz_snapshot 内容源;附件清单仅文件名——flow-center biz_snapshot 内容边界) */
private String itemSnapshotJson(ServiceItem item) { private String itemSnapshotJson(ServiceItem item, String submitterName) {
return itemSnapshotJson(item, new ArrayList<>()); return itemSnapshotJson(item, submitterName, new ArrayList<>());
} }
private String itemSnapshotJson(ServiceItem item, List<com.yunhai.svchall.model.svc.SvcModels.SvcItemAttachmentVo> attachments) { private String itemSnapshotJson(ServiceItem item, String submitterName,
List<com.yunhai.svchall.model.svc.SvcModels.SvcItemAttachmentVo> attachments) {
Map<String, Object> snapshot = new LinkedHashMap<>(); Map<String, Object> snapshot = new LinkedHashMap<>();
snapshot.put("itemTitle", item.getTitle()); snapshot.put("itemTitle", item.getTitle());
snapshot.put("summary", item.getSummary()); snapshot.put("summary", item.getSummary());
@@ -518,6 +516,17 @@ public class ServiceApplyService {
names.add(a.getFileName()); names.add(a.getFileName());
} }
snapshot.put("attachmentNames", names); snapshot.put("attachmentNames", names);
// 约定键:嵌入页「业务信息」唯一渲染源,只保留有值行
List<Map<String, Object>> 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 { try {
return objectMapper.writeValueAsString(snapshot); return objectMapper.writeValueAsString(snapshot);
} catch (Exception e) { } catch (Exception e) {
@@ -526,6 +535,17 @@ public class ServiceApplyService {
} }
} }
/** 值为空白则不追加(避免嵌入页出现 "-" 行;四项全空则不写 summaryFields 键) */
private void appendSummaryField(List<Map<String, Object>> fields, String label, String value) {
if (!StringUtils.hasText(value)) {
return;
}
Map<String, Object> field = new LinkedHashMap<>();
field.put("label", label);
field.put("value", value);
fields.add(field);
}
private Long userSchId(BoaUser user) { private Long userSchId(BoaUser user) {
if (user == null || user.getCurrentRole() == null || user.getCurrentRole().getSchId() == null) { if (user == null || user.getCurrentRole() == null || user.getCurrentRole().getSchId() == null) {
throw new BizException(ErrorCode.PARAM_ERROR, "当前用户无学校归属,无法操作办件"); throw new BizException(ErrorCode.PARAM_ERROR, "当前用户无学校归属,无法操作办件");