|
|
@@ -47,7 +47,9 @@ import lombok.RequiredArgsConstructor;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
@@ -101,6 +103,8 @@ public class CmsAccountController {
|
|
|
|
|
|
private final GoodsDonSkuMapper goodsDonSkuMapper;
|
|
|
|
|
|
+ private final SysEmailMapper sysEmailMapper;
|
|
|
+
|
|
|
@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) {
|
|
|
@@ -177,6 +181,13 @@ public class CmsAccountController {
|
|
|
}
|
|
|
Integer expiryCount = groupsMapper.countExpiredNum(accountView.getId());
|
|
|
accountView.setExpiryCount(expiryCount);
|
|
|
+
|
|
|
+ if (StrUtil.isNotEmpty(accountView.getAccount())) {
|
|
|
+ Optional.ofNullable(sysEmailMapper.selectOne(Wrappers.lambdaQuery(SysEmail.class)
|
|
|
+ .eq(SysEmail::getEmail, accountView.getAccount()).select(SysEmail::getPassword)
|
|
|
+ .last("limit 1")))
|
|
|
+ .ifPresent(email -> accountView.setEmailPassword(email.getPassword()));
|
|
|
+ }
|
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
}
|
|
|
@@ -977,4 +988,54 @@ public class CmsAccountController {
|
|
|
accountService.save(account);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量导入系统邮箱
|
|
|
+ */
|
|
|
+ @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();
|
|
|
+ }
|
|
|
}
|