From 9f6d9b1de42e9d83dcb875d1a35e97cb51b26017 Mon Sep 17 00:00:00 2001 From: xhxu Date: Thu, 20 May 2021 13:32:04 +0800 Subject: [PATCH] tt --- .../iformall/domain/po/tt/TtVideoLibrary.java | 9 +- .../iformall/mapper/TtVideoLibraryMapper.java | 1 + .../iformall/service/WxCallBackService.java | 2 +- .../service/tt/TtVideoLibraryService.java | 23 +++ .../service/tt/impl/TtCouponServiceImpl.java | 16 +- .../tt/impl/TtVideoLibraryServiceImpl.java | 67 +++++++++ .../main/resources/mapper/TtCouponMapper.xml | 51 ++++--- .../resources/mapper/TtVideoLibraryMapper.xml | 21 ++- .../controller/tt/TtCouponController.java | 137 +++++++++++++++--- .../controller/video/VideoController.java | 21 +++ .../java/com/iformall/video/VideoExcutor.java | 2 + .../video/aliyun/AliyunVideoExcutor.java | 29 ++++ 12 files changed, 329 insertions(+), 50 deletions(-) create mode 100644 mallinkService/src/main/java/com/iformall/service/tt/TtVideoLibraryService.java create mode 100644 mallinkService/src/main/java/com/iformall/service/tt/impl/TtVideoLibraryServiceImpl.java diff --git a/mallinkService/src/main/java/com/iformall/domain/po/tt/TtVideoLibrary.java b/mallinkService/src/main/java/com/iformall/domain/po/tt/TtVideoLibrary.java index 43ec165d4..eb7d354ec 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/tt/TtVideoLibrary.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/tt/TtVideoLibrary.java @@ -17,12 +17,19 @@ public class TtVideoLibrary extends TenantEntity { protected Long id; + @io.swagger.annotations.ApiModelProperty(value="",name="videoId") + private String videoId; + @io.swagger.annotations.ApiModelProperty(value="",name="videoUrl") + private String videoUrl; + @io.swagger.annotations.ApiModelProperty(value="封面图",name="preview") private String preview; @io.swagger.annotations.ApiModelProperty(value="",name="name") private String name; @io.swagger.annotations.ApiModelProperty(value="时长",name="duration") - private Integer duration; + private String duration; + @io.swagger.annotations.ApiModelProperty(value="有效时间",name="exceedTime") + private Date exceedTime; @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") private Date createDate; @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") diff --git a/mallinkService/src/main/java/com/iformall/mapper/TtVideoLibraryMapper.java b/mallinkService/src/main/java/com/iformall/mapper/TtVideoLibraryMapper.java index 7a458cf13..856135836 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/TtVideoLibraryMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/TtVideoLibraryMapper.java @@ -11,4 +11,5 @@ public interface TtVideoLibraryMapper extends CommonMapper int deleteById(Long id); + TtVideoLibrary getByVideoId(String videoId); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCallBackService.java b/mallinkService/src/main/java/com/iformall/service/WxCallBackService.java index 281be3a8f..ec6566236 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCallBackService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCallBackService.java @@ -7,7 +7,7 @@ import org.springframework.scheduling.annotation.Async; public interface WxCallBackService { /** - * 积分同步 + * * @param record */ @Async diff --git a/mallinkService/src/main/java/com/iformall/service/tt/TtVideoLibraryService.java b/mallinkService/src/main/java/com/iformall/service/tt/TtVideoLibraryService.java new file mode 100644 index 000000000..8a00be163 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/tt/TtVideoLibraryService.java @@ -0,0 +1,23 @@ +package com.iformall.service.tt; + +import com.github.pagehelper.PageInfo; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.po.tt.TtVideoLibrary; +import org.springframework.scheduling.annotation.Async; + +public interface TtVideoLibraryService { + + /** + * 根据实体查询分页列表 + * + * @param record + * @param pageIndex + * @param pageSize + * @return + */ + PageInfo listAsPage(TtVideoLibrary record, Integer pageIndex, Integer pageSize); + + + @Async + void saveOrUpdate(TtVideoLibrary video); +} diff --git a/mallinkService/src/main/java/com/iformall/service/tt/impl/TtCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/tt/impl/TtCouponServiceImpl.java index 095a9b5ef..3e4521d67 100644 --- a/mallinkService/src/main/java/com/iformall/service/tt/impl/TtCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/tt/impl/TtCouponServiceImpl.java @@ -6,6 +6,8 @@ import com.github.pagehelper.PageInfo; import com.iformall.common.IdWorker; import com.iformall.common.ResultData; import com.iformall.domain.po.tt.TtCoupon; +import com.iformall.enums.EnumTtCouponStatus; +import com.iformall.enums.EnumTtCouponType; import com.iformall.mapper.*; import com.iformall.service.WxMerchantService; import com.iformall.service.tt.TtCouponService; @@ -62,7 +64,7 @@ public class TtCouponServiceImpl implements TtCouponService { } } - + record.setStatus(EnumTtCouponStatus.TTCOUPON_STATUS_DRAFT.getCode()); if (record.getId() == null) { final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); @@ -74,7 +76,17 @@ public class TtCouponServiceImpl implements TtCouponService { record.setUpdateDate(new Date()); ttCouponMapper.updateById(record); } - return new ResultData(record.getId()); + + if(record.getType().equals(EnumTtCouponType.COUPON_COLUMN.getCode()) + && record.getColumnCoupons() != null && record.getColumnCoupons().size() > 0){ + for (TtCoupon ttc:record.getColumnCoupons()) { + ttc.updateTenantInfo(record); + ttc.setType(EnumTtCouponType.COUPON_MORE.getCode()); + ttc.setColumnId(record.getId()); + this.saveOrUpdate(ttc); + } + } + return new ResultData(); } @Override diff --git a/mallinkService/src/main/java/com/iformall/service/tt/impl/TtVideoLibraryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/tt/impl/TtVideoLibraryServiceImpl.java new file mode 100644 index 000000000..8d73b4b70 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/tt/impl/TtVideoLibraryServiceImpl.java @@ -0,0 +1,67 @@ +package com.iformall.service.tt.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.iformall.common.ErrorCode; +import com.iformall.common.IdWorker; +import com.iformall.common.ResultData; +import com.iformall.domain.po.WxAppinfo; +import com.iformall.domain.po.WxCUserBasicInfo; +import com.iformall.domain.po.base.TenantEntity; +import com.iformall.domain.po.tt.TtCoupon; +import com.iformall.domain.po.tt.TtOrder; +import com.iformall.domain.po.tt.TtVideoLibrary; +import com.iformall.douyin.pay.DouYinPayHelper; +import com.iformall.douyin.pay.orderQuery.OrderQueryResult; +import com.iformall.douyin.pay.preOrder.CreatePreOrderResult; +import com.iformall.douyin.pay.preOrder.DouYinCreatePreOrder; +import com.iformall.enums.*; +import com.iformall.exception.MallinkException; +import com.iformall.mapper.TtOrderMapper; +import com.iformall.mapper.TtVideoLibraryMapper; +import com.iformall.service.WxAppinfoService; +import com.iformall.service.WxCUserBasicInfoService; +import com.iformall.service.tt.TtCouponService; +import com.iformall.service.tt.TtOrderService; +import com.iformall.service.tt.TtVideoLibraryService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +@Service +public class TtVideoLibraryServiceImpl implements TtVideoLibraryService { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private TtVideoLibraryMapper ttVideoLibraryMapper; + + @Override + public PageInfo listAsPage(TtVideoLibrary record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> ttVideoLibraryMapper.findList(record)); + } + + @Override + public void saveOrUpdate(TtVideoLibrary video) { + TtVideoLibrary videoLib = ttVideoLibraryMapper.getByVideoId(video.getVideoId()); + if(videoLib != null && videoLib.getIsDel().equals(EnumYesOrNo.YES.getCode())){ + videoLib.setIsDel(EnumYesOrNo.NO.getCode()); + videoLib.setUpdateDate(new Date()); + ttVideoLibraryMapper.updateById(videoLib); + } + if(videoLib == null){ + final IdWorker idWorker = IdWorker.get(); + video.setId(idWorker.nextId()); + video.setCreateDate(new Date()); + video.setUpdateDate(new Date()); + ttVideoLibraryMapper.insert(video); + } + } + +} diff --git a/mallinkService/src/main/resources/mapper/TtCouponMapper.xml b/mallinkService/src/main/resources/mapper/TtCouponMapper.xml index 7f0484a02..91c7c14d0 100644 --- a/mallinkService/src/main/resources/mapper/TtCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/TtCouponMapper.xml @@ -39,85 +39,90 @@ + + - `id`, `tenant_id`, `parent_tenant_id`, `type`, `cover_img`, `cover_picture`, `detail_picture`, - `title`, `sub_title`, `video_id`, `video_time`, `html`, `is_landscape`, `is_payment`, - `sale_price`, `orig_price`, `is_preview`, `preview_duration`, `detail`, `false_sell_count`, - `dy_title`, `inventory`, `remark`, `status`, `create_date`, `update_date`, - `see_count`, `sell_count`, `assess_count`, `collect_count`, `is_del`, - `column_id`, `popularity`, `merchant_id`, `business_id`, `business_name` + c.`id`, c.`tenant_id`, c.`parent_tenant_id`, c.`type`, c.`cover_img`, c.`cover_picture`, c.`detail_picture`, + c.`title`, c.`sub_title`, c.`video_id`, c.`video_time`, c.`html`, c.`is_landscape`, c.`is_payment`, + c.`sale_price`, c.`orig_price`, c.`is_preview`, c.`preview_duration`, c.`detail`, c.`false_sell_count`, + c.`dy_title`, c.`inventory`, c.`remark`, c.`status`, c.`create_date`, c.`update_date`, + c.`see_count`, c.`sell_count`, c.`assess_count`, c.`collect_count`, c.`is_del`, + c.`column_id`, c.`popularity`, c.`merchant_id`, c.`business_id`, c.`business_name`, + m.name merchant_name, m.img_url merchant_pic - where `is_del` = 0 + where c.`is_del` = 0 - and `id` = #{id} + and c.`id` = #{id} - and `tenant_id` = #{tenantId} + and c.`tenant_id` = #{tenantId} - and `parent_tenant_id` = #{parentTenantId} + and c.`parent_tenant_id` = #{parentTenantId} - and `type` = #{type} + and c.`type` = #{type} - and `title` like concat('%', #{title},'%') + and c.`title` like concat('%', #{title},'%') - and `is_landscape` = #{isLandscape} + and c.`is_landscape` = #{isLandscape} - and `is_payment` = #{isPayment} + and c.`is_payment` = #{isPayment} - and `is_preview` = #{isPreview} + and c.`is_preview` = #{isPreview} - and `status` = #{status} + and c.`status` = #{status} - and `create_date` >= #{startdate} + and c.`create_date` >= #{startdate} - and `create_date` <= #{enddate} + and c.`create_date` <= #{enddate} - and `business_id` = #{businessId} + and c.`business_id` = #{businessId} - and `merchant_id` = #{merchantId} + and c.`merchant_id` = #{merchantId} - and id in + and c.id in #{idItem} - order by ${sortColumns} + order by c.`update_date` desc + diff --git a/mallinkService/src/main/resources/mapper/TtVideoLibraryMapper.xml b/mallinkService/src/main/resources/mapper/TtVideoLibraryMapper.xml index c9c671ca3..b09dec9c8 100644 --- a/mallinkService/src/main/resources/mapper/TtVideoLibraryMapper.xml +++ b/mallinkService/src/main/resources/mapper/TtVideoLibraryMapper.xml @@ -5,15 +5,18 @@ + + - + + - `id`, `tenant_id`, `parent_tenant_id`, `preview`, `name`, `duration`, `create_date`, `update_date` + `id`, `tenant_id`, `parent_tenant_id`, `video_id`, `video_url`, `preview`, `name`, `duration`, `exceed_time`,`create_date`, `update_date` @@ -30,6 +33,11 @@ and `parent_tenant_id` = #{parentTenantId} + + and `video_id` = #{videoId} + + + and `title` like concat('%', #{name},'%') @@ -61,4 +69,13 @@ update tt_video_library set is_del = 1,update_date=now() where id = #{id} + + + + diff --git a/mallinkTTAdmin/src/main/java/com/iformall/controller/tt/TtCouponController.java b/mallinkTTAdmin/src/main/java/com/iformall/controller/tt/TtCouponController.java index 77f441ba4..b85b6b6e5 100644 --- a/mallinkTTAdmin/src/main/java/com/iformall/controller/tt/TtCouponController.java +++ b/mallinkTTAdmin/src/main/java/com/iformall/controller/tt/TtCouponController.java @@ -1,24 +1,34 @@ package com.iformall.controller.tt; import com.iformall.annotation.SystemControllerLog; +import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; +import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.tt.TtCoupon; +import com.iformall.domain.po.tt.TtVideoLibrary; import com.iformall.enums.*; import com.iformall.service.WxFlowService; +import com.iformall.service.WxMerchantService; import com.iformall.service.tt.TtCouponService; +import com.iformall.service.tt.TtVideoLibraryService; import com.iformall.utils.RedisLock; +import com.iformall.video.VideoFactory; +import com.iformall.video.entity.VideUploadResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + @RestController @RequestMapping("ttCoupon") @Api(description = "") @@ -29,9 +39,21 @@ public class TtCouponController extends BaseController { @Autowired private TtCouponService ttCouponService; + @Autowired + private TtVideoLibraryService ttVideoLibraryService; + + @Autowired + private WxMerchantService wxMerchantService; + @Autowired private WxFlowService wxFlowService; + @Autowired + VideoFactory videoFactory; + + @Autowired + String videoType; + @Autowired RedisLock redisLock; @@ -52,9 +74,47 @@ public class TtCouponController extends BaseController { @SystemControllerLog(description = "-新增") public ResultData add(@RequestBody TtCoupon record) { logger.debug("[" + getIpAddr() + "] WxCouponController::add"); + if(record == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); + } TenantEntity tenantEntity = getTenantInfo(); record.updateTenantInfo(tenantEntity); + if(record.getMerchantId() == null){ + WxMerchant merchantQ = new WxMerchant(); + merchantQ.updateTenantInfo(tenantEntity); + merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); + List list = wxMerchantService.findList(merchantQ); + if(list != null && list.size() > 0){ + record.setMerchantId(list.get(0).getId()); + } + } + if(record.getMerchantId() == null){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到作者"); + } + if(record.getBusinessId() == null){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR,"未选择分类"); + } + if(StringUtils.isBlank(record.getVideoId())){ +// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"未上传视频"); + }else{ + VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(record.getVideoId()); + if(result.isSuccess()){ + record.setVideoTime(result.getDuration()); + TtVideoLibrary video = new TtVideoLibrary(); + video.updateTenantInfo(tenantEntity); + video.setVideoId(record.getVideoId()); + video.setVideoUrl(result.getVideoUrl()); + video.setPreview(result.getCoverURL()); + video.setDuration(result.getDuration()); + ttVideoLibraryService.saveOrUpdate(video); + }else{ + return new ResultData(ErrorCode.SYS_SERVER_ERROR,result.getMsg()); + } + } + + + record.setType(EnumTtCouponType.COUPON_SINGLE.getCode()); ResultData resultData = ttCouponService.saveOrUpdate(record); if (resultData.code != 200) { return resultData; @@ -67,6 +127,7 @@ public class TtCouponController extends BaseController { //修改coupon applyStatus状态为审核中 record.setStatus(EnumTtCouponStatus.TTCOUPON_STATUS_EXAMINE.getCode()); } + return resultData; } @@ -78,32 +139,66 @@ public class TtCouponController extends BaseController { if (record.getId() == null) { return new ResultData(ResultData.ERROR, "缺少id"); } - record.updateTenantInfo(getTenantInfo()); + TenantEntity tenantEntity = getTenantInfo(); + record.updateTenantInfo(tenantEntity); if(EnumDelFlag.YES.getCode().equals(record.getIsDel())){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到课程,或课程已删除"); + } + TtCoupon coupon = ttCouponService.getById(record.getId()); + if (null == coupon || EnumDelFlag.YES.getCode().equals(record.getIsDel())) { + return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到课程,或课程已删除"); + } + if(record.getMerchantId() == null){ + WxMerchant merchantQ = new WxMerchant(); + merchantQ.updateTenantInfo(tenantEntity); + merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); + List list = wxMerchantService.findList(merchantQ); + if(list != null && list.size() > 0){ + record.setMerchantId(list.get(0).getId()); + } + } + if(record.getMerchantId() == null){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到作者"); + } + if(record.getBusinessId() == null){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR,"未选择分类"); + } + if(!record.getMerchantId().equals(coupon.getMerchantId())){ + return new ResultData(ErrorCode.SYS_SERVER_ERROR,"作者课程不匹配"); + } + if(StringUtils.isBlank(record.getVideoId())){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"未上传视频"); + } + VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(record.getVideoId()); + if(result.isSuccess()){ + record.setVideoTime(result.getDuration()); + TtVideoLibrary video = new TtVideoLibrary(); + video.updateTenantInfo(tenantEntity); + video.setVideoId(record.getVideoId()); + video.setVideoUrl(result.getVideoUrl()); + video.setPreview(result.getCoverURL()); + video.setDuration(result.getDuration()); + ttVideoLibraryService.saveOrUpdate(video); + }else{ + return new ResultData(ErrorCode.SYS_SERVER_ERROR,result.getMsg()); } - TtCoupon coupon = ttCouponService.getById(record.getId()); - if (null == coupon) { - return new ResultData(ResultData.ERROR, "未查询到数据。"+record.getId()); - } - - //启动审批流 -// if (record.getFlowParams() != null && record.getFlowParams().size() > 0) { -// logger.info("------coupon.update().businessType:"+record.getFlowParams().get("businessType")); -// record.getFlowParams().put("businessId",record.getId()); -// wxFlowService.start(record.getFlowParams(), getUserId(), getUser().getName(), getTenantInfo()); -// //作废审批 -// if (EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(record.getStatus())) { -// record.setCancleApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); -// return new ResultData(record); -// } else { -// //投放审批 -// record.setPutApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); -// } -// } +// record.setType(EnumTtCouponType.COUPON_SINGLE.getCode()); + ResultData resultData = ttCouponService.saveOrUpdate(record); + if (resultData.code != 200) { + return resultData; + } + + //启动投放审批 + if(record.getFlowParams() !=null && record.getFlowParams().size()>0) { + record.getFlowParams().put("businessId",record.getId()); + wxFlowService.start(record.getFlowParams(), getUserId(), getUser().getName(), tenantEntity); + //修改coupon applyStatus状态为审核中 + record.setStatus(EnumTtCouponStatus.TTCOUPON_STATUS_EXAMINE.getCode()); + } - return ttCouponService.saveOrUpdate(record); + return resultData; } @ApiOperation("根据id删除接口") diff --git a/mallinkTTAdmin/src/main/java/com/iformall/controller/video/VideoController.java b/mallinkTTAdmin/src/main/java/com/iformall/controller/video/VideoController.java index be4a31576..1ba72eead 100644 --- a/mallinkTTAdmin/src/main/java/com/iformall/controller/video/VideoController.java +++ b/mallinkTTAdmin/src/main/java/com/iformall/controller/video/VideoController.java @@ -94,4 +94,25 @@ public class VideoController extends BaseController { } } + /** + * 获取视频信息 + * + * @param + * @return + * @throws Exception + */ + @GetMapping(value = "/getVideoDetail") + @ApiOperation("上传视频进度") + @ApiImplicitParams({ + @ApiImplicitParam(name = "videoId", value = "视频编号", dataType = "String", paramType = "query", required = true)}) + public ResultData getVideoDetail(String videoId) { + try { + VideUploadResult result = videoFactory.getExcutor(videoType).getVideoDetail(videoId); + return new ResultData(result); + } catch (Exception e) { + logger.error(e.getMessage()); + return new ResultData(ErrorCode.SYS_SERVER_ERROR); + } + } + } diff --git a/mallinkVideo/src/main/java/com/iformall/video/VideoExcutor.java b/mallinkVideo/src/main/java/com/iformall/video/VideoExcutor.java index cfeb04f17..49d7ce398 100644 --- a/mallinkVideo/src/main/java/com/iformall/video/VideoExcutor.java +++ b/mallinkVideo/src/main/java/com/iformall/video/VideoExcutor.java @@ -19,4 +19,6 @@ public interface VideoExcutor { public VideUploadResult uploadNetVideo(String title,String url,String ext); public String getVedioUploadProgress(String videoId); + + VideUploadResult getVideoDetail(String videoId); } diff --git a/mallinkVideo/src/main/java/com/iformall/video/aliyun/AliyunVideoExcutor.java b/mallinkVideo/src/main/java/com/iformall/video/aliyun/AliyunVideoExcutor.java index 3a8c3f8f6..a0e80a394 100644 --- a/mallinkVideo/src/main/java/com/iformall/video/aliyun/AliyunVideoExcutor.java +++ b/mallinkVideo/src/main/java/com/iformall/video/aliyun/AliyunVideoExcutor.java @@ -132,4 +132,33 @@ public class AliyunVideoExcutor implements VideoExcutor { public String getVedioUploadProgress(String videoId) { return AliyunVedioUpload.getUploadProgress(redisTemplate, videoId); } + + @Override + public VideUploadResult getVideoDetail(String videoId) { + VideUploadResult result = new VideUploadResult(); + result.setVideoId(videoId); + try { + GetPlayInfoResponse response = AliyunVedioServer.getPlayInfoResponse(config, videoId); + if(response != null){ + List playInfoList = response.getPlayInfoList(); + //播放地址 + for (GetPlayInfoResponse.PlayInfo playInfo : playInfoList) { + result.setVideoUrl(playInfo.getPlayURL()); + break; + } + GetPlayInfoResponse.VideoBase videoBase = response.getVideoBase(); + result.setDuration(videoBase.getDuration()); + result.setCoverURL(videoBase.getCoverURL()); + result.setTitle(videoBase.getTitle()); + result.setSuccess(true); + }else{ + result.setSuccess(false); + result.setMsg("未获取到视频"); + } + } catch (ClientException e) { + result.setSuccess(false); + result.setMsg("获取视频请求异常"); + } + return result; + } }