| | |
| | | } |
| | | |
| | | /** |
| | | * 上报已完成订单(新链路,Order格式) |
| | | * @author Ryan |
| | | * @date 2025/10/28 |
| | | * @param orderData Order格式的JSON数据 |
| | | * @return com.vincent.rsf.framework.common.R |
| | | */ |
| | | @Override |
| | | public R uploadReportOrdersNew(JSONObject orderData) { |
| | | if (Objects.isNull(orderData)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | String rcsUrl = rcsApi.getHost() + ":" + rcsApi.getPort() + RcsConstant.REPORT_ORDERS_NEW; |
| | | log.info("上报已完成订单(新链路):{}, 请求参数: {}", rcsUrl, orderData.toJSONString()); |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.add("Content-Type", "application/json"); |
| | | headers.add("api-version", "v2.0"); |
| | | |
| | | HttpEntity httpEntity = new HttpEntity(orderData, headers); |
| | | ResponseEntity<String> exchange = restTemplate.exchange(rcsUrl, HttpMethod.POST, httpEntity, String.class); |
| | | log.info("上报已完成订单(新链路),返回结果: {}", exchange); |
| | | if (Objects.isNull(exchange.getBody())) { |
| | | throw new CoolException("修改失败!!"); |
| | | } else { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | objectMapper.coercionConfigDefaults().setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty); |
| | | try { |
| | | CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class); |
| | | if (result.getCode() == 200) { |
| | | return R.ok().add(result.getData()); |
| | | } else { |
| | | return R.ok(result.getMsg()).add(result.getData()); |
| | | } |
| | | } catch (JsonProcessingException e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 盘点库存数据修改 |
| | | * @param params |
| | | * @return |