改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) {
|
||||
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);
|
||||
}
|
||||
|
||||
@GetMapping("/sourceGoods/{sourceId}")
|
||||
public ApiResponse<GoodsDetailVO> sourceGoodsInfo(@PathVariable("sourceId") Long sourceId) {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
return goodsService.sourceGoodsInfo(worker.getUserId(), sourceId);
|
||||
}
|
||||
|
||||
@ApiOperation("查询价格")
|
||||
@PostMapping("/queryPrice")
|
||||
public ApiResponse<BigDecimal> queryPrice(@RequestBody GoodsPriceQueryReq queryPriceData) {
|
||||
|
@ -49,6 +49,7 @@ public interface SourceMapper {
|
||||
int addRelation(MemberSourceEntity source);
|
||||
|
||||
List<SourceRespVO> listUser(SourceReqQuery sourceReqQuery);
|
||||
SourceRespVO listUserOne(Long userId, Long sourceId);
|
||||
|
||||
int addRelations(List<MemberSourceEntity> list);
|
||||
|
||||
@ -61,4 +62,5 @@ public interface SourceMapper {
|
||||
int hasRelationTo(Long memberId, Long sourceId, int type);
|
||||
|
||||
List<SourceEntity> listVideoByFaceRelation(Long faceId);
|
||||
|
||||
}
|
||||
|
@ -4,9 +4,11 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class VideoTaskStatusVO {
|
||||
private Integer status;
|
||||
private int status;
|
||||
private Long videoId;
|
||||
private Long templateId;
|
||||
private Long faceId;
|
||||
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;
|
||||
|
@ -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.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.video.entity.MemberVideoEntity;
|
||||
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.JwtTokenUtil;
|
||||
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.resp.VideoRespVO;
|
||||
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.DateUtils;
|
||||
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) -> {
|
||||
Long faceId = faceEntry.getKey();
|
||||
List<SourceRespVO> goods = faceEntry.getValue();
|
||||
return goods.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).entrySet().stream().map((typeEntry) -> {
|
||||
Integer type = typeEntry.getKey();
|
||||
return goods.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).keySet().stream().map(type -> {
|
||||
GoodsPageVO goodsPageVO = new GoodsPageVO();
|
||||
goodsPageVO.setFaceId(faceId);
|
||||
if (type == 1) {
|
||||
@ -252,7 +251,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
}
|
||||
long nullTask = taskList.stream().filter(Objects::isNull).count();
|
||||
if (nullTask > 0) {
|
||||
response.setStatus(0);
|
||||
response.setStatus(2);
|
||||
return ApiResponse.success(response);
|
||||
}
|
||||
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());
|
||||
VideoEntity video = videoMapper.findByTaskId(taskEntity.get().getId());
|
||||
response.setVideoId(video.getId());
|
||||
response.setCount(taskList.size());
|
||||
response.setStatus(1);
|
||||
} else {
|
||||
response.setStatus(2);
|
||||
@ -304,22 +304,25 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
response.setStatus(-2);
|
||||
return ApiResponse.success(response);
|
||||
}
|
||||
response.setFaceId(faceVO.getId());
|
||||
List<TaskEntity> taskList = videoMapper.listTaskByScenicRelation(userId, scenicId);
|
||||
if (taskList.isEmpty()) {
|
||||
response.setStatus(0);
|
||||
return ApiResponse.success(response);
|
||||
return getTaskStatusByFaceId(userId, faceVO.getId());
|
||||
}
|
||||
Optional<TaskEntity> taskEntity = taskList.stream().filter(task -> task.getStatus() == 1).findFirst();
|
||||
if (taskEntity.isPresent()) {
|
||||
response.setTemplateId(taskEntity.get().getTemplateId());
|
||||
VideoEntity video = videoMapper.findByTaskId(taskEntity.get().getId());
|
||||
response.setVideoId(video.getId());
|
||||
response.setStatus(1);
|
||||
} else {
|
||||
response.setStatus(2);
|
||||
}
|
||||
return ApiResponse.success(response);
|
||||
|
||||
@Override
|
||||
public ApiResponse<GoodsDetailVO> sourceGoodsInfo(Long userId, Long sourceId) {
|
||||
SourceRespVO sourceRespVO = sourceMapper.listUserOne(userId, sourceId);
|
||||
// if (sourceRespVO == null) {
|
||||
// return ApiResponse.fail("该视频不属于你");
|
||||
// }
|
||||
GoodsDetailVO goodsDetailVO = new GoodsDetailVO();
|
||||
goodsDetailVO.setGoodsName("原片");
|
||||
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.resp.TemplateRespVO;
|
||||
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.SnowFlakeUtil;
|
||||
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.adapters.IStorageAdapter;
|
||||
import com.ycwl.basic.task.VideoPieceGetter;
|
||||
import com.ycwl.basic.repository.TemplateRepository;
|
||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||
import lombok.NonNull;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -65,6 +66,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
private SourceMapper sourceMapper;
|
||||
@Autowired
|
||||
private VideoMapper videoMapper;
|
||||
@Autowired
|
||||
private TemplateRepository templateRepository;
|
||||
|
||||
private RenderWorkerEntity getWorker(@NonNull WorkerAuthReqVo req) {
|
||||
String accessKey = req.getAccessKey();
|
||||
@ -105,19 +108,6 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
renderWorkerMapper.update(worker);
|
||||
TaskSyncRespVo resp = new TaskSyncRespVo();
|
||||
// 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();
|
||||
resp.setTasks(taskList);
|
||||
taskList.forEach(task -> taskMapper.assignToWorker(task.getId(), worker.getId()));
|
||||
@ -131,7 +121,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
if (faceId == null) {
|
||||
return;
|
||||
}
|
||||
TemplateConfigEntity config = templateMapper.getConfig(templateId);
|
||||
TemplateConfigEntity config = templateRepository.getTemplateConfig(templateId);
|
||||
FaceRespVO faceRespVO = faceMapper.getById(faceId);
|
||||
if (faceRespVO == null) {
|
||||
return;
|
||||
@ -168,9 +158,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
if (worker == null) {
|
||||
return null;
|
||||
}
|
||||
TemplateRespVO respVO = templateMapper.getById(templateId);
|
||||
respVO.setChildren(templateMapper.getByPid(templateId));
|
||||
return respVO;
|
||||
return templateRepository.getTemplate(templateId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -202,6 +190,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
if (faceSampleList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// TODO: 优化
|
||||
List<TemplateEntity> templateList = templateMapper.listEnabledByScenicId(faceRespVO.getScenicId());
|
||||
if (templateList == null || templateList.isEmpty()) {
|
||||
return;
|
||||
|
@ -51,4 +51,6 @@ public interface GoodsService {
|
||||
ApiResponse<VideoTaskStatusVO> getTemplateTaskStatus(Long userId, Long faceId, Long templateId);
|
||||
|
||||
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">
|
||||
<mapper namespace="com.ycwl.basic.mapper.SourceMapper">
|
||||
<insert id="add">
|
||||
insert into source(id, scenic_id, device_id, url, video_url, `type`, face_sample_id, pos_json)
|
||||
values (#{id}, #{scenicId}, #{deviceId}, #{url}, #{videoUrl}, #{type}, #{faceSampleId}, #{posJson})
|
||||
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}, #{createTime})
|
||||
</insert>
|
||||
<insert id="addRelation">
|
||||
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>
|
||||
order by so.create_time desc
|
||||
</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 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user