package com.kmall.admin.controller.oms2kmall; import com.kmall.admin.controller.kmall2oms.KtoOmsController; import com.kmall.admin.service.oms2kmall.Oms2KmallService; import com.kmall.admin.utils.jackson.JacksonUtil; import com.kmall.admin.utils.oms.response.GoodsProductAuditResponse; import com.kmall.admin.utils.oms.response.TransferResponse; import com.kmall.admin.utils.oms.result.Result; import com.kmall.common.utils.R; import net.sf.json.JSONArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * @author zhangchuangbiao * @version 1.0 * 2021-03-08 10:45 */ @Controller @ResponseBody @RequestMapping("omstokmall") public class Oms2KmallController { private static Logger LOGGER = LoggerFactory.getLogger(Oms2KmallController.class); @Autowired private Oms2KmallService oms2KmallService; @RequestMapping("/transGoods/notice") public R transGoodsNotice(@RequestBody Result result){ Object dataResult = result.getData(); if(dataResult == null){ LOGGER.info("解析响应数据OrderResponse集合失败"); return null; } JSONArray json = JSONArray.fromObject(dataResult); if(json == null && json.size() <= 0){ return null; } LOGGER.info("请求参数:"+json.toString()); TransferResponse wayBillResponse = null; try { wayBillResponse = JacksonUtil.fromStringJson(json.getString(0),TransferResponse.class); } catch (Exception e) { e.printStackTrace(); return R.error(e.getMessage()); } return oms2KmallService.transGoodsNotice(wayBillResponse); } @RequestMapping("/goodsProductAudit/notice") public R goodsProductAuditNotice(@RequestBody Result result){ Object dataResult = result.getData(); if (dataResult == null) { LOGGER.info("解析响应数据OrderResponse集合失败"); return null; } JSONArray json = JSONArray.fromObject(dataResult); if (json == null && json.size() <= 0) { return null; } LOGGER.info("请求参数:" + json.toString()); GoodsProductAuditResponse goodsProductAuditResponse = null; try { goodsProductAuditResponse = JacksonUtil.fromStringJson(json.getString(0), GoodsProductAuditResponse.class); } catch (Exception e) { e.printStackTrace(); return R.error(e.getMessage()); } return oms2KmallService.goodsProductAuditNotice(goodsProductAuditResponse); } }