|
|
@@ -1,5 +1,6 @@
|
|
|
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 cn.hutool.http.HttpUtil;
|
|
|
@@ -9,19 +10,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
+import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.mapper.AccountMapper;
|
|
|
import com.cyksj.mapper.AccountUpdatePasswordRecordMapper;
|
|
|
import com.cyksj.mapper.manage.AutoUpdateAccountPwdLogMapper;
|
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
|
-import com.cyksj.model.entity.Account;
|
|
|
-import com.cyksj.model.entity.AccountUpdatePasswordRecord;
|
|
|
-import com.cyksj.model.entity.AutoUpdateAccountPwdLog;
|
|
|
-import com.cyksj.model.entity.OrderDon;
|
|
|
+import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.excel.ExcelAccountData;
|
|
|
import com.cyksj.model.manage.views.AccountView;
|
|
|
import com.cyksj.model.views.CmsUserVO;
|
|
|
import com.cyksj.model.views.ExpiredAccountDataView;
|
|
|
import com.cyksj.service.mange.CmsAccountService;
|
|
|
+import com.cyksj.service.mange.CmsGroupService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.param.Operator;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
@@ -29,9 +30,11 @@ import com.google.common.collect.Lists;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
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;
|
|
|
|
|
|
/**
|
|
|
@@ -52,6 +55,8 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
|
|
|
|
|
|
private final BeanSearcher beanSearcher;
|
|
|
|
|
|
+ private final CmsGroupService cmsGroupService;
|
|
|
+
|
|
|
@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));
|
|
|
@@ -157,6 +162,41 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
+ public void analysisChatGPTAccount(Long goodsId, Long skuId, List<Object> accountList) {
|
|
|
+ if (CollUtil.isEmpty(accountList)) {
|
|
|
+ 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];
|
|
|
+ String apiKey = part[2];
|
|
|
+ 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);
|
|
|
+ insert.setApiKey(apiKey);
|
|
|
+ insert.setGoodsId(goodsId);
|
|
|
+ this.save(insert);
|
|
|
+
|
|
|
+ //自动配置车队
|
|
|
+ GroupsTrips groupsTrips = new GroupsTrips();
|
|
|
+ groupsTrips.setSkuId(skuId);
|
|
|
+ groupsTrips.setAccountId(insert.getId());
|
|
|
+ cmsGroupService.issuance(groupsTrips);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
public String getRealAddressByIP(String ip) {
|
|
|
if (StrUtil.isBlank(ip)) {
|
|
|
return "unknown";
|