修复付款管理付款方式问题

This commit is contained in:
2026-09-02 15:14:50 +08:00
parent e5b8ff5d4c
commit 25fee0656d
@@ -29,6 +29,8 @@ import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.pojo.entity.DictBiz;
import org.springblade.transport.mapper.FormalSettlementMapper; import org.springblade.transport.mapper.FormalSettlementMapper;
import org.springblade.transport.mapper.FormalSettlementPaymentMapper; import org.springblade.transport.mapper.FormalSettlementPaymentMapper;
import org.springblade.transport.mapper.BillLedgerMapper; import org.springblade.transport.mapper.BillLedgerMapper;
@@ -304,7 +306,6 @@ public class PaymentApplicationServiceImpl extends BaseServiceImpl<PaymentApplic
if (Func.isEmpty(request.getPaymentType())) throw new ServiceException("付款类型不能为空"); if (Func.isEmpty(request.getPaymentType())) throw new ServiceException("付款类型不能为空");
if (!List.of("project_advance", "progress_advance", "settlement_payment").contains(request.getPaymentType())) throw new ServiceException("付款类型不合法"); if (!List.of("project_advance", "progress_advance", "settlement_payment").contains(request.getPaymentType())) throw new ServiceException("付款类型不合法");
if (Func.isEmpty(request.getPaymentMethod())) throw new ServiceException("付款方式不能为空"); if (Func.isEmpty(request.getPaymentMethod())) throw new ServiceException("付款方式不能为空");
if (!List.of("bank_transfer", "bank_draft", "commercial_draft").contains(request.getPaymentMethod())) throw new ServiceException("付款方式不合法");
if (isBillPayment(request.getPaymentMethod()) && request.getBillLedgerId() == null) throw new ServiceException("汇票付款必须选择汇票台账"); if (isBillPayment(request.getPaymentMethod()) && request.getBillLedgerId() == null) throw new ServiceException("汇票付款必须选择汇票台账");
if (request.getPaymentRatio() != null && (request.getPaymentRatio().compareTo(BigDecimal.ZERO) < 0 || request.getPaymentRatio().compareTo(BigDecimal.valueOf(100)) > 0)) throw new ServiceException("付款比例必须在0-100之间"); if (request.getPaymentRatio() != null && (request.getPaymentRatio().compareTo(BigDecimal.ZERO) < 0 || request.getPaymentRatio().compareTo(BigDecimal.valueOf(100)) > 0)) throw new ServiceException("付款比例必须在0-100之间");
if (request.getAppliedAmount() == null || request.getAppliedAmount().compareTo(BigDecimal.ZERO) < 0) throw new ServiceException("申请付款金额不能小于0"); if (request.getAppliedAmount() == null || request.getAppliedAmount().compareTo(BigDecimal.ZERO) < 0) throw new ServiceException("申请付款金额不能小于0");
@@ -592,7 +593,16 @@ public class PaymentApplicationServiceImpl extends BaseServiceImpl<PaymentApplic
} }
private boolean isBillPayment(String paymentMethod) { private boolean isBillPayment(String paymentMethod) {
return List.of("bank_draft", "commercial_draft").contains(paymentMethod); if (Func.isEmpty(paymentMethod)) return false;
List<DictBiz> paymentMethods = DictBizCache.getList("pay_method");
if (Func.isEmpty(paymentMethods)) return false;
return paymentMethods.stream()
.filter(item -> paymentMethod.equals(item.getDictKey()) || paymentMethod.equals(item.getDictValue()))
.anyMatch(item -> containsBillText(item.getDictKey()) || containsBillText(item.getDictValue()));
}
private boolean containsBillText(String value) {
return value != null && value.contains("汇票");
} }
private void change(Long id, String from, String to, String node, String reason) { PaymentApplication entity = existing(id); if (!from.equals(entity.getApprovalStatus())) throw new ServiceException("当前状态不允许此操作"); entity.setApprovalStatus(to); entity.setCurrentNode(node); entity.setCurrentProcessor(AuthUtil.getUserName()); entity.setRemark(reason == null ? entity.getRemark() : limit(reason, 200)); updateById(entity); refreshFormalSettlement(entity); } private void change(Long id, String from, String to, String node, String reason) { PaymentApplication entity = existing(id); if (!from.equals(entity.getApprovalStatus())) throw new ServiceException("当前状态不允许此操作"); entity.setApprovalStatus(to); entity.setCurrentNode(node); entity.setCurrentProcessor(AuthUtil.getUserName()); entity.setRemark(reason == null ? entity.getRemark() : limit(reason, 200)); updateById(entity); refreshFormalSettlement(entity); }