|
@@ -1,6 +1,8 @@
|
|
|
package org.jeecg.modules.okki.account.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.modules.okki.account.entity.OkkiAccount;
|
|
|
import org.jeecg.modules.okki.account.mapper.OkkiAccountMapper;
|
|
@@ -9,8 +11,6 @@ import org.jeecg.modules.okki.utils.HttpClientUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.TreeMap;
|
|
@@ -32,6 +32,11 @@ public class OkkiAccountServiceImpl extends ServiceImpl<OkkiAccountMapper, OkkiA
|
|
|
private String CLIENT_SECRET;
|
|
|
@Override
|
|
|
public void insertAccount(OkkiAccount okkiAccount) {
|
|
|
+ //查询账号是否已存在
|
|
|
+ OkkiAccount one = this.getOne(new LambdaQueryWrapper<OkkiAccount>().eq(OkkiAccount::getAccount, okkiAccount.getAccount()));
|
|
|
+ if (one != null) {
|
|
|
+ throw new RuntimeException("账号已存在,请新增其他账号!");
|
|
|
+ }
|
|
|
//创建小二账号
|
|
|
// 请求okki平台接口
|
|
|
Map<String, String> query = new TreeMap<>();
|
|
@@ -64,6 +69,8 @@ public class OkkiAccountServiceImpl extends ServiceImpl<OkkiAccountMapper, OkkiA
|
|
|
//关联站点
|
|
|
if (!okkiAccount.getSiteIds().equals("")) {
|
|
|
bindSites(okkiAccount);
|
|
|
+ }else {
|
|
|
+ this.save(okkiAccount);
|
|
|
}
|
|
|
}else {
|
|
|
throw new RuntimeException(jsonObject.get("msg").toString());
|