Compare commits
51 Commits
18c94ad1e0
...
059d6edc12
| Author | SHA1 | Date | |
|---|---|---|---|
| 059d6edc12 | |||
| 97c5be7b22 | |||
| c4da4ea111 | |||
| bbc8b025a9 | |||
| 630f6b2737 | |||
| d14fdfee79 | |||
| c14db62c0a | |||
|
|
9166bf1a1a | ||
|
|
84c024eab8 | ||
|
|
b86f3c9f7e | ||
| e2009617db | |||
| 65b17fe109 | |||
| 0917154283 | |||
| 0f525c6c00 | |||
| 4beae1094b | |||
| cefdac133e | |||
| a466f269c2 | |||
| 97f0c8f65f | |||
| ad00ac08ca | |||
| d236057f2a | |||
| 62e3e9c16f | |||
| 604c529b42 | |||
| bc612481dc | |||
| 2f3fa695b2 | |||
| 313fc19dac | |||
| f36e0488ea | |||
| f239c8c02b | |||
|
|
1d4017bafd | ||
|
|
8c98f91445 | ||
| 18f5528d59 | |||
| 88ce191950 | |||
|
|
f3d6d7b000 | ||
| ef84f32ca0 | |||
| 3886aeaa46 | |||
| 8750ea355a | |||
|
|
b107fa82df | ||
|
|
e56a6176a9 | ||
|
|
e35ed2c768 | ||
|
|
52094d58e7 | ||
|
|
e4e6cfbff7 | ||
|
|
15f2b78c94 | ||
|
|
1fd1f7dd47 | ||
|
|
2a6d3c1b58 | ||
| 59e33c22b7 | |||
| e5eecbfe8d | |||
| 9759cf4740 | |||
| e8766b9af3 | |||
| 4fed5f7439 | |||
|
|
c3e0a61ff7 | ||
|
|
58212e92ec | ||
| 5efaaf01b2 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -48,3 +48,4 @@ log
|
||||
temp/
|
||||
|
||||
docker-compose.yml
|
||||
/src/main/resources/application-local.properties
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -403,7 +403,7 @@
|
||||
<dependency>
|
||||
<groupId>com.volcengine</groupId>
|
||||
<artifactId>volcengine-java-sdk-ark-runtime</artifactId>
|
||||
<version>LATEST</version>
|
||||
<version>0.2.43</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Google 认证库 -->
|
||||
|
||||
@@ -6,10 +6,7 @@ import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
|
||||
import com.ai.da.model.vo.GenerateResultVO;
|
||||
import com.ai.da.model.vo.PoseTransformationVO;
|
||||
import com.ai.da.service.CloudTaskService;
|
||||
import com.ai.da.service.DesignService;
|
||||
import com.ai.da.service.GenerateService;
|
||||
import com.ai.da.service.UserLikeGroupService;
|
||||
import com.ai.da.service.*;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
@@ -17,17 +14,16 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
@@ -37,25 +33,22 @@ import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class GenerateConsumer {
|
||||
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
private final GenerateService generateService;
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
private final UserLikeGroupService userLikeGroupService;
|
||||
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
private final DesignService designService;
|
||||
|
||||
@Resource
|
||||
private CloudTaskService cloudTaskService;
|
||||
private final CloudTaskService cloudTaskService;
|
||||
|
||||
@Autowired
|
||||
private RabbitMQProperties rabbitMQProperties;
|
||||
private final RabbitMQProperties rabbitMQProperties;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private final MessageCenterService messageCenterService;
|
||||
|
||||
@Value("${redis.key.orderForGenerate}")
|
||||
private String consumptionOrderKey;
|
||||
@@ -301,8 +294,11 @@ public class GenerateConsumer {
|
||||
exceptionInfo.put(generateResult.get("tasks_id"), generateResult.get("message"));
|
||||
// 存redis
|
||||
redisUtil.addToMap(exceptionMapKey, exceptionInfo);
|
||||
// 记录失败状态并向用户发送提示消息
|
||||
generateService.processPTFailSituation(generateResult.get("tasks_id"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
try {
|
||||
channel.basicAck(msg.getMessageProperties().getDeliveryTag(), false);
|
||||
@@ -318,6 +314,8 @@ public class GenerateConsumer {
|
||||
exceptionInfo.put(String.valueOf(generateResult.get("tasks_id")), exceptionMessage);
|
||||
// 存redis
|
||||
redisUtil.addToMap(exceptionMapKey, exceptionInfo);
|
||||
// 记录失败状态并向用户发送提示消息
|
||||
generateService.processPTFailSituation(generateResult.get("tasks_id"));
|
||||
}
|
||||
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
@@ -200,6 +200,7 @@ public class MyTaskScheduler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 9 * * ?")
|
||||
public void sendTrialOrderExcelToManagements() {
|
||||
// 获取前一天日期
|
||||
|
||||
@@ -32,7 +32,8 @@ public class CommonConstant {
|
||||
|
||||
public static final String GENERATE_LOGO_SINGLE_CANCEL = "/api/generate_single_logo_cancel/";
|
||||
|
||||
public static final String POSE_TRANSFORMATION_CANCEL = "/api/pose_transform_cancel/";
|
||||
// public static final String POSE_TRANSFORMATION_CANCEL = "/api/pose_transform_cancel/";
|
||||
public static final String POSE_TRANSFORMATION_CANCEL = "/api/comfyui_i_2_video_cancel/";
|
||||
|
||||
public static final String PYTHON_PORT_9996 = "9996";
|
||||
|
||||
|
||||
@@ -68,4 +68,7 @@ public enum CollectionLevel2TypeEnum {
|
||||
public static List<String> printType() {
|
||||
return Arrays.asList(LOGO.getRealName(), SLOGAN.getRealName(), Pattern.getRealName());
|
||||
}
|
||||
public static CollectionLevel2TypeEnum ofWithLoweCase(String realName) {
|
||||
return Stream.of(CollectionLevel2TypeEnum.values()).filter(v -> v.getRealName().toLowerCase().equals(realName)).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
|
||||
29
src/main/java/com/ai/da/common/enums/MotionModeEnum.java
Normal file
29
src/main/java/com/ai/da/common/enums/MotionModeEnum.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.ai.da.common.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
public enum MotionModeEnum {
|
||||
POSE_TO_VIDEO(1, "/api/comfyui_image_pose_2_video"),
|
||||
|
||||
PROMPT_TO_VIDEO(2, "/api/comfyui_image_2_video"),
|
||||
|
||||
FIRST_LAST_FRAME_TO_VIDEO(3, "/api/comfyui_flf_2_video")
|
||||
;
|
||||
|
||||
private int code;
|
||||
|
||||
private String url;
|
||||
|
||||
MotionModeEnum(int code, String url) {
|
||||
this.code = code;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public static MotionModeEnum of(int code) {
|
||||
return Stream.of(MotionModeEnum.values()).filter(v -> v.getCode()== code).findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,7 @@ public enum PoseEnum {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", String.valueOf(id));
|
||||
map.put("gif", gifPath);
|
||||
map.put("video", videoPath);
|
||||
map.put("firstFrame", firstFramePath);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AccountTask {
|
||||
}
|
||||
|
||||
// 每天凌晨0点执行一次
|
||||
// @Scheduled(cron = "0 0 0 * * ?")
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void cancelActivityBenefits() {
|
||||
// 1、查询当前所有参与了活动且过期的用户
|
||||
List<Account> accountList = accountService.getExpiredUserBySystemUser(4);
|
||||
|
||||
@@ -6,12 +6,10 @@ import com.ai.da.mapper.primary.PoseTransformationMapper;
|
||||
import com.ai.da.mapper.primary.ToProductImageResultMapper;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.vo.PoseTransformationVO;
|
||||
import com.ai.da.service.APIGenerateService;
|
||||
import com.ai.da.service.CreditsService;
|
||||
import com.ai.da.service.GenerateService;
|
||||
import com.ai.da.service.MessageCenterService;
|
||||
import com.ai.da.service.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -25,19 +23,13 @@ import static com.ai.da.common.enums.CreditsEventsEnum.TO_PRODUCT_IMAGE;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class GenerateTask {
|
||||
@Resource
|
||||
private APIGenerateService apiGenerateService;
|
||||
@Resource
|
||||
private CreditsService creditsService;
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
@Resource
|
||||
private MessageCenterService messageCenterService;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
private PoseTransformationMapper poseTransformationMapper;
|
||||
private final APIGenerateService apiGenerateService;
|
||||
private final CreditsService creditsService;
|
||||
private final GenerateService generateService;
|
||||
private final PoseTransformationMapper poseTransformationMapper;
|
||||
private final ToProductImageResultMapper toProductImageResultMapper;
|
||||
|
||||
|
||||
/*
|
||||
@@ -106,15 +98,16 @@ public class GenerateTask {
|
||||
|
||||
}
|
||||
|
||||
// 万相 -> pose transformation 补偿 一小时执行一次
|
||||
// 万相 -> pose transformation 补偿 当前任务执行完后,5分钟再执行一次(不会出现任务重叠的情况)
|
||||
@Scheduled(fixedDelay = 5 * 60 * 1000)
|
||||
public void wxCompensationMechanism(){
|
||||
List<APIGenerate> apiGenerates = apiGenerateService.getPendingTaskByStatus("wx");
|
||||
if (apiGenerates != null && !apiGenerates.isEmpty()){
|
||||
log.info("=====万相补偿获取结果开始=====");
|
||||
for (APIGenerate apiGenerate : apiGenerates){
|
||||
String taskId = apiGenerate.getTaskId();
|
||||
PoseTransformation poseTransformation = poseTransformationMapper.selectOne(new QueryWrapper<PoseTransformation>().eq("unique_id", taskId));
|
||||
if (Objects.nonNull(poseTransformation) && "Pending".equals(poseTransformation.getTaskStatus())){
|
||||
if (Objects.nonNull(poseTransformation) && ("Pending".equals(poseTransformation.getTaskStatus()) || "Executing".equals(poseTransformation.getTaskStatus()))){
|
||||
// 判断当前任务的超时状态
|
||||
if (!DateUtil.isMoreThanOneDayApart(poseTransformation.getCreateTime())){
|
||||
try {
|
||||
@@ -122,7 +115,6 @@ public class GenerateTask {
|
||||
PoseTransformationVO animateResult = generateService.getAnimateResult(taskId);
|
||||
if (animateResult.getStatus().equals("Success")){
|
||||
log.info("补偿获取结果成功,发送系统消息");
|
||||
sendSysMsgToUser(poseTransformation.getAccountId(), "您的姿势变换生成任务已完成");
|
||||
}
|
||||
} catch (BusinessException e){
|
||||
log.warn("万相 animation 生成失败,原因:{}", e.getMessage());
|
||||
@@ -136,19 +128,13 @@ public class GenerateTask {
|
||||
apiGenerate.setStatus("Fail");
|
||||
apiGenerate.setUpdateTime(LocalDateTime.now());
|
||||
apiGenerateService.updateById(apiGenerate);
|
||||
generateService.sendSysMsgForPT(poseTransformation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sendSysMsgToUser(Long accountId, String content){
|
||||
Notification notification = new Notification();
|
||||
notification.setType("system");
|
||||
notification.setReceiverId(accountId);
|
||||
notification.setContent(content);
|
||||
|
||||
messageCenterService.prePushMessage(notification);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ public class PaymentTask {
|
||||
// !!关闭此定时器,改为提前三天站内信提醒!!
|
||||
// 提前7天向用户发送提醒邮件,每天早上8点执行
|
||||
// @Scheduled(cron = "0 0 8 * * ?")
|
||||
public void subscriptionReminder(){
|
||||
stripeService.subscriptionReminder();
|
||||
}
|
||||
// public void subscriptionReminder(){
|
||||
// stripeService.subscriptionReminder();
|
||||
// }
|
||||
|
||||
|
||||
// 如果有订阅已创建,但是没有发邮件通知的,需要主动获取回调信息并向用户发送邮件
|
||||
@@ -109,7 +109,7 @@ public class PaymentTask {
|
||||
affiliateService.syncLinkViewCountToDB();
|
||||
}
|
||||
|
||||
// @Scheduled(cron = "0 0 8 28-31 * ?")
|
||||
@Scheduled(cron = "0 0 8 28-31 * ?")
|
||||
public void commissionSummaryReminder(){
|
||||
// 每个月末的最后一天的早上八点执行
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.ai.da.common.task;
|
||||
|
||||
import com.ai.da.common.utils.SendEmailUtil;
|
||||
import com.ai.da.mapper.primary.AccountMapper;
|
||||
import com.ai.da.mapper.primary.SubscriptionInfoMapper;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.SubscriptionInfo;
|
||||
import com.ai.da.service.StripeService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SubscriptionReminderTask {
|
||||
|
||||
public final AccountMapper accountMapper;
|
||||
|
||||
public final SubscriptionInfoMapper subscriptionInfoMapper;
|
||||
|
||||
public final StripeService stripeService;
|
||||
|
||||
// 订阅类型与提前天数的映射配置
|
||||
private static final Map<String, Integer> REMINDER_DAYS_CONFIG = new HashMap<>();
|
||||
|
||||
static {
|
||||
REMINDER_DAYS_CONFIG.put("monthly", 7);
|
||||
REMINDER_DAYS_CONFIG.put("yearly", 14);
|
||||
}
|
||||
|
||||
public void subscriptionReminder() {
|
||||
// 获取所有需要通知的订阅
|
||||
List<SubscriptionInfo> subscriptionInfos = getDueSubscriptions();
|
||||
|
||||
for (SubscriptionInfo subscriptionInfo : subscriptionInfos) {
|
||||
Integer daysBefore = REMINDER_DAYS_CONFIG.get(subscriptionInfo.getType());
|
||||
if (daysBefore == null) {
|
||||
log.warn("未知的订阅类型: {}", subscriptionInfo.getType());
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean success = stripeService.sendEmail(subscriptionInfo.getSubscriptionId(), "reminder_subscriber", null);
|
||||
if (success) {
|
||||
log.info("提前{}天向用户 {} 发送续订通知邮件,订阅类型: {}",
|
||||
daysBefore, subscriptionInfo.getAccountId(), subscriptionInfo.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<SubscriptionInfo> getDueSubscriptions() {
|
||||
List<SubscriptionInfo> results = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<String, Integer> entry : REMINDER_DAYS_CONFIG.entrySet()) {
|
||||
String subscriptionType = entry.getKey();
|
||||
int daysBefore = entry.getValue();
|
||||
|
||||
results.addAll(getSubscriptionsDueInDays(subscriptionType, daysBefore));
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
private List<SubscriptionInfo> getSubscriptionsDueInDays(String subscriptionType, int daysBefore) {
|
||||
LocalDateTime targetDate = LocalDateTime.now().plusDays(daysBefore);
|
||||
LocalDateTime startOfDay = targetDate.toLocalDate().atStartOfDay();
|
||||
LocalDateTime endOfDay = targetDate.toLocalDate().atTime(23, 59, 59);
|
||||
|
||||
long startTimestamp = startOfDay.toEpochSecond(ZoneOffset.UTC);
|
||||
long endTimestamp = endOfDay.toEpochSecond(ZoneOffset.UTC);
|
||||
|
||||
QueryWrapper<SubscriptionInfo> qw = new QueryWrapper<>();
|
||||
qw.ge("current_period_end", startTimestamp);
|
||||
qw.lt("current_period_end", endTimestamp);
|
||||
qw.eq("status", "active");
|
||||
qw.eq("subscription_type", subscriptionType);
|
||||
|
||||
return subscriptionInfoMapper.selectList(qw);
|
||||
}
|
||||
|
||||
public void trialReminder() {
|
||||
// 今天的 00:00:00 和 23:59:59
|
||||
LocalDateTime startOfDay = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||
LocalDateTime endOfDay = LocalDateTime.now().toLocalDate().atTime(23, 59, 59);
|
||||
|
||||
// 转为时间戳
|
||||
long startTimestamp = startOfDay.toEpochSecond(ZoneOffset.UTC);
|
||||
long endTimestamp = endOfDay.toEpochSecond(ZoneOffset.UTC);
|
||||
|
||||
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().gt(Account::getValidEndTime, startTimestamp)
|
||||
.lt(Account::getValidEndTime, endTimestamp)
|
||||
.eq(Account::getSystemUser, 3);
|
||||
|
||||
List<Account> accounts = accountMapper.selectList(queryWrapper);
|
||||
for (Account account : accounts) {
|
||||
String language = stripeService.getLanguage(account.getLanguage(), account.getCountry(), "reminder_trial");
|
||||
SendEmailUtil.subscriptionEmailReminder("reminder_trial", null, language, account.getUserEmail());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* public void subscriptionReminder(){
|
||||
// 提前7天的 00:00:00 和 23:59:59
|
||||
LocalDateTime startOfDay = LocalDateTime.now().plusDays(7).toLocalDate().atStartOfDay();
|
||||
LocalDateTime endOfDay = LocalDateTime.now().plusDays(7).toLocalDate().atTime(23, 59, 59);
|
||||
|
||||
// 转为时间戳
|
||||
long startTimestamp = startOfDay.toEpochSecond(ZoneOffset.UTC);
|
||||
long endTimestamp = endOfDay.toEpochSecond(ZoneOffset.UTC);
|
||||
|
||||
QueryWrapper<SubscriptionInfo> qw = new QueryWrapper<>();
|
||||
qw.ge("current_period_end", startTimestamp);
|
||||
qw.lt("current_period_end", endTimestamp);
|
||||
qw.eq("status", "active");
|
||||
|
||||
List<SubscriptionInfo> subscriptionInfos = subscriptionInfoMapper.selectList(qw);
|
||||
for (SubscriptionInfo subscriptionInfo : subscriptionInfos) {
|
||||
boolean b = sendEmail(subscriptionInfo.getSubscriptionId(), "reminder", null);
|
||||
if (b) log.info("提前7天向用户 {} 发送续订通知邮件", subscriptionInfo.getAccountId());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -519,6 +519,7 @@ public class MinioUtil {
|
||||
|
||||
return bucketName + "/" + fileName;
|
||||
} catch (Exception e) {
|
||||
log.info("base64上传minio失败:{}",e.getMessage());
|
||||
log.error(e.getMessage());
|
||||
return null; // or throw an exception
|
||||
}
|
||||
@@ -908,6 +909,47 @@ public class MinioUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将A桶中的对象复制到B桶中
|
||||
* @return
|
||||
*/
|
||||
public void copyObject(String sourceBucket, String sourceObject, String targetBucket, String targetObject) {
|
||||
// 检查目标桶是否存在
|
||||
boolean found;
|
||||
try {
|
||||
found = minioClient.bucketExists(BucketExistsArgs.builder()
|
||||
.bucket(targetBucket)
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
log.error("目标桶{},不存在", targetBucket);
|
||||
throw new BusinessException("Copy object failed");
|
||||
}
|
||||
|
||||
if (found) {
|
||||
// 复制对象
|
||||
try {
|
||||
minioClient.copyObject(
|
||||
CopyObjectArgs.builder()
|
||||
.bucket(targetBucket)
|
||||
.object(targetObject)
|
||||
.source(
|
||||
CopySource.builder()
|
||||
.bucket(sourceBucket)
|
||||
.object(sourceObject)
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.error("对象复制失败");
|
||||
throw new BusinessException("Copy object failed");
|
||||
}
|
||||
log.info("对象复制成功");
|
||||
} else {
|
||||
log.error("目标桶{},不存在", targetBucket);
|
||||
throw new BusinessException("Copy object failed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -97,6 +97,8 @@ public class RedisUtil {
|
||||
|
||||
//- - - - - - - - - - - - - - - - - - - - - set类型 - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
public final static String VIDEO_FINISHED_TASKS = "VideoFinishedTasks";
|
||||
|
||||
/**
|
||||
* 将数据放入set缓存
|
||||
*/
|
||||
|
||||
@@ -828,15 +828,31 @@ public class SendEmailUtil {
|
||||
templateUser.setTemplateID(RENEWAL_USER_CN);
|
||||
}
|
||||
break;
|
||||
case "reminder":
|
||||
case "reminder_subscriber":
|
||||
if (language.equals("ENGLISH")) {
|
||||
user.setSubject("[Code-Create] AiDA Subscription Renewal Reminder");
|
||||
templateUser.setTemplateID(RENEWAL_REMINDER_USER_EN);
|
||||
} else {
|
||||
templateUser.setTemplateID(156072L);
|
||||
} else if (language.equals("CHINESE")){
|
||||
user.setSubject("[Code-Create] AiDA续订提醒");
|
||||
templateUser.setTemplateID(RENEWAL_REMINDER_USER_CN);
|
||||
templateUser.setTemplateID(156073L);
|
||||
} else {
|
||||
user.setSubject("[Code-Create] AiDA續訂提醒");
|
||||
templateUser.setTemplateID(156074L);
|
||||
}
|
||||
break;
|
||||
case "reminder_trial":
|
||||
if (language.equals("ENGLISH")) {
|
||||
user.setSubject("[Code-Create] AiDA — Free Trial Ending");
|
||||
templateUser.setTemplateID(156075L);
|
||||
} else if (language.equals("CHINESE")){
|
||||
user.setSubject("[Code-Create] AiDA — 免费试用结束提醒");
|
||||
templateUser.setTemplateID(156076L);
|
||||
} else {
|
||||
user.setSubject("[Code-Create] AiDA — 免費試用結束提醒");
|
||||
templateUser.setTemplateID(156077L);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
log.error("unknown subscription email type");
|
||||
return false;
|
||||
@@ -855,7 +871,7 @@ public class SendEmailUtil {
|
||||
SendEmailResponse respUser = client.SendEmail(user);
|
||||
log.info("邮件主题:{},发送结果toUser###{}", user.getSubject(), SendEmailResponse.toJsonString(respUser));
|
||||
}
|
||||
if (!type.equals("reminder")) {
|
||||
if (!type.startsWith("reminder")) {
|
||||
SendEmailResponse respMerchant = client.SendEmail(merchant);
|
||||
log.info("邮件主题:{},发送结果toMerchant###{}", merchant.getSubject(), SendEmailResponse.toJsonString(respMerchant));
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.ai.da.service.ReferralService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -67,10 +68,15 @@ public class AffiliateController {
|
||||
return Response.success(affiliateService.applicationApproval(id, isApproved, commission));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新佣金比例")
|
||||
@GetMapping("/updateCommission")
|
||||
public Response<String> updateCommissionPercentage(@RequestParam("id") Long id, @RequestParam("commission") Float commission) {
|
||||
affiliateService.updateCommissionPercentage(id, commission);
|
||||
@ApiOperation(value = "编辑affiliate")
|
||||
@GetMapping("/editAffiliate")
|
||||
public Response<String> editAffiliate(@RequestParam("id") Long id,
|
||||
@ApiParam(value = "佣金比例", example = "25")
|
||||
@RequestParam(value = "commission", required = false) Float commission,
|
||||
@ApiParam(value = "操作类型", example = "Active",
|
||||
allowableValues = "Active,Inactive,Delete")
|
||||
@RequestParam(value = "operationType", required = false) String operationType) {
|
||||
affiliateService.editAffiliate(id, commission, operationType);
|
||||
return Response.success("success");
|
||||
}
|
||||
|
||||
@@ -126,5 +132,4 @@ public class AffiliateController {
|
||||
return Response.success(affiliateService.getAllAffiliateUsername());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -243,4 +243,10 @@ public class LibraryController {
|
||||
return Response.success(libraryService.getAllSubAccLib(order, page, size));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "将系统sketch添加到library")
|
||||
@GetMapping("addSysSketchToLibrary")
|
||||
public Response<String> addSysSketchToLibrary(Long clothId, String path) {
|
||||
return Response.success(libraryService.addSysSketchToLibrary(clothId, path));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,13 +3,12 @@ package com.ai.da.controller;
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.model.vo.CommentVO;
|
||||
import com.ai.da.model.vo.PortfolioVO;
|
||||
import com.ai.da.model.vo.UserLikeChooseVO;
|
||||
import com.ai.da.service.PortfolioService;
|
||||
import com.ai.da.service.UserFollowService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -29,6 +28,9 @@ public class PortfolioController {
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
|
||||
@Resource
|
||||
private UserFollowService userFollowService;
|
||||
|
||||
@ApiOperation(value = "发布作品集")
|
||||
@PostMapping("/publish")
|
||||
public Response<Long> publish(@RequestParam("file") MultipartFile canvas, @RequestParam("data") String data) {
|
||||
@@ -138,13 +140,13 @@ public class PortfolioController {
|
||||
@ApiOperation(value = "获取关注列表")
|
||||
@PostMapping("/getFolloweeList")
|
||||
public Response<List<AccountFollowVO>> getFolloweeList(@Valid @RequestBody GetFollowListDTO getFollowListDTO) {
|
||||
return Response.success(portfolioService.getFolloweeList(getFollowListDTO));
|
||||
return Response.success(userFollowService.getFolloweeList(getFollowListDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取粉丝列表")
|
||||
@PostMapping("/getFollowerList")
|
||||
public Response<List<AccountFollowVO>> getFollowerList(@Valid @RequestBody GetFollowListDTO getFollowListDTO) {
|
||||
return Response.success(portfolioService.getFollowerList(getFollowListDTO));
|
||||
return Response.success(userFollowService.getFollowerList(getFollowListDTO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -197,8 +197,12 @@ public class SavedCollectionController {
|
||||
|
||||
@ApiOperation(value = "toProductImageElementUpload")
|
||||
@PostMapping("/toProductImageElementUpload")
|
||||
public Response<ToProductElementVO> toProductImageElementUpload(@RequestParam("file") MultipartFile file, @RequestParam(value = "projectId", required = false) Long projectId) {
|
||||
return Response.success(userLikeGroupService.toProductImageElementUpload(file, projectId));
|
||||
public Response<ToProductElementVO> toProductImageElementUpload(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "projectId", required = false) Long projectId,
|
||||
@ApiParam(value = "首尾帧", example = "first",
|
||||
allowableValues = "first,last")
|
||||
@RequestParam(value = "type", required = false) String type) {
|
||||
return Response.success(userLikeGroupService.toProductImageElementUpload(file, projectId, type));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "toProductImageElementDelete")
|
||||
|
||||
@@ -118,11 +118,11 @@ public class WorkspaceController {
|
||||
return Response.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("maleDataInsert")
|
||||
@GetMapping("/maleDataInsert")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@ApiOperation(value = "男装数据入库入minio")
|
||||
public Response<Boolean> maleDataInsert() throws FileNotFoundException {
|
||||
workspaceService.maleDataInsert();
|
||||
// workspaceService.maleDataInsert();
|
||||
return Response.success(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,4 +24,5 @@ public interface WorkspaceMapper extends CommonMapper<Workspace> {
|
||||
*/
|
||||
List<WorkspaceVO> selectWorkspacePage(IPage page, WorkspaceVO workspace);
|
||||
|
||||
String getStyleByProjectId(Long projectId);
|
||||
}
|
||||
|
||||
@@ -30,4 +30,6 @@ public class Affiliate extends BaseEntity{
|
||||
private String link;
|
||||
|
||||
private String promotionMethod;
|
||||
|
||||
private Integer isDeleted;
|
||||
}
|
||||
|
||||
@@ -97,4 +97,16 @@ public class Library implements Serializable {
|
||||
this.md5 = md5;
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
public Library(Long accountId, String level1Type, String level2Type, String level3Type, String ageGroup, String name, String url, String md5, Date createDate) {
|
||||
this.accountId = accountId;
|
||||
this.level1Type = level1Type;
|
||||
this.level2Type = level2Type;
|
||||
this.level3Type = level3Type;
|
||||
this.ageGroup = ageGroup;
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
this.md5 = md5;
|
||||
this.createDate = createDate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ public class PoseTransformation extends BaseEntity {
|
||||
|
||||
private String productImage;
|
||||
|
||||
private String lastFrameProductImage;
|
||||
|
||||
private int poseId;
|
||||
|
||||
private String gifUrl;
|
||||
@@ -37,6 +39,8 @@ public class PoseTransformation extends BaseEntity {
|
||||
|
||||
private String taskStatus;
|
||||
|
||||
private String prompt;
|
||||
|
||||
public PoseTransformation() {
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,15 @@ public class ToProductElement implements Serializable {
|
||||
@ApiModelProperty(value = "userLikeGroupId")
|
||||
private Long userLikeGroupId;
|
||||
|
||||
@ApiModelProperty(value = "项目id")
|
||||
private Long projectId;
|
||||
|
||||
@ApiModelProperty(value = "url")
|
||||
private String url;
|
||||
|
||||
// private String type;
|
||||
@ApiModelProperty(value = "首尾帧 first | last")
|
||||
private String frameType;
|
||||
|
||||
@ApiModelProperty(value = "createTime")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
||||
@@ -30,4 +30,10 @@ public interface AttributeRetrievalMapper {
|
||||
void updateStyleByFileName(String style, String fileName, String tableName);
|
||||
|
||||
String getStyleByUrl(String replace,String tableName);
|
||||
|
||||
Integer getCountByStyle(String tableName, String style);
|
||||
|
||||
String getOneSystemSketchRadom(String tableName, String style, Integer randomNum);
|
||||
|
||||
void insertSketch(AttributeRetrieval attributeRetrievalAttrDict, String tableName);
|
||||
}
|
||||
|
||||
@@ -12,10 +12,13 @@ public class PoseTransformDTO {
|
||||
@ApiModelProperty("项目id")
|
||||
private Long projectId;
|
||||
|
||||
@ApiModelProperty("图片的minio地址")
|
||||
@ApiModelProperty("图片的minio地址 | 首帧图片的minio地址")
|
||||
@NotBlank(message = "please select a product image")
|
||||
private String productImage;
|
||||
|
||||
@ApiModelProperty("尾帧图片的minio地址")
|
||||
private String lastFrameProductImage;
|
||||
|
||||
@ApiModelProperty("pose的编号")
|
||||
@NotNull(message = "please select a pose")
|
||||
private Integer poseId;
|
||||
@@ -26,9 +29,15 @@ public class PoseTransformDTO {
|
||||
@ApiModelProperty("design结果在collectionSort中的id")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty("子集中的元素作为父元素")
|
||||
@ApiModelProperty("子集中的元素作为父元素,用于重新排序")
|
||||
private Long userLikeSortId;
|
||||
|
||||
@ApiModelProperty("是否默认喜欢")
|
||||
private Boolean isDefaultLike;
|
||||
|
||||
@ApiModelProperty("动作描述")
|
||||
private String prompt;
|
||||
|
||||
@ApiModelProperty("生成模式 1.pose2video | 2.prompt2video | 3.FLFrame2video ")
|
||||
private Integer mode;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,12 @@ public class SubscriptionEmailParamsDTO {
|
||||
// 用户名
|
||||
private String username;
|
||||
|
||||
// 用户邮箱
|
||||
private String email;
|
||||
|
||||
// 国家
|
||||
private String country;
|
||||
|
||||
// t_payment_info id(每次支付对于用户来说是一笔新订单)
|
||||
private String orderId;
|
||||
|
||||
@@ -55,5 +61,5 @@ public class SubscriptionEmailParamsDTO {
|
||||
// 付款失败原因
|
||||
private String failMessage;
|
||||
|
||||
|
||||
private String days;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ public enum FemalePosition implements IEnumDisplay {
|
||||
BLOUSE("Blouse"),
|
||||
DRESS("Dress"),
|
||||
TROUSERS("Trousers"),
|
||||
SKIRT("Skirt");
|
||||
SKIRT("Skirt"),
|
||||
OTHERS("Others");
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ public enum MalePosition implements IEnumDisplay {
|
||||
|
||||
TOPS("Tops"),
|
||||
BOTTOMS("Bottoms"),
|
||||
OUTWEAR("Outwear");
|
||||
OUTWEAR("Outwear"),
|
||||
OTHERS("Others");
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ public enum Position implements IEnumDisplay {
|
||||
SKIRT("Skirt"),
|
||||
SLOGAN("Slogan"),
|
||||
LOGO("Logo"),
|
||||
PATTERN("Pattern");
|
||||
PATTERN("Pattern"),
|
||||
OTHERS("Others");
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@ public class DesignItemClothesDetailVO {
|
||||
@ApiModelProperty("对应图片minIO路径")
|
||||
private String minIOPath;
|
||||
|
||||
@ApiModelProperty("图片所属:sys, user")
|
||||
private String scope;
|
||||
|
||||
@ApiModelProperty(" 颜色 存 RGB值 中间空格分隔 比如 58 58 169")
|
||||
// private String color;
|
||||
private PantoneVO color;
|
||||
|
||||
@@ -15,6 +15,8 @@ public class PoseTransformationVO implements AllCollectionVO{
|
||||
|
||||
private String productImage;
|
||||
|
||||
private String lastFrameProductImage;
|
||||
|
||||
private String gifUrl;
|
||||
|
||||
private String videoUrl;
|
||||
@@ -38,6 +40,8 @@ public class PoseTransformationVO implements AllCollectionVO{
|
||||
|
||||
private int poseId;
|
||||
|
||||
private String prompt;
|
||||
|
||||
public PoseTransformationVO(Long id, String taskId, String gifUrl, String videoUrl, String firstFrameUrl, byte isLiked, String status) {
|
||||
this.id = id;
|
||||
this.taskId = taskId;
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.google.common.collect.Maps;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -666,32 +667,23 @@ public class PythonService {
|
||||
BigDecimal randomValue = generateRandomValue();
|
||||
boolean useSystem = randomValue.compareTo(systemScale) <= 0;
|
||||
|
||||
if (useSystem) {
|
||||
// 获取系统推荐sketch
|
||||
String categoryParam = elementVO.getModelSex().toLowerCase() + "_" + styleCategory.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, elementVO.getBrandId(), elementVO.getBrandScale());
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, styleCategory, elementVO);
|
||||
}else {
|
||||
throw new BusinessException("failed.to.obtain.system.sketch.recommendation");
|
||||
}
|
||||
}else {
|
||||
if (CollectionUtil.isNotEmpty(collectionElements)) {
|
||||
// 用过存在用户上传,则优先使用用户上传
|
||||
if (!useSystem && CollectionUtil.isNotEmpty(collectionElements)) {
|
||||
int collectionNoPinSize = collectionElements.size();
|
||||
int randomNum = RandomsUtil.randomSysFile(collectionNoPinSize);
|
||||
return coverSketchToDesignPythonItem(collectionElements.get(randomNum).getId(), collectionElements.get(randomNum), elementVO);
|
||||
}else {
|
||||
}
|
||||
|
||||
// 其他所有情况,都回退到使用系统推荐
|
||||
String categoryParam = elementVO.getModelSex().toLowerCase() + "_" + styleCategory.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, elementVO.getBrandId(), elementVO.getBrandScale());
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, styleCategory, elementVO);
|
||||
}else {
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, elementVO.getBrandId(), elementVO.getBrandScale(),elementVO.getStyle());
|
||||
|
||||
if (CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
throw new BusinessException("failed.to.obtain.system.sketch.recommendation");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, styleCategory, elementVO);
|
||||
|
||||
// int poolNum = 20;
|
||||
// if (CollectionUtil.isNotEmpty(collectionElements)) {
|
||||
@@ -1039,7 +1031,7 @@ public class PythonService {
|
||||
// 获取随机pin sketch的category
|
||||
String category = element.getLevel2Type();
|
||||
String categoryParam = validateElementVO.getModelSex().toLowerCase() + "_" + category.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, validateElementVO.getBrandId(), validateElementVO.getBrandScale());
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, validateElementVO.getBrandId(), validateElementVO.getBrandScale(), validateElementVO.getStyle());
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO);
|
||||
@@ -1062,7 +1054,7 @@ public class PythonService {
|
||||
String category = dressings.get(randomNum).getStyleCategory();
|
||||
|
||||
String categoryParam = validateElementVO.getModelSex().toLowerCase() + "_" + category.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, validateElementVO.getBrandId(), validateElementVO.getBrandScale());
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, validateElementVO.getBrandId(), validateElementVO.getBrandScale(), validateElementVO.getStyle());
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO);
|
||||
@@ -1098,7 +1090,7 @@ public class PythonService {
|
||||
String category = element.getLevel2Type();
|
||||
|
||||
String categoryParam = validateElementVO.getModelSex().toLowerCase() + "_" + category.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, validateElementVO.getBrandId(), validateElementVO.getBrandScale());
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, validateElementVO.getBrandId(), validateElementVO.getBrandScale(), validateElementVO.getStyle());
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO);
|
||||
@@ -1122,7 +1114,7 @@ public class PythonService {
|
||||
String category = dressings.get(randomNum).getStyleCategory();
|
||||
|
||||
String categoryParam = validateElementVO.getModelSex().toLowerCase() + "_" + category.toLowerCase();
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, validateElementVO.getBrandId(), validateElementVO.getBrandScale());
|
||||
List<String> recommentdUrlList = getSystemSketchByCategory(categoryParam, validateElementVO.getBrandId(), validateElementVO.getBrandScale(), validateElementVO.getStyle());
|
||||
if (!CollectionUtils.isEmpty(recommentdUrlList)) {
|
||||
String recommendSystemSketch = recommentdUrlList.get(0);
|
||||
return coverSystemSketchUrlToDesignPythonItem(recommendSystemSketch, category, validateElementVO);
|
||||
@@ -3962,7 +3954,30 @@ public class PythonService {
|
||||
throw new BusinessException("design.interface.exception");
|
||||
}
|
||||
|
||||
public List<String> getSystemSketchByCategory(String category, Long brandId, Double brandScale) {
|
||||
public List<String> getSystemSketchByCategory(String category, Long brandId, Double brandScale,String style) {
|
||||
//******3.1.2版本临时使用java推荐方案去解决style未使用的问题**********
|
||||
try {
|
||||
//使用新库attribute_retrieval_style,表命名修改为elementVO.getModelSex().toLowerCase() + "_" + styleCategory.toLowerCase()比如female_skirt,与传入的category保持一致
|
||||
Integer countByStyle = attributeRetrievalMapper.getCountByStyle(category, style);
|
||||
//根据数量随机获取一个系统sketch
|
||||
if (countByStyle > 0) {
|
||||
//获取一个不大于countByStyle的随机整数
|
||||
Integer randomNum = RandomUtils.nextInt(0, countByStyle);
|
||||
//返回格式为 dress/0902000649.jpg
|
||||
String oneSystemSketchRadom = attributeRetrievalMapper.getOneSystemSketchRadom(category, style,randomNum);
|
||||
String imgName = oneSystemSketchRadom.split("/")[1];
|
||||
//补齐正确格式aida-sys-image/images/male/tops/mens_test_5689.png
|
||||
//裁切category前半部分
|
||||
String sex = category.split("_")[0];
|
||||
String realCategory = category.split("_")[1];
|
||||
String path = "aida-sys-image/images/" + sex + "/" +realCategory +"/" +imgName;
|
||||
return Arrays.asList(path);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("推荐失败:{}",e.getMessage());
|
||||
throw new BusinessException("system.error");
|
||||
}
|
||||
//**********************end***********************************
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
@@ -4078,7 +4093,7 @@ public class PythonService {
|
||||
//生成失败
|
||||
throw new BusinessException("segProduct.interface.exception");
|
||||
}
|
||||
public Boolean poseTransformation(String productImage, int poseId, String taskId) {
|
||||
public Boolean poseTransformation(JSONObject content, String apiUri) {
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)
|
||||
@@ -4086,15 +4101,11 @@ public class PythonService {
|
||||
.writeTimeout(60, TimeUnit.SECONDS)//写入超时(单位:秒)
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
Map<String, String> content = Maps.newHashMap();
|
||||
content.put("image_url", productImage);
|
||||
content.put("tasks_id", taskId);
|
||||
content.put("pose_id", String.valueOf(poseId));
|
||||
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
|
||||
|
||||
log.info("poseTransformation 请求地址: {}", accessPythonIp + ":" + accessPythonPort + "/api/pose_transform");
|
||||
log.info("poseTransformation 请求地址: {}", accessPythonIp + ":" + accessPythonPort + apiUri);
|
||||
Request request = new Request.Builder()
|
||||
.url(accessPythonIp + ":" + accessPythonPort + "/api/pose_transform")
|
||||
.url(accessPythonIp + ":" + accessPythonPort + apiUri)
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
|
||||
@@ -105,6 +105,9 @@ public class DesignPythonItem {
|
||||
public static List<String> BOTTOMS = Arrays.asList(
|
||||
"Bottoms");
|
||||
|
||||
public static List<String> OTHERS = Arrays.asList(
|
||||
"Others");
|
||||
|
||||
public static List<String> SYS_HAIRSTYLE_SHOES_BODY = Arrays.asList(
|
||||
SysFileLevel2TypeEnum.HAIRSTYLE.getRealName(), SysFileLevel2TypeEnum.SHOES.getRealName(),
|
||||
SysFileLevel2TypeEnum.EARRINGS.getRealName(), SysFileLevel2TypeEnum.BODY.getRealName());
|
||||
|
||||
@@ -24,7 +24,7 @@ public interface AffiliateService extends IService<Affiliate> {
|
||||
|
||||
Boolean applicationApproval(Long id, Boolean isApproved, Float commission);
|
||||
|
||||
void updateCommissionPercentage(Long id, Float commission);
|
||||
void editAffiliate(Long id, Float commission, String operationType);
|
||||
|
||||
void updateAffiliateInfoWithPayment();
|
||||
|
||||
|
||||
@@ -25,4 +25,6 @@ public interface DesignItemDetailService extends IService<DesignItemDetail> {
|
||||
void saveDesignItemDetailCanvas(Long designItemDetailId, Long exportFileId);
|
||||
|
||||
DesignItemDetailCanvas getDIDCByDesignItemDetailId(Long designItemDetailId);
|
||||
|
||||
void updateDetailPathById(Long id, String path);
|
||||
}
|
||||
|
||||
@@ -95,10 +95,6 @@ public interface DesignService extends IService<Design> {
|
||||
|
||||
Integer designProcess(String processId);
|
||||
|
||||
void parseMoodboardPosition(String moodboardPosition, Long collectionIdParam);
|
||||
|
||||
void relationImageId(DesignPythonObjects objects);
|
||||
|
||||
List<CollectionSketchVO> sketchesBoundingBox(ReDesignCollectionDTO reDesignCollectionDTO);
|
||||
|
||||
List<String> getModel(List<Long> designItemIdList);
|
||||
|
||||
@@ -57,6 +57,10 @@ public interface GenerateService extends IService<Generate> {
|
||||
|
||||
void processPoseTransformResult(String taskId, String gifUrl, String videoUrl, String imageUrl);
|
||||
|
||||
void processPTFailSituation(String taskId);
|
||||
|
||||
void sendSysMsgForPT(PoseTransformation poseTransformation);
|
||||
|
||||
List<PoseTransformationVO> getPoseTransformationResult(List<String> taskIdList, Long projectId, Boolean like);
|
||||
|
||||
void updatePoseTransferStatus(String taskId, String status, PoseTransformation poseTransformation);
|
||||
|
||||
@@ -98,4 +98,6 @@ public interface LibraryService extends IService<Library> {
|
||||
PageBaseResponse<Library> getPublicLib(String order, long page, long size);
|
||||
|
||||
PageBaseResponse<Library> getAllSubAccLib(String order, long page, long size);
|
||||
|
||||
String addSysSketchToLibrary(Long clothId, String path);
|
||||
}
|
||||
|
||||
@@ -27,4 +27,6 @@ public interface MessageCenterService extends IService<Notification> {
|
||||
void setReadAll(String type);
|
||||
|
||||
void publishSystemNotification(PublishSysNotificationDTO message);
|
||||
|
||||
void videoFinishedMsg(Long userId, String projectName, boolean isSuccess);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.MoodboardPosition;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface MoodboardPositionService extends IService<MoodboardPosition> {
|
||||
|
||||
void parseMoodboardPosition(String moodboardPosition, Long collectionIdParam);
|
||||
}
|
||||
@@ -47,20 +47,8 @@ public interface PortfolioService extends IService<Portfolio> {
|
||||
|
||||
void cancelFollow(Long followeeId);
|
||||
|
||||
Long getFolloweeCount(Long accountId);
|
||||
|
||||
List<AccountFollowVO> getFolloweeList(GetFollowListDTO getFollowListDTO);
|
||||
|
||||
Long getFollowerCount(Long accountId);
|
||||
|
||||
List<AccountFollowVO> getFollowerList(GetFollowListDTO getFollowListDTO);
|
||||
|
||||
Integer getIfFollowed(Long followeeId, Long followerId);
|
||||
|
||||
Long getPortfolioCount(Long accountId);
|
||||
|
||||
List<Long> getFolloweeList(Long accountId);
|
||||
|
||||
// List<PortfolioVO> queryPortfolioByTag(String tagName, Long tagId);
|
||||
|
||||
void setPortfolioToPublic(Long portfolioId);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ai.da.service;
|
||||
|
||||
|
||||
import com.ai.da.mapper.primary.entity.PythonTAllInfo;
|
||||
import com.ai.da.python.vo.DesignPythonObjects;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
@@ -14,4 +15,6 @@ public interface PythonTAllInfoService extends IService<PythonTAllInfo> {
|
||||
|
||||
|
||||
Long getImageIdByPath(String path);
|
||||
|
||||
void relationImageId(DesignPythonObjects pythonObjects);
|
||||
}
|
||||
|
||||
@@ -35,11 +35,15 @@ public interface StripeService {
|
||||
|
||||
Map<String, String> getPaymentMethod(String paymentMethodId);
|
||||
|
||||
boolean sendEmail(String subscriptionId, String type, String orderNo);
|
||||
|
||||
String getLanguage(String language, String country, String type);
|
||||
|
||||
/*void updateSubscription(String subscriptionId);
|
||||
|
||||
void resume(String subscriptionId);*/
|
||||
|
||||
void subscriptionReminder();
|
||||
// void subscriptionReminder();
|
||||
|
||||
void checkSubscriptionExpiration();
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.ToProductImageResult;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface ToProductImageResultService extends IService<ToProductImageResult> {
|
||||
|
||||
Long getUnlikedResultParentId(ToProductImageResult toProductImageResult, String url);
|
||||
}
|
||||
24
src/main/java/com/ai/da/service/UserFollowService.java
Normal file
24
src/main/java/com/ai/da/service/UserFollowService.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.UserFollow;
|
||||
import com.ai.da.model.dto.GetFollowListDTO;
|
||||
import com.ai.da.model.vo.AccountFollowVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserFollowService extends IService<UserFollow> {
|
||||
|
||||
Long getFollowerCount(Long accountId);
|
||||
|
||||
List<AccountFollowVO> getFollowerList(GetFollowListDTO getFollowListDTO);
|
||||
|
||||
Long getFolloweeCount(Long accountId);
|
||||
|
||||
List<AccountFollowVO> getFolloweeList(GetFollowListDTO getFollowListDTO);
|
||||
|
||||
Integer getIfFollowed(Long followeeId, Long followerId);
|
||||
|
||||
List<Long> getFolloweeList(Long accountId);
|
||||
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
||||
|
||||
void toProduct(String taskId);
|
||||
|
||||
ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId);
|
||||
ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId, String type);
|
||||
|
||||
CollectionSort productImageLike(ProductImageLikeDTO productImageLikeDTO);
|
||||
|
||||
@@ -121,6 +121,4 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
||||
Boolean toProductImageElementDelete(Long id);
|
||||
|
||||
ToProductElementVO convertRelightElement(Long id);
|
||||
|
||||
Long getUnlikedResultParentId(ToProductImageResult toProductImageResult, String url);
|
||||
}
|
||||
|
||||
@@ -68,4 +68,8 @@ public interface WorkspaceService extends IService<Workspace> {
|
||||
|
||||
|
||||
String getProjectSexById(Long projectId);
|
||||
|
||||
String getStyleByProjectId(Long projectId);
|
||||
|
||||
String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId);
|
||||
}
|
||||
|
||||
@@ -143,6 +143,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Resource
|
||||
private AffiliateService affiliateService;
|
||||
|
||||
@Resource
|
||||
private UserFollowService userFollowService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AccountPreLoginVO preLogin(AccountPreLoginDTO accountDTO) {
|
||||
@@ -261,8 +264,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
avatar = account.getAvatar();
|
||||
}
|
||||
response.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
response.setFolloweeCount(portfolioService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(portfolioService.getFollowerCount(account.getId()));
|
||||
response.setFolloweeCount(userFollowService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(userFollowService.getFollowerCount(account.getId()));
|
||||
//判断是否常用ip 不是则发邮件提示
|
||||
calculateExceptionIp(RequestInfoUtil.getIpAddress(request), account);
|
||||
return response;
|
||||
@@ -2050,8 +2053,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
personalHomepageVO.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
|
||||
personalHomepageVO.setPortfolioCount(portfolioService.getPortfolioCount(accountId));
|
||||
personalHomepageVO.setFolloweeCount(portfolioService.getFolloweeCount(accountId));
|
||||
personalHomepageVO.setFollowerCount(portfolioService.getFollowerCount(accountId));
|
||||
personalHomepageVO.setFolloweeCount(userFollowService.getFolloweeCount(accountId));
|
||||
personalHomepageVO.setFollowerCount(userFollowService.getFollowerCount(accountId));
|
||||
personalHomepageVO.setHomepageViewCount(viewPersonalHomepageCount(0L));
|
||||
|
||||
|
||||
@@ -2061,7 +2064,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
// 只有本人才能看到个人主页浏览量
|
||||
personalHomepageVO.setHomepageViewCount(viewCount == null ? 0 : viewCount);
|
||||
} else {
|
||||
personalHomepageVO.setIsFollow(portfolioService.getIfFollowed(accountId, currentUserId));
|
||||
personalHomepageVO.setIsFollow(userFollowService.getIfFollowed(accountId, currentUserId));
|
||||
// 非本人浏览主页时增加浏览量
|
||||
viewsIncrease(accountId);
|
||||
}
|
||||
@@ -2925,8 +2928,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
avatar = account.getAvatar();
|
||||
}
|
||||
response.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
response.setFolloweeCount(portfolioService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(portfolioService.getFollowerCount(account.getId()));
|
||||
response.setFolloweeCount(userFollowService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(userFollowService.getFollowerCount(account.getId()));
|
||||
return response;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid ID token.");
|
||||
@@ -3030,8 +3033,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
avatar = account.getAvatar();
|
||||
}
|
||||
response.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
response.setFolloweeCount(portfolioService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(portfolioService.getFollowerCount(account.getId()));
|
||||
response.setFolloweeCount(userFollowService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(userFollowService.getFollowerCount(account.getId()));
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -3122,8 +3125,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
avatar = account.getAvatar();
|
||||
}
|
||||
response.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
response.setFolloweeCount(portfolioService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(portfolioService.getFollowerCount(account.getId()));
|
||||
response.setFolloweeCount(userFollowService.getFolloweeCount(account.getId()));
|
||||
response.setFollowerCount(userFollowService.getFollowerCount(account.getId()));
|
||||
|
||||
QueryWrapper<AccountExtend> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(AccountExtend::getAccountId, response.getUserId());
|
||||
|
||||
@@ -200,7 +200,7 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateCommissionPercentage(Long id, Float commission){
|
||||
public void editAffiliate(Long id, Float commission, String operationType){
|
||||
Affiliate affiliate = baseMapper.selectById(id);
|
||||
if (Objects.isNull(affiliate)){
|
||||
log.info("未知affiliate id :{}", id);
|
||||
@@ -208,8 +208,21 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
|
||||
}
|
||||
if (!Objects.equals(affiliate.getCommissionPercent(), commission)){
|
||||
affiliate.setCommissionPercent(commission);
|
||||
}
|
||||
|
||||
// operationType Active -> 激活 | Inactive -> 关闭 | Delete -> 删除
|
||||
if (!StringUtil.isNullOrEmpty(operationType)) {
|
||||
if (operationType.equals("Delete") || operationType.equals("Active") || operationType.equals("Inactive")) {
|
||||
affiliate.setStatus(operationType);
|
||||
} else {
|
||||
throw new BusinessException("unknown.operationType");
|
||||
}
|
||||
}
|
||||
affiliate.setUpdateTime(LocalDateTime.now());
|
||||
baseMapper.updateById(affiliate);
|
||||
|
||||
if (operationType.equals("Delete")) {
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,5 +567,4 @@ public class AffiliateServiceImpl extends ServiceImpl<AffiliateMapper, Affiliate
|
||||
coupon.setUnpaidCommission(unpaidCommission);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -59,30 +59,20 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementMapper, CollectionElement> implements CollectionElementService {
|
||||
@Resource
|
||||
private CollectionElementMapper collectionElementMapper;
|
||||
@Resource
|
||||
private FileProperties fileProperties;
|
||||
@Resource
|
||||
private PanToneService panToneService;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private SysFileService sysFileService;
|
||||
@Resource
|
||||
private GenerateMapper generateMapper;
|
||||
@Resource
|
||||
private GenerateDetailMapper generateDetailMapper;
|
||||
@Resource
|
||||
private LibraryModelPointService libraryModelPointService;
|
||||
@Resource
|
||||
private TCollectionElementRelationService tCollectionElementRelationService;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
private WorkspaceService workspaceService;
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final EmailService emailService;
|
||||
private final FileProperties fileProperties;
|
||||
private final GenerateMapper generateMapper;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
private final LibraryModelPointService libraryModelPointService;
|
||||
private final LibraryService libraryService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final PanToneService panToneService;
|
||||
private final PythonService pythonService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final SysFileService sysFileService;
|
||||
private final TCollectionElementRelationService tCollectionElementRelationService;
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
@Value("${minio.bucketName.collectionElement}")
|
||||
private String collectionElement;
|
||||
@@ -90,13 +80,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
private String gradientBucketName;
|
||||
@Value("${minio.bucketName.users}")
|
||||
private String userBucketName;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
// @Resource
|
||||
// private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private EmailService emailService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
@@ -358,6 +342,16 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
if (CollectionUtils.isEmpty(elements)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
// 根据MD5去重:保留第一个出现的元素,其余重复MD5的丢弃
|
||||
elements = elements.stream()
|
||||
.collect(Collectors.collectingAndThen(
|
||||
Collectors.toMap(
|
||||
CollectionElement::getMd5,
|
||||
e -> e,
|
||||
(e1, e2) -> e1 // 冲突时保留第一个
|
||||
),
|
||||
map -> new ArrayList<>(map.values())
|
||||
));
|
||||
//获取已存在相同的library
|
||||
List<String> md5List = elements.stream().map(CollectionElement::getMd5).collect(Collectors.toList());
|
||||
List<Library> existsLibrarys = libraryService.getByMD5List(md5List);
|
||||
@@ -644,7 +638,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
if (result) {
|
||||
throw new BusinessException("sketchBoards.designType.cannot.be.empty");
|
||||
}
|
||||
|
||||
List<CollectionElement> sketchBoardElements = new ArrayList<>();
|
||||
// 提取类型为COLLECTION的sketchBoard ID列表
|
||||
List<Long> sketchBoardIds = designDTO.getSketchBoards().stream()
|
||||
.filter(f -> f.getDesignType().equals(DesignTypeEnum.COLLECTION.getRealName()))
|
||||
@@ -652,12 +646,12 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
.collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(sketchBoardIds)) {
|
||||
// 从数据库查询验证sketchBoard元素是否存在
|
||||
List<CollectionElement> sketchBoardElements = collectionElementMapper.selectBatchIds(sketchBoardIds);
|
||||
sketchBoardElements = collectionElementMapper.selectBatchIds(sketchBoardIds);
|
||||
|
||||
if (CollectionUtil.isEmpty(sketchBoardElements) || sketchBoardElements.size() != sketchBoardIds.size()) {
|
||||
throw new BusinessException("get.sketchBoards.data.is.mismatch");
|
||||
}
|
||||
// 设置验证通过的sketchBoard元素到结果对象
|
||||
elementVO.setSketchBoardElements(sketchBoardElements);
|
||||
|
||||
// 记录已使用的元素ID
|
||||
usedElementIds.addAll(sketchBoardIds);
|
||||
}
|
||||
@@ -675,7 +669,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
Map<Long, CollectionSketchDTO> idToMap = designDTO.getSketchBoards()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(CollectionSketchDTO::getSketchBoardId, v -> v));
|
||||
libraryCollectionElements.addAll(covertLibrarysToCollections(librarys, idToMap));
|
||||
List<CollectionElement> librarysToCollections = covertLibrarysToCollections(librarys, idToMap);
|
||||
libraryCollectionElements.addAll(librarysToCollections);
|
||||
sketchBoardElements.addAll(librarysToCollections);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -691,9 +687,13 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
Map<Long, CollectionSketchDTO> idToMap = designDTO.getSketchBoards()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(CollectionSketchDTO::getSketchBoardId, v -> v));
|
||||
generateCollectionElements.addAll(covertGeneratesToCollections(generateDetailList, idToMap));
|
||||
List<CollectionElement> generatesToCollections = covertGeneratesToCollections(generateDetailList, idToMap);
|
||||
generateCollectionElements.addAll(generatesToCollections);
|
||||
sketchBoardElements.addAll(generatesToCollections);
|
||||
}
|
||||
}
|
||||
// 设置验证通过的sketchBoard元素到结果对象
|
||||
elementVO.setSketchBoardElements(sketchBoardElements);
|
||||
}
|
||||
}
|
||||
//校验marketingSketch
|
||||
@@ -796,7 +796,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
SysFileVO byId = sysFileService.getById(designDTO.getTemplateId());
|
||||
// 设置女性模特的风格类型
|
||||
if (Objects.nonNull(byId) && !StringUtils.isEmpty(byId.getLevel3Type()) && byId.getLevel2Type().equals("Female")) {
|
||||
elementVO.setStyle(byId.getLevel3Type());
|
||||
// elementVO.setStyle(byId.getLevel3Type());
|
||||
}
|
||||
LibraryModelPoint modelPoint = libraryModelPointService.getByRelationId(byId.getId(), designDTO.getModelType());
|
||||
elementVO.setDesignLibraryModelPoint(calculateTemplatePointTemplate(modelPoint, 700, 320, byId.getUrl()));
|
||||
@@ -821,6 +821,10 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
elementVO.setBrandScale(designDTO.getBrandScale()); // 设置品牌比例
|
||||
}
|
||||
|
||||
//设置风格
|
||||
String style = workspaceService.getStyleByProjectId(designDTO.getProjectId());
|
||||
elementVO.setStyle(style);
|
||||
|
||||
// 返回验证结果对象
|
||||
return elementVO;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
@Resource
|
||||
private AccountLoginLogService accountLoginLogService;
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
private GenerateMapper generateMapper;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
@@ -452,7 +452,8 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
Long singleDesignTimes = designItemService.getCountByUserAndTime(startTime, endTime, ids);
|
||||
|
||||
// generate -> MoodBoard\PrintBoard\SketchBoard
|
||||
List<Map<String, Object>> countGenerate = generateService.getCountByUserAndTime(startTime, endTime, ids);
|
||||
// List<Map<String, Object>> countGenerate = generateService.getCountByUserAndTime(startTime, endTime, ids);
|
||||
List<Map<String, Object>> countGenerate = generateMapper.getByTypeAndTime(startTime, endTime, ids);
|
||||
// 使用Stream API和lambda表达式将数据合并到一个Map中
|
||||
Map<String, Long> countGenerateMerge = countGenerate.stream()
|
||||
.collect(Collectors.toMap(
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -130,4 +131,16 @@ public class DesignItemDetailServiceImpl extends ServiceImpl<DesignItemDetailMap
|
||||
|
||||
return designItemDetailCanvasMapper.selectOne(qw);
|
||||
}
|
||||
|
||||
public void updateDetailPathById(Long id, String path) {
|
||||
if (Objects.nonNull(id)) {
|
||||
DesignItemDetail designItemDetail = baseMapper.selectById(id);
|
||||
if (Objects.nonNull(designItemDetail)) {
|
||||
designItemDetail.setPath(path);
|
||||
designItemDetail.setUpdateDate(new Date());
|
||||
|
||||
baseMapper.updateById(designItemDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.ai.da.common.enums.SingleOverallEnum;
|
||||
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.primary.DesignItemMapper;
|
||||
import com.ai.da.mapper.primary.DesignMapper;
|
||||
import com.ai.da.mapper.primary.UserLikeMapper;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.*;
|
||||
@@ -27,6 +28,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.SerializationUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -55,37 +57,25 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignItem> implements DesignItemService {
|
||||
@Resource
|
||||
private DesignItemMapper designItemMapper;
|
||||
@Resource
|
||||
private SysFileService sysFileService;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
@Resource
|
||||
private DesignItemDetailService designItemDetailService;
|
||||
@Resource
|
||||
private LibraryModelPointService libraryModelPointService;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private CollectionElementService collectionElementService;
|
||||
@Resource
|
||||
private ITDesignPythonOutfitService designPythonOutfitService;
|
||||
@Resource
|
||||
private ITDesignPythonOutfitDetailService designPythonOutfitDetailService;
|
||||
@Resource
|
||||
private PanToneService panToneService;
|
||||
@Resource
|
||||
private DesignItemDetailPrintService designItemDetailPrintService;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
@Resource
|
||||
private UserLikeService userLikeService;
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
|
||||
private final CollectionElementService collectionElementService;
|
||||
private final DesignMapper designMapper;
|
||||
private final DesignItemMapper designItemMapper;
|
||||
private final DesignItemDetailService designItemDetailService;
|
||||
private final DesignItemDetailPrintService designItemDetailPrintService;
|
||||
private final ITDesignPythonOutfitService designPythonOutfitService;
|
||||
private final ITDesignPythonOutfitDetailService designPythonOutfitDetailService;
|
||||
private final LibraryService libraryService;
|
||||
private final LibraryModelPointService libraryModelPointService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final PythonService pythonService;
|
||||
private final PanToneService panToneService;
|
||||
private final SysFileService sysFileService;
|
||||
private final UserLikeService userLikeService;
|
||||
private final UserLikeGroupService userLikeGroupService;
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
@Value("${minio.bucketName.modifiedSketch}")
|
||||
private String modifiedSketchBucket;
|
||||
@@ -196,7 +186,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
Design design = designService.getById(designItem.getDesignId());
|
||||
Design design = designMapper.selectById(designItem.getDesignId());
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
@@ -246,7 +236,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
Design design = designService.getById(designItem.getDesignId());
|
||||
Design design = designMapper.selectById(designItem.getDesignId());
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
@@ -283,6 +273,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// todo check这个方法是否还在用
|
||||
private DesignCollectionItemVO saveSingleDesignItemAndDetail(DesignPythonObjects pythonObjects
|
||||
, Long designId, Long designItemId, Long collectionId, AuthPrincipalVo userInfo, String timeZone) {
|
||||
@@ -501,7 +492,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
if (Objects.isNull(designItem)) {
|
||||
throw new BusinessException("designItem.not.found");
|
||||
}
|
||||
Design design = designService.getById(designItem.getDesignId());
|
||||
Design design = designMapper.selectById(designItem.getDesignId());
|
||||
if (Objects.isNull(design)) {
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
@@ -573,7 +564,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
// 画笔修改的sketch截图 上传后替换path
|
||||
// 由于用户在系统或自己上传sketch的基础上修改过的衣服,再次修改后,第一次修改的衣服不会回到某个池子被再次利用,
|
||||
// 所以,这里选择使用system或collection相同的地址,只是放在不同的桶,这样能保证图片服务器上,类似的sketch不会存在很多
|
||||
sketchBase64ToPath(designSingleIncludeLayersDTO);
|
||||
sketchBase64ToPath(designSingleIncludeLayersDTO, userId);
|
||||
|
||||
// 将标注后的mask上传到minio,并将minio地址传给python端
|
||||
// todo 如果当前design使用的仍是旧的mask 则置maskUrl为null
|
||||
@@ -653,7 +644,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
return selectById(designItemId); // 普通查询,不加锁
|
||||
}
|
||||
|
||||
private void sketchBase64ToPath(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO){
|
||||
private void sketchBase64ToPath(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO, Long userId) {
|
||||
designSingleIncludeLayersDTO.getDesignSingleItemDTOList().forEach(item -> {
|
||||
// 如果sketch截图不为空,则将该截图上传,并替换path
|
||||
if (!StringUtil.isNullOrEmpty(item.getSketchString())) {
|
||||
@@ -661,7 +652,14 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
throw new BusinessException("path.cannot.be.empty");
|
||||
}
|
||||
String sourcePath = item.getPath();
|
||||
String path = sourcePath.substring(sourcePath.indexOf("/") + 1, sourcePath.lastIndexOf("."));
|
||||
String path = sourcePath.substring(sourcePath.lastIndexOf("/") + 1, sourcePath.lastIndexOf("."));
|
||||
// 路径组成:用户id + sketchboard + temp | modified + 原图所在不同桶的原路径
|
||||
if (designSingleIncludeLayersDTO.getIsPreview()) {
|
||||
path = userId + "/sketchboard/temp/" + path;
|
||||
} else {
|
||||
path = userId + "/sketchboard/modified/" + path;
|
||||
}
|
||||
|
||||
// 将原图地址作为修改后的图片地址,放在不同的桶
|
||||
String newPath = minioUtil.base64UploadToPath(item.getSketchString(), modifiedSketchBucket, path);
|
||||
if (StringUtil.isNullOrEmpty(newPath)) {
|
||||
@@ -737,7 +735,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
JSONObject jsonObject = layers.getJSONObject(i);
|
||||
String priority = jsonObject.getString("priority");
|
||||
String category = jsonObject.getString("image_category").split("_")[0];
|
||||
if (!category.equals("body") && !priorityAndLayer.containsKey(priority)) priorityAndLayer.put(priority, Arrays.asList(jsonObject.getString("pattern_overall_image_url"), jsonObject.getString("pattern_print_image_url")));
|
||||
if (!category.equals("body") && !priorityAndLayer.containsKey(priority))
|
||||
priorityAndLayer.put(priority, Arrays.asList(jsonObject.getString("pattern_overall_image_url"), jsonObject.getString("pattern_print_image_url")));
|
||||
}
|
||||
return priorityAndLayer;
|
||||
}
|
||||
@@ -749,7 +748,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
for (int i = 0; i < layers.size(); i++) {
|
||||
JSONObject jsonObject = layers.getJSONObject(i);
|
||||
String category = jsonObject.getString("image_category").split("_")[0];
|
||||
if (!category.equals("body") && !typeAndLayer.containsKey(category)) typeAndLayer.put(category, jsonObject.getString("pattern_image_url"));
|
||||
if (!category.equals("body") && !typeAndLayer.containsKey(category))
|
||||
typeAndLayer.put(category, jsonObject.getString("pattern_image_url"));
|
||||
}
|
||||
return typeAndLayer;
|
||||
}
|
||||
@@ -839,6 +839,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
userLikeGroupService.updateDate(userLikeGroupId, timeZone);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUserLikeConvertStatus(Long designItemId, String timeZone) {
|
||||
UserLike userLike = userLikeService.getByDesignItemId(designItemId);
|
||||
if (!ObjectUtil.isEmpty(userLike) && userLike.getConverted() == 0) {
|
||||
@@ -879,7 +880,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
// 重置sketch的minio临时访问凭证
|
||||
designItemClothesDetailVO.setPath(minioUtil.getPreSignedUrl(singleItem.getPath(), 24 * 60, true));
|
||||
designItemClothesDetailVO.setMinIOPath(singleItem.getPath());
|
||||
if (!StringUtil.isNullOrEmpty(singleItem.getColor())) designItemClothesDetailVO.setColor(panToneService.getPantoneByRgb(singleItem.getColor()));
|
||||
if (!StringUtil.isNullOrEmpty(singleItem.getColor()))
|
||||
designItemClothesDetailVO.setColor(panToneService.getPantoneByRgb(singleItem.getColor()));
|
||||
designItemClothesDetailVO.setPrintObject(singleItem.getPrintObject());
|
||||
designItemClothesDetailVO.setTrims(singleItem.getTrims());
|
||||
designItemClothesDetailVO.setLayersObject(layersObject.stream().filter(
|
||||
@@ -1025,6 +1027,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
library.setLevel1Type(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
|
||||
library.setLevel2Type(designSingleItem.getType());
|
||||
library.setLevel3Type(designSingleIncludeLayersDTO.getGender());
|
||||
String ageGroup = workspaceService.getAgeGroupByProjectOrCollectionId(designSingleIncludeLayersDTO.getProjectId(), null);
|
||||
library.setAgeGroup(ageGroup);
|
||||
library.setUrl(designSingleItem.getPath());
|
||||
library.setName(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||
library.setMd5(md5);
|
||||
@@ -1090,6 +1094,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
|
||||
@Override
|
||||
public void convertHistoryMaskWithoutGradient() {
|
||||
// 1、获取全部需要转换的designOutfitId
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -61,56 +62,47 @@ import static com.ai.da.python.vo.DesignPythonItem.*;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> implements DesignService {
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
@Resource
|
||||
private CollectionElementService collectionElementService;
|
||||
@Resource
|
||||
private CollectionService collectionService;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private GenerateDetailMapper generateDetailMapper;
|
||||
@Resource
|
||||
private DesignItemService designItemService;
|
||||
@Resource
|
||||
private DesignItemDetailService designItemDetailService;
|
||||
@Resource
|
||||
private FileProperties fileProperties;
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
@Resource
|
||||
private UserLikeService userLikeService;
|
||||
@Resource
|
||||
private SysFileService sysFileService;
|
||||
@Resource
|
||||
private TCollectionElementRelationService tCollectionElementRelationService;
|
||||
@Resource
|
||||
private ITDesignPythonOutfitService designPythonOutfitService;
|
||||
@Resource
|
||||
private ITDesignPythonOutfitDetailService designPythonOutfitDetailService;
|
||||
@Resource
|
||||
private PanToneService panToneService;
|
||||
@Resource
|
||||
private PythonTAllInfoService pythonTAllInfoService;
|
||||
@Resource
|
||||
private DesignItemDetailPrintService designItemDetailPrintService;
|
||||
|
||||
@Resource
|
||||
private TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
@Resource
|
||||
private DesignItemDetailMapper designItemDetailMapper;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
private ToProductElementMapper toProductElementMapper;
|
||||
@Resource
|
||||
private MoodboardPositionMapper moodboardPositionMapper;
|
||||
@Resource
|
||||
private CollectionSortService collectionSortService;
|
||||
private final CloudTaskMapper cloudTaskMapper;
|
||||
private final CloudTaskService cloudTaskService;
|
||||
private final CreditsService creditsService;
|
||||
private final CollectionElementService collectionElementService;
|
||||
private final CollectionService collectionService;
|
||||
private final CollectionSortService collectionSortService;
|
||||
private final ColorLoopUpTableService colorLoopUpTableService;
|
||||
private final CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
private final DesignBatchMapper designBatchMapper;
|
||||
private final DesignMapper designMapper;
|
||||
private final DesignItemService designItemService;
|
||||
private final DesignItemDetailMapper designItemDetailMapper;
|
||||
private final DesignItemDetailService designItemDetailService;
|
||||
private final DesignItemDetailPrintService designItemDetailPrintService;
|
||||
private final TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
private final ITDesignPythonOutfitService designPythonOutfitService;
|
||||
private final ITDesignPythonOutfitDetailService designPythonOutfitDetailService;
|
||||
private final FileProperties fileProperties;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
private final LibraryService libraryService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final MoodboardPositionMapper moodboardPositionMapper;
|
||||
private final ProjectService projectService;
|
||||
private final PythonService pythonService;
|
||||
private final PanToneMapper panToneMapper;
|
||||
private final PanToneService panToneService;
|
||||
private final PoseTransformationMapper poseTransformationMapper;
|
||||
private final PythonTAllInfoService pythonTAllInfoService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final SysFileService sysFileService;
|
||||
private final TCollectionElementRelationService tCollectionElementRelationService;
|
||||
private final ToProductImageResultMapper toProductImageResultMapper;
|
||||
private final ToProductElementMapper toProductElementMapper;
|
||||
private final ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
private final UserLikeGroupService userLikeGroupService;
|
||||
private final UserLikeService userLikeService;
|
||||
private final UserBehaviorMapper userBehaviorMapper;
|
||||
private final UserPreferenceLogMapper userPreferenceLogMapper;
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
@Value("${minio.endpoint}")
|
||||
private String endpoint;
|
||||
@@ -123,34 +115,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
@Value("${access.python.port:''}")
|
||||
private String accessPythonPort;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private PoseTransformationMapper poseTransformationMapper;
|
||||
|
||||
@Resource
|
||||
private DesignBatchMapper designBatchMapper;
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
@Resource
|
||||
private CloudTaskMapper cloudTaskMapper;
|
||||
@Resource
|
||||
private CloudTaskService cloudTaskService;
|
||||
@Resource
|
||||
private CreditsService creditsService;
|
||||
@Resource
|
||||
private ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
@Resource
|
||||
private ColorLoopUpTableService colorLoopUpTableService;
|
||||
@Resource
|
||||
private UserBehaviorMapper userBehaviorMapper;
|
||||
@Resource
|
||||
private UserPreferenceLogMapper userPreferenceLogMapper;
|
||||
@Resource
|
||||
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
|
||||
private final ConcurrentHashMap<String, Map<String, Object>> designContext = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@@ -323,11 +287,11 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
// List<Long> reLationelementIds = reLationelements.stream().map(CollectionElement::getId).collect(Collectors.toList());
|
||||
// handleCollectionElementRelation(collectionId, (null == collectionIdParam) ? false : true, reLationelementIds);
|
||||
// //保存python返回信息
|
||||
|
||||
/// / return savePythonDesignItemAndDetail(pythonObjects,designId,collectionId,userInfo,designDTO.getTimeZone(),responseJSONObject);
|
||||
// //保存designItem 和detail
|
||||
// return saveDesignItemAndDetail(pythonObjects, designId, collectionId, userInfo, designDTO.getTimeZone());
|
||||
// }
|
||||
|
||||
private String designOrRedesignOperateNew(DesignCollectionDTO designDTO, AuthPrincipalVo userInfo,
|
||||
Long collectionIdParam, ValidateElementVO elementVO) {
|
||||
// if (CollectionUtil.isNotEmpty(designDTO.getSketchBoards())) {
|
||||
@@ -388,7 +352,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
|
||||
// 生成library - 根据设计元素生成设计库信息
|
||||
startTime = System.currentTimeMillis();
|
||||
String ageGroup = getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId);
|
||||
String ageGroup = workspaceService.getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId);
|
||||
generateLibrary(elementVO, designDTO.getTimeZone(), ageGroup);
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
// List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
@@ -419,124 +383,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
return requestId;
|
||||
}
|
||||
|
||||
private String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId){
|
||||
if (Objects.nonNull(projectId)){
|
||||
Workspace workspace = workspaceService.getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){
|
||||
return workspace.getAgeGroup();
|
||||
}
|
||||
} else if (Objects.nonNull(collectionId) && collectionId != 0){
|
||||
List<CollectionElement> byCollectionId = collectionElementService.getByCollectionId(collectionId);
|
||||
if (byCollectionId != null && !byCollectionId.isEmpty()){
|
||||
projectId = byCollectionId.get(0).getProjectId();
|
||||
if (projectId != null && projectId != 0L){
|
||||
Workspace workspace = workspaceService.getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){
|
||||
return workspace.getAgeGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return AgeGroup.ADULT.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseMoodboardPosition(String moodboardPosition, Long collectionIdParam) {
|
||||
if (!StringUtils.isEmpty(moodboardPosition)) {
|
||||
// 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject moodboardPositionJson = JSONObject.parseObject(moodboardPosition);
|
||||
|
||||
// 准备保存的 MoodboardPosition 列表
|
||||
List<MoodboardPosition> moodboardPositions = new ArrayList<>();
|
||||
|
||||
// 遍历 JSON 对象的 key(即样式类型)
|
||||
for (String key : moodboardPositionJson.keySet()) {
|
||||
// 特殊处理 "class" 字段
|
||||
if ("class".equals(key)) {
|
||||
// 获取 "class" 字段的值并将其转为 List<String>
|
||||
JSONArray classArray = moodboardPositionJson.getJSONArray(key);
|
||||
if (classArray != null) {
|
||||
|
||||
for (int j = 0; j < classArray.size(); j++) {
|
||||
// 将 classList 存入 MoodboardPosition(或者其他结构)
|
||||
|
||||
MoodboardPosition position = new MoodboardPosition()
|
||||
.setCollectionId(collectionIdParam) // 关联 Collection ID
|
||||
.setType(key) // 样式类型
|
||||
.setStyleData(classArray.getString(j)) // 设置 class 字段
|
||||
.setSequence(j) // 根据索引值设置顺序
|
||||
.setCreateTime(LocalDateTime.now()) // 创建时间
|
||||
.setUpdateTime(LocalDateTime.now()); // 更新时间
|
||||
|
||||
// 添加到列表中
|
||||
moodboardPositions.add(position);
|
||||
}
|
||||
}
|
||||
continue; // 跳过 "class" 字段的常规处理
|
||||
}
|
||||
|
||||
JSONArray styleArray = moodboardPositionJson.getJSONArray(key);
|
||||
if (styleArray != null) {
|
||||
for (int i = 0; i < styleArray.size(); i++) {
|
||||
// 获取当前样式数据
|
||||
JSONObject styleData = styleArray.getJSONObject(i);
|
||||
|
||||
// 构建 MoodboardPosition 实例
|
||||
MoodboardPosition position = new MoodboardPosition()
|
||||
.setCollectionId(collectionIdParam) // 关联 Collection ID
|
||||
.setType(key) // 样式类型
|
||||
.setStyleData(styleData.toJSONString()) // 样式数据存为 JSON 字符串
|
||||
.setSequence(i) // 根据索引值设置顺序
|
||||
.setCreateTime(LocalDateTime.now()) // 创建时间
|
||||
.setUpdateTime(LocalDateTime.now()); // 更新时间
|
||||
|
||||
// 添加到列表中
|
||||
moodboardPositions.add(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果解析结果非空,保存到数据库
|
||||
if (!moodboardPositions.isEmpty()) {
|
||||
for (MoodboardPosition position : moodboardPositions) {
|
||||
moodboardPositionMapper.insert(position);
|
||||
}
|
||||
log.info("成功解析并保存 {} 条 MoodboardPosition 数据", moodboardPositions.size());
|
||||
} else {
|
||||
log.warn("未找到可保存的 MoodboardPosition 数据");
|
||||
}
|
||||
} else {
|
||||
log.warn("传入的 moodboardPosition 字段为空");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void relationImageId(DesignPythonObjects pythonObjects) {
|
||||
if (Objects.isNull(pythonObjects)) {
|
||||
return;
|
||||
}
|
||||
pythonObjects.getObjects().forEach(
|
||||
o -> {
|
||||
for (DesignPythonItem item : o.getItems()) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
list.add(1L);
|
||||
list.add(1L);
|
||||
item.setOffset(list);
|
||||
item.setResize_scale(new Float[]{1.0f,1.0f});
|
||||
String path = item.getPath();
|
||||
if (StringUtils.isEmpty(path)) {
|
||||
String bodyPath = item.getBody_path();
|
||||
Long imageId = pythonTAllInfoService.getImageIdByPath(bodyPath);
|
||||
item.setImage_id(imageId);
|
||||
} else {
|
||||
Long imageId = pythonTAllInfoService.getImageIdByPath(path);
|
||||
item.setImage_id(imageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CollectionSketchVO> sketchesBoundingBox(ReDesignCollectionDTO reDesignDTO) {
|
||||
List<CollectionSketchDTO> sketchBoards = new ArrayList<>();
|
||||
@@ -757,8 +603,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
LocalCacheUtils.setDesignProcessCache(userId, saveNames);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
private DesignCollectionVO savePythonDesignItemAndDetailSingle(DesignPythonObjects pythonObjects, Long designId, Long collectionId, AuthPrincipalVo userInfo, String timeZone, JSONObject outfit, String singleOverall, Map<String, Object> context) {
|
||||
Object designCollectionVO = context.get("DesignCollectionVO");
|
||||
@@ -928,6 +772,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
private DesignCollectionVO savePythonDesignItemAndDetail(DesignPythonObjects pythonObjects
|
||||
, Long designId, Long collectionId, AuthPrincipalVo userInfo, String timeZone, JSONObject responseJSONObject, String singleOverall) {
|
||||
DesignCollectionVO response = new DesignCollectionVO();
|
||||
@@ -1197,7 +1042,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DesignLikeVO like(DesignLikeDTO designLikeDTO) {
|
||||
Long userGroupId = designLikeDTO.getUserGroupId();;
|
||||
Long userGroupId = designLikeDTO.getUserGroupId();
|
||||
Long groupDetailId;
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
DesignItem designItem = designItemService.getById(designLikeDTO.getDesignItemId());
|
||||
@@ -1456,12 +1301,13 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
response.setHighDesignUrl(designItem.getHighDesignUrl());
|
||||
List<DesignItemDetail> filterDetail = designItemDetails.stream()
|
||||
.filter(f -> OUTWEAR_DRESS_BLOUSE.contains(f.getType()) || SKIRT_TROUSERS.contains(f.getType())
|
||||
|| TOPS.contains(f.getType()) || BOTTOMS.contains(f.getType()))
|
||||
|| TOPS.contains(f.getType()) || BOTTOMS.contains(f.getType()) || OTHERS.contains(f.getType()))
|
||||
.collect(Collectors.toList());
|
||||
response.setClothes(CopyUtil.copyList(filterDetail, DesignItemClothesDetailVO.class, (o, d) -> {
|
||||
d.setId(o.getId());
|
||||
d.setPath(minioUtil.getPreSignedUrl(o.getPath(), 24 * 60, true));
|
||||
d.setMinIOPath(o.getPath());
|
||||
d.setScope(o.getPath().startsWith("aida-sys-image") ? "sys" : "user");
|
||||
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
||||
d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class));
|
||||
if (!StringUtil.isNullOrEmpty(o.getUndividedLayer())) {
|
||||
@@ -2525,7 +2371,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
log.info("design python端运行时间:" + totalTimeInSeconds + " 秒");
|
||||
//生成library
|
||||
startTime = System.currentTimeMillis();
|
||||
String ageGroup = getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId);
|
||||
String ageGroup = workspaceService.getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId);
|
||||
generateLibrary(elementVO, designDTO.getTimeZone(), ageGroup);
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
// List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
@@ -2901,9 +2747,6 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
return result;
|
||||
}
|
||||
|
||||
@Resource
|
||||
private PanToneMapper panToneMapper;
|
||||
|
||||
@Override
|
||||
public Boolean receiveDesignParams(ReceiveDesignParam receiveDesignParam) {
|
||||
List<ReceiveCollectionElement> receiveCollectionElementList = receiveDesignParam.getReceiveCollectionElementList();
|
||||
|
||||
@@ -634,7 +634,7 @@ public class EmailServiceImpl implements EmailService {
|
||||
userTemplate = RENEWAL_USER_CN;
|
||||
}
|
||||
break;
|
||||
case "reminder":
|
||||
/*case "reminder":
|
||||
if (language.equals("ENGLISH")) {
|
||||
userSubject = "[Code-Create] AiDA Subscription Renewal Reminder";
|
||||
userTemplate = RENEWAL_REMINDER_USER_EN;
|
||||
@@ -642,6 +642,30 @@ public class EmailServiceImpl implements EmailService {
|
||||
userSubject = "[Code-Create] AiDA续订提醒";
|
||||
userTemplate = RENEWAL_REMINDER_USER_CN;
|
||||
}
|
||||
break;*/
|
||||
case "reminder_subscriber":
|
||||
if (language.equals("ENGLISH")) {
|
||||
userSubject = "[Code-Create] AiDA Subscription Renewal Reminder";
|
||||
userTemplate = String.valueOf(156072L);
|
||||
} else if (language.equals("CHINESE")){
|
||||
userSubject = "[Code-Create] AiDA续订提醒";
|
||||
userTemplate = String.valueOf(156073L);
|
||||
} else {
|
||||
userSubject = "[Code-Create] AiDA續訂提醒";
|
||||
userTemplate = String.valueOf(156074L);
|
||||
}
|
||||
break;
|
||||
case "reminder_trial":
|
||||
if (language.equals("ENGLISH")) {
|
||||
userSubject = "[Code-Create] AiDA — Free Trial Ending";
|
||||
userTemplate = String.valueOf(156075L);
|
||||
} else if (language.equals("CHINESE")){
|
||||
userSubject = "[Code-Create] AiDA — 免费试用结束提醒";
|
||||
userTemplate = String.valueOf(156076L);
|
||||
} else {
|
||||
userSubject = "[Code-Create] AiDA — 免費試用結束提醒";
|
||||
userTemplate = String.valueOf(156077L);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log.error("unknown subscription email type");
|
||||
@@ -654,7 +678,7 @@ public class EmailServiceImpl implements EmailService {
|
||||
sendEmail(Collections.singletonList(receiverAddress), jsonObject, userTemplate, userSubject, null, null);
|
||||
}
|
||||
// 排除不向商家发送邮件的情况
|
||||
if (!type.equals("reminder")) {
|
||||
if (!type.startsWith("reminder")) {
|
||||
sendEmail(merchantReceiver, jsonObject, merchantTemplate, merchantSubject, null, null);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.volcengine.ark.runtime.model.images.generation.ImagesResponse;
|
||||
import com.volcengine.ark.runtime.service.ArkService;
|
||||
import io.minio.errors.MinioException;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@@ -77,6 +78,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import static com.ai.da.common.enums.CollectionLevel1TypeEnum.*;
|
||||
import static com.ai.da.common.enums.CreditsEventsEnum.PATTERN;
|
||||
import static com.ai.da.common.enums.CreditsEventsEnum.POSE_TRANSFORMATION;
|
||||
import static com.ai.da.common.enums.CreditsEventsEnum.TO_PRODUCT_IMAGE;
|
||||
import static com.ai.da.common.enums.CreditsEventsEnum.TO_PRODUCT_IMAGE_ADVANCED;
|
||||
import static com.ai.da.common.enums.WangXiangTaskStatusEnum.FAILED;
|
||||
@@ -84,59 +86,34 @@ import static com.ai.da.common.enums.WangXiangTaskStatusEnum.UNKNOWN_W;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> implements GenerateService {
|
||||
|
||||
@Resource
|
||||
private CollectionElementMapper collectionElementMapper;
|
||||
@Resource
|
||||
private GenerateDetailMapper generateDetailMapper;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private CollectionElementService collectionElementService;
|
||||
@Resource
|
||||
private CreditsService creditsService;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
@Resource
|
||||
private RabbitMQService rabbitMQService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private GenerateCancelMapper generateCancelMapper;
|
||||
@Resource
|
||||
private SketchReconstructionMapper sketchReconstructionMapper;
|
||||
@Resource
|
||||
private SendRequestUtil sendRequestUtil;
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
@Resource
|
||||
private CollectionSortService collectionSortService;
|
||||
@Resource
|
||||
private CloudTaskService cloudTaskService;
|
||||
@Resource
|
||||
private APIGenerateMapper apiGenerateMapper;
|
||||
@Resource
|
||||
private CollectionSortMapper collectionSortMapper;
|
||||
@Resource
|
||||
private SysFileService sysFileService;
|
||||
@Resource
|
||||
private LibraryModelPointService libraryModelPointService;
|
||||
@Resource
|
||||
private PoseTransformationMapper poseTransformationMapper;
|
||||
@Resource
|
||||
private CloudTaskMapper cloudTaskMapper;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
@Resource
|
||||
private APIGenerateService apiGenerateService;
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
|
||||
private final AccountService accountService;
|
||||
private final APIGenerateService apiGenerateService;
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final CollectionElementService collectionElementService;
|
||||
private final CreditsService creditsService;
|
||||
private final CollectionSortMapper collectionSortMapper;
|
||||
private final CollectionSortService collectionSortService;
|
||||
private final CloudTaskMapper cloudTaskMapper;
|
||||
private final CloudTaskService cloudTaskService;
|
||||
private final GenerateCancelMapper generateCancelMapper;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
private final LibraryService libraryService;
|
||||
// private final LibraryModelPointService libraryModelPointService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final MessageCenterService messageCenterService;
|
||||
private final PythonService pythonService;
|
||||
private final ProjectService projectService;
|
||||
private final PoseTransformationMapper poseTransformationMapper;
|
||||
private final RabbitMQService rabbitMQService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final SketchReconstructionMapper sketchReconstructionMapper;
|
||||
private final SendRequestUtil sendRequestUtil;
|
||||
private final SysFileService sysFileService;
|
||||
private final ToProductImageResultMapper toProductImageResultMapper;
|
||||
private final ToProductImageResultService toProductImageResultService;
|
||||
@Value("${redis.key.orderForGenerate}")
|
||||
private String consumptionOrderKey;
|
||||
|
||||
@@ -867,6 +844,9 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
if (base64Data != null && !base64Data.isEmpty()) {
|
||||
String resultPath = userId + "/product_image" + "/" + uuid;
|
||||
String minioPath = minioUtil.base64UploadToPath("data:image/png;base64," + base64Data, userBucket, resultPath);
|
||||
if (StringUtil.isNullOrEmpty(minioPath)) {
|
||||
log.warn("Google API调用成功,但图片保存失败 for taskId: {}", taskId);
|
||||
}
|
||||
// 生成成功,更新Redis状态和URL
|
||||
GenerateResultVO successResultVO = new GenerateResultVO(taskId, null, minioPath, "Success");
|
||||
redisUtil.addToString(key, new Gson().toJson(successResultVO), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
||||
@@ -1495,9 +1475,6 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
GenerateResultVO successResultVO = new GenerateResultVO(taskId, null, imageUrl, "Success");
|
||||
redisUtil.addToString(key, new Gson().toJson(successResultVO), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
||||
|
||||
|
||||
// TODO: 处理积分扣除逻辑
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Doubao image generation failed for taskId: {}", taskId, e);
|
||||
LambdaQueryWrapper<Account> select = new LambdaQueryWrapper<Account>().eq(Account::getId, userId).select(Account::getLanguage);
|
||||
@@ -2472,6 +2449,9 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
|
||||
public ToProductImageResultVO poseTransform(PoseTransformDTO poseTransformDTO) {
|
||||
// 参数判断
|
||||
handleMotionParams(poseTransformDTO);
|
||||
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
Long projectId = poseTransformDTO.getProjectId();
|
||||
String productImage = poseTransformDTO.getProductImage();
|
||||
@@ -2490,6 +2470,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
Boolean isRequestSuccess = false;
|
||||
PoseTransformation poseTransformation = new PoseTransformation();
|
||||
if (!StringUtil.isNullOrEmpty(poseTransformDTO.getModelName()) && poseTransformDTO.getModelName().equals("wx")) {
|
||||
// 请求生成视频
|
||||
taskId = animateAnyone(poseTransformDTO, accountId);
|
||||
if (!StringUtil.isNullOrEmpty(taskId)) {
|
||||
isRequestSuccess = true;
|
||||
@@ -2499,17 +2480,24 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
} else {
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
taskId = uuid + "-" + accountId;
|
||||
isRequestSuccess = pythonService.poseTransformation(productImage, poseId, taskId);
|
||||
|
||||
com.alibaba.fastjson.JSONObject params = createParamsForMotion(poseTransformDTO, taskId);
|
||||
String api = params.getString("api");
|
||||
params.remove("api");
|
||||
// 请求生成视频
|
||||
isRequestSuccess = pythonService.poseTransformation(params, api);
|
||||
}
|
||||
|
||||
poseTransformation.setProjectId(projectId);
|
||||
poseTransformation.setAccountId(accountId);
|
||||
poseTransformation.setUniqueId(taskId);
|
||||
poseTransformation.setProductImage(productImage);
|
||||
poseTransformation.setLastFrameProductImage(poseTransformDTO.getLastFrameProductImage());
|
||||
poseTransformation.setPoseId(poseId);
|
||||
poseTransformation.setIsLiked((byte) 0);
|
||||
String taskStatus = isRequestSuccess ? "Executing" : "Fail";
|
||||
poseTransformation.setTaskStatus(taskStatus);
|
||||
poseTransformation.setPrompt(poseTransformDTO.getPrompt());
|
||||
poseTransformation.setCreateTime(LocalDateTime.now());
|
||||
poseTransformationMapper.insert(poseTransformation);
|
||||
// 当需要默认like
|
||||
@@ -2551,27 +2539,39 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
throw new BusinessException("pose.transformation.error", ResultEnum.ERROR.getCode());
|
||||
}
|
||||
|
||||
private void handleMotionParams(PoseTransformDTO poseTransformDTO) {
|
||||
if (Objects.isNull(poseTransformDTO.getMode()) || poseTransformDTO.getMode() == 0) {
|
||||
throw new BusinessException("Mode cannot be empty");
|
||||
}
|
||||
MotionModeEnum motionModeEnum = MotionModeEnum.of(poseTransformDTO.getMode());
|
||||
if (Objects.isNull(motionModeEnum)) {
|
||||
throw new BusinessException("unknown.mode");
|
||||
}
|
||||
if (poseTransformDTO.getMode() == 1 && Objects.isNull(poseTransformDTO.getPoseId())) {
|
||||
throw new BusinessException("Please choose a pose");
|
||||
}
|
||||
if (poseTransformDTO.getMode() == 3 && StringUtil.isNullOrEmpty(poseTransformDTO.getLastFrameProductImage())) {
|
||||
throw new BusinessException("Last frame cannot be empty");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private CollectionSort addPoseTransferLike(PoseTransformDTO poseTransformDTO, Long poseTransformationId) {
|
||||
if (Objects.nonNull(poseTransformDTO.getParentId())
|
||||
&& !poseTransformDTO.getParentId().equals(0L)) {
|
||||
return disOrLikePose(poseTransformationId, "like",
|
||||
poseTransformDTO.getProjectId(), poseTransformDTO.getUserLikeSortId());
|
||||
poseTransformDTO.getProjectId(), poseTransformDTO.getParentId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void processPoseTransformResult(String taskId, String gifUrl, String videoUrl, String imageUrl) {
|
||||
// 1、存储模型返回的数据
|
||||
PoseTransformation poseTransformation;
|
||||
QueryWrapper<PoseTransformation> qw = new QueryWrapper<>();
|
||||
qw.eq("unique_id", taskId);
|
||||
List<PoseTransformation> poseTransformations = poseTransformationMapper.selectList(qw);
|
||||
if (poseTransformations != null && poseTransformations.size() > 1) {
|
||||
log.warn("通过taskId {} 查询到的PoseTransformation的结果不止一条", taskId);
|
||||
} else if (poseTransformations == null || poseTransformations.isEmpty()) {
|
||||
PoseTransformation poseTransformation = getPoseTransformationByTaskId(taskId);
|
||||
if (Objects.isNull(poseTransformation)) {
|
||||
return;
|
||||
}
|
||||
poseTransformation = poseTransformations.get(0);
|
||||
|
||||
poseTransformation.setGifUrl(gifUrl);
|
||||
poseTransformation.setVideoUrl(videoUrl);
|
||||
poseTransformation.setFirstFrameUrl(imageUrl);
|
||||
@@ -2593,6 +2593,64 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
// String uuid = taskId.substring(0, taskId.lastIndexOf("-"));
|
||||
Boolean flag = creditsService.taskCreditsDeduction(Long.parseLong(accountId), taskId);
|
||||
if (flag) creditsService.updateChangedCredits(accountId, taskId);
|
||||
|
||||
// 发消息
|
||||
sendSysMsgForPT(poseTransformation);
|
||||
}
|
||||
|
||||
// 处理PoseTransformation失败的情况
|
||||
public void processPTFailSituation(String taskId) {
|
||||
PoseTransformation poseTransformation = getPoseTransformationByTaskId(taskId);
|
||||
if (Objects.isNull(poseTransformation)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新生成记录的状态
|
||||
poseTransformation.setTaskStatus("Fail");
|
||||
poseTransformation.setUpdateTime(LocalDateTime.now());
|
||||
poseTransformationMapper.updateById(poseTransformation);
|
||||
// 发消息
|
||||
sendSysMsgForPT(poseTransformation);
|
||||
}
|
||||
|
||||
private PoseTransformation getPoseTransformationByTaskId(String taskId) {
|
||||
QueryWrapper<PoseTransformation> qw = new QueryWrapper<>();
|
||||
qw.eq("unique_id", taskId);
|
||||
List<PoseTransformation> poseTransformations = poseTransformationMapper.selectList(qw);
|
||||
if (poseTransformations != null && poseTransformations.size() > 1) {
|
||||
log.warn("通过taskId {} 查询到的PoseTransformation的结果不止一条", taskId);
|
||||
} else if (poseTransformations == null || poseTransformations.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return poseTransformations.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSysMsgForPT(PoseTransformation poseTransformation) {
|
||||
// 确认当前任务是否已通知过,是 -> 不再通知;否 -> 通知
|
||||
Boolean elementExistsInSet = redisUtil.isElementExistsInSet(RedisUtil.VIDEO_FINISHED_TASKS, poseTransformation.getUniqueId());
|
||||
if (elementExistsInSet) {
|
||||
// 已通知过,不再通知
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isSuccess;
|
||||
if (!StringUtil.isNullOrEmpty(poseTransformation.getTaskStatus()) && poseTransformation.getTaskStatus().equals("Success")) {
|
||||
isSuccess = true;
|
||||
} else if (!StringUtil.isNullOrEmpty(poseTransformation.getTaskStatus()) && poseTransformation.getTaskStatus().equals("Fail")) {
|
||||
isSuccess = false;
|
||||
} else {
|
||||
// 不通知
|
||||
return;
|
||||
}
|
||||
|
||||
Project project = projectService.getById(poseTransformation.getProjectId());
|
||||
// 发通知
|
||||
if (Objects.nonNull(project) && !StringUtil.isNullOrEmpty(project.getName())) {
|
||||
messageCenterService.videoFinishedMsg(poseTransformation.getAccountId(), project.getName(), isSuccess);
|
||||
// 添加已通知记录到redis
|
||||
redisUtil.addToSet(RedisUtil.VIDEO_FINISHED_TASKS, poseTransformation.getUniqueId(), CommonConstant.GENERATE_RESULT_EXPIRE_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
public List<PoseTransformationVO> getPoseTransformationResult(List<String> taskIdList, Long projectId, Boolean like) {
|
||||
@@ -2633,7 +2691,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
|
||||
private PoseTransformationVO buildPoseTransformationVO(String taskId, PoseTransformation dbItem) {
|
||||
String type = resolveModelType(taskId, CreditsEventsEnum.POSE_TRANSFORMATION.getValue());
|
||||
String type = resolveModelType(taskId, POSE_TRANSFORMATION.getName());
|
||||
String key = generateResultKey + ":" + taskId;
|
||||
String resultJson = redisUtil.getFromString(key);
|
||||
|
||||
@@ -2667,11 +2725,16 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
vo = CopyUtil.copyObject(dbItem, PoseTransformationVO.class);
|
||||
vo.setTaskId(taskId);
|
||||
|
||||
// 设置产品图片URL
|
||||
// 设置产品图片URL(首帧)
|
||||
if (dbItem.getProductImage() != null) {
|
||||
vo.setProductImage(minioUtil.getPreSignedUrl(
|
||||
dbItem.getProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
}
|
||||
// 设置产品图片URL(尾帧)
|
||||
if (dbItem.getLastFrameProductImage() != null) {
|
||||
vo.setLastFrameProductImage(minioUtil.getPreSignedUrl(
|
||||
dbItem.getLastFrameProductImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
}
|
||||
|
||||
// 如果视频URL为空,直接返回
|
||||
if (StringUtil.isNullOrEmpty(dbItem.getVideoUrl())) {
|
||||
@@ -2720,7 +2783,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
Long parentId = collectionSortService.getParentIdByElementIdAndElementType(
|
||||
productResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue());
|
||||
if (Objects.isNull(parentId)) {
|
||||
parentId = userLikeGroupService.getUnlikedResultParentId(null, poseTransformation.getProductImage());
|
||||
parentId = toProductImageResultService.getUnlikedResultParentId(null, poseTransformation.getProductImage());
|
||||
}
|
||||
vo.setParentId(parentId);
|
||||
vo.setId(poseTransformation.getId());
|
||||
@@ -2996,7 +3059,8 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
public List<Map<String, String>> getAllPose() {
|
||||
List<Map<String, String>> propertyList = PoseEnum.getPropertyList();
|
||||
propertyList.forEach(item -> {
|
||||
item.put("gif", minioUtil.getPreSignedUrl(item.get("gif"), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
// item.put("gif", minioUtil.getPreSignedUrl(item.get("gif"), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
item.put("video", minioUtil.getPreSignedUrl(item.get("video"), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
item.put("firstFrame", minioUtil.getPreSignedUrl(item.get("firstFrame"), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
});
|
||||
return propertyList;
|
||||
@@ -3006,16 +3070,11 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
@Transactional
|
||||
public void processPoseTransformResultBatch(String taskId, String gifUrl, String videoUrl, String imageUrl, String progress) {
|
||||
// 1、存储模型返回的数据
|
||||
PoseTransformation poseTransformation;
|
||||
QueryWrapper<PoseTransformation> qw = new QueryWrapper<>();
|
||||
qw.eq("unique_id", taskId);
|
||||
List<PoseTransformation> poseTransformations = poseTransformationMapper.selectList(qw);
|
||||
if (poseTransformations != null && poseTransformations.size() > 1) {
|
||||
log.warn("通过taskId {} 查询到的PoseTransformation的结果不止一条", taskId);
|
||||
} else if (poseTransformations == null || poseTransformations.isEmpty()) {
|
||||
PoseTransformation poseTransformation = getPoseTransformationByTaskId(taskId);
|
||||
if (Objects.isNull(poseTransformation)) {
|
||||
return;
|
||||
}
|
||||
poseTransformation = poseTransformations.get(0);
|
||||
|
||||
poseTransformation.setGifUrl(gifUrl);
|
||||
poseTransformation.setVideoUrl(videoUrl);
|
||||
poseTransformation.setFirstFrameUrl(imageUrl);
|
||||
@@ -3058,17 +3117,11 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
@Transactional
|
||||
public void processPoseTransformResultBatch(String progress, String taskId) {
|
||||
// 1、存储模型返回的数据
|
||||
PoseTransformation poseTransformation;
|
||||
QueryWrapper<PoseTransformation> qw = new QueryWrapper<>();
|
||||
qw.eq("unique_id", taskId);
|
||||
List<PoseTransformation> poseTransformations = poseTransformationMapper.selectList(qw);
|
||||
log.info("poseTransformations : {}", poseTransformations);
|
||||
if (poseTransformations != null && poseTransformations.size() > 1) {
|
||||
log.warn("通过taskId {} 查询到的PoseTransformation的结果不止一条", taskId);
|
||||
} else if (poseTransformations == null || poseTransformations.isEmpty()) {
|
||||
PoseTransformation poseTransformation = getPoseTransformationByTaskId(taskId);
|
||||
if (Objects.isNull(poseTransformation)) {
|
||||
return;
|
||||
}
|
||||
poseTransformation = poseTransformations.get(0);
|
||||
|
||||
String taskIdBatch = poseTransformation.getTaskIdBatch();
|
||||
log.info("progress:{}", progress);
|
||||
log.info("taskIdBatch:{}", taskIdBatch);
|
||||
@@ -3694,6 +3747,8 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
creditsService.deleteCreditsDeduction(accountId, taskId);
|
||||
}
|
||||
poseTransformationVO.setTaskId(taskId);
|
||||
// 发送提示消息
|
||||
sendSysMsgForPT(poseTransformation);
|
||||
|
||||
return poseTransformationVO;
|
||||
}
|
||||
@@ -3900,7 +3955,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
private String resolveModelType(String taskId, String func) {
|
||||
// 判断当前task来自哪个模型
|
||||
if (!StringUtil.isNullOrEmpty(func)
|
||||
&& func.equals(CreditsEventsEnum.POSE_TRANSFORMATION.getValue())) {
|
||||
&& func.equals(POSE_TRANSFORMATION.getName())) {
|
||||
List<PoseTransformation> poseTransformations = poseTransformationMapper.selectList(
|
||||
new QueryWrapper<PoseTransformation>().eq("unique_id", taskId));
|
||||
if (!poseTransformations.isEmpty()
|
||||
@@ -4198,6 +4253,33 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
}
|
||||
|
||||
public com.alibaba.fastjson.JSONObject createParamsForMotion(PoseTransformDTO poseTransformDTO, String taskId) {
|
||||
|
||||
com.alibaba.fastjson.JSONObject params = new com.alibaba.fastjson.JSONObject();
|
||||
params.put("tasks_id", taskId);
|
||||
// 判断当前使用的哪种生成模式
|
||||
MotionModeEnum motionModeEnum = MotionModeEnum.of(poseTransformDTO.getMode());
|
||||
switch (motionModeEnum) {
|
||||
case POSE_TO_VIDEO:
|
||||
params.put("pose_id", poseTransformDTO.getPoseId());
|
||||
params.put("image_url", poseTransformDTO.getProductImage());
|
||||
break;
|
||||
case PROMPT_TO_VIDEO:
|
||||
params.put("image_url", poseTransformDTO.getProductImage());
|
||||
params.put("prompt", poseTransformDTO.getPrompt());
|
||||
break;
|
||||
case FIRST_LAST_FRAME_TO_VIDEO:
|
||||
params.put("start_image_url", poseTransformDTO.getProductImage());
|
||||
params.put("end_image_url", poseTransformDTO.getLastFrameProductImage());
|
||||
params.put("prompt", poseTransformDTO.getPrompt());
|
||||
break;
|
||||
default:
|
||||
throw new BusinessException("unknown.mode");
|
||||
}
|
||||
params.put("api", motionModeEnum.getUrl());
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据豆包错误码和详细信息返回用户友好的错误信息
|
||||
*
|
||||
|
||||
@@ -17,21 +17,20 @@ import com.ai.da.model.enums.Sex;
|
||||
import com.ai.da.model.vo.LibraryModelPointVO;
|
||||
import com.ai.da.python.PythonService;
|
||||
import com.ai.da.python.vo.DesignPythonObjects;
|
||||
import com.ai.da.service.DesignService;
|
||||
import com.ai.da.service.LibraryModelPointService;
|
||||
import com.ai.da.service.LibraryService;
|
||||
import com.ai.da.service.PythonTAllInfoService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -45,17 +44,13 @@ import java.util.Objects;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointMapper, LibraryModelPoint> implements LibraryModelPointService {
|
||||
@Resource
|
||||
private LibraryModelPointMapper libraryModelPointMapper;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
@Autowired
|
||||
private MinioUtil minioUtil;
|
||||
private final LibraryModelPointMapper libraryModelPointMapper;
|
||||
private final LibraryService libraryService;
|
||||
private final MinioUtil minioUtil;
|
||||
private final PythonService pythonService;
|
||||
private final PythonTAllInfoService pythonTAllInfoService;
|
||||
|
||||
@Override
|
||||
public LibraryModelPointVO saveOrEditTemplatePoint(LibraryModelPointDTO libraryModelPointDTO) {
|
||||
@@ -226,7 +221,7 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
||||
public String modelsDot(ModelsDotDTO modelsDotDTO) {
|
||||
DesignPythonObjects objects = pythonService.covertModelsDotParam(
|
||||
modelsDotDTO, SingleOverallEnum.OVERALL.getRealName(), "");
|
||||
designService.relationImageId(objects);
|
||||
pythonTAllInfoService.relationImageId(objects);
|
||||
JSONObject jsonObject = pythonService.designNew(objects);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
if (data == null) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
@@ -54,6 +55,8 @@ import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ai.da.common.enums.CollectionLevel2TypeEnum.OUTWEAR;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
*
|
||||
@@ -62,39 +65,25 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> implements LibraryService {
|
||||
@Resource
|
||||
private LibraryMapper libraryMapper;
|
||||
@Resource
|
||||
private SysFileMapper sysFileMapper;
|
||||
@Resource
|
||||
private SysFileExtraMapper sysFileExtraMapper;
|
||||
@Resource
|
||||
private FileProperties fileProperties;
|
||||
@Resource
|
||||
private LibraryModelPointService libraryModelPointService;
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
@Resource
|
||||
private ClassificationService classificationService;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
@Resource
|
||||
private AccountMapper accountMapper;
|
||||
@Resource
|
||||
private EductionLibraryMapper eductionLibraryMapper;
|
||||
@Resource
|
||||
private EnterpriseLibraryMapper enterpriseLibraryMapper;
|
||||
@Resource
|
||||
private LibraryCopyMapper libraryCopyMapper;
|
||||
@Resource
|
||||
private LibraryModelPointCopyMapper libraryModelPointCopyMapper;
|
||||
@Resource
|
||||
private PythonTAllInfoService pythonTAllInfoService;
|
||||
@Resource
|
||||
private BrandRelLibraryMapper brandRelLibraryMapper;
|
||||
@Resource
|
||||
private GenerateDetailMapper generateDetailMapper;
|
||||
private final AccountMapper accountMapper;
|
||||
private final BrandRelLibraryMapper brandRelLibraryMapper;
|
||||
private final ClassificationService classificationService;
|
||||
private final DesignItemDetailService designItemDetailService;
|
||||
private final EductionLibraryMapper eductionLibraryMapper;
|
||||
private final EnterpriseLibraryMapper enterpriseLibraryMapper;
|
||||
private final FileProperties fileProperties;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
private final MinioUtil minioUtil;
|
||||
private final LibraryMapper libraryMapper;
|
||||
private final LibraryCopyMapper libraryCopyMapper;
|
||||
private final LibraryModelPointMapper libraryModelPointMapper;
|
||||
private final LibraryModelPointCopyMapper libraryModelPointCopyMapper;
|
||||
private final PythonTAllInfoService pythonTAllInfoService;
|
||||
private final SysFileMapper sysFileMapper;
|
||||
private final SysFileExtraMapper sysFileExtraMapper;
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
@Value("${minio.bucketName.users}")
|
||||
private String users;
|
||||
@@ -110,7 +99,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
private String fastApiPythonAddress;
|
||||
|
||||
private static List<String> top = Arrays.asList(CollectionLevel2TypeEnum.DRESS.getRealName(),
|
||||
CollectionLevel2TypeEnum.OUTWEAR.getRealName(), CollectionLevel2TypeEnum.BLOUSE.getRealName());
|
||||
OUTWEAR.getRealName(), CollectionLevel2TypeEnum.BLOUSE.getRealName());
|
||||
private static List<String> bottom = Arrays.asList(CollectionLevel2TypeEnum.SKIRT.getRealName(),
|
||||
CollectionLevel2TypeEnum.TROUSERS.getRealName());
|
||||
|
||||
@@ -233,7 +222,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
.filter(library -> library.getLevel1Type().equals(LibraryLevel1TypeEnum.MODELS.getRealName()))
|
||||
.map(Library::getId)
|
||||
.collect(Collectors.toList());
|
||||
List<LibraryModelPointVO> libraryModelPointVOS = libraryModelPointService.selectByLibraryIds(libraryIds);
|
||||
List<LibraryModelPointVO> libraryModelPointVOS = selectByLibraryIds(libraryIds);
|
||||
if (!CollectionUtils.isEmpty(libraryModelPointVOS)) {
|
||||
map = libraryModelPointVOS.stream()
|
||||
.collect(Collectors.toMap(LibraryModelPointVO::getRelationId, v -> v));
|
||||
@@ -307,6 +296,25 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
return PageBaseResponse.success(pageResult);
|
||||
}
|
||||
|
||||
public List<LibraryModelPointVO> selectByLibraryIds(List<Long> libraryIds) {
|
||||
QueryWrapper<LibraryModelPoint> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(LibraryModelPoint::getModelType, ModelType.LIBRARY.getValue());
|
||||
queryWrapper.in("relation_id", libraryIds);
|
||||
List<LibraryModelPoint> libraryModelPoints = libraryModelPointMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(libraryModelPoints)) {
|
||||
return null;
|
||||
}
|
||||
return CopyUtil.copyList(libraryModelPoints, LibraryModelPointVO.class, (o, d) -> {
|
||||
d.setTemplateId(o.getId());
|
||||
d.setHandLeft(JSON.parseObject(o.getHandLeft(), List.class));
|
||||
d.setHandRight(JSON.parseObject(o.getHandRight(), List.class));
|
||||
d.setShoulderRight(JSON.parseObject(o.getShoulderRight(), List.class));
|
||||
d.setShoulderLeft(JSON.parseObject(o.getShoulderLeft(), List.class));
|
||||
d.setWaistbandRight(JSON.parseObject(o.getWaistbandRight(), List.class));
|
||||
d.setWaistbandLeft(JSON.parseObject(o.getWaistbandLeft(), List.class));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LibraryUpdateVo upload(LibraryUploadDTO libraryUploadDTO) {
|
||||
//用户信息
|
||||
@@ -659,7 +667,8 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
|
||||
libraryModelPoint.setRelationId(newInsert.getId());
|
||||
libraryModelPoint.setId(null);
|
||||
libraryModelPointService.saveOrUpdate(libraryModelPoint);
|
||||
// libraryModelPointService.saveOrUpdate(libraryModelPoint);
|
||||
libraryModelPointMapper.insert(libraryModelPoint);
|
||||
continue;
|
||||
}
|
||||
if (libraryCopy.getLevel1Type().equals("Sketchboard")) {
|
||||
@@ -780,7 +789,12 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
} else {
|
||||
library.setLevel3Type(uploadDTO.getModelSex());
|
||||
}
|
||||
if (uploadDTO.getLevel1Type().equals(LibraryLevel1TypeEnum.SKETCH_BOARD.getRealName())&&StringUtils.isEmpty(uploadDTO.getAgeGroup())) {
|
||||
log.error("前端未传ageGroup");
|
||||
library.setAgeGroup("Adult");
|
||||
} else {
|
||||
library.setAgeGroup(uploadDTO.getAgeGroup());
|
||||
}
|
||||
libraryMapper.insert(library);
|
||||
return library;
|
||||
} else if (uploadDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
||||
@@ -913,12 +927,12 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
libraryMapper.insert(library);
|
||||
|
||||
// 添加点位信息到library
|
||||
LibraryModelPoint sysModelPoint = libraryModelPointService.getByRelationId(sysModelId, "System");
|
||||
LibraryModelPoint sysModelPoint = getByRelationId(sysModelId, "System");
|
||||
sysModelPoint.setId(null);
|
||||
sysModelPoint.setModelType("Library");
|
||||
sysModelPoint.setRelationId(library.getId());
|
||||
sysModelPoint.setCreateDate(new Date());
|
||||
libraryModelPointService.save(sysModelPoint);
|
||||
libraryModelPointMapper.insert(sysModelPoint);
|
||||
|
||||
Map<String, String> resp = new HashMap<>();
|
||||
resp.put("id", library.getId().toString());
|
||||
@@ -926,6 +940,19 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
return resp;
|
||||
}
|
||||
|
||||
public LibraryModelPoint getByRelationId(Long relationId, String modelType) {
|
||||
QueryWrapper<LibraryModelPoint> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(LibraryModelPoint::getRelationId, relationId)
|
||||
.eq(LibraryModelPoint::getModelType, modelType)
|
||||
.last("limit 1");
|
||||
List<LibraryModelPoint> libraryModelPoints = libraryModelPointMapper.selectList(queryWrapper);
|
||||
if (CollectionUtil.isEmpty(libraryModelPoints)) {
|
||||
throw new BusinessException("modelPoint.not.found");
|
||||
}
|
||||
return libraryModelPoints.get(0);
|
||||
}
|
||||
|
||||
|
||||
public boolean saveToOrganizationLibrary(Long libraryId){
|
||||
// 1、判断该用户是否属于某个组织
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
@@ -1030,4 +1057,54 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将系统sketch添加到个人library
|
||||
*/
|
||||
public String addSysSketchToLibrary(Long clothId, String path) {
|
||||
// 1. 判断当前路径是不是系统sketch
|
||||
if (!path.startsWith("aida-sys-image/images")) {
|
||||
throw new BusinessException("Non-system Sketch file cannot be added to personal library.", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
|
||||
// 2. 是。获取当前用户id,随机生成4位数
|
||||
String sourceObject = path.substring(path.indexOf("/") + 1);
|
||||
String subPath = sourceObject.substring(sourceObject.indexOf("images/") + "images/".length(), sourceObject.lastIndexOf("."));
|
||||
String gender = subPath.substring(0, subPath.indexOf("/")).equals("female") ? "Female" : "Male";
|
||||
String category = subPath.substring(subPath.indexOf("/") + 1, subPath.lastIndexOf("/"));
|
||||
CollectionLevel2TypeEnum collectionLevel2TypeEnum = CollectionLevel2TypeEnum.ofWithLoweCase(category);
|
||||
if (Objects.nonNull(collectionLevel2TypeEnum)){
|
||||
category = collectionLevel2TypeEnum.getRealName();
|
||||
} else {
|
||||
category = OUTWEAR.getRealName();
|
||||
}
|
||||
String suffix = sourceObject.substring(sourceObject.lastIndexOf(".") + 1);
|
||||
Long userId = UserContext.getUserHolder().getId();
|
||||
// 由于允许将同一张系统sketch多次添加到个人library,但是路径相对固定,所以这里添加随机数以作区分
|
||||
String name = subPath.substring(subPath.lastIndexOf("/") + 1) + "_" + RandomsUtil.generateVerifyCode(1000L, 9999L);
|
||||
String targetObject = userId + "/sketchboard/" + gender.toLowerCase() + "/" + category + "/" +
|
||||
name + "." + suffix;
|
||||
|
||||
// 3. 复制图片到用户个人图片文件夹下
|
||||
minioUtil.copyObject(sysImage, sourceObject, users, targetObject);
|
||||
|
||||
// 4. 存储到数据库中
|
||||
String targetPath = users + "/" + targetObject;
|
||||
String md5 = MD5Utils.encryptFile(minioUtil.getPreSignedUrl(targetPath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME), false);
|
||||
Library library = new Library(userId, CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName(),
|
||||
category, gender, "Adult", name, targetPath, md5, new Date());
|
||||
saveOne(library);
|
||||
|
||||
// 5. 更新designItemDetail中的图片路径
|
||||
if (Objects.nonNull(clothId)) {
|
||||
designItemDetailService.updateDetailPathById(clothId, targetPath);
|
||||
}
|
||||
return minioUtil.getPreSignedUrl(targetPath, CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 低分辨率下载
|
||||
*/
|
||||
public void downloadSysSketchWithWatermark() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,19 +8,15 @@ import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.common.websocket.NotificationConnection;
|
||||
import com.ai.da.mapper.primary.CanvasMapper;
|
||||
import com.ai.da.mapper.primary.NotificationMapper;
|
||||
import com.ai.da.mapper.primary.SysNotificationReadStatusMapper;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.Notification;
|
||||
import com.ai.da.mapper.primary.entity.Portfolio;
|
||||
import com.ai.da.mapper.primary.entity.SysNotificationReadStatus;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.GetNotificationDTO;
|
||||
import com.ai.da.model.dto.PublishSysNotificationDTO;
|
||||
import com.ai.da.model.enums.Language;
|
||||
import com.ai.da.model.vo.NotificationVO;
|
||||
import com.ai.da.service.AccountService;
|
||||
import com.ai.da.service.MessageCenterService;
|
||||
import com.ai.da.service.PortfolioService;
|
||||
import com.ai.da.service.UserFollowService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -30,12 +26,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.gson.Gson;
|
||||
import com.mysql.cj.util.StringUtils;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -44,22 +40,18 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, Notification> implements MessageCenterService {
|
||||
|
||||
@Resource
|
||||
private NotificationConnection notificationConnection;
|
||||
@Resource
|
||||
private SysNotificationReadStatusMapper sysNotificationReadStatusMapper;
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
@Resource
|
||||
private CanvasMapper canvasMapper;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
private final AccountService accountService;
|
||||
private final CanvasMapper canvasMapper;
|
||||
private final MinioUtil minioUtil;
|
||||
private final NotificationConnection notificationConnection;
|
||||
private final PortfolioMapper portfolioMapper;
|
||||
private final RedisUtil redisUtil;
|
||||
private final SysNotificationReadStatusMapper sysNotificationReadStatusMapper;
|
||||
private final UserFollowService userFollowService;
|
||||
|
||||
@Value("${redis.key.newPosted}")
|
||||
private String lastViewNewPostedTimeKey;
|
||||
|
||||
@@ -72,7 +64,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
.collect(Collectors.toMap(
|
||||
map -> (String) map.get("type"),
|
||||
map -> Objects.isNull(map.get("count")) ? 0L : (Long) map.get("count")));
|
||||
msgTypeCount.put("system", getUnreadSystemNotification());
|
||||
msgTypeCount.put("system", getUnreadSystemNotification(accountId));
|
||||
msgTypeCount.put("newPosted", getNewPostedCount(accountId));
|
||||
log.info(msgTypeCount.toString());
|
||||
// 整理数据 加上系统消息未读数
|
||||
@@ -97,9 +89,18 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
if (!StringUtils.isNullOrEmpty(getNotificationDTO.getType())) {
|
||||
queryWrapper.eq("type", getNotificationDTO.getType());
|
||||
}
|
||||
if (!getNotificationDTO.getType().equals("system")){
|
||||
queryWrapper.eq("receiver_id", accountId);
|
||||
|
||||
if (getNotificationDTO.getType().equals("system")) {
|
||||
queryWrapper.lambda().eq(Notification::getType, "system")
|
||||
.and(wrapper -> wrapper
|
||||
.isNull(Notification::getReceiverId)
|
||||
.or()
|
||||
.eq(Notification::getReceiverId, accountId)
|
||||
);
|
||||
} else {
|
||||
queryWrapper.lambda().eq(Notification::getReceiverId, accountId);
|
||||
}
|
||||
|
||||
Page<Notification> notificationPage = baseMapper.selectPage(new Page<>(getNotificationDTO.getPage(), getNotificationDTO.getSize()), queryWrapper);
|
||||
|
||||
List<Long> unreadSysNotificationIds = baseMapper.getUnreadSysNotification(accountId);
|
||||
@@ -115,7 +116,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
if (Objects.isNull(notificationVO.getPortfolioId())) {
|
||||
notificationVO.setPortfolioId(null);
|
||||
} else {
|
||||
Portfolio byId = portfolioService.getById(notificationVO.getPortfolioId());
|
||||
Portfolio byId = portfolioMapper.selectById(notificationVO.getPortfolioId());
|
||||
if (!Objects.isNull(byId)) {
|
||||
if (Objects.isNull(byId.getPortfolioName())) {
|
||||
notificationVO.setPortfolioName(null);
|
||||
@@ -161,6 +162,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
/**
|
||||
* 只记录唯一点赞和关注
|
||||
* 重复点赞、关注只会记录最新的一次操作
|
||||
*
|
||||
* @param notification
|
||||
* @return
|
||||
*/
|
||||
@@ -192,13 +194,13 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
count = getUnreadCountByType(type, receiverId);
|
||||
} else {
|
||||
// 系统未读消息
|
||||
count = getUnreadSystemNotification();
|
||||
count = getUnreadSystemNotification(receiverId);
|
||||
}
|
||||
if (type.equals("follow")) {
|
||||
HashMap<String, Object> followee = new HashMap<>();
|
||||
HashMap<String, Object> follower = new HashMap<>();
|
||||
follower.put("followerCount",portfolioService.getFollowerCount(receiverId));
|
||||
followee.put("followeeCount",portfolioService.getFolloweeCount(receiverId));
|
||||
follower.put("followerCount", userFollowService.getFollowerCount(receiverId));
|
||||
followee.put("followeeCount", userFollowService.getFolloweeCount(receiverId));
|
||||
resp.add(followee);
|
||||
resp.add(follower);
|
||||
}
|
||||
@@ -243,15 +245,21 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
return baseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
private Long getUnreadSystemNotification() {
|
||||
private Long getUnreadSystemNotification(Long receiverId) {
|
||||
// Long accountId = UserContext.getUserHolder().getId();
|
||||
// 计算总的系统通知数量
|
||||
QueryWrapper<Notification> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("type", "system");
|
||||
queryWrapper.lambda().eq(Notification::getType, "system")
|
||||
.and(wrapper -> wrapper
|
||||
.isNull(Notification::getReceiverId)
|
||||
.or()
|
||||
.eq(Notification::getReceiverId, receiverId)
|
||||
);
|
||||
Long totalSysCount = baseMapper.selectCount(queryWrapper);
|
||||
|
||||
// 计算单个用户读了多少条系统数据
|
||||
QueryWrapper<SysNotificationReadStatus> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("account_id", UserContext.getUserHolder().getId());
|
||||
wrapper.eq("account_id", receiverId);
|
||||
Long readCount = sysNotificationReadStatusMapper.selectCount(wrapper);
|
||||
|
||||
// 计算差
|
||||
@@ -279,11 +287,17 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
public void setReadStatusSystem(List<Long> notificationIdList) {
|
||||
Long id = UserContext.getUserHolder().getId();
|
||||
for (Long notificationId : notificationIdList) {
|
||||
Notification notification = getById(notificationId);
|
||||
if (Objects.nonNull(notification) && notification.getType().equals("system")) {
|
||||
// 当系统消息指定了接收人员时,不允许其他人员已读
|
||||
if (Objects.isNull(notification.getReceiverId()) || notification.getReceiverId().equals(id)) {
|
||||
SysNotificationReadStatus sysNotificationReadStatus = new SysNotificationReadStatus(notificationId, id);
|
||||
sysNotificationReadStatus.setCreateTime(LocalDateTime.now());
|
||||
sysNotificationReadStatusMapper.insert(sysNotificationReadStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 一键已读
|
||||
public void setReadAll(String type) {
|
||||
@@ -314,7 +328,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
|
||||
public Long getNewPostedCount(Long accountId) {
|
||||
// 1.1 获取我关注的所有用户
|
||||
List<Long> followeeList = portfolioService.getFolloweeList(accountId);
|
||||
List<Long> followeeList = userFollowService.getFolloweeList(accountId);
|
||||
// 1.2 查询我关注的用户在我上次查看动态之后发布的作品数量
|
||||
String lastViewTime = redisUtil.getFromString(lastViewNewPostedTimeKey + ":" + accountId);
|
||||
|
||||
@@ -330,7 +344,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
} else {
|
||||
return 0L;
|
||||
}
|
||||
return portfolioService.getBaseMapper().selectCount(queryWrapper);
|
||||
return portfolioMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,7 +354,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
|
||||
// 1、获取关注用户发布的所有作品
|
||||
// 1.1 获取我关注的所有用户
|
||||
List<Long> followeeList = portfolioService.getFolloweeList(accountId);
|
||||
List<Long> followeeList = userFollowService.getFolloweeList(accountId);
|
||||
// 1.2 分页查询我关注的用户发布的作品
|
||||
QueryWrapper<Portfolio> queryWrapper = new QueryWrapper<>();
|
||||
if (!followeeList.isEmpty()) {
|
||||
@@ -349,7 +363,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
return new PageBaseResponse<>(new ArrayList<>(), page, size, 0, 0);
|
||||
}
|
||||
queryWrapper.orderByDesc("create_date");
|
||||
Page<Portfolio> portfolioPage = portfolioService.getBaseMapper().selectPage(new Page<>(page, size), queryWrapper);
|
||||
Page<Portfolio> portfolioPage = portfolioMapper.selectPage(new Page<>(page, size), queryWrapper);
|
||||
// 2、组装返回的数据
|
||||
|
||||
IPage<NotificationVO> convert = portfolioPage.convert(o -> {
|
||||
@@ -378,4 +392,38 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
||||
return PageBaseResponse.success(convert);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void videoFinishedMsg(Long userId, String projectName, boolean isSuccess) {
|
||||
Account account = accountService.getById(userId);
|
||||
String language = account.getLanguage();
|
||||
PublishSysNotificationDTO sysNotificationDTO = new PublishSysNotificationDTO();
|
||||
Notification notification = new Notification();
|
||||
notification.setType("system");
|
||||
notification.setReceiverId(userId);
|
||||
if (isSuccess) {
|
||||
if (language.equals(Language.ENGLISH.name())) {
|
||||
sysNotificationDTO.setTitle("System Notification");
|
||||
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " is ready!");
|
||||
} else {
|
||||
sysNotificationDTO.setTitle("系统通知");
|
||||
sysNotificationDTO.setContent("您在项目 " + projectName + " 中创建的视频生成任务已完成!");
|
||||
}
|
||||
} else {
|
||||
if (language.equals(Language.ENGLISH.name())) {
|
||||
sysNotificationDTO.setTitle("System Notification");
|
||||
sysNotificationDTO.setContent("Your video generation task in Project " + projectName + " has failed.");
|
||||
} else {
|
||||
sysNotificationDTO.setTitle("系统通知");
|
||||
sysNotificationDTO.setContent("视频生成任务失败。");
|
||||
}
|
||||
}
|
||||
notification.setContent(JSON.toJSONString(sysNotificationDTO));
|
||||
notification.setIsRead(0);
|
||||
notification.setCreateTime(LocalDateTime.now());
|
||||
save(notification);
|
||||
// 这里推送消息是在接受到视频生成结束后发生的,所以UserContext中没有用户信息
|
||||
pushMessage("system", userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.mapper.primary.MoodboardPositionMapper;
|
||||
import com.ai.da.mapper.primary.entity.MoodboardPosition;
|
||||
import com.ai.da.service.MoodboardPositionService;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MoodboardPositionServiceImpl extends ServiceImpl<MoodboardPositionMapper, MoodboardPosition> implements MoodboardPositionService {
|
||||
|
||||
@Override
|
||||
public void parseMoodboardPosition(String moodboardPosition, Long collectionIdParam) {
|
||||
if (!StringUtils.isEmpty(moodboardPosition)) {
|
||||
// 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject moodboardPositionJson = JSONObject.parseObject(moodboardPosition);
|
||||
|
||||
// 准备保存的 MoodboardPosition 列表
|
||||
List<MoodboardPosition> moodboardPositions = new ArrayList<>();
|
||||
|
||||
// 遍历 JSON 对象的 key(即样式类型)
|
||||
for (String key : moodboardPositionJson.keySet()) {
|
||||
// 特殊处理 "class" 字段
|
||||
if ("class".equals(key)) {
|
||||
// 获取 "class" 字段的值并将其转为 List<String>
|
||||
JSONArray classArray = moodboardPositionJson.getJSONArray(key);
|
||||
if (classArray != null) {
|
||||
|
||||
for (int j = 0; j < classArray.size(); j++) {
|
||||
// 将 classList 存入 MoodboardPosition(或者其他结构)
|
||||
|
||||
MoodboardPosition position = new MoodboardPosition()
|
||||
.setCollectionId(collectionIdParam) // 关联 Collection ID
|
||||
.setType(key) // 样式类型
|
||||
.setStyleData(classArray.getString(j)) // 设置 class 字段
|
||||
.setSequence(j) // 根据索引值设置顺序
|
||||
.setCreateTime(LocalDateTime.now()) // 创建时间
|
||||
.setUpdateTime(LocalDateTime.now()); // 更新时间
|
||||
|
||||
// 添加到列表中
|
||||
moodboardPositions.add(position);
|
||||
}
|
||||
}
|
||||
continue; // 跳过 "class" 字段的常规处理
|
||||
}
|
||||
|
||||
JSONArray styleArray = moodboardPositionJson.getJSONArray(key);
|
||||
if (styleArray != null) {
|
||||
for (int i = 0; i < styleArray.size(); i++) {
|
||||
// 获取当前样式数据
|
||||
JSONObject styleData = styleArray.getJSONObject(i);
|
||||
|
||||
// 构建 MoodboardPosition 实例
|
||||
MoodboardPosition position = new MoodboardPosition()
|
||||
.setCollectionId(collectionIdParam) // 关联 Collection ID
|
||||
.setType(key) // 样式类型
|
||||
.setStyleData(styleData.toJSONString()) // 样式数据存为 JSON 字符串
|
||||
.setSequence(i) // 根据索引值设置顺序
|
||||
.setCreateTime(LocalDateTime.now()) // 创建时间
|
||||
.setUpdateTime(LocalDateTime.now()); // 更新时间
|
||||
|
||||
// 添加到列表中
|
||||
moodboardPositions.add(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果解析结果非空,保存到数据库
|
||||
if (!moodboardPositions.isEmpty()) {
|
||||
for (MoodboardPosition position : moodboardPositions) {
|
||||
baseMapper.insert(position);
|
||||
}
|
||||
log.info("成功解析并保存 {} 条 MoodboardPosition 数据", moodboardPositions.size());
|
||||
} else {
|
||||
log.warn("未找到可保存的 MoodboardPosition 数据");
|
||||
}
|
||||
} else {
|
||||
log.warn("传入的 moodboardPosition 字段为空");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.base.Function;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -45,107 +46,41 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio> implements PortfolioService {
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupMapper userLikeGroupMapper;
|
||||
|
||||
@Resource
|
||||
private CollectionMapper collectionMapper;
|
||||
|
||||
@Resource
|
||||
private CollectionElementService collectionElementService;
|
||||
|
||||
@Resource
|
||||
private CollectionElementMapper collectionElementMapper;
|
||||
@Resource
|
||||
private CollectionSortService collectionSortService;
|
||||
@Resource
|
||||
private CollectionSortMapper collectionSortMapper;
|
||||
@Resource
|
||||
private TCollectionElementRelationMapper collectionElementRelationMapper;
|
||||
|
||||
@Resource
|
||||
private PortfolioMapper portfolioMapper;
|
||||
|
||||
@Resource
|
||||
private UserLikeService userLikeService;
|
||||
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
|
||||
@Resource
|
||||
private TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
|
||||
@Resource
|
||||
private TDesignPythonOutfitDetailMapper designPythonOutfitDetailMapper;
|
||||
|
||||
@Resource
|
||||
private DesignItemMapper designItemMapper;
|
||||
|
||||
@Resource
|
||||
private DesignItemDetailMapper designItemDetailMapper;
|
||||
|
||||
@Resource
|
||||
private DesignItemDetailPrintMapper designItemDetailPrintMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
|
||||
@Resource
|
||||
private CanvasMapper canvasMapper;
|
||||
|
||||
@Resource
|
||||
private AccountMapper accountMapper;
|
||||
|
||||
@Resource
|
||||
private WorkspaceMapper workspaceMapper;
|
||||
|
||||
@Resource
|
||||
private SysFileMapper sysFileMapper;
|
||||
|
||||
@Resource
|
||||
private LibraryMapper libraryMapper;
|
||||
|
||||
@Resource
|
||||
private StyleMapper styleMapper;
|
||||
|
||||
@Resource
|
||||
private WorkspaceRelStyleMapper workspaceRelStyleMapper;
|
||||
|
||||
@Resource
|
||||
private UserFollowMapper userFollowMapper;
|
||||
|
||||
@Resource
|
||||
private PortfolioTagsMapper portfolioTagsMapper;
|
||||
|
||||
@Resource
|
||||
private TagsService tagsService;
|
||||
|
||||
@Resource
|
||||
private TagsMapper tagsMapper;
|
||||
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
@Resource
|
||||
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
private ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
@Resource
|
||||
private PoseTransformationMapper poseTransformationMapper;
|
||||
private final AccountMapper accountMapper;
|
||||
private final CanvasMapper canvasMapper;
|
||||
private final CollectionMapper collectionMapper;
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final CollectionElementService collectionElementService;
|
||||
private final CollectionSortMapper collectionSortMapper;
|
||||
private final CollectionSortService collectionSortService;
|
||||
private final CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
private final TCollectionElementRelationMapper collectionElementRelationMapper;
|
||||
private final DesignMapper designMapper;
|
||||
private final DesignItemMapper designItemMapper;
|
||||
private final DesignItemDetailMapper designItemDetailMapper;
|
||||
private final DesignItemDetailPrintMapper designItemDetailPrintMapper;
|
||||
private final TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
private final TDesignPythonOutfitDetailMapper designPythonOutfitDetailMapper;
|
||||
private final MinioUtil minioUtil;
|
||||
private final ProjectMapper projectMapper;
|
||||
private final PortfolioMapper portfolioMapper;
|
||||
private final PortfolioTagsMapper portfolioTagsMapper;
|
||||
private final PoseTransformationMapper poseTransformationMapper;
|
||||
private final TagsMapper tagsMapper;
|
||||
private final TagsService tagsService;
|
||||
private final ToProductImageResultMapper toProductImageResultMapper;
|
||||
private final ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
private final UserFollowMapper userFollowMapper;
|
||||
private final UserFollowService userFollowService;
|
||||
private final UserLikeService userLikeService;
|
||||
private final UserLikeMapper userLikeMapper;
|
||||
private final UserLikeGroupMapper userLikeGroupMapper;
|
||||
private final UserLikeGroupService userLikeGroupService;
|
||||
private final WorkspaceMapper workspaceMapper;
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -585,7 +520,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
vo.setIsLike(0);
|
||||
}
|
||||
// 设置当前用户是否关注了所查看作品的作者
|
||||
Integer ifFollowed = getIfFollowed(portfolio.getAccountId(), portfolioDTO.getAccountId());
|
||||
Integer ifFollowed = userFollowService.getIfFollowed(portfolio.getAccountId(), portfolioDTO.getAccountId());
|
||||
vo.setIsFollow(ifFollowed);
|
||||
avatar = StringUtil.isNullOrEmpty(account.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : account.getAvatar();
|
||||
}
|
||||
@@ -1157,7 +1092,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
if (!collect.contains(CommonConstant.RCA_WORKSHOP_TAG)) {
|
||||
return false;
|
||||
} else {
|
||||
UserLikeGroup userLikeGroup = userLikeGroupService.getById(userLikeGroupId);
|
||||
UserLikeGroup userLikeGroup = userLikeGroupMapper.selectById(userLikeGroupId);
|
||||
// 不是原创的作品不能参与活动
|
||||
if (userLikeGroup.getOriginal().equals(0)) {
|
||||
throw new BusinessException("only.original.works.can.participate.in.the.event", ResultEnum.PROMPT.getCode());
|
||||
@@ -1276,86 +1211,6 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
messageCenterService.pushMessage("follow", followeeId);
|
||||
}
|
||||
|
||||
public Long getFolloweeCount(Long accountId) {
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("follower_id", accountId).select("followee_id");
|
||||
return userFollowMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
// 获取某个用户的关注列表 + 按名字查询
|
||||
public List<AccountFollowVO> getFolloweeList(GetFollowListDTO getFollowListDTO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
// 1、判断是否有按用户名查询
|
||||
List<AccountFollowVO> followeeList;
|
||||
if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) {
|
||||
followeeList = userFollowMapper.getFolloweeListByName(getFollowListDTO.getSearchByName(), accountId);
|
||||
} else {
|
||||
// 2、查全部 分页查询
|
||||
String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC";
|
||||
Integer limit = getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20;
|
||||
Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0;
|
||||
followeeList = userFollowMapper.getFolloweeListByFollower(accountId, limit, offset, order);
|
||||
}
|
||||
|
||||
if (!followeeList.isEmpty()) {
|
||||
followeeList.forEach(followee -> {
|
||||
String avatar = StringUtil.isNullOrEmpty(followee.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : followee.getAvatar();
|
||||
followee.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
});
|
||||
return followeeList;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Long getFollowerCount(Long accountId) {
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("followee_id", accountId).select("follower_id");
|
||||
return userFollowMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
// 获取某个用户的粉丝列表 + 按名字查询 需返回是否关注该粉丝
|
||||
public List<AccountFollowVO> getFollowerList(GetFollowListDTO getFollowListDTO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
|
||||
// 获取当前用户的所有粉丝
|
||||
QueryWrapper<UserFollow> qw = new QueryWrapper<>();
|
||||
qw.eq("follower_id", accountId).select("followee_id", "create_time");
|
||||
List<UserFollow> userFollows = userFollowMapper.selectList(qw);
|
||||
Map<Long, LocalDateTime> followeeMap = userFollows.stream().collect(Collectors.toMap(UserFollow::getFolloweeId, UserFollow::getCreateTime));
|
||||
|
||||
List<AccountFollowVO> followerList;
|
||||
// 1、判断是否有按用户名查询粉丝
|
||||
if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) {
|
||||
followerList = userFollowMapper.getFollowerListByName(getFollowListDTO.getSearchByName(), accountId);
|
||||
} else {
|
||||
// 2、查全部 分页查询
|
||||
String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC";
|
||||
Integer limit = getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20;
|
||||
Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0;
|
||||
followerList = userFollowMapper.getFollowerListByFollowee(accountId, limit, offset, order);
|
||||
}
|
||||
|
||||
if (!followerList.isEmpty()) {
|
||||
// 判断当前用户是否与粉丝互关
|
||||
followerList.forEach(follower -> {
|
||||
String avatar = StringUtil.isNullOrEmpty(follower.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : follower.getAvatar();
|
||||
follower.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
follower.setIsFollow(Objects.isNull(followeeMap.get(follower.getSenderId())) ? 0 : 1);
|
||||
// follower.setFollowTime(followeeMap.get(follower.getUserId()));
|
||||
});
|
||||
return followerList;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Integer getIfFollowed(Long followeeId, Long followerId) {
|
||||
// 设置当前用户是否关注了所查看作品的作者
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("followee_id", followeeId).eq("follower_id", followerId);
|
||||
UserFollow userFollow = userFollowMapper.selectOne(queryWrapper);
|
||||
return Objects.isNull(userFollow) ? 0 : 1;
|
||||
}
|
||||
|
||||
public Long getPortfolioCount(Long accountId) {
|
||||
QueryWrapper<Portfolio> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("account_id", accountId);
|
||||
@@ -1363,19 +1218,6 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
return baseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关注列表
|
||||
*
|
||||
* @param accountId
|
||||
* @return
|
||||
*/
|
||||
public List<Long> getFolloweeList(Long accountId) {
|
||||
QueryWrapper<UserFollow> qw = new QueryWrapper<>();
|
||||
qw.eq("follower_id", accountId).select("followee_id");
|
||||
|
||||
List<UserFollow> userFollows = userFollowMapper.selectList(qw);
|
||||
return userFollows.stream().map(UserFollow::getFolloweeId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void setPortfolioToPublic(Long portfolioId) {
|
||||
// 判断当前用户与作品用户是不是一家公司的
|
||||
|
||||
@@ -4,6 +4,8 @@ package com.ai.da.service.impl;
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.mapper.primary.PythonTAllInfoMapper;
|
||||
import com.ai.da.mapper.primary.entity.PythonTAllInfo;
|
||||
import com.ai.da.python.vo.DesignPythonItem;
|
||||
import com.ai.da.python.vo.DesignPythonObjects;
|
||||
import com.ai.da.service.PythonTAllInfoService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -13,7 +15,9 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* (PythonTAllInfo)表服务实现类
|
||||
@@ -48,4 +52,31 @@ public class PythonTAllInfoServiceImpl extends ServiceImpl<PythonTAllInfoMapper,
|
||||
}
|
||||
return pythonTAllInfo.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void relationImageId(DesignPythonObjects pythonObjects) {
|
||||
if (Objects.isNull(pythonObjects)) {
|
||||
return;
|
||||
}
|
||||
pythonObjects.getObjects().forEach(
|
||||
o -> {
|
||||
for (DesignPythonItem item : o.getItems()) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
list.add(1L);
|
||||
list.add(1L);
|
||||
item.setOffset(list);
|
||||
item.setResize_scale(new Float[]{1.0f, 1.0f});
|
||||
String path = item.getPath();
|
||||
if (StringUtils.isEmpty(path)) {
|
||||
String bodyPath = item.getBody_path();
|
||||
Long imageId = getImageIdByPath(bodyPath);
|
||||
item.setImage_id(imageId);
|
||||
} else {
|
||||
Long imageId = getImageIdByPath(path);
|
||||
item.setImage_id(imageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.ai.da.model.dto.CreateCouponDTO;
|
||||
import com.ai.da.model.dto.ProductPurchaseDTO;
|
||||
import com.ai.da.model.dto.QueryCouponsPageDTO;
|
||||
import com.ai.da.model.dto.SubscriptionEmailParamsDTO;
|
||||
import com.ai.da.model.enums.Language;
|
||||
import com.ai.da.model.vo.CheckCouponsVO;
|
||||
import com.ai.da.service.*;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -1072,7 +1073,7 @@ public class StripeServiceImpl implements StripeService {
|
||||
String key = RedisUtil.SUBSCRIPTION_SENT_EMAIL_TYPE + subscriptionInfo.getId();
|
||||
// 先判断当前订单 这个类型的邮件是否已发送过
|
||||
Boolean elementExistsInSet = redisUtil.isElementExistsInSet(key, type);
|
||||
if (!type.equals("reminder") && !type.equals("cancel") && paymentInfo.getNotified() == 1 && elementExistsInSet){
|
||||
if (!type.startsWith("reminder") && !type.equals("cancel") && paymentInfo.getNotified() == 1 && elementExistsInSet){
|
||||
// 已经邮件通知过,直接返回
|
||||
log.info("不发送邮件,原因:【type为:{},order_no为:{},已经进行邮件通知】", type, orderNo);
|
||||
return true;
|
||||
@@ -1080,11 +1081,13 @@ public class StripeServiceImpl implements StripeService {
|
||||
|
||||
com.ai.da.mapper.primary.entity.Account account = accountMapper.selectById(subscriptionInfo.getAccountId());
|
||||
String userName = account.getUserName();
|
||||
String language = account.getLanguage();
|
||||
String language = getLanguage(account.getLanguage(), account.getCountry(), type);
|
||||
OrderInfo orderByOrderNo = orderInfoService.getOrderByOrderNo(subscriptionInfo.getOrderNo());
|
||||
|
||||
SubscriptionEmailParamsDTO emailParamsDTO = new SubscriptionEmailParamsDTO();
|
||||
emailParamsDTO.setUsername(userName);
|
||||
emailParamsDTO.setEmail(account.getUserEmail());
|
||||
emailParamsDTO.setCountry(paymentInfo.getCountry());
|
||||
emailParamsDTO.setOrderId(paymentInfo.getId().toString());
|
||||
emailParamsDTO.setOrderRef("\"" + orderListLink + paymentInfo.getId().toString() + "\"");
|
||||
emailParamsDTO.setCreateDate(String.valueOf(paymentInfo.getCreateTime()).replace("T", " "));
|
||||
@@ -1099,7 +1102,7 @@ public class StripeServiceImpl implements StripeService {
|
||||
if (!b) return false;
|
||||
|
||||
// 邮件通知成功后,更新标志
|
||||
if (!type.equals("reminder") && !type.equals("cancel")){
|
||||
if (!type.startsWith("reminder") && !type.equals("cancel")){
|
||||
PaymentInfo payment = new PaymentInfo();
|
||||
payment.setId(paymentInfo.getId());
|
||||
payment.setNotified(1);
|
||||
@@ -1112,6 +1115,20 @@ public class StripeServiceImpl implements StripeService {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getLanguage(String language, String country, String type) {
|
||||
if (StringUtil.isNullOrEmpty(language)){
|
||||
return Language.ENGLISH.name();
|
||||
} else {
|
||||
if (!StringUtil.isNullOrEmpty(type) && type.startsWith("reminder")
|
||||
&& language.equals(Language.CHINESE_SIMPLIFIED.name())
|
||||
&& !StringUtil.isNullOrEmpty(country)
|
||||
&& (country.equals("Hong Kong, China") || country.equals("Taiwan, China"))) {
|
||||
return "zh-Hant";
|
||||
}
|
||||
return language;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean sendEmail(String orderNo){
|
||||
SubscriptionEmailParamsDTO emailParamsDTO = new SubscriptionEmailParamsDTO();
|
||||
OrderInfo orderInfo = orderInfoService.getOrderByOrderNo(orderNo);
|
||||
@@ -1255,9 +1272,10 @@ public class StripeServiceImpl implements StripeService {
|
||||
emailParamsDTO.setNextPayDate(DateUtil.changeTimeStampFormat(subscriptionInfo.getCurrentPeriodEnd(), "seconds", CommonConstant.TIME_FORMAT_MMM_dd_yyyy));
|
||||
}
|
||||
emailParamsDTO.setRenewalTime(DateUtil.changeTimeStampFormat(subscriptionInfo.getCurrentPeriodEnd(), "seconds", CommonConstant.TIME_FORMAT_MMM_dd_yyyy));
|
||||
emailParamsDTO.setDays(subscriptionInfo.getType().equals("month") ? "7" : subscriptionInfo.getType().equals("year") ? "14" : "N/A");
|
||||
}
|
||||
|
||||
public void subscriptionReminder(){
|
||||
/*public void subscriptionReminder(){
|
||||
// 提前7天的 00:00:00 和 23:59:59
|
||||
LocalDateTime startOfDay = LocalDateTime.now().plusDays(7).toLocalDate().atStartOfDay();
|
||||
LocalDateTime endOfDay = LocalDateTime.now().plusDays(7).toLocalDate().atTime(23, 59, 59);
|
||||
@@ -1276,7 +1294,7 @@ public class StripeServiceImpl implements StripeService {
|
||||
boolean b = sendEmail(subscriptionInfo.getSubscriptionId(), "reminder", null);
|
||||
if (b) log.info("提前7天向用户 {} 发送续订通知邮件", subscriptionInfo.getAccountId());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void checkSubscriptionExpiration(){
|
||||
long epochSecond = Instant.now().getEpochSecond();
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.mapper.primary.ToProductImageResultMapper;
|
||||
import com.ai.da.mapper.primary.entity.CollectionSort;
|
||||
import com.ai.da.mapper.primary.entity.ToProductImageResult;
|
||||
import com.ai.da.mapper.primary.entity.UserLike;
|
||||
import com.ai.da.service.CollectionSortService;
|
||||
import com.ai.da.service.ToProductImageResultService;
|
||||
import com.ai.da.service.UserLikeService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ToProductImageResultServiceImpl extends ServiceImpl<ToProductImageResultMapper, ToProductImageResult> implements ToProductImageResultService {
|
||||
|
||||
private final CollectionSortService collectionSortService;
|
||||
|
||||
private final UserLikeService userLikeService;
|
||||
|
||||
// 获取未被like的to product\relight的parentId
|
||||
public Long getUnlikedResultParentId(ToProductImageResult toProductImageResult, String url) {
|
||||
// 卫语句处理null情况
|
||||
if (toProductImageResult == null && StringUtil.isNullOrEmpty(url)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 如果需要查询结果对象
|
||||
if (toProductImageResult == null) {
|
||||
toProductImageResult = baseMapper.selectOne(
|
||||
new QueryWrapper<ToProductImageResult>().eq("url", url));
|
||||
}
|
||||
|
||||
// 卫语句处理查询结果为空的情况
|
||||
if (toProductImageResult == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 根据不同类型处理
|
||||
String elementType = toProductImageResult.getElementType();
|
||||
if ("DesignOutfit".equals(elementType)) {
|
||||
return handleDesignOutfitCase(toProductImageResult);
|
||||
} else if ("ToProductImage".equals(elementType)) {
|
||||
// 两种情况 resultType : ToProductImage | Relight
|
||||
return handleToProductImageCase(toProductImageResult);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Long handleDesignOutfitCase(ToProductImageResult result) {
|
||||
UserLike userLike = userLikeService.getByDesignOutfitId(result.getElementId());
|
||||
if (userLike == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CollectionSort collectionSort = collectionSortService.queryCollectionSortByRelation(
|
||||
userLike.getId(), "Design", result.getProjectId());
|
||||
return collectionSort != null ? collectionSort.getId() : null;
|
||||
}
|
||||
|
||||
private Long handleToProductImageCase(ToProductImageResult result) {
|
||||
CollectionSort collectionSort = collectionSortService.queryCollectionSortByRelation(
|
||||
result.getElementId(), result.getResultType(), result.getProjectId());
|
||||
if (Objects.isNull(collectionSort) && result.getElementType().equals("ToProductImage")) {
|
||||
ToProductImageResult toProductImageResult = baseMapper.selectById(result.getElementId());
|
||||
return getUnlikedResultParentId(toProductImageResult, null);
|
||||
}
|
||||
return collectionSort != null ? collectionSort.getParentId() : null;
|
||||
}
|
||||
}
|
||||
125
src/main/java/com/ai/da/service/impl/UserFollowServiceImpl.java
Normal file
125
src/main/java/com/ai/da/service/impl/UserFollowServiceImpl.java
Normal file
@@ -0,0 +1,125 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.common.constant.CommonConstant;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.mapper.primary.UserFollowMapper;
|
||||
import com.ai.da.mapper.primary.entity.UserFollow;
|
||||
import com.ai.da.model.dto.GetFollowListDTO;
|
||||
import com.ai.da.model.vo.AccountFollowVO;
|
||||
import com.ai.da.service.UserFollowService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserFollowServiceImpl extends ServiceImpl<UserFollowMapper, UserFollow> implements UserFollowService {
|
||||
|
||||
private final MinioUtil minioUtil;
|
||||
|
||||
public Long getFolloweeCount(Long accountId) {
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("follower_id", accountId).select("followee_id");
|
||||
return baseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
// 获取某个用户的关注列表 + 按名字查询
|
||||
public List<AccountFollowVO> getFolloweeList(GetFollowListDTO getFollowListDTO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
// 1、判断是否有按用户名查询
|
||||
List<AccountFollowVO> followeeList;
|
||||
if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) {
|
||||
followeeList = baseMapper.getFolloweeListByName(getFollowListDTO.getSearchByName(), accountId);
|
||||
} else {
|
||||
// 2、查全部 分页查询
|
||||
String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC";
|
||||
Integer limit = getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20;
|
||||
Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0;
|
||||
followeeList = baseMapper.getFolloweeListByFollower(accountId, limit, offset, order);
|
||||
}
|
||||
|
||||
if (!followeeList.isEmpty()) {
|
||||
followeeList.forEach(followee -> {
|
||||
String avatar = StringUtil.isNullOrEmpty(followee.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : followee.getAvatar();
|
||||
followee.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
});
|
||||
return followeeList;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Long getFollowerCount(Long accountId) {
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("followee_id", accountId).select("follower_id");
|
||||
return baseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
// 获取某个用户的粉丝列表 + 按名字查询 需返回是否关注该粉丝
|
||||
public List<AccountFollowVO> getFollowerList(GetFollowListDTO getFollowListDTO) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
|
||||
// 获取当前用户的所有粉丝
|
||||
QueryWrapper<UserFollow> qw = new QueryWrapper<>();
|
||||
qw.eq("follower_id", accountId).select("followee_id", "create_time");
|
||||
List<UserFollow> userFollows = baseMapper.selectList(qw);
|
||||
Map<Long, LocalDateTime> followeeMap = userFollows.stream().collect(Collectors.toMap(UserFollow::getFolloweeId, UserFollow::getCreateTime));
|
||||
|
||||
List<AccountFollowVO> followerList;
|
||||
// 1、判断是否有按用户名查询粉丝
|
||||
if (!StringUtil.isNullOrEmpty(getFollowListDTO.getSearchByName())) {
|
||||
followerList = baseMapper.getFollowerListByName(getFollowListDTO.getSearchByName(), accountId);
|
||||
} else {
|
||||
// 2、查全部 分页查询
|
||||
String order = StringUtil.isNullOrEmpty(getFollowListDTO.getOrder()) ? "DESC" : getFollowListDTO.getOrder().equals("DESC") ? "DESC" : "ASC";
|
||||
Integer limit = getFollowListDTO.getSize() > 0 ? getFollowListDTO.getSize() : 20;
|
||||
Integer offset = getFollowListDTO.getPage() > 0 ? (getFollowListDTO.getPage() - 1) * getFollowListDTO.getSize() : 0;
|
||||
followerList = baseMapper.getFollowerListByFollowee(accountId, limit, offset, order);
|
||||
}
|
||||
|
||||
if (!followerList.isEmpty()) {
|
||||
// 判断当前用户是否与粉丝互关
|
||||
followerList.forEach(follower -> {
|
||||
String avatar = StringUtil.isNullOrEmpty(follower.getAvatar()) ? CommonConstant.DEFAULT_AVATAR : follower.getAvatar();
|
||||
follower.setAvatar(minioUtil.getPreSignedUrl(avatar, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
follower.setIsFollow(Objects.isNull(followeeMap.get(follower.getSenderId())) ? 0 : 1);
|
||||
// follower.setFollowTime(followeeMap.get(follower.getUserId()));
|
||||
});
|
||||
return followerList;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Integer getIfFollowed(Long followeeId, Long followerId) {
|
||||
// 设置当前用户是否关注了所查看作品的作者
|
||||
QueryWrapper<UserFollow> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("followee_id", followeeId).eq("follower_id", followerId);
|
||||
UserFollow userFollow = baseMapper.selectOne(queryWrapper);
|
||||
return Objects.isNull(userFollow) ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关注列表
|
||||
*
|
||||
* @param accountId
|
||||
* @return
|
||||
*/
|
||||
public List<Long> getFolloweeList(Long accountId) {
|
||||
QueryWrapper<UserFollow> qw = new QueryWrapper<>();
|
||||
qw.eq("follower_id", accountId).select("followee_id");
|
||||
|
||||
List<UserFollow> userFollows = baseMapper.selectList(qw);
|
||||
return userFollows.stream().map(UserFollow::getFolloweeId).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,9 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -37,6 +40,7 @@ import com.google.common.base.Function;
|
||||
import com.google.gson.Gson;
|
||||
import io.minio.errors.MinioException;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -65,98 +69,54 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, UserLikeGroup> implements UserLikeGroupService {
|
||||
@Resource
|
||||
private UserLikeGroupMapper userLikeGroupMapper;
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
@Resource
|
||||
private CollectionService collectionService;
|
||||
@Resource
|
||||
private UserLikeService userLikeService;
|
||||
@Resource
|
||||
private WorkspaceService workspaceService;
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
@Resource
|
||||
private TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
@Resource
|
||||
private SysFileMapper sysFileMapper;
|
||||
@Resource
|
||||
private LibraryMapper libraryMapper;
|
||||
@Resource
|
||||
private GenerateDetailMapper generateDetailMapper;
|
||||
@Resource
|
||||
private PortfolioMapper portfolioMapper;
|
||||
@Resource
|
||||
private TagsMapper tagsMapper;
|
||||
@Resource
|
||||
private DesignItemDetailService designItemDetailService;
|
||||
@Resource
|
||||
private CollectionElementMapper collectionElementMapper;
|
||||
@Resource
|
||||
private AttributeRetrievalMapper attributeRetrievalMapper;
|
||||
@Resource
|
||||
private ProductImageAttributeMapper productImageAttributeMapper;
|
||||
@Resource
|
||||
private CollectionSortMapper collectionSortMapper;
|
||||
@Resource
|
||||
private ClassificationService classificationService;
|
||||
@Resource
|
||||
private final UserLikeGroupMapper userLikeGroupMapper;
|
||||
private final AccountService accountService;
|
||||
private final CollectionService collectionService;
|
||||
private final UserLikeService userLikeService;
|
||||
private final WorkspaceService workspaceService;
|
||||
private final UserLikeMapper userLikeMapper;
|
||||
private final MinioUtil minioUtil;
|
||||
private final TDesignPythonOutfitMapper designPythonOutfitMapper;
|
||||
private final DesignMapper designMapper;
|
||||
private final MoodboardPositionService moodboardPositionService;
|
||||
private final SysFileMapper sysFileMapper;
|
||||
private final LibraryMapper libraryMapper;
|
||||
private final GenerateDetailMapper generateDetailMapper;
|
||||
private final PortfolioMapper portfolioMapper;
|
||||
private final TagsMapper tagsMapper;
|
||||
private final DesignItemDetailService designItemDetailService;
|
||||
private final CollectionElementMapper collectionElementMapper;
|
||||
private final AttributeRetrievalMapper attributeRetrievalMapper;
|
||||
private final ProductImageAttributeMapper productImageAttributeMapper;
|
||||
private final CollectionSortMapper collectionSortMapper;
|
||||
private final ClassificationService classificationService;
|
||||
// private ProjectMapper projectMapper;
|
||||
private ProjectService projectService;
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
@Resource
|
||||
private LibraryModelPointMapper libraryModelPointMapper;
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private BrandDNAMapper brandDNAMapper;
|
||||
@Resource
|
||||
private BrandRelLibraryMapper brandRelLibraryMapper;
|
||||
@Resource
|
||||
private ThreeDLayoutMapper threeDLayoutMapper;
|
||||
@Resource
|
||||
private ThreeDPatternLayoutMapper threeDPatternLayoutMapper;
|
||||
@Resource
|
||||
private ThreeDDetailMapper threeDDetailMapper;
|
||||
@Resource
|
||||
private ThreeDSimpleMapper threeDSimpleMapper;
|
||||
@Resource
|
||||
private ThreeDModuleMapper threeDModuleMapper;
|
||||
@Resource
|
||||
private ProductImageService productImageService;
|
||||
@Resource
|
||||
private CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
@Resource
|
||||
private CollectionSortService collectionSortService;
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
@Resource
|
||||
private ToProductElementMapper toProductElementMapper;
|
||||
@Resource
|
||||
private ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
private CloudTaskMapper cloudTaskMapper;
|
||||
@Resource
|
||||
private PythonService pythonService;
|
||||
@Resource
|
||||
private CreditsService creditsService;
|
||||
@Resource
|
||||
private PoseTransformationMapper poseTransformationMapper;
|
||||
@Resource
|
||||
private ExportFileMapper exportFileMapper;
|
||||
@Resource
|
||||
private DesignItemDetailCanvasMapper designItemDetailCanvasMapper;
|
||||
private final ProjectService projectService;
|
||||
private final LibraryModelPointMapper libraryModelPointMapper;
|
||||
private final LibraryService libraryService;
|
||||
private final BrandDNAMapper brandDNAMapper;
|
||||
private final BrandRelLibraryMapper brandRelLibraryMapper;
|
||||
private final ThreeDLayoutMapper threeDLayoutMapper;
|
||||
private final ThreeDPatternLayoutMapper threeDPatternLayoutMapper;
|
||||
private final ThreeDDetailMapper threeDDetailMapper;
|
||||
private final ThreeDSimpleMapper threeDSimpleMapper;
|
||||
private final ThreeDModuleMapper threeDModuleMapper;
|
||||
private final ProductImageService productImageService;
|
||||
private final CollectionElementRelModelMapper collectionElementRelModelMapper;
|
||||
private final CollectionSortService collectionSortService;
|
||||
private final GenerateService generateService;
|
||||
private final ToProductElementMapper toProductElementMapper;
|
||||
private final ToProductImageRecordMapper toProductImageRecordMapper;
|
||||
private final ToProductImageResultMapper toProductImageResultMapper;
|
||||
private final ToProductImageResultService toProductImageResultService;
|
||||
private final CloudTaskMapper cloudTaskMapper;
|
||||
private final PythonService pythonService;
|
||||
private final CreditsService creditsService;
|
||||
private final PoseTransformationMapper poseTransformationMapper;
|
||||
private final ExportFileMapper exportFileMapper;
|
||||
private final DesignItemDetailCanvasMapper designItemDetailCanvasMapper;
|
||||
@Value("${redis.key.generateResult}")
|
||||
private String generateResultKey;
|
||||
|
||||
@@ -443,17 +403,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
toProductImageRecord.setUserLikeGroupId(userLikeGroupId);
|
||||
}
|
||||
|
||||
// 处理用户输入的提示词
|
||||
String prompt = toProductImageDTO.getPrompt();
|
||||
String advancedPrompt;
|
||||
//nanobanana模型支持中文,为保证语义,使用这个模型的不翻译
|
||||
if (StringUtil.isNullOrEmpty(prompt)) {
|
||||
advancedPrompt = "Transform this image into a realistic, studio-quality photograph."
|
||||
+ "Pay attention to the size of the garment, the print, and the fabric texture. the white background. 8K, HDR, DOF, soft lighting" +
|
||||
", high detail, high quality,Do not return the original image";
|
||||
} else {
|
||||
advancedPrompt = prompt + "Pay attention to the size of the garment, the print, and the fabric texture. the white background. 8K, HDR, DOF, soft lighting, high detail, high quality,Do not return the original image";
|
||||
}
|
||||
String advancedPrompt = buildAdvancedPrompt(projectId, prompt);
|
||||
// 初始化基础提示词,确保生成高质量的真实图像
|
||||
StringBuilder sb = new StringBuilder("The best quality, masterpiece, real image.");
|
||||
if (!StringUtil.isNullOrEmpty(prompt) && !advanced) {
|
||||
@@ -747,7 +698,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId) {
|
||||
public ToProductElementVO toProductImageElementUpload(MultipartFile file, Long projectId, String type) {
|
||||
if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
|
||||
throw new BusinessException("file.cannot.be.empty");
|
||||
}
|
||||
@@ -762,7 +713,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
// toProductElement.setUserLikeGroupId(userLikeGroupId);
|
||||
toProductElement.setProjectId(projectId);
|
||||
toProductElement.setCreateTime(LocalDateTime.now());
|
||||
// toProductElement.setType(type);
|
||||
toProductElement.setFrameType(type);
|
||||
toProductElementMapper.insert(toProductElement);
|
||||
ToProductElementVO toProductElementVO = CopyUtil.copyObject(toProductElement, ToProductElementVO.class);
|
||||
toProductElementVO.setMinioUrl(toProductElementVO.getUrl());
|
||||
@@ -1909,6 +1860,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
|
||||
// private ProductImageAttribute toAttrDict(AttributeRecognitionJSON attrDictJSON) {
|
||||
// ProductImageAttribute attributeRetrieval = new ProductImageAttribute();
|
||||
|
||||
/// / attributeRetrieval.setImgName(attrDictJSON.getImgName().get(0));
|
||||
/// / attributeRetrieval.setLength(attrDictJSON.getLength().get(0));
|
||||
/// / attributeRetrieval.setSleeveLength(attrDictJSON.getSleeveLength().get(0));
|
||||
@@ -1933,7 +1885,6 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
// }
|
||||
// return attributeRetrieval;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IPage<ProjectVO> getPage(ProjectQueryDTO query) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
@@ -2041,7 +1992,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}
|
||||
if (userLikeGroupVO.getOriginal() == 0) {
|
||||
userLikeGroupVO.setOriginalAccountName(accountService.getById(userLikeGroupVO.getOriginalAccountId()).getUserName());
|
||||
Portfolio byId = portfolioService.getByIdAll(userLikeGroupVO.getOriginalPortfolioId());
|
||||
Portfolio byId = portfolioMapper.getByIdAll(userLikeGroupVO.getOriginalPortfolioId());
|
||||
if (Objects.nonNull(byId)) {
|
||||
String portfolioName = byId.getPortfolioName();
|
||||
userLikeGroupVO.setOriginalPortfolioName(portfolioName);
|
||||
@@ -2177,6 +2128,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
vo.setSketchBoardId(collectionElement.getId());
|
||||
voList.add(vo);
|
||||
}
|
||||
voList.sort(Comparator.comparing(CollectionSketchVO::getSketchBoardId));
|
||||
moduleChooseVO.setBoundingBox(voList);
|
||||
moduleChooseVO.setSketchBoard(list);
|
||||
} else if (module.equals(Module.design.name())) {
|
||||
@@ -2293,6 +2245,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
poseTransformationVO.setId(item.getId());
|
||||
poseTransformationVO.setTaskId(item.getUniqueId());
|
||||
poseTransformationVO.setProductImage(getMinioUrl(item.getProductImage()));
|
||||
poseTransformationVO.setLastFrameProductImage(getMinioUrl(item.getLastFrameProductImage()));
|
||||
poseTransformationVO.setPrompt(item.getPrompt());
|
||||
poseTransformationVO.setGifUrl(getMinioUrl(item.getGifUrl()));
|
||||
poseTransformationVO.setVideoUrl(getMinioUrl(item.getVideoUrl()));
|
||||
poseTransformationVO.setFirstFrameUrl(getMinioUrl(item.getFirstFrameUrl()));
|
||||
@@ -2373,7 +2327,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
if (Objects.nonNull(toProductImageRecord)) {
|
||||
vo.setPrompt(toProductImageRecord.getPrompt());
|
||||
}
|
||||
vo.setParentId(getUnlikedResultParentId(result, null));
|
||||
vo.setParentId(toProductImageResultService.getUnlikedResultParentId(result, null));
|
||||
// 按isLike分类
|
||||
if (result.getIsLike() != null && result.getIsLike() == 1) {
|
||||
likedList.add(vo);
|
||||
@@ -2502,56 +2456,6 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
return duration.toHours() >= 1;
|
||||
}
|
||||
|
||||
// 获取未被like的to product\relight的parentId
|
||||
public Long getUnlikedResultParentId(ToProductImageResult toProductImageResult, String url) {
|
||||
// 卫语句处理null情况
|
||||
if (toProductImageResult == null && StringUtil.isNullOrEmpty(url)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 如果需要查询结果对象
|
||||
if (toProductImageResult == null) {
|
||||
toProductImageResult = toProductImageResultMapper.selectOne(
|
||||
new QueryWrapper<ToProductImageResult>().eq("url", url));
|
||||
}
|
||||
|
||||
// 卫语句处理查询结果为空的情况
|
||||
if (toProductImageResult == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 根据不同类型处理
|
||||
String elementType = toProductImageResult.getElementType();
|
||||
if ("DesignOutfit".equals(elementType)) {
|
||||
return handleDesignOutfitCase(toProductImageResult);
|
||||
} else if ("ToProductImage".equals(elementType)) {
|
||||
// 两种情况 resultType : ToProductImage | Relight
|
||||
return handleToProductImageCase(toProductImageResult);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Long handleDesignOutfitCase(ToProductImageResult result) {
|
||||
UserLike userLike = userLikeService.getByDesignOutfitId(result.getElementId());
|
||||
if (userLike == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CollectionSort collectionSort = collectionSortService.queryCollectionSortByRelation(
|
||||
userLike.getId(), "Design", result.getProjectId());
|
||||
return collectionSort != null ? collectionSort.getId() : null;
|
||||
}
|
||||
|
||||
private Long handleToProductImageCase(ToProductImageResult result) {
|
||||
CollectionSort collectionSort = collectionSortService.queryCollectionSortByRelation(
|
||||
result.getElementId(), result.getResultType(), result.getProjectId());
|
||||
if (Objects.isNull(collectionSort) && result.getElementType().equals("ToProductImage")) {
|
||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(result.getElementId());
|
||||
return getUnlikedResultParentId(toProductImageResult, null);
|
||||
}
|
||||
return collectionSort != null ? collectionSort.getParentId() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -2573,7 +2477,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
collectionElementMapper.updateById(compositeImage);
|
||||
if (!StringUtils.isEmpty(moodBoard.getMoodboardPosition())) {
|
||||
// 合成图位置信息通过collectElementId关联(旧逻辑通过collectionId关联)
|
||||
designService.parseMoodboardPosition(moodBoard.getMoodboardPosition(), compositeImage.getId());
|
||||
moodboardPositionService.parseMoodboardPosition(moodBoard.getMoodboardPosition(), compositeImage.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2945,6 +2849,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
vo.setSketchBoardId(collectionElement.getId());
|
||||
voList.add(vo);
|
||||
}
|
||||
voList.sort(Comparator.comparing(CollectionSketchVO::getSketchBoardId));
|
||||
result.setBoundingBox(voList);
|
||||
}
|
||||
project.setUpdateTime(LocalDateTime.now());
|
||||
@@ -3362,4 +3267,49 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
toProductElementVO.setUrl(minioUtil.getPreSignedUrl(toProductElementVO.getUrl(), 24 * 60));
|
||||
return toProductElementVO;
|
||||
}
|
||||
|
||||
private String buildAdvancedPrompt(Long projectId, String prompt) {
|
||||
String process = projectService.getById(projectId).getProcess();
|
||||
String ageGroup = null;
|
||||
if (!"TO_PRODUCT_IMAGE".equals(process)) {
|
||||
//高级工具转产品图不需要这个字段
|
||||
ageGroup = workspaceService.getWSByProjectId(projectId).getAgeGroup();
|
||||
}
|
||||
String suffixCommon = "Pay attention to the size of the garment, the print, and the fabric texture, real photo, 8K, HDR, DOF, soft lighting, high detail, high quality, Do not return the original image.";
|
||||
String suffixModelAdult = "Transform this image into a real model standing," + suffixCommon;
|
||||
String suffixModelChild = "Transform this image into a real child model standing," + suffixCommon;
|
||||
if ("SINGLE_DESIGN".equals(process) && "Adult".equals(ageGroup)) {
|
||||
if (StringUtil.isNullOrEmpty(prompt)) {
|
||||
return "Transform this image into a real garment showing in the white studio: garment on invisible mannequin" + suffixCommon;
|
||||
} else {
|
||||
return prompt + suffixCommon;
|
||||
}
|
||||
} else if ("SINGLE_DESIGN".equals(process) && "Child".equals(ageGroup)) {
|
||||
if (StringUtil.isNullOrEmpty(prompt)) {
|
||||
return "Transform this image into a real child model stand and wear this garment, in the white studio, facing camera, standing posture." + suffixCommon;
|
||||
} else {
|
||||
return prompt + suffixCommon;
|
||||
}
|
||||
} else if ("SERIES_DESIGN".equals(process) && "Adult".equals(ageGroup)) {
|
||||
if (StringUtil.isNullOrEmpty(prompt)) {
|
||||
return "in the white studio, facing camera, standing posture." + suffixModelAdult;
|
||||
} else {
|
||||
return prompt + suffixModelAdult;
|
||||
}
|
||||
} else if ("SERIES_DESIGN".equals(process) && "Child".equals(ageGroup)) {
|
||||
if (StringUtil.isNullOrEmpty(prompt)) {
|
||||
return "in the white studio, facing camera, standing posture." + suffixModelChild + "\n";
|
||||
} else {
|
||||
return prompt + suffixModelChild;
|
||||
}
|
||||
} else if ("TO_PRODUCT_IMAGE".equals(process)) {
|
||||
if (StringUtil.isNullOrEmpty(prompt)) {
|
||||
throw new BusinessException("Please enter the prompt.");
|
||||
} else {
|
||||
return prompt + suffixCommon;
|
||||
}
|
||||
} else {
|
||||
return "Transform this image into a realistic, studio-quality photograph." + "Pay attention to the size of the garment, the print, and the fabric texture. the white background. 8K, HDR, DOF, soft lighting" + ", high detail, high quality,Do not return the original image";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,17 +12,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
@@ -32,13 +29,10 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserLikeServiceImpl extends ServiceImpl<UserLikeMapper, UserLike> implements UserLikeService {
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
@Resource
|
||||
private UserLikeGroupMapper userLikeGroupMapper;
|
||||
@Resource
|
||||
private DesignItemServiceImpl designItemService;
|
||||
private final UserLikeMapper userLikeMapper;
|
||||
private final UserLikeGroupMapper userLikeGroupMapper;
|
||||
|
||||
@Override
|
||||
public List<UserLikeVO> getGroupDetail(Long userGroupId) {
|
||||
@@ -50,12 +44,6 @@ public class UserLikeServiceImpl extends ServiceImpl<UserLikeMapper, UserLike> i
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return CopyUtil.copyList(userLikes, UserLikeVO.class);
|
||||
// List<Long> designItemIds = userLikes.stream().map(UserLike::getDesignItemId).collect(Collectors.toList());
|
||||
// List<DesignItem> designItems = designItemService.listByIds(designItemIds);
|
||||
// Map<Long,String> idToUrlMap = designItems.stream().collect(Collectors.toMap(DesignItem::getId,DesignItem::getDesignUrl));
|
||||
// return CopyUtil.copyList(userLikes,UserLikeVO.class,(o,d) ->{
|
||||
// d.setUrl(idToUrlMap.get(o.getDesignItemId()));
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.ai.da.common.response.ResultEnum;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.mapper.secondary.AttributeRetrievalMapper;
|
||||
import com.ai.da.mapper.secondary.entity.AttributeRetrieval;
|
||||
import com.ai.da.model.dto.ProjectDTO;
|
||||
import com.ai.da.model.dto.WorkspaceDTO;
|
||||
import com.ai.da.model.dto.WorkspaceSaveDTO;
|
||||
@@ -26,6 +28,7 @@ import io.netty.util.internal.StringUtil;
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.fileupload.FileItemFactory;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -37,6 +40,7 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -610,9 +614,138 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AttributeRetrievalMapper attributeRetrievalMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void maleDataInsert() throws FileNotFoundException {
|
||||
String directoryPath = "C:\\workspace\\fileData\\aida_men_library";
|
||||
String directoryPath = "C:\\Users\\39093\\Desktop\\generated_sketch_gemini_updated_regendered\\unisex\\Post_apocalyptic";
|
||||
List<File> pngFiles = getPNGFiles(directoryPath);
|
||||
for (File pngFile : pngFiles) {
|
||||
String category = Paths.get(directoryPath).getFileName().toString();
|
||||
String fileName = category + "_2_" + pngFile.getName();
|
||||
String tableName = null;
|
||||
SysFile sysFile = new SysFile();
|
||||
sysFile.setName(fileName);
|
||||
sysFile.setLevel1Type("Images");
|
||||
|
||||
AttributeRetrieval attributeRetrievalAttrDict = new AttributeRetrieval();
|
||||
|
||||
attributeRetrievalAttrDict.setStyle("POST_APOCALYPTIC");
|
||||
String absolutePath = pngFile.getAbsolutePath();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("aida-sys-image/images");
|
||||
if (absolutePath.contains("Coat_Jacket") || absolutePath.contains("coat_jacket")) {
|
||||
if (absolutePath.contains("\\male")) {
|
||||
tableName = "male_outwear";
|
||||
sb.append("/male/outwear/");
|
||||
sysFile.setLevel3Type("Male");
|
||||
} else if (absolutePath.contains("\\female")) {
|
||||
tableName = "female_outwear";
|
||||
sb.append("/female/outwear/");
|
||||
sysFile.setLevel3Type("Female");
|
||||
} else if (absolutePath.contains("\\unisex")) {
|
||||
tableName = "female_outwear";
|
||||
sb.append("/female/outwear/");
|
||||
sysFile.setLevel3Type("Female");
|
||||
}
|
||||
sysFile.setLevel2Type("Outwear");
|
||||
attributeRetrievalAttrDict.setImgName("outwear/" + fileName);
|
||||
}
|
||||
if (absolutePath.contains("Pants") || absolutePath.contains("pants")) {
|
||||
if (absolutePath.contains("\\male")) {
|
||||
tableName = "male_bottoms";
|
||||
sb.append("/male/bottoms/");
|
||||
sysFile.setLevel3Type("Male");
|
||||
} else if (absolutePath.contains("\\female")) {
|
||||
tableName = "female_trousers";
|
||||
sb.append("/female/trousers/");
|
||||
sysFile.setLevel3Type("Female");
|
||||
} else if (absolutePath.contains("\\unisex")) {
|
||||
tableName = "female_trousers";
|
||||
sb.append("/female/trousers/");
|
||||
sysFile.setLevel3Type("Female");
|
||||
}
|
||||
sysFile.setLevel2Type("Trousers");
|
||||
attributeRetrievalAttrDict.setImgName("trousers/" + fileName);
|
||||
}
|
||||
if (absolutePath.contains("Top_Shirt") || absolutePath.contains("top_shirt")) {
|
||||
if (absolutePath.contains("\\male")) {
|
||||
tableName = "male_tops";
|
||||
sb.append("/male/tops/");
|
||||
sysFile.setLevel3Type("Male");
|
||||
} else if (absolutePath.contains("\\female")) {
|
||||
tableName = "female_blouse";
|
||||
sb.append("/female/blouse/");
|
||||
sysFile.setLevel3Type("Female");
|
||||
} else if (absolutePath.contains("\\unisex")) {
|
||||
tableName = "female_blouse";
|
||||
sb.append("/female/blouse/");
|
||||
sysFile.setLevel3Type("Female");
|
||||
}
|
||||
sysFile.setLevel2Type("Blouse");
|
||||
attributeRetrievalAttrDict.setImgName("blouse/" + fileName);
|
||||
}
|
||||
if (absolutePath.contains("Dress") || absolutePath.contains("dress")) {
|
||||
tableName = "female_dress";
|
||||
sb.append("/female/dress/");
|
||||
sysFile.setLevel2Type("Dress");
|
||||
sysFile.setLevel3Type("Female");
|
||||
attributeRetrievalAttrDict.setImgName("dress/" + fileName);
|
||||
}
|
||||
if (absolutePath.contains("skirt") || absolutePath.contains("Skirt")) {
|
||||
tableName = "female_skirt";
|
||||
sb.append("/female/skirt/");
|
||||
sysFile.setLevel2Type("Skirt");
|
||||
sysFile.setLevel3Type("Female");
|
||||
attributeRetrievalAttrDict.setImgName("skirt/" + fileName);
|
||||
}
|
||||
sb.append(fileName);
|
||||
String url = sb.toString();
|
||||
sysFile.setUrl(url);
|
||||
sysFile.setMd5(MD5Utils.encryptFile(new FileInputStream(pngFile)));
|
||||
attributeRetrievalMapper.insertSketch(attributeRetrievalAttrDict, tableName);
|
||||
sysFile.setCreateDate(new Date());
|
||||
sysFile.setId(null);
|
||||
sysFileMapper.insert(sysFile);
|
||||
FileItem a = getMultipartFile(pngFile, fileName);
|
||||
MultipartFile multipartFile = new CommonsMultipartFile(a);
|
||||
minioUtil.upload(url.substring(0, 14), url.substring(15), multipartFile, "");
|
||||
System.out.println("上传成功url:" + url);
|
||||
if (absolutePath.contains("unisex")) {
|
||||
if (tableName.equals("female_outwear")) {
|
||||
tableName = "male_outwear";
|
||||
url = url.replace("/female/outwear/", "/male/outwear/");
|
||||
} else if (tableName.equals("female_blouse")) {
|
||||
tableName = "male_tops";
|
||||
attributeRetrievalAttrDict.setImgName("tops/" + fileName);
|
||||
sysFile.setLevel2Type("Tops");
|
||||
url = url.replace("/female/blouse/", "/male/tops/");
|
||||
} else if (tableName.equals("female_trousers")) {
|
||||
tableName = "male_bottoms";
|
||||
attributeRetrievalAttrDict.setImgName("bottoms/" + fileName);
|
||||
sysFile.setLevel2Type("Bottoms");
|
||||
url = url.replace("/female/trousers/", "/male/bottoms/");
|
||||
}
|
||||
minioUtil.upload(url.substring(0, 14), url.substring(15), multipartFile, "");
|
||||
sysFile.setLevel3Type("Male");
|
||||
sysFile.setId(null);
|
||||
sysFile.setUrl(url);
|
||||
sysFileMapper.insert(sysFile);
|
||||
attributeRetrievalMapper.insertSketch(attributeRetrievalAttrDict, tableName);
|
||||
System.out.println("上传成功url:" + url);
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println("结束");
|
||||
}
|
||||
|
||||
//上传衣服
|
||||
|
||||
public void maleDataInsert1() throws FileNotFoundException {
|
||||
String directoryPath = "C:\\Users\\39093\\Desktop\\generated_sketch_gemini_updated_regendered";
|
||||
List<File> pngFiles = getPNGFiles(directoryPath);
|
||||
for (File pngFile : pngFiles) {
|
||||
SysFile sysFile = new SysFile();
|
||||
@@ -898,6 +1031,11 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStyleByProjectId(Long projectId) {
|
||||
return workspaceMapper.getStyleByProjectId(projectId);
|
||||
}
|
||||
|
||||
// 由于在数据库中表设计问题,目前只能通过路径来判断项目中是否存在某一个模特
|
||||
public Boolean checkIfModelExistsInProject(String md5, Long projectId) {
|
||||
QueryWrapper<CollectionElement> qw = new QueryWrapper<>();
|
||||
@@ -974,4 +1112,32 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
return kvs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId) {
|
||||
if (Objects.nonNull(projectId)) {
|
||||
Workspace workspace = getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())) {
|
||||
return workspace.getAgeGroup();
|
||||
}
|
||||
} else if (Objects.nonNull(collectionId) && collectionId != 0) {
|
||||
List<CollectionElement> byCollectionId = getByCollectionId(collectionId);
|
||||
if (byCollectionId != null && !byCollectionId.isEmpty()) {
|
||||
projectId = byCollectionId.get(0).getProjectId();
|
||||
if (projectId != null && projectId != 0L) {
|
||||
Workspace workspace = getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())) {
|
||||
return workspace.getAgeGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return AgeGroup.ADULT.getValue();
|
||||
}
|
||||
|
||||
private List<CollectionElement> getByCollectionId(Long collectionId) {
|
||||
QueryWrapper<CollectionElement> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(CollectionElement::getCollectionId, collectionId);
|
||||
return collectionElementMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ spring.datasource.primary.username=aida_con
|
||||
spring.datasource.primary.password=123456
|
||||
|
||||
spring.datasource.secondary.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.secondary.jdbcUrl=jdbc:mysql://18.167.251.121:33008/attribute_retrieval_new_style?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
spring.datasource.secondary.jdbcUrl=jdbc:mysql://18.167.251.121:33008/attribute_retrieval_style?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
spring.datasource.secondary.username=aida_con
|
||||
spring.datasource.secondary.password=123456
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ spring.datasource.primary.username=root
|
||||
spring.datasource.primary.password=QWa998345
|
||||
|
||||
spring.datasource.secondary.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.secondary.jdbcUrl=jdbc:mysql://18.167.251.121:33008/attribute_retrieval_new_style?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
spring.datasource.secondary.jdbcUrl=jdbc:mysql://18.167.251.121:33008/attribute_retrieval_style?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
spring.datasource.secondary.username=aida_con
|
||||
spring.datasource.secondary.password=123456
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<if test="affiliateId != null">
|
||||
AND f.id = #{affiliateId}
|
||||
</if>
|
||||
AND f.is_deleted = 0
|
||||
</where>
|
||||
<choose>
|
||||
<when test="sortField != null and sortField != ''">
|
||||
@@ -83,6 +84,7 @@
|
||||
AND f.id = #{affiliateId}
|
||||
</if>
|
||||
</where>
|
||||
AND f.is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectAllAffiliateUsername" resultType="java.util.Map">
|
||||
|
||||
@@ -27,5 +27,10 @@
|
||||
<select id="selectWorkspacePage" resultMap="BaseResultMap">
|
||||
select * from workspace where is_deleted = 0
|
||||
</select>
|
||||
<select id="getStyleByProjectId" resultType="java.lang.String">
|
||||
select name from style where id =
|
||||
(select style_id from workspace_rel_style where workspace_id =
|
||||
(select id from workspace where project_id = #{projectId}))
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
<result column="opening_type" property="openingType" />
|
||||
<result column="subtype" property="subtype" />
|
||||
</resultMap>
|
||||
<insert id="insertSketch">
|
||||
INSERT INTO ${tableName} (img_name, style)
|
||||
VALUES (#{attributeRetrievalAttrDict.imgName}, #{attributeRetrievalAttrDict.style})
|
||||
</insert>
|
||||
|
||||
<select id="getSystemSketchPool" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
@@ -110,4 +114,21 @@
|
||||
${tableName}
|
||||
WHERE img_name = #{replace}
|
||||
</select>
|
||||
<select id="getCountByStyle" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
count(*)
|
||||
FROM
|
||||
${tableName}
|
||||
WHERE style = #{style} and deprecated = 0
|
||||
</select>
|
||||
|
||||
<select id="getOneSystemSketchRadom" resultType="java.lang.String">
|
||||
SELECT
|
||||
img_name
|
||||
FROM
|
||||
${tableName}
|
||||
WHERE style = #{style}
|
||||
and deprecated = 0
|
||||
ORDER BY ID LIMIT #{randomNum},1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -186,6 +186,9 @@ order.creation.failed=Order creation failed.
|
||||
order.deduction.failed=Order deduction failed.
|
||||
order.query.failed=Order query failed.
|
||||
do.not.have.the.permission.to.delete.this.comment=You do not have the permission to delete this comment.
|
||||
unknow.affiliate=Unknown affiliate id.
|
||||
unknown.operationType=Unknown operationType.
|
||||
unknown.mode=unknown mode
|
||||
|
||||
# 可能会报异常
|
||||
# Informative:
|
||||
@@ -231,6 +234,7 @@ OVERALL=Overall
|
||||
TOPS=Tops
|
||||
BOTTOMS=Bottoms
|
||||
OUTWEAR=Outwear
|
||||
OTHERS=Others
|
||||
BLOUSE=Blouse
|
||||
DRESS=Dress
|
||||
TROUSERS=Trousers
|
||||
|
||||
@@ -171,6 +171,7 @@ OVERALL=Général
|
||||
TOPS=Hauts
|
||||
BOTTOMS=Bas
|
||||
OUTWEAR=Manteau
|
||||
OTHERS=Autres
|
||||
BLOUSE=Chemisier
|
||||
DRESS=Robe
|
||||
TROUSERS=Pantalons
|
||||
|
||||
@@ -171,6 +171,7 @@ OVERALL=Complessivo
|
||||
TOPS=Parte superiore
|
||||
BOTTOMS=Parte inferiore
|
||||
OUTWEAR=Capo esterno
|
||||
OTHERS=Altri
|
||||
BLOUSE=Camicetta
|
||||
DRESS=Vestito
|
||||
TROUSERS=Pantaloni
|
||||
|
||||
@@ -171,6 +171,7 @@ OVERALL=全体
|
||||
TOPS=トップス
|
||||
BOTTOMS=ボトムス
|
||||
OUTWEAR=アウターウェア
|
||||
OTHERS=その他
|
||||
BLOUSE=ブラウス
|
||||
DRESS=ドレス
|
||||
TROUSERS=ズボン
|
||||
|
||||
@@ -171,6 +171,7 @@ OVERALL=전체
|
||||
TOPS=상의
|
||||
BOTTOMS=하의
|
||||
OUTWEAR=외투
|
||||
OTHERS=기타
|
||||
BLOUSE=블라우스
|
||||
DRESS=드레스
|
||||
TROUSERS=바지
|
||||
|
||||
@@ -171,6 +171,7 @@ OVERALL=Общий
|
||||
TOPS=Топы
|
||||
BOTTOMS=Штаны
|
||||
OUTWEAR=Верхняя одежда
|
||||
OTHERS=ДРУГИЕ
|
||||
BLOUSE=Блуза
|
||||
DRESS=Платье
|
||||
TROUSERS=Брюки
|
||||
|
||||
@@ -171,6 +171,7 @@ OVERALL=โดยรวม
|
||||
TOPS=เสื้อ
|
||||
BOTTOMS=กางเกง
|
||||
OUTWEAR=เสื้อผ้านอก
|
||||
OTHERS=อื่นๆ
|
||||
BLOUSE=เสื้อผ้าผู้หญิง
|
||||
DRESS=ชุดเดรส
|
||||
TROUSERS=กางเกงขายาว
|
||||
|
||||
@@ -171,6 +171,7 @@ OVERALL=Tổng thể
|
||||
TOPS=Áo đầu
|
||||
BOTTOMS=Quần
|
||||
OUTWEAR=Áo ngoại cỡ
|
||||
OTHERS=KHÁC
|
||||
BLOUSE=Áo sơ mi nữ
|
||||
DRESS=Váy
|
||||
TROUSERS=Quần dài
|
||||
|
||||
@@ -182,6 +182,9 @@ order.creation.failed=订单创建失败
|
||||
order.deduction.failed=订单金额扣除失败。
|
||||
order.query.failed=订单查询失败
|
||||
do.not.have.the.permission.to.delete.this.comment=您没有权限删除此评论
|
||||
unknow.affiliate=未知推广者id
|
||||
unknown.operationType=未知操作类型
|
||||
unknown.mode=未知模式
|
||||
|
||||
# 可能会报异常
|
||||
# Informative:
|
||||
@@ -225,6 +228,7 @@ OVERALL=整体
|
||||
TOPS=上装
|
||||
BOTTOMS=下装
|
||||
OUTWEAR=外套
|
||||
OTHERS=其他
|
||||
BLOUSE=上衣
|
||||
DRESS=连衣裙
|
||||
TROUSERS=裤子
|
||||
|
||||
Reference in New Issue
Block a user