Oms2KmallController.java 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package com.kmall.admin.controller.oms2kmall;
  2. import com.kmall.admin.controller.kmall2oms.KtoOmsController;
  3. import com.kmall.admin.service.oms2kmall.Oms2KmallService;
  4. import com.kmall.admin.utils.jackson.JacksonUtil;
  5. import com.kmall.admin.utils.oms.response.TransferResponse;
  6. import com.kmall.admin.utils.oms.result.Result;
  7. import com.kmall.common.utils.R;
  8. import net.sf.json.JSONArray;
  9. import org.slf4j.Logger;
  10. import org.slf4j.LoggerFactory;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.stereotype.Controller;
  13. import org.springframework.web.bind.annotation.RequestBody;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.ResponseBody;
  16. /**
  17. * @author zhangchuangbiao
  18. * @version 1.0
  19. * 2021-03-08 10:45
  20. */
  21. @Controller
  22. @ResponseBody
  23. @RequestMapping("omstokmall")
  24. public class Oms2KmallController {
  25. private static Logger LOGGER = LoggerFactory.getLogger(Oms2KmallController.class);
  26. @Autowired
  27. private Oms2KmallService oms2KmallService;
  28. @RequestMapping("/transGoods/notice")
  29. public R transGoodsNotice(@RequestBody Result result){
  30. Object dataResult = result.getData();
  31. if(dataResult == null){
  32. LOGGER.info("解析响应数据OrderResponse集合失败");
  33. return null;
  34. }
  35. JSONArray json = JSONArray.fromObject(dataResult);
  36. if(json == null && json.size() <= 0){
  37. return null;
  38. }
  39. LOGGER.info("请求参数:"+json.toString());
  40. TransferResponse wayBillResponse = null;
  41. try {
  42. wayBillResponse = JacksonUtil.fromStringJson(json.getString(0),TransferResponse.class);
  43. } catch (Exception e) {
  44. e.printStackTrace();
  45. return R.error(e.getMessage());
  46. }
  47. return oms2KmallService.transGoodsNotice(wayBillResponse);
  48. }
  49. }