|
@@ -2,6 +2,7 @@ package com.yhlxj.service.midjourney.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.core.util.URLUtil;
|
|
import cn.hutool.core.util.URLUtil;
|
|
@@ -1290,6 +1291,26 @@ public class MidjourneyServiceImpl implements MidjourneyService {
|
|
|
notifyHook(Jsons.toJson(json));
|
|
notifyHook(Jsons.toJson(json));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //上传图片到cos
|
|
|
|
|
+ List<MidjourneyUserConversation> imgConversations = conversationMapper.selectList(Wrappers.lambdaQuery(MidjourneyUserConversation.class)
|
|
|
|
|
+ .eq(MidjourneyUserConversation::getStatus,"SUCCESS").notLike(MidjourneyUserConversation::getImageUrl,"cdn.mj.galaxydvd.com")
|
|
|
|
|
+ .ge(MidjourneyUserConversation::getCreatedTime, DateUtil.offsetMinute(new Date(), -60 * 24)).orderByAsc(MidjourneyUserConversation::getId).last(" limit 10"));
|
|
|
|
|
+
|
|
|
|
|
+ for (MidjourneyUserConversation conversation : imgConversations) {
|
|
|
|
|
+ TASK_EXECUTOR.execute(() -> {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String imageUrl = conversation.getImageUrl();
|
|
|
|
|
+ if (StringUtil.isNotBlank(imageUrl)) {
|
|
|
|
|
+ conversation.setImageUrl(uploadPic(imageUrl, "conversation"+conversation.getId()));
|
|
|
|
|
+ conversationMapper.updateById(conversation);
|
|
|
|
|
+ TASK_IMG_SIZE_MAP.remove(conversation.getTaskId());
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
|
+ log.error("上传图片失败",e);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|