zc
3 天以前 5ec416d5886273ae2d9eed3e7ab2c1c286a361a3
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsErpServiceImpl.java
@@ -10,6 +10,7 @@
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;
@@ -80,7 +81,8 @@
                    result.setData(dto);
                    return result;
                } else {
                    throw new CoolException("查询失败!!");
                    return result;
//                    throw new CoolException("查询失败!!");
                }
            } catch (JsonProcessingException e) {
                throw new CoolException(e.getMessage());
@@ -236,21 +238,21 @@
        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("上传失败!!");
            }
        }
    }