|
@@ -367,85 +367,85 @@ public class EntityAnalyse {
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
public static String uploadFlowSheet(HyFreightSettlementInfo hyFreightSettlementInfo) throws IOException, ParseException {
|
|
public static String uploadFlowSheet(HyFreightSettlementInfo hyFreightSettlementInfo) throws IOException, ParseException {
|
|
-// String url = "http://116.182.4.67:50065/platform/api/v1/money";
|
|
|
|
-// SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
|
|
|
|
-// SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
|
|
|
|
-// CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
|
-// // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
|
|
|
|
-// HttpPost httpPost = new HttpPost(url);
|
|
|
|
-// JSONObject params = new JSONObject();
|
|
|
|
-// params.put("documentNumber", );
|
|
|
|
-// params.put("sendToProDateTime", f.format(new Date()));
|
|
|
|
-// params.put("carrier", hyFreightSettlementInfo.getDriverName());
|
|
|
|
-// params.put("actualCarrierId", hyFreightSettlementInfo.getDriverIdCard());
|
|
|
|
-// params.put("vehicleNumber", hyFreightSettlementInfo.getCarNumber());
|
|
|
|
-// if ("黄色".equals(hyFreightSettlementInfo.getCarNumberColour())) {
|
|
|
|
-// params.put("vehiclePlateColorCode", 2);
|
|
|
|
-// } else if ("蓝色".equals(hyFreightSettlementInfo.getCarNumberColour())) {
|
|
|
|
-// params.put("vehiclePlateColorCode", 1);
|
|
|
|
-// }
|
|
|
|
-// //运单列表
|
|
|
|
-// JSONArray shippingNoteList = new JSONArray();
|
|
|
|
-// JSONObject shippingNote = new JSONObject();
|
|
|
|
-// shippingNote.put("shippingNoteNumber", hyFreightSettlementInfo.getOrderNo());
|
|
|
|
-// shippingNote.put("serialNumber","0000");
|
|
|
|
-// shippingNote.put("totalMonetaryAmount", );
|
|
|
|
-// shippingNote.put("fuelAmount", );
|
|
|
|
-// shippingNoteList.add(shippingNote);
|
|
|
|
-// params.put("shippingNoteList",shippingNoteList);
|
|
|
|
-// //财务列表
|
|
|
|
-// JSONArray financialList = new JSONArray();
|
|
|
|
-// JSONObject financial = new JSONObject();
|
|
|
|
-// financial.put("shippingNoteNumber", );
|
|
|
|
-// financial.put("serialNumber","0000");
|
|
|
|
-// financial.put("driverName", hyFreightSettlementInfo.getDriverName());
|
|
|
|
-// financial.put("driverLicense", hyFreightSettlementInfo.getDriverIdCard());
|
|
|
|
-// financial.put("paymentMeansCode", "32");
|
|
|
|
-// if ("男".equals(hyFreightSettlementInfo.getDriverSex())) {
|
|
|
|
-// financial.put("sex",1);
|
|
|
|
-// } else {
|
|
|
|
-// financial.put("sex",2);
|
|
|
|
-// }
|
|
|
|
-// financial.put("sex",1);
|
|
|
|
-// String s = hyFreightSettlementInfo.getDriverBirthday().substring(0, hyFreightSettlementInfo.getDriverBirthday().length() - 1);
|
|
|
|
-// String s1 = s.replace("年", "-");
|
|
|
|
-// String s2 = s1.replace("月", "-");
|
|
|
|
-// Date date = df.parse(s2);
|
|
|
|
-// financial.put("birthday", df.format(date));
|
|
|
|
-// financial.put("idcardNumber", hyFreightSettlementInfo.getDriverIdCard());
|
|
|
|
-// financial.put("phone", hyFreightSettlementInfo.getDriverPhone());
|
|
|
|
-// financial.put("address",hyFreightSettlementInfo.getDriverAddress());
|
|
|
|
-// financial.put("receiptAccount", hyFreightSettlementInfo.getDriverName());
|
|
|
|
-// financial.put("bankCode", hyFreightSettlementInfo.getBankKey());
|
|
|
|
-// financial.put("networkName", hyFreightSettlementInfo.getBankDepositBranch());
|
|
|
|
-// financial.put("sequenceCode", hyFreightSettlementInfo.getSerialNumber());
|
|
|
|
-// Double doubleValue1 = Double.parseDouble(new DecimalFormat("0.000").format(hyFreightSettlementInfo.getAmountMoney())) * 1000;
|
|
|
|
-// int intValue1 = doubleValue1.intValue();
|
|
|
|
-// financial.put("monetaryAmount", intValue1);
|
|
|
|
-// financial.put("dateTime", f.format(hyFreightSettlementInfo.getArrivalDate()));
|
|
|
|
-// financial.put("payFile", EntityAnalyse.uploadImage(EntityAnalyse.urlToFile(new URL(hyFreightSettlementInfo.getPaymentVoucher())), hyFreightSettlementInfo.getToken()));
|
|
|
|
-// financialList.add(financial);
|
|
|
|
-// params.put("financialList",financialList);
|
|
|
|
-//
|
|
|
|
-// httpPost.setEntity(new StringEntity("[" + params.toString() + "]", StandardCharsets.UTF_8));
|
|
|
|
-// // 设置header信息
|
|
|
|
-// httpPost.setHeader("Content-type", "application/json");
|
|
|
|
-// httpPost.setHeader("token", hyFreightSettlementInfo.getToken());
|
|
|
|
-// CloseableHttpResponse response = httpClient.execute(httpPost);
|
|
|
|
-// try {
|
|
|
|
-// // 执行请求操作,并拿到结果(同步阻塞)
|
|
|
|
-// String body = EntityUtils.toString(response.getEntity());
|
|
|
|
-// JSONObject jsonObject = JSONObject.parseObject(body);
|
|
|
|
-// String result = jsonObject.getString("result");
|
|
|
|
-// System.out.println("result = " + result);
|
|
|
|
-// return result;
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
-// e.printStackTrace();
|
|
|
|
-// } finally {
|
|
|
|
-// // 释放链接
|
|
|
|
-// response.close();
|
|
|
|
-// httpClient.close();
|
|
|
|
-// }
|
|
|
|
|
|
+ String url = "http://116.182.4.67:50065/platform/api/v1/money";
|
|
|
|
+ SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
|
|
|
|
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
|
|
|
|
+ CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
|
+ // 模拟登陆,按实际服务器端要求选用 Post 或 Get 请求方式
|
|
|
|
+ HttpPost httpPost = new HttpPost(url);
|
|
|
|
+ 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("vehicleNumber", hyFreightSettlementInfo.getCarNumber());
|
|
|
|
+ if ("黄色".equals(hyFreightSettlementInfo.getCarNumberColour())) {
|
|
|
|
+ params.put("vehiclePlateColorCode", 2);
|
|
|
|
+ } else if ("蓝色".equals(hyFreightSettlementInfo.getCarNumberColour())) {
|
|
|
|
+ params.put("vehiclePlateColorCode", 1);
|
|
|
|
+ }
|
|
|
|
+ //运单列表
|
|
|
|
+ JSONArray shippingNoteList = new JSONArray();
|
|
|
|
+ JSONObject shippingNote = new JSONObject();
|
|
|
|
+ shippingNote.put("shippingNoteNumber", hyFreightSettlementInfo.getOrderNo());
|
|
|
|
+ shippingNote.put("serialNumber","0000");
|
|
|
|
+ shippingNote.put("totalMonetaryAmount", hyFreightSettlementInfo.getAmountMoney() * 1000);
|
|
|
|
+ shippingNote.put("fuelAmount", 0);
|
|
|
|
+ shippingNoteList.add(shippingNote);
|
|
|
|
+ params.put("shippingNoteList",shippingNoteList);
|
|
|
|
+ //财务列表
|
|
|
|
+ JSONArray financialList = new JSONArray();
|
|
|
|
+ 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("paymentMeansCode", "32");
|
|
|
|
+ if ("男".equals(hyFreightSettlementInfo.getDriverSex())) {
|
|
|
|
+ financial.put("sex",1);
|
|
|
|
+ } else {
|
|
|
|
+ financial.put("sex",2);
|
|
|
|
+ }
|
|
|
|
+ financial.put("sex",1);
|
|
|
|
+ String s = hyFreightSettlementInfo.getDriverBirthday().substring(0, hyFreightSettlementInfo.getDriverBirthday().length() - 1);
|
|
|
|
+ String s1 = s.replace("年", "-");
|
|
|
|
+ String s2 = s1.replace("月", "-");
|
|
|
|
+ Date date = df.parse(s2);
|
|
|
|
+ financial.put("birthday", df.format(date));
|
|
|
|
+ financial.put("idcardNumber", hyFreightSettlementInfo.getDriverIdCard());
|
|
|
|
+ financial.put("phone", hyFreightSettlementInfo.getDriverPhone());
|
|
|
|
+ financial.put("address",hyFreightSettlementInfo.getDriverAddress());
|
|
|
|
+ financial.put("receiptAccount", hyFreightSettlementInfo.getDriverName());
|
|
|
|
+ financial.put("bankCode", hyFreightSettlementInfo.getBankKey());
|
|
|
|
+ financial.put("networkName", hyFreightSettlementInfo.getBankDepositBranch());
|
|
|
|
+ financial.put("sequenceCode", hyFreightSettlementInfo.getSerialNumber());
|
|
|
|
+ Double doubleValue1 = Double.parseDouble(new DecimalFormat("0.000").format(hyFreightSettlementInfo.getAmountMoney())) * 1000;
|
|
|
|
+ int intValue1 = doubleValue1.intValue();
|
|
|
|
+ financial.put("monetaryAmount", intValue1);
|
|
|
|
+ financial.put("dateTime", f.format(hyFreightSettlementInfo.getArrivalDate()));
|
|
|
|
+ financial.put("payFile", EntityAnalyse.uploadImage(EntityAnalyse.urlToFile(new URL(hyFreightSettlementInfo.getPaymentVoucher())), hyFreightSettlementInfo.getToken()));
|
|
|
|
+ financialList.add(financial);
|
|
|
|
+ params.put("financialList",financialList);
|
|
|
|
+
|
|
|
|
+ httpPost.setEntity(new StringEntity("[" + params.toString() + "]", StandardCharsets.UTF_8));
|
|
|
|
+ // 设置header信息
|
|
|
|
+ httpPost.setHeader("Content-type", "application/json");
|
|
|
|
+ httpPost.setHeader("token", hyFreightSettlementInfo.getToken());
|
|
|
|
+ CloseableHttpResponse response = httpClient.execute(httpPost);
|
|
|
|
+ try {
|
|
|
|
+ // 执行请求操作,并拿到结果(同步阻塞)
|
|
|
|
+ String body = EntityUtils.toString(response.getEntity());
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(body);
|
|
|
|
+ String result = jsonObject.getString("result");
|
|
|
|
+ System.out.println("result = " + result);
|
|
|
|
+ return result;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ // 释放链接
|
|
|
|
+ response.close();
|
|
|
|
+ httpClient.close();
|
|
|
|
+ }
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
|
|
|