LogisticsController.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package com.iamberry.rst.controllers.kuaidi;
  2. import com.iamberry.rst.core.tools.LogisticsInfo;
  3. import com.iamberry.rst.faces.order.LogisticsInfoService;
  4. import com.iamberry.rst.utils.KuaiDi100;
  5. import com.iamberry.rst.utils.ResultMsg;
  6. import com.iamberry.wechat.tools.NameUtils;
  7. import com.iamberry.wechat.tools.ResultInfo;
  8. import net.sf.json.JSONObject;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.stereotype.Controller;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RequestParam;
  13. import org.springframework.web.bind.annotation.ResponseBody;
  14. import javax.servlet.http.HttpServletResponse;
  15. import java.util.List;
  16. /**
  17. * Created by Administrator on 2017/8/15.
  18. */
  19. @Controller
  20. @RequestMapping("/logistics")
  21. public class LogisticsController {
  22. @Autowired
  23. private KuaiDi100 kuaidi100;
  24. @Autowired
  25. private LogisticsInfoService logisticsInfoService;
  26. /**
  27. * 查询快递信息
  28. * @param com 快递公司代码
  29. * @param nu 快递单号
  30. * @return
  31. */
  32. @RequestMapping("/getExpressInfo")
  33. @ResponseBody
  34. public ResultMsg getExpressInfo(@RequestParam("com") String com, @RequestParam("nu") String nu, HttpServletResponse response){
  35. ResultMsg msg = new ResultMsg();
  36. JSONObject rst = null;
  37. if (com == null || com.equals("") || nu == null || nu.equals("")){
  38. msg.setResultCode(ResultInfo.ERRORCODE);
  39. msg.setMessage(NameUtils.getConfig("ERROR"));
  40. msg.setData(rst);
  41. msg.setStatus(false);
  42. return msg;
  43. }
  44. LogisticsInfo log = new LogisticsInfo();
  45. log.setLogisticsRstCode(com);
  46. List<LogisticsInfo> listlog = logisticsInfoService.getLogisticsInfoList(log);
  47. rst = kuaidi100.selectCourierCompany2(listlog.get(0).getLogisticsOnehundredCode(),nu);
  48. msg.setResultCode(ResultInfo.SUCCESSCODE);
  49. msg.setMessage(NameUtils.getConfig("SUCCESSINFO"));
  50. msg.setData(rst);
  51. msg.setStatus(true);
  52. return msg;
  53. }
  54. }