1
0

Oms2KmallController.java 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.GoodsProductAuditResponse;
  6. import com.kmall.admin.utils.oms.response.TransferResponse;
  7. import com.kmall.admin.utils.oms.result.Result;
  8. import com.kmall.common.utils.R;
  9. import net.sf.json.JSONArray;
  10. import org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.stereotype.Controller;
  14. import org.springframework.web.bind.annotation.RequestBody;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.ResponseBody;
  17. /**
  18. * @author zhangchuangbiao
  19. * @version 1.0
  20. * 2021-03-08 10:45
  21. */
  22. @Controller
  23. @ResponseBody
  24. @RequestMapping("omstokmall")
  25. public class Oms2KmallController {
  26. private static Logger LOGGER = LoggerFactory.getLogger(Oms2KmallController.class);
  27. @Autowired
  28. private Oms2KmallService oms2KmallService;
  29. @RequestMapping("/transGoods/notice")
  30. public R transGoodsNotice(@RequestBody Result result){
  31. Object dataResult = result.getData();
  32. if(dataResult == null){
  33. LOGGER.info("解析响应数据OrderResponse集合失败");
  34. return null;
  35. }
  36. JSONArray json = JSONArray.fromObject(dataResult);
  37. if(json == null && json.size() <= 0){
  38. return null;
  39. }
  40. LOGGER.info("请求参数:"+json.toString());
  41. TransferResponse wayBillResponse = null;
  42. try {
  43. wayBillResponse = JacksonUtil.fromStringJson(json.getString(0),TransferResponse.class);
  44. } catch (Exception e) {
  45. e.printStackTrace();
  46. return R.error(e.getMessage());
  47. }
  48. return oms2KmallService.transGoodsNotice(wayBillResponse);
  49. }
  50. @RequestMapping("/goodsProductAudit/notice")
  51. public R goodsProductAuditNotice(@RequestBody Result result){
  52. Object dataResult = result.getData();
  53. if (dataResult == null) {
  54. LOGGER.info("解析响应数据OrderResponse集合失败");
  55. return null;
  56. }
  57. JSONArray json = JSONArray.fromObject(dataResult);
  58. if (json == null && json.size() <= 0) {
  59. return null;
  60. }
  61. LOGGER.info("请求参数:" + json.toString());
  62. GoodsProductAuditResponse goodsProductAuditResponse = null;
  63. try {
  64. goodsProductAuditResponse = JacksonUtil.fromStringJson(json.getString(0), GoodsProductAuditResponse.class);
  65. } catch (Exception e) {
  66. e.printStackTrace();
  67. return R.error(e.getMessage());
  68. }
  69. return oms2KmallService.goodsProductAuditNotice(goodsProductAuditResponse);
  70. }
  71. }