逻辑
This commit is contained in:
parent
2031b77f12
commit
cfd48861d5
@ -32,6 +32,7 @@ import com.ycwl.basic.utils.IpUtils;
|
||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -40,6 +41,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -86,7 +88,6 @@ public class ViidController {
|
||||
device.setId(SnowFlakeUtil.getLongId());
|
||||
deviceMapper.addEntity(device);
|
||||
}
|
||||
SimpleDateFormat sdfTime = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
return new VIIDBaseResp(
|
||||
new ResponseStatusObject(serverId, "/VIID/System/Register", "0", "注册成功", sdfTime.format(new Date()))
|
||||
);
|
||||
@ -125,7 +126,6 @@ public class ViidController {
|
||||
}
|
||||
log.info("已经解析过的心跳信息:{}", keepaliveObject);
|
||||
|
||||
SimpleDateFormat sdfTime = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
return new VIIDBaseResp(
|
||||
new ResponseStatusObject(deviceId, "/VIID/System/UnRegister", "0", "注销成功", sdfTime.format(new Date()))
|
||||
);
|
||||
@ -152,7 +152,6 @@ public class ViidController {
|
||||
device.setKeepaliveAt(new Date());
|
||||
int update = deviceMapper.updateEntity(device);
|
||||
}
|
||||
SimpleDateFormat sdfTime = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
return new VIIDBaseResp(
|
||||
new ResponseStatusObject(deviceId, "/VIID/System/UnRegister", "0", "注销成功", sdfTime.format(new Date()))
|
||||
);
|
||||
@ -178,6 +177,7 @@ public class ViidController {
|
||||
|
||||
@Autowired
|
||||
private TaskFaceService taskFaceService;
|
||||
private final SimpleDateFormat sdfTime = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
|
||||
|
||||
/**
|
||||
@ -202,6 +202,14 @@ public class ViidController {
|
||||
if (device == null) {
|
||||
continue;
|
||||
}
|
||||
Date shotTime = new Date();
|
||||
if (StringUtils.isNotBlank(face.getShotTime())) {
|
||||
try {
|
||||
shotTime = sdfTime.parse(face.getShotTime());
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
Long scenicId = device.getScenicId();
|
||||
if (scenicId == null) {
|
||||
continue;
|
||||
@ -229,7 +237,7 @@ public class ViidController {
|
||||
faceSample.setScenicId(scenicId);
|
||||
faceSample.setDeviceId(device.getId());
|
||||
faceSample.setStatus(0);
|
||||
faceSample.setCreateAt(new Date());
|
||||
faceSample.setCreateAt(shotTime);
|
||||
String url = adapter.uploadFile(file, "user-face", UUID.randomUUID() + "." + ext);
|
||||
faceSample.setFaceUrl(url);
|
||||
faceSampleMapper.add(faceSample);
|
||||
@ -245,6 +253,7 @@ public class ViidController {
|
||||
source.setDeviceId(device.getId());
|
||||
source.setScenicId(device.getScenicId());
|
||||
source.setFaceSampleId(newFaceSampleId);
|
||||
source.setCreateTime(shotTime);
|
||||
source.setType(2);
|
||||
// 上传oss
|
||||
String url = adapter.uploadFile(file, "user-photo", UUID.randomUUID() + "." + ext);
|
||||
@ -257,7 +266,6 @@ public class ViidController {
|
||||
log.info("设备ID:{}", deviceID);
|
||||
}
|
||||
|
||||
SimpleDateFormat sdfTime = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
return new VIIDBaseResp(
|
||||
new ResponseStatusObject(faceId, "/VIID/Faces", "0", "OK", sdfTime.format(new Date()))
|
||||
);
|
||||
|
@ -55,4 +55,8 @@ public interface SourceMapper {
|
||||
int updateRelation(MemberSourceEntity memberSourceEntity);
|
||||
|
||||
List<SourceRespVO> queryByRelation(SourceReqQuery sourceReqQuery);
|
||||
|
||||
SourceEntity querySameVideo(Long faceSampleId, Long deviceId);
|
||||
|
||||
int hasRelationTo(Long memberId, Long sourceId, int type);
|
||||
}
|
||||
|
@ -33,5 +33,5 @@ public interface TemplateMapper {
|
||||
int deleteConfigById(Long id);
|
||||
List<TemplateEntity> listEnabledByScenicId(Long scenicId);
|
||||
|
||||
List<ContentPageVO> listFor(@Param("scenicId") Long scenicId, @Param("faceId") Long faceId);
|
||||
List<ContentPageVO> listFor(@Param("scenicId") Long scenicId);
|
||||
}
|
||||
|
@ -30,4 +30,6 @@ public interface VideoMapper {
|
||||
int updateRelation(MemberVideoEntity memberVideoEntity);
|
||||
|
||||
List<VideoRespVO> queryByRelation(VideoReqQuery videoReqQuery);
|
||||
|
||||
List<MemberVideoEntity> userFaceTemplateVideo(Long userId, Long faceId, Long templateId);
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ import lombok.Data;
|
||||
public class MemberSourceEntity {
|
||||
private Long id;
|
||||
private Long memberId;
|
||||
private Long scenicId;
|
||||
private Long faceId;
|
||||
private Integer type;
|
||||
private Long sourceId;
|
||||
private Integer isBuy;
|
||||
|
@ -26,10 +26,6 @@ public class SourceEntity {
|
||||
* 来源设备id
|
||||
*/
|
||||
private Long deviceId;
|
||||
/**
|
||||
* 所属用户
|
||||
*/
|
||||
private Long memberId;
|
||||
/**
|
||||
* 人脸样本id
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ public class SourceReqQuery extends BaseQueryParameterReq {
|
||||
private String url;
|
||||
@ApiModelProperty("是否被购买:0未购买,1已购买")
|
||||
private Integer isBuy;
|
||||
private Integer faceId;
|
||||
private Long faceId;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||
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.model.pc.video.req.VideoReqQuery;
|
||||
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||
@ -133,20 +134,15 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
|
||||
FaceRespVO faceRespVO = faceMapper.getById(faceId);
|
||||
if (StringUtils.isBlank(faceRespVO.getMatchSampleIds())) {
|
||||
return ApiResponse.success(new ArrayList<>());
|
||||
// return ApiResponse.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
List<ContentPageVO> contentList = templateMapper.listFor(faceRespVO.getScenicId(), faceId);
|
||||
List<ContentPageVO> contentList = templateMapper.listFor(faceRespVO.getScenicId());
|
||||
contentList.forEach(contentPageVO -> {
|
||||
if (contentPageVO.getContentType() == 1) {
|
||||
VideoReqQuery videoReqQuery = new VideoReqQuery();
|
||||
videoReqQuery.setScenicId(contentPageVO.getScenicId());
|
||||
videoReqQuery.setTemplateId(contentPageVO.getTemplateId());
|
||||
videoReqQuery.setMemberId(worker.getUserId());
|
||||
List<VideoRespVO> videoList = videoMapper.list(videoReqQuery);
|
||||
if (!videoList.isEmpty()) {
|
||||
contentPageVO.setContentId(videoList.get(0).getId());
|
||||
}
|
||||
List<MemberVideoEntity> memberVideoEntityList = videoMapper.userFaceTemplateVideo(worker.getUserId(), faceId, contentPageVO.getTemplateId());
|
||||
if (!memberVideoEntityList.isEmpty()) {
|
||||
contentPageVO.setIsBuy(memberVideoEntityList.get(0).getIsBuy());
|
||||
contentPageVO.setContentId(memberVideoEntityList.get(0).getId());
|
||||
}
|
||||
});
|
||||
|
||||
@ -180,17 +176,12 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
if (StringUtils.isBlank(faceRespVO.getMatchSampleIds())) {
|
||||
return ApiResponse.success(new ArrayList<>());
|
||||
}
|
||||
List<ContentPageVO> contentList = templateMapper.listFor(faceRespVO.getScenicId(), faceId);
|
||||
List<ContentPageVO> contentList = templateMapper.listFor(faceRespVO.getScenicId());
|
||||
contentList.forEach(contentPageVO -> {
|
||||
if (contentPageVO.getContentType() == 1) {
|
||||
VideoReqQuery videoReqQuery = new VideoReqQuery();
|
||||
videoReqQuery.setScenicId(contentPageVO.getScenicId());
|
||||
videoReqQuery.setTemplateId(contentPageVO.getTemplateId());
|
||||
videoReqQuery.setMemberId(userId);
|
||||
List<VideoRespVO> videoList = videoMapper.list(videoReqQuery);
|
||||
if (!videoList.isEmpty()) {
|
||||
contentPageVO.setContentId(videoList.get(0).getId());
|
||||
}
|
||||
List<MemberVideoEntity> memberVideoEntityList = videoMapper.userFaceTemplateVideo(userId, faceId, contentPageVO.getTemplateId());
|
||||
if (!memberVideoEntityList.isEmpty()) {
|
||||
contentPageVO.setIsBuy(memberVideoEntityList.get(0).getIsBuy());
|
||||
contentPageVO.setContentId(memberVideoEntityList.get(0).getId());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -79,12 +79,12 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
GoodsPageVO goodsPageVO = new GoodsPageVO();
|
||||
if (type == 1) {
|
||||
goodsPageVO.setGoodsName("原片集");
|
||||
goodsPageVO.setGoodsType(2);
|
||||
} else {
|
||||
goodsPageVO.setGoodsName("照片集");
|
||||
goodsPageVO.setGoodsType(3);
|
||||
}
|
||||
goodsPageVO.setScenicId(query.getScenicId());
|
||||
goodsPageVO.setGoodsType(2);
|
||||
goodsPageVO.setSourceType(type);
|
||||
goodsList.add(goodsPageVO);
|
||||
});
|
||||
|
||||
@ -99,6 +99,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
sourceReqQuery.setIsBuy(query.getIsBuy());
|
||||
sourceReqQuery.setMemberId(query.getMemberId());
|
||||
sourceReqQuery.setType(sourceType);
|
||||
sourceReqQuery.setFaceId(query.getFaceId());
|
||||
List<SourceRespVO> list = sourceMapper.listUser(sourceReqQuery);
|
||||
List<GoodsDetailVO> goodsDetailVOList = new ArrayList<>();
|
||||
|
||||
|
@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.enums.StatisticEnum;
|
||||
import com.ycwl.basic.exception.BaseException;
|
||||
import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||
import com.ycwl.basic.mapper.SourceMapper;
|
||||
import com.ycwl.basic.mapper.StatisticsMapper;
|
||||
import com.ycwl.basic.mapper.FaceMapper;
|
||||
@ -13,6 +14,7 @@ import com.ycwl.basic.model.mobile.statistic.req.StatisticsRecordAddReq;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
import com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO;
|
||||
import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
|
||||
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||
import com.ycwl.basic.model.task.resp.SearchFaceRespVo;
|
||||
@ -22,6 +24,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.storage.utils.StorageUtil;
|
||||
import com.ycwl.basic.task.VideoPieceGetter;
|
||||
import com.ycwl.basic.utils.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -58,6 +61,8 @@ public class FaceServiceImpl implements FaceService {
|
||||
private TaskService taskTaskService;
|
||||
@Autowired
|
||||
private SourceMapper sourceMapper;
|
||||
@Autowired
|
||||
private FaceSampleMapper faceSampleMapper;
|
||||
|
||||
@Override
|
||||
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
||||
@ -141,11 +146,11 @@ public class FaceServiceImpl implements FaceService {
|
||||
throw new BaseException("人脸照片校验失败,请重新上传");
|
||||
}
|
||||
// 2、通过人脸查找用户库
|
||||
SearchFaceRespVo userDbSearchResult = faceService.searchFace(USER_FACE_DB_NAME, faceUrl);
|
||||
Long newFaceId = SnowFlakeUtil.getLongId();
|
||||
FaceEntity faceEntity = new FaceEntity();
|
||||
faceEntity.setScore(scenicDbSearchResult.getScore());
|
||||
faceEntity.setMatchResult(scenicDbSearchResult.getSearchResultJson());
|
||||
SearchFaceRespVo userDbSearchResult = faceService.searchFace(USER_FACE_DB_NAME, faceUrl);
|
||||
if (userDbSearchResult == null) {
|
||||
// 都是null了,那得是新的
|
||||
faceService.addFaceSample(USER_FACE_DB_NAME, newFaceId.toString(), faceUrl, newFaceId.toString());
|
||||
@ -158,8 +163,13 @@ public class FaceServiceImpl implements FaceService {
|
||||
} else {
|
||||
// 有匹配结果,且能匹配旧的数据
|
||||
Long oldFaceId = userDbSearchResult.getSampleListIds().get(0);
|
||||
FaceRespVO oldFace = faceMapper.getById(oldFaceId);
|
||||
if (oldFace == null) {
|
||||
faceService.deleteFaceSample(USER_FACE_DB_NAME, oldFaceId.toString());
|
||||
} else {
|
||||
faceEntity.setId(oldFaceId);
|
||||
}
|
||||
}
|
||||
if (scenicDbSearchResult.getFirstMatchRate() != null) {
|
||||
faceEntity.setFirstMatchRate(BigDecimal.valueOf(scenicDbSearchResult.getFirstMatchRate()));
|
||||
}
|
||||
@ -173,14 +183,6 @@ public class FaceServiceImpl implements FaceService {
|
||||
List<Long> sampleListIds = scenicDbSearchResult.getSampleListIds();
|
||||
// 匹配原片:照片
|
||||
List<SourceEntity> sourceEntities = sourceMapper.listBySampleIds(sampleListIds);
|
||||
List<MemberSourceEntity> memberSourceEntityList = sourceEntities.stream().map(sourceEntity -> {
|
||||
MemberSourceEntity memberSourceEntity = new MemberSourceEntity();
|
||||
memberSourceEntity.setMemberId(userId);
|
||||
memberSourceEntity.setSourceId(sourceEntity.getId());
|
||||
memberSourceEntity.setType(sourceEntity.getType());
|
||||
memberSourceEntity.setIsBuy(0);
|
||||
return memberSourceEntity;
|
||||
}).collect(Collectors.toList());
|
||||
if (faceEntity.getId()==null) {
|
||||
//新增人脸
|
||||
faceEntity.setId(newFaceId);
|
||||
@ -191,7 +193,26 @@ public class FaceServiceImpl implements FaceService {
|
||||
faceMapper.update(faceEntity);
|
||||
taskTaskService.autoCreateTaskByFaceId(faceEntity.getId());
|
||||
}
|
||||
List<MemberSourceEntity> memberSourceEntityList = sourceEntities.stream().map(sourceEntity -> {
|
||||
MemberSourceEntity memberSourceEntity = new MemberSourceEntity();
|
||||
memberSourceEntity.setScenicId(scenicId);
|
||||
memberSourceEntity.setFaceId(faceEntity.getId());
|
||||
memberSourceEntity.setMemberId(userId);
|
||||
memberSourceEntity.setSourceId(sourceEntity.getId());
|
||||
memberSourceEntity.setType(sourceEntity.getType());
|
||||
memberSourceEntity.setIsBuy(0);
|
||||
return memberSourceEntity;
|
||||
}).collect(Collectors.toList());
|
||||
sourceMapper.addRelations(memberSourceEntityList);
|
||||
List<FaceSampleRespVO> faceSampleList = faceSampleMapper.listByIds(sampleListIds);
|
||||
for (FaceSampleRespVO sampleRespVO : faceSampleList) {
|
||||
VideoPieceGetter.Task task = new VideoPieceGetter.Task();
|
||||
task.faceId = faceEntity.getId();
|
||||
task.faceSampleId = sampleRespVO.getId();
|
||||
task.memberId = userId;
|
||||
task.createTime = sampleRespVO.getCreateAt();
|
||||
VideoPieceGetter.addTask(task);
|
||||
}
|
||||
StatisticsRecordAddReq statisticsRecordAddReq = new StatisticsRecordAddReq();
|
||||
statisticsRecordAddReq.setMemberId(userId);
|
||||
statisticsRecordAddReq.setType(StatisticEnum.UPLOAD_FACE.code);
|
||||
|
@ -339,6 +339,21 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteFaceSample(String dbName, String entityId) {
|
||||
DeleteFaceEntityRequest deleteFaceEntityRequest = new DeleteFaceEntityRequest();
|
||||
deleteFaceEntityRequest.setDbName(dbName);
|
||||
deleteFaceEntityRequest.setEntityId(entityId);
|
||||
try {
|
||||
IAcsClient client = getClient();
|
||||
client.getAcsResponse(deleteFaceEntityRequest);
|
||||
return true;
|
||||
} catch (ClientException e) {
|
||||
log.error("删除人脸样本失败!", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void addFaceDBCache(String dbName) {
|
||||
redisTemplate.opsForValue().set(FaceConstant.FACE_DB_NAME_PFX + dbName, "1");
|
||||
}
|
||||
|
@ -192,6 +192,9 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
@Override
|
||||
public void autoCreateTaskByFaceId(Long id) {
|
||||
FaceRespVO faceRespVO = faceMapper.getById(id);
|
||||
if (faceRespVO == null) {
|
||||
return;
|
||||
}
|
||||
if (!StringUtils.isNotBlank(faceRespVO.getMatchSampleIds())) {
|
||||
return;
|
||||
}
|
||||
@ -244,7 +247,6 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
VideoPieceGetter.Task task = new VideoPieceGetter.Task();
|
||||
task.setFaceSampleId(sample.getId());
|
||||
task.setMemberId(faceRespVO.getMemberId());
|
||||
task.setDeviceId(sample.getDeviceId());
|
||||
task.setCreateTime(sample.getCreateAt());
|
||||
return task;
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
|
@ -25,4 +25,6 @@ public interface TaskFaceService {
|
||||
void assureFaceDB(String scenicId);
|
||||
|
||||
String uploadFile(MultipartFile file, Long userId);
|
||||
|
||||
boolean deleteFaceSample(String dbName, String entityId);
|
||||
}
|
||||
|
@ -52,11 +52,11 @@ public class VideoPieceGetter {
|
||||
@Data
|
||||
public static class Task {
|
||||
public String type = "normal";
|
||||
public Long deviceId;
|
||||
public Long faceSampleId;
|
||||
public Date createTime;
|
||||
public Callback callback;
|
||||
public Long memberId;
|
||||
public Long faceId;
|
||||
|
||||
public static interface Callback {
|
||||
void onInvoke();
|
||||
@ -88,8 +88,27 @@ public class VideoPieceGetter {
|
||||
return;
|
||||
}
|
||||
FaceSampleRespVO faceSample = faceSampleMapper.getById(task.getFaceSampleId());
|
||||
DeviceEntity device = deviceMapper.getByDeviceId(task.getDeviceId());
|
||||
DeviceConfigEntity config = deviceMapper.getConfigByDeviceId(task.getDeviceId());
|
||||
DeviceEntity device = deviceMapper.getByDeviceId(faceSample.getDeviceId());
|
||||
DeviceConfigEntity config = deviceMapper.getConfigByDeviceId(faceSample.getDeviceId());
|
||||
|
||||
SourceEntity source = sourceMapper.querySameVideo(faceSample.getId(), device.getId());
|
||||
if (source != null) {
|
||||
// 有原视频
|
||||
int count = sourceMapper.hasRelationTo(task.getMemberId(), source.getId(), 1);
|
||||
if (count > 0) {
|
||||
return;
|
||||
}
|
||||
MemberSourceEntity videoSource = new MemberSourceEntity();
|
||||
videoSource.setId(SnowFlakeUtil.getLongId());
|
||||
videoSource.setScenicId(faceSample.getScenicId());
|
||||
videoSource.setFaceId(task.getFaceId());
|
||||
videoSource.setMemberId(task.getMemberId());
|
||||
videoSource.setType(1);
|
||||
videoSource.setIsBuy(0);
|
||||
videoSource.setSourceId(source.getId());
|
||||
sourceMapper.addRelation(videoSource);
|
||||
return;
|
||||
}
|
||||
BigDecimal cutPre = BigDecimal.valueOf(5L);
|
||||
BigDecimal cutPost = BigDecimal.valueOf(4L);
|
||||
if (config == null) {
|
||||
@ -115,7 +134,7 @@ public class VideoPieceGetter {
|
||||
log.warn("没有可用的文件");
|
||||
return;
|
||||
}
|
||||
long offset = task.getCreateTime().getTime() - listByDtRange.get(0).getCreateTime().getTime() - cutPre.multiply(BigDecimal.valueOf(1000)).longValue();
|
||||
long offset = task.getCreateTime().getTime() - cutPre.multiply(BigDecimal.valueOf(1000)).longValue() - listByDtRange.get(0).getCreateTime().getTime();
|
||||
FfmpegTask ffmpegTask = new FfmpegTask();
|
||||
ffmpegTask.setFileList(listByDtRange);
|
||||
ffmpegTask.setDuration(duration);
|
||||
@ -144,7 +163,6 @@ public class VideoPieceGetter {
|
||||
}
|
||||
sourceEntity.setVideoUrl(url);
|
||||
sourceEntity.setFaceSampleId(faceSample.getId());
|
||||
sourceEntity.setMemberId(task.getMemberId());
|
||||
sourceEntity.setScenicId(faceSample.getScenicId());
|
||||
sourceEntity.setDeviceId(faceSample.getDeviceId());
|
||||
sourceEntity.setType(1);
|
||||
|
@ -6,14 +6,14 @@
|
||||
values (#{id}, #{scenicId}, #{deviceId}, #{url}, #{videoUrl}, #{type}, #{faceSampleId}, #{posJson})
|
||||
</insert>
|
||||
<insert id="addRelation">
|
||||
replace member_source(member_id, source_id, is_buy, type, order_id)
|
||||
values (#{memberId}, #{sourceId}, #{isBuy}, #{type}, #{orderId})
|
||||
replace member_source(scenic_id, face_id, member_id, source_id, is_buy, type, order_id)
|
||||
values (#{scenicId}, #{faceId}, #{memberId}, #{sourceId}, #{isBuy}, #{type}, #{orderId})
|
||||
</insert>
|
||||
<insert id="addRelations">
|
||||
replace member_source(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)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.memberId}, #{item.sourceId}, #{item.isBuy}, #{item.type}, #{orderId})
|
||||
(#{item.scenicId}, #{item.faceId}, #{item.memberId}, #{item.sourceId}, #{item.isBuy}, #{item.type}, #{item.orderId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="update">
|
||||
@ -54,14 +54,13 @@
|
||||
and is_buy = #{isBuy}
|
||||
</if>
|
||||
<if test="type!=null">and so.type = #{type} </if>
|
||||
<if test="faceId!=null">and FIND_IN_SET(so.face_sample_id, (select face.match_sample_ids from face where id = #{faceId})) </if>
|
||||
<if test="startTime!= null">and so.create_time >= #{startTime} </if>
|
||||
<if test="endTime!= null">and so.create_time <= #{endTime} </if>
|
||||
</where>
|
||||
order by so.create_time desc
|
||||
</select>
|
||||
<select id="userGetById" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||
select so.id, scenic_id, device_id, ms.member_id, url, so.create_time, so.update_time,sc.`name` as scenicName
|
||||
select so.id, ms.scenic_id, device_id, ms.member_id, 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
|
||||
@ -74,7 +73,7 @@
|
||||
where so.id = #{id}
|
||||
</select>
|
||||
<select id="listGroupByType" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||
select so.id, scenic_id,sc.name scenicName, sc.longitude ,sc.latitude,so.type,so.is_buy
|
||||
select so.id, ms.scenic_id,sc.name scenicName, sc.longitude ,sc.latitude,so.type,so.is_buy
|
||||
from member_source ms
|
||||
left join source so on ms.source_id = so.id
|
||||
left join scenic sc on sc.id = so.scenic_id
|
||||
@ -121,7 +120,7 @@
|
||||
<if test="scenicId!= null">and ms.scenic_id = #{scenicId} </if>
|
||||
<if test="isBuy!=null">and ms.is_buy = #{isBuy}</if>
|
||||
<if test="type!=null">and ms.type = #{type} </if>
|
||||
<if test="faceId!=null">and FIND_IN_SET(so.face_sample_id, (select face.match_sample_ids from face where id = #{faceId})) </if>
|
||||
<if test="faceId!=null">and ms.face_id = #{faceId} </if>
|
||||
order by so.create_time desc
|
||||
</select>
|
||||
<select id="queryByRelation" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||
@ -135,4 +134,15 @@
|
||||
<if test="scenicId!= null">and ms.scenic_id = #{scenicId} </if>
|
||||
<if test="isBuy!=null">and ms.is_buy = #{isBuy}</if>
|
||||
</select>
|
||||
<select id="querySameVideo" resultType="com.ycwl.basic.model.pc.source.entity.SourceEntity">
|
||||
select *
|
||||
from source
|
||||
where device_id = #{deviceId} and face_sample_id = #{faceSampleId} and type = 1
|
||||
limit 1
|
||||
</select>
|
||||
<select id="hasRelationTo" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from member_source
|
||||
where member_id = #{memberId} and source_id = #{sourceId} and type = #{type}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -99,9 +99,7 @@
|
||||
</select>
|
||||
<select id="listFor" resultType="com.ycwl.basic.model.mobile.scenic.content.ContentPageVO">
|
||||
select t.id templateId, t.scenic_id, s.name as scenic_name, t.`name`, pid, t.cover_url templateCoverUrl,
|
||||
1 as sourceType,
|
||||
(select IF(count(1) > 0,1,0) from video left join task on video.task_id = task.id where video.template_id=t.id and task.face_id = #{faceId}) contentType,
|
||||
(select count(1) from video left join task on video.task_id = task.id where video.template_id=t.id and task.face_id = #{faceId} and video.is_buy = 1) isBuy,
|
||||
0 as sourceType,
|
||||
t.create_time, t.price
|
||||
from template t left join scenic s on s.id = t.scenic_id
|
||||
where t.scenic_id = #{scenicId} and pid = 0 and t.status = 1
|
||||
|
@ -102,4 +102,7 @@
|
||||
</where>
|
||||
order by v.create_time desc
|
||||
</select>
|
||||
<select id="userFaceTemplateVideo" resultType="com.ycwl.basic.model.pc.video.entity.MemberVideoEntity">
|
||||
select * from member_video where member_id = #{userId} and face_id = #{faceId} and template_id = #{templateId} order by id desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user