xw 1 deň pred
rodič
commit
a26b012810

+ 27 - 27
fs-company/src/main/java/com/fs/company/controller/feishu/FeishuAccountController.java

@@ -30,7 +30,7 @@ public class FeishuAccountController extends BaseController {
     @Autowired
     private ICompanyUserService companyUserService;
 
-    /** ??????????б??????????????? */
+    /** 鏌ヨ�鎴戠殑椋炰功璐﹀彿鍒楄〃 */
     @GetMapping("/my/list")
     public TableDataInfo myList(@RequestParam(required = false) Integer status,
                                 @RequestParam(required = false) String phone,
@@ -44,7 +44,7 @@ public class FeishuAccountController extends BaseController {
         return getDataTable(list);
     }
 
-    /** ???????????б?????????????/?????? */
+    /** 鏌ヨ�浼佷笟涓嬮�涔﹁处鍙峰垪琛�紙绠$悊鍛樺彲鏌ョ湅/鍒嗛厤锛� */
     @GetMapping("/company/list")
     public TableDataInfo companyList(@RequestParam(required = false) Integer status,
                                      @RequestParam(required = false) String phone,
@@ -86,8 +86,8 @@ public class FeishuAccountController extends BaseController {
         return AjaxResult.success(account);
     }
 
-    /** ????????? - ????? */
-    @Log(title = "?????????", businessType = BusinessType.INSERT)
+    /** 椋炰功璐﹀彿 - 鏂板�鎴戠殑璐﹀彿 */
+    @Log(title = "椋炰功璐﹀彿", businessType = BusinessType.INSERT)
     @PostMapping("/my")
     public AjaxResult addMy(@RequestBody FeishuAccount account) {
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
@@ -97,8 +97,8 @@ public class FeishuAccountController extends BaseController {
         return toAjax(feishuAccountService.insertFeishuAccount(account));
     }
 
-    /** ????????? - ???????? */
-    @Log(title = "?????????", businessType = BusinessType.INSERT)
+    /** 椋炰功璐﹀彿 - 鎵归噺鏂板�鎴戠殑璐﹀彿 */
+    @Log(title = "椋炰功璐﹀彿", businessType = BusinessType.INSERT)
     @PostMapping("/my/batch")
     public AjaxResult addMyBatch(@RequestBody List<FeishuAccount> accounts) {
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
@@ -107,41 +107,41 @@ public class FeishuAccountController extends BaseController {
             account.setCompanyUserId(user.getUserId());
         }
         int count = feishuAccountService.insertFeishuAccountBatch(accounts);
-        return AjaxResult.success("??????? " + count + " ?????");
+        return AjaxResult.success("鎴愬姛鏂板� " + count + " 鏉¤处鍙�");
     }
 
-    /** ?????????? - ?????????????? */
-    @Log(title = "??????????", businessType = BusinessType.INSERT)
+    /** 椋炰功璐﹀彿 - 鏂板�浼佷笟璐﹀彿锛堝垎閰嶇粰鍏朵粬浜哄憳锛� */
+    @Log(title = "浼佷笟椋炰功璐﹀彿", businessType = BusinessType.INSERT)
     @PostMapping("/company")
     public AjaxResult addCompany(@RequestBody FeishuAccount account) {
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
         account.setCompanyId(user.getCompanyId());
         if (account.getCompanyUserId() == null) {
-            throw new CustomException("????????????");
+            throw new CustomException("璇烽€夋嫨褰掑睘浜哄憳");
         }
         requireCompanyUser(account.getCompanyUserId(), user.getCompanyId());
         validateAccountPayload(account, true);
         return toAjax(feishuAccountService.insertFeishuAccount(account));
     }
 
-    /** ?????????? - ?????????????????? */
-    @Log(title = "??????????", businessType = BusinessType.INSERT)
+    /** 椋炰功璐﹀彿 - 鎵归噺鏂板�浼佷笟璐﹀彿锛堝垎閰嶇粰鎸囧畾浜哄憳锛� */
+    @Log(title = "浼佷笟椋炰功璐﹀彿", businessType = BusinessType.INSERT)
     @PostMapping("/company/batch")
     public AjaxResult addCompanyBatch(@RequestBody List<FeishuAccount> accounts) {
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
         prepareBatchAccounts(accounts, user.getCompanyId(), true);
         int count = feishuAccountService.insertFeishuAccountBatch(accounts);
-        return AjaxResult.success("??????? " + count + " ?????");
+        return AjaxResult.success("鎴愬姛鏂板� " + count + " 鏉¤处鍙�");
     }
 
-    @Log(title = "Feishu account", businessType = BusinessType.INSERT)
+    @Log(title = "椋炰功璐﹀彿", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody FeishuAccount account) {
         return addMy(account);
     }
 
-    /** ????????? - ?? */
-    @Log(title = "?????????", businessType = BusinessType.UPDATE)
+    /** 椋炰功璐﹀彿 - 淇�敼鎴戠殑璐﹀彿 */
+    @Log(title = "椋炰功璐﹀彿", businessType = BusinessType.UPDATE)
     @PutMapping("/my")
     public AjaxResult editMy(@RequestBody FeishuAccount account) {
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
@@ -153,8 +153,8 @@ public class FeishuAccountController extends BaseController {
         return toAjax(feishuAccountService.updateFeishuAccount(account));
     }
 
-    /** ?????????? - ??/???·??? */
-    @Log(title = "??????????", businessType = BusinessType.UPDATE)
+    /** 椋炰功璐﹀彿 - 淇�敼浼佷笟璐﹀彿/鏇存崲褰掑睘浜哄憳 */
+    @Log(title = "浼佷笟椋炰功璐﹀彿", businessType = BusinessType.UPDATE)
     @PutMapping("/company")
     public AjaxResult editCompany(@RequestBody FeishuAccount account) {
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
@@ -170,13 +170,13 @@ public class FeishuAccountController extends BaseController {
         return toAjax(feishuAccountService.updateFeishuAccount(account));
     }
 
-    @Log(title = "Feishu account", businessType = BusinessType.UPDATE)
+    @Log(title = "椋炰功璐﹀彿", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody FeishuAccount account) {
         return editMy(account);
     }
 
-    @Log(title = "?????????", businessType = BusinessType.DELETE)
+    @Log(title = "椋炰功璐﹀彿", businessType = BusinessType.DELETE)
     @DeleteMapping("/my/{id}")
     public AjaxResult removeMy(@PathVariable Long id) {
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
@@ -185,7 +185,7 @@ public class FeishuAccountController extends BaseController {
         return toAjax(feishuAccountService.deleteFeishuAccountById(id));
     }
 
-    @Log(title = "??????????", businessType = BusinessType.DELETE)
+    @Log(title = "浼佷笟椋炰功璐﹀彿", businessType = BusinessType.DELETE)
     @DeleteMapping("/company/{id}")
     public AjaxResult removeCompany(@PathVariable Long id) {
         CompanyUser user = SecurityUtils.getLoginUser().getUser();
@@ -194,7 +194,7 @@ public class FeishuAccountController extends BaseController {
         return toAjax(feishuAccountService.deleteFeishuAccountById(id));
     }
 
-    @Log(title = "Feishu account", businessType = BusinessType.DELETE)
+    @Log(title = "椋炰功璐﹀彿", businessType = BusinessType.DELETE)
     @DeleteMapping("/{id}")
     public AjaxResult remove(@PathVariable Long id) {
         return removeMy(id);
@@ -216,10 +216,10 @@ public class FeishuAccountController extends BaseController {
 
     private void validateAccountPayload(FeishuAccount account, boolean requireSecret) {
         if (StringUtils.isBlank(account.getAppId())) {
-            throw new CustomException("AppId???????");
+            throw new CustomException("AppId涓嶈兘涓虹┖");
         }
         if (requireSecret && StringUtils.isBlank(account.getAppSecret())) {
-            throw new CustomException("AppSecret???????");
+            throw new CustomException("AppSecret涓嶈兘涓虹┖");
         }
     }
 
@@ -232,17 +232,17 @@ public class FeishuAccountController extends BaseController {
     private void requireCompanyUser(Long companyUserId, Long companyId) {
         CompanyUser companyUser = companyUserService.selectCompanyUserById(companyUserId);
         if (companyUser == null || !companyId.equals(companyUser.getCompanyId())) {
-            throw new CustomException("所选人员不属于当前企业");
+            throw new CustomException("鎵€閫変汉鍛樹笉灞炰簬褰撳墠浼佷笟");
         }
     }
 
     private void prepareBatchAccounts(List<FeishuAccount> accounts, Long companyId, boolean requireSales) {
         if (accounts == null || accounts.isEmpty()) {
-            throw new CustomException("请至少添加一个账号");
+            throw new CustomException("鑷冲皯浼犲叆涓€鏉¤处鍙�");
         }
         Long companyUserId = accounts.get(0).getCompanyUserId();
         if (requireSales && companyUserId == null) {
-            throw new CustomException("请选择销售人员");
+            throw new CustomException("璇烽€夋嫨褰掑睘浜哄憳");
         }
         if (requireSales) {
             requireCompanyUser(companyUserId, companyId);

+ 2 - 2
fs-service/src/main/java/com/fs/feishu/service/IFeishuAccountService.java

@@ -27,12 +27,12 @@ public interface IFeishuAccountService {
     void validateCompanyScope(FeishuAccount account, Long companyId);
 
     /**
-     * �询查询当�用户�用�书账�(负载�衡选��用账�)
+     * 查询当�用户�用飞书账�(负载�衡选��用账�)
      */
     Long pollSendAccountId(Long companyUserId);
 
     /**
-     * 解���账�,��指定账�时使用指定账�,�指定则轮�
+     * 解���账�,支�指定账�时使用指定账�,�指定则轮询
      */
     Long resolveSendAccountId(Long companyUserId, Long feishuAccountId);
 

+ 12 - 12
fs-service/src/main/java/com/fs/feishu/service/impl/FeishuAccountServiceImpl.java

@@ -64,7 +64,7 @@ public class FeishuAccountServiceImpl implements IFeishuAccountService {
     @Transactional(rollbackFor = Exception.class)
     public int insertFeishuAccountBatch(List<FeishuAccount> accounts) {
         if (accounts == null || accounts.isEmpty()) {
-            throw new CustomException("请至少添加一个账号");
+            throw new CustomException("鑷冲皯浼犲叆涓€鏉¤处鍙�");
         }
         int count = 0;
         for (int i = 0; i < accounts.size(); i++) {
@@ -72,7 +72,7 @@ public class FeishuAccountServiceImpl implements IFeishuAccountService {
             try {
                 count += insertFeishuAccount(account);
             } catch (CustomException e) {
-                throw new CustomException("第" + (i + 1) + "个账号添加失败: " + e.getMessage());
+                throw new CustomException("绗�" + (i + 1) + "鏉¤处鍙锋柊澧炲け璐�: " + e.getMessage());
             }
         }
         return count;
@@ -92,30 +92,30 @@ public class FeishuAccountServiceImpl implements IFeishuAccountService {
     @Override
     public void validateOwnership(FeishuAccount account, Long companyId, Long companyUserId) {
         if (account == null) {
-            throw new CustomException("飞书账号不存??");
+            throw new CustomException("璐﹀彿涓嶅瓨鍦�");
         }
         if (companyId != null && account.getCompanyId() != null && !companyId.equals(account.getCompanyId())) {
-            throw new CustomException("无权操作该账??");
+            throw new CustomException("鏉冮檺鏍¢獙涓嶉€氳繃");
         }
         if (companyUserId != null && account.getCompanyUserId() != null && !companyUserId.equals(account.getCompanyUserId())) {
-            throw new CustomException("无权操作该账??");
+            throw new CustomException("鏉冮檺鏍¢獙涓嶉€氳繃");
         }
     }
 
     @Override
     public void validateCompanyScope(FeishuAccount account, Long companyId) {
         if (account == null) {
-            throw new CustomException("飞书账号不存??");
+            throw new CustomException("璐﹀彿涓嶅瓨鍦�");
         }
         if (companyId == null || account.getCompanyId() == null || !companyId.equals(account.getCompanyId())) {
-            throw new CustomException("无权操作该账??");
+            throw new CustomException("鏉冮檺鏍¢獙涓嶉€氳繃");
         }
     }
 
     @Override
     public Long pollSendAccountId(Long companyUserId) {
         if (companyUserId == null) {
-            throw new CustomException("用户ID不能为空");
+            throw new CustomException("鐢ㄦ埛ID涓嶈兘涓虹┖");
         }
         return clientPool.pollNextAccountId(companyUserId);
     }
@@ -123,7 +123,7 @@ public class FeishuAccountServiceImpl implements IFeishuAccountService {
     @Override
     public Long resolveSendAccountId(Long companyUserId, Long feishuAccountId) {
         if (companyUserId == null) {
-            throw new CustomException("用户ID不能为空");
+            throw new CustomException("鐢ㄦ埛ID涓嶈兘涓虹┖");
         }
         if (feishuAccountId != null) {
             requireEnabledAccount(feishuAccountId, companyUserId);
@@ -135,13 +135,13 @@ public class FeishuAccountServiceImpl implements IFeishuAccountService {
     private FeishuAccount requireEnabledAccount(Long feishuAccountId, Long companyUserId) {
         FeishuAccount account = feishuAccountMapper.selectById(feishuAccountId);
         if (account == null) {
-            throw new CustomException("飞书账号不存??");
+            throw new CustomException("璐﹀彿涓嶅瓨鍦�");
         }
         if (!companyUserId.equals(account.getCompanyUserId())) {
-            throw new CustomException("该账号不属于当前用户");
+            throw new CustomException("璇ヨ处鍙蜂笉灞炰簬褰撳墠鐢ㄦ埛");
         }
         if (!Integer.valueOf(1).equals(account.getStatus())) {
-            throw new CustomException("账号不可??: " + account.getErrorMsg());
+            throw new CustomException("璐﹀彿涓嶅彲鐢�: " + account.getErrorMsg());
         }
         return account;
     }