Ver código fonte

Merge branch 'master' into pre

zoujiajian 2 anos atrás
pai
commit
340877de39

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/AccountView.java

@@ -155,4 +155,7 @@ public class AccountView {
 
     @DbField("a.type")
     private Integer accountType;
+
+    @DbIgnore
+    private Boolean isMjMirror;
 }

+ 11 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -115,11 +115,13 @@ public class CmsAccountController {
 
 	private final ChatGptAccountService chatGptAccountService;
 
+	private final MidjourneyAccountMapper midjourneyAccountMapper;
+
 	private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
 
 	@GetMapping("/get")
 	@SaCheckPermission("account:view")
-	public Result<SearchResult<AccountView>> get(Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths) {
+	public Result<SearchResult<AccountView>> get(Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths, Boolean isMjMirror) {
 		MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
 		if (StrUtil.isNotEmpty(expiryStartTime) || StrUtil.isNotEmpty(expiryEndTime)) {
 			mapBuilder.field(AccountView::getExpiryTime, expiryStartTime, expiryEndTime)
@@ -165,6 +167,9 @@ public class CmsAccountController {
 				extra_sql += String.format(" (select min(expiry_time) from (select gt.id from groups_trips where account_id = a.id) gt inner join groups_relation gr on gr.groups_id = gt.id) > '%s'", endOfDay);
 			}
 		}
+		if (isMjMirror != null) {
+			extra_sql += String.format(" and %s (select 1 from midjourney_account ma where ma.account_id = a.id limit 1)", isMjMirror ? "EXISTS" : "NOT EXISTS");
+		}
 		if (StrUtil.isNotEmpty(extra_sql)) {
 			mapBuilder.put("extra_sql", extra_sql);
 		}
@@ -200,6 +205,11 @@ public class CmsAccountController {
 								.last("limit 1")))
 						.ifPresent(email -> accountView.setEmailPassword(email.getPassword()));
 			}
+			if (accountView.getGoodsId() == 26) {
+				Integer count = midjourneyAccountMapper.selectCount(Wrappers.lambdaQuery(MidjourneyAccount.class)
+						.eq(MidjourneyAccount::getAccountId, accountView.getId()));
+				accountView.setIsMjMirror(count > 0 ? true : false);
+			}
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}