yeg
2026-09-16 5c33cf1f2622d4470b861cb041024ead1775c828
talent-card-server/src/main/java/com/talentcard/server/business/merchant/MerchantWorkService.java
@@ -38,16 +38,19 @@
   private final OrderFundBoundaryService orderFundBoundary;
   private final com.talentcard.server.business.order.OrderVerificationService orderVerificationService;
   private final HuifuRefundService refundService;
   private final PaymentFundConfirmationService fundConfirmation;
   public MerchantWorkService(JdbcTemplate jdbcTemplate, ManualConsumptionService manualConsumptionService,
         OrderFundBoundaryService orderFundBoundary,
         com.talentcard.server.business.order.OrderVerificationService orderVerificationService,
         HuifuRefundService refundService) {
         HuifuRefundService refundService,
         PaymentFundConfirmationService fundConfirmation) {
      this.jdbcTemplate = jdbcTemplate;
      this.manualConsumptionService = manualConsumptionService;
      this.orderFundBoundary = orderFundBoundary;
      this.orderVerificationService = orderVerificationService;
      this.refundService = refundService;
      this.fundConfirmation = fundConfirmation;
   }
   @Transactional(readOnly = true)
@@ -280,6 +283,13 @@
      if (verifyTime == null || Duration.between(verifyTime, LocalDateTime.now()).toHours() >= REVOCATION_HOURS) {
         throw new BusinessException(ErrorCode.CONFLICT, "已过可撤销时间");
      }
      // 核销成功时钱已经确认给了商户(基本户),撤销核销必须先把钱退回通道延迟户。回退没成功就不许
      // 翻单:否则订单显示「待核销」,钱却已经结算给商户,商户还能拿着这张单再核销一次。
      String revertOutcome = fundConfirmation.revertForOrder(orderId);
      if (!PaymentFundConfirmationService.moneyBackInDelayAccount(revertOutcome)) {
         throw new BusinessException(ErrorCode.CONFLICT,
               PaymentFundConfirmationService.revertRefusalMessage(revertOutcome));
      }
      String reason = request.reason() == null || request.reason().isBlank() ? "商户撤销核销" : request.reason().trim();
      int updated = jdbcTemplate.update("""
            update verify_record set status = 2, revoked_at = now(), revoked_by = ?, revoke_reason = ?, revoke_idempotency_key = ?