修改
This commit is contained in:
parent
b3b7590775
commit
b88c070ec7
@ -2,6 +2,7 @@ package com.ycwl.basic.controller.viid;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.mapper.DeviceMapper;
|
||||
import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||
@ -12,6 +13,7 @@ import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||
import com.ycwl.basic.model.viid.entity.DeviceIdObject;
|
||||
import com.ycwl.basic.model.viid.entity.FaceListObject;
|
||||
import com.ycwl.basic.model.viid.entity.FaceObject;
|
||||
import com.ycwl.basic.model.viid.entity.FacePositionObject;
|
||||
import com.ycwl.basic.model.viid.entity.ResponseStatusObject;
|
||||
import com.ycwl.basic.model.viid.entity.SubImageInfoObject;
|
||||
import com.ycwl.basic.model.viid.entity.SubImageList;
|
||||
@ -206,6 +208,11 @@ public class ViidController {
|
||||
if (scenicId == null) {
|
||||
continue;
|
||||
}
|
||||
FacePositionObject facePosition = new FacePositionObject();
|
||||
facePosition.setLtY(face.getLeftTopY());
|
||||
facePosition.setLtX(face.getLeftTopX());
|
||||
facePosition.setRbY(face.getRightBtmY());
|
||||
facePosition.setRbX(face.getRightBtmX());
|
||||
if (ObjectUtil.isNotEmpty(subImageList) && CollUtil.isNotEmpty(subImageList.getSubImageInfoObject())) {
|
||||
// 遍历每个图片对象
|
||||
for (SubImageInfoObject subImage : subImageList.getSubImageInfoObject()) {
|
||||
@ -238,6 +245,8 @@ public class ViidController {
|
||||
}
|
||||
// Type=14 场景图
|
||||
else if (subImage.getType().equals("14")) {
|
||||
facePosition.setImgHeight(subImage.getHeight());
|
||||
facePosition.setImgWidth(subImage.getWidth());
|
||||
SourceEntity source = new SourceEntity();
|
||||
source.setId(SnowFlakeUtil.getLongId());
|
||||
source.setDeviceId(device.getId());
|
||||
@ -253,6 +262,7 @@ public class ViidController {
|
||||
continue;
|
||||
}
|
||||
source.setUrl(url);
|
||||
source.setPosJson(JSON.toJSONString(facePosition));
|
||||
sourceMapper.add(source);
|
||||
}
|
||||
}
|
||||
|
@ -41,4 +41,6 @@ public interface SourceMapper {
|
||||
int countByMemberId(String userId);
|
||||
|
||||
List<SourceEntity> listVideoBySampleIds(List<Long> sampleId);
|
||||
|
||||
SourceEntity findBySampleId(Long faceSampleId);
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public class GoodsPageVO {
|
||||
private Integer sourceType;
|
||||
@ApiModelProperty("商品(vlog)id goodsType为1时才有值")
|
||||
private Long goodsId;
|
||||
private String templateName;
|
||||
@ApiModelProperty("模版封面图片")
|
||||
private String templateCoverUrl;
|
||||
}
|
||||
|
@ -52,4 +52,5 @@ public class SourceEntity {
|
||||
private Integer isBuy;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private String posJson;
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.ycwl.basic.model.viid.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FacePositionObject {
|
||||
private Integer imgWidth;
|
||||
private Integer imgHeight;
|
||||
private Integer ltX;
|
||||
private Integer ltY;
|
||||
private Integer rbX;
|
||||
private Integer rbY;
|
||||
public Integer getWidth(){
|
||||
return rbX - ltX;
|
||||
}
|
||||
public Integer getHeight(){
|
||||
return rbY - ltY;
|
||||
}
|
||||
|
||||
public Integer centerX(){
|
||||
return (ltX + rbX) / 2;
|
||||
}
|
||||
public Integer centerY(){
|
||||
return (ltY + rbY) / 2;
|
||||
}
|
||||
}
|
@ -18,9 +18,9 @@ public class SubImageInfoObject {
|
||||
@JsonProperty("FileFormat")
|
||||
private String FileFormat;
|
||||
@JsonProperty("Width")
|
||||
private String Width;
|
||||
private Integer Width;
|
||||
@JsonProperty("Height")
|
||||
private String Height;
|
||||
private Integer Height;
|
||||
@JsonProperty("ShotTime")
|
||||
private String ShotTime;
|
||||
@JsonProperty("Data")
|
||||
|
@ -62,6 +62,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
goodsPageVO.setLatitude(videoRespVO.getLatitude());
|
||||
goodsPageVO.setGoodsType(1);
|
||||
goodsPageVO.setGoodsId(videoRespVO.getId());
|
||||
goodsPageVO.setTemplateName(videoRespVO.getTemplateName());
|
||||
goodsPageVO.setTemplateCoverUrl(videoRespVO.getTemplateCoverUrl());
|
||||
goodsList.add(goodsPageVO);
|
||||
});
|
||||
|
@ -126,8 +126,14 @@ public class VideoPieceGetter {
|
||||
try {
|
||||
InputStream inputStream = new FileInputStream(outFile);
|
||||
String url = ossUtil.uploadFile(inputStream, "user-video-source/", outFile.getName());
|
||||
SourceEntity imgSource = sourceMapper.findBySampleId(faceSample.getId());
|
||||
SourceEntity sourceEntity = new SourceEntity();
|
||||
sourceEntity.setId(SnowFlakeUtil.getLongId());
|
||||
if (imgSource != null) {
|
||||
sourceEntity.setUrl(imgSource.getUrl());
|
||||
sourceEntity.setPosJson(imgSource.getPosJson());
|
||||
sourceEntity.setMemberId(imgSource.getMemberId());
|
||||
}
|
||||
sourceEntity.setVideoUrl(url);
|
||||
sourceEntity.setFaceSampleId(faceSample.getId());
|
||||
sourceEntity.setMemberId(task.getMemberId());
|
||||
|
Loading…
x
Reference in New Issue
Block a user