commit
This commit is contained in:
+1
-1
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -24,6 +24,11 @@ public interface UnionReimburseService extends BaseService<UnionReimburse> {
|
||||
*/
|
||||
UnionReimburse getApplyForm(String id);
|
||||
|
||||
/**
|
||||
* 删除报销申请,并同步删除关联发票明细。
|
||||
*/
|
||||
void deleteApply(String id);
|
||||
|
||||
/**
|
||||
* 查询付款人的历史收款信息。
|
||||
*/
|
||||
|
||||
+51
-7
@@ -123,6 +123,8 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> 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<UnionReimburse> 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<UnionReimburseBankHistoryVO> getUserBankHistory(String payer) {
|
||||
if (StrUtil.isBlank(payer)) {
|
||||
@@ -470,6 +482,29 @@ public class UnionReimburseServiceImpl extends BaseServiceImpl<UnionReimburse> 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<UnionReimburse> 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<UnionReimburse> 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<UnionReimburse> 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<UnionReimburse> i
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前仅活动类报销维护发票明细,慰问类仍按原有逻辑处理金额。
|
||||
* 非慰问类报销必须维护发票明细,慰问类发票明细为可选。
|
||||
*/
|
||||
private boolean needInvoiceDetails(UnionReimburse unionReimburse) {
|
||||
return unionReimburse != null && !"UNION_REIMBURSE_PROJECT_1".equals(unionReimburse.getReimburseProject());
|
||||
|
||||
Reference in New Issue
Block a user