| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.lang.Validator; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | |
| | | */ |
| | | @ApiOperation(value = "车辆详情", tags = {"管理后台-车辆管理-在库车辆管理"}) |
| | | @GetMapping("/api/v1/vehicle/queryById") |
| | | public R<XpVehicle> getVehicleDetail(@ApiParam(value = "车辆id", required = true) @RequestParam Long id) { |
| | | return R.ok(xpVehicleService.getVehicleDetail(id)); |
| | | public R<XpVehicle> getVehicleDetail(@ApiParam(value = "车辆id", required = true) @RequestParam Long id) throws UnsupportedEncodingException { |
| | | XpVehicle vehicleDetail = xpVehicleService.getVehicleDetail(id); |
| | | if(vehicleDetail.getVehiclePictures()!=null){ |
| | | JSONObject jsonObject = JSONObject.parseObject(vehicleDetail.getVehiclePictures()); |
| | | String downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | jsonObject.put("url",downloadUrl); |
| | | String jsonString = jsonObject.toJSONString(); |
| | | vehicleDetail.setVehiclePictures(jsonString); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.ok(xpVehicleAnnualRecordService.queryTaskRoutineByVehicleId(query)); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | String inspectionAttachments = "[{\"id\": \"d57c4ac4-acb0-451b-8e94-70f226331e0c\", \"url\": \"https://huishou-1323682843.cos.ap-nanjing.myqcloud.com/images/552a3a31-e4dd-4a28-8748-fd8b87dd3055.png\", \"name\": \"测试.jpg\"}]"; |
| | | |
| | | if (StringUtils.isNotBlank(inspectionAttachments)) { |
| | | JSONArray jsonArray = JSONArray.parseArray(inspectionAttachments); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | jsonObject.put("url", "downloadUrl"); |
| | | } |
| | | |
| | | String jsonString = JSONArray.toJSONString(jsonArray); |
| | | |
| | | System.out.println(jsonString); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 根据围栏id查询空闲车辆 |
| | | * |