url https://api.weixin.qq.com/wxa/sec/order/upload_shipping_info?access_token=%s
入参{"shipping_list":{"tracking_no":"75611788998298","item_desc":"芙质富勒烯凝时面膜","contact":{"consignor_contact":"177****1234"},"express_company":"ZTO"},"upload_time":"2023-09-22 12:15:57+08:00","order_key":{"mchid":"1613275952","out_trade_no":"P16952896359775","order_number_type":1},"logistics_type":1,"payer":{"openid":"oho4p5FxIwXWDjgCW1BR7BjsmlrM"},"delivery_mode":1}
返回{"errcode":47001,"errmsg":"data format error, hint: [72ece8b0-7e2f-4c52-917b-af60b1ac5c3d] rid: 650d8748-67e95e45-62971516"}
帮忙检查一下,入参哪里错了?
try{ //请求url String url= String.format(orderDelivery, this.getAccessToken()); //请求参数 Map<String, Object> orderKey=new HashMap(); orderKey.put("order_number_type", 1);//订单单号类型,用于确认需要上传详情的订单。枚举值1,使用下单商户号和商户单号;枚举值2,使用微信支付单号。 orderKey.put("mchid","1613275952"); orderKey.put("out_trade_no", "P16952896359775");//原支付交易对应的微信订单号 Map<String, Object> contact =new HashMap(); contact.put("consignor_contact","177****1234"); Map<String, Object> shippingList=new HashMap(); shippingList.put("tracking_no","75611788998298");//物流单号 shippingList.put("express_company","ZTO");//物流公司编码 ZTO是中通快递 shippingList.put("item_desc","芙质富勒烯凝时面膜");//商品信息 shippingList.put("contact",contact); DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); Map<String, Object> payer=new HashMap(); payer.put("openid","oho4p5FxIwXWDjgCW1BR7BjsmlrM"); Map<String, Object> map = new HashMap<>(); map.put("order_key", orderKey); map.put("logistics_type",1);//1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 map.put("delivery_mode",1);//:1、(统一发货)2、(分拆发货) map.put("shipping_list",shippingList); map.put("upload_time", df.format(new Date()) ); map.put("payer",payer); System.out.println("------------:"+new JSONObject(map).toString()); StringEntity myEntity = new StringEntity(new JSONObject(map).toString(),"text/plain","utf-8"); //发送请求 HttpPost httpPost = new HttpPost(url); httpPost.setHeader("Content-type", "application/json"); httpPost.setEntity(myEntity); HttpResponse httpresponse = new DefaultHttpClient().execute(httpPost); String result = EntityUtils.toString(httpresponse.getEntity(), "UTF-8"); System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }