package com.stylefeng.guns.modular.system.util; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.stylefeng.guns.modular.system.dao.CarInsuranceMapper; import com.stylefeng.guns.modular.system.dao.DriverPunishMapper; import com.stylefeng.guns.modular.system.dao.DriverTrainMapper; import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.*; import java.util.regex.Pattern; /** * 上传安全平台数据 */ @Component public class PushMinistryOfTransportUtil { @Autowired private ITCarService carService; @Autowired private ITDriverService driverService; @Autowired private ITCompanyService companyService; @Autowired private ITSystemPriceService systemPriceService; @Autowired private ITCarModelService carModelService; @Autowired private ITCarBrandService carBrandService; @Autowired private ITCarServiceService carServiceService; @Autowired private ITVersionManagementService versionManagementService; @Autowired private ITOrderPrivateCarService orderPrivateCarService; @Autowired private ITComplaintService complaintService; @Resource private OrderCancelMapper orderCancelMapper; @Autowired private GDMapGeocodingUtil gdMapGeocodingUtil; @Resource private CarInsuranceMapper carInsuranceMapper; @Resource private DriverTrainMapper driverTrainMapper; @Resource private DriverPunishMapper driverPunishMapper; /** * 上传企业基础信息 */ public void baseInfoCompany(Integer id){ TCompany tCompany = companyService.selectById(id); String fileName = System.currentTimeMillis() + ".jpg"; //上传图片文件 Map file = new HashMap<>(); file.put("path", "/tmp"); file.put("fileName", fileName); file.put("url", tCompany.getLegalPhotoUrl()); file.put("newFilePath", "/swapfiles"); String result_ = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_ftp + "/uploadAndMoveFile", file); System.out.println("上传图片文件:" + result_); //上传数据 JSONObject jsonObject = new JSONObject(); jsonObject.put("CompanyName", tCompany.getName());//公司名称 jsonObject.put("Identifier", tCompany.getIdentifier());//统一社会信用代码 jsonObject.put("Address", Integer.valueOf(tCompany.getAddressCode()));//注册地行政区划代码 jsonObject.put("BusinessScope", tCompany.getBusinessScope());//经营范围 jsonObject.put("ContactAddress", tCompany.getContactAddress());//通信地址 jsonObject.put("EconomicType", tCompany.getEconomicType());//经营业户经济类型 jsonObject.put("RegCapital", tCompany.getRegCapital());//注册资本 jsonObject.put("LegalName", tCompany.getLegalName());//法人代表姓名 jsonObject.put("LegalID", tCompany.getLegalId());//法人代表身份证号 jsonObject.put("LegalPhone", tCompany.getLegalPhone());//法人代表电话 jsonObject.put("LegalPhoto", fileName);//法人代表身份证扫描件文件编号(.jpg) jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", 1);//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoCompany", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoCompany", map); System.out.println("上传企业基础信息:" + result); } /** * 上传网约车平台公司营运规模信息 */ public void baseInfoCompanyStat(){ int state = carService.selectCount(new EntityWrapper().eq("state", 1)); int i = driverService.selectCount(new EntityWrapper().eq("authState", 2).ne("flag", 3)); JSONObject jsonObject = new JSONObject(); jsonObject.put("VehicleNum", state); jsonObject.put("DriverNum", i); jsonObject.put("Flag", 1); jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoCompanyStat", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoCompanyStat", map); System.out.println("上传网约车平台公司营运规模信息:" + result); } /** * 上传网约车平台公司支付信息 */ public void baseInfoCompanyPay(){ JSONObject jsonObject = new JSONObject(); jsonObject.put("PayName", "支付宝(中国)网络技术有限公司");//银行或者非银行支付机构名称 jsonObject.put("PayId", "2000133000019");//非银行支付机构支付业务许可证编号 jsonObject.put("PayType", "1");//支付业务类型 jsonObject.put("PayScope", "全国");//业务覆盖范围 jsonObject.put("PrepareBank", "中国工商银行");//备付金存管银行 jsonObject.put("CountDate", 15);//结算周期 jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", 1);//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoCompanyPay", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoCompanyPay", map); System.out.println("上传网约车平台公司支付信息:" + result); } /** * 网约车平台公司服务机构 */ public void baseInfoCompanyService(){ JSONObject jsonObject = new JSONObject(); jsonObject.put("Address", 530100);//行政区划代码 jsonObject.put("ServiceName", "云南翔蝠科技有限公司");//服务机构名称 jsonObject.put("ServiceNo", "5301XFKJ9386");//服务机构代码 jsonObject.put("DetailAddress", "云南省昆明市西山区建德金苑南坝小区10栋3层303室");//服务机构地址 jsonObject.put("ResponsibleName", "车应江");//服务机构负责人姓名 jsonObject.put("ResponsiblePhone", "18908756111");//负责人联系电话 jsonObject.put("ManagerName", "余致扬");//服务机构管理人姓名 jsonObject.put("ManagerPhone", "13908758509");//管理人联系电话 jsonObject.put("ContactPhone", "0871-63563388");//服务机构紧急联系电话 jsonObject.put("MailAddress", "云南省昆明市西山区建德金苑南坝小区10栋3层303室");//行政文书送达邮寄地址 jsonObject.put("CreateDate", "2015年02月17日");//服务机构设立日期 jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", 1);//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoCompanyService", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoCompanyService", map); System.out.println("网约车平台公司服务机构:" + result); } /** * 网约车平台公司经营许可 * @param id */ public void baseInfoCompanyPermit(Integer id){ TCompany tCompany = companyService.selectById(id); JSONObject jsonObject = new JSONObject(); jsonObject.put("Address", tCompany.getAddressCode());//许可地行政区划代码 jsonObject.put("Certificate", tCompany.getLicenseNumber());//网络预约出租车经营许可证号 jsonObject.put("OperationArea", "云南省昆明市");//经营区域 jsonObject.put("OwnerName", tCompany.getName());//公司名称 jsonObject.put("Organization", tCompany.getLicensingAgency());//发证机构名称 jsonObject.put("StartDate", tCompany.getLicenseStartTime());//有效期起YYYYMMDD jsonObject.put("StopDate", tCompany.getLicenseEndTime());//有效期止YYYYMMDD jsonObject.put("CertifyDate", tCompany.getLicenseTime());//初次发证日期YYYYMMDD jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", 1);//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoCompanyPermit", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoCompanyPermit", map); System.out.println("网约车平台公司经营许可:" + result); } /** * 网约车平台公司运价信息 */ public void baseInfoCompanyFare(Integer id){ TSystemPrice tSystemPrice = systemPriceService.selectById(id); String content = tSystemPrice.getContent(); JSONObject price = JSON.parseObject(content); JSONObject jsonObject = new JSONObject(); jsonObject.put("Address", 530100);//运价适用地行政区划代码 jsonObject.put("FareType", id);//运价类型编码(由网约车平台公司统一编码,应确保唯一性) jsonObject.put("FareTypeNote", tSystemPrice.getFareTypeNote());//运价类型说明 jsonObject.put("FareValidOn", new Date());//运价有效期起YYYYMMDDhhmmss Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) +1); jsonObject.put("FareValidOff", calendar.getTime());//运价有效止YYYYMMDDhhmmss jsonObject.put("StartFare", Double.valueOf(price.get("num1").toString()));//起步价(元) jsonObject.put("StartMile", Double.valueOf(price.get("num2").toString()));//起步里程(km) jsonObject.put("UnitPricePerMile", Double.valueOf(price.get("num4").toString()));//计程单价(按公里/元) jsonObject.put("UnitPricePerMinute", Double.valueOf(price.get("num5").toString()));//计时单价(按分钟/元) jsonObject.put("UpPrice", Double.valueOf(price.get("num10").toString()));//单程加价单价(元) jsonObject.put("UpPriceStartMile", Double.valueOf(price.get("num8").toString()));//单程加价公里(km) String[] num23s = price.get("num23").toString().split(" - "); jsonObject.put("MorningPeakTimeOn", num23s[0]);//营运早高峰时间起(HHmm 24小时) jsonObject.put("MorningPeakTimeOff", num23s[1]);//营运早高峰时间止(HHmm 24小时) String[] num24s = price.get("num24").toString().split(" - "); jsonObject.put("EveningPeakTimeOn", num24s[0]);//营运晚高峰时间起(HHmm 24小时) jsonObject.put("EveningPeakTimeOff", num24s[1]);//营运晚高峰时间止(HHmm 24小时) jsonObject.put("OtherPeakTimeOn", "");//其他营运高峰时间起(HHmm 24小时) jsonObject.put("OtherPeakTineOff", "");//其他营运高峰时间止(HHmm 24小时) jsonObject.put("PeakUnitPrice", Double.valueOf(price.get("num28").toString()));//高峰时间单程加价单价(元) jsonObject.put("PeakPriceStartMile", Double.valueOf(price.get("num8").toString()));//高峰时间单程加价公里(km) jsonObject.put("LowSpeedPriceMinute", 0);//低速计时加价(按分钟 元) jsonObject.put("NightPricePerMile", Double.valueOf(price.get("num18").toString()));//夜间费(按公里 元) jsonObject.put("NightPricePerMinute", Double.valueOf(price.get("num19").toString()));//夜间费(按分钟 元) jsonObject.put("OtherPrice", 0);//其它加价金额(元) jsonObject.put("State", tSystemPrice.getState() != 1 ? 1 : 0);//状态(0:有效,1:失效) jsonObject.put("Flag", 1);//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoCompanyFare", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoCompanyFare", map); System.out.println("网约车平台公司运价信息:" + result); } /** * 车辆基本信息 * @param id */ public void baseInfoVehicle(Integer id){ TCar tCar = carService.selectById(id); TCarModel tCarModel = carModelService.selectById(tCar.getCarModelId()); TCarBrand tCarBrand = carBrandService.selectById(tCar.getCarBrandId()); TCarService tCarService = carServiceService.selectOne(new EntityWrapper().eq("carId", id).eq("type", 1)); TSystemPrice tSystemPrice = systemPriceService.selectOne(new EntityWrapper() .eq("type", 1) .eq("serverCarModelId", tCarService.getServerCarModelId()) .eq("companyId", (tCar.getFranchiseeId() == null || tCar.getFranchiseeId() == 0) ? tCar.getCompanyId() : tCar.getFranchiseeId()).eq("state", 1)); String fileName = System.currentTimeMillis() + ".jpg"; //上传图片文件 Map file = new HashMap<>(); file.put("path", "/tmp"); file.put("fileName", fileName); file.put("url", tCar.getCarPhoto()); file.put("newFilePath", "/swapfiles"); String result_ = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_ftp + "/uploadAndMoveFile", file); System.out.println("上传图片文件:" + result_); JSONObject jsonObject = new JSONObject(); jsonObject.put("Address", 530100);//车辆所在城市行政区划代码 jsonObject.put("VehicleNo", tCar.getCarLicensePlate());//车辆号牌 jsonObject.put("PlateColor", tCar.getPlateColor());//车牌颜色 jsonObject.put("Seats", tCarModel.getSeat());//核定载客位 jsonObject.put("Brand", tCarBrand.getName());//车辆厂牌 jsonObject.put("Model", tCarModel.getName());//车辆型号 jsonObject.put("VehicleType", tCar.getVehicleType());//车辆类型(以机动车行驶证为准) jsonObject.put("OwnerName", tCar.getOwnerName());//车辆所有人(以机动车行驶证为准) jsonObject.put("VehicleColor", tCar.getCarColor());//车身颜色 jsonObject.put("EngineId", tCar.getEngineId());//发动机号(以机动车行驶证为准) jsonObject.put("VIN", tCar.getVIN());//车辆VIN码(以机动车行驶证为准) jsonObject.put("CertifyDateA", tCar.getCertifyDateA());//车辆注册日期(以机动车行驶证为准)YYYY-MM-DD jsonObject.put("FuelType", tCar.getFuelType());//车辆燃料类型 jsonObject.put("EngineDisplace", tCar.getEngineDisplace());//发送机排量(毫升) jsonObject.put("PhotoId", fileName);//车辆照片文件编号 jsonObject.put("Certificate", tCar.getCertificate());//运输证字号 jsonObject.put("TransAgency", tCar.getTransAgency());//车辆运输证发证机构 jsonObject.put("TransArea", tCar.getTransArea());//车辆经营区域 jsonObject.put("TransDateStart", tCar.getTransDateStart());//车辆运输证有效期起YYYYMMDD jsonObject.put("TransDateStop", tCar.getTransDateStop());//车辆运输证有效期止YYYYMMDD jsonObject.put("CertifyDateB", tCar.getCertifyDateB());//车辆初次登记日期YYYY-MM-DD jsonObject.put("FixState", tCar.getFixState());//车辆维修状态(0:未检修,1:已检修,2:未知) jsonObject.put("NextFixDate", tCar.getNextFixDate());//车辆下次年检时间YYYY-MM-DD jsonObject.put("CheckState", tCar.getCheckState());//车辆年度审验状态 jsonObject.put("FeePrintId", tCar.getFeePrintId());//发票打印设备序列号 jsonObject.put("GPSBrand", tCar.getGPSBrand());//卫星定位装置品牌 jsonObject.put("GPSModel", tCar.getGPSModel());//卫星定位装置型号 jsonObject.put("GPSIMEI", tCar.getGPSIMEI());//卫星定位装置IMEI号 jsonObject.put("GPSInstallDate", tCar.getGPSInstallDate());//卫星定位设备安装日期YYYYMMDD jsonObject.put("RegisterDate", tCar.getRegisterDate());//报备日期(车辆信息向服务所在地出租车行政主管部门报备日期YYYYMMDD) jsonObject.put("CommercialType", Integer.valueOf(tCar.getCommercialType()));//服务类型(1:网络预约出租车,2:巡游出租汽车,3:私人小客车合乘) jsonObject.put("FareType", null == tSystemPrice ? "" : tSystemPrice.getId());//运价类型编码(与运价信息中一一对应) jsonObject.put("State", tCar.getState() == 1 ? 0 : 1);//状态(0:有效,1:失效) jsonObject.put("Flag", 1);//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date());//YYYYMMDDhhmmss Map map = new HashMap<>(); map.put("baseInfoVehicle", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoVehicle", map); System.out.println("车辆基本信息:" + result); } /** * 车辆保险信息 */ public void baseInfoVehicleInsurance(Integer id, Integer flag){ CarInsurance carInsurance = carInsuranceMapper.selectById(id); TCar tCar = carService.selectById(carInsurance.getCarId()); JSONObject jsonObject = new JSONObject(); jsonObject.put("VehicleNo", tCar.getCarLicensePlate());//车辆号牌 jsonObject.put("InsurCom", carInsurance.getInsurCom());//保险公司名称 jsonObject.put("InsurNum", carInsurance.getInsurNum());//保险号 jsonObject.put("InsurType", carInsurance.getInsurType());//保险类型 jsonObject.put("InsurCount", carInsurance.getInsurCount());//保险金额(元) jsonObject.put("InsurEff", carInsurance.getInsurEff());//保险生效时间YYYYMMDD jsonObject.put("InsurExp", carInsurance.getInsurExp());//保险到期时间YYYYMMDD jsonObject.put("Flag", flag);//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoVehicleInsurance", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoVehicleInsurance", map); System.out.println("车辆保险信息:" + result); } /** * 驾驶员基本信息 * @param driverId */ public void baseInfoDriver(Integer driverId){ TDriver tDriver = driverService.selectById(driverId); //上传图片文件 String fileName = System.currentTimeMillis() + ".jpg"; Map file = new HashMap<>(); file.put("path", "/tmp"); file.put("fileName", fileName); file.put("url", tDriver.getHeadImgUrl()); file.put("newFilePath", "/swapfiles"); String result_ = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_ftp + "/uploadAndMoveFile", file); System.out.println("上传图片文件:" + result_); String fileName1 = System.currentTimeMillis() + ".jpg"; Map file1 = new HashMap<>(); file1.put("path", "/tmp"); file1.put("fileName", fileName1); file1.put("url", tDriver.getDriveCardImgUrl()); file1.put("newFilePath", "/swapfiles"); String result1_ = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_ftp + "/uploadAndMoveFile", file1); System.out.println("上传图片文件:" + result1_); JSONObject jsonObject = new JSONObject(); jsonObject.put("Address", 530100);//注册地行政区划代码 jsonObject.put("DriverName", tDriver.getName());//机动车驾驶员姓名 jsonObject.put("DriverPhone", tDriver.getPhone());//驾驶员手机号 jsonObject.put("DriverGender", (tDriver.getSex() == 1 ? "男" : "女"));//驾驶员性别 jsonObject.put("DriverBirthday", tDriver.getBirthday());//出生日期YYYYMMDD jsonObject.put("DriverNationality", tDriver.getDriverNationality());//国籍 jsonObject.put("DriverNation", tDriver.getDriverNation());//驾驶员民族 jsonObject.put("DriverMaritalStatus", (tDriver.getDriverMaritalStatus() == 1 ? "未婚" : tDriver.getDriverMaritalStatus() == 2 ? "已婚" : "离异"));//驾驶员婚姻状况(未婚,已婚,离异) jsonObject.put("DriverLanguageLevel", tDriver.getDriverLanguageLevel());//驾驶员外语能力 jsonObject.put("DriverEducation", tDriver.getDriverEducation());//驾驶员学历 jsonObject.put("DriverCensus", tDriver.getDriverCensus());//户口登记机关名称 jsonObject.put("DriverAddress", tDriver.getDriverAddress());//户口住址或长住地址 jsonObject.put("DriverContactAddress", tDriver.getDriverContactAddress());//驾驶员通信地址 jsonObject.put("PhotoId", fileName);//驾驶员照片文件编号 jsonObject.put("LicenseId", tDriver.getDriveCard());//机动车驾驶证号 jsonObject.put("LicensePhotoId", fileName1);//机动车驾驶证扫描件文件编号 jsonObject.put("DriverType", tDriver.getDriverType());//准驾车型 jsonObject.put("GetDriverLicenseDate", tDriver.getGetDriverLicenseDate());//初次领取驾驶证日期YYYYMMDD jsonObject.put("DriverLicenseOn", tDriver.getDriverLicenseOn());//驾驶证有效期限起YYYYMMDD jsonObject.put("DriverLicenseOff", tDriver.getDriverLicenseOff());//驾驶证有效期限止YYYYMMDD jsonObject.put("TaxiDriver", tDriver.getTaxiDriver() == 0 ? 2 : 1);//是否巡游出租汽车驾驶员(1:是,2:否) jsonObject.put("CertificateNo", tDriver.getTaxiAptitudeCard());//网络预约出租汽车驾驶员资格证号 jsonObject.put("NetworkCarIssueOrganization", tDriver.getNetworkCarlssueOrganization());//网络预约出租汽车驾驶员证发证机构 jsonObject.put("NetworkCarIssueDate", tDriver.getNetworkCarlssueDate());//资格证发证日期YYYYMMDD jsonObject.put("GetNetworkCarProofDate", tDriver.getGetNetworkCarProofDate());//初次领取资格证日期YYYYMMDD jsonObject.put("NetworkCarProofOn", tDriver.getNetworkCarProofOn());//资格证有效起始日期YYYYMMDD jsonObject.put("NetworkCarProofOff", tDriver.getNetworkCarProofOff());//资格证有截止日期YYYYMMDD jsonObject.put("RegisterDate", tDriver.getRegisterDate());//报备日期(驾驶员信息向服务所在地出租车行政主管部门报备日期) jsonObject.put("FullTimeDriver", tDriver.getFullTimeDriver());//是否专职驾驶员(1:是,0:否) jsonObject.put("InDriverBlacklist", tDriver.getInDriverBlacklist());//是否在驾驶员黑名单内(1:是,0:否) jsonObject.put("CommercialType", tDriver.getCommercialType());//服务类型(1:网络预约出租汽车,2:巡游出租汽车,3:私人小客车合乘) jsonObject.put("ContractCompany", tDriver.getContractCompany());//驾驶员合同签署公司 jsonObject.put("ContractOn", tDriver.getContractOn());//合同有效期起YYYYMMDD jsonObject.put("ContractOff", tDriver.getContractOff());//合同有效期止YYYYMMDD jsonObject.put("EmergencyContact", tDriver.getEmergencyContact());//紧急情况联系人 jsonObject.put("EmergencyContactPhone", tDriver.getEmergencyContactPhone());//紧急情况联系人电话 jsonObject.put("EmergencyContactAddress", tDriver.getEmergencyContactAddress());//紧急情况联系人通信地址 jsonObject.put("State", tDriver.getAuthState() == 2 ? 0 : 1);//状态(0:有效,1:失效) jsonObject.put("Flag", tDriver.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoDriver", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoDriver", map); System.out.println("驾驶员基本信息:" + result); } /** * 网约车驾驶员培训信息 * @param id * @param id */ public void baseInfoDriverEducate(Integer id, Integer flag){ DriverTrain driverTrain = driverTrainMapper.selectById(id); TDriver driver = driverService.selectById(driverTrain.getDriverId()); JSONObject jsonObject = new JSONObject(); jsonObject.put("Address", 530100);//注册地行政区划代码 jsonObject.put("LicenseId", driver.getDriveCard());//机动车驾驶证号 jsonObject.put("CourseName", driverTrain.getCourseName());//驾驶员培训课程名称 jsonObject.put("CourseDate", driverTrain.getCourseDate());//培训课程日期YYYYMMDD jsonObject.put("StartTime", driverTrain.getStartTime());//培训开始时间 jsonObject.put("StopTime", driverTrain.getStopTime());//培训结束时间 jsonObject.put("Duration", driverTrain.getDuration());//培训时长 jsonObject.put("Flag", flag);//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoDriverEducate", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoDriverEducate", map); System.out.println("网约车驾驶员培训信息:" + result); } /** * 驾驶员移动终端信息 * @param driverId */ public void baseInfoDriverApp(Integer driverId){ TDriver tDriver = driverService.selectById(driverId); TVersionManagement type = versionManagementService.selectOne(new EntityWrapper().eq("type", 2).orderBy("insertTime desc limit 0, 1")); JSONObject jsonObject = new JSONObject(); jsonObject.put("Address", 530100);//注册地行政区划代码 jsonObject.put("LicenseId", tDriver.getDriveCard());//机动车驾驶证号 jsonObject.put("DriverPhone", tDriver.getPhone());//驾驶员手机号 jsonObject.put("NetType", phoneExp(tDriver.getPhone()));//手机运营商(1:中国联通,2:中国移动,3:中国电信,4:其他) jsonObject.put("AppVersion", type.getVersion());//使用APP版本号 jsonObject.put("MapType", 2);//使用地图类型(1:百度地图,2:高德地图,3:其他) jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", 1);//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoDriverApp", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoDriverApp", map); System.out.println("驾驶员移动终端信息:" + result); } /** * 驾驶员统计信息 * @param driverId */ public void baseInfoDriverStat(Integer driverId){ TDriver tDriver = driverService.selectById(driverId); Calendar s = Calendar.getInstance(); s.setTime(new Date()); s.set(s.get(Calendar.YEAR), s.get(Calendar.MONTH) - 1, 1, 0, 0, 0); Calendar e = Calendar.getInstance(); e.setTime(new Date()); e.set(e.get(Calendar.YEAR), e.get(Calendar.MONTH) - 1, e.getActualMaximum(Calendar.DAY_OF_MONTH), 23, 59, 59); int i = orderPrivateCarService.selectCount( new EntityWrapper() .eq("driverId", driverId) .in("state", Arrays.asList(6, 7, 8, 9)) .between("travelTime", s.getTime(), e.getTime()) ); int i1 = complaintService.selectCount( new EntityWrapper() .eq("driverId", driverId) .between("insert_time", s.getTime(), e.getTime()) ); JSONObject jsonObject = new JSONObject(); jsonObject.put("Address", 530100);//注册地行政区划代码 jsonObject.put("LicenseId", tDriver.getDriveCard());//机动车驾驶证号 jsonObject.put("Cycle", s.getTime());//统计周期(统计周期按月,内容填写统计月份YYYYMM) jsonObject.put("OrderCount", i);//完成订单次数 jsonObject.put("TrafficViolationCount", 0);//交通违章次数 jsonObject.put("ComplainedCount", i1);//被投诉次数 jsonObject.put("Flag", 1);//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", new Date()); Map map = new HashMap<>(); map.put("baseInfoDriverStat", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/baseInfoDriverStat", map); System.out.println("驾驶员统计信息:" + result); } /** * 订单撤销接口 * @param orderId */ public void orderCancel(Integer orderId){ TOrderPrivateCar tOrderPrivateCar = orderPrivateCarService.selectById(orderId); TDriver driver = driverService.selectById(tOrderPrivateCar.getDriverId()); OrderCancel query = orderCancelMapper.query(orderId, 1, null, null, 2); Map geocode = null; try { geocode = gdMapGeocodingUtil.geocode(tOrderPrivateCar.getBoardingLon().toString(), tOrderPrivateCar.getBoardingLat().toString()); } catch (Exception e) { e.printStackTrace(); } JSONObject jsonObject = new JSONObject(); jsonObject.put("Address", Integer.valueOf(geocode.get("districtCode")));//上车地点行政区划代码 jsonObject.put("OrderId", tOrderPrivateCar.getOrderNum());//订单编号 jsonObject.put("OrderTime", tOrderPrivateCar.getOrderNum());//订单时间YYYYMMDDhhmmss jsonObject.put("CancelTime", query.getInsertTime());//订单撤销时间YYYYMMDDhhmmss jsonObject.put("Operator", "3");//撤销发起方(1:乘客,2:驾驶员,3:平台公司) jsonObject.put("CancelTypeCode", null != driver ? driver.getDriveCard() : "");//机动车驾驶证编号 jsonObject.put("CancelReason", query.getReason());//撤销或违约原因 Map map = new HashMap<>(); map.put("orderCancel", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/orderCancel", map); System.out.println("订单撤销接口:" + result); } /** * 乘客投诉信息 * @param id */ public void ratedPassengerComplaint(Integer id){ TComplaint tComplaint = complaintService.selectById(id); JSONObject jsonObject = new JSONObject(); jsonObject.put("OrderId", "");//订单号 jsonObject.put("ComplaintTime", tComplaint.getInsertTime());//投诉时间YYYYMMDDhhmms jsonObject.put("Detail", tComplaint.getReason());//投诉内容 jsonObject.put("Result", tComplaint.getHandleResult());//处理结果 Map map = new HashMap<>(); map.put("ratedPassengerComplaint", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/ratedPassengerComplaint", map); System.out.println("乘客投诉信息:" + result); } /** * 驾驶员处罚信息 * @param id */ public void ratedDriverPunish(Integer id){ DriverPunish driverPunish = driverPunishMapper.selectById(id); TDriver driver = driverService.selectById(driverPunish.getDriverId()); JSONObject jsonObject = new JSONObject(); jsonObject.put("LicenseId", driver.getDriveCard());//机动车驾驶证编号 jsonObject.put("PunishTime", driverPunish.getPunishTime());//处罚时间YYYYMMDDhhmms jsonObject.put("PunishReason", driverPunish.getPunishReason());//处罚原因 jsonObject.put("PunishReault", driverPunish.getPunishReault());//处罚结果 Map map = new HashMap<>(); map.put("ratedDriverPunish", jsonObject.toJSONString()); String result = HttpRequestUtil.postRequest(PushURL.ministry_of_transport_data + "/ratedDriverPunish", map); System.out.println("驾驶员处罚信息:" + result); } private int phoneExp(String phone){ /** * 中国移动号码正则 * 139、138、137、136、135、134、147、150、151、152、157、158、159、178、182、183、184、187、188、198、195 * 虚拟运营商号段: 1703、1705、1706、165 **/ String MOBILE_PATTERN = "(^1(3[4-9]|47|5[0-27-9]|65|78|8[2-478]|98)\\d{8}$)|(^170[356]\\d{7}$)"; /** * 中国电信号码正则 * 133、149、153、173、177、180、181、189、199、191 * 虚拟运营商号段: 162、1700、1701、1702 **/ String TELECOM_PATTERN = "(^1(33|49|53|62|7[37]|8[019]|9[19])\\d{8}$)|(^170[012]\\d{7}$)"; /** * 中国联通号码正则 * 130、131、132、155、156、185、186、145、175、176、166、140 * 虚拟运营商号段: 171、1707、1708、1709、167 **/ String UNICOM_PATTERN = "(^1(3[0-2]|4[05]|5[56]|6[67]|7[156]|8[56])\\d{8}$)|(^170[7-9]\\d{7}$)"; if(Pattern.matches(UNICOM_PATTERN, phone)){ return 1; } if(Pattern.matches(MOBILE_PATTERN, phone)){ return 2; } if(Pattern.matches(TELECOM_PATTERN, phone)){ return 3; } return 4; } }