binarywang/WxJava · warning · IllegalArgumentException
查询请求 wxStoreId 不可为空
Error message
查询请求 wxStoreId 不可为空
What it means
Unchecked IllegalArgumentException from queryFlow(WxMaQueryFlowRequest) when request == null or request.getWxStoreId() == null. The flow query is scoped per-store, so a store identifier is mandatory even though WxMaQueryFlowRequest also carries serviceTransId and a time range.
Source
Thrown at weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpl.java:137
@Override
public String storeCharge(WxMaStoreChargeRequest request) throws WxErrorException {
String response = this.wxMaService.postWithSignature(Intracity.STORE_CHARGE, request);
Map<?, ?> map = gson.fromJson(response, Map.class);
return (String) map.get("payurl");
}
@Override
public int storeRefund(WxMaStoreRefundRequest request) throws WxErrorException {
String response = this.wxMaService.postWithSignature(Intracity.STORE_REFUND, request);
Map<?, ?> map = gson.fromJson(response, Map.class);
return ((Number) map.get("refund_amount")).intValue();
}
@Override
public WxMaStoreFlowResponse<? extends WxMaStoreFlowResponse.BasicFlowRecord> queryFlow(
WxMaQueryFlowRequest request) throws WxErrorException {
if (request == null || request.getWxStoreId() == null) {
throw new IllegalArgumentException("查询请求 wxStoreId 不可为空");
}
WxMaStoreFlowResponse<? extends WxMaStoreFlowResponse.BasicFlowRecord> inst =
getFlowInstanceByType(request.getFlowType());
if (inst == null) {
throw new IllegalArgumentException("查询请求 flowType 不正确,只能是1、2、3之一");
}
String response = this.wxMaService.postWithSignature(Intracity.QUERY_FLOW, request);
WxMaStoreFlowResponse<? extends WxMaStoreFlowResponse.BasicFlowRecord> flowResponse;
flowResponse =
(WxMaStoreFlowResponse<? extends WxMaStoreFlowResponse.BasicFlowRecord>)
gson.fromJson(response, inst.getClass());
logger.debug("queryFlow: {}", flowResponse);
return flowResponse;
}
private WxMaStoreFlowResponse<? extends WxMaStoreFlowResponse.BasicFlowRecord>View on GitHub (pinned to 1c43293a3c)
Solutions
- Set wxStoreId on the request: req.setWxStoreId(wxStoreId).
- Null-check the request object itself before calling queryFlow.
Example fix
// before WxMaQueryFlowRequest req = new WxMaQueryFlowRequest(); req.setFlowType(1); req.setBeginDate(start); intracityService.queryFlow(req); // after WxMaQueryFlowRequest req = new WxMaQueryFlowRequest(); req.setWxStoreId(wxStoreId); req.setFlowType(1); req.setBeginDate(start); intracityService.queryFlow(req);
Defensive patterns
Strategy: validation
Validate before calling
if (req == null || req.getWxStoreId() == null) {
throw new IllegalArgumentException("wxStoreId required for queryFlow");
} Try / catch
try {
resp = intracityService.queryFlow(req);
} catch (IllegalArgumentException e) {
throw e;
} Prevention
- Treat wxStoreId as required on every queryFlow request.
- Validate the full request object (null + key fields) in a shared pre-call validator.
When it happens
Trigger: Calling queryFlow(req) with a null request object, or a request where setWxStoreId(...) was not called.
Common situations: Building WxMaQueryFlowRequest from query params that omitted wxStoreId; sharing a request-builder that only sets dates and flowType.
Related errors
- 创建门店时outStoreId不能为空
- 更新门店时wxStoreId 或 outStoreId 至少要有一个不为null
- 查询请求 flowType 不正确,只能是1、2、3之一
- payMode是PAY_MODE_STORE或null时,必须传递wxStoreId
- 创建门店时wxStoreId只能是null
AI-assisted analysis of binarywang/WxJava@1c43293a3c (2026-08-14).
Data as JSON: /api/errors/77daf199761cf7f1.
Report an issue: GitHub.