优化
This commit is contained in:
+4
-4
@@ -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); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user