From 9e014daddf082cc128c8bd2774e6508ab9f24b27 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sat, 9 May 2026 15:33:13 +0800 Subject: [PATCH] commit --- .../UnionReimburseMineController.java | 2 +- .../service/UnionReimburseService.java | 5 ++ .../impl/UnionReimburseServiceImpl.java | 58 ++++++++++++++++--- .../unionReimburse/apply/index.html | 42 ++++++++------ .../zhgh/dayofficework/unionReimburse/info.js | 2 +- .../unionReimburse/apply/index.html | 56 ++++++++---------- .../dayofficework/unionReimburse/info.js | 2 +- 7 files changed, 106 insertions(+), 61 deletions(-) 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 55ed0437..da4e2f07 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 @@ -189,7 +189,7 @@ public class UnionReimburseMineController { @SaCheckPermission(value = {"unionReimburse.mine", "h5.unionReimburse.mine"}, mode = SaMode.OR) @SLog( tag = "删除工会报销", msg = "删除工会报销") public Result delete(@Param("id") String id) { - unionReimburseService.delete(id); + unionReimburseService.deleteApply(id); return Result.success(); } diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseService.java b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseService.java index 9d3f4bbc..6fef206a 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseService.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/UnionReimburseService.java @@ -24,6 +24,11 @@ public interface UnionReimburseService extends BaseService { */ UnionReimburse getApplyForm(String id); + /** + * 删除报销申请,并同步删除关联发票明细。 + */ + void deleteApply(String id); + /** * 查询付款人的历史收款信息。 */ diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseServiceImpl.java b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseServiceImpl.java index 3be043ba..ea0718ae 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/unionReimburse/service/impl/UnionReimburseServiceImpl.java @@ -123,6 +123,8 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i normalizeInvoiceDetails(unionReimburse); if (needInvoiceDetails(unionReimburse)) { fillInvoiceSummary(unionReimburse); + } else { + fillCondolenceInvoiceSummary(unionReimburse); } fillDefaultRealMoney(unionReimburse); if (stateId == 2) { @@ -178,6 +180,16 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i return unionReimburse; } + @Override + public void deleteApply(String id) { + if (StrUtil.isBlank(id)) { + return; + } + // 删除申请主记录时同步清理发票明细,避免遗留无归属的发票关联数据。 + this.dao().clear(UnionReimburseInvoiceDetail.class, Cnd.where("reimburseId", "=", id)); + this.delete(id); + } + @Override public List getUserBankHistory(String payer) { if (StrUtil.isBlank(payer)) { @@ -470,6 +482,29 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i unionReimburse.setInvoiceNumber(String.valueOf(invoiceFileCount)); } + /** + * 慰问类报销允许不填发票;有发票时按发票汇总金额申请,没有发票时按慰问金额申请。 + */ + private void fillCondolenceInvoiceSummary(UnionReimburse unionReimburse) { + double totalMoney = 0D; + int invoiceFileCount = 0; + for (UnionReimburseInvoiceDetail detail : unionReimburse.getInvoiceDetails()) { + if (detail.getInvoiceAmount() != null) { + totalMoney = BigDecimal.valueOf(totalMoney) + .add(BigDecimal.valueOf(detail.getInvoiceAmount())) + .doubleValue(); + } + if (Lang.isNotEmpty(detail.getInvoiceFiles())) { + invoiceFileCount++; + } + } + Double applyMoney = invoiceFileCount > 0 + ? BigDecimal.valueOf(totalMoney).setScale(2, RoundingMode.HALF_UP).doubleValue() + : unionReimburse.getCondolenceMoney(); + unionReimburse.setMoney(applyMoney); + unionReimburse.setInvoiceNumber(String.valueOf(invoiceFileCount)); + } + /** * 默认实际金额跟随申请金额,后续管理员可在汇总页按最终报销金额调整。 */ @@ -496,11 +531,8 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i // if (StrUtil.isBlank(unionReimburse.getBankOfDeposit())) { // return Result.error("请填写开户行"); // } - if (StrUtil.isBlank(unionReimburse.getPaymentNotes())) { - return Result.error("请填写支付内容"); - } if (!needInvoiceDetails(unionReimburse)) { - return null; + return validateInvoiceDetails(unionReimburse, false); } if (StrUtil.isBlank(unionReimburse.getActivityName())) { return Result.error("请填写活动名称"); @@ -514,7 +546,17 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i if (Lang.isEmpty(unionReimburse.getFiles())) { return Result.error("请上传附件"); } + return validateInvoiceDetails(unionReimburse, true); + } + + /** + * 发票明细提交校验:活动类必须至少一条,慰问类允许为空但填写后必须完整。 + */ + private Result validateInvoiceDetails(UnionReimburse unionReimburse, boolean required) { if (Lang.isEmpty(unionReimburse.getInvoiceDetails())) { + if (!required) { + return null; + } return Result.error("请至少维护一条发票明细"); } for (int i = 0; i < unionReimburse.getInvoiceDetails().size(); i++) { @@ -751,8 +793,10 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i } private BigDecimal getDeclaredApplyMoney(UnionReimburse unionReimburse) { - Double money = "UNION_REIMBURSE_PROJECT_1".equals(unionReimburse.getReimburseProject()) - ? unionReimburse.getCondolenceMoney() : unionReimburse.getMoney(); + Double money = unionReimburse.getMoney(); + if (money == null && "UNION_REIMBURSE_PROJECT_1".equals(unionReimburse.getReimburseProject())) { + money = unionReimburse.getCondolenceMoney(); + } return BigDecimal.valueOf(money == null ? 0D : money).setScale(2, RoundingMode.HALF_UP); } @@ -1097,7 +1141,7 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl i } /** - * 当前仅活动类报销维护发票明细,慰问类仍按原有逻辑处理金额。 + * 非慰问类报销必须维护发票明细,慰问类发票明细为可选。 */ private boolean needInvoiceDetails(UnionReimburse unionReimburse) { return unionReimburse != null && !"UNION_REIMBURSE_PROJECT_1".equals(unionReimburse.getReimburseProject()); diff --git a/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/apply/index.html b/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/apply/index.html index fa7b823d..56820c0a 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/apply/index.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/apply/index.html @@ -36,6 +36,13 @@ layout("/layouts/platform.html"){ .invoice-file-name:hover { text-decoration: underline; } + + .invoice-field-title { + color: #606266; + font-size: 14px; + line-height: 22px; + margin-bottom: 6px; + }
@@ -509,26 +516,23 @@ layout("/layouts/platform.html"){ +
报销金额
+
发票张数
+
支付内容
- - - - -
@@ -714,7 +718,6 @@ layout("/layouts/platform.html"){ condolenceTime: [{required: true, message: "请选择慰问时间", trigger: ["change", "blur"]}], // invoiceNumber: [{required: true, message: "请填写发票张数", trigger: ["change", "blur"]}], // invoice: [{required: true, message: "请填写发票号码", trigger: ["change", "blur"]}], - paymentNotes: [{required: true, message: "请填写支付内容", trigger: ["change", "blur"]}], activityName: [{required: true, message: "请填写活动名称", trigger: ["change", "blur"]}], money: [{required: true, message: "请填写报销金额", trigger: ["change", "blur"]}], mobile: [ @@ -756,7 +759,7 @@ layout("/layouts/platform.html"){ }, computed: { showInvoiceTab() { - return this.formData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1" + return !!this.formData.reimburseProject }, bankHistoryUserNames() { const userNameMap = {} @@ -999,14 +1002,14 @@ layout("/layouts/platform.html"){ this.$set(this.formData, "condolenceMoney", parseFloat(money).toFixed(2)) this.$set(this.formData, "condolenceFilesNotes", uploadFileDesc) this.$set(this.formData, "typeName", name) + this.rebuildInvoiceSummary() } }, handleReimburseProjectChange(value) { if (value === "UNION_REIMBURSE_PROJECT_1") { this.$set(this, "activeTabName", "basic") - this.$set(this.formData, "invoiceDetails", []) - this.$set(this.formData, "invoiceNumber", "") this.$set(this.formData, "money", null) + this.rebuildInvoiceSummary() } else { this.rebuildInvoiceSummary() this.normalizeFundBalance() @@ -1201,9 +1204,6 @@ layout("/layouts/platform.html"){ }) }, rebuildInvoiceSummary() { - if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") { - return - } let totalMoney = 0 let fileCount = 0 const invoiceDetails = this.formData.invoiceDetails || [] @@ -1215,15 +1215,19 @@ layout("/layouts/platform.html"){ fileCount = fileCount + 1 } } - this.$set(this.formData, "money", totalMoney ? totalMoney.toFixed(2) : "0.00") + // 慰问类发票为可选附件;有发票按发票汇总金额,没有发票按慰问金额。 + if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") { + const condolenceMoney = this.formData.condolenceMoney + this.$set(this.formData, "money", fileCount > 0 ? (totalMoney ? totalMoney.toFixed(2) : "0.00") : condolenceMoney) + } else { + this.$set(this.formData, "money", totalMoney ? totalMoney.toFixed(2) : "0.00") + } this.$set(this.formData, "invoiceNumber", String(fileCount)) }, validateInvoiceDetailsBeforeSubmit() { - if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") { - return true - } const invoiceDetails = this.formData.invoiceDetails || [] - if (!invoiceDetails.length) { + // 慰问类允许不填发票;如果填写了发票明细,则每条明细仍需完整。 + if (!invoiceDetails.length && this.formData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1") { this.$message.warning("请至少维护一条发票明细") return false } @@ -1284,6 +1288,7 @@ layout("/layouts/platform.html"){ // 提交验证 validateBeforeSubmit() { return new Promise((resolve) => { + this.rebuildInvoiceSummary() this.$refs.formRef.validate((valid) => { if (valid) { if (this.formData.reimburseFundSource === "UNION_REIMBURSE_FUND_SOURCE_3" && !this.formData.clubId) { @@ -1297,7 +1302,6 @@ layout("/layouts/platform.html"){ return } this.normalizeFundBalance() - this.rebuildInvoiceSummary() resolve(true) } else { this.$message.warning("请完善必填信息") diff --git a/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/info.js b/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/info.js index b9dfdaee..77520c51 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/info.js +++ b/src/main/resources/views/platform/zhgh/dayofficework/unionReimburse/info.js @@ -293,7 +293,7 @@ const unionReimburseInfo = { }, computed: { showInvoiceTab() { - return this.viewData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1" + return !!this.viewData.reimburseProject } }, methods: { diff --git a/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/apply/index.html b/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/apply/index.html index 1e3181b3..2e42bddf 100644 --- a/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/apply/index.html +++ b/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/apply/index.html @@ -497,9 +497,7 @@ layout("/layouts/platform_h5.html"){ placeholder="请填写报销事由" type="textarea" rows="2" - autosize - :rules="[{ required: true, message: '请填写报销事由' }]" - required> + autosize> - - - - + + +
发票明细列表 @@ -1023,9 +1014,8 @@ layout("/layouts/platform_h5.html"){ }, handleReimburseProjectChange(value) { if (value === "UNION_REIMBURSE_PROJECT_1") { - this.$set(this.formData, "invoiceDetails", []) - this.$set(this.formData, "invoiceNumber", "") this.$set(this.formData, "money", "") + this.rebuildInvoiceSummary() } else { this.rebuildInvoiceSummary() } @@ -1259,9 +1249,6 @@ layout("/layouts/platform_h5.html"){ }) }, rebuildInvoiceSummary() { - if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") { - return - } let totalMoney = 0 let fileCount = 0 const invoiceDetails = this.formData.invoiceDetails || [] @@ -1273,15 +1260,19 @@ layout("/layouts/platform_h5.html"){ fileCount = fileCount + 1 } } - this.$set(this.formData, "money", totalMoney ? totalMoney.toFixed(2) : "0.00") + // 慰问类发票为可选附件;有发票按发票汇总金额,没有发票按慰问金额。 + if (this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") { + const condolenceMoney = this.formData.condolenceMoney + this.$set(this.formData, "money", fileCount > 0 ? (totalMoney ? totalMoney.toFixed(2) : "0.00") : condolenceMoney) + } else { + this.$set(this.formData, "money", totalMoney ? totalMoney.toFixed(2) : "0.00") + } this.$set(this.formData, "invoiceNumber", String(fileCount)) }, validateInvoiceDetailsBeforeSubmit() { - if (!this.formData.reimburseProject || this.formData.reimburseProject === "UNION_REIMBURSE_PROJECT_1") { - return true - } const invoiceDetails = this.formData.invoiceDetails || [] - if (!invoiceDetails.length) { + // 慰问类允许不填发票;如果填写了发票明细,则每条明细仍需完整。 + if (!invoiceDetails.length && this.formData.reimburseProject !== "UNION_REIMBURSE_PROJECT_1") { this.$toast.fail("请至少维护一条发票明细") return false } @@ -1442,13 +1433,13 @@ layout("/layouts/platform_h5.html"){ async onSubmit() { this.normalizeContactFields() + this.normalizeCondolenceDateFields() + this.rebuildInvoiceSummary() this.$refs.formRef.validate().then(() => { // if (!this.formData.userSign) { // this.$toast.fail("请签名") // return // } - this.normalizeCondolenceDateFields() - this.rebuildInvoiceSummary() if (!this.validateInvoiceDetailsBeforeSubmit()) { return } @@ -1477,13 +1468,13 @@ layout("/layouts/platform_h5.html"){ async onSubmitAgain() { this.normalizeContactFields() + this.normalizeCondolenceDateFields() + this.rebuildInvoiceSummary() this.$refs.formRef.validate().then(() => { if (!this.formData.userSign) { this.$toast.fail("请签名") return } - this.normalizeCondolenceDateFields() - this.rebuildInvoiceSummary() if (!this.validateInvoiceDetailsBeforeSubmit()) { return } @@ -1578,6 +1569,7 @@ layout("/layouts/platform_h5.html"){ this.$set(this.formData, "way", selectedType.way) this.$set(this.formData, "condolenceMoney", parseFloat(selectedType.money || 0).toFixed(2)) this.$set(this.formData, "condolenceFilesNotes", selectedType.uploadFileDesc) + this.rebuildInvoiceSummary() } }, onCondolenceWayConfirm(o) { diff --git a/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/info.js b/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/info.js index 7c55ca88..e8434aa8 100644 --- a/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/info.js +++ b/src/main/resources/views/platform/zhghh5/dayofficework/unionReimburse/info.js @@ -92,7 +92,7 @@ const UNION_REIMBURSE_INFO = { - + {{ formatMoney(viewData.money) }} {{ viewData.invoiceNumber }}