|
|
@@ -200,38 +200,48 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
|
|
|
if (!redisService.setNx(cache, goodsId, RedisService.key.IMPORT_ACCOUNT_CACHE_KEY.getTimeout())) {
|
|
|
throw BusinessRuntimeException.getInstance("后台程序正在导入账号中...");
|
|
|
}
|
|
|
- accountList.forEach(accountData -> {
|
|
|
- Map<String, Object> map = Jsons.toMap(accountData);
|
|
|
- String[] part = map.get("0").toString().split("----");
|
|
|
- if (part.length >= 2) {
|
|
|
- String account = part[0];
|
|
|
- String password = part[1];
|
|
|
- int count = this.count(Wrappers.lambdaQuery(Account.class)
|
|
|
- .eq(Account::getAccount, account)
|
|
|
- .eq(Account::getGoodsId, goodsId));
|
|
|
- if (count > 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- Account insert = new Account();
|
|
|
- insert.setAccount(account);
|
|
|
- insert.setPassword(password);
|
|
|
- if (part.length > 2) {
|
|
|
- String apiKey = part[2];
|
|
|
- insert.setApiKey(apiKey);
|
|
|
- }
|
|
|
- insert.setGoodsId(goodsId);
|
|
|
- if (goodsId.equals(31l)) {
|
|
|
- insert.setSecret(Constant.AMERICA_APPID_SECRET);
|
|
|
+ String regex;
|
|
|
+ if (goodsId == 29l) {
|
|
|
+ regex = "\\|";
|
|
|
+ } else {
|
|
|
+ regex = "----";
|
|
|
+ }
|
|
|
+ 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];
|
|
|
+ int count = this.count(Wrappers.lambdaQuery(Account.class)
|
|
|
+ .eq(Account::getAccount, account)
|
|
|
+ .eq(Account::getGoodsId, goodsId));
|
|
|
+ if (count > 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Account insert = new Account();
|
|
|
+ insert.setAccount(account);
|
|
|
+ insert.setPassword(password);
|
|
|
+ if (part.length > 2) {
|
|
|
+ String apiKey = part[2];
|
|
|
+ insert.setApiKey(apiKey);
|
|
|
+ }
|
|
|
+ insert.setGoodsId(goodsId);
|
|
|
+ if (goodsId.equals(31l)) {
|
|
|
+ insert.setSecret(Constant.AMERICA_APPID_SECRET);
|
|
|
+ }
|
|
|
+ this.save(insert);
|
|
|
+
|
|
|
+ //自动配置车队
|
|
|
+ GroupsTrips groupsTrips = new GroupsTrips();
|
|
|
+ groupsTrips.setSkuId(skuId);
|
|
|
+ groupsTrips.setAccountId(insert.getId());
|
|
|
+ cmsGroupService.issuance(groupsTrips, null);
|
|
|
}
|
|
|
- this.save(insert);
|
|
|
-
|
|
|
- //自动配置车队
|
|
|
- GroupsTrips groupsTrips = new GroupsTrips();
|
|
|
- groupsTrips.setSkuId(skuId);
|
|
|
- groupsTrips.setAccountId(insert.getId());
|
|
|
- cmsGroupService.issuance(groupsTrips, null);
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(StringUtil.getErrorText(e));
|
|
|
+ }
|
|
|
redisService.del(cache);
|
|
|
}
|
|
|
}
|