| | |
| | | if (gearLevel == null || gearLevel != 4) { |
| | | throw new ServiceException("车辆非P档,无法操作后备箱", I18nKeyConstant.VEHICLE_NOT_P_GEAR); |
| | | } |
| | | if(xpOrder.getOpenTrunk()==0){ |
| | | xpOrder.setOpenTrunk(1); |
| | | vehiclesCommandVo.setCommandCode(VehiclesCommandEnum.DOOR_TRUNK_OPEN.getCommand()); |
| | | } |
| | | if(xpOrder.getOpenTrunk()==1) { |
| | | //查询后备箱开关状态 |
| | | VehicleTemperatureDto vehicleTemperatureDto = vehicleControlUtil.queryVehicleTemperature(String.valueOf(xpOrder.getAppUserId()), xpVehicle.getVehicleVin()); |
| | | VehicleStateVo trunkAjarCloseSt = vehicleTemperatureDto.getStateMap().get("trunkAjarCloseSt"); |
| | | //打开状态 |
| | | if(null != trunkAjarCloseSt && trunkAjarCloseSt.getValue().equals("1")){ |
| | | xpOrder.setOpenTrunk(2); |
| | | vehiclesCommandVo.setCommandCode(VehiclesCommandEnum.DOOR_TRUNK_CLOSE.getCommand()); |
| | | }else{ |
| | | //关闭状态 |
| | | xpOrder.setOpenTrunk(1); |
| | | vehiclesCommandVo.setCommandCode(VehiclesCommandEnum.DOOR_TRUNK_OPEN.getCommand()); |
| | | } |
| | | } |
| | | try { |
| | |
| | | //} |
| | | String result = vehicleControlUtil.vehiclesCommand(vehiclesCommandVo, xpOrder.getAppUserId()); |
| | | log.info("车辆控制结果:{}", result); |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code != 0) { |
| | | if (!result.contains("msgId")) { |
| | | return 0; |
| | | }else { |
| | | xpOrderClient.updateOrder(xpOrder); |
| | |
| | | vehiclesCommandVo.setExtParam(vehiclesCommandParamVo); |
| | | try { |
| | | String result = vehicleControlUtil.vehiclesCommand(vehiclesCommandVo, xpOrder.getAppUserId()); |
| | | log.info("车辆控制结果:{}", result); |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | String msgId = jsonObject.getString("msgId"); |
| | | if (StringUtils.isEmpty(msgId)) { |
| | | log.info("车辆温度设置结果:{}", result); |
| | | if (!result.contains("msgId")) { |
| | | return 0; |
| | | }else { |
| | | return 1; |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("车辆控制异常:{}", e.getMessage()); |
| | | log.info("车辆温度设置异常:{}", e.getMessage()); |
| | | return 0; |
| | | } |
| | | } |