init
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
<parent>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>yudao-module-digital</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>
|
||||
试衣间模块
|
||||
</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-system</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||
<artifactId>imageio-jpeg</artifactId>
|
||||
<version>3.6.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-infra</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.coobird</groupId>
|
||||
<artifactId>thumbnailator</artifactId>
|
||||
<version>0.4.19</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- mp3文件支持(如语音时长)-->
|
||||
<dependency>
|
||||
<groupId>org</groupId>
|
||||
<artifactId>jaudiotagger</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mp4文件支持(如语音时长)-->
|
||||
<dependency>
|
||||
<groupId>com.googlecode.mp4parser</groupId>
|
||||
<artifactId>isoparser</artifactId>
|
||||
<version>1.1.22</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.volcengine</groupId>
|
||||
<artifactId>volcengine-java-sdk-vpc</artifactId>
|
||||
<version>0.1.142</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.volcengine</groupId>
|
||||
<artifactId>volcengine-java-sdk-ecs</artifactId>
|
||||
<version>0.1.142</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.volcengine</groupId>
|
||||
<artifactId>ve-tos-java-sdk</artifactId>
|
||||
<version>2.8.7</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 录音文件识别请求-->
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java-asr</artifactId>
|
||||
<version>3.1.957</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.digital.ScheduleTask;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ClothTaskExecutor {
|
||||
|
||||
@Autowired
|
||||
private ClothTaskService clothTaskService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// 使用自定义的ThreadFactory来设置线程名字
|
||||
// 使用线程池执行任务处理线程
|
||||
// ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
// // 任务处理线程1
|
||||
// executorService.execute(() -> {
|
||||
// try {
|
||||
// log.info("启动==换装==处理线程..." + Thread.currentThread().getName());
|
||||
// if (clothTaskService != null) {
|
||||
// clothTaskService.startClothProcessingTasks();
|
||||
// } else {
|
||||
// log.error("taskService 为 null,无法启动任务处理");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("任务==换装==处理线程启动失败", e);
|
||||
// }
|
||||
// });
|
||||
// 关闭线程池(应用关闭时)
|
||||
// executorService.shutdown();
|
||||
}
|
||||
}
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
package cn.iocoder.yudao.module.digital.ScheduleTask;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.constants.CommonConstant;
|
||||
import cn.iocoder.yudao.framework.common.constants.Face3dSeverHTTPConstant;
|
||||
import cn.iocoder.yudao.framework.common.constants.ZitaCommonConstant;
|
||||
import cn.iocoder.yudao.framework.common.util.RestUtil;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.MwTrainTask;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysHistory;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysTaskQueue;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.MwTrainTaskMapper;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.SysHistoryMapper;
|
||||
import cn.iocoder.yudao.module.digital.service.SysTaskQueueService;
|
||||
import cn.iocoder.yudao.module.digital.utils.OssBootUtil;
|
||||
import cn.iocoder.yudao.module.digital.utils.OssConfiguration;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ClothTaskService {
|
||||
|
||||
@Autowired
|
||||
OssConfiguration ossConfiguration;
|
||||
@Autowired
|
||||
private SysTaskQueueService sysTaskQueueService;
|
||||
@Autowired
|
||||
private MwTrainTaskMapper trainTaskMapper;
|
||||
@Autowired
|
||||
private SysHistoryMapper sysHistoryMapper;
|
||||
|
||||
private ScheduledExecutorService executorService;
|
||||
private BlockingQueue<SysTaskQueue> clothTaskQueue = new LinkedBlockingQueue<>();
|
||||
|
||||
public ClothTaskService() {
|
||||
this.executorService = Executors.newSingleThreadScheduledExecutor();
|
||||
}
|
||||
|
||||
//@Scheduled(fixedRate = 3000) // 每隔3秒执行一次
|
||||
@Transactional
|
||||
public synchronized void pollClothTaskTable() {
|
||||
String taskId = UUID.randomUUID().toString();
|
||||
QueryWrapper<SysTaskQueue> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda()
|
||||
.eq(SysTaskQueue::getStatus, Face3dSeverHTTPConstant.CREATE_STATUS_DRAFT)
|
||||
.orderByAsc(SysTaskQueue::getId)
|
||||
.eq(SysTaskQueue::getTryOnType, CommonConstant.TRY_ON_TYPE_SINGLE)
|
||||
.and(wrapper -> wrapper.isNull(SysTaskQueue::getTryOnAlgo)
|
||||
.or().eq(SysTaskQueue::getTryOnAlgo, CommonConstant.TRY_ON_TYPE_ALGO_CLOTH))
|
||||
.last("LIMIT 1"); // 添加这个条件来限制查询结果为1条
|
||||
// log.info(Thread.currentThread().getName() + "放入【换装】队列前,clothTaskQueue = " + clothTaskQueue.size() + " taskId == " + taskId);
|
||||
SysTaskQueue sysTaskQueue = sysTaskQueueService.getOne(queryWrapper);
|
||||
if (null == sysTaskQueue) {
|
||||
QueryWrapper<SysTaskQueue> qw = new QueryWrapper<>();
|
||||
qw.lambda()
|
||||
.eq(SysTaskQueue::getStatus, Face3dSeverHTTPConstant.CREATE_STATUS_DRAFT)
|
||||
.orderByAsc(SysTaskQueue::getId)
|
||||
.eq(SysTaskQueue::getTryOnType, CommonConstant.TRY_ON_TYPE_BATCH)
|
||||
.and(wrapper -> wrapper.isNull(SysTaskQueue::getTryOnAlgo)
|
||||
.or().eq(SysTaskQueue::getTryOnAlgo, CommonConstant.TRY_ON_TYPE_ALGO_CLOTH)) // 假设 "cloth" 是你要比较的值
|
||||
.last("LIMIT 1"); // 限制只返回一条记录
|
||||
sysTaskQueue = sysTaskQueueService.getOne(qw);
|
||||
}
|
||||
if (sysTaskQueue != null && clothTaskQueue.size() < 1) {
|
||||
clothTaskQueue.offer(sysTaskQueue);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_IN_PROGRESS);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
}
|
||||
// log.info(Thread.currentThread().getName() + " 放入【换装】队列后,clothTaskQueue = " + clothTaskQueue.size() + " taskId == " + taskId);
|
||||
}
|
||||
|
||||
public void startClothProcessingTasks() {
|
||||
executorService.scheduleAtFixedRate(() -> {
|
||||
// log.info("当前【换装】队列大小=" + clothTaskQueue.size());
|
||||
SysTaskQueue clothTask = clothTaskQueue.poll();
|
||||
// log.info("当前【换装】队列大小=" + clothTaskQueue.size());
|
||||
if (clothTask != null) {
|
||||
// 执行任务
|
||||
processTask(clothTask);
|
||||
}
|
||||
}, 0, 3, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
|
||||
private synchronized void processTask(SysTaskQueue sysTaskQueue) {
|
||||
String taskId = sysTaskQueue.getTaskId();
|
||||
long startTime = System.currentTimeMillis();
|
||||
log.info(Thread.currentThread().getName() + " 开始【换装】=========================================:taskId==" + taskId + LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
String jsonInfo = sysTaskQueue.getJsonInfo();
|
||||
JSONObject clothParam = JSON.parseObject(jsonInfo);
|
||||
MwTrainTask trainTask = trainTaskMapper.selectOne(new QueryWrapper<MwTrainTask>().lambda().eq(MwTrainTask::getTaskId, taskId));
|
||||
//防止数据删除空指针
|
||||
SysHistory sysHistory = sysHistoryMapper.selectHistoryOne(taskId);
|
||||
try {
|
||||
String url;
|
||||
if (ZitaCommonConstant.sex_male.equals(sysTaskQueue.getSex())) {
|
||||
url = Face3dSeverHTTPConstant.SWAP_CLOTH_MALE;
|
||||
} else {
|
||||
url = Face3dSeverHTTPConstant.SWAP_CLOTH;
|
||||
}
|
||||
ResponseEntity<JSONObject> clothResult = RestUtil.zitaRequest(url,
|
||||
HttpMethod.POST, null, clothParam, JSONObject.class);
|
||||
String clothState = clothResult.getBody().get("status").toString();
|
||||
log.info(taskId + " 返回结果信息成功 ==" + taskId + " clothResult=" + clothResult.getBody());
|
||||
if (!ZitaCommonConstant.STATUS_NORMAL.equals(clothState)) {
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setRequestResult(String.format("digital cloth 【换装】任务失败!{taskId: %s, resp: %s}", taskId, clothResult.getBody().toJSONString()));
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
log.info(String.format("digital cloth 【换装】任务失败!{taskId: %s, resp: %s}", taskId, clothResult.getBody().toJSONString()));
|
||||
sysHistory.setFileUrl(CommonConstant.TRY_ON_FAIL);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
return;
|
||||
}
|
||||
// 尝试将返回结果转为JSON
|
||||
JSONObject resultBody = clothResult.getBody();
|
||||
String imagePath = (String) resultBody.get("data");
|
||||
File file = new File(imagePath);
|
||||
String newFileName = UUID.randomUUID().toString() + file.getName().substring(file.getName().lastIndexOf("."));
|
||||
String fileUrl = OssBootUtil.uploadOssVideo(file, CommonConstant.PUTON_SWAP, newFileName);
|
||||
String savePath = OssBootUtil.getDigitalObjectURL(ossConfiguration.getBucketName(), fileUrl, null);
|
||||
trainTask.setResultImages(savePath);
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
long endTime = System.currentTimeMillis();
|
||||
long duration = (endTime - startTime) / 1000; // 除以1000,将毫秒转换为秒
|
||||
trainTask.setCostTime((int) duration);
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
//替换换装后的照片
|
||||
sysHistory.setFileUrl(savePath);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
} catch (Exception ex) {
|
||||
String message = ex.getMessage();
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setRequestResult("digital cloth 【换装】失败!" + String.format("%s {taskId: %s}", message, taskId));
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
log.error("digital cloth 【换装】任务失败!" + String.format("%s {taskId: %s}", message, taskId));
|
||||
sysHistory.setFileUrl(CommonConstant.TRY_ON_FAIL);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
return;
|
||||
}
|
||||
log.info(Thread.currentThread().getName() + "结束【换装】=========================================:" + LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
}
|
||||
|
||||
}
|
||||
+363
@@ -0,0 +1,363 @@
|
||||
package cn.iocoder.yudao.module.digital.ScheduleTask;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.OnRecordRespVO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.onrecord.OnRecordDO;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.DataSyncMapper;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.onrecord.OnRecordMapper;
|
||||
import cn.iocoder.yudao.module.digital.dto.SpuInfoDTO;
|
||||
import cn.iocoder.yudao.module.digital.dto.SysFileDTO;
|
||||
import cn.iocoder.yudao.module.digital.dto.UploadClothDTO;
|
||||
import cn.iocoder.yudao.module.digital.service.ISysFileService;
|
||||
import cn.iocoder.yudao.module.digital.vo.Result;
|
||||
import cn.iocoder.yudao.module.digital.vo.UploadFileClothVO;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class DataSyncService {
|
||||
|
||||
@Resource
|
||||
private DataSyncMapper dataSyncMapper;
|
||||
|
||||
@Resource
|
||||
private ISysFileService sysFileService;
|
||||
|
||||
@Resource
|
||||
private OnRecordMapper onRecordMapper;
|
||||
|
||||
@Resource
|
||||
private FileApi fileApi;
|
||||
|
||||
|
||||
@Scheduled(fixedRate = 3000) // 每隔3秒执行一次
|
||||
@Transactional
|
||||
public synchronized void spuSyncFile() {
|
||||
log.info("【数据同步】开始同步数据");
|
||||
//查询 数据库中所有的spu,然后将其同步到文件系统中
|
||||
List<SpuInfoDTO> spuInfoDTOS = dataSyncMapper.selectSpuInfo();
|
||||
log.info("【数据同步】查询到数据:{}", spuInfoDTOS.size());
|
||||
for (SpuInfoDTO spuInfoDTO : spuInfoDTOS) {
|
||||
log.info("【数据同步】开始同步数据:{}", spuInfoDTO);
|
||||
//同步数据到文件系统中
|
||||
String pictureUrl = spuInfoDTO.getPicUrl();
|
||||
String syncId = spuInfoDTO.getSyncId();
|
||||
if(StringUtils.isEmpty(syncId)){
|
||||
//转换成MultipartFile对象
|
||||
MultipartFile multipartFile = downloadWithRestTemplate(pictureUrl);
|
||||
Result<?> result = sysFileService.uploadFileCloth(multipartFile);
|
||||
if (result.getCode() == 200) {
|
||||
log.info("【数据同步】同步数据成功:{}", spuInfoDTO);
|
||||
UploadFileClothVO uploadFileClothVO = (UploadFileClothVO) result.getResult();
|
||||
UploadClothDTO uploadClothDTO = new UploadClothDTO();
|
||||
List<String> clothFileList = new ArrayList<>();
|
||||
clothFileList.add(uploadFileClothVO.getId());
|
||||
uploadClothDTO.setClothFileList(clothFileList);
|
||||
uploadClothDTO.setClothType(spuInfoDTO.getCategoryId());
|
||||
uploadClothDTO.setIsSync("yes");
|
||||
sysFileService.uploadCloth(uploadClothDTO);
|
||||
//更新数据为已同步
|
||||
dataSyncMapper.updateSpuSync(spuInfoDTO.getId(),uploadFileClothVO.getId());
|
||||
} else {
|
||||
log.error("【数据同步】同步数据失败:{}", spuInfoDTO);
|
||||
}
|
||||
}else{
|
||||
dataSyncMapper.updateDeletedSpuSync(Long.parseLong(spuInfoDTO.getSyncId()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 已经同步的数据进行修改
|
||||
*/
|
||||
@Scheduled(fixedRate = 1000)
|
||||
@Transactional
|
||||
public synchronized void updateDataSync() {
|
||||
log.info("【数据同步】开始修改数据");
|
||||
List<SpuInfoDTO> spuInfoDTOS = dataSyncMapper.selectSyncSpuInfo();
|
||||
log.info("【数据同步】查询到数据:{}", spuInfoDTOS.size());
|
||||
for (SpuInfoDTO spuInfoDTO : spuInfoDTOS) {
|
||||
log.info("【数据同步】开始修改数据:{}", spuInfoDTO);
|
||||
//同步数据到文件系统中
|
||||
String pictureUrl = spuInfoDTO.getPicUrl();
|
||||
SysFileDTO sysFileDTO = dataSyncMapper.selectFileById(spuInfoDTO.getSyncId());
|
||||
if(null!=sysFileDTO){
|
||||
//同步删除状态
|
||||
if(1==sysFileDTO.getDeleted().intValue()){
|
||||
dataSyncMapper.updateDeletedSpuSync(Long.parseLong(spuInfoDTO.getSyncId()));
|
||||
dataSyncMapper.updateSpuDeleted(spuInfoDTO.getId());
|
||||
}
|
||||
//获取pictureUrl的文件名称
|
||||
String fileName = pictureUrl.substring(pictureUrl.lastIndexOf("/") + 1);
|
||||
//同步图片
|
||||
if(!fileName.equals(sysFileDTO.getFileName())){
|
||||
MultipartFile multipartFile = downloadWithRestTemplate(pictureUrl);
|
||||
byte[] content = new byte[0];
|
||||
try {
|
||||
content = IoUtil.readBytes(multipartFile.getInputStream());
|
||||
} catch (IOException e) {
|
||||
log.error("【数据同步】读取文件失败:{}", e.getMessage());
|
||||
}
|
||||
String savePath = fileApi.createFile(content);
|
||||
dataSyncMapper.updateFileUrl(spuInfoDTO.getSyncId(),savePath,fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//删除数据同步
|
||||
@Scheduled(fixedRate = 1000)
|
||||
@Transactional
|
||||
public synchronized void deleteDataSync() {
|
||||
log.info("【数据同步】开始删除数据");
|
||||
List<SpuInfoDTO> spuInfoDTOS = dataSyncMapper.selectDeletedSpuInfo();
|
||||
log.info("【数据同步】查询到数据:{}", spuInfoDTOS.size());
|
||||
if(CollectionUtils.isNotEmpty(spuInfoDTOS)){
|
||||
for (SpuInfoDTO spuInfoDTO : spuInfoDTOS) {
|
||||
log.info("【数据同步】开始删除数据:{}", spuInfoDTO);
|
||||
if(null!=spuInfoDTO.getSyncId()){
|
||||
sysFileService.deleteCloth(Long.parseLong(spuInfoDTO.getSyncId()));
|
||||
dataSyncMapper.deleteSpuSync(spuInfoDTO.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 试穿
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Scheduled(fixedRate = 3000)
|
||||
@Transactional
|
||||
public void tryOn(){
|
||||
//查询试穿列表
|
||||
List<OnRecordRespVO> tryOnList = onRecordMapper.getTryOnList();
|
||||
log.info("【试穿】查询到数据:{}", tryOnList.size());
|
||||
for (OnRecordRespVO onRecordRespVO : tryOnList) {
|
||||
log.info("【试穿】开始试穿:{}", JsonUtils.toJsonString(onRecordRespVO));
|
||||
LambdaQueryWrapper<OnRecordDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OnRecordDO::getModelId, onRecordRespVO.getModelId());
|
||||
//增加firstUrl不为空的条件
|
||||
//queryWrapper.isNotNull(OnRecordDO::getFirstUrl);
|
||||
List<OnRecordDO> onRecordDOList = onRecordMapper.selectList(queryWrapper);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
boolean isNo2 = false;
|
||||
boolean isMatch = false;
|
||||
if(CollectionUtils.isNotEmpty(onRecordDOList)){
|
||||
for(OnRecordDO onRecordDO : onRecordDOList){
|
||||
if(StringUtils.isNotEmpty(onRecordDO.getFirstUrl())){
|
||||
map.put("human_url", onRecordDO.getFirstUrl());
|
||||
isMatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isMatch){
|
||||
isNo2 = true;
|
||||
map.put("no2", false);
|
||||
map.put("human_url", onRecordRespVO.getModelImageUrl());
|
||||
}
|
||||
}else{
|
||||
isNo2 = true;
|
||||
map.put("no2", false);
|
||||
map.put("human_url", onRecordRespVO.getModelImageUrl());
|
||||
}
|
||||
//map.put("human_url", onRecordRespVO.getModelImageUrl());
|
||||
map.put("cloth_url", onRecordRespVO.getClothingImageUrl());
|
||||
map.put("output_format", "url");
|
||||
map.put("suit", false);
|
||||
map.put("cloth_len", StringUtils.isEmpty(onRecordRespVO.getLen())?"":onRecordRespVO.getLen());
|
||||
if(StringUtils.isNotEmpty(onRecordRespVO.getKuziUrl())){
|
||||
map.put("kuzi_url", onRecordRespVO.getKuziUrl());
|
||||
map.put("suit", true);
|
||||
}
|
||||
|
||||
String tryOnResultUrl = null;
|
||||
String errorMsg = null;
|
||||
String firstUrl = null;
|
||||
try {
|
||||
String result = HttpUtil.createPost("http://112.126.94.241:28888/do_change_cloth")
|
||||
.timeout(300000) // 设置超时时间为5分钟(300000毫秒)
|
||||
.body(JsonUtils.toJsonString(map))
|
||||
.execute()
|
||||
.body();
|
||||
log.info(result);
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
tryOnResultUrl = jsonObject.getString("url");
|
||||
if(isNo2){
|
||||
firstUrl = jsonObject.getString("first_url");
|
||||
}
|
||||
|
||||
if(StringUtils.isEmpty(tryOnResultUrl)){
|
||||
errorMsg = result;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("【试穿】调用接口异常:", e);
|
||||
errorMsg = e.getMessage();
|
||||
tryOnResultUrl = "https://puton.huimeimeta.com/imgs/generate-fail.png"; // 超时/错误时的默认图片地址
|
||||
}
|
||||
if(StringUtils.isEmpty(tryOnResultUrl)
|
||||
|| tryOnResultUrl.equals("https://puton.huimeimeta.com/imgs/generate-fail.png")){
|
||||
if(StringUtils.isEmpty(tryOnResultUrl)){
|
||||
tryOnResultUrl = "https://puton.huimeimeta.com/imgs/generate-fail.png";
|
||||
}
|
||||
onRecordMapper.updateTryOnStatus(onRecordRespVO.getId(),
|
||||
OnRecordDO.StatusEnum.FAIL.getCode(), tryOnResultUrl,firstUrl, errorMsg);
|
||||
} else {
|
||||
onRecordMapper.updateTryOnStatus(onRecordRespVO.getId(),
|
||||
OnRecordDO.StatusEnum.SUCCESS.getCode(), tryOnResultUrl,firstUrl, errorMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询发型试戴列表
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@Scheduled(fixedRate = 3000)
|
||||
@Transactional
|
||||
public void queryHairTryOnList() {
|
||||
//查询requestId不为空的记录,使用lamda表达式实现
|
||||
LambdaQueryWrapper<OnRecordDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.ne(OnRecordDO::getRequestId, "");
|
||||
List<OnRecordDO> onRecordDOList = onRecordMapper.selectList(queryWrapper);
|
||||
log.info("【试戴】查询到数据:{}", onRecordDOList.size());
|
||||
for (OnRecordDO onRecordDO : onRecordDOList) {
|
||||
//查询试戴结果接口 https://puton.meidaojia.com/api/v1/test/exchangeHairHistoryByTaskId post方法 传参 taskId
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("taskId", onRecordDO.getRequestId());
|
||||
String result = HttpUtil.createPost("https://puton.meidaojia.com/api/v1/test/exchangeHairHistoryByTaskId")
|
||||
.header("Content-Type","application/json")
|
||||
.body(JsonUtils.toJsonString(map))
|
||||
.execute().body();
|
||||
log.info("【试戴】查询结果:{}", result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
JSONArray hairList = jsonObject.getJSONArray("result");
|
||||
boolean isComplete = true;
|
||||
for (int i = 0; i < hairList.size(); i++) {
|
||||
JSONObject hair = hairList.getJSONObject(i);
|
||||
String url = hair.getString("url");
|
||||
Long id = Long.parseLong(hair.getString("historyId"));
|
||||
OnRecordDO queryOnRecordDO = onRecordMapper.selectById(id);
|
||||
if(queryOnRecordDO == null){
|
||||
OnRecordDO insertOnRecordDO = new OnRecordDO();
|
||||
insertOnRecordDO.setId(id);
|
||||
insertOnRecordDO.setUserId(onRecordDO.getUserId());
|
||||
if(!"https://cdn.meidaojia.com/aidigitalfield/digital_cloth/static/1720084773937.png"
|
||||
.equals(url)){
|
||||
insertOnRecordDO.setTryOnResultUrl(url);
|
||||
}
|
||||
insertOnRecordDO.setModelId(onRecordDO.getModelId());
|
||||
onRecordMapper.insert(insertOnRecordDO);
|
||||
}else{
|
||||
if(!"https://cdn.meidaojia.com/aidigitalfield/digital_cloth/static/1720084773937.png"
|
||||
.equals(url)){
|
||||
queryOnRecordDO.setTryOnResultUrl(url);
|
||||
}
|
||||
onRecordMapper.updateById(queryOnRecordDO);
|
||||
}
|
||||
if("https://cdn.meidaojia.com/aidigitalfield/digital_cloth/static/1720084773937.png".equals(url)){
|
||||
isComplete = false;
|
||||
}
|
||||
}
|
||||
if(isComplete){
|
||||
onRecordMapper.deleteById(onRecordDO.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private MultipartFile downloadWithRestTemplate(String fileUrl) {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
// 下载文件
|
||||
ResponseEntity<byte[]> response = restTemplate.getForEntity(fileUrl, byte[].class);
|
||||
|
||||
if (response.getBody() != null) {
|
||||
// 获取文件名
|
||||
String fileName = extractFileName(fileUrl, response);
|
||||
|
||||
// 获取内容类型
|
||||
String contentType = response.getHeaders().getContentType() != null ?
|
||||
response.getHeaders().getContentType().toString() : "application/octet-stream";
|
||||
|
||||
return new MockMultipartFile("file", fileName, contentType, response.getBody());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private String extractFileName(String fileUrl, ResponseEntity<byte[]> response) {
|
||||
// 首先尝试从响应头中获取文件名
|
||||
String contentDisposition = response.getHeaders().getFirst("Content-Disposition");
|
||||
if (contentDisposition != null) {
|
||||
// 处理不同的Content-Disposition格式
|
||||
if (contentDisposition.contains("filename*=")) {
|
||||
// 处理UTF-8编码的文件名
|
||||
String[] parts = contentDisposition.split("filename\\*=");
|
||||
if (parts.length > 1) {
|
||||
String fileName = parts[1].trim();
|
||||
if (fileName.startsWith("UTF-8''")) {
|
||||
try {
|
||||
return java.net.URLDecoder.decode(fileName.substring(7), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
// 解码失败时继续使用其他方法
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (contentDisposition.contains("filename=")) {
|
||||
// 处理普通的filename
|
||||
String[] parts = contentDisposition.split("filename=");
|
||||
if (parts.length > 1) {
|
||||
return parts[1].trim().replace("\"", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果响应头中没有文件名信息,则从URL中提取
|
||||
try {
|
||||
java.net.URL url = new java.net.URL(fileUrl);
|
||||
String path = url.getPath();
|
||||
String fileName = path.substring(path.lastIndexOf('/') + 1);
|
||||
if (fileName.isEmpty()) {
|
||||
return "downloaded_file";
|
||||
}
|
||||
return fileName;
|
||||
} catch (Exception e) {
|
||||
return "downloaded_file";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.digital.ScheduleTask;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class FigureTaskExecutor {
|
||||
|
||||
@Autowired
|
||||
private FigureTaskService figureTaskService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// 使用自定义的ThreadFactory来设置线程名字
|
||||
// 使用线程池执行任务处理线程
|
||||
// ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
// // 任务处理线程1
|
||||
// executorService.execute(() -> {
|
||||
// try {
|
||||
// log.info("启动==换身材==处理线程..." + Thread.currentThread().getName());
|
||||
// if (figureTaskService != null) {
|
||||
// figureTaskService.startClothProcessingTasks();
|
||||
// } else {
|
||||
// log.error("换身材 taskService 为 null,无法启动任务处理");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("任务==换身材==处理线程启动失败", e);
|
||||
// }
|
||||
// });
|
||||
// 关闭线程池(应用关闭时)
|
||||
// executorService.shutdown();
|
||||
}
|
||||
}
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
package cn.iocoder.yudao.module.digital.ScheduleTask;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.constants.CommonConstant;
|
||||
import cn.iocoder.yudao.framework.common.constants.Face3dSeverHTTPConstant;
|
||||
import cn.iocoder.yudao.framework.common.constants.ZitaCommonConstant;
|
||||
import cn.iocoder.yudao.framework.common.util.RestUtil;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.MwTrainTask;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysHistory;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysTaskQueue;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.MwTrainTaskMapper;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.SysHistoryMapper;
|
||||
import cn.iocoder.yudao.module.digital.service.SysTaskQueueService;
|
||||
import cn.iocoder.yudao.module.digital.utils.OssBootUtil;
|
||||
import cn.iocoder.yudao.module.digital.utils.OssConfiguration;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class FigureTaskService {
|
||||
|
||||
@Autowired
|
||||
OssConfiguration ossConfiguration;
|
||||
@Autowired
|
||||
private SysTaskQueueService sysTaskQueueService;
|
||||
@Autowired
|
||||
private MwTrainTaskMapper trainTaskMapper;
|
||||
@Autowired
|
||||
private SysHistoryMapper sysHistoryMapper;
|
||||
|
||||
private ScheduledExecutorService executorService;
|
||||
private BlockingQueue<SysTaskQueue> figureTaskQueue = new LinkedBlockingQueue<>();
|
||||
|
||||
public FigureTaskService() {
|
||||
this.executorService = Executors.newSingleThreadScheduledExecutor();
|
||||
}
|
||||
|
||||
//@Scheduled(fixedRate = 3000) // 每隔3秒执行一次
|
||||
@Transactional
|
||||
public synchronized void pollClothTaskTable() {
|
||||
String taskId = UUID.randomUUID().toString();
|
||||
QueryWrapper<SysTaskQueue> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda()
|
||||
.eq(SysTaskQueue::getStatus, Face3dSeverHTTPConstant.CREATE_STATUS_DRAFT)
|
||||
.orderByAsc(SysTaskQueue::getId)
|
||||
.eq(SysTaskQueue::getTryOnType, CommonConstant.TRY_ON_TYPE_SINGLE)
|
||||
.eq(SysTaskQueue::getTryOnAlgo, CommonConstant.TYPE_FIGURE)
|
||||
.last("LIMIT 1"); // 添加这个条件来限制查询结果为1条
|
||||
// log.info(Thread.currentThread().getName() + "放入【换身材】队列前,clothTaskQueue = " + clothTaskQueue.size() + " taskId == " + taskId);
|
||||
SysTaskQueue sysTaskQueue = sysTaskQueueService.getOne(queryWrapper);
|
||||
if (null == sysTaskQueue) {
|
||||
QueryWrapper<SysTaskQueue> qw = new QueryWrapper<>();
|
||||
qw.lambda()
|
||||
.eq(SysTaskQueue::getStatus, Face3dSeverHTTPConstant.CREATE_STATUS_DRAFT)
|
||||
.orderByAsc(SysTaskQueue::getId)
|
||||
.eq(SysTaskQueue::getTryOnType, CommonConstant.TRY_ON_TYPE_BATCH)
|
||||
.eq(SysTaskQueue::getTryOnAlgo, CommonConstant.TYPE_FIGURE)
|
||||
.last("LIMIT 1"); // 限制只返回一条记录
|
||||
sysTaskQueue = sysTaskQueueService.getOne(qw);
|
||||
}
|
||||
if (sysTaskQueue != null && figureTaskQueue.size() < 1) {
|
||||
figureTaskQueue.offer(sysTaskQueue);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_IN_PROGRESS);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
}
|
||||
// log.info(Thread.currentThread().getName() + " 放入【换身材】队列后,clothTaskQueue = " + clothTaskQueue.size() + " taskId == " + taskId);
|
||||
}
|
||||
|
||||
public void startClothProcessingTasks() {
|
||||
executorService.scheduleAtFixedRate(() -> {
|
||||
// log.info("当前【换身材】队列大小=" + clothTaskQueue.size());
|
||||
SysTaskQueue figureTask = figureTaskQueue.poll();
|
||||
// log.info("当前【换身材】队列大小=" + clothTaskQueue.size());
|
||||
if (figureTask != null) {
|
||||
// 执行任务
|
||||
processTask(figureTask);
|
||||
}
|
||||
}, 0, 3, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
|
||||
private synchronized void processTask(SysTaskQueue sysTaskQueue) {
|
||||
String taskId = sysTaskQueue.getTaskId();
|
||||
long startTime = System.currentTimeMillis();
|
||||
log.info(Thread.currentThread().getName() + " 开始【换身材】=========================================:taskId==" + taskId + LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
String jsonInfo = sysTaskQueue.getJsonInfo();
|
||||
JSONObject clothParam = JSON.parseObject(jsonInfo);
|
||||
MwTrainTask trainTask = trainTaskMapper.selectOne(new QueryWrapper<MwTrainTask>().lambda().eq(MwTrainTask::getTaskId, taskId));
|
||||
//防止数据删除空指针
|
||||
SysHistory sysHistory = sysHistoryMapper.selectHistoryOne(taskId);
|
||||
try {
|
||||
ResponseEntity<JSONObject> clothResult = RestUtil.zitaRequest(Face3dSeverHTTPConstant.FIGURE_UPLOAD,
|
||||
HttpMethod.POST, null, clothParam, JSONObject.class);
|
||||
String clothState = clothResult.getBody().get("status").toString();
|
||||
log.info(taskId + " 返回结果信息成功 ==" + taskId + " clothResult=" + clothResult.getBody());
|
||||
if (!ZitaCommonConstant.STATUS_NORMAL.equals(clothState)) {
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setRequestResult(String.format("digital figure 【换身材】任务失败!{taskId: %s, resp: %s}", taskId, clothResult.getBody().toJSONString()));
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
log.info(String.format("digital figure 【换身材】任务失败!{taskId: %s, resp: %s}", taskId, clothResult.getBody().toJSONString()));
|
||||
sysHistory.setFileUrl(CommonConstant.TRY_ON_FAIL);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
return;
|
||||
}
|
||||
// 尝试将返回结果转为JSON
|
||||
JSONObject resultBody = clothResult.getBody();
|
||||
String imagePath = (String) resultBody.get("res_img_path");
|
||||
File file = new File(imagePath);
|
||||
String newFileName = UUID.randomUUID().toString() + file.getName().substring(file.getName().lastIndexOf("."));
|
||||
String fileUrl = OssBootUtil.uploadOssVideo(file, CommonConstant.PUTON_SWAP, newFileName);
|
||||
String savePath = OssBootUtil.getDigitalObjectURL(ossConfiguration.getBucketName(), fileUrl, null);
|
||||
trainTask.setResultImages(savePath);
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
long endTime = System.currentTimeMillis();
|
||||
long duration = (endTime - startTime) / 1000; // 除以1000,将毫秒转换为秒
|
||||
trainTask.setCostTime((int) duration);
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
//替换换身材后的照片
|
||||
sysHistory.setFileUrl(savePath);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
} catch (Exception ex) {
|
||||
String message = ex.getMessage();
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setRequestResult("digital figure 【换身材】失败!" + String.format("%s {taskId: %s}", message, taskId));
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
log.error("digital figure 【换身材】任务失败!" + String.format("%s {taskId: %s}", message, taskId));
|
||||
sysHistory.setFileUrl(CommonConstant.TRY_ON_FAIL);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
return;
|
||||
}
|
||||
log.info(Thread.currentThread().getName() + "结束【换身材】=========================================:" + LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.digital.ScheduleTask;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class HairTaskExecutor {
|
||||
|
||||
@Autowired
|
||||
private HairTaskService HairTaskService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// 使用线程池执行任务处理线程
|
||||
// ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
// // 任务处理线程2
|
||||
// executorService.execute(() -> {
|
||||
// try {
|
||||
// log.info("启动==换发型==处理线程..." + Thread.currentThread().getName());
|
||||
// if (HairTaskService != null) {
|
||||
// HairTaskService.startHairProcessingTasks();
|
||||
// } else {
|
||||
// log.error("taskService 为 null,无法启动任务处理");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("任务==换发型==处理线程启动失败", e);
|
||||
// }
|
||||
// });
|
||||
// 关闭线程池(应用关闭时)
|
||||
// executorService.shutdown();
|
||||
}
|
||||
}
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
package cn.iocoder.yudao.module.digital.ScheduleTask;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.constants.CommonConstant;
|
||||
import cn.iocoder.yudao.framework.common.constants.Face3dSeverHTTPConstant;
|
||||
import cn.iocoder.yudao.framework.common.constants.ZitaCommonConstant;
|
||||
import cn.iocoder.yudao.framework.common.util.RestUtil;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.*;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.MwTrainTaskMapper;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.SysHistoryMapper;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.SysWhiteUserMapper;
|
||||
import cn.iocoder.yudao.module.digital.service.IDpUserService;
|
||||
import cn.iocoder.yudao.module.digital.service.SysTaskQueueService;
|
||||
import cn.iocoder.yudao.module.digital.utils.CloudStorageService;
|
||||
import cn.iocoder.yudao.module.digital.utils.OssConfiguration;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class HairTaskService {
|
||||
|
||||
@Autowired
|
||||
OssConfiguration ossConfiguration;
|
||||
@Autowired
|
||||
private SysTaskQueueService sysTaskQueueService;
|
||||
@Autowired
|
||||
private MwTrainTaskMapper trainTaskMapper;
|
||||
@Autowired
|
||||
private SysHistoryMapper sysHistoryMapper;
|
||||
@Autowired
|
||||
private SysWhiteUserMapper smsWhiteUserMapper;
|
||||
@Autowired
|
||||
private IDpUserService dpUserService;
|
||||
|
||||
private ScheduledExecutorService executorService;
|
||||
private BlockingQueue<SysTaskQueue> hairTaskQueue;
|
||||
|
||||
public HairTaskService() {
|
||||
this.executorService = Executors.newSingleThreadScheduledExecutor();
|
||||
this.hairTaskQueue = new LinkedBlockingQueue<>();
|
||||
}
|
||||
|
||||
//@Scheduled(fixedRate = 3000) // 每隔3秒执行一次
|
||||
@Transactional
|
||||
public void pollHairTaskTable() {
|
||||
QueryWrapper<SysTaskQueue> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(SysTaskQueue::getStatus, Face3dSeverHTTPConstant.CREATE_STATUS_DRAFT);
|
||||
queryWrapper.lambda().eq(SysTaskQueue::getTryOnType, CommonConstant.TRY_ON_TYPE_SINGLE);
|
||||
queryWrapper.lambda().eq(SysTaskQueue::getTryOnAlgo, CommonConstant.TRY_ON_TYPE_ALGO_HAIR);
|
||||
queryWrapper.lambda().orderByAsc(SysTaskQueue::getId);
|
||||
queryWrapper.lambda().last("LIMIT 1");
|
||||
// log.info(Thread.currentThread().getName() + "放入【换发型】队列前,hairTaskQueue = " + hairTaskQueue.size());
|
||||
SysTaskQueue sysTaskQueue = sysTaskQueueService.getOne(queryWrapper);
|
||||
if (null == sysTaskQueue) {
|
||||
QueryWrapper<SysTaskQueue> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(SysTaskQueue::getStatus, Face3dSeverHTTPConstant.CREATE_STATUS_DRAFT);
|
||||
qw.lambda().eq(SysTaskQueue::getTryOnType, CommonConstant.TRY_ON_TYPE_BATCH);
|
||||
qw.lambda().eq(SysTaskQueue::getTryOnAlgo, CommonConstant.TRY_ON_TYPE_ALGO_HAIR);
|
||||
qw.lambda().orderByAsc(SysTaskQueue::getId);
|
||||
qw.lambda().last("LIMIT 1");
|
||||
sysTaskQueue = sysTaskQueueService.getOne(qw);
|
||||
}
|
||||
if (sysTaskQueue != null && hairTaskQueue.size() < 1) {
|
||||
hairTaskQueue.offer(sysTaskQueue);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_IN_PROGRESS);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
}
|
||||
// log.info(Thread.currentThread().getName() + "放入【换发型】队列后,hairTaskQueue = " + hairTaskQueue.size());
|
||||
}
|
||||
|
||||
public synchronized void startHairProcessingTasks() {
|
||||
executorService.scheduleAtFixedRate(() -> {
|
||||
// log.info("当前【换发型】队列大小=" + hairTaskQueue.size());
|
||||
SysTaskQueue hairTask = hairTaskQueue.poll();
|
||||
// log.info("当前【换发型】队列大小=" + hairTaskQueue.size());
|
||||
if (hairTask != null) {
|
||||
// 执行任务
|
||||
processHairTask(hairTask);
|
||||
}
|
||||
}, 0, 1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
synchronized void processHairTask(SysTaskQueue sysTaskQueue) {
|
||||
String taskId = sysTaskQueue.getTaskId();
|
||||
long startTime = System.currentTimeMillis();
|
||||
log.info("开始【换发型】 =========================================:" + LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
String jsonInfo = sysTaskQueue.getJsonInfo();
|
||||
JSONObject hairParam = JSON.parseObject(jsonInfo);
|
||||
MwTrainTask trainTask = trainTaskMapper.selectOne(new QueryWrapper<MwTrainTask>().lambda().eq(MwTrainTask::getTaskId, taskId));
|
||||
//防止数据删除空指针
|
||||
SysHistory sysHistory = sysHistoryMapper.selectHistoryOne(taskId);
|
||||
try {
|
||||
DpUser dpUser = dpUserService.getByUserId(sysTaskQueue.getUserId());
|
||||
List<SysWhiteUser> sysWhiteUsers = smsWhiteUserMapper.selectList(new QueryWrapper<SysWhiteUser>().lambda().eq(SysWhiteUser::getDeleted, CommonConstant.DEL_FLAG_0));
|
||||
String url = Face3dSeverHTTPConstant.SWAP_HAIR_v1;
|
||||
if (null != dpUser && sysWhiteUsers != null) {
|
||||
List<String> accounts = sysWhiteUsers.stream()
|
||||
.map(SysWhiteUser::getAccount) // 将Person对象映射到它们的name字段
|
||||
.collect(Collectors.toList()); // 收集映射后的结果到List中
|
||||
if (accounts.contains(dpUser.getAccount())) {
|
||||
url = Face3dSeverHTTPConstant.SWAP_HAIR_v2;
|
||||
}
|
||||
}
|
||||
ResponseEntity<JSONObject> hairResult = RestUtil.zitaRequest(url,
|
||||
HttpMethod.POST, null, hairParam, JSONObject.class);
|
||||
String clothState = hairResult.getStatusCodeValue() + "";
|
||||
log.info(taskId + " 返回结果信息成功 ==" + taskId + " hairResult=" + hairResult.getBody());
|
||||
if (clothState != null && !ZitaCommonConstant.STATUS_NORMAL.equals(clothState)
|
||||
|| hairResult != null && hairResult.getBody() != null
|
||||
&& !("0").equals(hairResult.getBody().getString("state"))) {
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setRequestResult(String.format("digital 【换发型】 任务失败!{taskId: %s, resp: %s}", taskId, hairResult.getBody().toJSONString()));
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
log.info(String.format("digital 【换发型】 任务失败!{taskId: %s, resp: %s}", taskId, hairResult.getBody().toJSONString()));
|
||||
sysHistory.setFileUrl(CommonConstant.TRY_ON_FAIL);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
return;
|
||||
}
|
||||
// 尝试将返回结果转为JSON
|
||||
JSONObject resultBody = hairResult.getBody();
|
||||
String imageP = (String) resultBody.get("data");
|
||||
|
||||
// 判断手机号码
|
||||
if (Objects.equals(dpUser.getAccount(), "13763009010")) {
|
||||
// 获取图片流
|
||||
String imgName = getFileNameFromURL(imageP);
|
||||
InputStream imageStream = downloadImageStream(imageP);
|
||||
// 上传到客户oss
|
||||
String resReUrl = CloudStorageService.saveFileToBucket(imgName, imageStream);
|
||||
imageP = resReUrl;
|
||||
}
|
||||
|
||||
trainTask.setResultImages(imageP);
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
long endTime = System.currentTimeMillis();
|
||||
long duration = (endTime - startTime) / 1000; // 除以1000,将毫秒转换为秒
|
||||
trainTask.setCostTime((int) duration);
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
//替换换装后的照片
|
||||
sysHistory.setFileUrl(imageP);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
} catch (Exception ex) {
|
||||
String message = ex.getMessage();
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setRequestResult("digital 【换发型】 任务失败!" + String.format("digital 【换发型】 任务失败!详情: {taskId: {}, message: {}}", message, taskId));
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
log.error("digital 【换发型】 任务失败!详情: {taskId: {}, message: {}}", taskId, message);
|
||||
sysHistory.setFileUrl(CommonConstant.TRY_ON_FAIL);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
return;
|
||||
}
|
||||
log.info("结束【换发型】========================================:" + LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
}
|
||||
|
||||
|
||||
public static InputStream downloadImageStream(String imageUrl) {
|
||||
// 创建一个 URL 对象
|
||||
try {
|
||||
URL url = new URL(imageUrl);
|
||||
|
||||
// 打开一个到 URL 指向的资源的连接
|
||||
// 这里我们可以直接使用 URL.openStream() 方法来获取 InputStream
|
||||
// 也可以使用 HttpURLConnection 来获取更多的连接控制(比如设置请求头、处理重定向等)
|
||||
InputStream inputStream = url.openStream();
|
||||
|
||||
// 返回 InputStream,注意这里没有关闭它,因为调用者可能还需要使用它
|
||||
// 调用者应该在不再需要时关闭 InputStream 以释放资源
|
||||
return inputStream;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static String getFileNameFromURL(String urlString) {
|
||||
try {
|
||||
URL url = new URL(urlString);
|
||||
// 使用URI和Paths来获取文件名
|
||||
String fileName = url.getFile();
|
||||
fileName = fileName.substring(fileName.lastIndexOf("/") + 1); // 获取文件名
|
||||
return fileName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null; // 或者抛出一个自定义的异常
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.digital.ScheduleTask;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class UnderwearTaskExecutor {
|
||||
|
||||
@Autowired
|
||||
private UnderwearTaskService underwearTaskService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// 使用自定义的ThreadFactory来设置线程名字
|
||||
// 使用线程池执行任务处理线程
|
||||
// ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
// // 任务处理线程1
|
||||
// executorService.execute(() -> {
|
||||
// try {
|
||||
// log.info("启动==换内衣==处理线程..." + Thread.currentThread().getName());
|
||||
// if (underwearTaskService != null) {
|
||||
// underwearTaskService.startClothProcessingTasks();
|
||||
// } else {
|
||||
// log.error("换内衣 taskService 为 null,无法启动任务处理");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("任务==换内衣==处理线程启动失败", e);
|
||||
// }
|
||||
// });
|
||||
// 关闭线程池(应用关闭时)
|
||||
// executorService.shutdown();
|
||||
}
|
||||
}
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
package cn.iocoder.yudao.module.digital.ScheduleTask;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.constants.CommonConstant;
|
||||
import cn.iocoder.yudao.framework.common.constants.Face3dSeverHTTPConstant;
|
||||
import cn.iocoder.yudao.framework.common.constants.ZitaCommonConstant;
|
||||
import cn.iocoder.yudao.framework.common.util.RestUtil;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.MwTrainTask;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysHistory;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysTaskQueue;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.MwTrainTaskMapper;
|
||||
import cn.iocoder.yudao.module.digital.dal.mysql.SysHistoryMapper;
|
||||
import cn.iocoder.yudao.module.digital.service.SysTaskQueueService;
|
||||
import cn.iocoder.yudao.module.digital.utils.OssBootUtil;
|
||||
import cn.iocoder.yudao.module.digital.utils.OssConfiguration;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class UnderwearTaskService {
|
||||
|
||||
@Autowired
|
||||
OssConfiguration ossConfiguration;
|
||||
@Autowired
|
||||
private SysTaskQueueService sysTaskQueueService;
|
||||
@Autowired
|
||||
private MwTrainTaskMapper trainTaskMapper;
|
||||
@Autowired
|
||||
private SysHistoryMapper sysHistoryMapper;
|
||||
|
||||
private ScheduledExecutorService executorService;
|
||||
private BlockingQueue<SysTaskQueue> underwearTaskQueue = new LinkedBlockingQueue<>();
|
||||
|
||||
public UnderwearTaskService() {
|
||||
this.executorService = Executors.newSingleThreadScheduledExecutor();
|
||||
}
|
||||
|
||||
// @Scheduled(fixedRate = 3000) // 每隔3秒执行一次
|
||||
@Transactional
|
||||
public synchronized void pollClothTaskTable() {
|
||||
String taskId = UUID.randomUUID().toString();
|
||||
QueryWrapper<SysTaskQueue> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda()
|
||||
.eq(SysTaskQueue::getStatus, Face3dSeverHTTPConstant.CREATE_STATUS_DRAFT)
|
||||
.orderByAsc(SysTaskQueue::getId)
|
||||
.eq(SysTaskQueue::getTryOnType, CommonConstant.TRY_ON_TYPE_SINGLE)
|
||||
.eq(SysTaskQueue::getTryOnAlgo, CommonConstant.TYPE_UNDERWEAR)
|
||||
.last("LIMIT 1"); // 添加这个条件来限制查询结果为1条
|
||||
// log.info(Thread.currentThread().getName() + "放入【换内衣】队列前,clothTaskQueue = " + clothTaskQueue.size() + " taskId == " + taskId);
|
||||
SysTaskQueue sysTaskQueue = sysTaskQueueService.getOne(queryWrapper);
|
||||
if (null == sysTaskQueue) {
|
||||
QueryWrapper<SysTaskQueue> qw = new QueryWrapper<>();
|
||||
qw.lambda()
|
||||
.eq(SysTaskQueue::getStatus, Face3dSeverHTTPConstant.CREATE_STATUS_DRAFT)
|
||||
.orderByAsc(SysTaskQueue::getId)
|
||||
.eq(SysTaskQueue::getTryOnType, CommonConstant.TRY_ON_TYPE_BATCH)
|
||||
.eq(SysTaskQueue::getTryOnAlgo, CommonConstant.TYPE_UNDERWEAR)
|
||||
.last("LIMIT 1"); // 限制只返回一条记录
|
||||
sysTaskQueue = sysTaskQueueService.getOne(qw);
|
||||
}
|
||||
if (sysTaskQueue != null && underwearTaskQueue.size() < 1) {
|
||||
underwearTaskQueue.offer(sysTaskQueue);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_IN_PROGRESS);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
}
|
||||
// log.info(Thread.currentThread().getName() + " 放入【换内衣】队列后,clothTaskQueue = " + clothTaskQueue.size() + " taskId == " + taskId);
|
||||
}
|
||||
|
||||
public void startClothProcessingTasks() {
|
||||
executorService.scheduleAtFixedRate(() -> {
|
||||
// log.info("当前【换内衣】队列大小=" + clothTaskQueue.size());
|
||||
SysTaskQueue figureTask = underwearTaskQueue.poll();
|
||||
// log.info("当前【换内衣】队列大小=" + clothTaskQueue.size());
|
||||
if (figureTask != null) {
|
||||
// 执行任务
|
||||
processTask(figureTask);
|
||||
}
|
||||
}, 0, 3, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
|
||||
private synchronized void processTask(SysTaskQueue sysTaskQueue) {
|
||||
String taskId = sysTaskQueue.getTaskId();
|
||||
long startTime = System.currentTimeMillis();
|
||||
log.info(Thread.currentThread().getName() + " 开始【换内衣】=========================================:taskId==" + taskId + LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
String jsonInfo = sysTaskQueue.getJsonInfo();
|
||||
JSONObject clothParam = JSON.parseObject(jsonInfo);
|
||||
MwTrainTask trainTask = trainTaskMapper.selectOne(new QueryWrapper<MwTrainTask>().lambda().eq(MwTrainTask::getTaskId, taskId));
|
||||
//防止数据删除空指针
|
||||
SysHistory sysHistory = sysHistoryMapper.selectHistoryOne(taskId);
|
||||
try {
|
||||
ResponseEntity<JSONObject> underwearResult = RestUtil.zitaRequest(Face3dSeverHTTPConstant.SWAP_UNDERWEAR,
|
||||
HttpMethod.POST, null, clothParam, JSONObject.class);
|
||||
String clothState = underwearResult.getBody().get("status").toString();
|
||||
log.info(taskId + " 返回结果信息成功 ==" + taskId + " underwearResult=" + underwearResult.getBody());
|
||||
if (!ZitaCommonConstant.STATUS_NORMAL.equals(clothState)) {
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setRequestResult(String.format("digital figure 【换内衣】任务失败!{taskId: %s, resp: %s}", taskId, underwearResult.getBody().toJSONString()));
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
log.info(String.format("digital figure 【换内衣】任务失败!{taskId: %s, resp: %s}", taskId, underwearResult.getBody().toJSONString()));
|
||||
sysHistory.setFileUrl(CommonConstant.TRY_ON_FAIL);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
return;
|
||||
}
|
||||
// 尝试将返回结果转为JSON
|
||||
JSONObject resultBody = underwearResult.getBody();
|
||||
String imagePath = (String) resultBody.get("data");
|
||||
File file = new File(imagePath);
|
||||
String newFileName = UUID.randomUUID().toString() + file.getName().substring(file.getName().lastIndexOf("."));
|
||||
String fileUrl = OssBootUtil.uploadOssVideo(file, CommonConstant.PUTON_SWAP, newFileName);
|
||||
String savePath = OssBootUtil.getDigitalObjectURL(ossConfiguration.getBucketName(), fileUrl, null);
|
||||
trainTask.setResultImages(savePath);
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
long endTime = System.currentTimeMillis();
|
||||
long duration = (endTime - startTime) / 1000; // 除以1000,将毫秒转换为秒
|
||||
trainTask.setCostTime((int) duration);
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
//替换换内衣后的照片
|
||||
sysHistory.setFileUrl(savePath);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
} catch (Exception ex) {
|
||||
String message = ex.getMessage();
|
||||
trainTask.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setResult(Face3dSeverHTTPConstant.result_fail);
|
||||
trainTask.setRequestResult("digital figure 【换内衣】失败!" + String.format("%s {taskId: %s}", message, taskId));
|
||||
trainTaskMapper.updateById(trainTask);
|
||||
log.error("digital figure 【换内衣】任务失败!" + String.format("%s {taskId: %s}", message, taskId));
|
||||
sysHistory.setFileUrl(CommonConstant.TRY_ON_FAIL);
|
||||
sysHistory.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysHistoryMapper.updateById(sysHistory);
|
||||
sysTaskQueue.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
sysTaskQueueService.updateById(sysTaskQueue);
|
||||
return;
|
||||
}
|
||||
log.info(Thread.currentThread().getName() + "结束【换内衣】=========================================:" + LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
}
|
||||
|
||||
}
|
||||
+256
@@ -0,0 +1,256 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.digital.dto.*;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.DpUser;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysFile;
|
||||
import cn.iocoder.yudao.module.digital.service.*;
|
||||
import cn.iocoder.yudao.module.digital.utils.oConvertUtils;
|
||||
import cn.iocoder.yudao.module.digital.vo.LoginUserInfoVO;
|
||||
import cn.iocoder.yudao.module.digital.vo.Result;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cloth")
|
||||
@Slf4j
|
||||
public class DigitalClothController {
|
||||
|
||||
@Autowired
|
||||
private IDpUserService dpUserService;
|
||||
@Autowired
|
||||
private ISysFileService sysFileService;
|
||||
@Autowired
|
||||
private IMwTrainTaskService mwTrainTaskService;
|
||||
@Autowired
|
||||
private ISysContactService sysContactService;
|
||||
@Autowired
|
||||
private SysRoomService sysRoomService;
|
||||
|
||||
@PostMapping(value = "/addRoom")
|
||||
public Result<?> addRoom(@RequestBody @Validated AddRoomDTO addRoomDTO) {
|
||||
return sysRoomService.addRoom(addRoomDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/delRoom")
|
||||
public Result<?> delRoom(@RequestBody @Validated DelRoomDTO delRoomDTO) {
|
||||
return sysRoomService.delRoom(delRoomDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/updateRoom")
|
||||
public Result<?> updateRoom(@RequestBody @Validated UpdateRoomDTO updateRoomDTO) {
|
||||
return sysRoomService.updateRoom(updateRoomDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/getRoomList")
|
||||
public Result<?> getRoomList(@RequestBody @Validated GetRoomListDTO getRoomListDTO) {
|
||||
return sysRoomService.getRoomList(getRoomListDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/addRoomCloth")
|
||||
public Result<?> addRoomCloth(@RequestBody @Validated AddRoomClothDTO addRoomClothDTO) {
|
||||
return sysRoomService.addRoomCloth(addRoomClothDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/delRoomCloth")
|
||||
public Result<?> delRoomCloth(@RequestBody @Validated AddRoomClothDTO addRoomClothDTO) {
|
||||
return sysRoomService.delRoomCloth(addRoomClothDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getRoomClothList")
|
||||
public Result<?> getRoomClothList(@RequestBody @Validated GetRoomClothListDTO getRoomClothListDTO) {
|
||||
return sysRoomService.getRoomClothList(getRoomClothListDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/buyLink")
|
||||
public Result<?> buyLink(@RequestBody @Validated BuyLinksDTO buyLinksDTO) {
|
||||
return sysFileService.buyLink(buyLinksDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/batchDelHistory")
|
||||
public Result<?> batchDelHistory(@RequestBody @Validated BatchDelHistoryDTO batchDelHistoryDTO) {
|
||||
return sysFileService.batchDelHistory(batchDelHistoryDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/unTryOn")
|
||||
public Result<?> unTryOn(@RequestBody @Validated UnTryOnDTO unTryOnDTO) {
|
||||
return sysFileService.unTryOn(unTryOnDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadAvatar")
|
||||
public Result<?> uploadAvatar(@RequestParam("file") MultipartFile file) {
|
||||
return sysFileService.uploadAvatar(file);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/getLoginUserInfo")
|
||||
public Result<?> getLoginUserInfo() {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
log.info("开始 获取登录用户信息 loginUser =" + loginUser);
|
||||
DpUser dpUser = dpUserService.getByUserId(String.valueOf(loginUser.getId()));
|
||||
log.info("开始 获取登录用户信息 dpUser =" + dpUser);
|
||||
LoginUserInfoVO loginUserInfoVO = new LoginUserInfoVO();
|
||||
BeanUtils.copyProperties(dpUser, loginUserInfoVO);
|
||||
loginUserInfoVO.setUsername(DesensitizedUtil.mobilePhone(dpUser.getAccount()));
|
||||
return Result.ok(loginUserInfoVO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/addSuit")
|
||||
public Result<?> addSuit(@RequestBody @Validated AddSuitDTO addSuitDTO) {
|
||||
return sysFileService.addSuit(addSuitDTO);
|
||||
}
|
||||
|
||||
// @AutoLog(value = "查看试穿历史数据")
|
||||
|
||||
@PostMapping(value = "/getTryOnHistory")
|
||||
public Result<?> getTryOnHistory() {
|
||||
return sysFileService.getTryOnHistory();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadModel")
|
||||
public Result<?> uploadModel(@RequestParam("file") MultipartFile file, @RequestParam("sex") String sex) throws IOException {
|
||||
return sysFileService.uploadModel(file, sex);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getModelList")
|
||||
public Result<?> getModelList(@RequestBody @Validated GetModelDTO getModelDTO) {
|
||||
return sysFileService.getModelList(getModelDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/list")
|
||||
public Result<?> queryClothTypeList(@RequestBody @Validated QueryClothTypeDTO queryClothTypeDTO) {
|
||||
return sysFileService.clothList(queryClothTypeDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/grabPicture")
|
||||
public Result<?> grabPicture(@RequestBody @Validated CrawlerPictureDTO crawlerPictureDTO) {
|
||||
return sysFileService.grabPicture(crawlerPictureDTO.getGrabUrl());
|
||||
}
|
||||
|
||||
@PostMapping(value = "/unJoin")
|
||||
public Result<?> unJoin(@RequestBody @Validated UnJoinDTO unJoinDTO) {
|
||||
return sysFileService.unJoin(unJoinDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/addWardrobe")
|
||||
public Result<?> addWardrobe(@RequestBody @Validated AddWardrobeDTO addWardrobeDTO) {
|
||||
return sysFileService.addWardrobe(addWardrobeDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/submitContactInfo")
|
||||
public Result<?> submitContactInfo(@RequestBody @Validated SubmitContactInfoDTO submitContactInfoDTO) {
|
||||
return sysContactService.submitContactInfo(submitContactInfoDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/deleteCloth")
|
||||
public Result<String> deleteCloth(@RequestBody @Validated DeleteClothDTO deleteClothDTO) {
|
||||
String taskId = UUID.randomUUID().toString();
|
||||
String id = deleteClothDTO.getId();
|
||||
SysFile sysFile = sysFileService.getById(id);
|
||||
if (sysFile == null) {
|
||||
return Result.error("数据库中无此数据", taskId);
|
||||
}
|
||||
String commonClothType = sysFile.getCommonClothType();
|
||||
if (oConvertUtils.isNotEmpty(commonClothType) && commonClothType.contains("in_")) {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
if (!loginUser.getRoleCode().equals("admin")) {
|
||||
return Result.error("公共文件不能删除!", taskId);
|
||||
}
|
||||
}
|
||||
sysFileService.removeById(id);
|
||||
|
||||
String materialPath = sysFile.getMaterialPath();
|
||||
if (oConvertUtils.isNotEmpty(materialPath)) {
|
||||
QueryWrapper<SysFile> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(SysFile::getMaterialPath, materialPath);
|
||||
List<SysFile> deleteList = sysFileService.list(queryWrapper);
|
||||
if (deleteList != null && deleteList.size() > 0) {
|
||||
log.info("需要删除的数据 deleteList =" + deleteList);
|
||||
sysFileService.removeBatchByIds(deleteList);
|
||||
}
|
||||
}
|
||||
return Result.OK("删除成功!", taskId);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getCostTime")
|
||||
public Result<?> getCostTime() {
|
||||
return mwTrainTaskService.getCostTime();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/tryOnCallBack")
|
||||
public Result<?> tryOnCallBack(@RequestBody TryOnCallBackDTO tryOnCallBackDTO) {
|
||||
return sysFileService.tryOnCallBack(tryOnCallBackDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/callBack")
|
||||
public Result<?> callBack(@RequestBody CallBackDTO callBackDTO) {
|
||||
return sysFileService.callBack(callBackDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/tryOn")
|
||||
public Result<?> tryOn(@RequestBody @Validated TryOnDTO tryOnDTO) {
|
||||
return sysFileService.tryOn(tryOnDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadClothFile")
|
||||
public Result<?> uploadClothFile(MultipartFile file) {
|
||||
return sysFileService.uploadFileCloth(file);
|
||||
}
|
||||
|
||||
// @AutoLog(value = "批量添加上衣")
|
||||
@PostMapping(value = "/batchUploadClothFile")
|
||||
public Result<?> batchUploadClothFile(MultipartFile[] files) {
|
||||
return sysFileService.batchUploadClothFile(files);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadCloth")
|
||||
public Result<?> uploadCloth(@RequestBody UploadClothDTO uploadClothDTO) {
|
||||
return sysFileService.uploadCloth(uploadClothDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadFace")
|
||||
public Result<?> uploadFace(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
return sysFileService.uploadFace(file);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getFaceList")
|
||||
public Result<?> getFaceList(@RequestBody @Validated GetFaceDTO getFaceDTO) {
|
||||
return sysFileService.getFaceList(getFaceDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.ExchangeHairReq;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.OnRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.OnRecordRespVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.OnRecordSaveReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.onrecord.OnRecordDO;
|
||||
import cn.iocoder.yudao.module.digital.service.onrecord.OnRecordService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Tag(name = "管理后台 - 试穿记录")
|
||||
@RestController
|
||||
@RequestMapping("/digital/on-record")
|
||||
@Validated
|
||||
public class OnRecordController {
|
||||
|
||||
@Resource
|
||||
private OnRecordService onRecordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建试穿记录")
|
||||
@PreAuthorize("@ss.hasPermission('digital:on-record:create')")
|
||||
public CommonResult<String> createOnRecord(@Valid @RequestBody OnRecordSaveReqVO createReqVO) {
|
||||
return success(onRecordService.createOnRecord(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新试穿记录")
|
||||
@PreAuthorize("@ss.hasPermission('digital:on-record:update')")
|
||||
public CommonResult<Boolean> updateOnRecord(@Valid @RequestBody OnRecordSaveReqVO updateReqVO) {
|
||||
onRecordService.updateOnRecord(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除试穿记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('digital:on-record:delete')")
|
||||
public CommonResult<Boolean> deleteOnRecord(@RequestParam("id") Long id) {
|
||||
onRecordService.deleteOnRecord(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除试穿记录")
|
||||
@PreAuthorize("@ss.hasPermission('digital:on-record:delete')")
|
||||
public CommonResult<Boolean> deleteOnRecordList(@RequestParam("ids") List<Long> ids) {
|
||||
onRecordService.deleteOnRecordListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得试穿记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('digital:on-record:query')")
|
||||
public CommonResult<OnRecordRespVO> getOnRecord(@RequestParam("id") Long id) {
|
||||
OnRecordDO onRecord = onRecordService.getOnRecord(id);
|
||||
return success(BeanUtils.toBean(onRecord, OnRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得试穿记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('digital:on-record:query')")
|
||||
public CommonResult<PageResult<OnRecordRespVO>> getOnRecordPage(@Valid OnRecordPageReqVO pageReqVO) {
|
||||
PageResult<OnRecordDO> pageResult = onRecordService.getOnRecordPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, OnRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出试穿记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('digital:on-record:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportOnRecordExcel(@Valid OnRecordPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<OnRecordDO> list = onRecordService.getOnRecordPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "试穿记录.xls", "数据", OnRecordRespVO.class,
|
||||
BeanUtils.toBean(list, OnRecordRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/exchange-hair")
|
||||
@Operation(summary = "试戴发型")
|
||||
public CommonResult<String> exchangeHair(@RequestBody ExchangeHairReq req) {
|
||||
|
||||
onRecordService.processHairTryOn(req.isHr(), req.getHairIds(), req.getSex(),req.getModelId(), req.getFiles());
|
||||
return success("成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.RecordsPageReqVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.RecordsRespVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.RecordsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.RecordsDO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.digital.service.records.RecordsService;
|
||||
|
||||
@Tag(name = "管理后台 - 数据记录")
|
||||
@RestController
|
||||
@RequestMapping("/digital/records")
|
||||
@Validated
|
||||
public class RecordsController {
|
||||
|
||||
@Resource
|
||||
private RecordsService recordsService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建数据记录")
|
||||
@PreAuthorize("@ss.hasPermission('digital:records:create')")
|
||||
public CommonResult<Long> createRecords(@Valid @RequestBody RecordsSaveReqVO createReqVO) {
|
||||
return success(recordsService.createRecords(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新数据记录")
|
||||
@PreAuthorize("@ss.hasPermission('digital:records:update')")
|
||||
public CommonResult<Boolean> updateRecords(@Valid @RequestBody RecordsSaveReqVO updateReqVO) {
|
||||
recordsService.updateRecords(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除数据记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('digital:records:delete')")
|
||||
public CommonResult<Boolean> deleteRecords(@RequestParam("id") Long id) {
|
||||
recordsService.deleteRecords(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除数据记录")
|
||||
@PreAuthorize("@ss.hasPermission('digital:records:delete')")
|
||||
public CommonResult<Boolean> deleteRecordsList(@RequestParam("ids") List<Long> ids) {
|
||||
recordsService.deleteRecordsListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得数据记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('digital:records:query')")
|
||||
public CommonResult<RecordsRespVO> getRecords(@RequestParam("id") Long id) {
|
||||
RecordsDO records = recordsService.getRecords(id);
|
||||
return success(BeanUtils.toBean(records, RecordsRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得数据记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('digital:records:query')")
|
||||
public CommonResult<PageResult<RecordsRespVO>> getRecordsPage(@Valid RecordsPageReqVO pageReqVO) {
|
||||
PageResult<RecordsDO> pageResult = recordsService.getRecordsPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RecordsRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出数据记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('digital:records:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportRecordsExcel(@Valid RecordsPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<RecordsDO> list = recordsService.getRecordsPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "数据记录.xls", "数据", RecordsRespVO.class,
|
||||
BeanUtils.toBean(list, RecordsRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-by-user-id")
|
||||
@Operation(summary = "根据用户ID查询数据记录")
|
||||
public CommonResult<RecordsRespVO> getRecordsByUserId() {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
RecordsDO records = recordsService.getRecordsByUserId(userId);
|
||||
return success(BeanUtils.toBean(records, RecordsRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.SysTripleImagePageReqVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.SysTripleImageRespVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.SysTripleImageSaveReqVO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysTripleImage;
|
||||
import cn.iocoder.yudao.module.digital.service.SysTripleImageService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 三图记录")
|
||||
@RestController
|
||||
@RequestMapping("/digital/triple-image")
|
||||
@Validated
|
||||
public class SysTripleImageController {
|
||||
|
||||
@Resource
|
||||
private SysTripleImageService sysTripleImageService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建三图记录")
|
||||
@PreAuthorize("@ss.hasPermission('digital:triple-image:create')")
|
||||
public CommonResult<Long> createTripleImage(@Valid @RequestBody SysTripleImageSaveReqVO createReqVO) {
|
||||
return success(sysTripleImageService.createTripleImage(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新三图记录")
|
||||
@PreAuthorize("@ss.hasPermission('digital:triple-image:update')")
|
||||
public CommonResult<Boolean> updateTripleImage(@Valid @RequestBody SysTripleImageSaveReqVO updateReqVO) {
|
||||
sysTripleImageService.updateTripleImage(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除三图记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('digital:triple-image:delete')")
|
||||
public CommonResult<Boolean> deleteTripleImage(@RequestParam("id") Long id) {
|
||||
sysTripleImageService.deleteTripleImage(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得三图记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('digital:triple-image:query')")
|
||||
public CommonResult<SysTripleImageRespVO> getTripleImage(@RequestParam("id") Long id) {
|
||||
SysTripleImage sysTripleImage = sysTripleImageService.getTripleImage(id);
|
||||
return success(BeanUtils.toBean(sysTripleImage, SysTripleImageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得三图记录列表")
|
||||
@PreAuthorize("@ss.hasPermission('digital:triple-image:query')")
|
||||
public CommonResult<List<SysTripleImageRespVO>> getTripleImageList() {
|
||||
List<SysTripleImage> list = sysTripleImageService.getTripleImageList();
|
||||
return success(BeanUtils.toBean(list, SysTripleImageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得三图记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('digital:triple-image:query')")
|
||||
public CommonResult<PageResult<SysTripleImageRespVO>> getTripleImagePage(@Valid SysTripleImagePageReqVO pageVO) {
|
||||
PageResult<SysTripleImage> pageResult = sysTripleImageService.getTripleImagePage(pageVO);
|
||||
return success(BeanUtils.toBean(pageResult, SysTripleImageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出三图记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('digital:triple-image:export')")
|
||||
|
||||
public void exportTripleImageExcel(@Valid SysTripleImagePageReqVO pageVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<SysTripleImage> list = sysTripleImageService.getTripleImagePage(pageVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "三图记录.xls", "数据", SysTripleImageRespVO.class,
|
||||
BeanUtils.toBean(list, SysTripleImageRespVO.class));
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin;
|
||||
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.digital.dto.tjHair.GetHairDataDTO;
|
||||
import cn.iocoder.yudao.module.digital.dto.tjHair.GetSwapHairHistoryByTaskIdDTO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.DpUser;
|
||||
import cn.iocoder.yudao.module.digital.service.IDpUserService;
|
||||
import cn.iocoder.yudao.module.digital.service.ISysFileService;
|
||||
import cn.iocoder.yudao.module.digital.vo.Result;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/v1")
|
||||
@Slf4j
|
||||
public class TjSwapHairController {
|
||||
|
||||
@Autowired
|
||||
private ISysFileService sysFileService;
|
||||
@Autowired
|
||||
private IDpUserService dpUserService;
|
||||
|
||||
|
||||
@PostMapping(value = "/getHairData")
|
||||
public Result<?> getHairData(@RequestBody @Validated GetHairDataDTO getHairData) {
|
||||
String phone = "18701620166";
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
log.info("第三方用户信息:{}", dpUser);
|
||||
getHairData.setUserId(dpUser.getId());
|
||||
return sysFileService.getHairData(getHairData);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/queryHairData")
|
||||
public Result<?> queryHairData(@RequestBody @Validated GetHairDataDTO getHairData) {
|
||||
String phone = getHairData.getPhone();
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
log.info("查询的第三方用户信息:{}", dpUser);
|
||||
getHairData.setUserId(dpUser.getId());
|
||||
return sysFileService.getHairData(getHairData);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/swapHair")
|
||||
public Result<?> swapHair(@RequestParam(value = "isHr") String isHr,
|
||||
@RequestParam(value = "hairIds") String hairIds,
|
||||
MultipartFile[] files,
|
||||
@RequestParam(value = "sex") String sex) {
|
||||
//判断手机号格式是否合法
|
||||
String phone = "18701620166";
|
||||
//首先判断用户是否存在,不存在则添加
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
return sysFileService.swapHair(dpUser, isHr, hairIds, files, sex);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/swapHairAsync")
|
||||
public Result<?> swapHairAsync(@RequestParam(value = "isHr") String isHr,
|
||||
@RequestParam(value = "hairIds") String hairIds,
|
||||
MultipartFile[] files,
|
||||
@RequestParam(value = "modelUrls") String modelUrls,
|
||||
@RequestParam(value = "sex") String sex) {
|
||||
//判断手机号格式是否合法
|
||||
String phone = "13763009010";
|
||||
//首先判断用户是否存在,不存在则添加
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
return sysFileService.swapHairAsync(dpUser, isHr, hairIds, files, modelUrls, sex);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getSwapHairHistory")
|
||||
public Result<?> getSwapHairHistory() {
|
||||
String phone = "18701620166";
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
return sysFileService.getSwapHairHistory(dpUser);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getSwapHairHistoryByTaskId")
|
||||
public Result<?> getSwapHairHistoryByTaskId(@RequestBody @Validated GetSwapHairHistoryByTaskIdDTO getSwapHairHistoryByTaskIdDTO) {
|
||||
return sysFileService.getSwapHairHistoryByTaskId(getSwapHairHistoryByTaskIdDTO.getTaskId());
|
||||
}
|
||||
|
||||
@PostMapping(value = "/getTargetTryOnHistory")
|
||||
public Result<?> getTargetTryOnHistory() {
|
||||
String phone = "13763009010";
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
return sysFileService.getTargetTryOnHistory(dpUser);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/querySwapHairHistory")
|
||||
public Result<?> querySwapHairHistory() {
|
||||
String phone = "13763009010";
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
return sysFileService.getSwapHairHistory(dpUser);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExchangeHairReq {
|
||||
|
||||
private boolean isHr;
|
||||
|
||||
private String hairIds;
|
||||
|
||||
private String sex;
|
||||
|
||||
private String modelId;
|
||||
|
||||
private String files;
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 试穿记录分页 Request VO")
|
||||
@Data
|
||||
public class OnRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "模特ID", example = "21763")
|
||||
private Long modelId;
|
||||
|
||||
@Schema(description = "模特图片地址", example = "https://www.iocoder.cn")
|
||||
private String modelImageUrl;
|
||||
|
||||
@Schema(description = "衣服图片地址", example = "https://www.iocoder.cn")
|
||||
private String clothingImageUrl;
|
||||
|
||||
@Schema(description = "试穿效果地址", example = "https://www.iocoder.cn")
|
||||
private String tryOnResultUrl;
|
||||
|
||||
@Schema(description = "用户ID", example = "22622")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 试穿记录 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class OnRecordRespVO {
|
||||
|
||||
@Schema(description = "主键", example = "25410")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模特ID", example = "21763")
|
||||
@ExcelProperty("模特ID")
|
||||
private Long modelId;
|
||||
|
||||
@Schema(description = "模特图片地址", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("模特图片地址")
|
||||
private String modelImageUrl;
|
||||
|
||||
@Schema(description = "衣服图片地址", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("衣服图片地址")
|
||||
private String clothingImageUrl;
|
||||
|
||||
private String kuziUrl;
|
||||
|
||||
@Schema(description = "试穿效果地址", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("试穿效果地址")
|
||||
private String tryOnResultUrl;
|
||||
|
||||
@Schema(description = "用户ID", example = "22622")
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private String firstUrl;
|
||||
|
||||
private String len;
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 试穿记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class OnRecordSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", example = "25410")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模特ID", example = "21763")
|
||||
@NotNull(message = "模特ID不能为空")
|
||||
private Long modelId;
|
||||
|
||||
@Schema(description = "模特图片地址", example = "https://www.iocoder.cn")
|
||||
private String modelImageUrl;
|
||||
|
||||
@Schema(description = "衣服图片地址", example = "https://www.iocoder.cn")
|
||||
private String clothUrl;
|
||||
|
||||
private String kuziUrl;
|
||||
|
||||
@Schema(description = "试穿效果地址", example = "https://www.iocoder.cn")
|
||||
private String tryOnResultUrl;
|
||||
|
||||
@Schema(description = "用户ID", example = "22622")
|
||||
private Long userId;
|
||||
|
||||
private String len;
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 数据记录分页 Request VO")
|
||||
@Data
|
||||
public class RecordsPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户ID", example = "21893")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "数据JSON串")
|
||||
private String dataJson;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 数据记录 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RecordsRespVO {
|
||||
|
||||
@Schema(description = "主键ID" ,example = "133")
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户ID", example = "21893")
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "数据JSON串")
|
||||
@ExcelProperty("数据JSON串")
|
||||
private String dataJson;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 数据记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class RecordsSaveReqVO {
|
||||
|
||||
@Schema(description = "主键ID", example = "133")
|
||||
private Long id;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "数据JSON串")
|
||||
@NotEmpty(message = "数据JSON串不能为空")
|
||||
private String dataJson;
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 三图记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SysTripleImagePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "第一张图片URL", example = "https://www.iocoder.cn/1.jpg")
|
||||
private String firstImageUrl;
|
||||
|
||||
@Schema(description = "第二张图片URL", example = "https://www.iocoder.cn/2.jpg")
|
||||
private String secondImageUrl;
|
||||
|
||||
@Schema(description = "第三张图片URL", example = "https://www.iocoder.cn/3.jpg")
|
||||
private String thirdImageUrl;
|
||||
|
||||
@Schema(description = "用户ID", example = "1001")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "关联的任务ID", example = "TASK001")
|
||||
private String taskId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 三图记录 Response VO")
|
||||
@Data
|
||||
public class SysTripleImageRespVO {
|
||||
|
||||
@Schema(description = "主键", example = "1024")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "第一张图片URL", example = "https://www.iocoder.cn/1.jpg")
|
||||
@ExcelProperty("第一张图片URL")
|
||||
private String firstImageUrl;
|
||||
|
||||
@Schema(description = "第二张图片URL", example = "https://www.iocoder.cn/2.jpg")
|
||||
@ExcelProperty("第二张图片URL")
|
||||
private String secondImageUrl;
|
||||
|
||||
@Schema(description = "第三张图片URL", example = "https://www.iocoder.cn/3.jpg")
|
||||
@ExcelProperty("第三张图片URL")
|
||||
private String thirdImageUrl;
|
||||
|
||||
private String userFaceImageUrl;
|
||||
|
||||
@Schema(description = "用户ID", example = "1001")
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "关联的任务ID", example = "TASK001")
|
||||
@ExcelProperty("关联的任务ID")
|
||||
private String taskId;
|
||||
|
||||
@Schema(description = "图片描述")
|
||||
@ExcelProperty("图片描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.admin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 三图记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class SysTripleImageSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "第一张图片URL", example = "https://www.iocoder.cn/1.jpg")
|
||||
private String firstImageUrl;
|
||||
|
||||
@Schema(description = "第二张图片URL", example = "https://www.iocoder.cn/2.jpg")
|
||||
private String secondImageUrl;
|
||||
|
||||
@Schema(description = "第三张图片URL", example = "https://www.iocoder.cn/3.jpg")
|
||||
private String thirdImageUrl;
|
||||
|
||||
private String userFaceImageUrl;
|
||||
|
||||
@Schema(description = "关联的任务ID", example = "TASK001")
|
||||
private String taskId;
|
||||
|
||||
@Schema(description = "图片描述")
|
||||
private String description;
|
||||
}
|
||||
+252
@@ -0,0 +1,252 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.app;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.DpUser;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysFile;
|
||||
import cn.iocoder.yudao.module.digital.dto.*;
|
||||
import cn.iocoder.yudao.module.digital.service.*;
|
||||
import cn.iocoder.yudao.module.digital.utils.oConvertUtils;
|
||||
import cn.iocoder.yudao.module.digital.vo.LoginUserInfoVO;
|
||||
import cn.iocoder.yudao.module.digital.vo.Result;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cloth")
|
||||
@Slf4j
|
||||
public class AppDigitalClothController {
|
||||
|
||||
@Autowired
|
||||
private IDpUserService dpUserService;
|
||||
@Autowired
|
||||
private ISysFileService sysFileService;
|
||||
@Autowired
|
||||
private IMwTrainTaskService mwTrainTaskService;
|
||||
@Autowired
|
||||
private ISysContactService sysContactService;
|
||||
@Autowired
|
||||
private SysRoomService sysRoomService;
|
||||
|
||||
@PostMapping(value = "/addRoom")
|
||||
public Result<?> addRoom(@RequestBody @Validated AddRoomDTO addRoomDTO) {
|
||||
return sysRoomService.addRoom(addRoomDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/delRoom")
|
||||
public Result<?> delRoom(@RequestBody @Validated DelRoomDTO delRoomDTO) {
|
||||
return sysRoomService.delRoom(delRoomDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/updateRoom")
|
||||
public Result<?> updateRoom(@RequestBody @Validated UpdateRoomDTO updateRoomDTO) {
|
||||
return sysRoomService.updateRoom(updateRoomDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/getRoomList")
|
||||
public Result<?> getRoomList(@RequestBody @Validated GetRoomListDTO getRoomListDTO) {
|
||||
return sysRoomService.getRoomList(getRoomListDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/addRoomCloth")
|
||||
public Result<?> addRoomCloth(@RequestBody @Validated AddRoomClothDTO addRoomClothDTO) {
|
||||
return sysRoomService.addRoomCloth(addRoomClothDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/delRoomCloth")
|
||||
public Result<?> delRoomCloth(@RequestBody @Validated AddRoomClothDTO addRoomClothDTO) {
|
||||
return sysRoomService.delRoomCloth(addRoomClothDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getRoomClothList")
|
||||
public Result<?> getRoomClothList(@RequestBody @Validated GetRoomClothListDTO getRoomClothListDTO) {
|
||||
return sysRoomService.getRoomClothList(getRoomClothListDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/buyLink")
|
||||
public Result<?> buyLink(@RequestBody @Validated BuyLinksDTO buyLinksDTO) {
|
||||
return sysFileService.buyLink(buyLinksDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/batchDelHistory")
|
||||
public Result<?> batchDelHistory(@RequestBody @Validated BatchDelHistoryDTO batchDelHistoryDTO) {
|
||||
return sysFileService.batchDelHistory(batchDelHistoryDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/unTryOn")
|
||||
public Result<?> unTryOn(@RequestBody @Validated UnTryOnDTO unTryOnDTO) {
|
||||
return sysFileService.unTryOn(unTryOnDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadAvatar")
|
||||
public Result<?> uploadAvatar(@RequestParam("file") MultipartFile file) {
|
||||
return sysFileService.uploadAvatar(file);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/getLoginUserInfo")
|
||||
public Result<?> getLoginUserInfo() {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
log.info("开始 获取登录用户信息 loginUser =" + loginUser);
|
||||
DpUser dpUser = dpUserService.getByUserId(String.valueOf(loginUser.getId()));
|
||||
log.info("开始 获取登录用户信息 dpUser =" + dpUser);
|
||||
LoginUserInfoVO loginUserInfoVO = new LoginUserInfoVO();
|
||||
BeanUtils.copyProperties(dpUser, loginUserInfoVO);
|
||||
loginUserInfoVO.setUsername(DesensitizedUtil.mobilePhone(dpUser.getAccount()));
|
||||
return Result.ok(loginUserInfoVO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/addSuit")
|
||||
public Result<?> addSuit(@RequestBody @Validated AddSuitDTO addSuitDTO) {
|
||||
return sysFileService.addSuit(addSuitDTO);
|
||||
}
|
||||
|
||||
// @AutoLog(value = "查看试穿历史数据")
|
||||
|
||||
@PostMapping(value = "/getTryOnHistory")
|
||||
public Result<?> getTryOnHistory() {
|
||||
return sysFileService.getTryOnHistory();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadModel")
|
||||
public Result<?> uploadModel(@RequestParam("file") MultipartFile file, @RequestParam("sex") String sex) throws IOException {
|
||||
return sysFileService.uploadModel(file, sex);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getModelList")
|
||||
public Result<?> getModelList(@RequestBody @Validated GetModelDTO getModelDTO) {
|
||||
return sysFileService.getModelList(getModelDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/list")
|
||||
public Result<?> queryClothTypeList(@RequestBody @Validated QueryClothTypeDTO queryClothTypeDTO) {
|
||||
return sysFileService.clothList(queryClothTypeDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/grabPicture")
|
||||
public Result<?> grabPicture(@RequestBody @Validated CrawlerPictureDTO crawlerPictureDTO) {
|
||||
return sysFileService.grabPicture(crawlerPictureDTO.getGrabUrl());
|
||||
}
|
||||
|
||||
@PostMapping(value = "/unJoin")
|
||||
public Result<?> unJoin(@RequestBody @Validated UnJoinDTO unJoinDTO) {
|
||||
return sysFileService.unJoin(unJoinDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/addWardrobe")
|
||||
public Result<?> addWardrobe(@RequestBody @Validated AddWardrobeDTO addWardrobeDTO) {
|
||||
return sysFileService.addWardrobe(addWardrobeDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/submitContactInfo")
|
||||
public Result<?> submitContactInfo(@RequestBody @Validated SubmitContactInfoDTO submitContactInfoDTO) {
|
||||
return sysContactService.submitContactInfo(submitContactInfoDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/deleteCloth")
|
||||
public Result<String> deleteCloth(@RequestBody @Validated DeleteClothDTO deleteClothDTO) {
|
||||
String taskId = UUID.randomUUID().toString();
|
||||
String id = deleteClothDTO.getId();
|
||||
SysFile sysFile = sysFileService.getById(id);
|
||||
if (sysFile == null) {
|
||||
return Result.error("数据库中无此数据", taskId);
|
||||
}
|
||||
String commonClothType = sysFile.getCommonClothType();
|
||||
if (oConvertUtils.isNotEmpty(commonClothType) && commonClothType.contains("in_")) {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
if (!loginUser.getRoleCode().equals("admin")) {
|
||||
return Result.error("公共文件不能删除!", taskId);
|
||||
}
|
||||
}
|
||||
sysFileService.removeById(id);
|
||||
|
||||
String materialPath = sysFile.getMaterialPath();
|
||||
if (oConvertUtils.isNotEmpty(materialPath)) {
|
||||
QueryWrapper<SysFile> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(SysFile::getMaterialPath, materialPath);
|
||||
List<SysFile> deleteList = sysFileService.list(queryWrapper);
|
||||
if (deleteList != null && deleteList.size() > 0) {
|
||||
log.info("需要删除的数据 deleteList =" + deleteList);
|
||||
sysFileService.removeBatchByIds(deleteList);
|
||||
}
|
||||
}
|
||||
return Result.OK("删除成功!", taskId);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getCostTime")
|
||||
public Result<?> getCostTime() {
|
||||
return mwTrainTaskService.getCostTime();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/tryOnCallBack")
|
||||
public Result<?> tryOnCallBack(@RequestBody TryOnCallBackDTO tryOnCallBackDTO) {
|
||||
return sysFileService.tryOnCallBack(tryOnCallBackDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/callBack")
|
||||
public Result<?> callBack(@RequestBody CallBackDTO callBackDTO) {
|
||||
return sysFileService.callBack(callBackDTO);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/tryOn")
|
||||
public Result<?> tryOn(@RequestBody @Validated TryOnDTO tryOnDTO) {
|
||||
return sysFileService.tryOn(tryOnDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadClothFile")
|
||||
public Result<?> uploadClothFile(MultipartFile file) {
|
||||
return sysFileService.uploadFileCloth(file);
|
||||
}
|
||||
|
||||
// @AutoLog(value = "批量添加上衣")
|
||||
@PostMapping(value = "/batchUploadClothFile")
|
||||
public Result<?> batchUploadClothFile(MultipartFile[] files) {
|
||||
return sysFileService.batchUploadClothFile(files);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadCloth")
|
||||
public Result<?> uploadCloth(@RequestBody UploadClothDTO uploadClothDTO) {
|
||||
return sysFileService.uploadCloth(uploadClothDTO);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadFace")
|
||||
public Result<?> uploadFace(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
return sysFileService.uploadFace(file);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/getFaceList")
|
||||
public Result<?> getFaceList(@RequestBody @Validated GetFaceDTO getFaceDTO) {
|
||||
return sysFileService.getFaceList(getFaceDTO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.app;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.ExchangeHairReq;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.OnRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.OnRecordRespVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.OnRecordSaveReqVO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.onrecord.OnRecordDO;
|
||||
import cn.iocoder.yudao.module.digital.service.onrecord.OnRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 试穿记录")
|
||||
@RestController
|
||||
@RequestMapping("/digital/on-record")
|
||||
@Validated
|
||||
public class AppOnRecordController {
|
||||
|
||||
@Resource
|
||||
private OnRecordService onRecordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建试穿记录")
|
||||
public CommonResult<String> createOnRecord(@Valid @RequestBody OnRecordSaveReqVO createReqVO) {
|
||||
return success(onRecordService.createOnRecord(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新试穿记录")
|
||||
public CommonResult<Boolean> updateOnRecord(@Valid @RequestBody OnRecordSaveReqVO updateReqVO) {
|
||||
onRecordService.updateOnRecord(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除试穿记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteOnRecord(@RequestParam("id") Long id) {
|
||||
onRecordService.deleteOnRecord(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除试穿记录")
|
||||
public CommonResult<Boolean> deleteOnRecordList(@RequestParam("ids") List<Long> ids) {
|
||||
onRecordService.deleteOnRecordListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得试穿记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<OnRecordRespVO> getOnRecord(@RequestParam("id") Long id) {
|
||||
OnRecordDO onRecord = onRecordService.getOnRecord(id);
|
||||
return success(BeanUtils.toBean(onRecord, OnRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得试穿记录分页")
|
||||
public CommonResult<PageResult<OnRecordRespVO>> getOnRecordPage(@Valid OnRecordPageReqVO pageReqVO) {
|
||||
PageResult<OnRecordDO> pageResult = onRecordService.getOnRecordPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, OnRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出试穿记录 Excel")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportOnRecordExcel(@Valid OnRecordPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<OnRecordDO> list = onRecordService.getOnRecordPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "试穿记录.xls", "数据", OnRecordRespVO.class,
|
||||
BeanUtils.toBean(list, OnRecordRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/exchange-hair")
|
||||
@Operation(summary = "试戴发型")
|
||||
public CommonResult<String> exchangeHair(@RequestBody ExchangeHairReq req) {
|
||||
|
||||
onRecordService.processHairTryOn(req.isHr(), req.getHairIds(), req.getSex(),req.getModelId(), req.getFiles());
|
||||
return success("成功");
|
||||
}
|
||||
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.app;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.RecordsPageReqVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.RecordsRespVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.RecordsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.RecordsDO;
|
||||
import cn.iocoder.yudao.module.digital.service.records.RecordsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 数据记录")
|
||||
@RestController
|
||||
@RequestMapping("/digital/records")
|
||||
@Validated
|
||||
public class AppRecordsController {
|
||||
|
||||
@Resource
|
||||
private RecordsService recordsService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建数据记录")
|
||||
public CommonResult<Long> createRecords(@Valid @RequestBody RecordsSaveReqVO createReqVO) {
|
||||
return success(recordsService.createRecords(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新数据记录")
|
||||
public CommonResult<Boolean> updateRecords(@Valid @RequestBody RecordsSaveReqVO updateReqVO) {
|
||||
recordsService.updateRecords(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除数据记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteRecords(@RequestParam("id") Long id) {
|
||||
recordsService.deleteRecords(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除数据记录")
|
||||
public CommonResult<Boolean> deleteRecordsList(@RequestParam("ids") List<Long> ids) {
|
||||
recordsService.deleteRecordsListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得数据记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
||||
public CommonResult<RecordsRespVO> getRecords(@RequestParam("id") Long id) {
|
||||
RecordsDO records = recordsService.getRecords(id);
|
||||
return success(BeanUtils.toBean(records, RecordsRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得数据记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('digital:records:query')")
|
||||
public CommonResult<PageResult<RecordsRespVO>> getRecordsPage(@Valid RecordsPageReqVO pageReqVO) {
|
||||
PageResult<RecordsDO> pageResult = recordsService.getRecordsPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RecordsRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出数据记录 Excel")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportRecordsExcel(@Valid RecordsPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<RecordsDO> list = recordsService.getRecordsPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "数据记录.xls", "数据", RecordsRespVO.class,
|
||||
BeanUtils.toBean(list, RecordsRespVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询数据记录
|
||||
*/
|
||||
@GetMapping("/get-by-user-id")
|
||||
@Operation(summary = "根据用户ID查询数据记录")
|
||||
public CommonResult<RecordsRespVO> getRecordsByUserId() {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
RecordsDO records = recordsService.getRecordsByUserId(userId);
|
||||
return success(BeanUtils.toBean(records, RecordsRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.app;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.SysTripleImagePageReqVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.SysTripleImageRespVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.SysTripleImageSaveReqVO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysTripleImage;
|
||||
import cn.iocoder.yudao.module.digital.service.SysTripleImageService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 三图记录")
|
||||
@RestController
|
||||
@RequestMapping("/digital/triple-image")
|
||||
@Validated
|
||||
public class AppSysTripleImageController {
|
||||
|
||||
@Resource
|
||||
private SysTripleImageService sysTripleImageService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建三图记录")
|
||||
public CommonResult<Long> createTripleImage(@Valid @RequestBody SysTripleImageSaveReqVO createReqVO) {
|
||||
return success(sysTripleImageService.createTripleImage(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新三图记录")
|
||||
public CommonResult<Boolean> updateTripleImage(@Valid @RequestBody SysTripleImageSaveReqVO updateReqVO) {
|
||||
sysTripleImageService.updateTripleImage(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除三图记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteTripleImage(@RequestParam("id") Long id) {
|
||||
sysTripleImageService.deleteTripleImage(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得三图记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<SysTripleImageRespVO> getTripleImage(@RequestParam("id") Long id) {
|
||||
SysTripleImage sysTripleImage = sysTripleImageService.getTripleImage(id);
|
||||
return success(BeanUtils.toBean(sysTripleImage, SysTripleImageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得三图记录列表")
|
||||
public CommonResult<List<SysTripleImageRespVO>> getTripleImageList() {
|
||||
List<SysTripleImage> list = sysTripleImageService.getTripleImageList();
|
||||
return success(BeanUtils.toBean(list, SysTripleImageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得三图记录分页")
|
||||
public CommonResult<PageResult<SysTripleImageRespVO>> getTripleImagePage(@Valid SysTripleImagePageReqVO pageVO) {
|
||||
PageResult<SysTripleImage> pageResult = sysTripleImageService.getTripleImagePage(pageVO);
|
||||
return success(BeanUtils.toBean(pageResult, SysTripleImageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出三图记录 Excel")
|
||||
|
||||
public void exportTripleImageExcel(@Valid SysTripleImagePageReqVO pageVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<SysTripleImage> list = sysTripleImageService.getTripleImagePage(pageVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "三图记录.xls", "数据", SysTripleImageRespVO.class,
|
||||
BeanUtils.toBean(list, SysTripleImageRespVO.class));
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package cn.iocoder.yudao.module.digital.controller.app;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.DpUser;
|
||||
import cn.iocoder.yudao.module.digital.dto.tjHair.GetHairDataDTO;
|
||||
import cn.iocoder.yudao.module.digital.dto.tjHair.GetSwapHairHistoryByTaskIdDTO;
|
||||
import cn.iocoder.yudao.module.digital.service.IDpUserService;
|
||||
import cn.iocoder.yudao.module.digital.service.ISysFileService;
|
||||
import cn.iocoder.yudao.module.digital.vo.Result;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/v1")
|
||||
@Slf4j
|
||||
public class AppTjSwapHairController {
|
||||
|
||||
@Autowired
|
||||
private ISysFileService sysFileService;
|
||||
@Autowired
|
||||
private IDpUserService dpUserService;
|
||||
|
||||
|
||||
@PostMapping(value = "/getHairData")
|
||||
public Result<?> getHairData(@RequestBody @Validated GetHairDataDTO getHairData) {
|
||||
String phone = "18701620166";
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
log.info("第三方用户信息:{}", dpUser);
|
||||
getHairData.setUserId(dpUser.getId());
|
||||
return sysFileService.getHairData(getHairData);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/queryHairData")
|
||||
public Result<?> queryHairData(@RequestBody @Validated GetHairDataDTO getHairData) {
|
||||
String phone = getHairData.getPhone();
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
log.info("查询的第三方用户信息:{}", dpUser);
|
||||
getHairData.setUserId(dpUser.getId());
|
||||
return sysFileService.getHairData(getHairData);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/swapHair")
|
||||
public Result<?> swapHair(@RequestParam(value = "isHr") String isHr,
|
||||
@RequestParam(value = "hairIds") String hairIds,
|
||||
MultipartFile[] files,
|
||||
@RequestParam(value = "sex") String sex) {
|
||||
//判断手机号格式是否合法
|
||||
String phone = "18701620166";
|
||||
//首先判断用户是否存在,不存在则添加
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
return sysFileService.swapHair(dpUser, isHr, hairIds, files, sex);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/swapHairAsync")
|
||||
public Result<?> swapHairAsync(@RequestParam(value = "isHr") String isHr,
|
||||
@RequestParam(value = "hairIds") String hairIds,
|
||||
MultipartFile[] files,
|
||||
@RequestParam(value = "modelUrls") String modelUrls,
|
||||
@RequestParam(value = "sex") String sex) {
|
||||
//判断手机号格式是否合法
|
||||
String phone = "13763009010";
|
||||
//首先判断用户是否存在,不存在则添加
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
return sysFileService.swapHairAsync(dpUser, isHr, hairIds, files, modelUrls, sex);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getSwapHairHistory")
|
||||
public Result<?> getSwapHairHistory() {
|
||||
String phone = "18701620166";
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
return sysFileService.getSwapHairHistory(dpUser);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/getSwapHairHistoryByTaskId")
|
||||
public Result<?> getSwapHairHistoryByTaskId(@RequestBody @Validated GetSwapHairHistoryByTaskIdDTO getSwapHairHistoryByTaskIdDTO) {
|
||||
return sysFileService.getSwapHairHistoryByTaskId(getSwapHairHistoryByTaskIdDTO.getTaskId());
|
||||
}
|
||||
|
||||
@PostMapping(value = "/getTargetTryOnHistory")
|
||||
public Result<?> getTargetTryOnHistory() {
|
||||
String phone = "13763009010";
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
return sysFileService.getTargetTryOnHistory(dpUser);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/querySwapHairHistory")
|
||||
public Result<?> querySwapHairHistory() {
|
||||
String phone = "13763009010";
|
||||
DpUser dpUser = dpUserService.getUserByAccount(phone);
|
||||
return sysFileService.getSwapHairHistory(dpUser);
|
||||
}
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: dp_user
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-04-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("dp_user")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class DpUser extends BaseDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
|
||||
private String appId;
|
||||
|
||||
|
||||
private String roleType;
|
||||
|
||||
|
||||
private boolean apiAuthority;
|
||||
|
||||
|
||||
private String appSecret;
|
||||
|
||||
|
||||
private String reqFrom;
|
||||
|
||||
|
||||
private String token;
|
||||
|
||||
|
||||
private Date expires;
|
||||
|
||||
|
||||
private String account;
|
||||
|
||||
private String realname;
|
||||
|
||||
private String password;
|
||||
|
||||
private String salt;
|
||||
|
||||
private String avatar;
|
||||
/**
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
|
||||
private Date birthday;
|
||||
/**
|
||||
* 性别(0-默认未知,1-男,2-女)
|
||||
*/
|
||||
|
||||
private String sex;
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
|
||||
private String email;
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
|
||||
private String phone;
|
||||
/**
|
||||
* 性别(1-正常,2-冻结)
|
||||
*/
|
||||
|
||||
private String status;
|
||||
|
||||
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
|
||||
private String companyName;
|
||||
/**
|
||||
* 购买的短视频合成时长
|
||||
*/
|
||||
|
||||
private Integer videoComposeTime;
|
||||
/**
|
||||
* 购买的数字人个数
|
||||
*/
|
||||
|
||||
private Integer modelNum;
|
||||
|
||||
|
||||
private Integer useModelNum;
|
||||
/**
|
||||
* 购买克隆声音数
|
||||
*/
|
||||
|
||||
private Integer cloneSoundNum;
|
||||
/**
|
||||
* 定制的数字人个数
|
||||
*/
|
||||
|
||||
private Integer customizedModelNum;
|
||||
/**
|
||||
* 剩余的数字人个数
|
||||
*/
|
||||
|
||||
private Integer remainModelNum;
|
||||
/**
|
||||
* 剩余声音克隆个数
|
||||
*/
|
||||
|
||||
private Integer remainCloneSoundNum;
|
||||
/**
|
||||
* remainComposeTime
|
||||
*/
|
||||
|
||||
private Integer remainComposeTime;
|
||||
/**
|
||||
* 短视频合成时长 分
|
||||
*/
|
||||
|
||||
private Integer videoComposeMin;
|
||||
/**
|
||||
* 短视频合成时长 秒
|
||||
*/
|
||||
|
||||
private Integer videoComposeSec;
|
||||
/**
|
||||
* 剩余定制模特数-豪华版(2K)
|
||||
*/
|
||||
|
||||
private Integer remainModeTwoNum;
|
||||
/**
|
||||
* 剩余定制模特数-旗舰版(4K)
|
||||
*/
|
||||
|
||||
private Integer remainModeThreeNum;
|
||||
/**
|
||||
* 剩余克隆声音数-基础版
|
||||
*/
|
||||
|
||||
private Integer remainSoundTwoNum;
|
||||
/**
|
||||
* 剩余克隆声音数-情感版
|
||||
*/
|
||||
|
||||
private Integer remainSoundThreeNum;
|
||||
/**
|
||||
* 互动并发总数量
|
||||
*/
|
||||
|
||||
private Integer liveInteractConcurrency;
|
||||
/**
|
||||
* 直播并发总数量
|
||||
*/
|
||||
private Integer liveConcurrency;
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("mw_train_task")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MwTrainTask extends BaseDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
private Integer costTime;
|
||||
|
||||
|
||||
private String taskId;
|
||||
|
||||
private String tryOnType;
|
||||
|
||||
|
||||
private String tryOnAlgo;
|
||||
|
||||
private String userId;
|
||||
|
||||
|
||||
private String clothPath;
|
||||
|
||||
private String modelPath;
|
||||
|
||||
|
||||
private String tilePath;
|
||||
|
||||
|
||||
private String status;
|
||||
|
||||
|
||||
private String result;
|
||||
|
||||
|
||||
private String requestResult;
|
||||
|
||||
private String resultImages;
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 数据记录 DO
|
||||
*
|
||||
* @author XXXX
|
||||
*/
|
||||
@TableName("data_records")
|
||||
@KeySequence("data_records_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RecordsDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 数据JSON串
|
||||
*/
|
||||
private String dataJson;
|
||||
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: sys_contact
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-05-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_contact")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysContact extends BaseDO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
|
||||
private String phone;
|
||||
/**
|
||||
* 公司
|
||||
*/
|
||||
|
||||
private String company;
|
||||
/**
|
||||
* 需求描述
|
||||
*/
|
||||
|
||||
private String description;
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("sys_file")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysFile extends BaseDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
private String repValue;
|
||||
|
||||
|
||||
private String wardrobeId;
|
||||
|
||||
private String buyLink;
|
||||
|
||||
|
||||
private String sex;
|
||||
|
||||
|
||||
private String materialPath;
|
||||
|
||||
|
||||
private String isPerson;
|
||||
|
||||
private String processType;
|
||||
|
||||
|
||||
private String fileStatus;
|
||||
|
||||
private String clothType;
|
||||
|
||||
|
||||
private String fileType;
|
||||
|
||||
|
||||
private String commonClothType;
|
||||
|
||||
private String extendName;
|
||||
|
||||
|
||||
private Integer fileSum;
|
||||
|
||||
|
||||
private String fileName;
|
||||
|
||||
private String ossFilePath;
|
||||
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
private String filePath;
|
||||
/**
|
||||
* 文件路径id
|
||||
*/
|
||||
private String filePathId;
|
||||
/**
|
||||
* 对应ossId
|
||||
*/
|
||||
private String fileOssId;
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String ossFileName;
|
||||
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
private Integer fileSize;
|
||||
|
||||
|
||||
private String fileUrl;
|
||||
|
||||
|
||||
private String thumbnailFileUrl;
|
||||
|
||||
|
||||
private Integer expireTime;
|
||||
/**
|
||||
* 临时数据 1 是,0 不是
|
||||
*/
|
||||
private String isTemp;
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
|
||||
private String userId;
|
||||
|
||||
private String len;
|
||||
|
||||
|
||||
private String dealRes;
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("sys_history")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysHistory extends BaseDO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
private String tryOnType;
|
||||
|
||||
|
||||
private String tryOnAlgo;
|
||||
|
||||
|
||||
private String batchNo;
|
||||
|
||||
|
||||
private String status;
|
||||
|
||||
|
||||
private String taskId;
|
||||
|
||||
|
||||
private String fileUrl;
|
||||
|
||||
|
||||
private String userId;
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("sys_room")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysRoom extends BaseDO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
|
||||
private String roomName;
|
||||
|
||||
private String sex;
|
||||
|
||||
private String userId;
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("sys_room_cloth")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysRoomCloth extends BaseDO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
private String roomId;
|
||||
|
||||
|
||||
private String fileId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("sys_task_queue")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysTaskQueue extends BaseDO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
|
||||
private String isHr;
|
||||
|
||||
|
||||
private String tryOnType;
|
||||
|
||||
|
||||
private String tryOnAlgo;
|
||||
|
||||
|
||||
private String sex;
|
||||
|
||||
|
||||
private String status;
|
||||
|
||||
|
||||
private String taskId;
|
||||
|
||||
|
||||
private String jsonInfo;
|
||||
|
||||
|
||||
private String userId;
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@TableName("sys_triple_image")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysTripleImage extends BaseDO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 第一张图片URL
|
||||
*/
|
||||
private String firstImageUrl;
|
||||
|
||||
/**
|
||||
* 第二张图片URL
|
||||
*/
|
||||
private String secondImageUrl;
|
||||
|
||||
/**
|
||||
* 第三张图片URL
|
||||
*/
|
||||
private String thirdImageUrl;
|
||||
|
||||
private String userFaceImageUrl;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 关联的任务ID
|
||||
*/
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 图片描述
|
||||
*/
|
||||
private String description;
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("sys_white_user")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SysWhiteUser extends BaseDO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
private String account;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.dataobject.onrecord;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 试穿记录 DO
|
||||
*
|
||||
* @author XXXX
|
||||
*/
|
||||
@TableName("try_on_record")
|
||||
@KeySequence("try_on_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OnRecordDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 模特ID
|
||||
*/
|
||||
private Long modelId;
|
||||
/**
|
||||
* 模特图片地址
|
||||
*/
|
||||
private String modelImageUrl;
|
||||
/**
|
||||
* 衣服图片地址
|
||||
*/
|
||||
private String clothingImageUrl;
|
||||
|
||||
private String kuziUrl;
|
||||
/**
|
||||
* 试穿效果地址
|
||||
*/
|
||||
private String tryOnResultUrl;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 状态:0-待处理 1-处理中 2-处理成功 3-处理失败
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 处理结果
|
||||
*/
|
||||
private String dealMsg;
|
||||
|
||||
private String requestId;
|
||||
|
||||
private String firstUrl;
|
||||
|
||||
private String len;
|
||||
|
||||
@Getter
|
||||
public enum StatusEnum {
|
||||
WAITING(0, "待处理"),
|
||||
PROCESSING(1, "处理中"),
|
||||
SUCCESS(2, "处理成功"),
|
||||
FAIL(3, "处理失败");
|
||||
private final Integer code;
|
||||
private final String msg;
|
||||
StatusEnum(Integer code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.module.digital.dto.SpuInfoDTO;
|
||||
import cn.iocoder.yudao.module.digital.dto.SysFileDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DataSyncMapper {
|
||||
|
||||
/**
|
||||
* 查询商品信息
|
||||
*/
|
||||
public List<SpuInfoDTO> selectSpuInfo();
|
||||
|
||||
public List<SpuInfoDTO> selectSyncSpuInfo();
|
||||
|
||||
void updateSpuSync(@Param("id") Long id,@Param("syncId") String syncId);
|
||||
|
||||
List<SpuInfoDTO> selectDeletedSpuInfo();
|
||||
|
||||
void deleteSpuSync(Long id);
|
||||
|
||||
void updateDeletedSpuSync(long parseLong);
|
||||
|
||||
void updateFileUrl(@Param("id") String syncId, @Param("url") String savePath,@Param("fileName") String fileName);
|
||||
|
||||
SysFileDTO selectFileById(@Param("id") String id);
|
||||
|
||||
void updateSpuDeleted(@Param("id")Long id);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.DpUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Description: dp_user
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-04-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface DpUserMapper extends BaseMapperX<DpUser> {
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.MwTrainTask;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Description: mw_train_task
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-10-06
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface MwTrainTaskMapper extends BaseMapperX<MwTrainTask> {
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.RecordsPageReqVO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.RecordsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 数据记录 Mapper
|
||||
*
|
||||
* @author XXXX
|
||||
*/
|
||||
@Mapper
|
||||
public interface RecordsMapper extends BaseMapperX<RecordsDO> {
|
||||
|
||||
default PageResult<RecordsDO> selectPage(RecordsPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RecordsDO>()
|
||||
.eqIfPresent(RecordsDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(RecordsDO::getDataJson, reqVO.getDataJson())
|
||||
.betweenIfPresent(RecordsDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(RecordsDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysContact;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysContactMapper extends BaseMapperX<SysContact> {
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysFile;
|
||||
import cn.iocoder.yudao.module.digital.vo.QueryClothTypeListVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Description: sys_file
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-04-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysFileMapper extends BaseMapperX<SysFile> {
|
||||
|
||||
IPage<QueryClothTypeListVO> queryClothTypeList(@Param("page") Page<SysFile> page, @Param(Constants.WRAPPER) QueryWrapper<SysFile> queryWrapper);
|
||||
|
||||
SysFile selectWithoutLogicDeleteById(String clothId);
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.digital.dto.UserHistoryMap;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysHistory;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@Mapper
|
||||
public interface SysHistoryMapper extends BaseMapperX<SysHistory> {
|
||||
|
||||
List<String> selectBatchNosFieldValues(String userId);
|
||||
|
||||
|
||||
List<String> selectAllBatchNosFieldValues();
|
||||
|
||||
SysHistory selectHistoryOne(String taskId);
|
||||
|
||||
List<UserHistoryMap> getUserHistory(String userId);
|
||||
|
||||
List<UserHistoryMap> getAllUserHistory();
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysRoomCloth;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysRoomClothMapper extends BaseMapperX<SysRoomCloth> {
|
||||
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysRoom;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysRoomMapper extends BaseMapperX<SysRoom> {
|
||||
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysTaskQueue;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysTaskQueueMapper extends BaseMapperX<SysTaskQueue> {
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.RecordsPageReqVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.SysTripleImagePageReqVO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.RecordsDO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysTripleImage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysTripleImageMapper extends BaseMapperX<SysTripleImage> {
|
||||
|
||||
default PageResult<SysTripleImage> selectPage(SysTripleImagePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<SysTripleImage>()
|
||||
.eqIfPresent(SysTripleImage::getUserId, reqVO.getUserId())
|
||||
.orderByDesc(SysTripleImage::getId));
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysWhiteUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysWhiteUserMapper extends BaseMapperX<SysWhiteUser> {
|
||||
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.digital.dal.mysql.onrecord;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.OnRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.OnRecordRespVO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.onrecord.OnRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 试穿记录 Mapper
|
||||
*
|
||||
* @author XXXX
|
||||
*/
|
||||
@Mapper
|
||||
public interface OnRecordMapper extends BaseMapperX<OnRecordDO> {
|
||||
|
||||
default PageResult<OnRecordDO> selectPage(OnRecordPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<OnRecordDO>()
|
||||
.eqIfPresent(OnRecordDO::getModelId, reqVO.getModelId())
|
||||
.eqIfPresent(OnRecordDO::getModelImageUrl, reqVO.getModelImageUrl())
|
||||
.eqIfPresent(OnRecordDO::getClothingImageUrl, reqVO.getClothingImageUrl())
|
||||
.eqIfPresent(OnRecordDO::getTryOnResultUrl, reqVO.getTryOnResultUrl())
|
||||
.eqIfPresent(OnRecordDO::getUserId, reqVO.getUserId())
|
||||
.betweenIfPresent(OnRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||
.isNull(OnRecordDO::getRequestId)
|
||||
.orderByDesc(OnRecordDO::getId));
|
||||
}
|
||||
|
||||
List<OnRecordRespVO> getTryOnList();
|
||||
|
||||
void updateTryOnStatus(@Param("id") Long id, @Param("status") Integer status,
|
||||
@Param("tryOnResultUrl") String tryOnResultUrl,
|
||||
@Param("firstUrl") String firstUrl,
|
||||
@Param("result") String result);
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class AddRoomClothDTO {
|
||||
|
||||
@NotBlank(message = "roomId 不能为空!")
|
||||
private String roomId;
|
||||
|
||||
@NotBlank(message = "clothId 不能为空!")
|
||||
private String clothId;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class AddRoomDTO {
|
||||
|
||||
|
||||
@NotBlank(message = "roomName 不能为空!")
|
||||
private String roomName;
|
||||
|
||||
|
||||
@NotBlank(message = "sex 不能为空!")
|
||||
private String sex;
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class AddSuitDTO {
|
||||
|
||||
|
||||
@NotBlank(message = "topClothId 不能为空!")
|
||||
private String topClothId;
|
||||
|
||||
|
||||
@NotBlank(message = "bottomClothId 不能为空!")
|
||||
private String bottomClothId;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class AddWardrobeDTO {
|
||||
|
||||
|
||||
@NotBlank(message = "clothType 不能为空!")
|
||||
private String clothType;
|
||||
|
||||
@NotBlank(message = "clothId 不能为空!")
|
||||
private String clothId;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BatchDelHistoryDTO {
|
||||
|
||||
@NotEmpty
|
||||
private List<String> historyIds;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class BuyLinksDTO {
|
||||
|
||||
|
||||
@NotBlank(message = "clothId 不能为空!")
|
||||
private String clothId;
|
||||
|
||||
|
||||
@NotBlank(message = "buyLinks 不能为空!")
|
||||
private String buyLink;
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CallBackDTO {
|
||||
|
||||
|
||||
private String status;
|
||||
|
||||
|
||||
private String taskId;
|
||||
|
||||
|
||||
private String clothId;
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CrawlerPictureDTO {
|
||||
private String grabUrl;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class DelRoomDTO {
|
||||
|
||||
@NotBlank(message = "roomId 不能为空!")
|
||||
private String roomId;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class DeleteClothDTO {
|
||||
|
||||
@NotBlank(message = "id不能为空!")
|
||||
private String id;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GetFaceDTO {
|
||||
|
||||
@Schema(description = "数据范围:0-自己;1-所有")
|
||||
private String dataScope;
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class GetModelDTO {
|
||||
|
||||
@NotBlank(message = "性别不能为空!")
|
||||
private String sex;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class GetRoomClothListDTO {
|
||||
|
||||
@NotBlank(message = "roomId 不能为空!")
|
||||
private String roomId;
|
||||
|
||||
|
||||
@NotBlank(message = "sex 不能为空!")
|
||||
private String sex;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class GetRoomListDTO {
|
||||
|
||||
@NotBlank(message = "sex 不能为空!")
|
||||
private String sex;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class LoginDTO {
|
||||
|
||||
|
||||
@NotBlank(message = "account 不能为空!")
|
||||
private String account;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* author: damao
|
||||
* date:2022-10-03 12:47
|
||||
* description:手机号登录dto
|
||||
**/
|
||||
@Data
|
||||
public class PhoneLoginDTO {
|
||||
|
||||
@NotBlank(message = "手机号不能为空!")
|
||||
|
||||
private String phone;
|
||||
|
||||
@NotBlank(message = "验证码不能为空!")
|
||||
|
||||
private String captcha;
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class QueryClothTypeDTO {
|
||||
|
||||
|
||||
@NotBlank(message = "isPerson 不能为空!")
|
||||
private String isPerson;
|
||||
|
||||
|
||||
private String clothType;
|
||||
|
||||
|
||||
private String sex;
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class SmsLoginDTO {
|
||||
|
||||
|
||||
@NotBlank(message = "手机号不能为空!")
|
||||
private String phone;
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SpuInfoDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String categoryId;
|
||||
|
||||
private String picUrl;
|
||||
|
||||
private String syncId;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class SubmitContactInfoDTO {
|
||||
|
||||
|
||||
@NotBlank(message = "name 不能为空!")
|
||||
private String name;
|
||||
|
||||
@NotBlank(message = "phone 不能为空!")
|
||||
private String phone;
|
||||
|
||||
|
||||
@NotBlank(message = "company 不能为空!")
|
||||
private String company;
|
||||
|
||||
|
||||
private String description;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysFileDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String fileName;
|
||||
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TrainTaskCallbackDTO {
|
||||
|
||||
|
||||
private String status;
|
||||
|
||||
|
||||
private String taskId;
|
||||
|
||||
|
||||
private List<String> urlList;
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TryOnCallBackDTO {
|
||||
|
||||
|
||||
private Integer status;
|
||||
|
||||
|
||||
private String taskId;
|
||||
|
||||
|
||||
private String filePath;
|
||||
|
||||
|
||||
private String msg;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TryOnDTO {
|
||||
|
||||
private List<TryOn> tryOnList;
|
||||
|
||||
private String isHr;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class TryOn {
|
||||
|
||||
private List<String> clothIds;
|
||||
|
||||
private String modelId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class UnJoinDTO {
|
||||
|
||||
|
||||
@NotBlank(message = "clothId 不能为空!")
|
||||
private String clothId;
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UnTryOnDTO {
|
||||
|
||||
@NotEmpty
|
||||
private List<String> historyIds;
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class UpdateRoomDTO {
|
||||
|
||||
@NotBlank(message = "roomId 不能为空!")
|
||||
private String roomId;
|
||||
|
||||
|
||||
@NotBlank(message = "roomName 不能为空!")
|
||||
private String roomName;
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UploadClothDTO {
|
||||
|
||||
private List<String> clothFileList;
|
||||
|
||||
@NotBlank(message = "clothType不能为空!")
|
||||
private String clothType;
|
||||
|
||||
@NotBlank(message = "isSync 不能为空!")
|
||||
private String isSync;
|
||||
|
||||
@NotBlank(message = "sex 不能为空!")
|
||||
private String sex;
|
||||
|
||||
private String len;
|
||||
|
||||
private boolean isUpdate = false;
|
||||
|
||||
private String isPerson = "no";
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.digital.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class UserHistoryMap {
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String batchNo;
|
||||
|
||||
private String historyIdFileUrls;
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.digital.dto.tjHair;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class GetHairDataDTO {
|
||||
|
||||
// @NotBlank(message = "phone 不能为空!")
|
||||
// @Pattern(regexp = "^1[3-9]\\d{9}$", message = "phone 不是合法的手机号!")
|
||||
private String phone;
|
||||
|
||||
@NotBlank(message = "isPerson 不能为空!")
|
||||
private String isPerson;
|
||||
|
||||
private String userId;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.digital.dto.tjHair;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class GetSwapHairHistoryByTaskIdDTO {
|
||||
|
||||
@NotBlank(message = "taskId 不能为空!")
|
||||
private String taskId;
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.digital.emun;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public enum LiveStatusEnum {
|
||||
//枚举值
|
||||
//STARTING 开启中
|
||||
//SUCCESS 开播成功
|
||||
//CANCEL 取消开播
|
||||
//FAIL 开播失败
|
||||
//说明
|
||||
CANCEL, FAIL, STARTING, SUCCESS;
|
||||
|
||||
public String toValue() {
|
||||
switch (this) {
|
||||
case CANCEL: return "CANCEL";
|
||||
case FAIL: return "FAIL";
|
||||
case STARTING: return "STARTING";
|
||||
case SUCCESS: return "SUCCESS";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LiveStatusEnum forValue(String value) throws IOException {
|
||||
if (value.equals("CANCEL")) return CANCEL;
|
||||
if (value.equals("FAIL")) return FAIL;
|
||||
if (value.equals("STARTING")) return STARTING;
|
||||
if (value.equals("SUCCESS")) return SUCCESS;
|
||||
throw new IOException("Cannot deserialize Status");
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.digital.emun;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 回复者 主播 ANCHOR, 助播 ASSISTANT;
|
||||
*/
|
||||
public enum ReplySource {
|
||||
ANCHOR, ASSISTANT;
|
||||
|
||||
public String toValue() {
|
||||
switch (this) {
|
||||
case ANCHOR: return "ANCHOR";
|
||||
case ASSISTANT: return "ASSISTANT";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ReplySource forValue(String value) throws IOException {
|
||||
if (value.equals("ANCHOR")) return ANCHOR;
|
||||
if (value.equals("ASSISTANT")) return ASSISTANT;
|
||||
throw new IOException("Cannot deserialize ReplySource");
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.digital.emun;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public enum ReplyType {
|
||||
AUDIO, TEXT;
|
||||
|
||||
public String toValue() {
|
||||
switch (this) {
|
||||
case AUDIO: return "AUDIO";
|
||||
case TEXT: return "TEXT";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ReplyType forValue(String value) throws IOException {
|
||||
if (value.equals("AUDIO")) return AUDIO;
|
||||
if (value.equals("TEXT")) return TEXT;
|
||||
throw new IOException("Cannot deserialize ReplyType");
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.digital.emun;
|
||||
|
||||
|
||||
|
||||
public enum SortTypeEnum {
|
||||
picture_1("1", "DESC"),
|
||||
picture_2("0", "ASC"),
|
||||
;
|
||||
|
||||
SortTypeEnum(String type, String extendName) {
|
||||
this.type = type;
|
||||
this.extendName = extendName;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getExtendName() {
|
||||
return extendName;
|
||||
}
|
||||
|
||||
public void setExtendName(String extendName) {
|
||||
this.extendName = extendName;
|
||||
}
|
||||
|
||||
private String type;
|
||||
private String extendName;
|
||||
|
||||
|
||||
public static SortTypeEnum codeIn(String type) {
|
||||
if (type == null) {
|
||||
return null;
|
||||
} else {
|
||||
for (SortTypeEnum em : SortTypeEnum.values()) {
|
||||
if (em.getType().equals(type)) {
|
||||
return em;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.digital.emun;
|
||||
|
||||
|
||||
/**
|
||||
* U CAN GET A CRAB WHEN U MEET US!
|
||||
* IF GET A QUESTION,PLEASE CONTACT US:
|
||||
* WEBSITE: www.crabholder.cn www.crabholder.com
|
||||
* EMAIL:crabholder@163.com.
|
||||
* CREATED ON 2020/7/13!
|
||||
*/
|
||||
public enum StatusTypeEnum {
|
||||
picture_1("2", "DRAFT"),
|
||||
picture_2("0", "IN_PROGRESS"),
|
||||
picture_3("1", "SUCCESS"),
|
||||
picture_4("-1", "FAIL"),
|
||||
;
|
||||
|
||||
StatusTypeEnum(String fileType, String extendName) {
|
||||
this.fileType = fileType;
|
||||
this.extendName = extendName;
|
||||
}
|
||||
|
||||
public String getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
public String getExtendName() {
|
||||
return extendName;
|
||||
}
|
||||
|
||||
public void setExtendName(String extendName) {
|
||||
this.extendName = extendName;
|
||||
}
|
||||
|
||||
private String fileType;
|
||||
private String extendName;
|
||||
|
||||
|
||||
public static StatusTypeEnum codeIn(String fileType) {
|
||||
if (fileType == null) {
|
||||
return null;
|
||||
} else {
|
||||
for (StatusTypeEnum em : StatusTypeEnum.values()) {
|
||||
if (em.getFileType().equals(fileType)) {
|
||||
return em;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.digital.emun;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public enum Type {
|
||||
GIFT, KEYS, LIVE_DURATION, LIVE_INTERVAL, ONLINE_NUM, TOTAL_VIEW_NUM, UPVOTE_NUM;
|
||||
|
||||
public String toValue() {
|
||||
switch (this) {
|
||||
case GIFT: return "GIFT";
|
||||
case KEYS: return "KEYS";
|
||||
case LIVE_DURATION: return "LIVE_DURATION";
|
||||
case LIVE_INTERVAL: return "LIVE_INTERVAL";
|
||||
case ONLINE_NUM: return "ONLINE_NUM";
|
||||
case TOTAL_VIEW_NUM: return "TOTAL_VIEW_NUM";
|
||||
case UPVOTE_NUM: return "UPVOTE_NUM";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Type forValue(String value) throws IOException {
|
||||
if (value.equals("GIFT")) return GIFT;
|
||||
if (value.equals("KEYS")) return KEYS;
|
||||
if (value.equals("LIVE_DURATION")) return LIVE_DURATION;
|
||||
if (value.equals("LIVE_INTERVAL")) return LIVE_INTERVAL;
|
||||
if (value.equals("ONLINE_NUM")) return ONLINE_NUM;
|
||||
if (value.equals("TOTAL_VIEW_NUM")) return TOTAL_VIEW_NUM;
|
||||
if (value.equals("UPVOTE_NUM")) return UPVOTE_NUM;
|
||||
throw new IOException("Cannot deserialize Type");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.digital.emun;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public enum TypeEnum {
|
||||
GLOBAL_IMAGE, IMAGE, VIDEO;
|
||||
|
||||
public String toValue() {
|
||||
switch (this) {
|
||||
case GLOBAL_IMAGE: return "GlobalImage";
|
||||
case IMAGE: return "Image";
|
||||
case VIDEO: return "Video";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TypeEnum forValue(String value) throws IOException {
|
||||
if (value.equals("GlobalImage")) return GLOBAL_IMAGE;
|
||||
if (value.equals("Image")) return IMAGE;
|
||||
if (value.equals("Video")) return VIDEO;
|
||||
throw new IOException("Cannot deserialize TypeEnum");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
package cn.iocoder.yudao.module.digital;
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
package cn.iocoder.yudao.module.digital.service;//package digital.application.service;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import digital.application.dto.TryOnDTO;
|
||||
//import digital.application.entity.SysFile;
|
||||
//import digital.application.entity.SysHistory;
|
||||
//import digital.application.mapper.MwTrainTaskMapper;
|
||||
//import digital.application.mapper.SysFileMapper;
|
||||
//import digital.application.mapper.SysHistoryMapper;
|
||||
//import digital.base.constant.CommonConstant;
|
||||
//import digital.base.constant.Face3dSeverHTTPConstant;
|
||||
//import digital.base.constant.ZitaCommonConstant;
|
||||
//import digital.bean.task.MwTrainTask;
|
||||
//import digital.config.oss.OssConfiguration;
|
||||
//import digital.util.oss.OssBootUtil;
|
||||
//import digital.util.util.RestUtil;
|
||||
//import digital.util.util.oConvertUtils;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.http.HttpMethod;
|
||||
//import org.springframework.http.ResponseEntity;
|
||||
//import org.springframework.scheduling.annotation.Async;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.util.Arrays;
|
||||
//import java.util.List;
|
||||
//import java.util.UUID;
|
||||
//
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//public class AsyncService {
|
||||
// @Autowired
|
||||
// OssConfiguration ossConfiguration;
|
||||
// @Autowired
|
||||
// private SysFileMapper sysFileMapper;
|
||||
// @Autowired
|
||||
// private MwTrainTaskMapper trainTaskMapper;
|
||||
// @Autowired
|
||||
// private SysHistoryMapper sysHistoryMapper;
|
||||
//
|
||||
//// @Transactional
|
||||
// @Async("defaultThreadPoolExecutor")
|
||||
// public void syncCommon(List<SysHistory> sysHistoryList, TryOnDTO tryOns, String userId) {
|
||||
// String batchNo = UUID.randomUUID().toString();
|
||||
// log.info("开始同步任务" + batchNo);
|
||||
// List<TryOnDTO.TryOn> tryOnDTOList = tryOns.getTryOnList();
|
||||
// ////////////////// 开始处理试穿 /////////////////////
|
||||
// for (int i = 0; i < tryOnDTOList.size(); i++) {
|
||||
// String taskId = UUID.randomUUID().toString();
|
||||
// log.info(taskId + "开始处理试穿");
|
||||
// TryOnDTO.TryOn tryOnDTO = tryOnDTOList.get(i);
|
||||
// SysHistory sysHistory = sysHistoryList.get(i);
|
||||
// String modelId = tryOnDTO.getModelId();
|
||||
// SysFile modelImage = sysFileMapper.selectById(modelId);
|
||||
// if (modelImage == null) {
|
||||
// log.info(taskId + "数据库中无此数据! modelId=" + modelId);
|
||||
// continue;
|
||||
// }
|
||||
// List<String> clothIds = tryOnDTO.getClothIds();
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// MwTrainTask trainTask = new MwTrainTask();
|
||||
// trainTask.setTaskId(taskId);
|
||||
// trainTask.setUserId(userId);
|
||||
// trainTask.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_IN_PROGRESS);
|
||||
// trainTask.setClothPath(String.join(",", clothIds));
|
||||
// trainTaskMapper.insert(trainTask);
|
||||
// //给历史记录添加taskid
|
||||
// sysHistory.setTaskId(taskId);
|
||||
// sysHistoryMapper.updateById(sysHistory);
|
||||
// //添加完毕
|
||||
// int size = clothIds.size();
|
||||
// if (size == 1) {
|
||||
// for (String clothId : clothIds) {
|
||||
// SysFile clothImage = sysFileMapper.selectById(clothId);
|
||||
// if (clothImage != null) {
|
||||
// if ("topCloth".equals(clothImage.getClothType())) {
|
||||
// List<String> list = Arrays.asList(clothImage.getMaterialPath(), "0", clothImage.getProcessType());
|
||||
// jsonObject.put("upper", list);
|
||||
// jsonObject.put("lower", "");
|
||||
// }
|
||||
// if ("bottomCloth".equals(clothImage.getClothType())) {
|
||||
// List<String> list = Arrays.asList(clothImage.getMaterialPath(), "1", clothImage.getProcessType());
|
||||
// jsonObject.put("upper", "");
|
||||
// jsonObject.put("lower", list);
|
||||
// }
|
||||
// if ("dress".equals(clothImage.getClothType())) {
|
||||
// List<String> list = Arrays.asList(clothImage.getMaterialPath(), "2", clothImage.getProcessType());
|
||||
// jsonObject.put("upper", list);
|
||||
// jsonObject.put("lower", "");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (size == 2) {
|
||||
// if (clothIds != null && clothIds.size() > 0) {
|
||||
// for (String clothId : clothIds) {
|
||||
// SysFile clothImage = sysFileMapper.selectById(clothId);
|
||||
// if (clothImage != null) {
|
||||
// if ("topCloth".equals(clothImage.getClothType())) {
|
||||
// List<String> list = Arrays.asList(clothImage.getMaterialPath(), "0", clothImage.getProcessType());
|
||||
// jsonObject.put("upper", list);
|
||||
// }
|
||||
// if ("bottomCloth".equals(clothImage.getClothType())) {
|
||||
// List<String> list = Arrays.asList(clothImage.getMaterialPath(), "0", clothImage.getProcessType());
|
||||
// jsonObject.put("lower", list);
|
||||
// }
|
||||
// if ("dress".equals(clothImage.getClothType())) {
|
||||
// List<String> list = Arrays.asList(clothImage.getMaterialPath(), "0", clothImage.getProcessType());
|
||||
// jsonObject.put("upper", list);
|
||||
// jsonObject.put("lower", "");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// trainTask.setModelPath(modelImage.getFilePath());
|
||||
// long startTime = System.currentTimeMillis();
|
||||
// JSONObject clothParam = new JSONObject();
|
||||
// clothParam.put("task_id", taskId);
|
||||
// clothParam.put("userImgPath", modelImage.getFilePath());
|
||||
// if (oConvertUtils.isNotEmpty(modelImage.getSex())) {
|
||||
// clothParam.put("sex", modelImage.getSex());
|
||||
// } else {
|
||||
// clothParam.put("sex", "female");
|
||||
// }
|
||||
// clothParam.put("data_dict", jsonObject);
|
||||
// log.info("算法 clothParam =" + clothParam);
|
||||
// try {
|
||||
// String url;
|
||||
// if (ZitaCommonConstant.sex_male.equals(modelImage.getSex())) {
|
||||
// url = Face3dSeverHTTPConstant.SWAP_CLOTH_MALE;
|
||||
// } else {
|
||||
// url = Face3dSeverHTTPConstant.SWAP_CLOTH;
|
||||
// }
|
||||
// ResponseEntity<JSONObject> clothResult = RestUtil.zitaRequest(url,
|
||||
// HttpMethod.POST, null, clothParam, JSONObject.class);
|
||||
// String clothState = clothResult.getBody().get("status").toString();
|
||||
// log.info(taskId + " 返回结果信息成功 ==" + taskId + " clothResult=" + clothResult.getBody());
|
||||
// if (!ZitaCommonConstant.STATUS_NORMAL.equals(clothState)) {
|
||||
// trainTask.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
// trainTask.setResult(Face3dSeverHTTPConstant.result_fail);
|
||||
// trainTask.setRequestResult(String.format("digital cloth 任务失败!{taskId: %s, resp: %s}", taskId, clothResult.getBody().toJSONString()));
|
||||
// trainTaskMapper.updateById(trainTask);
|
||||
// log.info(String.format("digital cloth 任务失败!{taskId: %s, resp: %s}", taskId, clothResult.getBody().toJSONString()));
|
||||
// sysHistory.setFileUrl(CommonConstant.TRY_ON_FAIL);
|
||||
// sysHistory.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
// sysHistoryMapper.updateById(sysHistory);
|
||||
// continue;
|
||||
// }
|
||||
// // 尝试将返回结果转为JSON
|
||||
// JSONObject resultBody = clothResult.getBody();
|
||||
// String imagePath = (String) resultBody.get("data");
|
||||
// File file = new File(imagePath);
|
||||
// String newFileName = UUID.randomUUID().toString() + file.getName().substring(file.getName().lastIndexOf("."));
|
||||
// String fileUrl = OssBootUtil.uploadOssVideo(file, CommonConstant.PUTON_SWAP, newFileName);
|
||||
// String savePath = OssBootUtil.getDigitalObjectURL(ossConfiguration.getBucketName(), fileUrl, null);
|
||||
// log.info("oss 图片 savePath=" + savePath);
|
||||
// trainTask.setResultImages(savePath);
|
||||
// trainTask.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
// trainTask.setResult(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
// long endTime = System.currentTimeMillis();
|
||||
// long duration = (endTime - startTime) / 1000; // 除以1000,将毫秒转换为秒
|
||||
// trainTask.setCostTime((int) duration);
|
||||
// trainTaskMapper.updateById(trainTask);
|
||||
// //替换换装后的照片
|
||||
// sysHistory.setFileUrl(savePath);
|
||||
// sysHistory.setStatus(Face3dSeverHTTPConstant.CREATE_STATUS_SUCCESS);
|
||||
// sysHistoryMapper.updateById(sysHistory);
|
||||
// } catch (Exception ex) {
|
||||
// String message = ex.getMessage();
|
||||
// trainTask.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
// trainTask.setResult(Face3dSeverHTTPConstant.result_fail);
|
||||
// trainTask.setRequestResult("digital cloth 任务失败!" + String.format("%s {taskId: %s}", message, taskId));
|
||||
// trainTaskMapper.updateById(trainTask);
|
||||
// log.info("digital cloth 任务失败!" + String.format("%s {taskId: %s}", message, taskId));
|
||||
// sysHistory.setFileUrl(CommonConstant.TRY_ON_FAIL);
|
||||
// sysHistory.setStatus(Face3dSeverHTTPConstant.result_fail);
|
||||
// sysHistoryMapper.updateById(sysHistory);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.digital.service;
|
||||
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.DpUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: dp_user
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-04-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDpUserService extends IService<DpUser> {
|
||||
|
||||
/**
|
||||
* 根据账号获取用户信息
|
||||
*
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
DpUser getUserByAccount(String phone);
|
||||
|
||||
DpUser addUser(String mobile);
|
||||
|
||||
DpUser getByUserId(String id);
|
||||
|
||||
DpUser getDeUserByName(String username);
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.digital.service;
|
||||
|
||||
import cn.iocoder.yudao.module.digital.dto.TrainTaskCallbackDTO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.MwTrainTask;
|
||||
import cn.iocoder.yudao.module.digital.vo.Result;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: mw_train_task
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-10-06
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IMwTrainTaskService extends IService<MwTrainTask> {
|
||||
|
||||
/**
|
||||
* 数字人服务
|
||||
* @return
|
||||
* @param clothFileList
|
||||
* @param modelFileList
|
||||
*/
|
||||
Result<?> getFace3dSever(List<MultipartFile> clothFileList, List<MultipartFile> modelFileList, MultipartFile tileFile) ;
|
||||
|
||||
|
||||
/**
|
||||
* 换装体验任务 回调
|
||||
* @param trainTaskCallbackDTO
|
||||
* @return
|
||||
*/
|
||||
Result<?> trainTaskCallback(TrainTaskCallbackDTO trainTaskCallbackDTO);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Result<?> getCostTime();
|
||||
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.digital.service;
|
||||
|
||||
import cn.iocoder.yudao.module.digital.dto.SubmitContactInfoDTO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysContact;
|
||||
import cn.iocoder.yudao.module.digital.vo.Result;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: sys_contact
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-05-07
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysContactService extends IService<SysContact> {
|
||||
|
||||
Result<?> submitContactInfo(SubmitContactInfoDTO submitContactInfoDTO);
|
||||
|
||||
}
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
package cn.iocoder.yudao.module.digital.service;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.digital.controller.admin.vo.OnRecordRespVO;
|
||||
import cn.iocoder.yudao.module.digital.dto.*;
|
||||
import cn.iocoder.yudao.module.digital.dto.tjHair.GetHairDataDTO;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.DpUser;
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysFile;
|
||||
import cn.iocoder.yudao.module.digital.vo.Result;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public interface ISysFileService extends IService<SysFile> {
|
||||
|
||||
/**
|
||||
* 衣服类型图片-分页列表查询
|
||||
*
|
||||
* @param page
|
||||
* @param clothType
|
||||
* @return
|
||||
*/
|
||||
Result<?> queryClothTypeList(Page<SysFile> page, String clothType);
|
||||
|
||||
/**
|
||||
* 上传图片分类
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Result<?> uploadCloth(UploadClothDTO uploadClothDTO);
|
||||
|
||||
/**
|
||||
* 衣服类型图片所有数据查询
|
||||
*
|
||||
* @param clothType
|
||||
* @return
|
||||
*/
|
||||
Result<?> clothList(QueryClothTypeDTO clothType);
|
||||
|
||||
Result<?> uploadFileCloth(MultipartFile files);
|
||||
|
||||
Result<?> uploadModel(MultipartFile file, String sex) throws IOException;
|
||||
|
||||
/**
|
||||
* 获取模特列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Result<?> getModelList(GetModelDTO sex);
|
||||
|
||||
/**
|
||||
* 试穿
|
||||
*
|
||||
* @param tryOnDTO
|
||||
* @return
|
||||
*/
|
||||
Result<?> tryOn(TryOnDTO tryOnDTO);
|
||||
|
||||
/**
|
||||
* @param callBackDTO
|
||||
* @return
|
||||
*/
|
||||
Result<?> callBack(CallBackDTO callBackDTO);
|
||||
|
||||
/**
|
||||
* 抓取图片
|
||||
*
|
||||
* @param crawlerUrl
|
||||
* @return
|
||||
*/
|
||||
Result<?> grabPicture(String crawlerUrl);
|
||||
|
||||
/**
|
||||
* 加入衣橱
|
||||
*
|
||||
* @param addWardrobeDTO
|
||||
* @return
|
||||
*/
|
||||
Result<?> addWardrobe(AddWardrobeDTO addWardrobeDTO);
|
||||
|
||||
/**
|
||||
* 取消加入
|
||||
*
|
||||
* @param unJoinDTO
|
||||
* @return
|
||||
*/
|
||||
Result<?> unJoin(UnJoinDTO unJoinDTO);
|
||||
|
||||
/**
|
||||
* 查看试穿历史数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Result<?> getTryOnHistory();
|
||||
|
||||
|
||||
/**
|
||||
* 查看写死手机号试穿的历史数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Result<?> getTargetTryOnHistory(DpUser dpUser);
|
||||
|
||||
|
||||
/**
|
||||
* 加入套装
|
||||
*
|
||||
* @param addSuitDTO
|
||||
* @return
|
||||
*/
|
||||
Result<?> addSuit(AddSuitDTO addSuitDTO);
|
||||
|
||||
/**
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
Result<?> uploadAvatar(MultipartFile file);
|
||||
|
||||
Result<?> tryOnCallBack(TryOnCallBackDTO tryOnCallBackDTO);
|
||||
|
||||
Result<?> unTryOn(UnTryOnDTO unTryOnDTO);
|
||||
|
||||
/**
|
||||
* 批量删除历史数据
|
||||
*
|
||||
* @param batchDelHistoryDTO
|
||||
* @return
|
||||
*/
|
||||
Result<?> batchDelHistory(BatchDelHistoryDTO batchDelHistoryDTO);
|
||||
|
||||
/**
|
||||
* 购买链接
|
||||
*
|
||||
* @param buyLinksDTO
|
||||
* @return
|
||||
*/
|
||||
Result<?> buyLink(BuyLinksDTO buyLinksDTO);
|
||||
|
||||
Result<?> batchUploadClothFile(MultipartFile[] files);
|
||||
|
||||
Result<?> getHairData(GetHairDataDTO getHairData);
|
||||
|
||||
Result<?> swapHair(DpUser dpUser, String isHr, String clothIds, MultipartFile[] file, String sex);
|
||||
|
||||
Result<?> swapHairAsync(DpUser dpUser, String isHr, String clothIds, MultipartFile[] file, String modelUrls, String sex);
|
||||
|
||||
Result<?> getSwapHairHistory(DpUser dpUser);
|
||||
|
||||
Result<?> getSwapHairHistoryByTaskId(String taskId);
|
||||
|
||||
void deleteCloth(Long id);
|
||||
|
||||
|
||||
Result<?> uploadFace(MultipartFile file);
|
||||
|
||||
Result<?> getFaceList(GetFaceDTO getFaceDTO);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package cn.iocoder.yudao.module.digital.service;
|
||||
|
||||
import cn.iocoder.yudao.module.digital.dal.dataobject.SysHistory;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface SysHistoryService extends IService<SysHistory> {
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user