甲方的返回的json结构改变 的处理(与原来的返回对上)

public  static   String analyticalOldResult1(Long xbxOrderId, String body, String vin) {
logger.info("INFO-->VinSingleNewServiceImpl-->analyticalOldResult|INFO = body desc|param:xbxOrderId="+xbxOrderId+"|body="+body);
String sexamp="[{\"Detail\":{\"Basic\":{\"Country\":\"中国\",\"Emission\":\"国Ⅴ\",\"ModelID\":\"172182\",\"BrandType\":\"紧凑型轿车\",\"EndDate\":\"2017-12-31\",\"ProductionState\":\"停产\"},\"Body\":{\"Doors\":\"4\",\"FrontTrack\":\"0\",\"FuelTank\":\"0\",\"Height\":\"1469\",\"Length\":\"4501\",\"MaximumTrunk\":\"0\",\"MinimumGroundClearance\":\"109.0000\",\"RearTrack\":\"0\",\"Seating\":\"5\",\"Trunk\":\"442\",\"Weight\":\"1170\",\"WheelBase\":\"2604\",\"Width\":\"1704\",\"ApproachAngle\":\"0.0000\",\"CarBodyForm\":\"\",\"DepartureAngle\":\"0.0000\",\"DragCoefficient\":\"0.0000\",\"FrontSuspensionLength\":\"0\",\"HoodForm\":\"\",\"HoodOpening\":\"\",\"MaximumMass\":\"0\",\"MinimumTurningDiameter\":\"0.0000\",\"RearSuspensionLength\":\"0\",\"RoofForm\":\"硬顶\"},\"Chassis\":{\"DriveHubDiameter\":\"15\",\"DriveTireHeightAspectRatio\":\"60\",\"DriveTireWidth\":\"185\",\"DrivingMethod\":\"前驱\",\"FWDMethod\":\"\",\"FrontBrake\":\"通风盘\",\"FrontSuspension\":\"麦弗逊式独立悬架\",\"FrontTireSize\":\"185 R15\",\"PowerSteering\":\"电动助力\",\"RearBrake\":\"毂式\",\"RearSuspension\":\"复合扭力梁式非独立悬架\",\"RearTireSize\":\"18560 R15\",\"SpareTire\":\"非全尺寸备胎\",\"Transmission\":\"6档 自动\",\"FrontHubMaterial\":\"\",\"GearMode\":\"地排\",\"RearHubMaterial\":\"\",\"SpareTireHubMaterial\":\"\",\"SpareTireNum\":\"0\",\"SpareTireNumSize\":\"非全尺寸\",\"SteeringSystem\":\"\"},\"Driving\":{\"Acceleration\":\"12.5000\",\"BrakingDistance\":\"0.0000\",\"MaximumGradability\":\"\",\"MaximumSpeed\":\"185\"},\"ElectricMotor\":{\"BatteryCapacity\":\"0\",\"ElectromotorModel\":\"\",\"MaximumMileage\":\"0\",\"MaximumPower\":\"0\",\"PeakTorque\":\"0\"},\"Engine\":{\"AirIntake\":\"自然进气\",\"Compression\":\"0.0000\",\"CylinderBlock\":\"铝合金\",\"CylinderCover\":\"铝合金\",\"CylinderDiameter\":\"0.0000\",\"CylinderNum\":\"4\",\"EngineModel\":\"EA211\",\"EngineStroke\":\"0.0000\",\"EngineType\":\"直列\",\"Exhaust\":\"1498\",\"FuelSupplyMode\":\"多点电喷\",\"FuelType\":\"无铅汽油92#\",\"MaximumPower\":\"81(110)6000\",\"PeakTorque\":\"1503800\",\"ValveNum\":\"4\",\"AdmissionGear\":\"DOHC\",\"ComprehensiveFuelConsumption\":\"5.7000\",\"CoolingSystem\":\"水冷\",\"EngineDescription\":\"\",\"EngineDirection\":\"横向\",\"EngineImportantTechnology\":\"\",\"EngineManufacturer\":\"\",\"EnginePosition\":\"前置\",\"LitrePower\":\"54.0700\"},\"Truck\":{\"AxleNum\":\"0\",\"FrontAxleLoad\":\"0\",\"LoadingSpaceHeight\":\"0\",\"LoadingSpaceLength\":\"0\",\"LoadingSpaceType\":\"\",\"LoadingSpaceWidth\":\"0\",\"MaxGrossMass\":\"0\",\"RearAxleLoad\":\"0\",\"SprinNum\":\"\"}},\"Model\":{\"Displacement\":\"1.5\",\"ID\":\"172182\",\"Name\":\"捷达1.5-AT豪华型(国Ⅴ)\",\"Price\":\"11.9600\",\"TransmissionType\":\"6档 自动\",\"VersionYear\":\"2017\",\"ProductionYear\":\"2017\",\"VersionDate\":\"201612\",\"MergeID\":\"172182\"},\"NewPrice\":{\"ModelID\":\"172182\",\"Price\":\"9.96\"},\"UsedPrice\":{\"BuyPrice\":\"8.09\",\"ModelID\":\"172182\",\"SellPrice\":\"8.90\"},\"Color\":\"糖果白\",\"DiffConfigList\":null,\"EngineNo\":\"059709\",\"GB\":\"FV7150FCBBG\",\"ProductionDate\":\"2017-04-18\"}]";
Map<String,Object> data = new HashMap<String,Object>();
    data.put("CX", "" );
    data.put("PC", ""  );
    data.put("PFBZ","");
    data.put("PP", "");
    data.put("PPID", "");
    data.put("FZRQ", "");
    data.put("VIN", vin);
    data.put("CLXH", "");
    data.put("CSYS", "");
    data.put("SCRQ", "");
    data.put("FDJH", "");
    data.put("CXID", "");
    data.put("PFBZ","");
    data.put("EDZK", "");
    data.put("ZBZL", "");
    data.put("ZZL", "");
    data.put("FDJXH","");
    data.put("GL", "");
    data.put("KXID", "");
    data.put("KXMC", "");
    data.put("PL", "" );
    data.put("YH", "");
    JSONArray dycBodyList = (JSONArray) JSONArray.parse(sexamp);
    JSONObject firstObject = (JSONObject) dycBodyList.get(0);
    if(firstObject!=null)
    {
    Object GB = firstObject.get("GB");
    Object Color = firstObject.get("Color");
    Object ProductionDate = firstObject.get("ProductionDate");
    Object EngineNo = firstObject.get("EngineNo");
    data.put("CLXH", GB);
    data.put("CSYS", Color);
    data.put("SCRQ", ProductionDate);
    data.put("FDJH", EngineNo);
    JSONObject DetailObject = (JSONObject) firstObject.get("Detail");
    if(DetailObject!=null){
    JSONObject Basic= (JSONObject) DetailObject.get("Basic");
    if (Basic!=null) {
    Object ModelID = Basic.get("ModelID");
    Object Emission = Basic.get("Emission");
    data.put("CXID", ModelID);
    data.put("PFBZ", Emission);
}
    JSONObject Body= (JSONObject) DetailObject.get("Body");
    if(Body!=null)
    {
    data.put("EDZK", Body.get("Seating"));
    data.put("ZBZL", Body.get("Weight"));
    data.put("ZZL", Body.get("MaximumMass"));
    }
    JSONObject ElectricMotor= (JSONObject) DetailObject.get("ElectricMotor");
    if(ElectricMotor!=null)
    {
   
    data.put("FDJXH", ElectricMotor.get("ElectromotorModel"));
    data.put("GL", ElectricMotor.get("MaximumPower"));
    }
    }
    JSONObject Model= (JSONObject) firstObject.get("Model");
    if(Model!=null)
    {
   
    data.put("KXID", Model.get("ID"));
    data.put("KXMC", Model.get("Name"));
    data.put("PL", Model.get("Displacement") );
   
    }
    
    JSONObject Engine= (JSONObject) DetailObject.get("Engine");
    if(Engine!=null)
    {
    data.put("YH", Engine.get("ComprehensiveFuelConsumption"));
    }
   
    }
    Map<String, Object> nullToEmpty = MapUtil.nullToEmpty(data);
    String jsonString = JSONObject.toJSONString(nullToEmpty);
String resultBody = "{\"status\": 200,\"statusText\": \"success\",\"data\":" +jsonString.toString()+"}";
    logger.info("INFO-->VinSingleNewServiceImpl(zl)-->analyticalOldResult|INFO = resultBody desc|param:xbxOrderId="+xbxOrderId+"|body="+resultBody);
return resultBody;
}




public static void main(String[] args) {
String analyticalOldResult1 = analyticalOldResult1(1l,"","1234");
System.out.println(analyticalOldResult1);
System.out.println(analyticalOldResult1);

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值