|
|
@@ -8,7 +8,9 @@ import cn.reghao.devops.web.admin.sys.model.po.NotifyReceiver;
|
|
|
import cn.reghao.jutil.jdk.result.WebResult;
|
|
|
import cn.reghao.jutil.jdk.string.StringRegexp;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.http.MediaType;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -31,6 +33,8 @@ public class EmailController {
|
|
|
this.emailAccountRepository = emailAccountRepository;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "添加邮箱帐号")
|
|
|
+ @PreAuthorize("hasRole('ROLE_ADMIN')")
|
|
|
@PostMapping(value = "/save", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String saveReceiver(@Validated EmailAccount emailAccount) {
|
|
|
String email = emailAccount.getUsername();
|
|
|
@@ -54,15 +58,17 @@ public class EmailController {
|
|
|
return WebResult.success();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "删除邮箱帐号")
|
|
|
+ @PreAuthorize("hasRole('ROLE_ADMIN')")
|
|
|
@DeleteMapping(value = "/delete/{username}", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String deleteEmail(@PathVariable("username") String username) {
|
|
|
- NotifyReceiver notifyReceiver = notifyReceiverRepository.findByType(NotifyType.email.name());
|
|
|
+ /*NotifyReceiver notifyReceiver = notifyReceiverRepository.findByType(NotifyType.email.name());
|
|
|
if (notifyReceiver != null) {
|
|
|
return WebResult.failWithMsg("系统中存在接收通知的邮箱地址, 不能删除发送通知的邮箱");
|
|
|
}
|
|
|
|
|
|
List<EmailAccount> list = emailAccountRepository.findAll();
|
|
|
- emailAccountRepository.delete(list.get(0));
|
|
|
- return WebResult.success();
|
|
|
+ emailAccountRepository.delete(list.get(0));*/
|
|
|
+ return WebResult.failWithMsg("接口未实现");
|
|
|
}
|
|
|
}
|