|
|
@@ -1,6 +1,6 @@
|
|
|
package com.yhlxj.web.mirror;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.annotation.NoSubmit;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
@@ -11,24 +11,35 @@ import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.SearchResult;
|
|
|
import com.ejlchina.searcher.util.MapBuilder;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
+import com.yhlxj.dao.mapper.GroupsRelationMapper;
|
|
|
+import com.yhlxj.dao.mapper.MidjourneyPaintingPlazaMapper;
|
|
|
import com.yhlxj.dao.mapper.midjourney.MidjourneyUserMapper;
|
|
|
import com.yhlxj.dao.model.dto.*;
|
|
|
+import com.yhlxj.dao.model.entity.GroupsRelation;
|
|
|
+import com.yhlxj.dao.model.entity.MidjourneyPaintingPlaza;
|
|
|
import com.yhlxj.dao.model.entity.MidjourneyUser;
|
|
|
import com.yhlxj.dao.model.entity.MidjourneyUserConversation;
|
|
|
-import com.yhlxj.dao.model.response.SubmitResult;
|
|
|
+import com.yhlxj.dao.model.views.MidjourneyPaintingUserView;
|
|
|
+import com.yhlxj.dao.model.views.MidjourneyUserPaintingDayRecordView;
|
|
|
+import com.yhlxj.dao.model.views.MidjourneyUserPaintingRecordView;
|
|
|
import com.yhlxj.redis.RedisService;
|
|
|
import com.yhlxj.service.midjourney.MidjourneyService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.Cookie;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
-/**
|
|
|
+/** server/镜像服务/mj绘画
|
|
|
* @author zwhui
|
|
|
* @date 2024/4/23 10:31
|
|
|
*/
|
|
|
@@ -38,6 +49,11 @@ import java.util.List;
|
|
|
@RequestMapping("/applets/midjourney")
|
|
|
public class MidjourneyController {
|
|
|
|
|
|
+ @Value("${midjourney.drawUrl}")
|
|
|
+ private String midjourneyDrawUrl;
|
|
|
+
|
|
|
+ private final HttpServletResponse response;
|
|
|
+
|
|
|
private final MidjourneyUserMapper midjourneyUserMapper;
|
|
|
|
|
|
private final HttpServletRequest request;
|
|
|
@@ -45,46 +61,43 @@ public class MidjourneyController {
|
|
|
private final MidjourneyService midjourneyService;
|
|
|
|
|
|
private final BeanSearcher beanSearcher;
|
|
|
-
|
|
|
+
|
|
|
private final RedisService redisService;
|
|
|
|
|
|
+ private final GroupsRelationMapper groupsRelationMapper;
|
|
|
+
|
|
|
+ private final MidjourneyPaintingPlazaMapper midjourneyPaintingPlazaMapper;
|
|
|
+
|
|
|
public MidjourneyUser getUser(){
|
|
|
String userToken = request.getHeader("user-token");
|
|
|
- MidjourneyUser midjourneyUser = (MidjourneyUser) redisService.get(RedisService.key.MIDJOURNEY_USER.getName() + userToken);
|
|
|
+
|
|
|
+ MidjourneyUser midjourneyUser = midjourneyUserMapper.selectOne(Wrappers.lambdaQuery(MidjourneyUser.class)
|
|
|
+ .eq(MidjourneyUser::getUserToken, userToken).last("limit 1"));
|
|
|
if (midjourneyUser == null){
|
|
|
- midjourneyUser = midjourneyUserMapper.selectOne(Wrappers.lambdaQuery(MidjourneyUser.class)
|
|
|
- .eq(MidjourneyUser::getUserToken, userToken).last("limit 1"));
|
|
|
- if (midjourneyUser == null){
|
|
|
- throw new BusinessRuntimeException("账号不存在,请重新登录");
|
|
|
- }
|
|
|
- redisService.set(RedisService.key.MIDJOURNEY_USER.getName() + userToken, midjourneyUser, RedisService.key.MIDJOURNEY_USER.getTimeout());
|
|
|
- Object fastNum = redisService.get(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + midjourneyUser.getId());
|
|
|
- if (fastNum == null){
|
|
|
- redisService.set(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + midjourneyUser.getId(), midjourneyUser.getMjFastNum(), RedisService.key.MIDJOURNEY_FAST_LIMIT.getTimeout());
|
|
|
- }
|
|
|
- Object relaxNum = redisService.get(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + midjourneyUser.getId());
|
|
|
- if (relaxNum == null){
|
|
|
- if (midjourneyUser.getMjRelaxNum() != null){
|
|
|
- redisService.set(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + midjourneyUser.getId(), midjourneyUser.getMjRelaxNum(), RedisService.key.MIDJOURNEY_RELAX_LIMIT.getTimeout());
|
|
|
- }
|
|
|
- }
|
|
|
- }else {
|
|
|
- Object fastNum = redisService.get(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + midjourneyUser.getId());
|
|
|
- if (fastNum == null){
|
|
|
- redisService.set(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + midjourneyUser.getId(), midjourneyUser.getMjFastNum(), RedisService.key.MIDJOURNEY_FAST_LIMIT.getTimeout());
|
|
|
- }else {
|
|
|
- midjourneyUser.setMjFastNum(Integer.parseInt(fastNum.toString()));
|
|
|
- }
|
|
|
- Object relaxNum = redisService.get(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + midjourneyUser.getId());
|
|
|
- if (relaxNum == null){
|
|
|
- if (midjourneyUser.getMjRelaxNum() != null){
|
|
|
- redisService.set(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + midjourneyUser.getId(), midjourneyUser.getMjRelaxNum(), RedisService.key.MIDJOURNEY_RELAX_LIMIT.getTimeout());
|
|
|
- }
|
|
|
- }else {
|
|
|
- midjourneyUser.setMjRelaxNum(Integer.parseInt(relaxNum.toString()));
|
|
|
- }
|
|
|
+ throw new BusinessRuntimeException("账号不存在,请重新登录");
|
|
|
+ }
|
|
|
+ if(!redisService.hasKey(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + midjourneyUser.getId())){
|
|
|
+ redisService.set(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + midjourneyUser.getId(),midjourneyUser.getMjFastNum());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!redisService.hasKey(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + midjourneyUser.getId())){
|
|
|
+ redisService.set(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + midjourneyUser.getId(),midjourneyUser.getMjRelaxNum());
|
|
|
}
|
|
|
+ Long relationId = midjourneyUser.getRelationId();
|
|
|
+ GroupsRelation relation = groupsRelationMapper.selectById(relationId);
|
|
|
+ midjourneyUser.setAqType(relation.getAqType());
|
|
|
+
|
|
|
return midjourneyUser;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/midjourneyMirrorWithToken/{userToken}")
|
|
|
+ public void midjourneyMirrorWithToken(@PathVariable String userToken) throws IOException {
|
|
|
+ Cookie cookie = new Cookie("userToken", userToken);
|
|
|
+ cookie.setMaxAge(31536000);
|
|
|
+ cookie.setPath("/");
|
|
|
+ response.addCookie(cookie);
|
|
|
+ response.sendRedirect(midjourneyDrawUrl);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -96,25 +109,42 @@ public class MidjourneyController {
|
|
|
if (user.getExpireTime().before(new Date())){
|
|
|
throw BusinessRuntimeException.getInstance("账号已过期");
|
|
|
}
|
|
|
- if (user.getMode() == 1){
|
|
|
- num = redisService.decr(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + user.getId(), 1L);
|
|
|
- if (num < 0) {
|
|
|
- user.setMode(2);
|
|
|
- redisService.incr(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + user.getId(), 1L);
|
|
|
- }
|
|
|
- }
|
|
|
- if (user.getMode() == 2){
|
|
|
- Object relax = redisService.get(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + user.getId());
|
|
|
- if (relax != null){
|
|
|
- num = redisService.decr(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + user.getId(), 1L);
|
|
|
- if (num < 0){
|
|
|
- redisService.incr(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + user.getId(), 1L);
|
|
|
- }
|
|
|
- }else {
|
|
|
- num = null;
|
|
|
- }
|
|
|
- }
|
|
|
- return num;
|
|
|
+ if (user.getMode() == 1){
|
|
|
+
|
|
|
+ num = redisService.decr(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + user.getId(), 1L);
|
|
|
+
|
|
|
+ if (num < 0) {
|
|
|
+ user.setMode(2);
|
|
|
+ midjourneyUserMapper.update(null, Wrappers.lambdaUpdate(MidjourneyUser.class).eq(MidjourneyUser::getId, user.getId()).set(MidjourneyUser::getMode, user.getMode()));
|
|
|
+ redisService.incr(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + user.getId(), 1L);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ int i = midjourneyUserMapper.decFastNum(user.getId(), 1, user.getMjFastNum());
|
|
|
+ if (i == 0) {
|
|
|
+ redisService.incr(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + user.getId(), 1L);
|
|
|
+ throw BusinessRuntimeException.getInstance("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (user.getMode() == 2){
|
|
|
+ Object relax = redisService.get(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + user.getId());
|
|
|
+
|
|
|
+ if (relax != null){
|
|
|
+ num = redisService.decr(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + user.getId(), 1L);
|
|
|
+ if (num < 0){
|
|
|
+ redisService.incr(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + user.getId(), 1L);
|
|
|
+ }else {
|
|
|
+ int i = midjourneyUserMapper.decRelaxNum(user.getId(), 1, user.getMjRelaxNum());
|
|
|
+ if (i == 0) {
|
|
|
+ redisService.incr(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + user.getId(), 1L);
|
|
|
+ throw BusinessRuntimeException.getInstance("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ num = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return num;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -123,32 +153,34 @@ public class MidjourneyController {
|
|
|
public void recoverUserLimit(Long id,Integer mode,Long num){
|
|
|
if (mode == 1){
|
|
|
redisService.incr(RedisService.key.MIDJOURNEY_FAST_LIMIT.getName() + id, 1L);
|
|
|
+ midjourneyUserMapper.incrFastNum(id, 1);
|
|
|
}
|
|
|
if (mode == 2){
|
|
|
if (num != null){
|
|
|
redisService.incr(RedisService.key.MIDJOURNEY_RELAX_LIMIT.getName() + id, 1L);
|
|
|
+ midjourneyUserMapper.incrRelaxNum(id, 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 同步数据库
|
|
|
- */
|
|
|
- public void syncUser(Long id,Integer mode,Long num){
|
|
|
- log.info("同步次数 id:{},mode:{},num:{}",id,mode,num);
|
|
|
- if (num == null){
|
|
|
- return;
|
|
|
- }
|
|
|
- LambdaUpdateWrapper<MidjourneyUser> wrapper = Wrappers.lambdaUpdate(MidjourneyUser.class)
|
|
|
- .eq(MidjourneyUser::getId, id);
|
|
|
- if (mode == 1){
|
|
|
- wrapper.set(MidjourneyUser::getMjFastNum, num);
|
|
|
- }
|
|
|
- if (mode == 2){
|
|
|
- wrapper.set(MidjourneyUser::getMjRelaxNum, num);
|
|
|
- }
|
|
|
- midjourneyUserMapper.update(null, wrapper);
|
|
|
- }
|
|
|
+ ///**
|
|
|
+ // * 同步数据库
|
|
|
+ // */
|
|
|
+ //public void syncUser(Long id,Integer mode,Long num){
|
|
|
+ // log.info("同步次数 id:{},mode:{},num:{}",id,mode,num);
|
|
|
+ // if (num == null){
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // LambdaUpdateWrapper<MidjourneyUser> wrapper = Wrappers.lambdaUpdate(MidjourneyUser.class)
|
|
|
+ // .eq(MidjourneyUser::getId, id);
|
|
|
+ // if (mode == 1){
|
|
|
+ // wrapper.set(MidjourneyUser::getMjFastNum, num);
|
|
|
+ // }
|
|
|
+ // if (mode == 2){
|
|
|
+ // wrapper.set(MidjourneyUser::getMjRelaxNum, num);
|
|
|
+ // }
|
|
|
+ // midjourneyUserMapper.update(null, wrapper);
|
|
|
+ //}
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -167,7 +199,7 @@ public class MidjourneyController {
|
|
|
@PostMapping("/submit/imagine")
|
|
|
@NoSubmit
|
|
|
public Result<MidjourneyUserConversation> submitImagine(@RequestBody SubmitImagineDTO submitImagineDTO) {
|
|
|
- log.info("提交Imagine任务,提示:{},base64数组长度:{}",submitImagineDTO.getPrompt(),submitImagineDTO.getBase64Array());
|
|
|
+ log.info("提交Imagine任务,提示:{}",submitImagineDTO.getPrompt());
|
|
|
MidjourneyUser user = getUser();
|
|
|
Long num = checkUserLimit(user);
|
|
|
if (num != null && num < 0){
|
|
|
@@ -180,7 +212,7 @@ public class MidjourneyController {
|
|
|
recoverUserLimit(user.getId(), user.getMode(),num);
|
|
|
throw BusinessRuntimeException.getInstance(e.getMessage());
|
|
|
}
|
|
|
- syncUser(user.getId(), user.getMode(), num);
|
|
|
+ //syncUser(user.getId(), user.getMode(), num);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(conversation);
|
|
|
}
|
|
|
|
|
|
@@ -198,12 +230,12 @@ public class MidjourneyController {
|
|
|
}
|
|
|
MidjourneyUserConversation conversation;
|
|
|
try {
|
|
|
- conversation = midjourneyService.submitDescribe(user, submitDescribeDTO.getBase64(), submitDescribeDTO.getBotType());
|
|
|
+ conversation = midjourneyService.submitDescribe(user, submitDescribeDTO.getBotType(),submitDescribeDTO.getBase64());
|
|
|
} catch (Exception e) {
|
|
|
recoverUserLimit(user.getId(), user.getMode(),num);
|
|
|
throw BusinessRuntimeException.getInstance(e.getMessage());
|
|
|
}
|
|
|
- syncUser(user.getId(), user.getMode(), num);
|
|
|
+ //syncUser(user.getId(), user.getMode(), num);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(conversation);
|
|
|
}
|
|
|
|
|
|
@@ -226,7 +258,7 @@ public class MidjourneyController {
|
|
|
recoverUserLimit(user.getId(), user.getMode(),num);
|
|
|
throw BusinessRuntimeException.getInstance(e.getMessage());
|
|
|
}
|
|
|
- syncUser(user.getId(), user.getMode(), num);
|
|
|
+ //syncUser(user.getId(), user.getMode(), num);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(conversation);
|
|
|
}
|
|
|
|
|
|
@@ -236,7 +268,7 @@ public class MidjourneyController {
|
|
|
@PostMapping("/submit/modal")
|
|
|
@NoSubmit
|
|
|
public Result<MidjourneyUserConversation> submitModal(@RequestBody SubmitModalDTO submitModalDTO) {
|
|
|
- log.info("提交Modal任务,taskId:{},提示:{},base64数组长度:{}",submitModalDTO.getTaskId(),submitModalDTO.getPrompt(),submitModalDTO.getMaskBase64());
|
|
|
+ log.info("提交Modal任务,taskId:{},提示:{}",submitModalDTO.getTaskId(),submitModalDTO.getPrompt());
|
|
|
MidjourneyUser user = getUser();
|
|
|
Long num = checkUserLimit(user);
|
|
|
if (num != null && num < 0){
|
|
|
@@ -249,7 +281,7 @@ public class MidjourneyController {
|
|
|
recoverUserLimit(user.getId(), user.getMode(),num);
|
|
|
throw BusinessRuntimeException.getInstance(e.getMessage());
|
|
|
}
|
|
|
- syncUser(user.getId(), user.getMode(), num);
|
|
|
+ //syncUser(user.getId(), user.getMode(), num);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(conversation);
|
|
|
}
|
|
|
|
|
|
@@ -272,7 +304,7 @@ public class MidjourneyController {
|
|
|
recoverUserLimit(user.getId(), user.getMode(),num);
|
|
|
throw BusinessRuntimeException.getInstance(e.getMessage());
|
|
|
}
|
|
|
- syncUser(user.getId(), user.getMode(), num);
|
|
|
+ //syncUser(user.getId(), user.getMode(), num);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(conversation);
|
|
|
}
|
|
|
|
|
|
@@ -281,14 +313,17 @@ public class MidjourneyController {
|
|
|
*/
|
|
|
@PostMapping("/submit/action")
|
|
|
@NoSubmit
|
|
|
- public Result<SubmitResult> action(@RequestBody SubmitActionDTO actionDTO) {
|
|
|
+ public Result<Object> action(@RequestBody SubmitActionDTO actionDTO) {
|
|
|
log.info("任务id:{},执行动作:{}",actionDTO.getTaskId(),actionDTO.getCustomId());
|
|
|
MidjourneyUser user = getUser();
|
|
|
- Long num = checkUserLimit(user);
|
|
|
- if (num != null && num < 0){
|
|
|
- throw BusinessRuntimeException.getInstance("次数已用完");
|
|
|
+ Long num = 0L;
|
|
|
+ if (!actionDTO.getCustomId().contains("BOOKMARK")) {
|
|
|
+ num = checkUserLimit(user);
|
|
|
+ if (num != null && num < 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("次数已用完");
|
|
|
+ }
|
|
|
}
|
|
|
- SubmitResult conversation;
|
|
|
+ Object conversation;
|
|
|
try {
|
|
|
conversation = midjourneyService.submitAction(user, actionDTO.getTaskId(), actionDTO.getCustomId(),num, actionDTO.getBotType());
|
|
|
} catch (Exception e) {
|
|
|
@@ -346,7 +381,7 @@ public class MidjourneyController {
|
|
|
}
|
|
|
midjourneyUser.setMode(mode);
|
|
|
midjourneyUserMapper.updateById(midjourneyUser);
|
|
|
- redisService.del(RedisService.key.MIDJOURNEY_USER.getName() + midjourneyUser.getUserToken());
|
|
|
+ //redisService.del(RedisService.key.MIDJOURNEY_USER.getName() + midjourneyUser.getUserToken());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
|
|
|
@@ -360,4 +395,59 @@ public class MidjourneyController {
|
|
|
String json = new String(bytes, StandardCharsets.UTF_8);
|
|
|
midjourneyService.notifyHook(json);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * mj绘画广场
|
|
|
+ */
|
|
|
+ @GetMapping("/get/painting")
|
|
|
+ public Result<SearchResult<MidjourneyPaintingUserView>> getPaintingCollect() {
|
|
|
+ SearchResult<MidjourneyPaintingUserView> search = beanSearcher.search(MidjourneyPaintingUserView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
+ .build());
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 复制mj绘画广场 提示词
|
|
|
+ */
|
|
|
+ @PostMapping("/painting/copy/{id}")
|
|
|
+ public Result<String> resetPaintingCopyNum(@PathVariable Long id) {
|
|
|
+ MidjourneyPaintingPlaza midjourneyPaintingPlaza = midjourneyPaintingPlazaMapper.selectById(id);
|
|
|
+ if (midjourneyPaintingPlaza != null) {
|
|
|
+ midjourneyPaintingPlazaMapper.updatePaintingCopyNum(id);
|
|
|
+ }
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户绘画记录
|
|
|
+ */
|
|
|
+ @GetMapping("/get/painting/record")
|
|
|
+ public Result<SearchResult<MidjourneyUserPaintingDayRecordView>> getPaintingRecord(String prompt, Boolean bookmark) {
|
|
|
+ MidjourneyUser user = getUser();
|
|
|
+ String condition = String.format(" and mc.user_id = %s", user.getId());
|
|
|
+ if (StrUtil.isNotBlank(prompt)) {
|
|
|
+ condition += String.format(" and mc.prompt like '%%%s%%'", prompt);
|
|
|
+ }
|
|
|
+ if (bookmark != null) {
|
|
|
+ condition += String.format(" and mc.bookmark is %s", bookmark);
|
|
|
+ }
|
|
|
+ SearchResult<MidjourneyUserPaintingDayRecordView> search = beanSearcher.search(MidjourneyUserPaintingDayRecordView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
+ .put("condition", condition)
|
|
|
+ .orderBy(MidjourneyUserPaintingRecordView::getCreatedTime).desc()
|
|
|
+ .build());
|
|
|
+ String dateSql;
|
|
|
+ for (MidjourneyUserPaintingDayRecordView e : search.getDataList()) {
|
|
|
+ String date = e.getDate();
|
|
|
+ dateSql = String.format(" and DATE_FORMAT(mc.created_time,'%%Y-%%m-%%d') = '%s'", date);
|
|
|
+ List<MidjourneyUserPaintingRecordView> list = beanSearcher.searchAll(MidjourneyUserPaintingRecordView.class, MapUtils.builder()
|
|
|
+ .put("condition", condition)
|
|
|
+ .put("date", dateSql)
|
|
|
+ .orderBy(MidjourneyUserPaintingRecordView::getCreatedTime).desc()
|
|
|
+ .build());
|
|
|
+ e.setList(list);
|
|
|
+ }
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
+ }
|
|
|
}
|