|
|
@@ -2,6 +2,7 @@ package com.cyksj.service.mange.account;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@@ -216,81 +217,98 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
|
|
|
try {
|
|
|
accountList.forEach(accountData -> {
|
|
|
Map<String, Object> map = Jsons.toMap(accountData);
|
|
|
- String[] part = map.get("0").toString().split(regex);
|
|
|
- if (part.length >= 2) {
|
|
|
- String account = part[0];
|
|
|
- String password = part[1];
|
|
|
- //重复不再重新插入
|
|
|
- if (accountCommonService.checkIsDupAccount(goodsId, account)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- Account insert = new Account();
|
|
|
+ Account insert = new Account();
|
|
|
+ insert.setGoodsId(goodsId);
|
|
|
+ if (map.keySet().size() >= 6) {
|
|
|
+ String account = map.get("0").toString();
|
|
|
+ String password = map.get("1").toString();
|
|
|
+ String friend = map.get("2").toString();
|
|
|
+ String work = map.get("3").toString();
|
|
|
+ String parents = map.get("4").toString();
|
|
|
+ String country = map.get("5").toString();
|
|
|
+ String secret = String.format(Constant.NEW_APPID_SECRET, friend, work, parents, country);
|
|
|
insert.setAccount(account);
|
|
|
insert.setPassword(password);
|
|
|
- if (part.length > 2 && part.length < 9) {
|
|
|
- //google36、辅助邮箱
|
|
|
- //46 Google Bard
|
|
|
- if (special_email_goods_ids.contains(goodsId)) {
|
|
|
- String email = part[2];
|
|
|
- insert.setEmail(email);
|
|
|
- } else {
|
|
|
- String apiKey = part[2];
|
|
|
- insert.setApiKey(apiKey);
|
|
|
- }
|
|
|
- }
|
|
|
- insert.setGoodsId(goodsId);
|
|
|
- if (goodsId.equals(31l)) {
|
|
|
- if (part.length >= 9) {
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
- String country = part[part.length - 1];
|
|
|
- if (country.contains("国")) {
|
|
|
- sb.append(part[part.length - 1]);
|
|
|
- sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[part.length - 2]);
|
|
|
- sb.append(Constant.ONE_EMPTY);
|
|
|
+ insert.setSecret(secret);
|
|
|
+ } else {
|
|
|
+ String[] part = map.get("0").toString().split(regex);
|
|
|
+ if (part.length >= 2) {
|
|
|
+ String account = part[0];
|
|
|
+ String password = part[1];
|
|
|
+ insert.setAccount(account);
|
|
|
+ insert.setPassword(password);
|
|
|
+ if (part.length > 2 && part.length < 9) {
|
|
|
+ //google36、辅助邮箱
|
|
|
+ //46 Google Bard
|
|
|
+ if (special_email_goods_ids.contains(goodsId)) {
|
|
|
+ String email = part[2];
|
|
|
+ insert.setEmail(email);
|
|
|
+ } else {
|
|
|
+ String apiKey = part[2];
|
|
|
+ insert.setApiKey(apiKey);
|
|
|
}
|
|
|
- for (int i = 2; i < part.length; i++) {
|
|
|
- if (part[i].contains("朋友")) {
|
|
|
- sb.append("朋友");
|
|
|
+ }
|
|
|
+ if (goodsId.equals(31l)) {
|
|
|
+ if (part.length >= 9) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ String country = part[part.length - 1];
|
|
|
+ if (country.contains("国")) {
|
|
|
+ sb.append(part[part.length - 1]);
|
|
|
sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[i + 1]);
|
|
|
- i++;
|
|
|
- }
|
|
|
- if (part[i].contains("工作")) {
|
|
|
- sb.append("工作");
|
|
|
+ sb.append(part[part.length - 2]);
|
|
|
sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[i + 1]);
|
|
|
- i++;
|
|
|
}
|
|
|
- if (part[i].contains("父母")) {
|
|
|
- sb.append("父母");
|
|
|
- sb.append(Constant.ONE_EMPTY);
|
|
|
- sb.append(part[i + 1]);
|
|
|
- i++;
|
|
|
+ for (int i = 2; i < part.length; i++) {
|
|
|
+ if (part[i].contains("朋友")) {
|
|
|
+ sb.append("朋友");
|
|
|
+ sb.append(Constant.ONE_EMPTY);
|
|
|
+ sb.append(part[i + 1]);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (part[i].contains("工作")) {
|
|
|
+ sb.append("工作");
|
|
|
+ sb.append(Constant.ONE_EMPTY);
|
|
|
+ sb.append(part[i + 1]);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ if (part[i].contains("父母")) {
|
|
|
+ sb.append("父母");
|
|
|
+ sb.append(Constant.ONE_EMPTY);
|
|
|
+ sb.append(part[i + 1]);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
}
|
|
|
+ insert.setSecret(sb.toString());
|
|
|
+ } else {
|
|
|
+ insert.setSecret(Constant.AMERICA_APPID_SECRET);
|
|
|
}
|
|
|
- insert.setSecret(sb.toString());
|
|
|
- } else {
|
|
|
- insert.setSecret(Constant.AMERICA_APPID_SECRET);
|
|
|
}
|
|
|
}
|
|
|
- this.save(insert);
|
|
|
- //是否存在未发车的车队
|
|
|
- GroupsTrips waiting = cmsGroupService.getOne(Wrappers.lambdaQuery(GroupsTrips.class)
|
|
|
- .eq(GroupsTrips::getSkuId, skuId)
|
|
|
- .eq(GroupsTrips::getStatus, GroupsTrips.Status.waiting).last("limit 1"));
|
|
|
- if (waiting != null) {
|
|
|
- waiting.setAccountId(insert.getId());
|
|
|
- try {
|
|
|
- cmsGroupService.setAccount(waiting);
|
|
|
- } catch (Exception e) {
|
|
|
- //自动配置车队
|
|
|
- setGroupsTrips(skuId, insert.getId());
|
|
|
- }
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ String account = insert.getAccount();
|
|
|
+ if (StrUtil.isEmpty(account)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //重复不再重新插入
|
|
|
+ if (accountCommonService.checkIsDupAccount(goodsId, account)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.save(insert);
|
|
|
+ //是否存在未发车的车队
|
|
|
+ GroupsTrips waiting = cmsGroupService.getOne(Wrappers.lambdaQuery(GroupsTrips.class)
|
|
|
+ .eq(GroupsTrips::getSkuId, skuId)
|
|
|
+ .eq(GroupsTrips::getStatus, GroupsTrips.Status.waiting).last("limit 1"));
|
|
|
+ if (waiting != null) {
|
|
|
+ waiting.setAccountId(insert.getId());
|
|
|
+ try {
|
|
|
+ cmsGroupService.setAccount(waiting);
|
|
|
+ } catch (Exception e) {
|
|
|
//自动配置车队
|
|
|
setGroupsTrips(skuId, insert.getId());
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //自动配置车队
|
|
|
+ setGroupsTrips(skuId, insert.getId());
|
|
|
}
|
|
|
});
|
|
|
} catch (Exception e) {
|