|
@@ -0,0 +1,627 @@
|
|
|
+package com.yh.saas.plugin.yiliangyiyun.util;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.view.*;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.service.Waybill;
|
|
|
+//import com.wlhy.constants.FormatChecks;
|
|
|
+//import com.wlhy.demo.message.dispatch.*;
|
|
|
+//import com.wlhy.demo.message.financial.Financial;
|
|
|
+//import com.wlhy.demo.message.financial.FinancialRoot;
|
|
|
+//import com.wlhy.demo.message.financial.ShippingNote;
|
|
|
+//import Vehicle;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+public class TestJson {
|
|
|
+ /**
|
|
|
+ * 用户列表
|
|
|
+ */
|
|
|
+ // 账号,密码,社会信用代码
|
|
|
+ public static String[][] usersArr = {
|
|
|
+ {"23106960", "qweasd!@#123", "91210804MA10FPAM2G"}
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 测试
|
|
|
+ */
|
|
|
+ public static final String debugStr = Constants.DEBUG_SYSTEM_CODE;
|
|
|
+ public static final String sendUrl = "http://wlhy.org.cn/wlhy-exchange-adjust/adjustMessage/send";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 正式
|
|
|
+ */
|
|
|
+// public static final String debugStr = "";
|
|
|
+// public static final String sendUrl = "http://wlhy.org.cn/wlhy-exchange-kafka/message/send";
|
|
|
+
|
|
|
+ public static void sendTest() {
|
|
|
+ System.out.println("start");
|
|
|
+ for (int i = 0; i < 1; i++) {
|
|
|
+ System.out.println(i);
|
|
|
+ try {
|
|
|
+ List<Root> roots = new ArrayList<>();
|
|
|
+ roots.add(getFinancialRoot());
|
|
|
+ roots.add(testDispatch());
|
|
|
+ roots.add(testDriverRoot(null));
|
|
|
+ roots.add(testVehicleRoot(null));
|
|
|
+ for (Root root : roots) {
|
|
|
+ System.out.println("================================消息分割线================================");
|
|
|
+ String messageJson = JSON.toJSONString(root);
|
|
|
+ System.out.println("发送报文的内容:" + messageJson);
|
|
|
+ String result = PostUtils.post(sendUrl, messageJson);
|
|
|
+ System.out.println("服务器返回消息:" + result);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+// ExecutorService threads = Executors.newFixedThreadPool(100);
|
|
|
+// threads.execute(new Runnable() {
|
|
|
+// @Override
|
|
|
+// public void run() {
|
|
|
+//
|
|
|
+// }
|
|
|
+// });
|
|
|
+// try{
|
|
|
+// Thread.sleep(Integer.MAX_VALUE);
|
|
|
+// }catch (Exception e){
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Root testDispatch() {
|
|
|
+ Root root = null;
|
|
|
+ try {
|
|
|
+ Root edmRoot = roots.get(r.nextInt(roots.size()));
|
|
|
+ String name = "电子运单";
|
|
|
+ Dispatch dispatch = getDispatch();
|
|
|
+ dispatch.setUnifiedSocialCreditIdentifier(edmRoot.getUscc());
|
|
|
+ root = getRoot(dispatch, name, edmRoot);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return root;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static Root getFinancialRoot() throws Exception {
|
|
|
+ String name = "资金流水单";
|
|
|
+ FinancialRoot financialRoot = new FinancialRoot();
|
|
|
+ financialRoot.setActualCarrierID("SHTYXY" + new Random().nextInt(1200000000));
|
|
|
+ financialRoot.setCarrier(names[new Random().nextInt(names.length)]);
|
|
|
+ financialRoot.setVehiclePlateColorCode(FormatChecks.licensePlateTypeCodeList.get(r.nextInt(FormatChecks.licensePlateTypeCodeList.size())));
|
|
|
+ financialRoot.setSendToProDateTime("20190505122559");
|
|
|
+ financialRoot.setVehicleNumber("晋A" + (new Random().nextInt(80000) + 10000));
|
|
|
+ financialRoot.setDocumentNumber("ZJLSDH" + new Date().getTime());
|
|
|
+// financialRoot.setDocumentNumber("ZJLSDH123456789");
|
|
|
+
|
|
|
+ List<ShippingNote> shippingNoteList = new ArrayList<>();
|
|
|
+ ShippingNote shippingNote1 = new ShippingNote();
|
|
|
+ shippingNote1.setShippingNoteNumber("TYDH" + new Random().nextInt(1200000000));
|
|
|
+ shippingNote1.setSerialNumber(Constants.R.nextInt(8000) + 1000 + "");
|
|
|
+ shippingNote1.setTotalMonetaryAmount(Constants.R.nextInt(9999) + ".333");
|
|
|
+ ShippingNote shippingNote2 = new ShippingNote();
|
|
|
+ shippingNote2.setShippingNoteNumber("TYDH" + new Random().nextInt(1200000000));
|
|
|
+ shippingNote2.setSerialNumber(Constants.R.nextInt(8000) + 1000 + "");
|
|
|
+ shippingNote2.setTotalMonetaryAmount(Constants.R.nextInt(9999) + ".333");
|
|
|
+ shippingNoteList.add(shippingNote1);
|
|
|
+ shippingNoteList.add(shippingNote2);
|
|
|
+ financialRoot.setShippingNoteList(shippingNoteList);
|
|
|
+
|
|
|
+
|
|
|
+ List<Financial> financiallist = new ArrayList<>();
|
|
|
+ Financial financial1 = new Financial();
|
|
|
+ financial1.setBankCode(FormatChecks.bankCodeList.get(Constants.R.nextInt(FormatChecks.bankCodeList.size())));
|
|
|
+ financial1.setDateTime("20190505111259");
|
|
|
+ financial1.setMonetaryAmount(r.nextInt(100000) + 1000 + "." + (r.nextInt(888) + 100));
|
|
|
+ financial1.setPaymentMeansCode(FormatChecks.paymentMeansCodeList.get(r.nextInt(FormatChecks.paymentMeansCodeList.size())));
|
|
|
+ financial1.setReceiptAccount(new Random().nextInt(1200000000) + "");
|
|
|
+ financial1.setRecipient(names[r.nextInt(names.length)]);
|
|
|
+ financial1.setSequenceCode("lsh" + new Random().nextInt(1200000000));
|
|
|
+ Financial financial2 = new Financial();
|
|
|
+ financial2.setBankCode(FormatChecks.bankCodeList.get(Constants.R.nextInt(FormatChecks.bankCodeList.size())));
|
|
|
+ financial2.setDateTime("20190505111259");
|
|
|
+ financial2.setMonetaryAmount(r.nextInt(100000) + 1000 + "." + (r.nextInt(888) + 100));
|
|
|
+ financial2.setPaymentMeansCode(FormatChecks.paymentMeansCodeList.get(r.nextInt(FormatChecks.paymentMeansCodeList.size())));
|
|
|
+ financial2.setReceiptAccount(new Random().nextInt(1200000000) + "");
|
|
|
+ financial2.setRecipient(names[r.nextInt(names.length)]);
|
|
|
+ financial2.setSequenceCode("lsh" + new Random().nextInt(1200000000));
|
|
|
+ Financial financial3 = new Financial();
|
|
|
+ financial3.setBankCode(FormatChecks.bankCodeList.get(Constants.R.nextInt(FormatChecks.bankCodeList.size())));
|
|
|
+ financial3.setDateTime("20190505111259");
|
|
|
+ financial3.setMonetaryAmount(r.nextInt(100000) + 1000 + "." + (r.nextInt(888) + 100));
|
|
|
+ financial3.setPaymentMeansCode(FormatChecks.paymentMeansCodeList.get(r.nextInt(FormatChecks.paymentMeansCodeList.size())));
|
|
|
+ financial3.setReceiptAccount(new Random().nextInt(1200000000) + "");
|
|
|
+ financial3.setRecipient(names[r.nextInt(names.length)]);
|
|
|
+ financial3.setSequenceCode("lsh" + new Random().nextInt(1200000000));
|
|
|
+ financiallist.add(financial1);
|
|
|
+// financiallist.add(financial2);
|
|
|
+// financiallist.add(financial3);
|
|
|
+ financialRoot.setFinanciallist(financiallist);
|
|
|
+ Root root = getRoot(financialRoot, name);
|
|
|
+ System.out.println("root:===");
|
|
|
+ System.out.println(JSON.toJSONString(root));
|
|
|
+ return root;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// public static Root testPostionRoot() throws Exception{
|
|
|
+// String name= "位置信息单";
|
|
|
+// Postion postion = new Postion();
|
|
|
+// postion.setCountrySubdivisionCode(5+""+(new Random().nextInt(1000) + 1000)+"6");
|
|
|
+// postion.setLatitude(new Random().nextDouble()*100+"");
|
|
|
+// postion.setLocationText("备注"+new Random().nextInt(10000)+"");
|
|
|
+// postion.setLocationType(r.nextInt(2) + "");
|
|
|
+// postion.setLongitude(new Random().nextDouble()*120+"");
|
|
|
+// postion.setSendDateTime("20190909130158");
|
|
|
+// postion.setSendToProDateTime("20190909130158");
|
|
|
+// postion.setShippingNoteNumber("265595"+new Random().nextInt(10000)+"");
|
|
|
+// Root root = getRoot(postion,name);
|
|
|
+// String messageJson = JSON.toJSONString(root);
|
|
|
+// System.out.println(messageJson);
|
|
|
+// return root;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ public static Root testDriverRoot(Root root1) throws Exception {
|
|
|
+ return testDriverRoot(root1, null);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static Root testDriverRoot(Root root1, Driver driver1) throws Exception {
|
|
|
+ String name = "驾驶员信息单";
|
|
|
+ Driver driver = null;
|
|
|
+ if (driver1 == null) {
|
|
|
+ driver = testDriver();
|
|
|
+ } else {
|
|
|
+ driver = driver1;
|
|
|
+ }
|
|
|
+ Root root = getRoot(driver, name, root1);
|
|
|
+ String messageJson = JSON.toJSONString(root);
|
|
|
+ System.out.println(messageJson);
|
|
|
+ return root;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static Driver testDriver() throws Exception {
|
|
|
+ String name = "驾驶员信息单";
|
|
|
+ Driver driver = new Driver();
|
|
|
+// driver.setVehicleClass(classTypes.get(r.nextInt(classTypes.size())));
|
|
|
+// driver.setDrivingLicense(new Random().nextInt(800000000) + "");
|
|
|
+//// driver.setDriveingLicense("123456");
|
|
|
+// driver.setQualificationCertificate(new Random().nextInt(11111111) + new Random().nextInt(1111111111) + "");
|
|
|
+// driver.setDriverName(names[new Random().nextInt(names.length)]);
|
|
|
+// driver.setTelephone("18" + (new Random().nextInt(800000000) + 100000000));
|
|
|
+// List<String> list = new ArrayList<>();
|
|
|
+// list.add(vehicleoffices[r.nextInt(vehicleoffices.length)]);
|
|
|
+// driver.setIssuingOrganizations(list);
|
|
|
+// driver.setRemark("备注");
|
|
|
+// driver.setValidPeriodFrom("20190909");
|
|
|
+// driver.setValidPeriodTo("20200909");
|
|
|
+ return driver;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验未通过{"vehicle.GrossMass":"vehicle.GrossMass 为浮点数,最大长度不得超过 9,浮点位2位,不足补0",
|
|
|
+ * "vehicle.RoadTransportCertificateNumber":"vehicle.RoadTransportCertificateNumber 是存数组,长度等于12,总质量4.5吨及以下普通货运车辆的,可填“车籍地6位行政区域代码+000000”",
|
|
|
+ * "vehicle.TrailerVehiclePlateNumber":"vehicle.TrailerVehiclePlateNumber 不是标准车牌号",
|
|
|
+ * "vehicle.VehicleEnergyType":"vehicle.VehicleEnergyType 不能为空,现值只允许出现[E01, E02, E03, E04, E99]","
|
|
|
+ * vehicle.VehicleTonnage":"vehicle.VehicleTonnage 为浮点数,最大长度不得超过 9,浮点位2位,不足补0"}
|
|
|
+ * <p>
|
|
|
+ * 校验未通过{"vehicle.RoadTransportCertificateNumber":"vehicle.RoadTransportCertificateNumber 是存数组,长度等于12,域代码+000000”"}
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public static Root testVehicleRoot(Root root1) throws Exception {
|
|
|
+ String name = "车辆信息单";
|
|
|
+ Vehicle vehicle = new Vehicle();
|
|
|
+ vehicle.setIssueDate("20170502121514");
|
|
|
+ vehicle.setIssuingOrganizations(vehicleoffices[r.nextInt(vehicleoffices.length)]);
|
|
|
+ vehicle.setVehiclePlateColorCode(FormatChecks.licensePlateTypeCodeList.get(r.nextInt(FormatChecks.licensePlateTypeCodeList.size())));
|
|
|
+ vehicle.setRegisterDate("20190502121514");
|
|
|
+ vehicle.setOwner(names[new Random().nextInt(name.length())]);
|
|
|
+ vehicle.setGrossMass(r.nextInt(100) + 5 + "." + (r.nextInt(88) + 10));
|
|
|
+ vehicle.setRemark("备注");
|
|
|
+ vehicle.setUseCharacter("拉货");
|
|
|
+ vehicle.setVehicleNumber("晋A" + (new Random().nextInt(10000) + 80000));
|
|
|
+// vehicle.setVehicleNumber("晋A123456");
|
|
|
+ vehicle.setVehicleType(vehicleTypes.get(r.nextInt(vehicleTypes.size())));
|
|
|
+ vehicle.setRoadTransportCertificateNumber(r.nextInt(111111111) + 1111111111 + "10");
|
|
|
+ vehicle.setVehicleTonnage(r.nextInt(100) + 5 + "." + (r.nextInt(88) + 10));
|
|
|
+ vehicle.setVehicleEnergyType(FormatChecks.vehicleEnergyTypeList.get(r.nextInt(FormatChecks.vehicleEnergyTypeList.size())));
|
|
|
+ vehicle.setVin(new Random().nextInt(10000) + 80000 + "");
|
|
|
+ Root root = getRoot(vehicle, name, root1);
|
|
|
+ String messageJson = JSON.toJSONString(root);
|
|
|
+ System.out.println(messageJson);
|
|
|
+ return root;
|
|
|
+ }
|
|
|
+
|
|
|
+ Root edmRoot = roots.get(r.nextInt(roots.size()));
|
|
|
+
|
|
|
+
|
|
|
+ public static Root getRoot(Waybill waybill, String name) throws Exception {
|
|
|
+ return getRoot(waybill, name, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Root getRoot(Waybill waybill, String name, Root edmRoot) throws Exception {
|
|
|
+// Map<String, String> rsaKeys = KeyPairGenUtil.genKeyPair();
|
|
|
+ if (edmRoot == null) {
|
|
|
+ edmRoot = roots.get(r.nextInt(roots.size()));
|
|
|
+ }
|
|
|
+ Map<String, String> rsaKeys = new HashMap<String, String>();
|
|
|
+ rsaKeys.put("PUBLIC_KEY", edmRoot.getPublicKey());
|
|
|
+ String aesKey = MyStrUtil.uuid().substring(0, 16);
|
|
|
+ String dispatchJson = JSON.toJSONString(waybill);
|
|
|
+ System.out.println("dispatchJson:" + dispatchJson);
|
|
|
+
|
|
|
+ SM4Utils sm4 = new SM4Utils();
|
|
|
+ sm4.secretKey = aesKey;
|
|
|
+ sm4.hexString = false;
|
|
|
+ System.out.println("ECB模式加密");
|
|
|
+ String encryptedContent = sm4.encryptData_ECB(dispatchJson);
|
|
|
+ String encryptedCode = SM2Utils.encrypt(Util.hexToByte(rsaKeys.get("PUBLIC_KEY")), aesKey.getBytes());
|
|
|
+// String encryptedContent = AESOperator.getInstance().encryptECB(dispatchJson, aesKey);
|
|
|
+// String encryptedCode = RsaEncryptUtil.encryptByPublicKey(aesKey, rsaKeys);
|
|
|
+
|
|
|
+ Root root = new Root();
|
|
|
+ root.setUserName(edmRoot.getUserName());
|
|
|
+ root.setDocumentName(name);
|
|
|
+ root.setDocumentVersionNumber("1.0");
|
|
|
+ root.setSenderCode(edmRoot.getSenderCode());
|
|
|
+ root.setRecipientCode("wlhymot");
|
|
|
+ root.setMessageSendingDateTime("20190909130158");
|
|
|
+ root.setToken(edmRoot.getToken());
|
|
|
+ root.setSenderCode(edmRoot.getSenderCode());
|
|
|
+ root.setEncryptedCode(encryptedCode);
|
|
|
+ root.setEncryptedContent(encryptedContent);
|
|
|
+ root.setMessageReferenceNumber(MyStrUtil.uuid());
|
|
|
+ String ipcType = "";
|
|
|
+ if ("车辆信息单".equals(name)) {
|
|
|
+ ipcType = Constants.IPC_TYPE_CL;
|
|
|
+ }
|
|
|
+ if ("驾驶员信息单".equals(name)) {
|
|
|
+ ipcType = Constants.IPC_TYPE_JSY;
|
|
|
+ }
|
|
|
+ if ("位置信息单".equals(name)) {
|
|
|
+ ipcType = Constants.IPC_TYPE_WZ;
|
|
|
+ }
|
|
|
+ if ("资金流水单".equals(name)) {
|
|
|
+ ipcType = Constants.IPC_TYPE_ZJ;
|
|
|
+ }
|
|
|
+ if ("电子运单".equals(name)) {
|
|
|
+ ipcType = Constants.IPC_TYPE_YD;
|
|
|
+ }
|
|
|
+ root.setIpcType(ipcType);
|
|
|
+ return root;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static Dispatch getDispatch() {
|
|
|
+ Dispatch dispatch = new Dispatch();
|
|
|
+ dispatch.setShippingNoteNumber("TYDH" + (new Random().nextInt(1000000) + 1000000));
|
|
|
+ dispatch.setSerialNumber(Constants.R.nextInt(8000) + 1000 + "");
|
|
|
+// dispatch.setShippingNoteNumber("TYDH1776734");
|
|
|
+// dispatch.setSerialNumber("3823");
|
|
|
+ dispatch.setUnifiedSocialCreditIdentifier("12548485484545454");
|
|
|
+ dispatch.setBusinessTypeCode("1003997");
|
|
|
+ dispatch.setCarrier(carriers.get(r.nextInt(carriers.size())));
|
|
|
+ dispatch.setConsignmentDateTime("20190903131900");
|
|
|
+ dispatch.setDespatchActualDateTime("20190903131900");
|
|
|
+ dispatch.setRemark("自由写的文本内容");
|
|
|
+ dispatch.setGoodsReceiptDateTime("20190903131900");
|
|
|
+ dispatch.setOriginalDocumentNumber("WTDH" + new Random().nextInt(1200000000));
|
|
|
+ dispatch.setPermitNumber("JYXKZH" + new Random().nextInt(1200000000));
|
|
|
+ dispatch.setSendToProDateTime("20190903131900");
|
|
|
+ dispatch.setVehicleAmount(Constants.R.nextInt(9999) + "");
|
|
|
+ dispatch.setTransportTypeCode(FormatChecks.transportTypeCodeList.get(Constants.R.nextInt(FormatChecks.transportTypeCodeList.size())));
|
|
|
+ setConsigneeInfo(dispatch);
|
|
|
+ setConsignorInfo(dispatch);
|
|
|
+ setInsuranceInformation(dispatch);
|
|
|
+ dispatch.setTotalMonetaryAmount(new Random().nextInt(10000) + 100 + ".000");
|
|
|
+ setVehicleInfo(dispatch);
|
|
|
+ ActualCarrierInfo actual = new ActualCarrierInfo();
|
|
|
+ actual.setActualCarrierBusinessLicense(r.nextInt(111111111) + 1111111111 + "" + r.nextInt(111111111));
|
|
|
+ actual.setActualCarrierID(r.nextInt(111111111) + 1111111111 + "" + r.nextInt(111111111));
|
|
|
+
|
|
|
+ actual.setActualCarrierName(names[new Random().nextInt(names.length)]);
|
|
|
+ List<ActualCarrierInfo> actualList = new ArrayList<>();
|
|
|
+ actualList.add(actual);
|
|
|
+ dispatch.setActualCarrierInfo(actualList);
|
|
|
+
|
|
|
+ return dispatch;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setConsigneeInfo(Dispatch dispatch) {
|
|
|
+ List<ConsigneeInfo> consigneeInfos = new ArrayList<>();
|
|
|
+ ConsigneeInfo consigneeInfo = new ConsigneeInfo();
|
|
|
+ consigneeInfo.setConsignee(names[new Random().nextInt(names.length)]);
|
|
|
+ consigneeInfo.setConsigneeID(r.nextInt(111111111) + 1111111111 + "" + r.nextInt(111111111));
|
|
|
+ consigneeInfo.setCountrySubdivisionCode(1 + "" + (new Random().nextInt(1000) + 1000) + "6");
|
|
|
+ consigneeInfo.setCountrySubdivisionCode("610126");
|
|
|
+ consigneeInfo.setGoodsReceiptPlace(addrs[r.nextInt(addrs.length)]);
|
|
|
+ consigneeInfos.add(consigneeInfo);
|
|
|
+ dispatch.setConsigneeInfo(consigneeInfos);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setConsignorInfo(Dispatch dispatch) {
|
|
|
+ List<ConsignorInfo> consignorInfos = new ArrayList<>();
|
|
|
+ ConsignorInfo consignorInfo = new ConsignorInfo();
|
|
|
+ consignorInfo.setConsignor(names[new Random().nextInt(names.length)]);
|
|
|
+ consignorInfo.setConsignorID(r.nextInt(111111111) + 1111111111 + "" + r.nextInt(111111111));
|
|
|
+ consignorInfo.setCountrySubdivisionCode(1 + "" + (new Random().nextInt(1000) + 1000) + "6");
|
|
|
+ consignorInfo.setCountrySubdivisionCode("330204");
|
|
|
+ consignorInfo.setPlaceOfLoading(addrs[r.nextInt(addrs.length)]);
|
|
|
+ consignorInfos.add(consignorInfo);
|
|
|
+ dispatch.setConsignorInfo(consignorInfos);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setInsuranceInformation(Dispatch dispatch) {
|
|
|
+ List<InsuranceInformation> insuranceInformations = new ArrayList<>();
|
|
|
+ InsuranceInformation insuranceInformation = new InsuranceInformation();
|
|
|
+ insuranceInformation.setInsuranceCompanyCode(FormatChecks.insuranceCodeList.get(Constants.R.nextInt(FormatChecks.insuranceCodeList.size())));
|
|
|
+ insuranceInformation.setPolicyNumber("BXDH" + new Random().nextInt(1200000000));
|
|
|
+ insuranceInformations.add(insuranceInformation);
|
|
|
+ dispatch.setInsuranceInformation(insuranceInformations);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void setVehicleInfo(Dispatch dispatch) {
|
|
|
+ List<VehicleInfo> vehicleInfos = new ArrayList<>();
|
|
|
+ VehicleInfo vehicleInfo = new VehicleInfo();
|
|
|
+
|
|
|
+ vehicleInfo.setVehicleNumber("晋A" + (new Random().nextInt(80000) + 10000));
|
|
|
+ vehicleInfo.setVehiclePlateColorCode(FormatChecks.licensePlateTypeCodeList.get(r.nextInt(FormatChecks.licensePlateTypeCodeList.size())));
|
|
|
+ vehicleInfo.setPlaceOfLoading("大四的访问国外而且认为其二为二人");
|
|
|
+ vehicleInfo.setGoodsReceiptDateTime("20190903131900");
|
|
|
+ vehicleInfo.setDespatchActualDateTime("20190903131900");
|
|
|
+ vehicleInfo.setLoadingCountrySubdivisionCode("121212");
|
|
|
+ vehicleInfo.setReceiptCountrySubdivisionCode("131313");
|
|
|
+ vehicleInfo.setGoodsReceiptPlace("打底裙wed4erwew");
|
|
|
+ List<Driver> drivers = new ArrayList<Driver>();
|
|
|
+ Driver driver1 = new Driver();
|
|
|
+ driver1.setDriverName(names[new Random().nextInt(names.length)]);
|
|
|
+ driver1.setDrivingLicense("JSZ" + r.nextInt(1111111111) + "");
|
|
|
+ Driver driver2 = new Driver();
|
|
|
+ driver2.setDriverName(names[new Random().nextInt(names.length)]);
|
|
|
+ driver2.setDrivingLicense("JSZ" + r.nextInt(1111111111) + "");
|
|
|
+ drivers.add(driver1);
|
|
|
+ drivers.add(driver2);
|
|
|
+ vehicleInfo.setDriver(drivers);
|
|
|
+
|
|
|
+ List<GoodsInfo> goodsInfos = new ArrayList<GoodsInfo>();
|
|
|
+ GoodsInfo goodsInfo1 = new GoodsInfo();
|
|
|
+ goodsInfo1.setCargoTypeClassificationCode(FormatChecks.cargoTypeClassificationCodeList.get(r.nextInt(FormatChecks.cargoTypeClassificationCodeList.size())));
|
|
|
+ goodsInfo1.setCube(r.nextInt(1000) + 100 + "." + (r.nextInt(8888) + 1000));
|
|
|
+ goodsInfo1.setDescriptionOfGoods(goodsNames[r.nextInt(goodsNames.length)]);
|
|
|
+ goodsInfo1.setGoodsItemGrossWeight(r.nextInt(100000) + 10000 + "." + (r.nextInt(888) + 100));
|
|
|
+ goodsInfo1.setTotalNumberOfPackages(r.nextInt(10000) + "");
|
|
|
+ GoodsInfo goodsInfo2 = new GoodsInfo();
|
|
|
+ goodsInfo2.setCargoTypeClassificationCode(FormatChecks.cargoTypeClassificationCodeList.get(r.nextInt(FormatChecks.cargoTypeClassificationCodeList.size())));
|
|
|
+ goodsInfo2.setCube(r.nextInt(1000) + 100 + "." + (r.nextInt(8888) + 1000));
|
|
|
+ goodsInfo2.setDescriptionOfGoods(goodsNames[r.nextInt(goodsNames.length)]);
|
|
|
+ goodsInfo2.setGoodsItemGrossWeight(r.nextInt(100000) + 10000 + "." + (r.nextInt(888) + 100));
|
|
|
+ goodsInfo2.setTotalNumberOfPackages(r.nextInt(10000) + "");
|
|
|
+
|
|
|
+ goodsInfos.add(goodsInfo1);
|
|
|
+ goodsInfos.add(goodsInfo2);
|
|
|
+ vehicleInfo.setGoodsInfo(goodsInfos);
|
|
|
+ vehicleInfos.add(vehicleInfo);
|
|
|
+ dispatch.setVehicleInfo(vehicleInfos);
|
|
|
+ }
|
|
|
+
|
|
|
+ static Random r = new Random();
|
|
|
+
|
|
|
+ static String[] names = new String[20];
|
|
|
+
|
|
|
+ static String[] vehicleoffices = new String[10];
|
|
|
+
|
|
|
+ static String[] goodsNames = new String[20];
|
|
|
+
|
|
|
+ static String[] company = new String[10];
|
|
|
+
|
|
|
+ static String[] addrs = new String[20];
|
|
|
+
|
|
|
+ static List<String> carriers = new ArrayList<>();
|
|
|
+
|
|
|
+ static List<String> vehicleTypes = new ArrayList<>();
|
|
|
+
|
|
|
+ static List<String> classTypes = new ArrayList<>();
|
|
|
+
|
|
|
+ static List<Root> roots = new ArrayList<>();
|
|
|
+
|
|
|
+ static List<String[]> users = new ArrayList<>();
|
|
|
+
|
|
|
+ public static Map<String, String> login(String userName, String password, String debug) {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ String getpublicKeyPost = PostUtils.post("https://heilongjiang.wlhy.org.cn/wlhy-user/RsaController/getPubKey", "{}");
|
|
|
+ System.out.println("申请公钥接口:" + getpublicKeyPost);
|
|
|
+ Map<String, Object> resultPublicKeyMap = JSON.parseObject(getpublicKeyPost, Map.class);
|
|
|
+ String publicKey = (String) ((Map) resultPublicKeyMap.get("data")).get("publicKey");
|
|
|
+ System.out.println("获取到的公钥:" + publicKey);
|
|
|
+
|
|
|
+ HashMap<String, String> stringStringHashMap = new HashMap<>();
|
|
|
+ stringStringHashMap.put(Constants.PUBLIC_KEY_NAME, publicKey);
|
|
|
+// String encryptPassword = RsaEncryptUtil.encryptByPublicKey(password, stringStringHashMap);
|
|
|
+ String encryptPassword = SM2Utils.encrypt(Util.hexToByte(publicKey), password.getBytes());
|
|
|
+ System.out.println("加密后的密码:" + encryptPassword);
|
|
|
+
|
|
|
+ Map<String, String> loginParam = new HashMap<>();
|
|
|
+ loginParam.put("account", userName);
|
|
|
+ loginParam.put("passwd", encryptPassword);
|
|
|
+ loginParam.put("publicRsa", publicKey);
|
|
|
+ loginParam.put("systemCode", debug);
|
|
|
+ System.out.println(JSON.toJSONString(loginParam));
|
|
|
+ String loginPost = PostUtils.post("https://heilongjiang.wlhy.org.cn/wlhy-user/user/exgLogin", JSON.toJSONString(loginParam));
|
|
|
+ Map<String, Object> loginResultMap = JSON.parseObject(loginPost, Map.class);
|
|
|
+ System.out.println("登录post接口返回:" + loginResultMap);
|
|
|
+
|
|
|
+ String token = (String) ((Map) loginResultMap.get("data")).get("token");
|
|
|
+ String msgPublicKey = (String) ((Map) loginResultMap.get("data")).get("PUBLIC_KEY");
|
|
|
+ System.out.println("登录成功token:" + token);
|
|
|
+ map.put("token", token);
|
|
|
+ map.put("account", userName);
|
|
|
+ map.put("msgPublicKey", msgPublicKey);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Root loginRoot(String userName, String password, String uscc, String debug) {
|
|
|
+ Map<String, String> token = login(userName, password, debug);
|
|
|
+ Root edmRoot = new Root();
|
|
|
+ edmRoot.setToken(token.get("token"));
|
|
|
+ edmRoot.setUserName(token.get("account"));
|
|
|
+ edmRoot.setSenderCode(token.get("account"));
|
|
|
+ edmRoot.setPublicKey(token.get("msgPublicKey"));
|
|
|
+ edmRoot.setUscc(uscc);
|
|
|
+ return edmRoot;
|
|
|
+ }
|
|
|
+
|
|
|
+ static {
|
|
|
+
|
|
|
+ for (String[] user1 : usersArr) {
|
|
|
+ users.add(user1);
|
|
|
+ }
|
|
|
+ for (int i = 0; i < users.size(); i++) {
|
|
|
+ roots.add(loginRoot(users.get(i)[0], users.get(i)[1], users.get(i)[2], debugStr));
|
|
|
+ }
|
|
|
+
|
|
|
+ classTypes.add("A1");
|
|
|
+ classTypes.add("A2");
|
|
|
+ classTypes.add("B1");
|
|
|
+ classTypes.add("B2");
|
|
|
+ classTypes.add("A3");
|
|
|
+ classTypes.add("C1");
|
|
|
+ classTypes.add("C2");
|
|
|
+ classTypes.add("C3");
|
|
|
+
|
|
|
+ vehicleTypes.add("大型汽车");
|
|
|
+ vehicleTypes.add("小型汽车");
|
|
|
+ vehicleTypes.add("专用汽车");
|
|
|
+ vehicleTypes.add("特种车");
|
|
|
+ vehicleTypes.add("有轨电车");
|
|
|
+ vehicleTypes.add("无轨电车");
|
|
|
+ vehicleTypes.add("电瓶车");
|
|
|
+ vehicleTypes.add("三轮摩托车");
|
|
|
+ vehicleTypes.add("大型方向盘式拖拉机");
|
|
|
+ vehicleTypes.add("全挂车");
|
|
|
+ vehicleTypes.add("半挂车");
|
|
|
+ vehicleTypes.add("轮式自行专用机械");
|
|
|
+
|
|
|
+ carriers.add("好多车联科技有限公司");
|
|
|
+ carriers.add("数据在线国际供应链管理股份有限公司");
|
|
|
+ carriers.add("世德现代物流有限公司");
|
|
|
+ carriers.add("津大田运输服务有限公司");
|
|
|
+ carriers.add("联合运输(天津)有限公司");
|
|
|
+ carriers.add("五矿物流集团天津货运有限公司");
|
|
|
+ carriers.add("滴滴集运(天津)科技股份有限公司");
|
|
|
+ carriers.add("天津港散货物流有限责任公司");
|
|
|
+ carriers.add("天津正易物通网络科技有限公司");
|
|
|
+ carriers.add("天津陆路港公路运输发展有限公司");
|
|
|
+ carriers.add("河北快运集团");
|
|
|
+ carriers.add("河北沃车港智慧科技有限公司");
|
|
|
+ carriers.add("云端物流河北有限公司");
|
|
|
+ carriers.add("中国外运河北有限公司");
|
|
|
+ carriers.add("河北好望角物流发展有限公司");
|
|
|
+ carriers.add("唐山公路港物流有限公司");
|
|
|
+ carriers.add("邯郸市邯钢集团安达物流有限公司");
|
|
|
+ carriers.add("山西经纬通达股份有限公司");
|
|
|
+ carriers.add("山西新晋中交兴路信息科技有限公司");
|
|
|
+ carriers.add("山西聚鑫物云电子科技有限公司");
|
|
|
+ carriers.add("山西云启正通物流有限责任公司");
|
|
|
+ carriers.add("山西卡的网络科技有限公司");
|
|
|
+
|
|
|
+ addrs[0] = "天津市红桥区光荣道与红桥北大街";
|
|
|
+ addrs[1] = "唐山市路南区学院南路";
|
|
|
+ addrs[2] = "河北省遵化市娘娘庄乡";
|
|
|
+ addrs[3] = "天津市蓟州区下营镇船舱";
|
|
|
+ addrs[4] = "张家口市怀来县";
|
|
|
+ addrs[5] = "山西省大同市云州区";
|
|
|
+ addrs[6] = "山西省朔州市朔城区长宁东街";
|
|
|
+ addrs[7] = "忻州市宁武县忻五线";
|
|
|
+ addrs[8] = "山西省吕梁市方山县北武当镇";
|
|
|
+ addrs[9] = "延安市延川县乾坤湾镇";
|
|
|
+ addrs[10] = "陕西延安市宜川县壶口镇";
|
|
|
+ addrs[11] = "山西省朔州市朔城区长宁东街";
|
|
|
+ addrs[12] = "山西省忻州市宁武县";
|
|
|
+ addrs[13] = "山西省晋中市榆次区安宁东街";
|
|
|
+ addrs[14] = "晋中市榆次区";
|
|
|
+ addrs[15] = "晋中市祁县东观镇";
|
|
|
+ addrs[16] = "长治市武乡县";
|
|
|
+ addrs[17] = "西安市鄠邑区草寺东路";
|
|
|
+ addrs[18] = "四川省达州市渠县";
|
|
|
+ addrs[19] = "四川省内江市市中区内荣路";
|
|
|
+
|
|
|
+ company[0] = "百年人寿";
|
|
|
+ company[1] = "工银安盛";
|
|
|
+ company[2] = "建信人寿";
|
|
|
+ company[3] = "前海人寿";
|
|
|
+ company[4] = "友邦保险";
|
|
|
+ company[5] = "中邮人寿";
|
|
|
+ company[6] = "新华人寿";
|
|
|
+ company[7] = "平安人寿";
|
|
|
+ company[8] = "天安人寿";
|
|
|
+ company[9] = "中国人寿";
|
|
|
+
|
|
|
+ goodsNames[0] = "机油";
|
|
|
+ goodsNames[1] = "电脑";
|
|
|
+ goodsNames[2] = "水杯";
|
|
|
+ goodsNames[3] = "电饭锅";
|
|
|
+ goodsNames[4] = "电风扇";
|
|
|
+ goodsNames[5] = "矿泉水";
|
|
|
+ goodsNames[6] = "插座";
|
|
|
+ goodsNames[7] = "铅笔";
|
|
|
+ goodsNames[8] = "笔记本";
|
|
|
+ goodsNames[9] = "鼠标";
|
|
|
+ goodsNames[10] = "啤酒";
|
|
|
+ goodsNames[11] = "充电器";
|
|
|
+ goodsNames[12] = "面粉";
|
|
|
+ goodsNames[13] = "苹果";
|
|
|
+ goodsNames[14] = "跑步机";
|
|
|
+ goodsNames[15] = "自行车";
|
|
|
+ goodsNames[16] = "轮胎";
|
|
|
+ goodsNames[17] = "汽车配件";
|
|
|
+ goodsNames[18] = "大豆油";
|
|
|
+ goodsNames[19] = "硬盘";
|
|
|
+
|
|
|
+ vehicleoffices[0] = "交警支队车辆管理所";
|
|
|
+ vehicleoffices[1] = "古交市交警大队车管所";
|
|
|
+ vehicleoffices[2] = "公安局交警支队小店二大队车管所";
|
|
|
+ vehicleoffices[3] = "城南车管所(世贸汽车城)";
|
|
|
+ vehicleoffices[4] = "中牟县公安局交警大队车管所";
|
|
|
+ vehicleoffices[5] = "车辆管理所";
|
|
|
+ vehicleoffices[6] = "车辆管理局津北分所";
|
|
|
+ vehicleoffices[7] = "公安厅车辆管理";
|
|
|
+ vehicleoffices[8] = "太原市交警支队车辆管理所";
|
|
|
+ vehicleoffices[9] = "公安局交通警察支队车辆管理所二分所";
|
|
|
+
|
|
|
+ names[0] = "余曲波";
|
|
|
+ names[1] = "黄志波";
|
|
|
+ names[2] = "柏渝";
|
|
|
+ names[3] = "何炯";
|
|
|
+ names[4] = "李翔";
|
|
|
+ names[5] = "杨建松";
|
|
|
+ names[6] = "孟盛";
|
|
|
+ names[7] = "彭浩";
|
|
|
+ names[8] = "彭岳军";
|
|
|
+ names[9] = "杨康";
|
|
|
+
|
|
|
+ names[10] = "刘子政";
|
|
|
+ names[11] = "潘宇航";
|
|
|
+ names[12] = "湛晨";
|
|
|
+ names[13] = "廖海东";
|
|
|
+ names[14] = "贺胜斌";
|
|
|
+ names[15] = "张文荣";
|
|
|
+ names[16] = "李雪莲";
|
|
|
+ names[17] = "于宏刚";
|
|
|
+ names[18] = "苏博";
|
|
|
+ names[19] = "高翔";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|