快递100 官网:https://www.kuaidi100.com/
通过官网可知有 订阅推送API和实时查询API。接下来是对订阅推送API的使用详解。
订阅快递100需要参数:
1:快递100的key:授权码,签合同后发放,具体请看API
2:订阅地址 :http://www.kuaidi100.com/poll
3:回调地址:callbackurl 物流订阅成功后,快递100推送的回调地址,用于接收物流信息
以下是订阅推送的代码逻辑:
Controller层:
package com.vue.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hhz.basic.page.Page;
import com.hhz.basic.page.PageData;
import com.hhz.basic.util.common.JsonReturn;
import com.hhz.entity.shop.SubscriptLogExcel;
import com.hhz.service.DictDataUtils;
import com.hhz.service.GoodsOrderManageService;
import com.hhz.service.SubscriptionLogisticsMgr;
import com.hhz.utils.ExportExcelUtil;
import com.hhz.utils.ExportExcelUtil.ExportExcelWrapper;
import com.hhz.utils.UserUtils;
@Controller
@RequestMapping(value = "/vue/subscription")
public class SubscriptionController {
@Autowired
private SubscriptionLogisticsMgr subscriptionLogisticsMgrImpl;
@Autowired
private GoodsOrderManageService goodsOrderManageService;
/**
* 订阅(支持批量订阅)
* @param request
* @param url
* @param status
* @return
*/
@SuppressWarnings("unchecked")
@RequestMapping(value="/subscriptionLogistics.do",produces="application/json;charset=UTF-8", method = RequestMethod.POST)
@ResponseBody
public JsonReturn subscriptionLogistics(HttpServletRequest request,HttpServletResponse response,String token,String orderId,Integer passId) throws Exception{
// 判断数据
if (StringUtils.isEmpty(token) || StringUtils.isEmpty(orderId)) {
return new JsonReturn(JsonReturn.CODE_ERROR, "参数错误");
}
JsonReturn addsubScriotionLog = null;
try {
String[] orderIdString = orderId.split(",");
for(int i=0;i map = new HashMap();
map.put("orderId", orderIdString[i]);
List
Service层:
package com.hhz.service;
import java.util.List;
import java.util.Map;
import org.springframework.web.multipart.MultipartFile;
import com.hhz.basic.util.common.JsonReturn;
import com.hhz.entity.sms.SubscriptionLogistics;
public interface SubscriptionLogisticsMgr {
/**
* 保存订阅记录
*/
public SubscriptionLogistics saveSubscriptionLogistics( SubscriptionLogistics subscriptionLogistics) ;
/**
* 查找记录-根据物流号、订单Id、物流公司
*/
@SuppressWarnings("unchecked")
public List
Service实现类:
package com.hhz.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.hhz.basic.dao.DaoSupport;
import com.hhz.basic.util.common.HttpRequestHelper;
import com.hhz.basic.util.common.JacksonHelper;
import com.hhz.basic.util.common.JsonReturn;
import com.hhz.entity.shop.GoodsOrder;
import com.hhz.entity.shop.Logistics;
import com.hhz.entity.sms.ConstVar;
import com.hhz.entity.sms.SubscriptionLogistics;
import com.hhz.entity.sms.SubscriptionLogisticsRequest;
import com.hhz.entity.sms.SubscriptionLogisticsResponse;
import com.hhz.service.SubscriptionLogisticsMgr;
@Service("subscriptionLogisticsMgrImpl")
public class SubscriptionLogisticsMgrImpl implements SubscriptionLogisticsMgr {
@Resource(name = "daoSupport")
private DaoSupport dao;
/**
* 保存订阅记录
*/
public SubscriptionLogistics saveSubscriptionLogistics( SubscriptionLogistics subscriptionLogistics) {
dao.save("SubscriptionLogisticsMapper.saveLogistics", subscriptionLogistics);
return subscriptionLogistics;
}
/**
* 修改订阅记录状态为0,成功
*/
public SubscriptionLogistics updateSubscriptionLogistics( SubscriptionLogistics subscriptionLogistics) {
dao.save("SubscriptionLogisticsMapper.updSubscriptionLogisticsCallBackUrl", subscriptionLogistics);
return subscriptionLogistics;
}
/**
* 修改回调地址
*/
public SubscriptionLogistics updSubscriptionLogisticsCallBackUrl( SubscriptionLogistics subscriptionLogistics) {
dao.save("SubscriptionLogisticsMapper.updSubscriptionLogisticsCallBackUrl", subscriptionLogistics);
return subscriptionLogistics;
}
/**
* 查找记录-根据物流号、订单Id、物流公司
*/
@SuppressWarnings("unchecked")
public List> getSsLByDeliveryNo(String deliveryNo,long orderId,String logisticsCode) {
Map map = new HashMap();
map.put("deliveryNo", deliveryNo);
map.put("orderId", orderId);
map.put("logisticsCode", logisticsCode);
return (List>) dao.findForList("SubscriptionLogisticsMapper.getSysLogistics", map);
}
/**
* 根据sslId取得订阅记录
* @param sslId
* @return
*/
public SubscriptionLogistics getSslBySslId(long sslId) {
Map map = new HashMap();
map.put("sslId", sslId);
return (SubscriptionLogistics)dao.findForObject("SubscriptionLogisticsMapper.getSysLogisticsById", map);
}
public JsonReturn addsubScriotionLog(Integer orderId,Integer passId){
Map orderIdMap = new HashMap();
orderIdMap.put("orderId", orderId);
//根据订单编号查询订单
GoodsOrder goodsOrder =(GoodsOrder) dao.findForObject("GoodsOrderManageMapper.getOrderByIdSubscription", orderIdMap);
int status = 0;//状态 0--订阅失败
//取得请求的域名
// String callBackUrl = erpFoundationMgr.getConfigValueByKey(ConstVar.CALLBACK_URL);
String callBackUrl = ConstVar.CALLBACK_URL;
//PropertiesHelper.getProperty("callback_url");
if (goodsOrder != null) {
try {
Map logisticsIdMap = new HashMap();
logisticsIdMap.put("logisticsId", goodsOrder.getLogisticsId());
Logistics logistics = (Logistics) dao.findForObject("GoodsOrderManageMapper.findlogisticsById", logisticsIdMap);
//查找是否已经订阅过
List> ssLList = this.getSsLByDeliveryNo(goodsOrder.getLogisticsNo(),orderId,logistics.getLogisticsCode());
String ret = null;
SubscriptionLogistics ssl = new SubscriptionLogistics();
switch (ssLList.size()) {
case 0://如果该运单号没有订阅
//新增订阅记录
ssl=getsubscriptionLogistics(goodsOrder,passId,callBackUrl);
//组装推送数据
ret = Subscription(ssl);
status = 1;//--订阅失败
break;
case 1://如果是订阅失败的,则重新订阅
if (Integer.parseInt(String.valueOf(ssLList.get(0).get("scope_state"))) == 1) {
//重新订阅
ssl.setSslId(Integer.parseInt(String.valueOf(ssLList.get(0).get("ssl_id"))));
ssl.setOrderId(Integer.parseInt(String.valueOf(ssLList.get(0).get("order_id"))));
ssl.setDeliveryNo(String.valueOf(ssLList.get(0).get("delivery_no")));
ssl.setLogisticsId(Integer.parseInt(String.valueOf(ssLList.get(0).get("logistics_id"))));
ssl.setCom(String.valueOf(ssLList.get(0).get("com")));
ssl.setPassId(Integer.parseInt(String.valueOf(ssLList.get(0).get("pass_id"))));
ssl.setPassName(String.valueOf(ssLList.get(0).get("pass_name")));
ssl.setFromAdd(String.valueOf(ssLList.get(0).get("from_add")));
ssl.setToAdd(String.valueOf(ssLList.get(0).get("to_add")));
ssl.setCallbackUrl(String.valueOf(ssLList.get(0).get("callback_url")));
ssl.setCtime(Long.parseLong(String.valueOf(ssLList.get(0).get("ctime"))));
ssl.setScopeState(Integer.parseInt(String.valueOf(ssLList.get(0).get("scope_state"))));
ret = Subscription(ssl);
status = 1;//--订阅失败
} else {
status = 2;//--该运单号已订阅
}
break;
default:
status = 2;//--该运单号已订阅
break;
}
if (status == 1) {
//订阅
SubscriptionLogisticsResponse resp = JacksonHelper.fromJSON(ret, SubscriptionLogisticsResponse.class);
if(resp.getResult()==true){
//status = 3;//成功
ssl.setScopeState(SubscriptionLogistics.scopeState_Success);
this.updateSubscriptionLogistics(ssl);
return new JsonReturn(JsonReturn.CODE_SUCCESS, "订阅成功");
}else{
//status = 3;//成功
ssl.setScopeState(SubscriptionLogistics.scopeState_Success);
this.updateSubscriptionLogistics(ssl);
return new JsonReturn(JsonReturn.CODE_ERROR, resp.getMessage());
}
}else{
return new JsonReturn(JsonReturn.CODE_ERROR, "该运单号已订阅");
}
} catch (Exception e) {
e.printStackTrace();
return new JsonReturn(JsonReturn.CODE_BAD,"服务器错误");
}
}
return new JsonReturn(JsonReturn.CODE_ERROR, "未找到该订单");
}
/**
* 保存订阅记录并返回
* @param orders
* @param passId
* @param callbackurl
* @return
*/
protected SubscriptionLogistics getsubscriptionLogistics(GoodsOrder goodsOrder,Integer passId,String callbackurl){
SubscriptionLogistics ssl = new SubscriptionLogistics();
ssl.setOrderId(goodsOrder.getOrderId());//订单
ssl.setDeliveryNo(goodsOrder.getLogisticsNo());//运单号
ssl.setLogisticsId(goodsOrder.getLogisticsId());//快递公司
Map map =new HashMap();
map.put("logisticsId", goodsOrder.getLogisticsId());
Logistics logistics = (Logistics)dao.findForObject("GoodsOrderManageMapper.findlogisticsById", map);
ssl.setCom(logistics.getLogisticsCode());
ssl.setCtime(System.currentTimeMillis());//创建时间
if(passId!=null){
ssl.setPassId(passId);//订阅人
}
ssl.setPassName("系统");
ssl.setScopeState(SubscriptionLogistics.scopeState_Error);//状态
ssl.setFromAdd(ConstVar.SEND_ADDR_FROM);
ssl.setToAdd(goodsOrder.getReceiverProvince()+goodsOrder.getReceiverCity()+goodsOrder.getReceiverCountry()+goodsOrder.getReceiverAddress());
ssl = this.saveSubscriptionLogistics(ssl);
//设置推送地址
ssl.setCallbackUrl(callbackurl+"?sslId="+ssl.getSslId());
ssl = this.updSubscriptionLogisticsCallBackUrl(ssl);
return ssl;
}
/**
* 组装订阅请求
* @param ssl
* @return
*/
protected String Subscription(SubscriptionLogistics ssl){
try {
SubscriptionLogisticsRequest req = new SubscriptionLogisticsRequest();
//取得物流公司
req.setCompany(ssl.getCom());//快递公司
req.setFrom(ssl.getFromAdd());//发货地址
req.setTo(ssl.getToAdd());//收获地址
req.setNumber(ssl.getDeliveryNo());//运单号-快递号
req.getParameters().put("callbackurl", ssl.getCallbackUrl());//回调地址
req.getParameters().put("resultv2", "1");//推送
req.setKey(ConstVar.KUAIDI100_KEY);//PropertiesHelper.getProperty("kuaidi100_key")
HashMap p = new HashMap();
p.put("schema", "json");
p.put("param", JacksonHelper.toJSON(req));
System.out.println("订阅的请求数据信息"+p);
String ret = HttpRequestHelper.postData(ConstVar.REQUEST_KUAIDI100_URL, p, "UTF-8");//PropertiesHelper.getProperty("reuqest_kuaidi100_url")
System.out.println("订阅的返回数据信息"+ret);
return ret;
} catch (Exception e) {
return null;
}
}
/**
* 根据订单取得最新的订阅信息
* @param orderId
* @return
*/
@SuppressWarnings("unchecked")
public SubscriptionLogistics getLastSslByOrderId(String orderId) {
Map map = new HashMap();
map.put("orderId", orderId);
List> subscriptionLogisticsList = (List>)dao.findForList("SubscriptionLogisticsMapper.getSysLogisticsByOrderId", map);
if(subscriptionLogisticsList.size()>0){
return (SubscriptionLogistics) subscriptionLogisticsList.get(0);
}
return null;
}
/**
* 根据订阅ID查找最新订阅信息
* @param sslId
* @return
*/
@SuppressWarnings("unchecked")
public SubscriptionLogistics getLastSslBySslId(long sslId) {
Map map = new HashMap();
map.put("sslId", sslId);
List> subscriptionLogisticsList = (List>)dao.findForList("SubscriptionLogisticsMapper.getSysLogisticsBysslId", map);
if (subscriptionLogisticsList.size()>0) {
return (SubscriptionLogistics) subscriptionLogisticsList.get(0);
}
return null;
}
/**
* 查找最近一条记录-根据物流号
*/
@SuppressWarnings("unchecked")
public List> getSsLByDeliveryNo(String deliveryNo) {
Map map = new HashMap();
map.put("deliveryNo", deliveryNo);
List> subscriptionLogistics = (List>)dao.findForObject("SubscriptionLogisticsMapper.getSysLogisticsBydeliveryNo", map);
return subscriptionLogistics;
}
}
下面是所用到的实体类:
package com.hhz.entity.sms;
import com.hhz.basic.util.common.JacksonHelper;
import com.thoughtworks.xstream.XStream;
public class NoticeRequest {
private static XStream xstream;
private String status = "";
private String billstatus = "";
private String message = "";
private Result lastResult = new Result();
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getBillstatus() {
return billstatus;
}
public void setBillstatus(String billstatus) {
this.billstatus = billstatus;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Result getLastResult() {
return lastResult;
}
public void setLastResult(Result lastResult) {
this.lastResult = lastResult;
}
private static XStream getXStream() {
if (xstream == null) {
xstream = new XStream();
xstream.autodetectAnnotations(true);
xstream.alias("pushRequest", NoticeRequest.class);
xstream.alias("item", ResultItem.class);
}
return xstream;
}
public String toXml() {
return "\r\n"
+ getXStream().toXML(this);
}
public static NoticeRequest fromXml(String sXml) {
return (NoticeRequest) getXStream().fromXML(sXml);
}
public static void main(String[] args) {
NoticeRequest req = new NoticeRequest();
req.setBillstatus("polling");
req.setMessage("到达");
req.setStatus("check");
req.getLastResult().setCom("yauntong");
req.getLastResult().setCondition("F00");
req.getLastResult().setIscheck("0");
req.getLastResult().setNu("V030344422");
req.getLastResult().setState("0");
req.getLastResult().setStatus("200");
req.getLastResult().setMessage("ok");
ResultItem item = new ResultItem();
item.setContext("上海分拨中心/装件入车扫描 ");
item.setFtime("2012-08-28 16:33:19");
item.setTime("2012-08-28 16:33:19");
req.getLastResult().getData().add(item);
item = new ResultItem();
item.setContext("上海分拨中心/下车扫描");
item.setFtime("2012-08-27 23:22:42");
item.setTime("2012-08-27 23:22:42");
req.getLastResult().getData().add(item);
String sss = "\r\n" + getXStream().toXML(req);
System.out.println(sss);
sss = " check polling 到达 ok V030344422 0 yauntong 200 -
上海分拨中心/装件入车扫描 2012-08-28 16:33:19 -
上海分拨中心/下车扫描 2012-08-27 23:22:42 0 F00 ";
req = NoticeRequest.fromXml(sss);
String json = JacksonHelper.toJSON(req);
System.out.println(json);
}
}
package com.hhz.entity.sms;
public class NoticeResponse {
private boolean result;
private String returnCode;
private String message;
public boolean isResult() {
return result;
}
public void setResult(boolean result) {
this.result = result;
}
public String getReturnCode() {
return returnCode;
}
public void setReturnCode(String returnCode) {
this.returnCode = returnCode;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
package com.hhz.entity.sms;
import java.util.ArrayList;
import org.codehaus.jackson.annotate.JsonIgnore;
import com.hhz.basic.util.common.JacksonHelper;
public class Result {
private String message = "";
private String nu = ""; //运单号
@JsonIgnore
private String ischeck = "0";
@JsonIgnore
private String com = "";
private String status = "0";
@JsonIgnore
private ArrayList data = new ArrayList();
@JsonIgnore
private String state = "0";
@JsonIgnore
private String condition = "";
/**在途中*/
public final static String STATE_ON_THE_WAY = "0";
/**已揽收*/
public final static String STATE_TAKING = "1";
/**疑难*/
public final static String STATE_ISSUE = "2";
/**已签收*/
public final static String STATE_SIGNED_FOR = "3";
/**退签*/
public final static String STATE_RETURNED = "4";
/**同城派送中*/
public final static String STATE_SEND = "5";
/**退回*/
public final static String STATE_UNTREAD = "6";
/**转单*/
public final static String STATE_TRANSFER = "7";
@SuppressWarnings("unchecked")
public Result clone() {
Result r = new Result();
r.setCom(this.getCom());
r.setIscheck(this.getIscheck());
r.setMessage(this.getMessage());
r.setNu(this.getNu());
r.setState(this.getState());
r.setStatus(this.getStatus());
r.setCondition(this.getCondition());
r.setData((ArrayList) this.getData().clone());
return r;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getNu() {
return nu;
}
public void setNu(String nu) {
this.nu = nu;
}
public String getCom() {
return com;
}
public void setCom(String com) {
this.com = com;
}
public ArrayList getData() {
return data;
}
public void setData(ArrayList data) {
this.data = data;
}
public String getIscheck() {
return ischeck;
}
public void setIscheck(String ischeck) {
this.ischeck = ischeck;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
@Override
public String toString() {
return JacksonHelper.toJSON(this);
}
}
package com.hhz.entity.sms;
public class ResultItem {
String time;
String context;
String ftime;
String status;
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context;
}
public String getFtime() {
return ftime;
}
public void setFtime(String ftime) {
this.ftime = ftime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
package com.hhz.entity.sms;
public class SubscriptionLogistics {
/**订阅成功*/
public static final int scopeState_Success = 0;
/**订阅失败*/
public static final int scopeState_Error = 1;
/**发送短信成功*/
public static final int SEND_SMS_YES =1;
/**发送短信失败*/
public static final int SEND_SMS_NO =0;
private Integer sslId;
private Integer orderId;
private String orderNo;
private String deliveryNo;
private Integer logisticsId;
private String com;
private Integer passId;
private String passName;
private String fromAdd;
private String toAdd;
private String callbackUrl;
private Long ctime;
private Integer scopeState;
public Integer getSslId() {
return sslId;
}
public void setSslId(Integer sslId) {
this.sslId = sslId;
}
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getDeliveryNo() {
return deliveryNo;
}
public void setDeliveryNo(String deliveryNo) {
this.deliveryNo = deliveryNo == null ? null : deliveryNo.trim();
}
public Integer getLogisticsId() {
return logisticsId;
}
public void setLogisticsId(Integer logisticsId) {
this.logisticsId = logisticsId;
}
public String getCom() {
return com;
}
public void setCom(String com) {
this.com = com == null ? null : com.trim();
}
public Integer getPassId() {
return passId;
}
public void setPassId(Integer passId) {
this.passId = passId;
}
public String getPassName() {
return passName;
}
public void setPassName(String passName) {
this.passName = passName == null ? null : passName.trim();
}
public String getFromAdd() {
return fromAdd;
}
public void setFromAdd(String fromAdd) {
this.fromAdd = fromAdd == null ? null : fromAdd.trim();
}
public String getToAdd() {
return toAdd;
}
public void setToAdd(String toAdd) {
this.toAdd = toAdd == null ? null : toAdd.trim();
}
public String getCallbackUrl() {
return callbackUrl;
}
public void setCallbackUrl(String callbackUrl) {
this.callbackUrl = callbackUrl == null ? null : callbackUrl.trim();
}
public Long getCtime() {
return ctime;
}
public void setCtime(Long ctime) {
this.ctime = ctime;
}
public Integer getScopeState() {
return scopeState;
}
public void setScopeState(Integer scopeState) {
this.scopeState = scopeState;
}
}
package com.hhz.entity.sms;
import java.util.HashMap;
import java.util.Map.Entry;
import com.hhz.basic.util.common.JacksonHelper;
import com.hhz.basic.util.common.PropertiesHelper;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.mapper.DefaultMapper;
public class SubscriptionLogisticsRequest{
private static XStream xstream;
private String company ;
private String number = "";
private String from = "";
private String to = "";
private String key = PropertiesHelper.getProperty("kuaidi100_key","config.properties");
private String src;
private HashMap parameters = new HashMap();
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
public HashMap getParameters() {
return parameters;
}
public void setParameters(HashMap parameters) {
this.parameters = parameters;
}
@Override
public String toString() {
return JacksonHelper.toJSON(this);
}
// private static XStream getXStream() {
// if (xstream == null) {
// xstream = new XStream();
// xstream.registerConverter(new MapCustomConverter(new DefaultMapper(XStream.class.getClassLoader())));
// xstream.autodetectAnnotations(true);
// xstream.alias("orderRequest", SubscriptionLogisticsRequest.class);
// xstream.alias("property", Entry.class);
// }
// return xstream;
// }
// public String toXml(){
// return "\r\n" + getXStream().toXML(this);
// }
//
// public static SubscriptionLogisticsRequest fromXml(String sXml){
// return (SubscriptionLogisticsRequest)getXStream().fromXML(sXml);
// }
}
package com.hhz.entity.sms;
import com.thoughtworks.xstream.XStream;
public class SubscriptionLogisticsResponse {
private static XStream xstream;
private Boolean result;
private String returnCode;
private String message;
public Boolean getResult() {
return result;
}
public void setResult(Boolean result) {
this.result = result;
}
public String getReturnCode() {
return returnCode;
}
public void setReturnCode(String returnCode) {
this.returnCode = returnCode;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
private static XStream getXStream() {
if (xstream == null) {
xstream = new XStream();
xstream.autodetectAnnotations(true);
xstream.alias("orderResponse", SubscriptionLogisticsResponse.class);
}
return xstream;
}
public String toXml(){
return "\r\n" + getXStream().toXML(this);
}
public static SubscriptionLogisticsResponse fromXml(String sXml){
return (SubscriptionLogisticsResponse)getXStream().fromXML(sXml);
}
public static void main(String[] args){
SubscriptionLogisticsResponse req = new SubscriptionLogisticsResponse();
req.setMessage("订阅成功");
req.setResult(true);
req.setReturnCode("200");
System.out.print(req.toXml());
}
}
mybatis.xml文件
ssl_id, order_id, delivery_no, logistics_id, com, pass_id, pass_name, from_add, to_add,
callback_url, ctime, scope_state
insert into t_logistics_subscription
order_id,
delivery_no,
logistics_id,
com,
pass_id,
pass_name,
from_add,
to_add,
callback_url,
ctime,
scope_state,
#{orderId,jdbcType=BIGINT},
#{deliveryNo,jdbcType=VARCHAR},
#{logisticsId,jdbcType=BIGINT},
#{com,jdbcType=VARCHAR},
#{passId,jdbcType=BIGINT},
#{passName,jdbcType=VARCHAR},
#{fromAdd,jdbcType=VARCHAR},
#{toAdd,jdbcType=VARCHAR},
#{callbackUrl,jdbcType=VARCHAR},
#{ctime,jdbcType=BIGINT},
#{scopeState,jdbcType=INTEGER},
update t_logistics_subscription
order_id = #{orderId,jdbcType=BIGINT},
delivery_no = #{deliveryNo,jdbcType=VARCHAR},
logistics_id = #{logisticsId,jdbcType=BIGINT},
com = #{com,jdbcType=VARCHAR},
pass_id = #{passId,jdbcType=BIGINT},
pass_name = #{passName,jdbcType=VARCHAR},
from_add = #{fromAdd,jdbcType=VARCHAR},
to_add = #{toAdd,jdbcType=VARCHAR},
callback_url = #{callbackUrl,jdbcType=VARCHAR},
ctime = #{ctime,jdbcType=BIGINT},
scope_state = #{scopeState,jdbcType=INTEGER},
where ssl_id = #{sslId,jdbcType=BIGINT}
订阅成功后,登录自己的快递100企业账户即可查看订阅记录。下一篇是关于快递如何推送物流信息,觉得用得上的话请给本小编默默的留个赞,嘻嘻!