|
@@ -24,7 +24,13 @@ public class WzwlDocking extends BaseClass {
|
|
|
String companyCode = "202409241033166130229eade94bece";
|
|
|
String appKey = "jA0TvC5VOHnmk8P4RdEX1wAgktMQvtlC";
|
|
|
String secretKey = "mIAZwKEaUOpp";
|
|
|
+ boolean isDocking = false;
|
|
|
|
|
|
+ public WzwlDocking(String siteid) throws YosException {
|
|
|
+ if(siteid.equalsIgnoreCase("lsa")){
|
|
|
+ isDocking=true;
|
|
|
+ }
|
|
|
+ }
|
|
|
/**创建万中物流订单
|
|
|
* @param logisticRow
|
|
|
* @param logisticItems
|
|
@@ -35,14 +41,15 @@ public class WzwlDocking extends BaseClass {
|
|
|
* @throws NoSuchAlgorithmException
|
|
|
*/
|
|
|
public String createWzwlOrder(Row logisticRow, Rows logisticItems, Controller controller, long sa_logisticsid, JSONObject sender) throws YosException, NoSuchAlgorithmException, UnsupportedEncodingException {
|
|
|
- JSONObject request = new JSONObject();
|
|
|
- JSONObject request1 = new JSONObject();
|
|
|
- JSONObject data = new JSONObject();
|
|
|
- JSONObject consigner = new JSONObject();
|
|
|
- JSONObject consignee = new JSONObject();
|
|
|
- JSONArray cargo = new JSONArray();
|
|
|
- String settleType=logisticRow.getString("paytype");
|
|
|
- String deliverType=logisticRow.getString("delivertype");
|
|
|
+ if(isDocking){
|
|
|
+ JSONObject request = new JSONObject();
|
|
|
+ JSONObject request1 = new JSONObject();
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
+ JSONObject consigner = new JSONObject();
|
|
|
+ JSONObject consignee = new JSONObject();
|
|
|
+ JSONArray cargo = new JSONArray();
|
|
|
+ String settleType=logisticRow.getString("paytype");
|
|
|
+ String deliverType=logisticRow.getString("delivertype");
|
|
|
// switch (logisticRow.getString("paytype")){
|
|
|
// case "发货人付款(现付)":{
|
|
|
// settleType=1;
|
|
@@ -83,71 +90,73 @@ public class WzwlDocking extends BaseClass {
|
|
|
// default:
|
|
|
// break;
|
|
|
// }
|
|
|
- data.put("companyCode", companyCode);
|
|
|
- data.put("logisticCompanyID", "WZ");
|
|
|
- data.put("custOrderNo", logisticRow.getString("billno"));
|
|
|
- long timestamp = System.currentTimeMillis() / 1000;
|
|
|
- data.put("submitTime",timestamp);
|
|
|
- data.put("totalNum", StringUtils.isBlank(logisticRow.getString("packageqty"))?0:logisticRow.getInteger("packageqty")); //待定
|
|
|
- data.put("totalWeight", StringUtils.isBlank(logisticRow.getString("weight"))?0:logisticRow.getBigDecimal("weight"));//待定
|
|
|
- data.put("totalVolume", StringUtils.isBlank(logisticRow.getString("volume"))?0:logisticRow.getBigDecimal("volume"));//待定
|
|
|
- data.put("settleType", StringUtils.isBlank(logisticRow.getString("paytype"))?3:logisticRow.getInteger("paytype"));
|
|
|
- data.put("isPickup", "false");
|
|
|
- data.put("deliverType", StringUtils.isBlank(logisticRow.getString("delivertype"))?2:logisticRow.getInteger("delivertype"));
|
|
|
- data.put("remark", logisticRow.getString("remarks"));
|
|
|
- //发货人
|
|
|
- consigner.put("company", sender.getString("company"));
|
|
|
- consigner.put("name", sender.getString("name"));
|
|
|
- consigner.put("mobile", sender.getString("phonenumber"));
|
|
|
- consigner.put("phone", sender.getString("phonenumber"));
|
|
|
- consigner.put("province", sender.getString("province"));
|
|
|
- consigner.put("city", sender.getString("city"));
|
|
|
- consigner.put("district", sender.getString("county"));
|
|
|
- consigner.put("address", sender.getString("address"));
|
|
|
- //收货人
|
|
|
- consignee.put("company", "");
|
|
|
- consignee.put("name", logisticRow.getString("name"));
|
|
|
- consignee.put("mobile", logisticRow.getString("phonenumber"));
|
|
|
- consignee.put("phone", logisticRow.getString("phonenumber"));
|
|
|
- consignee.put("province", logisticRow.getString("province"));
|
|
|
- consignee.put("city", logisticRow.getString("city"));
|
|
|
- consignee.put("district", logisticRow.getString("county"));
|
|
|
- consignee.put("address", logisticRow.getString("address"));
|
|
|
- data.put("consigner", consigner);
|
|
|
- data.put("consignee", consignee);
|
|
|
- for (Row row : logisticItems) {
|
|
|
- JSONObject logisticItem = new JSONObject();
|
|
|
- logisticItem.put("name", row.getString("itemname"));
|
|
|
- logisticItem.put("num", row.getInteger("qty"));
|
|
|
- cargo.add(logisticItem);
|
|
|
- }
|
|
|
- data.put("cargo", cargo);
|
|
|
- String datastr=data.toString().replace("\"", "'");
|
|
|
- String datastr1=data.toString().replace("\"", "''");
|
|
|
- request1.put("data", datastr1);
|
|
|
- request1.put("appKey", appKey);
|
|
|
- request1.put("digest", digest_MD5_Base64(datastr, secretKey));
|
|
|
- request.put("data", datastr);
|
|
|
- request.put("appKey", appKey);
|
|
|
- request.put("digest", digest_MD5_Base64(datastr, secretKey));
|
|
|
- HashMap<String, String> map = new HashMap<>();
|
|
|
- map.put("content-Type", "application/json");
|
|
|
- System.out.println(request.toString());
|
|
|
- String result = new WebRequest().doPost(request.toString(), url + "OrderCreate", map);
|
|
|
- JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
+ data.put("companyCode", companyCode);
|
|
|
+ data.put("logisticCompanyID", "WZ");
|
|
|
+ data.put("custOrderNo", logisticRow.getString("billno"));
|
|
|
+ long timestamp = System.currentTimeMillis() / 1000;
|
|
|
+ data.put("submitTime",timestamp);
|
|
|
+ data.put("totalNum", StringUtils.isBlank(logisticRow.getString("packageqty"))?0:logisticRow.getInteger("packageqty")); //待定
|
|
|
+ data.put("totalWeight", StringUtils.isBlank(logisticRow.getString("weight"))?0:logisticRow.getBigDecimal("weight"));//待定
|
|
|
+ data.put("totalVolume", StringUtils.isBlank(logisticRow.getString("volume"))?0:logisticRow.getBigDecimal("volume"));//待定
|
|
|
+ data.put("settleType", StringUtils.isBlank(logisticRow.getString("paytype"))?3:logisticRow.getInteger("paytype"));
|
|
|
+ data.put("isPickup", "false");
|
|
|
+ data.put("deliverType", StringUtils.isBlank(logisticRow.getString("delivertype"))?2:logisticRow.getInteger("delivertype"));
|
|
|
+ data.put("remark", logisticRow.getString("remarks"));
|
|
|
+ //发货人
|
|
|
+ consigner.put("company", sender.getString("company"));
|
|
|
+ consigner.put("name", sender.getString("name"));
|
|
|
+ consigner.put("mobile", sender.getString("phonenumber"));
|
|
|
+ consigner.put("phone", sender.getString("phonenumber"));
|
|
|
+ consigner.put("province", sender.getString("province"));
|
|
|
+ consigner.put("city", sender.getString("city"));
|
|
|
+ consigner.put("district", sender.getString("county"));
|
|
|
+ consigner.put("address", sender.getString("address"));
|
|
|
+ //收货人
|
|
|
+ consignee.put("company", "");
|
|
|
+ consignee.put("name", logisticRow.getString("name"));
|
|
|
+ consignee.put("mobile", logisticRow.getString("phonenumber"));
|
|
|
+ consignee.put("phone", logisticRow.getString("phonenumber"));
|
|
|
+ consignee.put("province", logisticRow.getString("province"));
|
|
|
+ consignee.put("city", logisticRow.getString("city"));
|
|
|
+ consignee.put("district", logisticRow.getString("county"));
|
|
|
+ consignee.put("address", logisticRow.getString("address"));
|
|
|
+ data.put("consigner", consigner);
|
|
|
+ data.put("consignee", consignee);
|
|
|
+ for (Row row : logisticItems) {
|
|
|
+ JSONObject logisticItem = new JSONObject();
|
|
|
+ logisticItem.put("name", row.getString("itemname"));
|
|
|
+ logisticItem.put("num", row.getInteger("qty"));
|
|
|
+ cargo.add(logisticItem);
|
|
|
+ }
|
|
|
+ data.put("cargo", cargo);
|
|
|
+ String datastr=data.toString().replace("\"", "'");
|
|
|
+ String datastr1=data.toString().replace("\"", "''");
|
|
|
+ request1.put("data", datastr1);
|
|
|
+ request1.put("appKey", appKey);
|
|
|
+ request1.put("digest", digest_MD5_Base64(datastr, secretKey));
|
|
|
+ request.put("data", datastr);
|
|
|
+ request.put("appKey", appKey);
|
|
|
+ request.put("digest", digest_MD5_Base64(datastr, secretKey));
|
|
|
+ HashMap<String, String> map = new HashMap<>();
|
|
|
+ map.put("content-Type", "application/json");
|
|
|
+ System.out.println(request.toString());
|
|
|
+ String result = new WebRequest().doPost(request.toString(), url + "OrderCreate", map);
|
|
|
+ JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
|
|
|
- saveLog(controller, "sa_logistics", sa_logisticsid, "创建万众物流订单", request1.toString(), resultobject);
|
|
|
+ saveLog(controller, "sa_logistics", sa_logisticsid, "创建万众物流订单", request1.toString(), resultobject);
|
|
|
|
|
|
- if (resultobject != null) {
|
|
|
- if (resultobject.getString("success").equals("true")) {
|
|
|
- return "true";
|
|
|
+ if (resultobject != null) {
|
|
|
+ if (resultobject.getString("success").equals("true")) {
|
|
|
+ return "true";
|
|
|
+ } else {
|
|
|
+ return resultobject.getString("errorMessage");
|
|
|
+ }
|
|
|
} else {
|
|
|
- return resultobject.getString("errorMessage");
|
|
|
+ return "false";
|
|
|
}
|
|
|
- } else {
|
|
|
- return "false";
|
|
|
+ }else{
|
|
|
+ return "true";
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -158,17 +167,19 @@ public class WzwlDocking extends BaseClass {
|
|
|
* @throws NoSuchAlgorithmException
|
|
|
*/
|
|
|
public JSONObject queryWzwlOrder(String orderNo) throws YosException, NoSuchAlgorithmException {
|
|
|
- JSONObject request = new JSONObject();
|
|
|
- JSONObject data = new JSONObject();
|
|
|
-
|
|
|
- data.put("companyCode", companyCode);
|
|
|
- data.put("orderNo", orderNo);
|
|
|
+ JSONObject resultobject=new JSONObject();
|
|
|
+ if(isDocking) {
|
|
|
+ JSONObject request = new JSONObject();
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
|
|
|
- HashMap<String, String> map = new HashMap<>();
|
|
|
- map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(data.toString(), url + "OrderQuery", map);
|
|
|
- JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
+ data.put("companyCode", companyCode);
|
|
|
+ data.put("orderNo", orderNo);
|
|
|
|
|
|
+ HashMap<String, String> map = new HashMap<>();
|
|
|
+ map.put("content-Type", "application/json");
|
|
|
+ String result = new WebRequest().doPost(data.toString(), url + "OrderQuery", map);
|
|
|
+ resultobject = JSONObject.parseObject(result);
|
|
|
+ }
|
|
|
return resultobject;
|
|
|
}
|
|
|
|
|
@@ -180,39 +191,43 @@ public class WzwlDocking extends BaseClass {
|
|
|
* @throws NoSuchAlgorithmException
|
|
|
*/
|
|
|
public JSONObject queryWzwlOrderAmount(String orderNo) throws YosException, NoSuchAlgorithmException, UnsupportedEncodingException {
|
|
|
- JSONObject request = new JSONObject();
|
|
|
- JSONObject data = new JSONObject();
|
|
|
-
|
|
|
- data.put("companyCode", companyCode);
|
|
|
- data.put("orderNo", orderNo);
|
|
|
- String datastr =data.toString().replace("\"", "'");
|
|
|
- request.put("data", data.toString().replace("\"", "'"));
|
|
|
- request.put("appKey", appKey);
|
|
|
- request.put("digest", digest_MD5_Base64(datastr, secretKey));
|
|
|
- HashMap<String, String> map = new HashMap<>();
|
|
|
- map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(request.toString(), url + "OrderAmountList", map);
|
|
|
- JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
+ JSONObject resultobject=new JSONObject();
|
|
|
+ if(isDocking) {
|
|
|
+ JSONObject request = new JSONObject();
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
|
|
|
+ data.put("companyCode", companyCode);
|
|
|
+ data.put("orderNo", orderNo);
|
|
|
+ String datastr =data.toString().replace("\"", "'");
|
|
|
+ request.put("data", data.toString().replace("\"", "'"));
|
|
|
+ request.put("appKey", appKey);
|
|
|
+ request.put("digest", digest_MD5_Base64(datastr, secretKey));
|
|
|
+ HashMap<String, String> map = new HashMap<>();
|
|
|
+ map.put("content-Type", "application/json");
|
|
|
+ String result = new WebRequest().doPost(request.toString(), url + "OrderAmountList", map);
|
|
|
+ resultobject = JSONObject.parseObject(result);
|
|
|
+ }
|
|
|
return resultobject;
|
|
|
}
|
|
|
|
|
|
|
|
|
public JSONObject queryWzwlOrderAmountExtendList(String orderNo) throws YosException, NoSuchAlgorithmException, UnsupportedEncodingException {
|
|
|
- JSONObject request = new JSONObject();
|
|
|
- JSONObject data = new JSONObject();
|
|
|
-
|
|
|
- data.put("companyCode", companyCode);
|
|
|
- data.put("orderNo", orderNo);
|
|
|
- String datastr =data.toString().replace("\"", "'");
|
|
|
- request.put("data", data.toString().replace("\"", "'"));
|
|
|
- request.put("appKey", appKey);
|
|
|
- request.put("digest", digest_MD5_Base64(datastr, secretKey));
|
|
|
- HashMap<String, String> map = new HashMap<>();
|
|
|
- map.put("content-Type", "application/json");
|
|
|
- String result = new WebRequest().doPost(request.toString(), url + "OrderAmountExtendList", map);
|
|
|
- JSONObject resultobject = JSONObject.parseObject(result);
|
|
|
+ JSONObject resultobject=new JSONObject();
|
|
|
+ if(isDocking) {
|
|
|
+ JSONObject request = new JSONObject();
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
|
|
|
+ data.put("companyCode", companyCode);
|
|
|
+ data.put("orderNo", orderNo);
|
|
|
+ String datastr =data.toString().replace("\"", "'");
|
|
|
+ request.put("data", data.toString().replace("\"", "'"));
|
|
|
+ request.put("appKey", appKey);
|
|
|
+ request.put("digest", digest_MD5_Base64(datastr, secretKey));
|
|
|
+ HashMap<String, String> map = new HashMap<>();
|
|
|
+ map.put("content-Type", "application/json");
|
|
|
+ String result = new WebRequest().doPost(request.toString(), url + "OrderAmountExtendList", map);
|
|
|
+ resultobject = JSONObject.parseObject(result);
|
|
|
+ }
|
|
|
return resultobject;
|
|
|
}
|
|
|
|