You've already forked FrameTour-BE
2
This commit is contained in:
@ -71,7 +71,7 @@ public class AppGoodsController {
|
||||
@GetMapping("/getTaskStatus/")
|
||||
public ApiResponse<VideoTaskStatusVO> getAllTaskStatus() {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
return goodsService.getAllTaskStatus(worker.getUserId());
|
||||
return ApiResponse.success(goodsService.getAllTaskStatus(worker.getUserId()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,6 +84,6 @@ public class AppGoodsController {
|
||||
@GetMapping("/task/face/{faceId}/template/{templateId}")
|
||||
public ApiResponse<VideoTaskStatusVO> getTemplateTaskStatus(@PathVariable("faceId") Long faceId, @PathVariable("templateId") Long templateId) {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
return goodsService.getTaskStatusByTemplateId(worker.getUserId(), faceId, templateId);
|
||||
return ApiResponse.success(goodsService.getTaskStatusByTemplateId(worker.getUserId(), faceId, templateId));
|
||||
}
|
||||
}
|
||||
|
@ -29,13 +29,15 @@ public class AppTaskController {
|
||||
@IgnoreLogReq
|
||||
public ApiResponse<VideoTaskStatusVO> getTaskStatusByFaceId(@PathVariable("faceId") Long faceId) {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
return goodsService.getTaskStatusByFaceId(worker.getUserId(), faceId);
|
||||
return ApiResponse.success(goodsService.getTaskStatusByFaceId(worker.getUserId(), faceId));
|
||||
}
|
||||
@GetMapping("/scenic/{scenicId}")
|
||||
@IgnoreLogReq
|
||||
public ApiResponse<VideoTaskStatusVO> getAllTaskStatusByScenicId(@PathVariable("scenicId") Long scenicId) {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
return goodsService.getTaskStatusByScenicId(worker.getUserId(), scenicId);
|
||||
VideoTaskStatusVO taskStatus = goodsService.getTaskStatusByScenicId(worker.getUserId(), scenicId);
|
||||
taskStatus.setScenicId(scenicId);
|
||||
return ApiResponse.success(taskStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,7 +51,7 @@ public class AppTaskController {
|
||||
@IgnoreLogReq
|
||||
public ApiResponse<VideoTaskStatusVO> getTemplateTaskStatus(@PathVariable("faceId") Long faceId, @PathVariable("templateId") Long templateId) {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
return goodsService.getTaskStatusByTemplateId(worker.getUserId(), faceId, templateId);
|
||||
return ApiResponse.success(goodsService.getTaskStatusByTemplateId(worker.getUserId(), faceId, templateId));
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.ycwl.basic.controller.mobile.manage;
|
||||
|
||||
import com.ycwl.basic.constant.BaseContextHandler;
|
||||
import com.ycwl.basic.mapper.ScenicAccountMapper;
|
||||
import com.ycwl.basic.model.pc.order.req.OrderReqQuery;
|
||||
import com.ycwl.basic.model.pc.order.resp.OrderRespVO;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||
import com.ycwl.basic.service.pc.OrderService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/mobile/scenic/order/v1")
|
||||
@Api(tags = "景区账号相关接口")
|
||||
public class AppScenicOrderController {
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
@Autowired
|
||||
private ScenicAccountMapper scenicAccountMapper;
|
||||
|
||||
@PostMapping("/list")
|
||||
public ApiResponse<List<OrderRespVO>> list(@RequestBody OrderReqQuery query) {
|
||||
String userId = BaseContextHandler.getUserId();
|
||||
ScenicAccountEntity account = scenicAccountMapper.findAccountById(userId);
|
||||
if (account == null) {
|
||||
return ApiResponse.fail("用户未绑定景区");
|
||||
}
|
||||
query.setScenicId(account.getScenicId());
|
||||
return orderService.list(query);
|
||||
}
|
||||
}
|
@ -64,6 +64,7 @@ public class AppStatisticsController {
|
||||
|
||||
@ApiOperation("统计数据记录")
|
||||
@PostMapping("/addStatistics")
|
||||
@IgnoreToken
|
||||
public ApiResponse addStatistics(@RequestBody StatisticsRecordAddReq req) {
|
||||
|
||||
return statisticsService.addStatistics(req);
|
||||
|
@ -82,4 +82,9 @@ public class ScenicController {
|
||||
scenicService.saveConfig(id, config);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
@PostMapping("/saveConfig/undefined")
|
||||
public ApiResponse saveConfig(@RequestBody ScenicConfigEntity config) {
|
||||
scenicService.addConfig(config);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,11 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ycwl.basic.annotation.IgnoreLogReq;
|
||||
import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.annotation.RequestToFile;
|
||||
import com.ycwl.basic.mapper.DeviceMapper;
|
||||
import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||
import com.ycwl.basic.mapper.SourceMapper;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
||||
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
||||
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||
@ -50,6 +52,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IgnoreToken
|
||||
@RestController
|
||||
@ -190,6 +193,7 @@ public class ViidController {
|
||||
*/
|
||||
@RequestMapping(value = "/Faces", method = RequestMethod.POST)
|
||||
@IgnoreLogReq
|
||||
@RequestToFile
|
||||
public VIIDBaseResp faces(@RequestBody FaceUploadReq req) {
|
||||
FaceListObject faceListObject = req.getFaceListObject();
|
||||
List<FaceObject> faceObject = faceListObject.getFaceObject();
|
||||
@ -198,7 +202,6 @@ public class ViidController {
|
||||
for (FaceObject face : faceObject) {
|
||||
// 设置FaceId
|
||||
faceId = face.getFaceID();
|
||||
Long newFaceSampleId = SnowFlakeUtil.getLongId();
|
||||
// 获取图片信息
|
||||
SubImageList subImageList = face.getSubImageList();
|
||||
// 判断人脸对象中的列表是否为空
|
||||
@ -207,14 +210,31 @@ public class ViidController {
|
||||
if (device == null) {
|
||||
continue;
|
||||
}
|
||||
Date shotTime = new Date();
|
||||
DeviceConfigEntity deviceConfig = deviceRepository.getDeviceConfig(device.getId());
|
||||
int viidMode = 0;
|
||||
if (deviceConfig != null && deviceConfig.getViidType() != null) {
|
||||
viidMode = deviceConfig.getViidType();
|
||||
}
|
||||
Date shotTime = null;
|
||||
if (StringUtils.isNotBlank(face.getShotTime())) {
|
||||
try {
|
||||
shotTime = sdfTime.parse(face.getShotTime());
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
log.warn("拍摄时间时间转换失败,使用当前时间。错误entity:{}", face);
|
||||
}
|
||||
}
|
||||
if (shotTime == null) {
|
||||
if (StringUtils.isNotBlank(face.getFaceAppearTime())) {
|
||||
try {
|
||||
shotTime = sdfTime.parse(face.getFaceAppearTime());
|
||||
} catch (ParseException e) {
|
||||
log.warn("拍摄时间时间转换失败,使用当前时间。错误entity:{}", face);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shotTime == null) {
|
||||
shotTime = new Date();
|
||||
}
|
||||
Long scenicId = device.getScenicId();
|
||||
if (scenicId == null) {
|
||||
continue;
|
||||
@ -225,48 +245,79 @@ public class ViidController {
|
||||
facePosition.setRbY(face.getRightBtmY());
|
||||
facePosition.setRbX(face.getRightBtmX());
|
||||
if (ObjectUtil.isNotEmpty(subImageList) && CollUtil.isNotEmpty(subImageList.getSubImageInfoObject())) {
|
||||
// 遍历每个图片对象
|
||||
for (SubImageInfoObject subImage : subImageList.getSubImageInfoObject()) {
|
||||
// base64转换成MultipartFIle
|
||||
MultipartFile file = ImageUtils.base64ToMultipartFile(subImage.getData());
|
||||
String ext = subImage.getFileFormat();
|
||||
if (ext.equalsIgnoreCase("jpeg")) {
|
||||
ext = "jpg";
|
||||
if (viidMode == 0) {
|
||||
// 遍历每个图片对象
|
||||
// 先找到type14的图片
|
||||
List<SubImageInfoObject> type14ImageList = subImageList.getSubImageInfoObject().stream().filter(subImage -> "14".equals(subImage.getType())).collect(Collectors.toList());
|
||||
for (SubImageInfoObject subImage : subImageList.getSubImageInfoObject()) {
|
||||
// base64转换成MultipartFIle
|
||||
MultipartFile file = ImageUtils.base64ToMultipartFile(subImage.getData());
|
||||
String ext = subImage.getFileFormat();
|
||||
if (ext.equalsIgnoreCase("jpeg")) {
|
||||
ext = "jpg";
|
||||
}
|
||||
IStorageAdapter adapter = StorageFactory.use("faces");
|
||||
// Type=11 人脸
|
||||
if (subImage.getType().equals("11")) {
|
||||
// 上传oss
|
||||
FaceSampleEntity faceSample = new FaceSampleEntity();
|
||||
Long newFaceSampleId = SnowFlakeUtil.getLongId();
|
||||
faceSample.setId(newFaceSampleId);
|
||||
faceSample.setScenicId(scenicId);
|
||||
faceSample.setDeviceId(device.getId());
|
||||
faceSample.setStatus(0);
|
||||
faceSample.setCreateAt(shotTime);
|
||||
String url = adapter.uploadFile(file, "user-face", UUID.randomUUID() + "." + ext);
|
||||
faceSample.setFaceUrl(url);
|
||||
faceSampleMapper.add(faceSample);
|
||||
DynamicTaskGenerator.addTask(faceSample.getId());
|
||||
taskFaceService.addFaceSample(faceSample.getId());
|
||||
for (SubImageInfoObject _subImage : type14ImageList) {
|
||||
facePosition.setImgHeight(_subImage.getHeight());
|
||||
facePosition.setImgWidth(_subImage.getWidth());
|
||||
SourceEntity source = new SourceEntity();
|
||||
source.setId(SnowFlakeUtil.getLongId());
|
||||
source.setDeviceId(device.getId());
|
||||
source.setScenicId(device.getScenicId());
|
||||
source.setFaceSampleId(newFaceSampleId);
|
||||
source.setCreateTime(shotTime);
|
||||
source.setType(2);
|
||||
// 上传oss
|
||||
MultipartFile _file = ImageUtils.base64ToMultipartFile(_subImage.getData());
|
||||
String _sourceUrl = adapter.uploadFile(_file, "user-photo", UUID.randomUUID() + "." + ext);
|
||||
source.setUrl(_sourceUrl);
|
||||
source.setPosJson(JSON.toJSONString(facePosition));
|
||||
sourceMapper.add(source);
|
||||
}
|
||||
log.info("人脸信息及原图{}张入库成功!设备ID:{}", type14ImageList.size(), deviceID);
|
||||
}
|
||||
}
|
||||
IStorageAdapter adapter = StorageFactory.use("faces");
|
||||
// Type=11 人脸
|
||||
if (subImage.getType().equals("11")) {
|
||||
// 上传oss
|
||||
FaceSampleEntity faceSample = new FaceSampleEntity();
|
||||
faceSample.setId(newFaceSampleId);
|
||||
faceSample.setScenicId(scenicId);
|
||||
faceSample.setDeviceId(device.getId());
|
||||
faceSample.setStatus(0);
|
||||
faceSample.setCreateAt(shotTime);
|
||||
String url = adapter.uploadFile(file, "user-face", UUID.randomUUID() + "." + ext);
|
||||
faceSample.setFaceUrl(url);
|
||||
faceSampleMapper.add(faceSample);
|
||||
log.info("人脸信息入库成功!设备ID:{}", deviceID);
|
||||
DynamicTaskGenerator.addTask(faceSample.getId());
|
||||
taskFaceService.addFaceSample(faceSample.getId());
|
||||
}
|
||||
// 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());
|
||||
source.setScenicId(device.getScenicId());
|
||||
source.setFaceSampleId(newFaceSampleId);
|
||||
source.setCreateTime(shotTime);
|
||||
source.setType(2);
|
||||
// 上传oss
|
||||
String url = adapter.uploadFile(file, "user-photo", UUID.randomUUID() + "." + ext);
|
||||
source.setUrl(url);
|
||||
source.setPosJson(JSON.toJSONString(facePosition));
|
||||
sourceMapper.add(source);
|
||||
log.info("源照片入库成功!设备ID:{}", deviceID);
|
||||
} else if (viidMode == 1) {
|
||||
for (SubImageInfoObject subImage : subImageList.getSubImageInfoObject()) {
|
||||
// base64转换成MultipartFIle
|
||||
MultipartFile file = ImageUtils.base64ToMultipartFile(subImage.getData());
|
||||
String ext = subImage.getFileFormat();
|
||||
if (ext.equalsIgnoreCase("jpeg")) {
|
||||
ext = "jpg";
|
||||
}
|
||||
IStorageAdapter adapter = StorageFactory.use("faces");
|
||||
// Type=14 人脸,传™的,有这么传的嘛
|
||||
if (subImage.getType().equals("14")) {
|
||||
// 上传oss
|
||||
FaceSampleEntity faceSample = new FaceSampleEntity();
|
||||
Long newFaceSampleId = SnowFlakeUtil.getLongId();
|
||||
faceSample.setId(newFaceSampleId);
|
||||
faceSample.setScenicId(scenicId);
|
||||
faceSample.setDeviceId(device.getId());
|
||||
faceSample.setStatus(0);
|
||||
faceSample.setCreateAt(shotTime);
|
||||
String url = adapter.uploadFile(file, "user-face", UUID.randomUUID() + "." + ext);
|
||||
faceSample.setFaceUrl(url);
|
||||
faceSampleMapper.add(faceSample);
|
||||
DynamicTaskGenerator.addTask(faceSample.getId());
|
||||
taskFaceService.addFaceSample(faceSample.getId());
|
||||
log.info("模式1人脸信息入库成功!设备ID:{}", deviceID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user