package com.iamberry.rst.controllers.kuaidi; import com.iamberry.rst.core.tools.LogisticsInfo; import com.iamberry.rst.faces.order.LogisticsInfoService; import com.iamberry.rst.utils.KuaiDi100; import com.iamberry.rst.utils.ResultMsg; import com.iamberry.wechat.tools.NameUtils; import com.iamberry.wechat.tools.ResultInfo; import net.sf.json.JSONObject; 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.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * Created by Administrator on 2017/8/15. */ @Controller @RequestMapping("/logistics") public class LogisticsController { @Autowired private KuaiDi100 kuaidi100; @Autowired private LogisticsInfoService logisticsInfoService; /** * 查询快递信息 * @param com 快递公司代码 * @param nu 快递单号 * @return */ @RequestMapping("/getExpressInfo") @ResponseBody public ResultMsg getExpressInfo(@RequestParam("com") String com, @RequestParam("nu") String nu, HttpServletResponse response){ ResultMsg msg = new ResultMsg(); JSONObject rst = null; if (com == null || com.equals("") || nu == null || nu.equals("")){ msg.setResultCode(ResultInfo.ERRORCODE); msg.setMessage(NameUtils.getConfig("ERROR")); msg.setData(rst); msg.setStatus(false); return msg; } LogisticsInfo log = new LogisticsInfo(); log.setLogisticsRstCode(com); List listlog = logisticsInfoService.getLogisticsInfoList(log); rst = kuaidi100.selectCourierCompany2(listlog.get(0).getLogisticsOnehundredCode(),nu); msg.setResultCode(ResultInfo.SUCCESSCODE); msg.setMessage(NameUtils.getConfig("SUCCESSINFO")); msg.setData(rst); msg.setStatus(true); return msg; } }