|  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 
|---|
|  |  |  | import com.fasterxml.jackson.core.JsonProcessingException; | 
|---|
|  |  |  | import com.fasterxml.jackson.databind.ObjectMapper; | 
|---|
|  |  |  | import com.fasterxml.jackson.databind.cfg.CoercionAction; | 
|---|
|  |  |  | import com.fasterxml.jackson.databind.cfg.CoercionInputShape; | 
|---|
|  |  |  | import com.vincent.rsf.common.domain.CommonReponse; | 
|---|
|  |  |  | import com.vincent.rsf.framework.common.R; | 
|---|
|  |  |  | import com.vincent.rsf.framework.exception.CoolException; | 
|---|
|  |  |  | import com.vincent.rsf.server.api.config.RemotesInfoProperties; | 
|---|
|  |  |  | import com.vincent.rsf.server.api.controller.erp.params.ReportParams; | 
|---|
|  |  |  | import com.vincent.rsf.server.api.entity.CommonResponse; | 
|---|
|  |  |  | import com.vincent.rsf.server.api.entity.constant.RcsConstant; | 
|---|
|  |  |  | import com.vincent.rsf.server.api.entity.dto.PoItemsDto; | 
|---|
|  |  |  | import com.vincent.rsf.server.api.entity.params.ErpInspectItem; | 
|---|
|  |  |  | import com.vincent.rsf.server.api.entity.params.ErpInspectParams; | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R reportOrders(ReportParams params) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | if (Objects.isNull(params)) { | 
|---|
|  |  |  | throw new CoolException("参数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /**WMS基础配置链接*/ | 
|---|
|  |  |  | String rcsUrl = rcsApi.getHost() + ":" + rcsApi.getPort() + RcsConstant.REPORT_ORDERS; | 
|---|
|  |  |  | log.info("上报已完成订单:{}, 请求参数: {}", rcsUrl, JSONObject.toJSONString(params)); | 
|---|
|  |  |  | HttpHeaders headers = new HttpHeaders(); | 
|---|
|  |  |  | headers.add("Content-Type", "application/json"); | 
|---|
|  |  |  | headers.add("api-version", "v2.0"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | HttpEntity httpEntity = new HttpEntity(params, 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 { | 
|---|
|  |  |  | throw new CoolException("修改失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (JsonProcessingException e) { | 
|---|
|  |  |  | throw new CoolException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|