diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseMineController.java b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseMineController.java index 58e737c0..ead27b9b 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseMineController.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/controller/UnionReimburseMineController.java @@ -127,7 +127,7 @@ public class UnionReimburseMineController { cnd.and(seg); } applyListSort(cnd, pageForm); - cnd.and("info.userId", "=", SecurityUtil.getUserId()); +// cnd.and("info.userId", "=", SecurityUtil.getUserId()); sql.setCondition(cnd); Pagination pagination = unionReimburseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); return Result.success(pagination); diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseExportService.java b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseExportService.java index fa63f76f..8fea2773 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseExportService.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseExportService.java @@ -6,8 +6,9 @@ import java.util.Map; /** 工会报销活动及慰问审批单共用的导出服务。 */ public interface UnionReimburseExportService { /** + * 我的慰问按类型使用专用模板,没有对应模板映射时拒绝导出,不回退通用慰问模板。 * @param id 当前登录人已提交的报销单ID,不接受其他人的单据或待提交单据 - * @return 完整PDF字节数组,模板或转换失败时抛出业务异常 + * @return 按慰问类型选择专用模板生成的完整PDF字节数组,活动沿用原模板;类型、模板或转换失败时抛出业务异常 */ byte[] exportPdf(String id); diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseExportServiceImpl.java b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseExportServiceImpl.java index 6cca083e..65440ee1 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseExportServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseExportServiceImpl.java @@ -51,7 +51,7 @@ public class UnionReimburseExportServiceImpl implements UnionReimburseExportServ public static final String ACTIVITY_TEMPLATE = "union_reimburse_activity_pdf"; public static final String CONDOLENCE_TEMPLATE = "union_reimburse_condolence_pdf"; // 使用慰问类型业务编码匹配模板,避免类型名称调整后选择错误;编码与现有申请页一致。 - private static final Map COLLECT_CONDOLENCE_TEMPLATES = Map.of( + private static final Map CONDOLENCE_TEMPLATES = Map.of( "A", "union_reimburse_condolence_marriage_pdf", "D", "union_reimburse_condolence_birth_pdf", "E", "union_reimburse_condolence_hospital_pdf", @@ -64,7 +64,7 @@ public class UnionReimburseExportServiceImpl implements UnionReimburseExportServ @Inject private Dao dao; - /** 当前“我的报销”导出仅允许单据经办人,状态白名单与页面按钮保持一致。 */ + /** 当前“我的报销”导出仅允许单据经办人,状态白名单与页面按钮保持一致,慰问按类型使用专用模板。 */ @Override public byte[] exportPdf(String id) { return renderDocument(loadExportForm(id, false, false), true, false); @@ -112,29 +112,34 @@ public class UnionReimburseExportServiceImpl implements UnionReimburseExportServ } /** - * 汇总页五类慰问使用独立模板,其余类型和我的报销沿用原模板。 + * 我的报销与汇总页共用五类慰问专用模板映射,活动沿用原模板。 * @param form 已通过数据权限校验的报销单,使用慰问类型 ID 读取业务编码 - * @param collectPrint 是否为汇总页打印,只有该入口启用分类模板 - * @return 系统导出模板管理中的模板编码;类型关联缺失时提示核对,不猜测类型名称 + * @param collectPrint 是否为汇总页打印,仅该入口保留五类之外慰问的原通用模板兜底 + * @return 系统导出模板管理中的模板编码;类型关联缺失或我的慰问无专用模板映射时抛出业务异常 */ private String resolveTemplateCode(UnionReimburse form, boolean collectPrint) { if (!"UNION_REIMBURSE_PROJECT_1".equals(form.getReimburseProject())) { return ACTIVITY_TEMPLATE; } - if (!collectPrint) { - return CONDOLENCE_TEMPLATE; - } // 兼容旧申请将类型 ID 保存在 condolenceType 的情况,不回写历史数据。 String typeId = StrUtil.blankToDefault(form.getCondolenceTypeId(), form.getCondolenceType()); CondolenceType type = StrUtil.isBlank(typeId) ? null : dao.fetch(CondolenceType.class, typeId); if (type == null || StrUtil.isBlank(type.getCode())) { throw new BaseException("慰问类型不存在或编码为空,请核对后打印"); } - // 五类之外的既有慰问继续使用通用模板;已匹配的专用模板缺失时由模板加载器明确报错。 - return COLLECT_CONDOLENCE_TEMPLATES.getOrDefault(type.getCode(), CONDOLENCE_TEMPLATE); + // 两个入口按相同业务编码选择专用模板,模板文件缺失时由模板加载器明确报错。 + String templateCode = CONDOLENCE_TEMPLATES.get(type.getCode()); + if (templateCode != null) { + return templateCode; + } + // 我的慰问禁止回退通用模板,未配置映射的类型明确提示;汇总页保留原有兜底规则。 + if (!collectPrint) { + throw new BaseException("当前慰问类型未配置专用导出模板,请联系管理员核对"); + } + return CONDOLENCE_TEMPLATE; } - /** 模板共用字段和循环行配置;汇总打印按慰问类型选模板并补充编号二维码。 */ + /** 两个入口按慰问类型选模板并共用字段和循环行配置;汇总打印额外补充编号二维码。 */ private byte[] renderDocument(UnionReimburse form, boolean asPdf, boolean collectPrint) { String templateCode = resolveTemplateCode(form, collectPrint); Path docx = null;