| | |
| | | @GetMapping("{sn}/getMedia/{traceid}") |
| | | public ResponseResult getMedia(@PathVariable String sn, @PathVariable String traceid) { |
| | | |
| | | String timestamp = (Long)RedisOpsUtils.hashGet(RedisConst.COMMANDS_PREFIX + sn + RedisConst.DELIMITER + traceid,traceid) / 1000 * 1000 + ""; |
| | | MediaFileEntity entity = mediaService.getMediaFieByTid(timestamp); |
| | | String url = "https://wrj.shuixiongit.com/minio/cloud-bucket" + entity.getObjectKey(); |
| | | Map ret = new HashMap(); |
| | | ret.put("url", url); |
| | | ret.put("metadata", JSONObject.parseObject(entity.getMetadata().toString())); |
| | | return ResponseResult.success(ret); |
| | | try{ |
| | | String timestamp = (Long)RedisOpsUtils.hashGet(RedisConst.COMMANDS_PREFIX + sn + RedisConst.DELIMITER + traceid,traceid) / 1000 * 1000 + ""; |
| | | MediaFileEntity entity = mediaService.getMediaFieByTid(timestamp); |
| | | if (null == entity) { |
| | | return ResponseResult.error(-1,"等待媒体文件上传中"); |
| | | } |
| | | String url = "https://wrj.shuixiongit.com/minio/cloud-bucket" + entity.getObjectKey(); |
| | | Map ret = new HashMap(); |
| | | ret.put("url", url); |
| | | ret.put("metadata", JSONObject.parseObject(entity.getMetadata().toString())); |
| | | return ResponseResult.success(ret); |
| | | } catch (Exception e) { |
| | | return ResponseResult.error(-1,"拍摄未完成或者媒体文件未上传"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |