package com.sinata.ministryoftransport.util; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; import com.sinata.ministryoftransport.model.*; import com.sinata.ministryoftransport.util.httpClinet.HttpClientUtil; import com.sinata.ministryoftransport.util.httpClinet.HttpResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; /** * 交通部接口对接 */ @Component public class MinistryOfTransport { Logger logger = LoggerFactory.getLogger(MinistryOfTransport.class); private final String CompanyId = "5301XFKJ9386";//公司标识 private final String Source = "0";//消息来源标识 private final String url = "https://wycup.ggjtfw.com:8085"; private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); private SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd"); /** * 上传企业基础信息 */ public String baseInfoCompany(BaseInfoCompany baseInfoCompany) throws Exception{ String IPCType = "baseInfoCompany"; String path = url + "/baseinfo/company"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("CompanyName", baseInfoCompany.getCompanyName());//公司名称 jsonObject.put("Identifier", baseInfoCompany.getIdentifier());//统一社会信用代码 jsonObject.put("Address", baseInfoCompany.getAddress());//注册地行政区划代码 jsonObject.put("BusinessScope", baseInfoCompany.getBusinessScope());//经营范围 jsonObject.put("ContactAddress", baseInfoCompany.getContactAddress());//通信地址 jsonObject.put("EconomicType", baseInfoCompany.getEconomicType());//经营业户经济类型 jsonObject.put("RegCapital", baseInfoCompany.getRegCapital());//注册资本 jsonObject.put("LegalName", baseInfoCompany.getLegalName());//法人代表姓名 jsonObject.put("LegalID", baseInfoCompany.getLegalID());//法人代表身份证号 jsonObject.put("LegalPhone", baseInfoCompany.getLegalPhone());//法人代表电话 jsonObject.put("LegalPhoto", baseInfoCompany.getLegalPhoto());//法人代表身份证扫描件文件编号(.jpg) jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", baseInfoCompany.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", baseInfoCompany.getUpdateTime()); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/company\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【企业基础信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【企业基础信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 网约车平台公司营运规模信息接口 */ public String baseInfoCompanyStat(BaseInfoCompanyStat baseInfoCompanyStat) throws Exception{ String IPCType = "baseInfoCompanyStat"; String path = url + "/baseinfo/companystat"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("VehicleNum", baseInfoCompanyStat.getVehicleNum());//平台注册网约车辆数 jsonObject.put("DriverNum", baseInfoCompanyStat.getDriverNum());//平台注册驾驶员数 jsonObject.put("Flag", baseInfoCompanyStat.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoCompanyStat.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/companystat\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【网约车平台公司营运规模信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【网约车平台公司营运规模信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 网约车平台公司支付信息 */ public String baseInfoCompanyPay(BaseInfoCompanyPay baseInfoCompanyPay) throws Exception{ String IPCType = "baseInfoCompanyPay"; String path = url + "/baseinfo/companypay"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("PayName", baseInfoCompanyPay.getPayName());//银行或者非银行支付机构名称 jsonObject.put("PayId", baseInfoCompanyPay.getPayId());//非银行支付机构支付业务许可证编号 jsonObject.put("PayType", baseInfoCompanyPay.getPayType());//支付业务类型 jsonObject.put("PayScope", baseInfoCompanyPay.getPayScope());//业务覆盖范围 jsonObject.put("PrepareBank", baseInfoCompanyPay.getPrepareBank());//备付金存管银行 jsonObject.put("CountDate", baseInfoCompanyPay.getCountDate());//结算周期 jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", baseInfoCompanyPay.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoCompanyPay.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/companypay\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【网约车平台公司支付信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【网约车平台公司支付信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 网约车平台公司服务机构 */ public String baseInfoCompanyService(BaseInfoCompanyService baseInfoCompanyService) throws Exception{ String IPCType = "baseInfoCompanyService"; String path = url + "/baseinfo/companyservice"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", baseInfoCompanyService.getAddress());//行政区划代码 jsonObject.put("ServiceName", baseInfoCompanyService.getServiceName());//服务机构名称 jsonObject.put("ServiceNo", baseInfoCompanyService.getServiceNo());//服务机构代码 jsonObject.put("DetailAddress", baseInfoCompanyService.getDetailAddress());//服务机构地址 jsonObject.put("ResponsibleName", baseInfoCompanyService.getResponsibleName());//服务机构负责人姓名 jsonObject.put("ResponsiblePhone", baseInfoCompanyService.getResponsiblePhone());//负责人联系电话 jsonObject.put("ManagerName", baseInfoCompanyService.getManagerName());//服务机构管理人姓名 jsonObject.put("ManagerPhone", baseInfoCompanyService.getManagerPhone());//管理人联系电话 jsonObject.put("ContactPhone", baseInfoCompanyService.getContactPhone());//服务机构紧急联系电话 jsonObject.put("MailAddress", baseInfoCompanyService.getMailAddress());//行政文书送达邮寄地址 jsonObject.put("CreateDate", Long.valueOf(sdf.format(baseInfoCompanyService.getCreateDate())));//服务机构设立日期 jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", baseInfoCompanyService.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoCompanyService.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/companyservice\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【网约车平台公司服务机构】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【网约车平台公司服务机构】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 网约车平台公司经营许可 */ public String baseInfoCompanyPermit(BaseInfoCompanyPermit baseInfoCompanyPermit) throws Exception{ String IPCType = "baseInfoCompanyPermit"; String path = url + "/baseinfo/companypermit"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", baseInfoCompanyPermit.getAddress());//许可地行政区划代码 jsonObject.put("Certificate", baseInfoCompanyPermit.getCertificate());//网络预约出租车经营许可证号 jsonObject.put("OperationArea", baseInfoCompanyPermit.getOperationArea());//经营区域 jsonObject.put("OwnerName", baseInfoCompanyPermit.getOwnerName());//公司名称 jsonObject.put("Organization", baseInfoCompanyPermit.getOrganization());//发证机构名称 jsonObject.put("StartDate", Long.valueOf(sdf2.format(baseInfoCompanyPermit.getStartDate())));//有效期起YYYYMMDD jsonObject.put("StopDate", Long.valueOf(sdf2.format(baseInfoCompanyPermit.getStopDate())));//有效期止YYYYMMDD jsonObject.put("CertifyDate", Long.valueOf(sdf2.format(baseInfoCompanyPermit.getCertifyDate())));//初次发证日期YYYYMMDD jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", baseInfoCompanyPermit.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoCompanyPermit.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/companypermit\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【网约车平台公司经营许可】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【网约车平台公司经营许可】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 网约车平台公司运价信息 */ public String baseInfoCompanyFare(BaseInfoCompanyFare baseInfoCompanyFare) throws Exception{ String IPCType = "baseInfoCompanyFare"; String path = url + "/baseinfo/companyfare"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", baseInfoCompanyFare.getAddress());//运价适用地行政区划代码 jsonObject.put("FareType", baseInfoCompanyFare.getFareType());//运价类型编码(由网约车平台公司统一编码,应确保唯一性) jsonObject.put("FareTypeNote", baseInfoCompanyFare.getFareTypeNote());//运价类型说明 jsonObject.put("FareValidOn", Long.valueOf(sdf.format(baseInfoCompanyFare.getFareValidOn())));//运价有效期起YYYYMMDDhhmmss jsonObject.put("FareValidOff", Long.valueOf(sdf.format(baseInfoCompanyFare.getFareValidOff())));//运价有效止YYYYMMDDhhmmss jsonObject.put("StartFare", baseInfoCompanyFare.getStartFare().intValue());//起步价(元) jsonObject.put("StartMile", baseInfoCompanyFare.getStartMile());//起步里程(km) jsonObject.put("UnitPricePerMile", baseInfoCompanyFare.getUnitPricePerMile().intValue());//计程单价(按公里/元) jsonObject.put("UnitPricePerMinute", baseInfoCompanyFare.getUnitPricePerMinute().intValue());//计时单价(按分钟/元) jsonObject.put("UpPrice", baseInfoCompanyFare.getUpPrice().intValue());//单程加价单价(元) jsonObject.put("UpPriceStartMile", baseInfoCompanyFare.getUpPriceStartMile());//单程加价公里(km) jsonObject.put("MorningPeakTimeOn", baseInfoCompanyFare.getMorningPeakTimeOn());//营运早高峰时间起(HHmm 24小时) jsonObject.put("MorningPeakTimeOff", baseInfoCompanyFare.getMorningPeakTimeOff());//营运早高峰时间止(HHmm 24小时) jsonObject.put("EveningPeakTimeOn", baseInfoCompanyFare.getEveningPeakTimeOn());//营运晚高峰时间起(HHmm 24小时) jsonObject.put("EveningPeakTimeOff", baseInfoCompanyFare.getEveningPeakTimeOff());//营运晚高峰时间止(HHmm 24小时) jsonObject.put("OtherPeakTimeOn", baseInfoCompanyFare.getOtherPeakTimeOn());//其他营运高等时间起(HHmm 24小时) jsonObject.put("OtherPeakTineOff", baseInfoCompanyFare.getOtherPeakTineOff());//其他营运高等时间止(HHmm 24小时) jsonObject.put("PeakUnitPrice", baseInfoCompanyFare.getPeakUnitPrice().intValue());//高峰时间单程加价单价(元) jsonObject.put("PeakPriceStartMile", baseInfoCompanyFare.getPeakPriceStartMile());//高峰时间单程加价公里(km) jsonObject.put("LowSpeedPriceMinute", baseInfoCompanyFare.getLowSpeedPriceMinute().intValue());//低速计时加价(按分钟 元) jsonObject.put("NightPricePerMile", baseInfoCompanyFare.getNightPricePerMile().intValue());//夜间费(按公里 元) jsonObject.put("NightPricePerMinute", baseInfoCompanyFare.getNightPricePerMinute().intValue());//夜间费(按分钟 元) jsonObject.put("OtherPrice", baseInfoCompanyFare.getOtherPrice().intValue());//其它加价金额(元) jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", baseInfoCompanyFare.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoCompanyFare.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/companyfare\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【网约车平台公司运价信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【网约车平台公司运价信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 车辆基本信息 */ public String baseInfoVehicle(BaseInfoVehicle baseInfoVehicle) throws Exception{ String IPCType = "baseInfoVehicle"; String path = url + "/baseinfo/vehicle"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", baseInfoVehicle.getAddress());//车辆所在城市行政区划代码 jsonObject.put("VehicleNo", baseInfoVehicle.getVehicleNo());//车辆号牌 jsonObject.put("PlateColor", baseInfoVehicle.getPlateColor());//车牌颜色 jsonObject.put("Seats", baseInfoVehicle.getSeats());//核定载客位 jsonObject.put("Brand", baseInfoVehicle.getBrand());//车辆厂牌 jsonObject.put("Model", baseInfoVehicle.getModel());//车辆型号 jsonObject.put("VehicleType", baseInfoVehicle.getVehicleType());//车辆类型(以机动车行驶证为准) jsonObject.put("OwnerName", baseInfoVehicle.getOwnerName());//车辆所有人(以机动车行驶证为准) jsonObject.put("VehicleColor", baseInfoVehicle.getVehicleColor());//车身颜色 jsonObject.put("EngineId", baseInfoVehicle.getEngineId());//发动机号(以机动车行驶证为准) jsonObject.put("VIN", baseInfoVehicle.getVIN());//车辆VIN码(以机动车行驶证为准) jsonObject.put("CertifyDateA", Long.valueOf(sdf2.format(baseInfoVehicle.getCertifyDateA())));//车辆注册日期(以机动车行驶证为准)YYYY-MM-DD jsonObject.put("FuelType", baseInfoVehicle.getFuelType());//车辆燃料类型 jsonObject.put("EngineDisplace", baseInfoVehicle.getEngineDisplace());//发送机排量(毫升) jsonObject.put("PhotoId", baseInfoVehicle.getPhotoId());//车辆照片文件编号 jsonObject.put("Certificate", baseInfoVehicle.getCertificate());//运输证字号 jsonObject.put("TransAgency", baseInfoVehicle.getTransAgency());//车辆运输证发证机构 jsonObject.put("TransArea", baseInfoVehicle.getTransArea());//车辆经营区域 jsonObject.put("TransDateStart", Long.valueOf(sdf2.format(baseInfoVehicle.getTransDateStart())));//车辆运输证有效期起YYYYMMDD jsonObject.put("TransDateStop", Long.valueOf(sdf2.format(baseInfoVehicle.getTransDateStop())));//车辆运输证有效期止YYYYMMDD jsonObject.put("CertifyDateB", Long.valueOf(sdf2.format(baseInfoVehicle.getCertifyDateB())));//车辆初次登记日期YYYY-MM-DD jsonObject.put("FixState", baseInfoVehicle.getFixState());//车辆维修状态(0:未检修,1:已检修,2:未知) jsonObject.put("NextFixDate", Long.valueOf(sdf2.format(baseInfoVehicle.getNextFixDate())));//车辆下次年检时间YYYY-MM-DD jsonObject.put("CheckState", baseInfoVehicle.getCheckState());//车辆年度审验状态 jsonObject.put("FeePrintId", baseInfoVehicle.getFeePrintId());//发票打印设备序列号 jsonObject.put("GPSBrand", baseInfoVehicle.getGPSBrand());//卫星定位装置品牌 jsonObject.put("GPSModel", baseInfoVehicle.getGPSModel());//卫星定位装置型号 jsonObject.put("GPSIMEI", baseInfoVehicle.getGPSIMEI());//卫星定位装置IMEI号 jsonObject.put("GPSInstallDate", Long.valueOf(sdf2.format(baseInfoVehicle.getGPSInstallDate())));//卫星定位设备安装日期YYYYMMDD jsonObject.put("RegisterDate", Long.valueOf(sdf2.format(baseInfoVehicle.getRegisterDate())));//报备日期(车辆信息向服务所在地出租车行政主管部门报备日期YYYYMMDD) jsonObject.put("CommercialType", baseInfoVehicle.getCommercialType());//服务类型(1:网络预约出租车,2:巡游出租汽车,3:私人小客车合乘) jsonObject.put("FareType", baseInfoVehicle.getFareType());//运价类型编码(与云间信息中一一对应) jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", baseInfoVehicle.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoVehicle.getUpdateTime())));//YYYYMMDDhhmmss data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/vehicle\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【车辆基本信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【车辆基本信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 车辆保险信息 */ public String baseInfoVehicleInsurance(BaseInfoVehicleInsurance baseInfoVehicleInsurance) throws Exception{ String IPCType = "baseInfoVehicleInsurance"; String path = url + "/baseinfo/vehicleinsurance"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("VehicleNo", baseInfoVehicleInsurance.getVehicleNo());//车辆号牌 jsonObject.put("InsurCom", baseInfoVehicleInsurance.getInsurCom());//保险公司名称 jsonObject.put("InsurNum", baseInfoVehicleInsurance.getInsurNum());//保险号 jsonObject.put("InsurType", baseInfoVehicleInsurance.getInsurType());//保险类型 jsonObject.put("InsurCount", baseInfoVehicleInsurance.getInsurCount());//保险金额(元) jsonObject.put("InsurEff", Long.valueOf(sdf2.format(baseInfoVehicleInsurance.getInsurEff())));//保险生效时间YYYYMMDD jsonObject.put("InsurExp", Long.valueOf(sdf2.format(baseInfoVehicleInsurance.getInsurExp())));//保险到期时间YYYYMMDD jsonObject.put("Flag", baseInfoVehicleInsurance.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoVehicleInsurance.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/vehicleinsurance\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【车辆保险信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【车辆保险信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 网约车车辆里程信息 */ public String baseInfoVehicleTotalMile(BaseInfoVehicleTotalMile baseInfoVehicleTotalMile) throws Exception{ String IPCType = "baseInfoVehicleTotalMile"; String path = url + "/baseinfo/vehicletotalmile"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", baseInfoVehicleTotalMile.getAddress());//注册地行政区划代码 jsonObject.put("VehicleNo", baseInfoVehicleTotalMile.getVehicleNo());//车辆号牌 jsonObject.put("TotalMile", baseInfoVehicleTotalMile.getTotalMile());//行驶总里程(km) jsonObject.put("Flag", baseInfoVehicleTotalMile.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoVehicleTotalMile.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/vehicletotalmile\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【网约车车辆里程信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【网约车车辆里程信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 驾驶员基本信息 */ public String baseInfoDriver(BaseInfoDriver baseInfoDriver) throws Exception{ String IPCType = "baseInfoDriver"; String path = url + "/baseinfo/driver"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", baseInfoDriver.getAddress());//注册地行政区划代码 jsonObject.put("DriverName", baseInfoDriver.getDriverName());//机动车驾驶员姓名 jsonObject.put("DriverPhone", baseInfoDriver.getDriverPhone());//驾驶员手机号 jsonObject.put("DriverGender", baseInfoDriver.getDriverGender());//驾驶员性别 jsonObject.put("DriverBirthday", null == baseInfoDriver.getDriverBirthday() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getDriverBirthday())));//出生日期YYYYMMDD jsonObject.put("DriverNationality", baseInfoDriver.getDriverNationality());//国籍 jsonObject.put("DriverNation", baseInfoDriver.getDriverNation());//驾驶员民族 jsonObject.put("DriverMaritalStatus", baseInfoDriver.getDriverMaritalStatus());//驾驶员婚姻状况(未婚,已婚,离异) jsonObject.put("DriverLanguageLevel", baseInfoDriver.getDriverLanguageLevel());//驾驶员外语能力 jsonObject.put("DriverEducation", baseInfoDriver.getDriverEducation());//驾驶员学历 jsonObject.put("DriverCensus", baseInfoDriver.getDriverCensus());//户口登记机关名称 jsonObject.put("DriverAddress", baseInfoDriver.getDriverAddress());//户口住址或长住地址 jsonObject.put("DriverContactAddress", baseInfoDriver.getDriverContactAddress());//驾驶员通信地址 jsonObject.put("PhotoId", baseInfoDriver.getPhotoId());//驾驶员照片文件编号 jsonObject.put("LicenseId", null != baseInfoDriver.getLicenseId() ? baseInfoDriver.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("LicensePhotoId", baseInfoDriver.getLicensePhotoId());//机动车驾驶证扫描件文件编号 jsonObject.put("DriverType", baseInfoDriver.getDriverType());//准驾车型 jsonObject.put("GetDriverLicenseDate", null == baseInfoDriver.getGetDriverLicenseDate() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getGetDriverLicenseDate())));//初次领取驾驶证日期YYYYMMDD jsonObject.put("DriverLicenseOn", null == baseInfoDriver.getDriverLicenseOn() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getDriverLicenseOn())));//驾驶证有效期限起YYYYMMDD jsonObject.put("DriverLicenseOff", null == baseInfoDriver.getDriverLicenseOff() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getDriverLicenseOff())));//驾驶证有效期限止YYYYMMDD jsonObject.put("TaxiDriver", baseInfoDriver.getTaxiDriver());//是否巡游出租汽车驾驶员(1:是,2:否) jsonObject.put("CertificateNo", baseInfoDriver.getCertificateNo());//网络预约出租汽车驾驶员资格证号 jsonObject.put("NetworkCarIssueOrganization", baseInfoDriver.getNetworkCarIssueOrganization());//网络预约出租汽车驾驶员证发证机构 jsonObject.put("NetworkCarIssueDate", null == baseInfoDriver.getNetworkCarIssueDate() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getNetworkCarIssueDate())));//资格证发证日期YYYYMMDD jsonObject.put("GetNetworkCarProofDate", null == baseInfoDriver.getGetNetworkCarProofDate() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getGetNetworkCarProofDate())));//初次领取资格证日期YYYYMMDD jsonObject.put("NetworkCarProofOn", null == baseInfoDriver.getNetworkCarProofOn() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getNetworkCarProofOn())));//资格证有效起始日期YYYYMMDD jsonObject.put("NetworkCarProofOff", null == baseInfoDriver.getNetworkCarProofOff() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getNetworkCarProofOff())));//资格证有截止日期YYYYMMDD jsonObject.put("RegisterDate", null == baseInfoDriver.getRegisterDate() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getRegisterDate())));//报备日期(驾驶员信息向服务所在地出租车行政主管部门报备日期) jsonObject.put("FullTimeDriver", baseInfoDriver.getFullTimeDriver());//是否专职驾驶员(1:是,0:否) jsonObject.put("InDriverBlacklist", baseInfoDriver.getInDriverBlacklist());//是否在驾驶员黑名单内(1:是,0:否) jsonObject.put("CommercialType", baseInfoDriver.getCommercialType());//服务类型(1:网络预约出租汽车,2:巡游出租汽车,3:私人小客车合乘) jsonObject.put("ContractCompany", baseInfoDriver.getContractCompany());//驾驶员合同签署公司 jsonObject.put("ContractOn", null == baseInfoDriver.getContractOn() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getContractOn())));//合同有效期起YYYYMMDD jsonObject.put("ContractOff", null == baseInfoDriver.getContractOff() ? 0 : Long.valueOf(sdf2.format(baseInfoDriver.getContractOff())));//合同有效期止YYYYMMDD jsonObject.put("EmergencyContact", baseInfoDriver.getEmergencyContact());//紧急情况联系人 jsonObject.put("EmergencyContactPhone", baseInfoDriver.getEmergencyContactPhone());//紧急情况联系人电话 jsonObject.put("EmergencyContactAddress", baseInfoDriver.getEmergencyContactAddress());//紧急情况联系人通信地址 jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", baseInfoDriver.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoDriver.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/driver\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【驾驶员基本信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【驾驶员基本信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 网约车驾驶员培训信息 */ public String baseInfoDriverEducate(BaseInfoDriverEducate baseInfoDriverEducate) throws Exception{ String IPCType = "baseInfoDriverEducate"; String path = url + "/baseinfo/drivereducate"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", baseInfoDriverEducate.getAddress());//注册地行政区划代码 jsonObject.put("LicenseId", null != baseInfoDriverEducate.getLicenseId() ? baseInfoDriverEducate.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("CourseName", baseInfoDriverEducate.getCourseName());//驾驶员培训课程名称 jsonObject.put("CourseDate", Long.valueOf(sdf2.format(baseInfoDriverEducate.getCourseDate())));//培训课程日期YYYYMMDD jsonObject.put("StartTime", baseInfoDriverEducate.getStartTime());//培训开始时间 jsonObject.put("StopTime", baseInfoDriverEducate.getStopTime());//培训结束时间 jsonObject.put("Duration", baseInfoDriverEducate.getDuration());//培训时长 jsonObject.put("Flag", baseInfoDriverEducate.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoDriverEducate.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/drivereducate\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【网约车驾驶员培训信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【网约车驾驶员培训信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 驾驶员移动终端信息 */ public String baseInfoDriverApp(BaseInfoDriverApp baseInfoDriverApp) throws Exception{ String IPCType = "baseInfoDriverApp"; String path = url + "/baseinfo/driverapp"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", baseInfoDriverApp.getAddress());//注册地行政区划代码 jsonObject.put("LicenseId", null != baseInfoDriverApp.getLicenseId() ? baseInfoDriverApp.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("DriverPhone", baseInfoDriverApp.getDriverPhone());//驾驶员手机号 jsonObject.put("NetType", baseInfoDriverApp.getNetType());//手机运营商(1:中国联通,2:中国移动,3:中国电信,4:其他) jsonObject.put("AppVersion", baseInfoDriverApp.getAppVersion());//使用APP版本号 jsonObject.put("MapType", baseInfoDriverApp.getMapType());//使用地图类型(1:百度地图,2:高德地图,3:其他) jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", baseInfoDriverApp.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoDriverApp.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/driverapp\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【驾驶员移动终端信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【驾驶员移动终端信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 驾驶员统计信息 */ public String baseInfoDriverStat(BaseInfoDriverStat baseInfoDriverStat) throws Exception{ String IPCType = "baseInfoDriverStat"; String path = url + "/baseinfo/driverstat"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", baseInfoDriverStat.getAddress());//注册地行政区划代码 jsonObject.put("LicenseId", null != baseInfoDriverStat.getLicenseId() ? baseInfoDriverStat.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("Cycle", Long.valueOf(sdf2.format(baseInfoDriverStat.getCycle())));//统计周期(统计周期按月,内容填写统计月份YYYYMM) jsonObject.put("OrderCount", baseInfoDriverStat.getOrderCount());//完成订单次数 jsonObject.put("TrafficViolationCount", baseInfoDriverStat.getTrafficViolationCount());//交通违章次数 jsonObject.put("ComplainedCount", baseInfoDriverStat.getComplainedCount());//被投诉次数 jsonObject.put("Flag", baseInfoDriverStat.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoDriverStat.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/driverstat\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【驾驶员统计信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【驾驶员统计信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 乘客基本信息 */ public String baseInfoPassenger(BaseInfoPassenger baseInfoPassenger) throws Exception{ String IPCType = "baseInfoPassenger"; String path = url + "/baseinfo/passenger"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("RegisterDate", Long.valueOf(sdf2.format(baseInfoPassenger.getRegisterDate())));//注册日期YYYYMMDD jsonObject.put("PassengerPhone", null != baseInfoPassenger.getPassengerPhone() ? baseInfoPassenger.getPassengerPhone() : "");//乘客手机号 jsonObject.put("PassengerName", null != baseInfoPassenger.getPassengerName() ? baseInfoPassenger.getPassengerName() : "");//乘客称谓 jsonObject.put("PassengerGender", null != baseInfoPassenger.getPassengerGender() ? baseInfoPassenger.getPassengerGender() : "");//乘客性别 jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", baseInfoPassenger.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoPassenger.getUpdateTime()))); data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/passenger\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【乘客基本信息1】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【乘客基本信息1】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 订单发起接口 */ public String orderCreate(OrderCreate orderCreate) throws Exception{ String IPCType = "orderCreate"; String path = url + "/order/create"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", orderCreate.getAddress());//发起第行政区划代码 jsonObject.put("OrderId", orderCreate.getOrderId());//订单编号 jsonObject.put("DepartTime", Long.valueOf(sdf.format(orderCreate.getDepartTime())));//预计用车时间YYYYMMDDhhmmss jsonObject.put("OrderTime", Long.valueOf(sdf.format(orderCreate.getOrderTime())));//订单发起时间YYYYMMDDhhmmss jsonObject.put("PassengerNote", orderCreate.getPassengerNote());//乘客备注 jsonObject.put("Departure", orderCreate.getDeparture());//预计出发地点详细地址 jsonObject.put("DepLongitude", Double.valueOf(orderCreate.getDepLongitude() * 1000000).intValue());//预计出发地点经度 jsonObject.put("DepLatitude", Double.valueOf(orderCreate.getDepLatitude() * 1000000).intValue());//预计出发地点纬度 jsonObject.put("Destination", orderCreate.getDestination());//预计目的地 jsonObject.put("DestLongitude", Double.valueOf(orderCreate.getDestLongitude() * 1000000).intValue());//预计目的地经度 jsonObject.put("DestLatitude", Double.valueOf(orderCreate.getDestLatitude() * 1000000).intValue());//预计目的地纬度 jsonObject.put("Encrypt", orderCreate.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) jsonObject.put("FareType", orderCreate.getFareType());//运价类型编码 data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/order/create\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【订单发起1】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【订单发起1】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 订单成功接口 */ public String orderMatch(OrderMatch orderMatch) throws Exception{ String IPCType = "orderMatch"; String path = url + "/order/match"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", orderMatch.getAddress());//发起地行政区划代码 jsonObject.put("OrderId", orderMatch.getOrderId());//订单编号 jsonObject.put("Longitude", Double.valueOf(orderMatch.getLongitude() * 1000000).intValue());//车辆经度 jsonObject.put("Latitude", Double.valueOf(orderMatch.getLatitude() * 1000000).intValue());//车辆纬度 jsonObject.put("Encrypt", orderMatch.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) jsonObject.put("LicenseId", null != orderMatch.getLicenseId() ? orderMatch.getLicenseId() : "");//机动车驾驶证编号 jsonObject.put("DriverPhone", orderMatch.getDriverPhone());//驾驶员手机号 jsonObject.put("VehicleNo", orderMatch.getVehicleNo());//车辆号牌 jsonObject.put("DistributeTime", Long.valueOf(sdf.format(orderMatch.getDistributeTime())));//派单成功时间YYYYMMDDhhmmss data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/order/match\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【订单成功】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【订单成功】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 订单撤销接口 */ public String orderCancel(OrderCancel orderCancel) throws Exception{ String IPCType = "orderCancel"; String path = url + "/order/cancel"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", orderCancel.getAddress());//上车地点行政区划代码 jsonObject.put("OrderId", orderCancel.getOrderId());//订单编号 jsonObject.put("OrderTime", Long.valueOf(sdf.format(orderCancel.getOrderTime())));//订单时间YYYYMMDDhhmmss jsonObject.put("CancelTime", Long.valueOf(sdf.format(orderCancel.getCancelTime())));//订单撤销时间YYYYMMDDhhmmss jsonObject.put("Operator", orderCancel.getOperator());//撤销发起方(1:乘客,2:驾驶员,3:平台公司) jsonObject.put("CancelTypeCode", orderCancel.getCancelTypeCode());//机动车驾驶证编号 jsonObject.put("CancelReason", orderCancel.getCancelReason());//撤销或违约原因 data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/order/cancel\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【订单撤销】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【订单撤销】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 车辆经营上线接口 */ public String operateLogin(OperateLogin operateLogin) throws Exception{ String IPCType = "operateLogin"; String path = url + "/operate/login"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("LicenseId", null != operateLogin.getLicenseId() ? operateLogin.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("VehicleNo", operateLogin.getVehicleNo());//车辆号牌 jsonObject.put("LoginTime", Long.valueOf(sdf.format(operateLogin.getLoginTime())));//车辆经营上线时间YYYYMMDDhhmmss jsonObject.put("Longitude", Double.valueOf(operateLogin.getLongitude() * 1000000).intValue());//上线经度 jsonObject.put("Latitude", Double.valueOf(operateLogin.getLatitude() * 1000000).intValue());//上线纬度 jsonObject.put("Encrypt", operateLogin.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/operate/login\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【车辆经营上线】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【车辆经营上线】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 车辆经营下线接口 */ public String operateLogout(OperateLogout operateLogout) throws Exception{ String IPCType = "operateLogout"; String path = url + "/operate/logout"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("LicenseId", null != operateLogout.getLicenseId() ? operateLogout.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("VehicleNo", operateLogout.getVehicleNo());//车辆号牌 jsonObject.put("LogoutTime", Long.valueOf(sdf.format(operateLogout.getLogoutTime())));//车辆经营下线时间YYYYMMDDhhmmss jsonObject.put("Longitude", Double.valueOf(operateLogout.getLongitude() * 1000000).intValue());//下线经度 jsonObject.put("Latitude", Double.valueOf(operateLogout.getLatitude() * 1000000).intValue());//下线纬度 jsonObject.put("Encrypt", operateLogout.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/operate/logout\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【车辆经营下线】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【车辆经营下线】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 经营出发接口 */ public String operateDepart(OperateDepart operateDepart) throws Exception{ String IPCType = "operateDepart"; String path = url + "/operate/depart"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("OrderId", operateDepart.getOrderId());//订单号 jsonObject.put("LicenseId", null != operateDepart.getLicenseId() ? operateDepart.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("FareType", operateDepart.getFareType());//运价类型编码 jsonObject.put("VehicleNo", operateDepart.getVehicleNo());//车辆号牌 jsonObject.put("DepLongitude", Double.valueOf(operateDepart.getDepLongitude() * 1000000).intValue());//车辆出发经度 jsonObject.put("DepLatitude", Double.valueOf(operateDepart.getDepLatitude() * 1000000).intValue());//车辆出发纬度 jsonObject.put("Encrypt", operateDepart.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) jsonObject.put("DepTime", Long.valueOf(sdf.format(operateDepart.getDepTime())));//上车时间YYYYMMDDhhmmss jsonObject.put("WaitMile", operateDepart.getWaitMile());//空驶里程(km) jsonObject.put("WaitTime", operateDepart.getWaitTime());//等待时间(秒) data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/operate/depart\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【 经营出发】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【经营出发】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 经营到达接口 */ public String operateArrive(OperateArrive operateArrive) throws Exception{ String IPCType = "operateArrive"; String path = url + "/operate/arrive"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("OrderId", operateArrive.getOrderId());//订单号 jsonObject.put("DestLongitude", Double.valueOf(operateArrive.getDestLongitude() * 1000000).intValue());//车辆到达经度 jsonObject.put("DestLatitude", Double.valueOf(operateArrive.getDestLatitude() * 1000000).intValue());//车辆到达纬度 jsonObject.put("Encrypt", operateArrive.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) jsonObject.put("DestTime", Long.valueOf(sdf.format(operateArrive.getDestTime())));//下车时间YYYYMMDDhhmmss jsonObject.put("DriveMile", operateArrive.getDriveMile());//载客里程(km) jsonObject.put("DriveTime", operateArrive.getDriveTime());//载客时间(秒) data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/operate/arrive\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【经营到达】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【经营到达】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 经营支付接口 */ public String operatePay(OperatePay operatePay) throws Exception{ String IPCType = "operatePay"; String path = url + "/operate/pay"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("OrderId", operatePay.getOrderId());//订单号 jsonObject.put("OnArea", operatePay.getOnArea());//上车位置行政区划代码 jsonObject.put("DriverName", operatePay.getDriverName());//机动车驾驶员 jsonObject.put("LicenseId", null != operatePay.getLicenseId() ? operatePay.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("FareType", operatePay.getFareType());//运价类型编码(由网约车公司定义,与运价信息接口保持一街) jsonObject.put("VehicleNo", operatePay.getVehicleNo());//车辆号牌 jsonObject.put("BookDepTime", Long.valueOf(sdf.format(operatePay.getBookDepTime())));//预计上车时间YYYYMMDDhhmmss jsonObject.put("WaitTime", operatePay.getWaitTime());//等待时间(秒) jsonObject.put("DepLongitude", Double.valueOf(operatePay.getDepLongitude() * 1000000).intValue());//车辆出发经度 jsonObject.put("DepLatitude", Double.valueOf(operatePay.getDepLatitude() * 1000000).intValue());//车辆出发纬度 jsonObject.put("DepArea", operatePay.getDepArea());//上车点 jsonObject.put("DepTime", Long.valueOf(sdf.format(operatePay.getDepTime())));//上车时间YYYYMMDDhhmmss jsonObject.put("DestLongitude", Double.valueOf(operatePay.getDestLongitude() * 1000000).intValue());//车辆到达经度 jsonObject.put("DestLatitude", Double.valueOf(operatePay.getDestLatitude() * 1000000).intValue());//车辆到达纬度 jsonObject.put("DestArea", operatePay.getDestArea());//下车地点 jsonObject.put("DestTime", Long.valueOf(sdf.format(operatePay.getDestTime())));//下车时间YYYYMMDDhhmmss jsonObject.put("BookModel", operatePay.getBookModel());//预定车型 jsonObject.put("Model", operatePay.getModel());//实际使用车型 jsonObject.put("DriveMile", operatePay.getDriveMile());//载客里程(km) jsonObject.put("DriveTime", operatePay.getDriveTime());//载客时间(秒) jsonObject.put("WaitMile", operatePay.getWaitMile());//空驶里程(km) jsonObject.put("FactPrice", operatePay.getFactPrice());//实收金额(元) jsonObject.put("Price", operatePay.getPrice());//应收金额(元) jsonObject.put("CashPrice", operatePay.getCashPrice());//现金支付金额(元) jsonObject.put("LineName", operatePay.getLineName());//电子支付机构 jsonObject.put("LinePrice", operatePay.getLinePrice());//电子支付金额(元) jsonObject.put("PosName", operatePay.getPosName());//POS机支付机构 jsonObject.put("PosPrice", operatePay.getPosPrice());//POS机支付金额(元) jsonObject.put("BenfitPrice", operatePay.getBenfitPrice());//优惠金额(元) jsonObject.put("BookTip", operatePay.getBookTip());//预约服务费(元) jsonObject.put("PassengerTip", operatePay.getPassengerTip());//附加费(元) jsonObject.put("PeakUpPrice", operatePay.getPeakUpPrice());//高峰时段时间加价金额(元) jsonObject.put("NightUpPrice", operatePay.getNightUpPrice());//夜间时段里程加价金额(元) jsonObject.put("FarUpPrice", operatePay.getFarUpPrice());//远途加价金额(元) jsonObject.put("OtherUpPrice", operatePay.getOtherUpPrice());//其他加价金额(元) jsonObject.put("PayState", operatePay.getPayState());//结算状态(0:未结算,1:已结算,2:未知) jsonObject.put("PayTime", Long.valueOf(sdf.format(operatePay.getPayTime())));//乘客结算时间YYYYMMDDhhmmss jsonObject.put("OrderMatchTime", Long.valueOf(sdf.format(operatePay.getOrderMatchTime())));//订单完成时间YYYYMMDDhhmmss jsonObject.put("InvoiceStatus", operatePay.getInvoiceStatus());//发票状态(0:未开票,1:已开票,2:未知) data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/operate/pay\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【经营支付接口】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【经营支付接口】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 驾驶员定位信息 */ public String positionDriver(PositionDriver positionDriver) throws Exception{ String IPCType = "positionDriver"; String path = url + "/position/driver"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("LicenseId", null != positionDriver.getLicenseId() ? positionDriver.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("DriverRegionCode", positionDriver.getDriverRegionCode());//行政区划代码 jsonObject.put("VehicleNo", positionDriver.getVehicleNo());//车辆号牌 jsonObject.put("PositionTime", positionDriver.getPositionTime());//定位时间(时间戳) jsonObject.put("Longitude", Double.valueOf(positionDriver.getLongitude() * 1000000).intValue());//经度 jsonObject.put("Latitude", Double.valueOf(positionDriver.getLatitude() * 1000000).intValue());//纬度 jsonObject.put("Encrypt", positionDriver.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) jsonObject.put("Direction", positionDriver.getDirection().intValue());//方向角 jsonObject.put("Elevation", positionDriver.getElevation().intValue());//海拔高度 jsonObject.put("Speed", positionDriver.getSpeed());//瞬时速度(km/h) jsonObject.put("BizStatus", positionDriver.getBizStatus());//营运状态(1:载客,2:接单,3:空驶,4:停运) jsonObject.put("OrderId", positionDriver.getOrderId());//订单编号 data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/position/driver\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【驾驶员定位信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【驾驶员定位信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 车辆定位信息 */ public String positionVehicle(PositionVehicle positionVehicle) throws Exception{ String IPCType = "positionVehicle"; String path = url + "/position/vehicle"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("VehicleNo", positionVehicle.getVehicleNo());//车辆号牌 jsonObject.put("VehicleRegionCode", positionVehicle.getVehicleRegionCode());//行政区划代码 jsonObject.put("PositionTime", positionVehicle.getPositionTime());//定位时间(时间戳) jsonObject.put("Longitude", Double.valueOf(positionVehicle.getLongitude() * 1000000).intValue());//经度 jsonObject.put("Latitude", Double.valueOf(positionVehicle.getLatitude() * 1000000).intValue());//纬度 jsonObject.put("Speed", positionVehicle.getSpeed());//瞬时速度(km/h) jsonObject.put("Direction", positionVehicle.getDirection().intValue());//方向角 jsonObject.put("Elevation", positionVehicle.getElevation().intValue());//海拔高度 jsonObject.put("Mileage", positionVehicle.getMileage());//行驶里程(KM) jsonObject.put("Encrypt", positionVehicle.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) jsonObject.put("WarnStatus", positionVehicle.getWarnStatus());//预警状态 jsonObject.put("VehStatus", positionVehicle.getVehStatus());//车辆状态 jsonObject.put("BizStatus", positionVehicle.getBizStatus());//营运状态(1:载客,2:接单,3:空驶,4:停运) jsonObject.put("OrderId", positionVehicle.getOrderId());//订单编号(非营运状态下填"0") data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/position/vehicle\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【车辆定位信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【车辆定位信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 乘客评价信息 */ public String ratedPassenger(RatedPassenger ratedPassenger) throws Exception{ String IPCType = "ratedPassenger"; String path = url + "/rated/passenger"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("OrderId", ratedPassenger.getOrderId());//订单号 jsonObject.put("EvaluateTime", Long.valueOf(sdf.format(ratedPassenger.getEvaluateTime())));//评价时间YYYYMMDDhhmms jsonObject.put("ServiceScore", ratedPassenger.getServiceScore());//服务满意度(五分制) jsonObject.put("DriverScore", ratedPassenger.getDriverScore());//驾驶员满意度(五分制) jsonObject.put("VehicleScore", ratedPassenger.getVehicleScore());//车辆满意度(五分制) jsonObject.put("Detail", ratedPassenger.getDetail());//评价内容 data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/rated/passenger\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【乘客评价信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【乘客评价信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 乘客投诉信息 */ public String ratedPassengerComplaint(RatedPassengerComplaint ratedPassengerComplaint) throws Exception{ String IPCType = "ratedPassengerComplaint"; String path = url + "/rated/passengercomplaint"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("OrderId", ratedPassengerComplaint.getOrderId());//订单号 jsonObject.put("ComplaintTime", Long.valueOf(sdf.format(ratedPassengerComplaint.getComplaintTime())));//投诉时间YYYYMMDDhhmms jsonObject.put("Detail", ratedPassengerComplaint.getDetail());//投诉内容 jsonObject.put("Result", ratedPassengerComplaint.getResult());//处理结果 data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/rated/passengercomplaint\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【乘客投诉信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【乘客投诉信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 驾驶员处罚信息 */ public String ratedDriverPunish(RatedDriverPunish ratedDriverPunish) throws Exception{ String IPCType = "ratedDriverPunish"; String path = url + "/rated/driverpunish"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("LicenseId", null != ratedDriverPunish.getLicenseId() ? ratedDriverPunish.getLicenseId() : "");//机动车驾驶证编号 jsonObject.put("PunishTime", Long.valueOf(sdf.format(ratedDriverPunish.getPunishTime())));//处罚时间YYYYMMDDhhmms jsonObject.put("PunishReason", ratedDriverPunish.getPunishReason());//处罚原因 jsonObject.put("PunishReault", ratedDriverPunish.getPunishReault());//处罚结果 data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/rated/driverpunish\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【驾驶员处罚信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【驾驶员处罚信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 驾驶员信誉信息 */ public String ratedDriver(RatedDriver ratedDriver) throws Exception{ String IPCType = "ratedDriver"; String path = url + "/rated/driver"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("LicenseId", null != ratedDriver.getLicenseId() ? ratedDriver.getLicenseId() : "");//机动车驾驶证编号 jsonObject.put("Level", ratedDriver.getLevel());//服务质量信誉等级(五分制) jsonObject.put("TestDate", Long.valueOf(sdf2.format(ratedDriver.getTestDate())));//服务质量信誉考核日期YYYYMMDD jsonObject.put("TestDepartment", ratedDriver.getTestDepartment());//服务质量信誉考核机构 data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/rated/driver\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【驾驶员信誉信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【驾驶员信誉信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 私人小客车合乘信息服务平台基本信息 */ public String shareCompany(ShareCompany shareCompany) throws Exception{ String IPCType = "shareCompany"; String path = url + "/share/company"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("CompanyName", shareCompany.getCompanyName());//公司名称 jsonObject.put("Identifier", shareCompany.getIdentifier());//统一社会信用代码 jsonObject.put("Address", shareCompany.getAddress());//注册地行政区划代码 jsonObject.put("ContactAddress", shareCompany.getContactAddress());//通信地址 jsonObject.put("EconomicType", shareCompany.getEconomicType());//经营业户经济类型 jsonObject.put("LegalName", shareCompany.getLegalName());//法人代表姓名(按照营业执照填写) jsonObject.put("LegalPhone", shareCompany.getLegalPhone());//法人代表电话 jsonObject.put("State", 0);//状态(0:有效,1:失效) jsonObject.put("Flag", shareCompany.getFlag());//操作标识(1:新增,2:更新,3:删除) jsonObject.put("UpdateTime", Long.valueOf(sdf.format(shareCompany.getUpdateTime())));//更新时间YYYYMMDDhhmmss data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/share/company\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【私人小客车合乘信息服务平台基本信息】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【私人小客车合乘信息服务平台基本信息】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 私人小客车合乘驾驶员行程发布接口 */ public String shareRoute(ShareRoute shareRoute) throws Exception{ String IPCType = "shareRoute"; String path = url + "/share/route"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", shareRoute.getAddress());//行政区划代码 jsonObject.put("RouteId", shareRoute.getRouteId());//驾驶员发起行程编号 jsonObject.put("DriverName", shareRoute.getDriverName());//驾驶员姓名 jsonObject.put("DriverPhone", shareRoute.getDriverPhone());//驾驶员手机号 jsonObject.put("LicenseId", null != shareRoute.getLicenseId() ? shareRoute.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("VehicleNo", shareRoute.getVehicleNo());//车辆号牌 jsonObject.put("Departure", shareRoute.getDeparture());//行程出发地点 jsonObject.put("DepLongitude", Double.valueOf(shareRoute.getDepLongitude() * 1000000).intValue());//车辆出发经度 jsonObject.put("DepLatitude", Double.valueOf(shareRoute.getDepLatitude() * 1000000).intValue());//车辆出发纬度 jsonObject.put("Destination", shareRoute.getDestination());//行程到达地点 jsonObject.put("DestLongitude", Double.valueOf(shareRoute.getDestLongitude() * 1000000).intValue());//到达地经度 jsonObject.put("DestLatitude", Double.valueOf(shareRoute.getDestLatitude() * 1000000).intValue());//到达纬度 jsonObject.put("Encrypt", shareRoute.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) jsonObject.put("RouteCreateTime", Long.valueOf(sdf.format(shareRoute.getRouteCreateTime())));//行程发布时间YYYYMMDDhhmmss jsonObject.put("RouteMile", shareRoute.getRouteMile());//行程预计里程(km) jsonObject.put("RouteNote", shareRoute.getRouteNote());//行程备注 data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/share/route\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【私人小客车合乘驾驶员行程发布】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【私人小客车合乘驾驶员行程发布】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 私人小客车合乘订单接口 */ public String shareOrder(ShareOrder shareOrder) throws Exception{ String IPCType = "shareOrder"; String path = url + "/share/order"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", shareOrder.getAddress());//行政区划代码 jsonObject.put("RouteId", shareOrder.getRouteId());//驾驶员发起行程编号 jsonObject.put("OrderId", shareOrder.getOrderId());//乘客合乘订单号 jsonObject.put("BookDepartTime", Integer.valueOf(sdf.format(shareOrder.getBookDepartTime())));//预计上车时间YYYYMMDDhhmmss jsonObject.put("Departure", shareOrder.getDeparture());//预计上车地点 jsonObject.put("DepLongitude", Double.valueOf(shareOrder.getDepLongitude() * 1000000).intValue());//预计上车地点经度 jsonObject.put("DepLatitude", Double.valueOf(shareOrder.getDepLatitude() * 1000000).intValue());//预计上车地点纬度 jsonObject.put("Destination", shareOrder.getDestination());//预计下车地点 jsonObject.put("DestLongitude", Double.valueOf(shareOrder.getDestLongitude() * 1000000).intValue());//预计下车地点经度 jsonObject.put("DestLatitude", Double.valueOf(shareOrder.getDestLatitude() * 1000000).intValue());//预计下车地点纬度 jsonObject.put("Encrypt", shareOrder.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) jsonObject.put("OrderEnsureTime", Integer.valueOf(sdf.format(shareOrder.getOrderEnsureTime())));//订单确认时间YYYYMMDDhhmmss jsonObject.put("PassengerNum", shareOrder.getPassengerNum());//乘客人数 jsonObject.put("PassengerNote", shareOrder.getPassengerNote());//乘客备注 data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/share/order\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【私人小客车合乘订单】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【私人小客车合乘订单】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 私人小客车合乘订单支付接口 */ public String sharePay(SharePay sharePay) throws Exception{ String IPCType = "sharePay"; String path = url + "/share/pay"; JSONObject data = new JSONObject(true); JSONObject jsonObject = new JSONObject(true); jsonObject.put("CompanyId", CompanyId); jsonObject.put("Address", sharePay.getAddress());//行政区划代码 jsonObject.put("RouteId", sharePay.getRouteId());//驾驶员发起行程编号 jsonObject.put("OrderId", sharePay.getOrderId());//乘客合乘订单号 jsonObject.put("DriverPhone", sharePay.getDriverPhone());//驾驶员手机号 jsonObject.put("LicenseId", null != sharePay.getLicenseId() ? sharePay.getLicenseId() : "");//机动车驾驶证号 jsonObject.put("VehicleNo", sharePay.getVehicleNo());//车辆号牌 jsonObject.put("FareType", sharePay.getFareType());//运价类型编码 jsonObject.put("BookDepartTime", Integer.valueOf(sdf.format(sharePay.getBookDepartTime())));//预计上车时间YYYYMMDDhhmmss jsonObject.put("DepartTime", Integer.valueOf(sdf.format(sharePay.getDepartTime())));//实际上车时间YYYYMMDDhhmmss jsonObject.put("Departure", sharePay.getDeparture());//上车地点 jsonObject.put("DepLongitude", Double.valueOf(sharePay.getDepLongitude() * 1000000).intValue());//上车地点经度 jsonObject.put("DepLatitude", Double.valueOf(sharePay.getDepLatitude() * 1000000).intValue());//上车地点纬度 jsonObject.put("DestTime", Integer.valueOf(sdf.format(sharePay.getDestTime())));//下车时间YYYYMMDDhhmmss jsonObject.put("Destination", sharePay.getDestination());//下车地点 jsonObject.put("DestLongitude", Double.valueOf(sharePay.getDestLongitude() * 1000000).intValue());//下车地点经度 jsonObject.put("DestLatitude", Double.valueOf(sharePay.getDestLatitude() * 1000000).intValue());//下车地点纬度 jsonObject.put("Encrypt", sharePay.getEncrypt());//坐标加密标识(1:GCJ-02测绘局标准,2:WGS84 GPS标准,3:BD-09百度标准,4:CGCS2000北斗标准,0:其他) jsonObject.put("DriveMile", sharePay.getDriveMile());//载客里程(km) jsonObject.put("DriveTime", sharePay.getDriveTime());//载客时间(秒) jsonObject.put("FactPrice", sharePay.getFactPrice());//实收金额(元) jsonObject.put("Price", sharePay.getPrice());//应收金额(元) jsonObject.put("CashPrice", sharePay.getCashPrice());//现金支付金额(元) jsonObject.put("LineName", sharePay.getLineName());//电子支付机构 jsonObject.put("LinePrice", sharePay.getLinePrice());//电子支付金额(元) jsonObject.put("BenfitPrice", sharePay.getBenfitPrice());//优惠金额(元) jsonObject.put("ShareFuelFee", sharePay.getShareFuelFee());//燃料成本分摊金额(元) jsonObject.put("ShareHighwayToll", sharePay.getShareHighwayToll());//路桥通行分摊金额(元) jsonObject.put("PassengerTip", sharePay.getPassengerTip());//附加费(元) jsonObject.put("ShareOther", sharePay.getShareOther());//其他费用分摊金额(元) jsonObject.put("PayState", sharePay.getPayState());//结算状态(0:未结算,1:已结算,2:未知) jsonObject.put("PassengerNum", sharePay.getPassengerNum());//乘客人数 jsonObject.put("PayTime", Integer.valueOf(sdf.format(sharePay.getPayTime())));//乘客结算时间YYYYMMDDhhmmss jsonObject.put("OrderMatchTime", Integer.valueOf(sdf.format(sharePay.getOrderMatchTime())));//订单完成时间YYYYMMDDhhmmss data.put("CompanyId", CompanyId); data.put("Source", Source); data.put("IPCType", IPCType); data.put(IPCType, jsonObject); logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/share/pay\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8"); logger.info(sdf.format(new Date()) + "【私人小客车合乘订单支付】请求:\n" + path + "\n" + "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue)); Map map = sendPost_JSON(path, data); Integer code = Integer.valueOf(map.get("code").toString()); String msg = map.get("msg").toString(); logger.info("【私人小客车合乘订单支付】响应:\n【"+ code + "】" + msg); analysisResult(code); HttpResult httpResult = new HttpResult(); httpResult.setCode(code); httpResult.setData(msg); return JSON.toJSONString(httpResult); } /** * 处理返回结果 */ private void analysisResult(Integer code){ if(code == 0){ logger.info("接口请求失败!"); } if(code == 200){ logger.info("(成功)服务器已成功处理了请求"); } if(code == 201){ logger.info("请求已经完成并一个新的返回资源被创建"); } if(code == 400){ logger.info("(错误请求)服务器不理解请求的语法"); } if(code == 401){ logger.info("(未授权)请求要求身份验证"); } if(code == 403){ logger.info("(禁止)服务器拒绝请求"); } if(code == 404){ logger.info("(未找到)服务器找不到请求的网页"); } if(code == 500){ logger.info("服务器遭遇异常阻止了当前请求的执行"); } if(code == 502){ logger.info("(错误网关)服务器作为网关或代理,从上游服务器收到无效响应"); } if(code == 702){ logger.info("请求文件不存在"); } if(code == 948){ logger.info("请求文件名格式不正确"); } if(code == 949){ logger.info("文件解压失败"); } if(code == 952){ logger.info("格式校验失败"); } if(code == 1000){ logger.info("请求异常"); } } public Map sendPost_JSON(String url, JSONObject obj) { Map map = new HashMap<>(); HttpRequest post = HttpUtil.createPost(url); post.header("Connection", "keep-alive"); post.header("Content-Type", "application/json"); post.header("Accept-Encoding", "gzip"); post.header("Accept-Charset", "utf-8"); post.body(obj.toJSONString()); try { HttpResponse execute = post.execute(); int status = execute.getStatus(); map.put("code", status); map.put("msg", execute.body()); return map; }catch (Exception e){ e.printStackTrace(); } map.put("code", 0); map.put("msg", ""); return map; } }