|
@@ -1,7 +1,6 @@
|
|
|
package com.cyksj.web.controller.manage.account;
|
|
package com.cyksj.web.controller.manage.account;
|
|
|
|
|
|
|
|
-import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
|
|
-import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
|
|
|
+import com.cyksj.web.util.StpAbroadUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
@@ -21,6 +20,7 @@ import com.cyksj.enums.BusinessType;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
import com.cyksj.mapper.*;
|
|
import com.cyksj.mapper.*;
|
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
|
|
|
+import com.cyksj.mapper.sys.SysEmailMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.excel.ExcelDoubleVerifyAccountData;
|
|
import com.cyksj.model.excel.ExcelDoubleVerifyAccountData;
|
|
|
import com.cyksj.model.excel.ExcelImportAccountData;
|
|
import com.cyksj.model.excel.ExcelImportAccountData;
|
|
@@ -47,7 +47,9 @@ import lombok.RequiredArgsConstructor;
|
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
@@ -100,8 +102,9 @@ public class CmsAccountController {
|
|
|
|
|
|
|
|
private final RedisService redisService;
|
|
private final RedisService redisService;
|
|
|
|
|
|
|
|
|
|
+ private final SysEmailMapper sysEmailMapper;
|
|
|
|
|
+
|
|
|
@GetMapping("/get")
|
|
@GetMapping("/get")
|
|
|
- @SaCheckPermission("account:view")
|
|
|
|
|
public Result<SearchResult<AccountView>> get(Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths) {
|
|
public Result<SearchResult<AccountView>> get(Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths) {
|
|
|
MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
|
|
MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
if (StrUtil.isNotEmpty(expiryStartTime) || StrUtil.isNotEmpty(expiryEndTime)) {
|
|
if (StrUtil.isNotEmpty(expiryStartTime) || StrUtil.isNotEmpty(expiryEndTime)) {
|
|
@@ -184,7 +187,6 @@ public class CmsAccountController {
|
|
|
* 导出账号
|
|
* 导出账号
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/export/account")
|
|
@GetMapping("/export/account")
|
|
|
- @SaCheckPermission("account:export")
|
|
|
|
|
@Log(module = "平台管理/导出账号", businessType = BusinessType.EXPORT, isSaveRequestData = true)
|
|
@Log(module = "平台管理/导出账号", businessType = BusinessType.EXPORT, isSaveRequestData = true)
|
|
|
public void exportAccount(Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths, HttpServletResponse response) {
|
|
public void exportAccount(Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths, HttpServletResponse response) {
|
|
|
MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
|
|
MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
|
|
@@ -244,7 +246,6 @@ public class CmsAccountController {
|
|
|
* 下载批量修改密码模板
|
|
* 下载批量修改密码模板
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/get/account/template")
|
|
@GetMapping("/get/account/template")
|
|
|
- @SaCheckPermission("account:batchUpdatePwd")
|
|
|
|
|
public void getAccountTemplate(HttpServletResponse response) {
|
|
public void getAccountTemplate(HttpServletResponse response) {
|
|
|
EasyExcelUtils.createTemplateExcel(response, ExcelImportAccountData.class, "账号批量修改密码模板", "账号批量修改密码模板", ExcelTypeEnum.XLSX, null);
|
|
EasyExcelUtils.createTemplateExcel(response, ExcelImportAccountData.class, "账号批量修改密码模板", "账号批量修改密码模板", ExcelTypeEnum.XLSX, null);
|
|
|
}
|
|
}
|
|
@@ -254,7 +255,7 @@ public class CmsAccountController {
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/import/account")
|
|
@PostMapping("/import/account")
|
|
|
public Result<String> importAccount(Long goodsId, MultipartFile file) throws Exception {
|
|
public Result<String> importAccount(Long goodsId, MultipartFile file) throws Exception {
|
|
|
- long userId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
+ long userId = StpAbroadUtil.getLoginIdAsLong();
|
|
|
EasyExcel.read(file.getInputStream(), ExcelImportAccountData.class, new AnalysisEventListener<ExcelImportAccountData>() {
|
|
EasyExcel.read(file.getInputStream(), ExcelImportAccountData.class, new AnalysisEventListener<ExcelImportAccountData>() {
|
|
|
@SneakyThrows
|
|
@SneakyThrows
|
|
|
@Override
|
|
@Override
|
|
@@ -340,7 +341,6 @@ public class CmsAccountController {
|
|
|
@PostMapping("/post")
|
|
@PostMapping("/post")
|
|
|
@NoSubmit
|
|
@NoSubmit
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
|
- @SaCheckPermission("account:add")
|
|
|
|
|
@Log(module = "平台管理/新增账号", businessType = BusinessType.POST, isSaveRequestData = true)
|
|
@Log(module = "平台管理/新增账号", businessType = BusinessType.POST, isSaveRequestData = true)
|
|
|
public Result<String> add(@RequestBody Account account){
|
|
public Result<String> add(@RequestBody Account account){
|
|
|
account.setAccount(account.getAccount().trim());
|
|
account.setAccount(account.getAccount().trim());
|
|
@@ -426,7 +426,6 @@ public class CmsAccountController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PutMapping("/update")
|
|
@PutMapping("/update")
|
|
|
- @SaCheckPermission("account:update")
|
|
|
|
|
@Log(module = "平台管理/编辑账号", businessType = BusinessType.PUT, isSaveRequestData = true)
|
|
@Log(module = "平台管理/编辑账号", businessType = BusinessType.PUT, isSaveRequestData = true)
|
|
|
public Result<String> update(@RequestBody Account account){
|
|
public Result<String> update(@RequestBody Account account){
|
|
|
Account db = accountService.getById(account.getId());
|
|
Account db = accountService.getById(account.getId());
|
|
@@ -435,7 +434,7 @@ public class CmsAccountController {
|
|
|
}
|
|
}
|
|
|
Boolean isClear = false;
|
|
Boolean isClear = false;
|
|
|
String dbAccount = db.getAccount();
|
|
String dbAccount = db.getAccount();
|
|
|
- long userId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
+ long userId = StpAbroadUtil.getLoginIdAsLong();
|
|
|
if (!db.getPassword().equals(account.getPassword())) {
|
|
if (!db.getPassword().equals(account.getPassword())) {
|
|
|
account.setCustomerServiceId(0l);
|
|
account.setCustomerServiceId(0l);
|
|
|
accountService.saveRecord(userId, account.getId(), db.getPassword(), account.getPassword(), "操作编辑");
|
|
accountService.saveRecord(userId, account.getId(), db.getPassword(), account.getPassword(), "操作编辑");
|
|
@@ -516,7 +515,7 @@ public class CmsAccountController {
|
|
|
@PutMapping("/update/pwd")
|
|
@PutMapping("/update/pwd")
|
|
|
@Log(module = "平台管理/批量修改密码", businessType = BusinessType.PUT, isSaveRequestData = true)
|
|
@Log(module = "平台管理/批量修改密码", businessType = BusinessType.PUT, isSaveRequestData = true)
|
|
|
public Result<String> updatePwdAndSendMsg(@RequestBody List<Account> accounts) throws Exception {
|
|
public Result<String> updatePwdAndSendMsg(@RequestBody List<Account> accounts) throws Exception {
|
|
|
- long userId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
+ long userId = StpAbroadUtil.getLoginIdAsLong();
|
|
|
accounts.forEach(account -> {
|
|
accounts.forEach(account -> {
|
|
|
Account db = accountService.getById(account.getId());
|
|
Account db = accountService.getById(account.getId());
|
|
|
if (db != null) {
|
|
if (db != null) {
|
|
@@ -586,7 +585,6 @@ public class CmsAccountController {
|
|
|
|
|
|
|
|
|
|
|
|
|
@DeleteMapping("/delete/{id}")
|
|
@DeleteMapping("/delete/{id}")
|
|
|
- @SaCheckPermission("account:delete")
|
|
|
|
|
@Log(module = "平台管理/删除账号", businessType = BusinessType.DELETE, isSaveRequestData = true)
|
|
@Log(module = "平台管理/删除账号", businessType = BusinessType.DELETE, isSaveRequestData = true)
|
|
|
public Result<String> update(@PathVariable Long id){
|
|
public Result<String> update(@PathVariable Long id){
|
|
|
//是否关联了车队
|
|
//是否关联了车队
|
|
@@ -599,7 +597,6 @@ public class CmsAccountController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PutMapping("/update/expiryTime")
|
|
@PutMapping("/update/expiryTime")
|
|
|
- @SaCheckPermission("account:addExpiryTime")
|
|
|
|
|
public Result<String> updateExpiryTime(@RequestBody ReqAccountIncrExpiryTime incrExpiryTime){
|
|
public Result<String> updateExpiryTime(@RequestBody ReqAccountIncrExpiryTime incrExpiryTime){
|
|
|
incrExpiryTime.getAccounts().forEach((accountId)->{
|
|
incrExpiryTime.getAccounts().forEach((accountId)->{
|
|
|
Account account = accountService.getById(accountId);
|
|
Account account = accountService.getById(accountId);
|
|
@@ -726,7 +723,7 @@ public class CmsAccountController {
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/get/updatePwd/num")
|
|
@GetMapping("/get/updatePwd/num")
|
|
|
public Result<CustomerServiceUpdatePwdDetail> updatePwdDetails() {
|
|
public Result<CustomerServiceUpdatePwdDetail> updatePwdDetails() {
|
|
|
- long userId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
+ long userId = StpAbroadUtil.getLoginIdAsLong();
|
|
|
CmsUser user = cmsUserManager.getUser(userId);
|
|
CmsUser user = cmsUserManager.getUser(userId);
|
|
|
MapBuilder builder = MapUtils.builder();
|
|
MapBuilder builder = MapUtils.builder();
|
|
|
if (user != null && user.getRoleNames() != null && user.getRoleNames().contains("客服")) {
|
|
if (user != null && user.getRoleNames() != null && user.getRoleNames().contains("客服")) {
|
|
@@ -873,4 +870,54 @@ public class CmsAccountController {
|
|
|
List<DoubleVerifyClickRefreshRecord> search = beanSearcher.searchAll(DoubleVerifyClickRefreshRecord.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
List<DoubleVerifyClickRefreshRecord> search = beanSearcher.searchAll(DoubleVerifyClickRefreshRecord.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 批量导入系统邮箱
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/batch/import/email")
|
|
|
|
|
+ public Result<String> batchImportEmail(MultipartFile file) throws Exception {
|
|
|
|
|
+ accountService.readFileAndImportEmail(file);
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 系统邮箱列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/get/email")
|
|
|
|
|
+ public Result<SearchResult<SysEmail>> getEmail() {
|
|
|
|
|
+ SearchResult<SysEmail> search = beanSearcher.search(SysEmail.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
|
|
+ .field(SysEmail::getDeleted, 1)
|
|
|
|
|
+ .build());
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新增邮箱
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/post/email")
|
|
|
|
|
+ public Result postEmail(@RequestBody @Validated SysEmail sysEmail) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ sysEmailMapper.insert(sysEmail);
|
|
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
|
|
+ }
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 修改系统邮箱
|
|
|
|
|
+ */
|
|
|
|
|
+ @PutMapping("/update/email")
|
|
|
|
|
+ public Result updateEmail(@RequestBody SysEmail sysEmail) {
|
|
|
|
|
+ sysEmailMapper.updateById(sysEmail);
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除系统邮箱
|
|
|
|
|
+ */
|
|
|
|
|
+ @DeleteMapping("/delete/email/{id}")
|
|
|
|
|
+ public Result deleteEmail(@PathVariable Long id) {
|
|
|
|
|
+ sysEmailMapper.deleteById(id);
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|