|
@@ -305,14 +305,46 @@ public class EntityAnalyse {
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
public static String uploadWaybill(OrderInfo orderInfo) throws IOException {
|
|
|
+ SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
|
|
|
+ DecimalFormat df = new DecimalFormat("0.000");
|
|
|
+ DecimalFormat df1 = new DecimalFormat("0.0000");
|
|
|
+
|
|
|
String url = "http://116.182.4.67:50065/platform/api/v1/transport";
|
|
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
// 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
|
|
|
HttpPost httpPost = new HttpPost(url);
|
|
|
JSONObject params = new JSONObject();
|
|
|
+ params.put("originalDocumentNumber", orderInfo.getOrderNo());
|
|
|
params.put("shippingNoteNumber", orderInfo.getOrderNo());
|
|
|
params.put("serialNumber", "0000");
|
|
|
+ params.put("vehicleAmount", "1");
|
|
|
+ params.put("transportTypeCode", "1");
|
|
|
+ params.put("sendToProDateTime", f.format(new Date()));
|
|
|
+ params.put("carrier", "黑龙江畅运通物流供应链有限公司");
|
|
|
params.put("unifiedSocialCreditIdentifier", "91230229MABPEWQX94");
|
|
|
+ params.put("permitNumber", "230229200940");
|
|
|
+ params.put("consignmentDateTime", f.format(orderInfo.getCreateDate()));
|
|
|
+ params.put("businessTypeCode", orderInfo.getBusinessTypeCode());
|
|
|
+ params.put("despatchActualDateTime", f.format(orderInfo.getDeliveryTime()));
|
|
|
+ params.put("goodsReceiptDateTime", f.format(orderInfo.getReceivingTime()));
|
|
|
+
|
|
|
+ //托运人信息
|
|
|
+ JSONObject consignorInfoQuery = new JSONObject();
|
|
|
+ consignorInfoQuery.put("consignor", orderInfo.getConsignorName());
|
|
|
+ consignorInfoQuery.put("consignorId", orderInfo.getConsignorID());
|
|
|
+ consignorInfoQuery.put("placeOfLoading", orderInfo.getSendPrivate() + orderInfo.getSendCity() + orderInfo.getSendArea() + orderInfo.getSendDetailedAddress());
|
|
|
+ consignorInfoQuery.put("countrySubdivisionCode", orderInfo.getNationalCode());
|
|
|
+ params.put("consignorInfoQuery", consignorInfoQuery);
|
|
|
+
|
|
|
+ //收货方信息
|
|
|
+ JSONObject consigneeInfoQuery = new JSONObject();
|
|
|
+ consigneeInfoQuery.put("consignee", orderInfo.getShipToName());
|
|
|
+ consigneeInfoQuery.put("consigneeId", orderInfo.getShipToID());
|
|
|
+ consigneeInfoQuery.put("goodsReceiptPlace", orderInfo.getUnloadPrivate() + orderInfo.getUnloadCity() + orderInfo.getUnloadArea() + orderInfo.getUnloadDetailedAddress());
|
|
|
+ consigneeInfoQuery.put("countrySubdivisionCode", orderInfo.getShipToNationalCode());
|
|
|
+ consigneeInfoQuery.put("totalMonetaryAmount", df.format(orderInfo.getActualFreight() * 1000));
|
|
|
+ params.put("consigneeInfoQuery", consigneeInfoQuery);
|
|
|
+
|
|
|
//车辆信息
|
|
|
JSONObject vehicleInfoQuery = new JSONObject();
|
|
|
if ("黄色".equals(orderInfo.getCarNumberColour())) {
|
|
@@ -321,26 +353,65 @@ public class EntityAnalyse {
|
|
|
vehicleInfoQuery.put("vehiclePlateColorCode", 1);
|
|
|
}
|
|
|
vehicleInfoQuery.put("vehicleNumber", orderInfo.getCarNumber());
|
|
|
+ vehicleInfoQuery.put("despatchActualDateTime", f.format(orderInfo.getDeliveryTime()));
|
|
|
+ vehicleInfoQuery.put("goodsReceiptDateTime", f.format(orderInfo.getReceivingTime()));
|
|
|
+ vehicleInfoQuery.put("placeOfLoading", orderInfo.getSendPrivate() + orderInfo.getSendCity() + orderInfo.getSendArea() + orderInfo.getSendDetailedAddress());
|
|
|
+ vehicleInfoQuery.put("loadingCountrySubdivisionCode", orderInfo.getNationalCode());
|
|
|
+ vehicleInfoQuery.put("goodsReceiptPlace", orderInfo.getUnloadPrivate() + orderInfo.getUnloadCity() + orderInfo.getUnloadArea() + orderInfo.getUnloadDetailedAddress());
|
|
|
+ vehicleInfoQuery.put("receiptCountrySubdivisionCode", orderInfo.getShipToNationalCode());
|
|
|
+ vehicleInfoQuery.put("driverLoadDateTime", orderInfo.getLoadingDate());
|
|
|
+ vehicleInfoQuery.put("driverLoadLonlat", orderInfo.getLoadingLonLat());
|
|
|
+ vehicleInfoQuery.put("driverUnloadDateTime", orderInfo.getUnloadingDate());
|
|
|
+ vehicleInfoQuery.put("driverUnloadLonlat", orderInfo.getUnloadingLonLat());
|
|
|
params.put("vehicleInfoQuery", vehicleInfoQuery);
|
|
|
+
|
|
|
//司机信息
|
|
|
JSONObject drivers = new JSONObject();
|
|
|
drivers.put("driverName", orderInfo.getDriverName());
|
|
|
drivers.put("drivingLicense", orderInfo.getDriverIdCard());
|
|
|
params.put("drivers", drivers);
|
|
|
+
|
|
|
//货物信息
|
|
|
JSONObject goodsInfos = new JSONObject();
|
|
|
goodsInfos.put("descriptionOfGoods", orderInfo.getGoodsType());
|
|
|
goodsInfos.put("cargoTypeClassificationCode", orderInfo.getGoodsTypeKey());
|
|
|
+ goodsInfos.put("goodsItemGrossWeight", df.format(orderInfo.getGrossWeight() * 1000000));
|
|
|
+ //todo 体积,件数
|
|
|
+ if (orderInfo.getVolume() != null){
|
|
|
+ goodsInfos.put("cube", df1.format(orderInfo.getVolume() * 10000));
|
|
|
+ }
|
|
|
+ if (orderInfo.getPackageNumber() != null) {
|
|
|
+ goodsInfos.put("totalNumberOfPackages", String.valueOf(orderInfo.getPackageNumber()));
|
|
|
+ }
|
|
|
params.put("goodsInfos", goodsInfos);
|
|
|
|
|
|
+ //实际承运人信息
|
|
|
+ JSONObject actualCarrierInfo = new JSONObject();
|
|
|
+ actualCarrierInfo.put("actualCarrierName", orderInfo.getPayeeName());
|
|
|
+ actualCarrierInfo.put("actualCarrierBusinessLicense", orderInfo.getRoadTransportBusinessLicenseNo());
|
|
|
+ actualCarrierInfo.put("actualCarrierId", orderInfo.getPayeeIdCard());
|
|
|
+ params.put("actualCarrierInfo", actualCarrierInfo);
|
|
|
+
|
|
|
+ //保险信息
|
|
|
+ JSONObject insuranceInformation = new JSONObject();
|
|
|
+ insuranceInformation.put("policyNumber", orderInfo.getPolicyNo() != null ? orderInfo.getPolicyNo() : "none");
|
|
|
+ insuranceInformation.put("insuranceCompanyCode", orderInfo.getInsuranceCompanyCode() != null ? orderInfo.getInsuranceCompanyCode() : "none");
|
|
|
+ params.put("insuranceInformation", insuranceInformation);
|
|
|
+
|
|
|
+ params.put("remark", orderInfo.getRemark() != null ? orderInfo.getRemark() : "");
|
|
|
+ params.put("file", EntityAnalyse.uploadImage(EntityAnalyse.urlToFile(new URL(orderInfo.getDriverContractUrl())), orderInfo.getToken()));
|
|
|
+ params.put("ownersContractFile", EntityAnalyse.uploadImage(EntityAnalyse.urlToFile(new URL(orderInfo.getOwnerContractUrl())), orderInfo.getToken()));
|
|
|
+ params.put("backDocumentImages", EntityAnalyse.uploadImage(EntityAnalyse.urlToFile(new URL(orderInfo.getReceiptImg())), orderInfo.getToken()));
|
|
|
+
|
|
|
+
|
|
|
httpPost.setEntity(new StringEntity("[" + params.toString() + "]", StandardCharsets.UTF_8));
|
|
|
// 设置header信息
|
|
|
httpPost.setHeader("Content-type", "application/json");
|
|
|
httpPost.setHeader("token", orderInfo.getToken());
|
|
|
- CloseableHttpResponse response = httpClient.execute(httpPost);
|
|
|
+// CloseableHttpResponse response = null;
|
|
|
try {
|
|
|
// 执行请求操作,并拿到结果(同步阻塞)
|
|
|
- String body = EntityUtils.toString(response.getEntity());
|
|
|
+ String body = EntityUtils.toString(httpClient.execute(httpPost).getEntity());
|
|
|
JSONObject jsonObject = JSONObject.parseObject(body);
|
|
|
String result = jsonObject.getString("result");
|
|
|
System.out.println("result = " + result);
|
|
@@ -349,7 +420,7 @@ public class EntityAnalyse {
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
|
// 释放链接
|
|
|
- response.close();
|
|
|
+// response.close();
|
|
|
httpClient.close();
|
|
|
}
|
|
|
return "";
|
|
@@ -372,8 +443,8 @@ public class EntityAnalyse {
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("documentNumber", hyFreightSettlementInfo.getDocumentNo());
|
|
|
params.put("sendToProDateTime", f.format(new Date()));
|
|
|
- params.put("carrier", hyFreightSettlementInfo.getDriverName());
|
|
|
- params.put("actualCarrierId", hyFreightSettlementInfo.getDriverIdCard());
|
|
|
+ params.put("carrier", hyFreightSettlementInfo.getPayeeName());
|
|
|
+ params.put("actualCarrierId", hyFreightSettlementInfo.getPayeeIdCard());
|
|
|
params.put("vehicleNumber", hyFreightSettlementInfo.getCarNumber());
|
|
|
if ("黄色".equals(hyFreightSettlementInfo.getCarNumberColour())) {
|
|
|
params.put("vehiclePlateColorCode", 2);
|
|
@@ -394,10 +465,10 @@ public class EntityAnalyse {
|
|
|
JSONObject financial = new JSONObject();
|
|
|
financial.put("shippingNoteNumber", hyFreightSettlementInfo.getOrderNo());
|
|
|
financial.put("serialNumber", "0000");
|
|
|
- financial.put("driverName", hyFreightSettlementInfo.getDriverName());
|
|
|
- financial.put("driverLicense", hyFreightSettlementInfo.getDriverIdCard());
|
|
|
+ financial.put("driverName", hyFreightSettlementInfo.getPayeeName());
|
|
|
+ financial.put("driverLicense", hyFreightSettlementInfo.getPayeeIdCard());
|
|
|
financial.put("paymentMeansCode", "32");
|
|
|
- financial.put("recipient", hyFreightSettlementInfo.getDriverName());
|
|
|
+ financial.put("recipient", hyFreightSettlementInfo.getPayeeName());
|
|
|
if ("男".equals(hyFreightSettlementInfo.getDriverSex())) {
|
|
|
financial.put("sex", 1);
|
|
|
} else {
|
|
@@ -409,7 +480,7 @@ public class EntityAnalyse {
|
|
|
String s2 = s1.replace("月", "-");
|
|
|
Date date = df.parse(s2);
|
|
|
financial.put("birthday", df.format(date));
|
|
|
- financial.put("idcardNumber", hyFreightSettlementInfo.getDriverIdCard());
|
|
|
+ financial.put("idcardNumber", hyFreightSettlementInfo.getPayeeIdCard());
|
|
|
financial.put("phone", hyFreightSettlementInfo.getDriverPhone());
|
|
|
financial.put("address", hyFreightSettlementInfo.getDriverAddress());
|
|
|
financial.put("receiptAccount", hyFreightSettlementInfo.getBankCard());
|
|
@@ -422,6 +493,8 @@ public class EntityAnalyse {
|
|
|
financial.put("monetaryAmount", intValue1);
|
|
|
financial.put("dateTime", f.format(hyFreightSettlementInfo.getPaymentDate()));
|
|
|
financial.put("payFile", EntityAnalyse.uploadImage(EntityAnalyse.urlToFile(new URL(hyFreightSettlementInfo.getPaymentVoucher())), hyFreightSettlementInfo.getToken()));
|
|
|
+ financial.put("recipientIdCardBackImg", EntityAnalyse.uploadImage(EntityAnalyse.urlToFile(new URL(hyFreightSettlementInfo.getPayeeIDCardBack())), hyFreightSettlementInfo.getToken()));
|
|
|
+ financial.put("recipientIdCardFrontImg", EntityAnalyse.uploadImage(EntityAnalyse.urlToFile(new URL(hyFreightSettlementInfo.getPayeeIDCardFront())), hyFreightSettlementInfo.getToken()));
|
|
|
financialList.add(financial);
|
|
|
params.put("financialList", financialList);
|
|
|
|