| | |
| | | |
| | | |
| | | |
| | | public int addOrderToServer(Order order) { |
| | | public String addOrderToServer(Order order) { |
| | | if (Objects.isNull(order.getOrderNo()) || order.getOrderNo().isEmpty()) { |
| | | throw new CoolException("订单号不能为空!!"); |
| | | } |
| | |
| | | maps.add(mapParams); |
| | | log.info("修改订单信息及状态: {}, 请求参数: {}", wmsUrl, JSONArray.toJSONString(maps)); |
| | | HttpEntity<List<Map<String, Object>>> httpEntity = new HttpEntity<>(maps, headers); |
| | | ArrayList<Order> orders = new ArrayList<>(); |
| | | orders.add(order); |
| | | HttpEntity httpEntity2 = new HttpEntity<>(orders, headers);//cs |
| | | // asnOrder/items/save |
| | | ResponseEntity<String> exchange = restTemplate.exchange(wmsUrl, HttpMethod.POST, httpEntity, String.class); |
| | | ResponseEntity<String> exchange = restTemplate.exchange(wmsUrl, HttpMethod.POST, httpEntity2, String.class);//cs |
| | | log.info("订单修改返回结果: {}", exchange); |
| | | if (Objects.isNull(exchange.getBody())) { |
| | | throw new CoolException("查询失败!!"); |
| | |
| | | CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class); |
| | | if (result.getCode() == 200) { |
| | | // JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(result.getData())); |
| | | return 1; |
| | | return "200"; |
| | | } else { |
| | | return 0; |
| | | return result.getMsg(); |
| | | // throw new CoolException("查询失败!!"); |
| | | } |
| | | } catch (JsonProcessingException e) { |
| | | return 0; |
| | | return e.getMessage(); |
| | | // throw new CoolException(e.getMessage()); |
| | | } |
| | | } |