package com.zy.common.service.wms;
|
|
import com.alibaba.fastjson.JSON;
|
import com.zy.common.utils.HttpHandler;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.stereotype.Component;
|
|
import java.io.IOException;
|
import java.util.List;
|
|
/**
|
* Created by vincent on 2021/5/27
|
*/
|
@Component
|
public class WmsService {
|
|
@Value("${wms.url}")
|
private String wmsUrl;
|
|
// // todo:luxiaotao
|
// public Result replenish(List<ReplenishDto> dtos) {
|
// return new Result(200, "操作成功", null);
|
// }
|
|
public Result replenish(List<ReplenishDto> dtos) {
|
try {
|
ReplenishParam param = new ReplenishParam();
|
param.setList(dtos);
|
String response = new HttpHandler.Builder()
|
.setUri(wmsUrl)
|
.setPath("/open/api/replenish")
|
.setJson(JSON.toJSONString(param))
|
.build()
|
.doPost();
|
return JSON.parseObject(response, Result.class);
|
} catch (IOException e) {
|
e.printStackTrace();
|
return new Result(500, "服务器异常", null);
|
}
|
}
|
|
}
|