bug修改,根性视频meta信息
This commit is contained in:
parent
c27665e513
commit
5c0bf09c95
@ -0,0 +1,22 @@
|
|||||||
|
package com.ycwl.basic.controller.mobile;
|
||||||
|
|
||||||
|
import com.ycwl.basic.model.task.req.VideoInfoReq;
|
||||||
|
import com.ycwl.basic.repository.VideoRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/mobile/video/v1")
|
||||||
|
public class AppVideoController {
|
||||||
|
@Autowired
|
||||||
|
private VideoRepository videoRepository;
|
||||||
|
|
||||||
|
@PostMapping("/{videoId}/updateMeta")
|
||||||
|
public void updateMeta(@PathVariable("videoId") Long videoId, @RequestBody VideoInfoReq req) {
|
||||||
|
videoRepository.updateMeta(videoId, req);
|
||||||
|
}
|
||||||
|
}
|
@ -22,6 +22,7 @@ public interface VideoMapper {
|
|||||||
int add(VideoEntity task);
|
int add(VideoEntity task);
|
||||||
int deleteById(Long id);
|
int deleteById(Long id);
|
||||||
int update(VideoEntity task);
|
int update(VideoEntity task);
|
||||||
|
int updateMeta(VideoEntity task);
|
||||||
|
|
||||||
VideoEntity findByTaskId(@NonNull Long taskId);
|
VideoEntity findByTaskId(@NonNull Long taskId);
|
||||||
|
|
||||||
|
@ -50,4 +50,7 @@ public class VideoGoodsDetailVO {
|
|||||||
private Integer lensNum;
|
private Integer lensNum;
|
||||||
private Long faceId;
|
private Long faceId;
|
||||||
private boolean share = false;
|
private boolean share = false;
|
||||||
|
private Integer height;
|
||||||
|
private Integer width;
|
||||||
|
private BigDecimal duration;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,4 +48,8 @@ public class VideoEntity {
|
|||||||
private Integer isBuy;
|
private Integer isBuy;
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
private Integer height;
|
||||||
|
private Integer width;
|
||||||
|
private BigDecimal duration;
|
||||||
}
|
}
|
||||||
|
@ -60,4 +60,7 @@ public class VideoRespVO {
|
|||||||
private Date createTime;
|
private Date createTime;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
private Integer height;
|
||||||
|
private Integer width;
|
||||||
|
private BigDecimal duration;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
package com.ycwl.basic.model.task.req;
|
package com.ycwl.basic.model.task.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
public class VideoInfoReq {
|
public class VideoInfoReq {
|
||||||
private Integer height;
|
private Integer height;
|
||||||
private Integer width;
|
private Integer width;
|
||||||
private Float duration;
|
private BigDecimal duration;
|
||||||
}
|
}
|
||||||
|
34
src/main/java/com/ycwl/basic/repository/VideoRepository.java
Normal file
34
src/main/java/com/ycwl/basic/repository/VideoRepository.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package com.ycwl.basic.repository;
|
||||||
|
|
||||||
|
import com.ycwl.basic.mapper.VideoMapper;
|
||||||
|
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
||||||
|
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||||
|
import com.ycwl.basic.model.task.req.VideoInfoReq;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class VideoRepository {
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
@Autowired
|
||||||
|
private VideoMapper videoMapper;
|
||||||
|
|
||||||
|
public void updateMeta(Long videoId, VideoInfoReq req) {
|
||||||
|
VideoRespVO video = videoMapper.getById(videoId);
|
||||||
|
if (video.getDuration() != null) {
|
||||||
|
if (video.getDuration().subtract(req.getDuration()).abs().compareTo(BigDecimal.ONE) <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
VideoEntity update = new VideoEntity();
|
||||||
|
update.setId(videoId);
|
||||||
|
update.setHeight(req.getHeight());
|
||||||
|
update.setWidth(req.getWidth());
|
||||||
|
update.setDuration(req.getDuration());
|
||||||
|
videoMapper.updateMeta(update);
|
||||||
|
}
|
||||||
|
}
|
@ -14,8 +14,6 @@ public class VideoTaskRepository {
|
|||||||
private RedisTemplate<String, String> redisTemplate;
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TaskMapper taskMapper;
|
private TaskMapper taskMapper;
|
||||||
@Autowired
|
|
||||||
private VideoMapper videoMapper;
|
|
||||||
|
|
||||||
public static final String TASK_CACHE_KEY = "task:byId:%s";
|
public static final String TASK_CACHE_KEY = "task:byId:%s";
|
||||||
|
|
||||||
|
@ -196,6 +196,9 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
goodsDetailVO.setVideoUrl(videoRespVO.getVideoUrl());
|
goodsDetailVO.setVideoUrl(videoRespVO.getVideoUrl());
|
||||||
goodsDetailVO.setTemplateCoverUrl(videoRespVO.getTemplateCoverUrl());
|
goodsDetailVO.setTemplateCoverUrl(videoRespVO.getTemplateCoverUrl());
|
||||||
goodsDetailVO.setCreateTime(videoRespVO.getCreateTime());
|
goodsDetailVO.setCreateTime(videoRespVO.getCreateTime());
|
||||||
|
goodsDetailVO.setHeight(videoRespVO.getHeight());
|
||||||
|
goodsDetailVO.setWidth(videoRespVO.getWidth());
|
||||||
|
goodsDetailVO.setDuration(videoRespVO.getDuration());
|
||||||
if (userId == null) {
|
if (userId == null) {
|
||||||
goodsDetailVO.setIsBuy(0);
|
goodsDetailVO.setIsBuy(0);
|
||||||
goodsDetailVO.setShare(true);
|
goodsDetailVO.setShare(true);
|
||||||
|
@ -364,6 +364,11 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
VideoEntity video = videoMapper.findByTaskId(taskId);
|
VideoEntity video = videoMapper.findByTaskId(taskId);
|
||||||
if (video != null) {
|
if (video != null) {
|
||||||
video.setVideoUrl(task.getVideoUrl());
|
video.setVideoUrl(task.getVideoUrl());
|
||||||
|
if (req.getVideoInfo() != null) {
|
||||||
|
video.setHeight(req.getVideoInfo().getHeight());
|
||||||
|
video.setWidth(req.getVideoInfo().getWidth());
|
||||||
|
video.setDuration(req.getVideoInfo().getDuration());
|
||||||
|
}
|
||||||
videoMapper.update(video);
|
videoMapper.update(video);
|
||||||
} else {
|
} else {
|
||||||
video = new VideoEntity();
|
video = new VideoEntity();
|
||||||
@ -374,6 +379,11 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
video.setWorkerId(worker.getId());
|
video.setWorkerId(worker.getId());
|
||||||
video.setVideoUrl(task.getVideoUrl());
|
video.setVideoUrl(task.getVideoUrl());
|
||||||
video.setCreateTime(new Date());
|
video.setCreateTime(new Date());
|
||||||
|
if (req.getVideoInfo() != null) {
|
||||||
|
video.setHeight(req.getVideoInfo().getHeight());
|
||||||
|
video.setWidth(req.getVideoInfo().getWidth());
|
||||||
|
video.setDuration(req.getVideoInfo().getDuration());
|
||||||
|
}
|
||||||
videoMapper.add(video);
|
videoMapper.add(video);
|
||||||
}
|
}
|
||||||
int isBuy = 0;
|
int isBuy = 0;
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
</update>
|
</update>
|
||||||
<update id="setStart">
|
<update id="setStart">
|
||||||
update task
|
update task
|
||||||
set start_time = now(), worker_id = #{workerId}
|
set start_time = now(), end_time = null, worker_id = #{workerId}
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
<update id="setSuccess">
|
<update id="setSuccess">
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ycwl.basic.mapper.VideoMapper">
|
<mapper namespace="com.ycwl.basic.mapper.VideoMapper">
|
||||||
<insert id="add">
|
<insert id="add">
|
||||||
insert into video(id, scenic_id, template_id, task_id, worker_id, video_url)
|
insert into video(id, scenic_id, template_id, task_id, worker_id, video_url, height, width, duration)
|
||||||
values (#{id}, #{scenicId}, #{templateId}, #{taskId}, #{workerId}, #{videoUrl})
|
values (#{id}, #{scenicId}, #{templateId}, #{taskId}, #{workerId}, #{videoUrl}, #{height}, #{width}, #{duration})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="addRelation">
|
<insert id="addRelation">
|
||||||
replace member_video(member_id, scenic_id, face_id, template_id, task_id, video_id, is_buy, order_id)
|
replace member_video(member_id, scenic_id, face_id, template_id, task_id, video_id, is_buy, order_id)
|
||||||
@ -24,9 +24,19 @@
|
|||||||
<if test="taskId!= null">task_id = #{taskId}, </if>
|
<if test="taskId!= null">task_id = #{taskId}, </if>
|
||||||
<if test="workerId!= null">worker_id = #{workerId}, </if>
|
<if test="workerId!= null">worker_id = #{workerId}, </if>
|
||||||
<if test="videoUrl!= null">video_url = #{videoUrl}, </if>
|
<if test="videoUrl!= null">video_url = #{videoUrl}, </if>
|
||||||
|
<if test="height!= null">height = #{height}, </if>
|
||||||
|
<if test="width!= null">width = #{width}, </if>
|
||||||
|
<if test="duration!= null">duration = #{duration}, </if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateMeta">
|
||||||
|
update video
|
||||||
|
set height = #{height},
|
||||||
|
width = #{width},
|
||||||
|
duration = #{duration}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
<update id="updateRelation">
|
<update id="updateRelation">
|
||||||
update member_video
|
update member_video
|
||||||
<set>
|
<set>
|
||||||
@ -67,7 +77,7 @@
|
|||||||
<select id="getById" resultType="com.ycwl.basic.model.pc.video.resp.VideoRespVO">
|
<select id="getById" resultType="com.ycwl.basic.model.pc.video.resp.VideoRespVO">
|
||||||
select v.id, v.scenic_id, template_id, task_id, worker_id, video_url, v.create_time, v.update_time,
|
select v.id, v.scenic_id, template_id, task_id, worker_id, video_url, v.create_time, v.update_time,
|
||||||
t.name templateName,t.price templatePrice, t.cover_url templateCoverUrl, t.slash_price slashPrice,
|
t.name templateName,t.price templatePrice, t.cover_url templateCoverUrl, t.slash_price slashPrice,
|
||||||
s.name scenicName
|
s.name scenicName, v.height, v.width, v.duration
|
||||||
from video v
|
from video v
|
||||||
left join scenic s on v.scenic_id = s.id
|
left join scenic s on v.scenic_id = s.id
|
||||||
left join template t on v.template_id = t.id
|
left join template t on v.template_id = t.id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user