Browse Source

平台辅助邮箱导入账号

zoujiajian 3 years ago
parent
commit
888a922be7

+ 5 - 0
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -129,4 +129,9 @@ public interface Constant {
 	String CORP_SERVICE_FOLLOWS_KEY = "corp_service_follows_key";
 
 	String NEW_USER_WELFARE_KEY = "new_user_welfare_key";
+
+	/**
+	 * 特殊格式平台邮箱
+	 */
+	String SPECIAL_GOODS_ACCOUNT_IMPORT_KEY = "special_goods_account_import_key";
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/request/AccountGroupsReq.java

@@ -58,4 +58,9 @@ public class AccountGroupsReq {
 	private String remark;
 
 	private String verifyCodes;
+
+	/**
+	 * 辅助邮箱
+	 */
+	private String email;
 }

+ 16 - 6
netflix-service/src/main/java/com/cyksj/service/mange/account/CmsAccountServiceImpl.java

@@ -22,6 +22,7 @@ import com.cyksj.model.views.ExpiredAccountDataView;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.mange.CmsAccountService;
 import com.cyksj.service.mange.CmsGroupService;
+import com.cyksj.service.sys.SysConfigService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.param.Operator;
 import com.ejlchina.searcher.util.MapUtils;
@@ -31,10 +32,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.util.*;
 
 /**
  * @author chan
@@ -58,6 +56,8 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 
 	private final RedisService redisService;
 
+	private final SysConfigService sysConfigService;
+
 	@Override
 	public IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startTime, String endTime, String now, Long offset, Long limit) {
 		return accountMapper.getExpiredAccountView(isCorpWx, customerService, goodsId, skuId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, now, new Page<>(offset, limit));
@@ -200,6 +200,15 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 		if (!redisService.setNx(cache, goodsId, RedisService.key.IMPORT_ACCOUNT_CACHE_KEY.getTimeout())) {
 			throw BusinessRuntimeException.getInstance("后台程序正在导入账号中...");
 		}
+		List<Long> special_email_goods_ids = new ArrayList<>();
+		SysConfig sysConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
+				.eq(SysConfig::getSysKey, Constant.SPECIAL_GOODS_ACCOUNT_IMPORT_KEY).last("limit 1"));
+		if (sysConfig != null) {
+			try {
+				special_email_goods_ids.addAll(Jsons.parseList(sysConfig.getSysValue(), Long.class));
+			} catch (Exception e) {
+			}
+		}
 		String regex;
 		if (goodsId == 29l) {
 			regex = "\\|";
@@ -223,8 +232,9 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 					insert.setAccount(account);
 					insert.setPassword(password);
 					if (part.length > 2) {
-						//google辅助邮箱
-						if (goodsId.equals(36l)) {
+						//google36、辅助邮箱
+						//46 Google Bard
+						if (special_email_goods_ids.contains(goodsId)) {
 							String email = part[2];
 							insert.setEmail(email);
 						} else {

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

@@ -122,7 +122,7 @@ public class CmsAccountController {
 		}
 		String extra_sql = StrUtil.EMPTY;
 		if (expiredAll != null && expiredAll) {
-			extra_sql += "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=4,true,false)) = 1";
+			extra_sql += "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=3,true,false)) = 1";
 		}
 
 		if (noChangeMonths != null) {
@@ -206,7 +206,7 @@ public class CmsAccountController {
         }
 	    String extra_sql = StrUtil.EMPTY;
 	    if (expiredAll != null && expiredAll) {
-		    extra_sql += "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=4,true,false)) = 1";
+		    extra_sql += "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=3,true,false)) = 1";
 	    }
 
 	    if (noChangeMonths != null) {
@@ -712,7 +712,7 @@ public class CmsAccountController {
 			builder.field(AccountView::getCustomerServiceId, userId);
 		}
 		//需要修改密码
-		String extra_sql = "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=4,true,false)) = 1";
+		String extra_sql = "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=3,true,false)) = 1";
 		builder.put("extra_sql", extra_sql);
 		Number expireAll = beanSearcher.searchCount(AccountView.class, builder.build());
 		//存在过期