|
|
@@ -7,6 +7,7 @@ import com.fs.feishu.service.IFeishuAccountService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
@@ -56,11 +57,16 @@ public class FeishuAccountServiceImpl implements IFeishuAccountService {
|
|
|
if (account.getStatus() == null) {
|
|
|
account.setStatus(1);
|
|
|
}
|
|
|
- int result = feishuAccountMapper.insertFeishuAccount(account);
|
|
|
- if (result > 0) {
|
|
|
- clearFeishuCompanyUserCache(account.getCompanyId(), account.getCompanyUserId());
|
|
|
+ try {
|
|
|
+ int result = feishuAccountMapper.insertFeishuAccount(account);
|
|
|
+ if (result > 0) {
|
|
|
+ clearFeishuCompanyUserCache(account.getCompanyId(), account.getCompanyUserId());
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
+ log.error("添加飞书账号失败,原因:数据库已存在该飞书AppId", e);
|
|
|
+ throw new RuntimeException("添加飞书账号失败,原因:数据库已存在该飞书AppId");
|
|
|
}
|
|
|
- return result;
|
|
|
}
|
|
|
|
|
|
@Override
|