Browse Source

密码动态配置配合不同环境联调

master
psh 1 year ago
parent
commit
f2d9342aed
  1. 3
      acs/nladmin-system/src/main/java/org/nl/acs/AcsConfig.java
  2. 13
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java

3
acs/nladmin-system/src/main/java/org/nl/acs/AcsConfig.java

@ -33,6 +33,9 @@ public interface AcsConfig {
//WCS系统接口地址 //WCS系统接口地址
String WCSURL = "liKu_wcs_url"; String WCSURL = "liKu_wcs_url";
//密码
String PASSWORD = "password";
String HASOTHERSYSTEM = "hasOtherSystem"; String HASOTHERSYSTEM = "hasOtherSystem";
String ERPURL = "erpurl"; String ERPURL = "erpurl";

13
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java

@ -103,6 +103,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
log.info("开始反馈wms任务状态,请求参数:{}", JSON.toJSONString(data)); log.info("开始反馈wms任务状态,请求参数:{}", JSON.toJSONString(data));
this.getTokenFromWms(); this.getTokenFromWms();
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
String password=paramService.findByCode(AcsConfig.PASSWORD).getValue();
HttpResponse result = null; HttpResponse result = null;
AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms"); AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms");
String methods_url = addressDto.getMethods_url(); String methods_url = addressDto.getMethods_url();
@ -113,7 +114,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result = HttpRequest result = HttpRequest
.post(url) .post(url)
.header("Content-Type", "application/json;charset=UTF-8") .header("Content-Type", "application/json;charset=UTF-8")
.basicAuth("INFOR","Aa123456@@!!") .basicAuth("INFOR",password)
.body(JSON.toJSONString(data)) .body(JSON.toJSONString(data))
.timeout(3000) .timeout(3000)
.execute(); .execute();
@ -535,6 +536,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
String password=paramService.findByCode(AcsConfig.PASSWORD).getValue();
AddressDto addressDto = addressService.findByCode("shipDeviceUpdate"); AddressDto addressDto = addressService.findByCode("shipDeviceUpdate");
String methods_url = addressDto.getMethods_url(); String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url; String url = wmsUrl + methods_url;
@ -543,7 +545,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
ja.add(param); ja.add(param);
HttpResponse result=HttpRequest.post(url) HttpResponse result=HttpRequest.post(url)
.body(ja.toString()) .body(ja.toString())
.basicAuth("INFOR","Aa123456@@!!") .basicAuth("INFOR",password)
.execute(); .execute();
log.info("shipDeviceUpdate - 返回参数 {}", result.body()); log.info("shipDeviceUpdate - 返回参数 {}", result.body());
return JSONObject.parseObject(result.body()); return JSONObject.parseObject(result.body());
@ -563,6 +565,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
String password=paramService.findByCode(AcsConfig.PASSWORD).getValue();
AddressDto addressDto = addressService.findByCode("feedAgvTaskStatus"); AddressDto addressDto = addressService.findByCode("feedAgvTaskStatus");
String methodsUrl = addressDto.getMethods_url(); String methodsUrl = addressDto.getMethods_url();
String url = wmsUrl + methodsUrl; String url = wmsUrl + methodsUrl;
@ -570,7 +573,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
HttpResponse response = HttpRequest HttpResponse response = HttpRequest
.post(url) .post(url)
.body(from.toString()) .body(from.toString())
.basicAuth("INFOR","Aa123456@@!!") .basicAuth("INFOR",password)
.execute(); .execute();
log.info("feedAgvTaskStatus - 返回参数 {}", response.body()); log.info("feedAgvTaskStatus - 返回参数 {}", response.body());
return JSONObject.parseObject(response.body()); return JSONObject.parseObject(response.body());
@ -626,7 +629,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override @Override
public HttpResponse feedbackAgvDeviceStatus(String device_code, String hasGoods) { public HttpResponse feedbackAgvDeviceStatus(String device_code, String hasGoods) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
String password=paramService.findByCode(AcsConfig.PASSWORD).getValue();
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("device_code", device_code); json.put("device_code", device_code);
json.put("is_have", hasGoods); json.put("is_have", hasGoods);
@ -640,7 +643,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
try { try {
result = HttpRequest.post(url) result = HttpRequest.post(url)
.body(String.valueOf(json)) .body(String.valueOf(json))
.basicAuth("INFOR","Aa123456@@!!") .basicAuth("INFOR",password)
.execute(); .execute();
System.out.println(result); System.out.println(result);
log.info("feedbackAgvDeviceStatus----返回参数{}", result); log.info("feedbackAgvDeviceStatus----返回参数{}", result);

Loading…
Cancel
Save