| | |
| | | import com.vincent.rsf.openApi.config.PlatformProperties; |
| | | import com.vincent.rsf.openApi.entity.constant.WmsConstant; |
| | | import com.vincent.rsf.openApi.entity.dto.CommonResponse; |
| | | import com.vincent.rsf.openApi.entity.dto.ErpCommonResponse; |
| | | import com.vincent.rsf.openApi.entity.dto.OrderDto; |
| | | import com.vincent.rsf.openApi.entity.params.ErpMatnrParms; |
| | | import com.vincent.rsf.openApi.entity.params.ErpOpParams; |
| | |
| | | result.setData(dto); |
| | | return result; |
| | | } else { |
| | | throw new CoolException("查询失败!!"); |
| | | return result; |
| | | // throw new CoolException("查询失败!!"); |
| | | } |
| | | } catch (JsonProcessingException e) { |
| | | throw new CoolException(e.getMessage()); |
| | |
| | | log.info("已完成订单上传:{}, 请求参数: {}", rcsUrl, httpEntity.getBody()); |
| | | |
| | | ResponseEntity<String> exchange = restTemplate.exchange(rcsUrl, HttpMethod.POST, httpEntity, String.class); |
| | | log.info("已完成订单上传,请求结果: {}", exchange); |
| | | log.info("已完成订单上传,请求结果: {}", exchange.getBody()); |
| | | 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 result; |
| | | } else { |
| | | throw new CoolException("上传失败!!"); |
| | | } |
| | | } catch (JsonProcessingException e) { |
| | | throw new CoolException(e.getMessage()); |
| | | // ObjectMapper objectMapper = new ObjectMapper(); |
| | | // objectMapper.coercionConfigDefaults().setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty); |
| | | CommonResponse commonResponse = new CommonResponse(); |
| | | //// |
| | | // ErpCommonResponse result = objectMapper.readValue(exchange.getBody(), ErpCommonResponse.class); |
| | | ErpCommonResponse result = JSONObject.parseObject(exchange.getBody(), ErpCommonResponse.class); |
| | | if (!result.getIsError()) { |
| | | commonResponse.setCode(200).setMsg(result.getMessage()).setData(result.getData()); |
| | | return commonResponse; |
| | | } else { |
| | | throw new CoolException("上传失败!!"); |
| | | } |
| | | } |
| | | } |