|
@@ -22,6 +22,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
import org.apache.http.impl.client.HttpClients;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.apache.http.util.EntityUtils;
|
|
|
+
|
|
|
import java.io.*;
|
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
@@ -140,8 +141,8 @@ public class EntityAnalyse {
|
|
|
JSONObject params = new JSONObject();
|
|
|
List<HyDriverInfo> hyDriverInfos = hyDriverInfo.getHyDriverInfoList();
|
|
|
//批量上报
|
|
|
- if (CollectionUtils.isNotEmpty(hyDriverInfos)){
|
|
|
- for (HyDriverInfo hyDriverInfo1 : hyDriverInfos){
|
|
|
+ if (CollectionUtils.isNotEmpty(hyDriverInfos)) {
|
|
|
+ for (HyDriverInfo hyDriverInfo1 : hyDriverInfos) {
|
|
|
params.put("driverName", hyDriverInfo1.getDriverName());
|
|
|
params.put("drivingLicense", hyDriverInfo1.getNumberCard());
|
|
|
params.put("vehicleClass", hyDriverInfo1.getQuasiDrivingVehicle());
|
|
@@ -241,7 +242,7 @@ public class EntityAnalyse {
|
|
|
}
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
if ("非挂车".equals(hyDriverCarInfo.getCarCategory())) {
|
|
|
- String approvedWeight =df.format(hyDriverCarInfo.getCarApprovedWeight());
|
|
|
+ String approvedWeight = df.format(hyDriverCarInfo.getCarApprovedWeight());
|
|
|
Double doubleValue = Double.parseDouble(approvedWeight) / 10;
|
|
|
int intValue = doubleValue.intValue();
|
|
|
params.put("vehicleTonnage", intValue);
|
|
@@ -320,17 +321,17 @@ public class EntityAnalyse {
|
|
|
vehicleInfoQuery.put("vehiclePlateColorCode", 1);
|
|
|
}
|
|
|
vehicleInfoQuery.put("vehicleNumber", orderInfo.getCarNumber());
|
|
|
- params.put("vehicleInfoQuery",vehicleInfoQuery);
|
|
|
+ params.put("vehicleInfoQuery", vehicleInfoQuery);
|
|
|
//司机信息
|
|
|
JSONObject drivers = new JSONObject();
|
|
|
drivers.put("driverName", orderInfo.getDriverName());
|
|
|
drivers.put("drivingLicense", orderInfo.getDriverIdCard());
|
|
|
- params.put("drivers",drivers);
|
|
|
+ params.put("drivers", drivers);
|
|
|
//货物信息
|
|
|
JSONObject goodsInfos = new JSONObject();
|
|
|
goodsInfos.put("descriptionOfGoods", orderInfo.getGoodsType());
|
|
|
goodsInfos.put("cargoTypeClassificationCode", orderInfo.getGoodsTypeKey());
|
|
|
- params.put("goodsInfos",goodsInfos);
|
|
|
+ params.put("goodsInfos", goodsInfos);
|
|
|
|
|
|
httpPost.setEntity(new StringEntity("[" + params.toString() + "]", StandardCharsets.UTF_8));
|
|
|
// 设置header信息
|
|
@@ -383,26 +384,26 @@ public class EntityAnalyse {
|
|
|
JSONArray shippingNoteList = new JSONArray();
|
|
|
JSONObject shippingNote = new JSONObject();
|
|
|
shippingNote.put("shippingNoteNumber", hyFreightSettlementInfo.getOrderNo());
|
|
|
- shippingNote.put("serialNumber","0000");
|
|
|
+ shippingNote.put("serialNumber", "0000");
|
|
|
shippingNote.put("totalMonetaryAmount", hyFreightSettlementInfo.getAmountMoney() * 1000);
|
|
|
shippingNote.put("fuelAmount", 0);
|
|
|
shippingNoteList.add(shippingNote);
|
|
|
- params.put("shippingNoteList",shippingNoteList);
|
|
|
+ params.put("shippingNoteList", shippingNoteList);
|
|
|
//财务列表
|
|
|
JSONArray financialList = new JSONArray();
|
|
|
JSONObject financial = new JSONObject();
|
|
|
financial.put("shippingNoteNumber", hyFreightSettlementInfo.getOrderNo());
|
|
|
- financial.put("serialNumber","0000");
|
|
|
+ financial.put("serialNumber", "0000");
|
|
|
financial.put("driverName", hyFreightSettlementInfo.getDriverName());
|
|
|
financial.put("driverLicense", hyFreightSettlementInfo.getDriverIdCard());
|
|
|
financial.put("paymentMeansCode", "32");
|
|
|
financial.put("recipient", hyFreightSettlementInfo.getDriverName());
|
|
|
if ("男".equals(hyFreightSettlementInfo.getDriverSex())) {
|
|
|
- financial.put("sex",1);
|
|
|
+ financial.put("sex", 1);
|
|
|
} else {
|
|
|
- financial.put("sex",2);
|
|
|
+ financial.put("sex", 2);
|
|
|
}
|
|
|
- financial.put("sex",1);
|
|
|
+ financial.put("sex", 1);
|
|
|
String s = hyFreightSettlementInfo.getDriverBirthday().substring(0, hyFreightSettlementInfo.getDriverBirthday().length() - 1);
|
|
|
String s1 = s.replace("年", "-");
|
|
|
String s2 = s1.replace("月", "-");
|
|
@@ -410,19 +411,19 @@ public class EntityAnalyse {
|
|
|
financial.put("birthday", df.format(date));
|
|
|
financial.put("idcardNumber", hyFreightSettlementInfo.getDriverIdCard());
|
|
|
financial.put("phone", hyFreightSettlementInfo.getDriverPhone());
|
|
|
- financial.put("address",hyFreightSettlementInfo.getDriverAddress());
|
|
|
+ financial.put("address", hyFreightSettlementInfo.getDriverAddress());
|
|
|
financial.put("receiptAccount", hyFreightSettlementInfo.getBankCard());
|
|
|
financial.put("bankCode", hyFreightSettlementInfo.getBankKey());
|
|
|
financial.put("networkName", hyFreightSettlementInfo.getBankDepositBranch());
|
|
|
financial.put("sequenceCode", hyFreightSettlementInfo.getSerialNumber());
|
|
|
DecimalFormat df1 = new DecimalFormat("0.000");
|
|
|
// String str = String.valueOf(Double.valueOf(df1.format(hyFreightSettlementInfo.getAmountMoney())) * 1000);
|
|
|
- int intValue1 = (int)(Double.valueOf(df1.format(hyFreightSettlementInfo.getAmountMoney())) * 1000);
|
|
|
+ int intValue1 = (int) (Double.valueOf(df1.format(hyFreightSettlementInfo.getAmountMoney())) * 1000);
|
|
|
financial.put("monetaryAmount", intValue1);
|
|
|
financial.put("dateTime", f.format(hyFreightSettlementInfo.getPaymentDate()));
|
|
|
financial.put("payFile", EntityAnalyse.uploadImage(EntityAnalyse.urlToFile(new URL(hyFreightSettlementInfo.getPaymentVoucher())), hyFreightSettlementInfo.getToken()));
|
|
|
financialList.add(financial);
|
|
|
- params.put("financialList",financialList);
|
|
|
+ params.put("financialList", financialList);
|
|
|
|
|
|
httpPost.setEntity(new StringEntity("[" + params.toString() + "]", StandardCharsets.UTF_8));
|
|
|
// 设置header信息
|
|
@@ -919,7 +920,7 @@ public class EntityAnalyse {
|
|
|
String t2 = t.substring(4, 6);
|
|
|
String t3 = t.substring(6, 8);
|
|
|
distinguishView.setLicenseIssueDate(t1 + "-" + t2 + "-" + t3);
|
|
|
- distinguishView.setLssuingAuthority(jsonObject.getString("issue_organization"));
|
|
|
+ distinguishView.setLssuingAuthority(jsonObject.getString("issue_authority"));
|
|
|
distinguishView.setVehicleType(jsonObject.getString("vehicle_type"));
|
|
|
distinguishView.setCarCode(jsonObject.getString("vin"));
|
|
|
} else {
|
|
@@ -1000,24 +1001,22 @@ public class EntityAnalyse {
|
|
|
* @throws ServiceException
|
|
|
*/
|
|
|
public static DistinguishView qualificationLicenseShibie(String image) throws ServiceException {
|
|
|
-
|
|
|
- String host = "https://dlyzcy.market.alicloudapi.com";
|
|
|
- String path = "/ai_ocr/dao_lu_lv_ben_lb/v1";
|
|
|
+ String host1 = "https://dlyzcy.market.alicloudapi.com";
|
|
|
+ String path1 = "/ai_ocr/dao_lu_xin_ban_new/v1";
|
|
|
String method = "POST";
|
|
|
String appcode = "2d59bfa794994f5f94d1d98b7b5bd102";
|
|
|
- Map<String, String> headers = new HashMap<String, String>();
|
|
|
+ Map<String, String> headers1 = new HashMap<String, String>();
|
|
|
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
|
|
- headers.put("Authorization", "APPCODE " + appcode);
|
|
|
+ headers1.put("Authorization", "APPCODE " + appcode);
|
|
|
//根据API的要求,定义相对应的Content-Type
|
|
|
- headers.put("Content-Type", "application/json; charset=UTF-8");
|
|
|
-
|
|
|
- Map<String, String> querys = new HashMap<String, String>();
|
|
|
- Map<String, String> bodys = new HashMap<String, String>();
|
|
|
- bodys.put("IMAGE", image);
|
|
|
- bodys.put("IMAGE_TYPE", "1");
|
|
|
+ headers1.put("Content-Type", "application/json; charset=UTF-8");
|
|
|
+ Map<String, String> querys1 = new HashMap<String, String>();
|
|
|
+ Map<String, String> bodys1 = new HashMap<String, String>();
|
|
|
+ bodys1.put("IMAGE", image);
|
|
|
+ bodys1.put("IMAGE_TYPE", "1");
|
|
|
|
|
|
//阿里云APPCODE
|
|
|
- DistinguishView distinguishView = new DistinguishView();
|
|
|
+ DistinguishView distinguishView1 = new DistinguishView();
|
|
|
try {
|
|
|
/**
|
|
|
* 重要提示如下:
|
|
@@ -1028,30 +1027,34 @@ public class EntityAnalyse {
|
|
|
* 相应的依赖请参照
|
|
|
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
|
|
|
*/
|
|
|
- HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
|
|
+ HttpResponse response = HttpUtils.doPost(host1, path1, method, headers1, querys1, bodys1);
|
|
|
String body = EntityUtils.toString(response.getEntity());
|
|
|
System.out.println(body);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(body);
|
|
|
- distinguishView.setQualificationCertificate(jsonObject.getJSONObject("智能道路运政从业人员资格证绿本版印刷文字识别实体信息").getString("有效期限"));
|
|
|
- distinguishView.setQualificationCertificateNum(jsonObject.getJSONObject("智能道路运政从业人员资格证绿本版印刷文字识别实体信息").getString("证号"));
|
|
|
+ distinguishView1.setQualificationCertificate(jsonObject.getJSONObject("智能道路运政从业人员资格证新版印刷文字识别实体信息").getString("有效期至"));
|
|
|
+ distinguishView1.setQualificationCertificateNum(jsonObject.getJSONObject("智能道路运政从业人员资格证新版印刷文字识别实体信息").getString("从业资格证号"));
|
|
|
+ return distinguishView1;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- if (distinguishView.getQualificationCertificate() == null || distinguishView.getQualificationCertificate().isEmpty()) {
|
|
|
- String host1 = "https://dlyzcy.market.alicloudapi.com";
|
|
|
- String path1 = "/ai_ocr/dao_lu_xin_ban_new/v1";
|
|
|
- Map<String, String> headers1 = new HashMap<String, String>();
|
|
|
+
|
|
|
+ if (distinguishView1.getQualificationCertificateNum() == null || distinguishView1.getQualificationCertificateNum().isEmpty()) {
|
|
|
+ String host = "https://dlyzcy.market.alicloudapi.com";
|
|
|
+ String path = "/ai_ocr/dao_lu_lv_ben_lb/v1";
|
|
|
+
|
|
|
+ Map<String, String> headers = new HashMap<String, String>();
|
|
|
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
|
|
- headers1.put("Authorization", "APPCODE " + appcode);
|
|
|
+ headers.put("Authorization", "APPCODE " + appcode);
|
|
|
//根据API的要求,定义相对应的Content-Type
|
|
|
- headers1.put("Content-Type", "application/json; charset=UTF-8");
|
|
|
- Map<String, String> querys1 = new HashMap<String, String>();
|
|
|
- Map<String, String> bodys1 = new HashMap<String, String>();
|
|
|
- bodys1.put("IMAGE", image);
|
|
|
- bodys1.put("IMAGE_TYPE", "1");
|
|
|
+ headers.put("Content-Type", "application/json; charset=UTF-8");
|
|
|
+
|
|
|
+ Map<String, String> querys = new HashMap<String, String>();
|
|
|
+ Map<String, String> bodys = new HashMap<String, String>();
|
|
|
+ bodys.put("IMAGE", image);
|
|
|
+ bodys.put("IMAGE_TYPE", "1");
|
|
|
|
|
|
//阿里云APPCODE
|
|
|
- DistinguishView distinguishView1 = new DistinguishView();
|
|
|
+ DistinguishView distinguishView = new DistinguishView();
|
|
|
try {
|
|
|
/**
|
|
|
* 重要提示如下:
|
|
@@ -1062,18 +1065,18 @@ public class EntityAnalyse {
|
|
|
* 相应的依赖请参照
|
|
|
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
|
|
|
*/
|
|
|
- HttpResponse response = HttpUtils.doPost(host1, path1, method, headers1, querys1, bodys1);
|
|
|
+ HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
|
|
String body = EntityUtils.toString(response.getEntity());
|
|
|
System.out.println(body);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(body);
|
|
|
- distinguishView1.setQualificationCertificate(jsonObject.getJSONObject("智能道路运政从业人员资格证新版印刷文字识别实体信息").getString("有效期至"));
|
|
|
- distinguishView1.setQualificationCertificateNum(jsonObject.getJSONObject("智能道路运政从业人员资格证新版印刷文字识别实体信息").getString("从业资格证号"));
|
|
|
- return distinguishView1;
|
|
|
+ distinguishView.setQualificationCertificate(jsonObject.getJSONObject("智能道路运政从业人员资格证绿本版印刷文字识别实体信息").getString("有效期限"));
|
|
|
+ distinguishView.setQualificationCertificateNum(jsonObject.getJSONObject("智能道路运政从业人员资格证绿本版印刷文字识别实体信息").getString("证号"));
|
|
|
+ return distinguishView;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
} else {
|
|
|
- return distinguishView;
|
|
|
+ return distinguishView1;
|
|
|
}
|
|
|
return null;
|
|
|
}
|