This commit is contained in:
2026-09-29 18:06:18 +08:00
parent 54ad26c607
commit 2c60a29e0f
30 changed files with 384 additions and 139 deletions
@@ -14,11 +14,11 @@ import org.springframework.dao.DuplicateKeyException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.server.ResponseStatusException;
import com.baiyue.common.event.EventProtocolException;
import java.util.List;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
@Service
@RequiredArgsConstructor
@@ -67,12 +67,12 @@ public class WalletCommandCompletedConsumer {
|| result.businessType() == null || result.businessType().isBlank()
|| result.businessNo() == null || result.businessNo().isBlank()) throw bad("资金结果事件字段无效");
return result;
} catch (ResponseStatusException exception) { throw exception; }
} catch (EventProtocolException exception) { throw exception; }
catch (Exception exception) { throw bad("资金结果事件载荷无法解析"); }
}
private String json(Object value) {
try { return objectMapper.writeValueAsString(value); }
catch (Exception exception) { throw bad("资金结果事件序列化失败"); }
}
private static ResponseStatusException bad(String message) { return new ResponseStatusException(BAD_REQUEST, message); }
private static EventProtocolException bad(String message) { return new EventProtocolException(message); }
}