改bug
This commit is contained in:
parent
ade7193e64
commit
c376e3b1b6
@ -38,4 +38,9 @@ AppFaceController {
|
|||||||
public ApiResponse faceUpload(@RequestParam("file")MultipartFile file, @RequestParam("scenicId") Long scenicId) {
|
public ApiResponse faceUpload(@RequestParam("file")MultipartFile file, @RequestParam("scenicId") Long scenicId) {
|
||||||
return faceService.faceUpload(file,scenicId);
|
return faceService.faceUpload(file,scenicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{faceId}")
|
||||||
|
public ApiResponse<FaceRespVO> getById(@PathVariable("faceId") Long faceId) {
|
||||||
|
return faceService.getById(faceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,12 @@ public class AppGoodsController {
|
|||||||
return goodsService.videoGoodsDetail(worker.getUserId(), videoId);
|
return goodsService.videoGoodsDetail(worker.getUserId(), videoId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/sourceGoods/{sourceId}")
|
||||||
|
public ApiResponse<GoodsDetailVO> sourceGoodsInfo(@PathVariable("sourceId") Long sourceId) {
|
||||||
|
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||||
|
return goodsService.sourceGoodsInfo(worker.getUserId(), sourceId);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("查询价格")
|
@ApiOperation("查询价格")
|
||||||
@PostMapping("/queryPrice")
|
@PostMapping("/queryPrice")
|
||||||
public ApiResponse<BigDecimal> queryPrice(@RequestBody GoodsPriceQueryReq queryPriceData) {
|
public ApiResponse<BigDecimal> queryPrice(@RequestBody GoodsPriceQueryReq queryPriceData) {
|
||||||
|
@ -49,6 +49,7 @@ public interface SourceMapper {
|
|||||||
int addRelation(MemberSourceEntity source);
|
int addRelation(MemberSourceEntity source);
|
||||||
|
|
||||||
List<SourceRespVO> listUser(SourceReqQuery sourceReqQuery);
|
List<SourceRespVO> listUser(SourceReqQuery sourceReqQuery);
|
||||||
|
SourceRespVO listUserOne(Long userId, Long sourceId);
|
||||||
|
|
||||||
int addRelations(List<MemberSourceEntity> list);
|
int addRelations(List<MemberSourceEntity> list);
|
||||||
|
|
||||||
@ -61,4 +62,5 @@ public interface SourceMapper {
|
|||||||
int hasRelationTo(Long memberId, Long sourceId, int type);
|
int hasRelationTo(Long memberId, Long sourceId, int type);
|
||||||
|
|
||||||
List<SourceEntity> listVideoByFaceRelation(Long faceId);
|
List<SourceEntity> listVideoByFaceRelation(Long faceId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,11 @@ import lombok.Data;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class VideoTaskStatusVO {
|
public class VideoTaskStatusVO {
|
||||||
private Integer status;
|
private int status;
|
||||||
private Long videoId;
|
private Long videoId;
|
||||||
private Long templateId;
|
private Long templateId;
|
||||||
private Long faceId;
|
private Long faceId;
|
||||||
private Long scenicId;
|
private Long scenicId;
|
||||||
|
private int count;
|
||||||
|
private int maxCount;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.ycwl.basic.face.repository;
|
package com.ycwl.basic.repository;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
package com.ycwl.basic.repository;
|
||||||
|
|
||||||
|
public class ScenicRepository {
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.ycwl.basic.template.repository;
|
package com.ycwl.basic.repository;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ycwl.basic.mapper.FaceMapper;
|
import com.ycwl.basic.mapper.FaceMapper;
|
@ -0,0 +1,4 @@
|
|||||||
|
package com.ycwl.basic.repository;
|
||||||
|
|
||||||
|
public class VideoTaskRepository {
|
||||||
|
}
|
@ -23,7 +23,7 @@ import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
|
|||||||
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
||||||
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
|
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
|
||||||
import com.ycwl.basic.service.mobile.AppScenicService;
|
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||||
import com.ycwl.basic.template.repository.TemplateRepository;
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import com.ycwl.basic.utils.JwtTokenUtil;
|
import com.ycwl.basic.utils.JwtTokenUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -16,7 +16,7 @@ import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
|||||||
import com.ycwl.basic.model.pc.video.req.VideoReqQuery;
|
import com.ycwl.basic.model.pc.video.req.VideoReqQuery;
|
||||||
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||||
import com.ycwl.basic.service.mobile.GoodsService;
|
import com.ycwl.basic.service.mobile.GoodsService;
|
||||||
import com.ycwl.basic.template.repository.TemplateRepository;
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import com.ycwl.basic.utils.DateUtils;
|
import com.ycwl.basic.utils.DateUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -85,8 +85,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
List<GoodsPageVO> sourceGoods = sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getFaceId)).entrySet().stream().flatMap((faceEntry) -> {
|
List<GoodsPageVO> sourceGoods = sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getFaceId)).entrySet().stream().flatMap((faceEntry) -> {
|
||||||
Long faceId = faceEntry.getKey();
|
Long faceId = faceEntry.getKey();
|
||||||
List<SourceRespVO> goods = faceEntry.getValue();
|
List<SourceRespVO> goods = faceEntry.getValue();
|
||||||
return goods.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).entrySet().stream().map((typeEntry) -> {
|
return goods.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).keySet().stream().map(type -> {
|
||||||
Integer type = typeEntry.getKey();
|
|
||||||
GoodsPageVO goodsPageVO = new GoodsPageVO();
|
GoodsPageVO goodsPageVO = new GoodsPageVO();
|
||||||
goodsPageVO.setFaceId(faceId);
|
goodsPageVO.setFaceId(faceId);
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
@ -252,7 +251,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
}
|
}
|
||||||
long nullTask = taskList.stream().filter(Objects::isNull).count();
|
long nullTask = taskList.stream().filter(Objects::isNull).count();
|
||||||
if (nullTask > 0) {
|
if (nullTask > 0) {
|
||||||
response.setStatus(0);
|
response.setStatus(2);
|
||||||
return ApiResponse.success(response);
|
return ApiResponse.success(response);
|
||||||
}
|
}
|
||||||
Optional<TaskEntity> taskEntity = taskList.stream().filter(task -> 1 == task.getStatus()).findFirst();
|
Optional<TaskEntity> taskEntity = taskList.stream().filter(task -> 1 == task.getStatus()).findFirst();
|
||||||
@ -260,6 +259,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
response.setTemplateId(taskEntity.get().getTemplateId());
|
response.setTemplateId(taskEntity.get().getTemplateId());
|
||||||
VideoEntity video = videoMapper.findByTaskId(taskEntity.get().getId());
|
VideoEntity video = videoMapper.findByTaskId(taskEntity.get().getId());
|
||||||
response.setVideoId(video.getId());
|
response.setVideoId(video.getId());
|
||||||
|
response.setCount(taskList.size());
|
||||||
response.setStatus(1);
|
response.setStatus(1);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(2);
|
response.setStatus(2);
|
||||||
@ -304,22 +304,25 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
response.setStatus(-2);
|
response.setStatus(-2);
|
||||||
return ApiResponse.success(response);
|
return ApiResponse.success(response);
|
||||||
}
|
}
|
||||||
response.setFaceId(faceVO.getId());
|
return getTaskStatusByFaceId(userId, faceVO.getId());
|
||||||
List<TaskEntity> taskList = videoMapper.listTaskByScenicRelation(userId, scenicId);
|
|
||||||
if (taskList.isEmpty()) {
|
|
||||||
response.setStatus(0);
|
|
||||||
return ApiResponse.success(response);
|
|
||||||
}
|
}
|
||||||
Optional<TaskEntity> taskEntity = taskList.stream().filter(task -> task.getStatus() == 1).findFirst();
|
|
||||||
if (taskEntity.isPresent()) {
|
@Override
|
||||||
response.setTemplateId(taskEntity.get().getTemplateId());
|
public ApiResponse<GoodsDetailVO> sourceGoodsInfo(Long userId, Long sourceId) {
|
||||||
VideoEntity video = videoMapper.findByTaskId(taskEntity.get().getId());
|
SourceRespVO sourceRespVO = sourceMapper.listUserOne(userId, sourceId);
|
||||||
response.setVideoId(video.getId());
|
// if (sourceRespVO == null) {
|
||||||
response.setStatus(1);
|
// return ApiResponse.fail("该视频不属于你");
|
||||||
} else {
|
// }
|
||||||
response.setStatus(2);
|
GoodsDetailVO goodsDetailVO = new GoodsDetailVO();
|
||||||
}
|
goodsDetailVO.setGoodsName("原片");
|
||||||
return ApiResponse.success(response);
|
goodsDetailVO.setScenicId(sourceRespVO.getScenicId());
|
||||||
|
goodsDetailVO.setScenicName(sourceRespVO.getScenicName());
|
||||||
|
goodsDetailVO.setGoodsType(0);
|
||||||
|
goodsDetailVO.setGoodsId(sourceRespVO.getId());
|
||||||
|
goodsDetailVO.setVideoUrl(sourceRespVO.getVideoUrl());
|
||||||
|
goodsDetailVO.setTemplateCoverUrl(sourceRespVO.getUrl());
|
||||||
|
goodsDetailVO.setCreateTime(sourceRespVO.getCreateTime());
|
||||||
|
return ApiResponse.success(goodsDetailVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.ycwl.basic.model.pc.template.entity.TemplateEntity;
|
|||||||
import com.ycwl.basic.model.pc.template.req.TemplateReqQuery;
|
import com.ycwl.basic.model.pc.template.req.TemplateReqQuery;
|
||||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||||
import com.ycwl.basic.service.pc.TemplateService;
|
import com.ycwl.basic.service.pc.TemplateService;
|
||||||
import com.ycwl.basic.template.repository.TemplateRepository;
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -30,6 +30,7 @@ import com.ycwl.basic.service.task.TaskService;
|
|||||||
import com.ycwl.basic.storage.StorageFactory;
|
import com.ycwl.basic.storage.StorageFactory;
|
||||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||||
import com.ycwl.basic.task.VideoPieceGetter;
|
import com.ycwl.basic.task.VideoPieceGetter;
|
||||||
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -65,6 +66,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
private SourceMapper sourceMapper;
|
private SourceMapper sourceMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private VideoMapper videoMapper;
|
private VideoMapper videoMapper;
|
||||||
|
@Autowired
|
||||||
|
private TemplateRepository templateRepository;
|
||||||
|
|
||||||
private RenderWorkerEntity getWorker(@NonNull WorkerAuthReqVo req) {
|
private RenderWorkerEntity getWorker(@NonNull WorkerAuthReqVo req) {
|
||||||
String accessKey = req.getAccessKey();
|
String accessKey = req.getAccessKey();
|
||||||
@ -105,19 +108,6 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
renderWorkerMapper.update(worker);
|
renderWorkerMapper.update(worker);
|
||||||
TaskSyncRespVo resp = new TaskSyncRespVo();
|
TaskSyncRespVo resp = new TaskSyncRespVo();
|
||||||
// Template
|
// Template
|
||||||
// String cacheJson = redisTemplate.opsForValue().get(TaskConstant.TASK_TEMPLATE_KEY_PFX + worker.getId());
|
|
||||||
// if (cacheJson == null) {
|
|
||||||
// TemplateReqQuery templateReqQuery = new TemplateReqQuery();
|
|
||||||
// templateReqQuery.setPid(0L);
|
|
||||||
// List<TemplateRespVO> templateList = templateMapper.list(templateReqQuery);
|
|
||||||
// for (TemplateRespVO template : templateList) {
|
|
||||||
// template.setChildren(templateMapper.getByPid(template.getId()));
|
|
||||||
// }
|
|
||||||
// resp.setTemplates(templateList);
|
|
||||||
// redisTemplate.opsForValue().set(TaskConstant.TASK_TEMPLATE_KEY_PFX + worker.getId(), JSON.toJSONString(templateList), 60, TimeUnit.SECONDS);
|
|
||||||
// } else {
|
|
||||||
// resp.setTemplates(JSON.parseArray(cacheJson, TemplateRespVO.class));
|
|
||||||
// }
|
|
||||||
List<TaskRespVO> taskList = taskMapper.selectNotRunning();
|
List<TaskRespVO> taskList = taskMapper.selectNotRunning();
|
||||||
resp.setTasks(taskList);
|
resp.setTasks(taskList);
|
||||||
taskList.forEach(task -> taskMapper.assignToWorker(task.getId(), worker.getId()));
|
taskList.forEach(task -> taskMapper.assignToWorker(task.getId(), worker.getId()));
|
||||||
@ -131,7 +121,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
if (faceId == null) {
|
if (faceId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TemplateConfigEntity config = templateMapper.getConfig(templateId);
|
TemplateConfigEntity config = templateRepository.getTemplateConfig(templateId);
|
||||||
FaceRespVO faceRespVO = faceMapper.getById(faceId);
|
FaceRespVO faceRespVO = faceMapper.getById(faceId);
|
||||||
if (faceRespVO == null) {
|
if (faceRespVO == null) {
|
||||||
return;
|
return;
|
||||||
@ -168,9 +158,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
if (worker == null) {
|
if (worker == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
TemplateRespVO respVO = templateMapper.getById(templateId);
|
return templateRepository.getTemplate(templateId);
|
||||||
respVO.setChildren(templateMapper.getByPid(templateId));
|
|
||||||
return respVO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -202,6 +190,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
if (faceSampleList.isEmpty()) {
|
if (faceSampleList.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// TODO: 优化
|
||||||
List<TemplateEntity> templateList = templateMapper.listEnabledByScenicId(faceRespVO.getScenicId());
|
List<TemplateEntity> templateList = templateMapper.listEnabledByScenicId(faceRespVO.getScenicId());
|
||||||
if (templateList == null || templateList.isEmpty()) {
|
if (templateList == null || templateList.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -51,4 +51,6 @@ public interface GoodsService {
|
|||||||
ApiResponse<VideoTaskStatusVO> getTemplateTaskStatus(Long userId, Long faceId, Long templateId);
|
ApiResponse<VideoTaskStatusVO> getTemplateTaskStatus(Long userId, Long faceId, Long templateId);
|
||||||
|
|
||||||
ApiResponse<VideoTaskStatusVO> getTaskStatusByScenicId(Long userId, Long scenicId);
|
ApiResponse<VideoTaskStatusVO> getTaskStatusByScenicId(Long userId, Long scenicId);
|
||||||
|
|
||||||
|
ApiResponse<GoodsDetailVO> sourceGoodsInfo(Long userId, Long sourceId);
|
||||||
}
|
}
|
||||||
|
@ -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.SourceMapper">
|
<mapper namespace="com.ycwl.basic.mapper.SourceMapper">
|
||||||
<insert id="add">
|
<insert id="add">
|
||||||
insert into source(id, scenic_id, device_id, url, video_url, `type`, face_sample_id, pos_json)
|
insert into source(id, scenic_id, device_id, url, video_url, `type`, face_sample_id, pos_json, create_time)
|
||||||
values (#{id}, #{scenicId}, #{deviceId}, #{url}, #{videoUrl}, #{type}, #{faceSampleId}, #{posJson})
|
values (#{id}, #{scenicId}, #{deviceId}, #{url}, #{videoUrl}, #{type}, #{faceSampleId}, #{posJson}, #{createTime})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="addRelation">
|
<insert id="addRelation">
|
||||||
replace member_source(scenic_id, face_id, member_id, source_id, is_buy, type, order_id)
|
replace member_source(scenic_id, face_id, member_id, source_id, is_buy, type, order_id)
|
||||||
@ -123,6 +123,15 @@
|
|||||||
<if test="faceId!=null">and ms.face_id = #{faceId} </if>
|
<if test="faceId!=null">and ms.face_id = #{faceId} </if>
|
||||||
order by so.create_time desc
|
order by so.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="listUserOne" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||||
|
select so.id, ms.scenic_id, device_id, url, video_url, so.create_time, so.update_time,sc.`name` as scenicName
|
||||||
|
from member_source ms
|
||||||
|
left join source so on ms.source_id = so.id
|
||||||
|
left join scenic sc on sc.id = so.scenic_id
|
||||||
|
where ms.member_id = #{userId} and ms.source_id = #{sourceId}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
<select id="queryByRelation" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
<select id="queryByRelation" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||||
select so.id, ms.face_id, ms.scenic_id, ms.type, so.url, so.create_time, so.update_time,sc.`name` as scenicName
|
select so.id, ms.face_id, ms.scenic_id, ms.type, so.url, so.create_time, so.update_time,sc.`name` as scenicName
|
||||||
from member_source ms
|
from member_source ms
|
||||||
|
Loading…
x
Reference in New Issue
Block a user