1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | package api.jisuapi.car; import api.util.HttpUtil; import net.sf.json.JSONObject; public class Detail { public static final String APPKEY = "your_appkey_here" ; // 你的appkey public static final String URL = "https://api.jisuapi.com/car/detail" ; public static final int carid = 2571 ; // 车ID public static void Get() { String result = null ; String url = URL + "?appkey=" + APPKEY + "&carid=" + carid; try { result = HttpUtil.sendGet(url, "utf-8" ); JSONObject json = JSONObject.fromObject(carid); if (json.getInt( "status" ) != 0 ) { System.out.println(json.getString( "msg" )); } else { JSONObject resultarr = json.optJSONObject( "result" ); String id = resultarr.getString( "id" ); String name = resultarr.getString( "name" ); String initial = resultarr.getString( "initial" ); String parentid = resultarr.getString( "parentid" ); String logo = resultarr.getString( "logo" ); String price = resultarr.getString( "price" ); String yeartype = resultarr.getString( "yeartype" ); String productionstate = resultarr.getString( "productionstate" ); String salestate = resultarr.getString( "salestate" ); String sizetype = resultarr.getString( "sizetype" ); String depth = resultarr.getString( "depth" ); System.out.println(id + " " + name + " " + initial + " " + parentid + " " + logo + " " + price + " " + yeartype + " " + productionstate + " " + salestate + " " + sizetype + " " + depth); if (resultarr.opt( "basic" ) != null ) { JSONObject basic = resultarr.optJSONObject( "basic" ); String price1 = basic.getString( "price" ); String saleprice = basic.getString( "saleprice" ); String warrantypolicy = basic.getString( "warrantypolicy" ); String vechiletax = basic.getString( "vechiletax" ); String displacement = basic.getString( "displacement" ); String gearbox = basic.getString( "gearbox" ); String comfuelconsumption = basic.getString( "comfuelconsumption" ); String userfuelconsumption = basic.getString( "userfuelconsumption" ); String officialaccelerationtime100 = basic.getString( "officialaccelerationtime100" ); String testaccelerationtime100 = basic.getString( "testaccelerationtime100" ); String maxspeed = basic.getString( "maxspeed" ); String seatnum = basic.getString( "seatnum" ); System.out.println( "基本信息:" + price1 + " " + saleprice + " " + warrantypolicy + " " + vechiletax + " " + displacement + " " + gearbox + " " + comfuelconsumption + " " + userfuelconsumption + " " + officialaccelerationtime100 + " " + testaccelerationtime100 + " " + maxspeed + " " + seatnum); } if (resultarr.opt( "body" ) != null ) { JSONObject body = resultarr.optJSONObject( "body" ); String color = body.getString( "color" ); String len = body.getString( "len" ); String width = body.getString( "width" ); String height = body.getString( "height" ); String wheelbase = body.getString( "wheelbase" ); String fronttrack = body.getString( "fronttrack" ); String reartrack = body.getString( "reartrack" ); String weight = body.getString( "weight" ); String fullweight = body.getString( "fullweight" ); String mingroundclearance = body.getString( "mingroundclearance" ); String approachangle = body.getString( "approachangle" ); String departureangle = body.getString( "departureangle" ); String luggagevolume = body.getString( "luggagevolume" ); String luggagemode = body.getString( "luggagemode" ); String luggageopenmode = body.getString( "luggageopenmode" ); String inductionluggage = body.getString( "inductionluggage" ); String doornum = body.getString( "doornum" ); String tooftype = body.getString( "tooftype" ); String hoodtype = body.getString( "hoodtype" ); String roofluggagerack = body.getString( "roofluggagerack" ); String sportpackage = body.getString( "sportpackage" ); System.out.println( "车体:" + color + " " + len + " " + width + " " + height + " " + wheelbase + " " + fronttrack + " " + reartrack + " " + weight + " " + fullweight + " " + mingroundclearance + " " + approachangle + " " + departureangle + " " + luggagevolume + " " + luggagemode + " " + luggageopenmode + " " + inductionluggage + " " + doornum + " " + tooftype + " " + hoodtype + " " + roofluggagerack + " " + sportpackage); } if (resultarr.opt( "engine" ) != null ) { JSONObject engine = resultarr.optJSONObject( "engine" ); String position = engine.getString( "position" ); String model = engine.getString( "model" ); String displacement = engine.getString( "displacement" ); String displacementml = engine.getString( "displacementml" ); String intakeform = engine.getString( "intakeform" ); String cylinderarrangetype = engine.getString( "cylinderarrangetype" ); String cylindernum = engine.getString( "cylindernum" ); String valvetrain = engine.getString( "valvetrain" ); String valvestructure = engine.getString( "valvestructure" ); String compressionratio = engine.getString( "compressionratio" ); String bore = engine.getString( "bore" ); String stroke = engine.getString( "stroke" ); String maxhorsepower = engine.getString( "maxhorsepower" ); String maxpower = engine.getString( "maxpower" ); String maxpowerspeed = engine.getString( "maxpowerspeed" ); String maxtorque = engine.getString( "maxtorque" ); String maxtorquespeed = engine.getString( "maxtorquespeed" ); String fueltype = engine.getString( "fueltype" ); String fuelgrade = engine.getString( "fuelgrade" ); String fuelmethod = engine.getString( "fuelmethod" ); String fueltankcapacity = engine.getString( "fueltankcapacity" ); String cylinderheadmaterial = engine.getString( "cylinderheadmaterial" ); String cylinderbodymaterial = engine.getString( "cylinderbodymaterial" ); String environmentalstandards = engine.getString( "environmentalstandards" ); String startstopsystem = engine.getString( "startstopsystem" ); System.out.println( "发动机:" + position + " " + model + " " + displacement + " " + displacementml + " " + intakeform + " " + cylinderarrangetype + " " + cylindernum + " " + valvetrain + " " + valvestructure + " " + compressionratio + " " + bore + " " + stroke + " " + maxhorsepower + " " + maxpower + " " + maxpowerspeed + " " + maxtorque + " " + maxtorquespeed + " " + fueltype + " " + fuelgrade + " " + fuelmethod + " " + fueltankcapacity + " " + cylinderheadmaterial + " " + cylinderbodymaterial + " " + environmentalstandards + " " + startstopsystem); } if (resultarr.opt( "gearbox" ) != null ) { JSONObject gearbox = resultarr.optJSONObject( "gearbox" ); String gearbox1 = gearbox.getString( "gearbox" ); String shiftpaddles = gearbox.getString( "shiftpaddles" ); System.out.println( "变速箱:" + gearbox1 + " " + shiftpaddles); } if (resultarr.opt( "chassisbrake" ) != null ) { JSONObject chassisbrake = resultarr.optJSONObject( "chassisbrake" ); String bodystructure = chassisbrake.getString( "bodystructure" ); String powersteering = chassisbrake.getString( "powersteering" ); String frontbraketype = chassisbrake.getString( "frontbraketype" ); String rearbraketype = chassisbrake.getString( "rearbraketype" ); String parkingbraketype = chassisbrake.getString( "parkingbraketype" ); String drivemode = chassisbrake.getString( "drivemode" ); String airsuspension = chassisbrake.getString( "airsuspension" ); String adjustablesuspension = chassisbrake.getString( "adjustablesuspension" ); String frontsuspensiontype = chassisbrake.getString( "frontsuspensiontype" ); String rearsuspensiontype = chassisbrake.getString( "rearsuspensiontype" ); String centerdifferentiallock = chassisbrake.getString( "centerdifferentiallock" ); System.out.println( "底盘制动:" + bodystructure + " " + powersteering + " " + frontbraketype + " " + rearbraketype + " " + parkingbraketype + " " + drivemode + " " + airsuspension + " " + adjustablesuspension + " " + frontsuspensiontype + " " + rearsuspensiontype + " " + centerdifferentiallock); } if (resultarr.opt( "safe" ) != null ) { JSONObject safe = resultarr.optJSONObject( "safe" ); String airbagdrivingposition = safe.getString( "airbagdrivingposition" ); String airbagfrontpassenger = safe.getString( "airbagfrontpassenger" ); String airbagfrontside = safe.getString( "airbagfrontside" ); String airbagfronthead = safe.getString( "airbagfronthead" ); String airbagknee = safe.getString( "airbagknee" ); String airbagrearside = safe.getString( "airbagrearside" ); String airbagrearhead = safe.getString( "airbagrearhead" ); String safetybeltprompt = safe.getString( "safetybeltprompt" ); String safetybeltlimiting = safe.getString( "safetybeltlimiting" ); String safetybeltpretightening = safe.getString( "safetybeltpretightening" ); String frontsafetybeltadjustment = safe.getString( "frontsafetybeltadjustment" ); String rearsafetybelt = safe.getString( "rearsafetybelt" ); String tirepressuremonitoring = safe.getString( "tirepressuremonitoring" ); String zeropressurecontinued = safe.getString( "zeropressurecontinued" ); String centrallocking = safe.getString( "centrallocking" ); String childlock = safe.getString( "childlock" ); String remotekey = safe.getString( "remotekey" ); String keylessentry = safe.getString( "keylessentry" ); String keylessstart = safe.getString( "keylessstart" ); String engineantitheft = safe.getString( "engineantitheft" ); System.out.println( "安全配置:" + airbagdrivingposition + " " + airbagfrontpassenger + " " + airbagfrontside + " " + airbagfronthead + " " + airbagknee + " " + airbagrearside + " " + airbagrearhead + " " + safetybeltprompt + " " + safetybeltlimiting + " " + safetybeltpretightening + " " + frontsafetybeltadjustment + " " + rearsafetybelt + " " + tirepressuremonitoring + " " + zeropressurecontinued + " " + centrallocking + " " + childlock + " " + remotekey + " " + keylessentry + " " + keylessstart + " " + engineantitheft); } if (resultarr.opt( "wheel" ) != null ) { JSONObject wheel = resultarr.optJSONObject( "wheel" ); String fronttiresize = wheel.getString( "fronttiresize" ); String reartiresize = wheel.getString( "reartiresize" ); String sparetiretype = wheel.getString( "sparetiretype" ); String hubmaterial = wheel.getString( "hubmaterial" ); System.out.println( "车轮:" + fronttiresize + " " + reartiresize + " " + sparetiretype + " " + hubmaterial); } if (resultarr.opt( "drivingauxiliary" ) != null ) { JSONObject drivingauxiliary = resultarr.optJSONObject( "drivingauxiliary" ); String abs = drivingauxiliary.getString( "abs" ); String ebd = drivingauxiliary.getString( "ebd" ); String brakeassist = drivingauxiliary.getString( "brakeassist" ); String tractioncontrol = drivingauxiliary.getString( "tractioncontrol" ); String esp = drivingauxiliary.getString( "esp" ); String eps = drivingauxiliary.getString( "eps" ); String automaticparking = drivingauxiliary.getString( "automaticparking" ); String hillstartassist = drivingauxiliary.getString( "hillstartassist" ); String hilldescent = drivingauxiliary.getString( "hilldescent" ); String frontparkingradar = drivingauxiliary.getString( "frontparkingradar" ); String reversingradar = drivingauxiliary.getString( "reversingradar" ); String reverseimage = drivingauxiliary.getString( "reverseimage" ); String panoramiccamera = drivingauxiliary.getString( "panoramiccamera" ); String cruisecontrol = drivingauxiliary.getString( "cruisecontrol" ); String adaptivecruise = drivingauxiliary.getString( "adaptivecruise" ); String gps = drivingauxiliary.getString( "gps" ); String automaticparkingintoplace = drivingauxiliary.getString( "automaticparkingintoplace" ); String ldws = drivingauxiliary.getString( "ldws" ); String activebraking = drivingauxiliary.getString( "activebraking" ); String integralactivesteering = drivingauxiliary.getString( "integralactivesteering" ); String nightvisionsystem = drivingauxiliary.getString( "nightvisionsystem" ); String blindspotdetection = drivingauxiliary.getString( "blindspotdetection" ); System.out.println( "行车辅助:" + abs + " " + ebd + " " + brakeassist + " " + tractioncontrol + " " + esp + " " + eps + " " + automaticparking + " " + hillstartassist + " " + hilldescent + " " + frontparkingradar + " " + reversingradar + " " + reverseimage + " " + panoramiccamera + " " + cruisecontrol + " " + adaptivecruise + " " + gps + " " + automaticparkingintoplace + " " + ldws + " " + activebraking + " " + integralactivesteering + " " + nightvisionsystem + " " + blindspotdetection); } if (resultarr.opt( "doormirror" ) != null ) { JSONObject doormirror = resultarr.optJSONObject( "doormirror" ); String openstyle = doormirror.getString( "openstyle" ); String electricwindow = doormirror.getString( "electricwindow" ); String uvinterceptingglass = doormirror.getString( "uvinterceptingglass" ); String privacyglass = doormirror.getString( "privacyglass" ); String antipinchwindow = doormirror.getString( "antipinchwindow" ); String skylightopeningmode = doormirror.getString( "skylightopeningmode" ); String skylightstype = doormirror.getString( "skylightstype" ); String rearwindowsunshade = doormirror.getString( "rearwindowsunshade" ); String rearsidesunshade = doormirror.getString( "rearsidesunshade" ); String rearwiper = doormirror.getString( "rearwiper" ); String sensingwiper = doormirror.getString( "sensingwiper" ); String electricpulldoor = doormirror.getString( "electricpulldoor" ); String rearmirrorwithturnlamp = doormirror.getString( "rearmirrorwithturnlamp" ); String externalmirrormemory = doormirror.getString( "externalmirrormemory" ); String externalmirrorheating = doormirror.getString( "externalmirrorheating" ); String externalmirrorfolding = doormirror.getString( "externalmirrorfolding" ); String externalmirroradjustment = doormirror.getString( "externalmirroradjustment" ); String rearviewmirrorantiglare = doormirror.getString( "rearviewmirrorantiglare" ); String sunvisormirror = doormirror.getString( "sunvisormirror" ); System.out.println( "门窗后视镜:" + openstyle + " " + electricwindow + " " + uvinterceptingglass + " " + privacyglass + " " + antipinchwindow + " " + skylightopeningmode + " " + skylightstype + " " + rearwindowsunshade + " " + rearsidesunshade + " " + rearwiper + " " + sensingwiper + " " + electricpulldoor + " " + rearmirrorwithturnlamp + " " + externalmirrormemory + " " + externalmirrorheating + " " + externalmirrorfolding + " " + externalmirroradjustment + " " + rearviewmirrorantiglare + " " + sunvisormirror); } if (resultarr.opt( "light" ) != null ) { JSONObject light = resultarr.optJSONObject( "light" ); String light1 = light.getString( "light" ); String headlighttype = light.getString( "headlighttype" ); String optionalheadlighttype = light.getString( "optionalheadlighttype" ); String headlightautomaticopen = light.getString( "headlightautomaticopen" ); String headlightautomaticclean = light.getString( "headlightautomaticclean" ); String headlightdelayoff = light.getString( "headlightdelayoff" ); String headlightdynamicsteering = light.getString( "headlightdynamicsteering" ); String headlightilluminationadjustment = light.getString( "headlightilluminationadjustment" ); String headlightdimming = light.getString( "headlightdimming" ); String frontfoglight = light.getString( "frontfoglight" ); String readinglight = light.getString( "readinglight" ); String interiorairlight = light.getString( "interiorairlight" ); String daytimerunninglight = light.getString( "daytimerunninglight" ); String ledtaillight = light.getString( "ledtaillight" ); String lightsteeringassist = light.getString( "lightsteeringassist" ); System.out.println( "灯光:" + light1 + " " + headlighttype + " " + optionalheadlighttype + " " + headlightautomaticopen + " " + headlightautomaticclean + " " + headlightdelayoff + " " + headlightdynamicsteering + " " + headlightilluminationadjustment + " " + headlightdimming + " " + frontfoglight + " " + readinglight + " " + interiorairlight + " " + daytimerunninglight + " " + ledtaillight + " " + lightsteeringassist); } if (resultarr.opt( "internalconfig" ) != null ) { JSONObject internalconfig = resultarr.optJSONObject( "internalconfig" ); String steeringwheelbeforeadjustment = internalconfig.getString( "steeringwheelbeforeadjustment" ); String steeringwheelupadjustment = internalconfig.getString( "steeringwheelupadjustment" ); String steeringwheeladjustmentmode = internalconfig.getString( "steeringwheeladjustmentmode" ); String steeringwheelmemory = internalconfig.getString( "steeringwheelmemory" ); String steeringwheelmaterial = internalconfig.getString( "steeringwheelmaterial" ); String steeringwheelmultifunction = internalconfig.getString( "steeringwheelmultifunction" ); String steeringwheelheating = internalconfig.getString( "steeringwheelheating" ); String computerscreen = internalconfig.getString( "computerscreen" ); String huddisplay = internalconfig.getString( "huddisplay" ); String interiorcolor = internalconfig.getString( "interiorcolor" ); String rearcupholder = internalconfig.getString( "rearcupholder" ); String supplyvoltage = internalconfig.getString( "supplyvoltage" ); System.out.println( "内部配置:" + steeringwheelbeforeadjustment + " " + steeringwheelupadjustment + " " + steeringwheeladjustmentmode + " " + steeringwheelmemory + " " + steeringwheelmaterial + " " + steeringwheelmultifunction + " " + steeringwheelheating + " " + computerscreen + " " + huddisplay + " " + interiorcolor + " " + rearcupholder + " " + supplyvoltage); } if (resultarr.opt( "seat" ) != null ) { JSONObject seat = resultarr.optJSONObject( "seat" ); String sportseat = seat.getString( "sportseat" ); String seatmaterial = seat.getString( "seatmaterial" ); String seatheightadjustment = seat.getString( "seatheightadjustment" ); String driverseatadjustmentmode = seat.getString( "driverseatadjustmentmode" ); String auxiliaryseatadjustmentmode = seat.getString( "auxiliaryseatadjustmentmode" ); String driverseatlumbarsupportadjustment = seat.getString( "driverseatlumbarsupportadjustment" ); String driverseatshouldersupportadjustment = seat.getString( "driverseatshouldersupportadjustment" ); String frontseatheadrestadjustment = seat.getString( "frontseatheadrestadjustment" ); String rearseatadjustmentmode = seat.getString( "rearseatadjustmentmode" ); String rearseatreclineproportion = seat.getString( "rearseatreclineproportion" ); String rearseatangleadjustment = seat.getString( "rearseatangleadjustment" ); String frontseatcenterarmrest = seat.getString( "frontseatcenterarmrest" ); String rearseatcenterarmrest = seat.getString( "rearseatcenterarmrest" ); String seatventilation = seat.getString( "seatventilation" ); String seatheating = seat.getString( "seatheating" ); String seatmassage = seat.getString( "seatmassage" ); String electricseatmemory = seat.getString( "electricseatmemory" ); String childseatfixdevice = seat.getString( "childseatfixdevice" ); String thirdrowseat = seat.getString( "thirdrowseat" ); System.out.println( "座椅:" + sportseat + " " + seatmaterial + " " + seatheightadjustment + " " + driverseatadjustmentmode + " " + auxiliaryseatadjustmentmode + " " + driverseatlumbarsupportadjustment + " " + driverseatshouldersupportadjustment + " " + frontseatheadrestadjustment + " " + rearseatadjustmentmode + " " + rearseatreclineproportion + " " + rearseatangleadjustment + " " + frontseatcenterarmrest + " " + rearseatcenterarmrest + " " + seatventilation + " " + seatheating + " " + seatmassage + " " + electricseatmemory + " " + childseatfixdevice + " " + thirdrowseat); } if (resultarr.opt( "entcom" ) != null ) { JSONObject entcom = resultarr.optJSONObject( "entcom" ); String locationservice = entcom.getString( "locationservice" ); String bluetooth = entcom.getString( "bluetooth" ); String externalaudiointerface = entcom.getString( "externalaudiointerface" ); String builtinharddisk = entcom.getString( "builtinharddisk" ); String cartv = entcom.getString( "cartv" ); String speakernum = entcom.getString( "speakernum" ); String audiobrand = entcom.getString( "audiobrand" ); String dvd = entcom.getString( "dvd" ); String cd = entcom.getString( "cd" ); String consolelcdscreen = entcom.getString( "consolelcdscreen" ); String rearlcdscreen = entcom.getString( "rearlcdscreen" ); System.out.println( "娱乐通讯:" + locationservice + " " + bluetooth + " " + externalaudiointerface + " " + builtinharddisk + " " + cartv + " " + speakernum + " " + audiobrand + " " + dvd + " " + cd + " " + consolelcdscreen + " " + rearlcdscreen); } if (resultarr.opt( "aircondrefrigerator" ) != null ) { JSONObject aircondrefrigerator = resultarr.optJSONObject( "aircondrefrigerator" ); String airconditioningcontrolmode = aircondrefrigerator.getString( "airconditioningcontrolmode" ); String tempzonecontrol = aircondrefrigerator.getString( "tempzonecontrol" ); String rearairconditioning = aircondrefrigerator.getString( "rearairconditioning" ); String reardischargeoutlet = aircondrefrigerator.getString( "reardischargeoutlet" ); String airconditioning = aircondrefrigerator.getString( "airconditioning" ); String airpurifyingdevice = aircondrefrigerator.getString( "airpurifyingdevice" ); String carrefrigerator = aircondrefrigerator.getString( "carrefrigerator" ); System.out.println( "空调冰箱:" + airconditioningcontrolmode + " " + tempzonecontrol + " " + rearairconditioning + " " + reardischargeoutlet + " " + airconditioning + " " + airpurifyingdevice + " " + carrefrigerator); } if (resultarr.opt( "actualtest" ) != null ) { JSONObject actualtest = resultarr.optJSONObject( "actualtest" ); String accelerationtime100 = actualtest.getString( "accelerationtime100" ); String brakingdistance = actualtest.getString( "brakingdistance" ); System.out.println( "实际测试:" + accelerationtime100 + " " + brakingdistance); } } } catch (Exception e) { e.printStackTrace(); } } } |
Java HTTP请求通用函数
Java Android请求通用函数
© 2015-2025 杭州极速互联科技有限公司 版权所有 浙ICP备17047587号-4 浙公网安备33010502005096 增值电信业务经营许可证:浙B2-20190875