|
|
@@ -45,6 +45,20 @@ public class CompanyWxAccountController extends BaseController
|
|
|
List<CompanyWxAccount> list = companyWxAccountService.selectCompanyWxAccountListCompany(companyWxEnterpriseAccount);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询我的企微账号列表(仅当前登录人)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('company:companyWx:myList')")
|
|
|
+ @GetMapping("/myList")
|
|
|
+ public TableDataInfo myList(CompanyWxAccount companyWxAccount)
|
|
|
+ {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ companyWxAccount.setCompanyUserId(loginUser.getUser().getUserId());
|
|
|
+ startPage();
|
|
|
+ List<CompanyWxAccount> list = companyWxAccountService.selectCompanyWxAccountListCompany(companyWxAccount);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
/**
|
|
|
* 查询企微账号列表
|
|
|
*/
|
|
|
@@ -68,6 +82,21 @@ public class CompanyWxAccountController extends BaseController
|
|
|
return util.exportExcel(list, "companyAccount");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 导出我的企微账号列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('company:companyWx:myExport')")
|
|
|
+ @Log(title = "我的企微账号", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/myExport")
|
|
|
+ public AjaxResult myExport(CompanyWxAccount companyWxAccount)
|
|
|
+ {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ companyWxAccount.setCompanyUserId(loginUser.getUser().getUserId());
|
|
|
+ List<CompanyWxAccount> list = companyWxAccountService.selectCompanyWxAccountListCompany(companyWxAccount);
|
|
|
+ ExcelUtil<CompanyWxAccount> util = new ExcelUtil<CompanyWxAccount>(CompanyWxAccount.class);
|
|
|
+ return util.exportExcel(list, "myCompanyAccount");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取企微账号详细信息
|
|
|
*/
|
|
|
@@ -85,6 +114,19 @@ public class CompanyWxAccountController extends BaseController
|
|
|
@Log(title = "企微账号", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody CompanyWxAccount account){
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ account.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ account.setCreateUser(loginUser.getUser().getUserId());
|
|
|
+ return toAjax(companyWxAccountService.insertCompanyWxAccount(account));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增我的企微账号(仅绑定当前登录人)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('company:companyWx:myAdd')")
|
|
|
+ @Log(title = "我的企微账号", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/myAdd")
|
|
|
+ public AjaxResult myAdd(@RequestBody CompanyWxAccount account){
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
account.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
account.setCompanyUserId(loginUser.getUser().getUserId());
|
|
|
@@ -102,6 +144,25 @@ public class CompanyWxAccountController extends BaseController
|
|
|
return toAjax(companyWxAccountService.updateCompanyWxAccount(companyWxEnterpriseAccount));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改我的企微账号(仅允许修改当前登录人的数据)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('company:companyWx:myEdit')")
|
|
|
+ @Log(title = "我的企微账号", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/myEdit")
|
|
|
+ public AjaxResult myEdit(@RequestBody CompanyWxAccount account)
|
|
|
+ {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long companyUserId = loginUser.getUser().getUserId();
|
|
|
+ CompanyWxAccount existAccount = companyWxAccountService.selectCompanyWxAccountById(account.getId());
|
|
|
+ if (existAccount == null || !companyUserId.equals(existAccount.getCompanyUserId())) {
|
|
|
+ return AjaxResult.error("无权修改该微信账号");
|
|
|
+ }
|
|
|
+ account.setCompanyUserId(companyUserId);
|
|
|
+ account.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ return toAjax(companyWxAccountService.updateCompanyWxAccount(account));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 删除企微账号
|
|
|
*/
|
|
|
@@ -112,6 +173,25 @@ public class CompanyWxAccountController extends BaseController
|
|
|
{
|
|
|
return toAjax(companyWxAccountService.deleteCompanyWxAccountByIds(ids));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除我的企微账号(仅允许删除当前登录人的数据)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('company:companyWx:myRemove')")
|
|
|
+ @Log(title = "我的企微账号", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/my/{ids}")
|
|
|
+ public AjaxResult myRemove(@PathVariable Long[] ids)
|
|
|
+ {
|
|
|
+ LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ Long companyUserId = loginUser.getUser().getUserId();
|
|
|
+ for (Long id : ids) {
|
|
|
+ CompanyWxAccount account = companyWxAccountService.selectCompanyWxAccountById(id);
|
|
|
+ if (account == null || !companyUserId.equals(account.getCompanyUserId())) {
|
|
|
+ return AjaxResult.error("无权删除该微信账号");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return toAjax(companyWxAccountService.deleteCompanyWxAccountByIds(ids));
|
|
|
+ }
|
|
|
/**
|
|
|
* 删除企微账号
|
|
|
*/
|