对接京东接口流程如下:
京东官网,获取JD待处理安维订单参数文档地址:http://jos.jd.com/api/detail.htm?id=1890
对接获取订单信息jingdong.las.im.hfs.order.search代码如下:
// 获取订单
public static LasImHfsOrderSearchResponse lasImHfsOrderSearch(
LasImHfsOrderSearchRequest request) throws JdException {
JdClient client = new DefaultJdClient(serverUrl, accessToken, appKey,
appSecret);
request.setNo(serProNo);//服务商编码
return client.execute(request);
}
返回的数据格式为:
{
"jingdong_las_im_hfs_order_search_responce": {
"code": "0",
"result": {
"err_msg": "成功",
"content": [{
"rec_tow_no": "51733",
"pop_add": "",
"des_tow_n": "城区",
"des_tow_no": "51733",
"rec_cit_n": "南昌市",
"sit_con": "",
"cus_tel": "13500090***",
"col_add": "",
"is_ver": 0,
"mai_pri": 0,
"pop_no": "649828",
"del_cit_n": "",
"sum_pri": 0,
"col_pri": 0,
"col_cit_n": "南昌市",
"des_cit_no": "1827",
"col_cod": "",
"est_rec_t": -28800000,
"bra_pri": 0,
"sit_tel": "",
"col_tow_no": "",
"col_tel": "",
"sit_add": "",
"ord_sta": 1100,
"ins_pri": 0,
"des_pro_n": "江西",
"rec_cit_no": "1827",
"del_pro_no": "",
"col_dis_no": "",
"col_cit_no": "",
"del_cit_no": "",
"rec_pro_no": "21",
"col_pro_n": "",
"pop_con": "",
"del_dis_n": "",
"del_add": "",
"is_col": 0,
"col_tow_n": "",
"lgs_sta": 0,
"del_tow_no": "",
"rec_pro_n": "江西",
"ser_sco": 1,
"ord_fro_typ": 200,
"sit_n": "***",
"cus_n": "测试订单",
"des_dis_n": "西湖区",
"des_dis_no": "3506",
"pop_tel": "",
"del_dis_no": "",
"rec_tow_n": "城区",
"col_dis_n": "",
"des_cit_n": "南昌市",
"pop_n": "***",
"des_pro_no": "21",
"jd_ord_no": "9995245***",
"del_tow_n": "",
"sum_vol": 0,
"sit_no": "01086***",
"vou_pri": 0,
"ord_no": "9995245***",
"col_t": 0,
"ord_det": "[{\"goodsCount\":1,\"goodsName\":\"***套装 淋浴喷枪花洒喷头沐浴莲 带喷枪花洒AEO1T1106-P\",\"goodsNo\":\"120079***\",\"height\":0,\"installPrice\":0,\"isNeedInstall\":1,\"length\":0,\"serviceNo\":\"W100014***\",\"volume\":0,\"weight\":0,\"width\":0}]",
"cus_add": "江西南昌市西湖区城区南昌市***48号",
"col_pro_no": "",
"del_pro_n": "",
"rec_dis_no": "3506",
"rec_dis_n": "西湖区"
}],
"nex_que_cod": "",
"size": 1,
"cur_que_cod": "OP15154686***",
"err_cod": 100
}
}
}
// 获取订单
public List<ImPendingOrderDto> lasImHfsOrderSearch(String code, int offset, String no,
String token) throws Exception {
LasImHfsOrderSearchRequest request = new LasImHfsOrderSearchRequest();request.setCode(code);
request.setOffset(offset);
request.setNo(no);
request.setToken(token);
LasImHfsOrderSearchResponse response = JDAPIParent
.lasImHfsOrderSearch(request);
String queryCode="";
try{
queryCode=response.getResult().getCurQueCod();
}catch(Exception e){
queryCode="getCurQueCod失败";
}
//System.out.println(ReflectionToStringBuilder.toString(response));
try{
this.addLog(
"N/A",
"jingdong.las.im.hfs.order.search",
ReflectionToStringBuilder.toString(request),
ReflectionToStringBuilder.toString(response)
+ "//result="
+ ReflectionToStringBuilder.toString(response
.getResult()),queryCode);
}catch(Exception e){
this.addLog(
"N/A",
"jingdong.las.im.hfs.order.search",
ReflectionToStringBuilder.toString(request),"数据太大忽略//result="
+ ReflectionToStringBuilder.toString(response
.getResult()),queryCode);
}
List<ImPendingOrderDto> list = response.getResult().getContent();
int size = StringUtil.getListSize(list);
for (int i = 0; i < size; i++) {
ImPendingOrderDto dto = list.get(i);
this.addLog(dto.getOrdNo(), "jingdong.las.im.hfs.order.search",
ReflectionToStringBuilder.toString(request),
ReflectionToStringBuilder.toString(dto),queryCode);
}
return list;
}
源码下载
源码项目目录为: