Browse Source

重构回调上传离线视频接口代码

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
b66e632c2b
1 changed files with 8 additions and 7 deletions
  1. +8
    -7
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/upload/UploadFlightUrlService.java

+ 8
- 7
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/upload/UploadFlightUrlService.java View File

* @return * @return
*/ */
public JsonResult uploadFlightUrl(UploadFlightUrlRequest request) { public JsonResult uploadFlightUrl(UploadFlightUrlRequest request) {
log.info("进入上传离线视频业务接口");
log.info("进入上传离线视频业务接口, request:{}", request);
JsonResult result = this.check(request); JsonResult result = this.check(request);
if (0 != result.getCode()) { if (0 != result.getCode()) {
log.info("上传离线视频业务接口:校验失败:{}", result.getMsg()); log.info("上传离线视频业务接口:校验失败:{}", result.getMsg());


Inspection inspection = (Inspection) result.getData(); Inspection inspection = (Inspection) result.getData();


log.info("上传离线视频业务接口, inspectionid:{}", inspection.getId());
log.info("上传离线视频业务接口, isLive:{}, analyseStatus:{}", inspection.getIsLive(), inspection.getAnalyseStatus());
log.info("上传离线视频业务接口, inspectionid:{}, isLive:{}, analyseStatus:{}", inspection.getId(), inspection.getIsLive(), inspection.getAnalyseStatus());


//修改用户直播完也可以进行分析 //修改用户直播完也可以进行分析
if (1 == inspection.getIsLive() && inspection.getAnalyseStatus() != 1) { if (1 == inspection.getIsLive() && inspection.getAnalyseStatus() != 1) {
private JsonResult check(UploadFlightUrlRequest request) { private JsonResult check(UploadFlightUrlRequest request) {
if (StringUtils.isEmpty(request.getVideoUrl()) || StringUtils.isEmpty(request.getSrtUrl()) if (StringUtils.isEmpty(request.getVideoUrl()) || StringUtils.isEmpty(request.getSrtUrl())
|| StringUtils.isEmpty(request.getTaskCode())) { || StringUtils.isEmpty(request.getTaskCode())) {
log.info("参数为空!");
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }

Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>() Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getCode, request.getTaskCode()) .eq(Inspection::getCode, request.getTaskCode())
.eq(Inspection::getMark, MarkTypeEnum.VALID.getCode())); .eq(Inspection::getMark, MarkTypeEnum.VALID.getCode()));
Optional.ofNullable(inspection).orElseThrow(() -> new ServiceException(ServiceExceptionEnum.TASK_DOES_NOT_EXIST));

return JsonResult.success();
if (ObjectUtils.isEmpty(inspection)) {
log.info("巡检任务不存在!");
throw new ServiceException(ServiceExceptionEnum.TASK_DOES_NOT_EXIST);
}
return JsonResult.success(inspection);
} }


private void updatInspection(UploadFlightUrlRequest request, Inspection inspection) { private void updatInspection(UploadFlightUrlRequest request, Inspection inspection) {

Loading…
Cancel
Save