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