video manage commit

This commit is contained in:
danmo 2024-04-07 23:52:22 +08:00
parent e27b15cabc
commit 25ffb374c5
21 changed files with 1427 additions and 11 deletions

View File

@ -49,12 +49,12 @@ public enum DyConfigEnum {
/**
* 上传图片
*/
UPDATE_IMAGE("updateImage", "/api/douyin/v1/video/upload_image"),
UPLOAD_IMAGE("uploadImage", "/api/douyin/v1/video/upload_image"),
/**
* 上传视频
*/
UPDATE_VIDEO("updateVideo", "/api/douyin/v1/video/upload_video"),
UPLOAD_VIDEO("uploadVideo", "/api/douyin/v1/video/upload_video"),
/**
* 创建视频
@ -64,13 +64,13 @@ public enum DyConfigEnum {
/**
* 分片上传完成
*/
COMPLETE_VIDEO_PART_UPDATE("completeVideoPartUpdate", "/api/douyin/v1/video/complete_video_part_upload"),
COMPLETE_VIDEO_PART_UPLOAD("completeVideoPartUpload", "/api/douyin/v1/video/complete_video_part_upload"),
/**
* 分片上传
*/
UPDATE_VIDEO_PART("updateVideoPart", "/api/douyin/v1/video/upload_video_part"),
UPLOAD_VIDEO_PART("uploadVideoPart", "/api/douyin/v1/video/upload_video_part"),
/**

View File

@ -0,0 +1,6 @@
package com.dyj.common.enums;
public class MediaTypeEnum {
}

View File

@ -5,10 +5,16 @@ import com.dyj.common.config.DyConfiguration;
import com.dyj.common.domain.DyResult;
import com.dyj.common.domain.TokenInfo;
import com.dyj.common.handler.RequestHandler;
import com.dyj.web.domain.query.CreateImageTextQuery;
import com.dyj.web.domain.query.CreateVideoQuery;
import com.dyj.web.domain.query.VideoDataQuery;
import com.dyj.web.domain.vo.*;
import com.dyj.web.handler.AccessTokenHandler;
import com.dyj.web.handler.UserHandler;
import com.dyj.web.handler.VideoHandler;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
/**
@ -134,4 +140,150 @@ public class DyWebClient {
return new UserHandler(agentConfiguration).userRoleCheck(openId, douyinShortId, roleLabels);
}
/**
* 创建图文消息
*
* @param query 创建图文消息的查询参数
* @return DyResult<CreateImageTextVo> 返回一个包含创建图文消息结果的响应对象
*/
public DyResult<CreateImageTextVo> createImageText(CreateImageTextQuery query){
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).createImageText(query);
}
/**
* 上传图片
*
* @param openId 用户的OpenID用于标识上传者
* @param file 要上传的图片文件
* @return DyResult<UploadImageVo> 返回一个包含上传图片结果的响应对象
* @throws FileNotFoundException 如果指定的文件不存在则抛出此异常
*/
public DyResult<UploadImageVo> uploadImage(String openId, File file) throws FileNotFoundException {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).uploadImage(openId, file);
}
/**
* 上传视频
*
* @param openId 用户的OpenID用于标识上传者
* @param file 要上传的视频文件
* @return DyResult<UploadVideoVo> 返回一个包含上传视频结果的响应对象
* @throws FileNotFoundException 如果指定的文件不存在则抛出此异常
*/
public DyResult<UploadVideoVo> uploadVideo(String openId, File file) throws FileNotFoundException {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).uploadVideo(openId, file);
}
/**
* 创建视频
*
* @param query 创建视频的查询参数
* @return DyResult<CreateVideoVo> 返回一个包含创建视频结果的响应对象
*/
public DyResult<CreateVideoVo> createVideo(CreateVideoQuery query){
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).createVideo(query);
}
/**
* 分片上传完成
*
* @param openId 用户ID
* @param uploadId 分片上传的标记
* @return DyResult<UploadVideoVo>
*/
public DyResult<UploadVideoVo> completeVideoPartUpdate(String openId, String uploadId) {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).completeVideoPartUpdate(openId, uploadId);
}
/**
* 分片上传
*
* @param openId 用户ID
* @param uploadId 分片上传的标记
* @param partNumber 分片上传的序号
* @param file 要上传的文件
* @return DyResult<BaseVo>
* @throws FileNotFoundException 如果指定的文件不存在则抛出此异常
*/
public DyResult<BaseVo> updateVideoPart(String openId, String uploadId, Integer partNumber, File file) throws FileNotFoundException {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).updateVideoPart(openId, uploadId, partNumber, file);
}
/**
* 初始化分片上传
*
* @param openId 用户ID
* @return DyResult<InitPartUploadVo>
*/
public DyResult<InitPartUploadVo> initializeVideoPartUpload(String openId) {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).initializeVideoPartUpload(openId);
}
/**
* 查询授权账号视频列表
*
* @param openId 用户ID
* @param cursor 分页游标
* @param count 每页数量
* @return DyResult<QueryVideoListVo>
*/
public DyResult<QueryVideoListVo> queryVideoList(String openId, Integer cursor, Integer count) {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).queryVideoList(openId, cursor, count);
}
/**
* 查询特定视频的视频数据
*
* @param query 查询参数
* @return DyResult<QueryVideoListVo>
*/
public DyResult<QueryVideoListVo> queryVideoData(VideoDataQuery query) {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).queryVideoData(query);
}
/**
* 查询视频发布结果
*
* @param defaultHashtag 默认话题
* @param linkParam 链接参数
* @param needCallback 是否需要回调
* @param sourceStyleId 源样式ID
* @return DyResult<QueryVideoPublishResultVo>
*/
public DyResult<QueryVideoPublishResultVo> queryVideoPublishResult(String defaultHashtag, String linkParam, Boolean needCallback, String sourceStyleId) {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).queryVideoPublishResult(defaultHashtag, linkParam, needCallback, sourceStyleId);
}
/**
* 查询视频携带的地点信息
*
* @param count 每页数量
* @param keyword 关键词
* @param city 城市
* @param cursor 分页游标
* @return DyResult<QueryVideoLocationVo>
*/
public DyResult<QueryVideoLocationVo> queryVideoLocation(Integer count, String keyword, String city, Integer cursor) {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).queryVideoLocation(count, keyword, city, cursor);
}
/**
* 查询视频的IFRAME
*
* @param videoId 视频ID
* @return DyResult<VideoIframeVo>
*/
public DyResult<VideoIframeVo> getIframeByVideo(String videoId) {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).getIframeByVideo(videoId);
}
/**
* 查询视频的IFRAME
*
* @param itemId 视频ID
* @return DyResult<VideoIframeVo>
*/
public DyResult<VideoIframeVo> getIframeByItem(String itemId) {
return new VideoHandler(configuration().getAgentConfigService().loadAgentByTenantId(tenantId, clientKey)).getIframeByItem(itemId);
}
}

View File

@ -1,15 +1,15 @@
package com.dyj.web.client;
import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.JSONBody;
import com.dtflys.forest.annotation.Post;
import com.dtflys.forest.annotation.Var;
import com.dtflys.forest.annotation.*;
import com.dtflys.forest.backend.ContentType;
import com.dyj.common.domain.DyResult;
import com.dyj.web.domain.query.CreateImageTextQuery;
import com.dyj.web.domain.vo.CreateImageTextVo;
import com.dyj.web.domain.query.*;
import com.dyj.web.domain.vo.*;
import com.dyj.web.interceptor.ClientTokenInterceptor;
import com.dyj.web.interceptor.TokenHeaderInterceptor;
import java.io.InputStream;
/**
* @author danmo
* @date 2024-04-07 18:47
@ -18,6 +18,43 @@ import com.dyj.web.interceptor.TokenHeaderInterceptor;
@BaseRequest(baseURL = "${domain}")
public interface VideoClient {
@Post(url = "${createImageText}?open_id=${query.open_id}", contentType = ContentType.APPLICATION_JSON)
@Post(url = "${createImageText}?open_id=${query.open_id}", contentType = ContentType.APPLICATION_JSON, interceptor = TokenHeaderInterceptor.class)
DyResult<CreateImageTextVo> createImageText(@JSONBody @Var("query") CreateImageTextQuery query);
@Post(url = "${uploadImage}?open_id=${query.open_id}", contentType = ContentType.MULTIPART_FORM_DATA, interceptor = TokenHeaderInterceptor.class)
DyResult<UploadImageVo> uploadImage(@Var("query") UserInfoQuery query, @DataFile(value = "image") InputStream inputStream);
@Post(url = "${uploadVideo}?open_id=${query.open_id}", contentType = ContentType.MULTIPART_FORM_DATA, interceptor = TokenHeaderInterceptor.class)
DyResult<UploadVideoVo> uploadVideo(@Var("query") UserInfoQuery query, @DataFile(value = "video") InputStream inputStream);
@Post(url = "${createVideo}?open_id=${query.open_id}", contentType = ContentType.APPLICATION_JSON, interceptor = TokenHeaderInterceptor.class)
DyResult<CreateVideoVo> createVideo(@JSONBody @Var("query") CreateVideoQuery query);
@Post(url = "${completeVideoPartUpload}?open_id=${query.open_id}", contentType = ContentType.APPLICATION_JSON, interceptor = TokenHeaderInterceptor.class)
DyResult<UploadVideoVo> completeVideoPartUpload(@Var("query") UserInfoQuery query, @Query("upload_id") String uploadId);
@Post(url = "${uploadVideoPart}?open_id=${query.open_id}", contentType = ContentType.MULTIPART_FORM_DATA, interceptor = TokenHeaderInterceptor.class)
DyResult<BaseVo> uploadVideoPart(@Var("query") UserInfoQuery query, @Query("upload_id") String uploadId, @Query("part_number") Integer partNumber, @DataFile(value = "video") InputStream inputStream);
@Post(url = "${initializeVideoPartUpload}?open_id=${query.open_id}", contentType = ContentType.APPLICATION_JSON, interceptor = TokenHeaderInterceptor.class)
DyResult<InitPartUploadVo> initializeVideoPartUpload(@Var("query") UserInfoQuery query);
@Get(url = "${queryVideoList}?open_id=${query.open_id}", contentType = ContentType.APPLICATION_JSON, interceptor = TokenHeaderInterceptor.class)
DyResult<QueryVideoListVo> queryVideoList(@Var("query") UserInfoQuery query, @Query("cursor") Integer cursor, @Query("count") Integer count);
@Post(url = "${queryVideoData}?open_id=${query.open_id}", contentType = ContentType.APPLICATION_JSON, interceptor = TokenHeaderInterceptor.class)
DyResult<QueryVideoListVo> queryVideoData(@JSONBody @Var("query") VideoDataQuery query);
@Get(url = "${queryVideoPublishResult}", contentType = ContentType.APPLICATION_JSON, interceptor = ClientTokenInterceptor.class)
DyResult<QueryVideoPublishResultVo> queryVideoPublishResult(@JSONBody BaseQuery query, @Query("default_hashtag") String defaultHashtag, @Query("link_param") String linkParam, @Query("need_callback") Boolean needCallback, @Query("source_style_id") String sourceStyleId);
@Get(url = "${queryVideoLocation}", contentType = ContentType.APPLICATION_JSON, interceptor = ClientTokenInterceptor.class)
DyResult<QueryVideoLocationVo> queryVideoLocation(@JSONBody BaseQuery query, @Query("count") Integer count, @Query("keyword") String keyword, @Query("city") String city, @Query("cursor") Integer cursor);
@Get(url = "${queryVideoIframe}", contentType = ContentType.APPLICATION_JSON)
DyResult<VideoIframeVo> getIframeByVideo(@Query("video_id") String videoId);
@Get(url = "${queryVideoIframeByItem}", contentType = ContentType.APPLICATION_JSON)
DyResult<VideoIframeVo> getIframeByItem(@Query("item_id") String itemId, @Query("client_key") String clientKey);
}

View File

@ -0,0 +1,168 @@
package com.dyj.web.domain;
/**
* @author danmo
* @date 2024/04/07 22:40
*/
public class AccountVideo {
/**
* 视频封面
*/
private String cover;
/**
* 视频创建时间
*/
private Long create_time;
/**
* 是否审核通过
*/
private Boolean is_reviewed;
/**
* 是否置顶
*/
private Boolean is_top;
/**
* 视频id
*/
private String item_id;
/**
* 分享链接
*/
private String share_url;
/**
* 视频标题
*/
private String title;
/**
* 视频状态1:细化为567三种状态;2:不适宜公开;4:审核中;5:公开视频;6:好友可见;7:私密视频
*/
private Integer video_status;
/**
* 视频类型
*/
private Integer media_type;
/**
* 视频统计信息
*/
private VideoStatistics statistics;
/**
* 视频真实id
*/
private String video_id;
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
public Long getCreate_time() {
return create_time;
}
public void setCreate_time(Long create_time) {
this.create_time = create_time;
}
public Boolean getIs_reviewed() {
return is_reviewed;
}
public void setIs_reviewed(Boolean is_reviewed) {
this.is_reviewed = is_reviewed;
}
public Boolean getIs_top() {
return is_top;
}
public void setIs_top(Boolean is_top) {
this.is_top = is_top;
}
public String getItem_id() {
return item_id;
}
public void setItem_id(String item_id) {
this.item_id = item_id;
}
public String getShare_url() {
return share_url;
}
public void setShare_url(String share_url) {
this.share_url = share_url;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getVideo_status() {
return video_status;
}
public void setVideo_status(Integer video_status) {
this.video_status = video_status;
}
public Integer getMedia_type() {
return media_type;
}
public void setMedia_type(Integer media_type) {
this.media_type = media_type;
}
public VideoStatistics getStatistics() {
return statistics;
}
public void setStatistics(VideoStatistics statistics) {
this.statistics = statistics;
}
public String getVideo_id() {
return video_id;
}
public void setVideo_id(String video_id) {
this.video_id = video_id;
}
@Override
public String toString() {
return "AccountVideo{" +
"cover='" + cover + '\'' +
", create_time=" + create_time +
", is_reviewed=" + is_reviewed +
", is_top=" + is_top +
", item_id='" + item_id + '\'' +
", share_url='" + share_url + '\'' +
", title='" + title + '\'' +
", video_status=" + video_status +
", media_type=" + media_type +
", statistics=" + statistics +
", video_id='" + video_id + '\'' +
'}';
}
}

View File

@ -0,0 +1,43 @@
package com.dyj.web.domain;
public class UploadImage {
private String image_id;
private String width;
private String height;
public String getImage_id() {
return image_id;
}
public void setImage_id(String image_id) {
this.image_id = image_id;
}
public String getWidth() {
return width;
}
public void setWidth(String width) {
this.width = width;
}
public String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
@Override
public String toString() {
return "UpLoadImage{" +
"image_id='" + image_id + '\'' +
", width='" + width + '\'' +
", height='" + height + '\'' +
'}';
}
}

View File

@ -0,0 +1,43 @@
package com.dyj.web.domain;
public class UploadVideo {
private String video_id;
private String width;
private String height;
public String getVideo_id() {
return video_id;
}
public void setVideo_id(String video_id) {
this.video_id = video_id;
}
public String getWidth() {
return width;
}
public void setWidth(String width) {
this.width = width;
}
public String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
@Override
public String toString() {
return "UploadVideo{" +
"video_id='" + video_id + '\'' +
", width='" + width + '\'' +
", height='" + height + '\'' +
'}';
}
}

View File

@ -0,0 +1,120 @@
package com.dyj.web.domain;
public class VideoLocation {
private String address;
private String city;
private String city_code;
private String country;
private String country_code;
private String district;
private String location;
private String poi_id;
private String poi_name;
private String province;
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCity_code() {
return city_code;
}
public void setCity_code(String city_code) {
this.city_code = city_code;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getCountry_code() {
return country_code;
}
public void setCountry_code(String country_code) {
this.country_code = country_code;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getPoi_id() {
return poi_id;
}
public void setPoi_id(String poi_id) {
this.poi_id = poi_id;
}
public String getPoi_name() {
return poi_name;
}
public void setPoi_name(String poi_name) {
this.poi_name = poi_name;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
@Override
public String toString() {
return "VideoLocation{" +
"address='" + address + '\'' +
", city='" + city + '\'' +
", city_code='" + city_code + '\'' +
", country='" + country + '\'' +
", country_code='" + country_code + '\'' +
", district='" + district + '\'' +
", location='" + location + '\'' +
", poi_id='" + poi_id + '\'' +
", poi_name='" + poi_name + '\'' +
", province='" + province + '\'' +
'}';
}
}

View File

@ -0,0 +1,94 @@
package com.dyj.web.domain;
public class VideoStatistics {
/**
* 评论数
*/
private Integer comment_count;
/**
* 点赞数
*/
private Integer digg_count;
/**
* 下载数
*/
private Integer download_count;
/**
* 转发数
*/
private Integer forward_count;
/**
* 播放数
*/
private Integer play_count;
/**
* 分享数
*/
private Integer share_count;
public Integer getComment_count() {
return comment_count;
}
public void setComment_count(Integer comment_count) {
this.comment_count = comment_count;
}
public Integer getDigg_count() {
return digg_count;
}
public void setDigg_count(Integer digg_count) {
this.digg_count = digg_count;
}
public Integer getDownload_count() {
return download_count;
}
public void setDownload_count(Integer download_count) {
this.download_count = download_count;
}
public Integer getForward_count() {
return forward_count;
}
public void setForward_count(Integer forward_count) {
this.forward_count = forward_count;
}
public Integer getPlay_count() {
return play_count;
}
public void setPlay_count(Integer play_count) {
this.play_count = play_count;
}
public Integer getShare_count() {
return share_count;
}
public void setShare_count(Integer share_count) {
this.share_count = share_count;
}
@Override
public String toString() {
return "VideoStatistics{" +
"comment_count=" + comment_count +
", digg_count=" + digg_count +
", download_count=" + download_count +
", forward_count=" + forward_count +
", play_count=" + play_count +
", share_count=" + share_count +
'}';
}
}

View File

@ -0,0 +1,240 @@
package com.dyj.web.domain.query;
import java.util.List;
public class CreateVideoQuery extends UserInfoQuery{
/**
* 必须上传加密的 video_id加密的 video_id 通过调用 /video/upload 接口可以得到
*/
private String video_id;
/**
* 视频标题可以带话题@用户注意话题审核依旧遵循抖音的审核逻辑强烈建议第三方谨慎拟定话题名称避免强导流行为
*/
private String text;
/**
* 如果需要 at 其他用户 text @nickname 对应的 open_id 放到这里
*/
private List<String> at_users;
/**
* 小程序标题
*/
private String micro_app_title;
/**
* 开发者在小程序中生成该页面时写的 path 地址
*/
private String micro_app_url;
/**
* 小程序 id
*/
private String micro_app_id;
/**
* 地理位置 idpoi_id 可通过"查询视频携带的地点信息"能力获取
*/
private String poi_id;
/**
* 将传入的指定时间点对应帧设置为视频封面单位
*/
private Double cover_tsp;
/**
* true 如果用户拥有门店推广能力则用户发布视频所添加的地理位置默认开启门店推广
*/
private Boolean poi_commerce;
/**
* 自定义封面图片参数为图片上传接口返回的 image_id
*/
private String custom_cover_image_url;
/**
* 影视ID
*/
private String ent_id;
public String getVideo_id() {
return video_id;
}
public void setVideo_id(String video_id) {
this.video_id = video_id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public List<String> getAt_users() {
return at_users;
}
public void setAt_users(List<String> at_users) {
this.at_users = at_users;
}
public String getMicro_app_title() {
return micro_app_title;
}
public void setMicro_app_title(String micro_app_title) {
this.micro_app_title = micro_app_title;
}
public String getMicro_app_url() {
return micro_app_url;
}
public void setMicro_app_url(String micro_app_url) {
this.micro_app_url = micro_app_url;
}
public String getMicro_app_id() {
return micro_app_id;
}
public void setMicro_app_id(String micro_app_id) {
this.micro_app_id = micro_app_id;
}
public String getPoi_id() {
return poi_id;
}
public void setPoi_id(String poi_id) {
this.poi_id = poi_id;
}
public Double getCover_tsp() {
return cover_tsp;
}
public void setCover_tsp(Double cover_tsp) {
this.cover_tsp = cover_tsp;
}
public Boolean getPoi_commerce() {
return poi_commerce;
}
public void setPoi_commerce(Boolean poi_commerce) {
this.poi_commerce = poi_commerce;
}
public String getCustom_cover_image_url() {
return custom_cover_image_url;
}
public void setCustom_cover_image_url(String custom_cover_image_url) {
this.custom_cover_image_url = custom_cover_image_url;
}
public String getEnt_id() {
return ent_id;
}
public void setEnt_id(String ent_id) {
this.ent_id = ent_id;
}
public static CreateVideoQuery build() {
return new CreateVideoQuery();
}
public CreateVideoQuery video_id(String video_id) {
this.video_id = video_id;
return this;
}
public CreateVideoQuery text(String text) {
this.text = text;
return this;
}
public CreateVideoQuery at_users(List<String> at_users) {
this.at_users = at_users;
return this;
}
public CreateVideoQuery micro_app_title(String micro_app_title) {
this.micro_app_title = micro_app_title;
return this;
}
public CreateVideoQuery micro_app_url(String micro_app_url) {
this.micro_app_url = micro_app_url;
return this;
}
public CreateVideoQuery micro_app_id(String micro_app_id) {
this.micro_app_id = micro_app_id;
return this;
}
public CreateVideoQuery poi_id(String poi_id) {
this.poi_id = poi_id;
return this;
}
public CreateVideoQuery cover_tsp(Double cover_tsp) {
this.cover_tsp = cover_tsp;
return this;
}
public CreateVideoQuery poi_commerce(Boolean poi_commerce) {
this.poi_commerce = poi_commerce;
return this;
}
public CreateVideoQuery custom_cover_image_url(String custom_cover_image_url) {
this.custom_cover_image_url = custom_cover_image_url;
return this;
}
public CreateVideoQuery ent_id(String ent_id) {
this.ent_id = ent_id;
return this;
}
public CreateVideoQuery open_id(String open_id) {
super.open_id = open_id;
return this;
}
public CreateVideoQuery tenantId(Integer tenantId) {
super.tenantId = tenantId;
return this;
}
public CreateVideoQuery clientKey(String clientKey) {
super.clientKey = clientKey;
return this;
}
@Override
public String toString() {
return "CreateVideoQuery{" +
"video_id='" + video_id + '\'' +
", text='" + text + '\'' +
", at_users=" + at_users +
", micro_app_title='" + micro_app_title + '\'' +
", micro_app_url='" + micro_app_url + '\'' +
", micro_app_id='" + micro_app_id + '\'' +
", poi_id='" + poi_id + '\'' +
", cover_tsp=" + cover_tsp +
", poi_commerce=" + poi_commerce +
", custom_cover_image_url='" + custom_cover_image_url + '\'' +
", ent_id='" + ent_id + '\'' +
", open_id='" + open_id + '\'' +
", tenantId=" + tenantId +
", clientKey='" + clientKey + '\'' +
'}';
}
}

View File

@ -0,0 +1,72 @@
package com.dyj.web.domain.query;
import java.util.List;
public class VideoDataQuery extends UserInfoQuery{
/**
* item_id 数组仅能查询 access_token 对应用户上传的视频与video_ids字段二选一平台优先处理item_ids
*/
private List<String> item_ids;
/**
* video_id 数组仅能查询 access_token 对应用户上传的视频与item_ids字段二选一平台优先处理item_ids
*/
private List<String> video_ids;
public List<String> getItem_ids() {
return item_ids;
}
public void setItem_ids(List<String> item_ids) {
this.item_ids = item_ids;
}
public List<String> getVideo_ids() {
return video_ids;
}
public void setVideo_ids(List<String> video_ids) {
this.video_ids = video_ids;
}
public static VideoDataQuery build() {
return new VideoDataQuery();
}
public VideoDataQuery item_ids(List<String> item_ids) {
this.item_ids = item_ids;
return this;
}
public VideoDataQuery video_ids(List<String> video_ids) {
this.video_ids = video_ids;
return this;
}
public VideoDataQuery tenantId(Integer tenantId) {
this.tenantId = tenantId;
return this;
}
public VideoDataQuery clientKey(String clientKey) {
this.clientKey = clientKey;
return this;
}
public VideoDataQuery open_id(String open_id) {
this.open_id = open_id;
return this;
}
@Override
public String toString() {
return "VideoDataQuery{" +
"item_ids=" + item_ids +
", video_ids=" + video_ids +
", open_id='" + open_id + '\'' +
", tenantId=" + tenantId +
", clientKey='" + clientKey + '\'' +
'}';
}
}

View File

@ -0,0 +1,34 @@
package com.dyj.web.domain.vo;
public class CreateVideoVo extends BaseVo{
private String item_id;
private String video_id;
public String getItem_id() {
return item_id;
}
public void setItem_id(String item_id) {
this.item_id = item_id;
}
public String getVideo_id() {
return video_id;
}
public void setVideo_id(String video_id) {
this.video_id = video_id;
}
@Override
public String toString() {
return "CreateVideoVo{" +
"item_id='" + item_id + '\'' +
", video_id='" + video_id + '\'' +
", description='" + description + '\'' +
", error_code=" + error_code +
'}';
}
}

View File

@ -0,0 +1,23 @@
package com.dyj.web.domain.vo;
public class InitPartUploadVo extends BaseVo{
private String upload_id;
public String getUpload_id() {
return upload_id;
}
public void setUpload_id(String upload_id) {
this.upload_id = upload_id;
}
@Override
public String toString() {
return "InitPartUploadVo{" +
"upload_id='" + upload_id + '\'' +
", description='" + description + '\'' +
", error_code=" + error_code +
'}';
}
}

View File

@ -0,0 +1,49 @@
package com.dyj.web.domain.vo;
import com.dyj.web.domain.AccountVideo;
import java.util.List;
public class QueryVideoListVo extends BaseVo {
private Integer cursor;
private Boolean has_more;
private List<AccountVideo> list;
public Integer getCursor() {
return cursor;
}
public void setCursor(Integer cursor) {
this.cursor = cursor;
}
public Boolean getHas_more() {
return has_more;
}
public void setHas_more(Boolean has_more) {
this.has_more = has_more;
}
public List<AccountVideo> getList() {
return list;
}
public void setList(List<AccountVideo> list) {
this.list = list;
}
@Override
public String toString() {
return "QueryVideoListVo{" +
"cursor=" + cursor +
", has_more=" + has_more +
", list=" + list +
", description='" + description + '\'' +
", error_code=" + error_code +
'}';
}
}

View File

@ -0,0 +1,49 @@
package com.dyj.web.domain.vo;
import com.dyj.web.domain.VideoLocation;
import java.util.List;
public class QueryVideoLocationVo extends BaseVo {
private Integer cursor;
private Boolean has_more;
private List<VideoLocation> list;
public Integer getCursor() {
return cursor;
}
public void setCursor(Integer cursor) {
this.cursor = cursor;
}
public Boolean getHas_more() {
return has_more;
}
public void setHas_more(Boolean has_more) {
this.has_more = has_more;
}
public List<VideoLocation> getList() {
return list;
}
public void setList(List<VideoLocation> list) {
this.list = list;
}
@Override
public String toString() {
return "QueryVideoLocationVo{" +
"cursor=" + cursor +
", has_more=" + has_more +
", list=" + list +
", description='" + description + '\'' +
", error_code=" + error_code +
'}';
}
}

View File

@ -0,0 +1,24 @@
package com.dyj.web.domain.vo;
public class QueryVideoPublishResultVo extends BaseVo{
private String share_id;
public String getShare_id() {
return share_id;
}
public void setShare_id(String share_id) {
this.share_id = share_id;
}
@Override
public String toString() {
return "QueryVideoPublishResultVo{" +
"share_id='" + share_id + '\'' +
", description='" + description + '\'' +
", error_code=" + error_code +
'}';
}
}

View File

@ -0,0 +1,26 @@
package com.dyj.web.domain.vo;
import com.dyj.web.domain.UploadImage;
public class UploadImageVo extends BaseVo{
private UploadImage image;
public UploadImage getImage() {
return image;
}
public void setImage(UploadImage image) {
this.image = image;
}
@Override
public String
toString() {
return "UploadImageVo{" +
"image=" + image +
", description='" + description + '\'' +
", error_code=" + error_code +
'}';
}
}

View File

@ -0,0 +1,25 @@
package com.dyj.web.domain.vo;
import com.dyj.web.domain.UploadVideo;
public class UploadVideoVo extends BaseVo {
private UploadVideo video;
public UploadVideo getVideo() {
return video;
}
public void setVideo(UploadVideo video) {
this.video = video;
}
@Override
public String toString() {
return "UploadVideoVo{" +
"video=" + video +
", description='" + description + '\'' +
", error_code=" + error_code +
'}';
}
}

View File

@ -0,0 +1,68 @@
package com.dyj.web.domain.vo;
public class VideoIframeVo extends BaseVo {
/**
* 视频iframe代码
*/
private String iframe_code;
/**
* 视频高度
*/
private String video_height;
/**
* 视频标题
*/
private String video_title;
/**
* 视频宽度
*/
private String video_width;
public String getIframe_code() {
return iframe_code;
}
public void setIframe_code(String iframe_code) {
this.iframe_code = iframe_code;
}
public String getVideo_height() {
return video_height;
}
public void setVideo_height(String video_height) {
this.video_height = video_height;
}
public String getVideo_title() {
return video_title;
}
public void setVideo_title(String video_title) {
this.video_title = video_title;
}
public String getVideo_width() {
return video_width;
}
public void setVideo_width(String video_width) {
this.video_width = video_width;
}
@Override
public String toString() {
return "QueryVideoIframeVo{" +
"iframe_code='" + iframe_code + '\'' +
", video_height='" + video_height + '\'' +
", video_title='" + video_title + '\'' +
", video_width='" + video_width + '\'' +
", description='" + description + '\'' +
", error_code=" + error_code +
'}';
}
}

View File

@ -0,0 +1,118 @@
package com.dyj.web.handler;
import com.dyj.common.config.AgentConfiguration;
import com.dyj.common.domain.DyResult;
import com.dyj.spring.utils.SpringUtils;
import com.dyj.web.client.VideoClient;
import com.dyj.web.domain.query.*;
import com.dyj.web.domain.vo.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class VideoHandler {
private final VideoClient videoClient;
private final AgentConfiguration agentConfiguration;
{
videoClient = SpringUtils.getBean(VideoClient.class);
}
public VideoHandler(AgentConfiguration agentConfiguration) {
this.agentConfiguration = agentConfiguration;
}
public DyResult<CreateImageTextVo> createImageText(CreateImageTextQuery query) {
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
return videoClient.createImageText(query);
}
public DyResult<UploadImageVo> uploadImage(String openId, File file) throws FileNotFoundException {
UserInfoQuery query = new UserInfoQuery();
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
query.setOpen_id(openId);
FileInputStream inputStream = new FileInputStream(file);
return videoClient.uploadImage(query, inputStream);
}
public DyResult<UploadVideoVo> uploadVideo(String openId, File file) throws FileNotFoundException {
UserInfoQuery query = new UserInfoQuery();
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
query.setOpen_id(openId);
FileInputStream inputStream = new FileInputStream(file);
return videoClient.uploadVideo(query, inputStream);
}
public DyResult<CreateVideoVo> createVideo(CreateVideoQuery query) {
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
return videoClient.createVideo(query);
}
public DyResult<UploadVideoVo> completeVideoPartUpdate(String openId, String uploadId) {
UserInfoQuery query = new UserInfoQuery();
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
query.setOpen_id(openId);
return videoClient.completeVideoPartUpload(query, uploadId);
}
public DyResult<BaseVo> updateVideoPart(String openId, String uploadId, Integer partNumber, File file) throws FileNotFoundException {
UserInfoQuery query = new UserInfoQuery();
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
query.setOpen_id(openId);
FileInputStream inputStream = new FileInputStream(file);
return videoClient.uploadVideoPart(query, uploadId, partNumber, inputStream);
}
public DyResult<InitPartUploadVo> initializeVideoPartUpload(String openId) {
UserInfoQuery query = new UserInfoQuery();
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
query.setOpen_id(openId);
return videoClient.initializeVideoPartUpload(query);
}
public DyResult<QueryVideoListVo> queryVideoList(String openId, Integer cursor, Integer count) {
UserInfoQuery query = new UserInfoQuery();
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
query.setOpen_id(openId);
return videoClient.queryVideoList(query, cursor, count);
}
public DyResult<QueryVideoListVo> queryVideoData(VideoDataQuery query) {
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
return videoClient.queryVideoData(query);
}
public DyResult<QueryVideoPublishResultVo> queryVideoPublishResult(String defaultHashtag, String linkParam, Boolean needCallback, String sourceStyleId) {
BaseQuery query = new UserInfoQuery();
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
return videoClient.queryVideoPublishResult(query, defaultHashtag, linkParam, needCallback, sourceStyleId);
}
public DyResult<QueryVideoLocationVo> queryVideoLocation(Integer count, String keyword, String city, Integer cursor) {
BaseQuery query = new UserInfoQuery();
query.setTenantId(agentConfiguration.getTenantId());
query.setClientKey(agentConfiguration.getClientKey());
return videoClient.queryVideoLocation(query, count, keyword, city, cursor);
}
public DyResult<VideoIframeVo> getIframeByVideo(String videoId) {
return videoClient.getIframeByVideo(videoId);
}
public DyResult<VideoIframeVo> getIframeByItem(String itemId) {
return videoClient.getIframeByItem(itemId, agentConfiguration.getClientKey());
}
}

View File

@ -0,0 +1,25 @@
package com.dyj.web.interceptor;
import com.dtflys.forest.exceptions.ForestRuntimeException;
import com.dtflys.forest.http.ForestRequest;
import com.dtflys.forest.http.ForestResponse;
import com.dtflys.forest.interceptor.Interceptor;
import com.dyj.common.domain.DyResult;
public class ClientTokenInterceptor implements Interceptor<DyResult> {
@Override
public boolean beforeExecute(ForestRequest request) {
return Interceptor.super.beforeExecute(request);
}
@Override
public void onSuccess(DyResult data, ForestRequest request, ForestResponse response) {
Interceptor.super.onSuccess(data, request, response);
}
@Override
public void onError(ForestRuntimeException ex, ForestRequest request, ForestResponse response) {
Interceptor.super.onError(ex, request, response);
}
}