|
@@ -2,10 +2,14 @@ package com.simuwang.manage.api.email;
|
|
|
|
|
|
import com.simuwang.base.common.page.TableDataInfo;
|
|
|
import com.simuwang.base.common.result.AjaxResult;
|
|
|
+import com.simuwang.base.pojo.vo.IdVO;
|
|
|
import com.simuwang.base.pojo.vo.MailboxInfoTableVO;
|
|
|
import com.simuwang.base.pojo.vo.MailboxInfoVO;
|
|
|
+import com.simuwang.base.pojo.vo.SuccessVO;
|
|
|
import com.simuwang.manage.api.base.BaseController;
|
|
|
import com.simuwang.manage.service.EmailConfigService;
|
|
|
+import com.smppw.common.pojo.ResultVo;
|
|
|
+import com.smppw.common.pojo.enums.status.ResultCode;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -18,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
- * FileName: EmailConfigController
|
|
|
+ * 接收邮箱配置管理
|
|
|
* Author: chenjianhua
|
|
|
* Date: 2024/9/9 11:40
|
|
|
* Description: ${DESCRIPTION}
|
|
@@ -32,7 +36,7 @@ public class EmailConfigController extends BaseController {
|
|
|
private static final Logger logger = LoggerFactory.getLogger(EmailConfigController.class);
|
|
|
|
|
|
/**
|
|
|
- * 表格查询
|
|
|
+ * 页面展示查询
|
|
|
* @param email
|
|
|
* @return
|
|
|
*/
|
|
@@ -47,44 +51,69 @@ public class EmailConfigController extends BaseController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("save-email-config")
|
|
|
- public AjaxResult saveEmailConfig(@RequestBody MailboxInfoVO mailboxInfoVO){
|
|
|
+ public ResultVo saveEmailConfig(@RequestBody MailboxInfoVO mailboxInfoVO){
|
|
|
+ ResultVo vo = new ResultVo(ResultCode.SAVE_SUCCESS.getCode());
|
|
|
+ SuccessVO successVO = new SuccessVO();
|
|
|
+ vo.setData(successVO);
|
|
|
try{
|
|
|
if(mailboxInfoVO.getId() == null && !emailConfigService.checkEmailUnique(mailboxInfoVO.getEmail())){
|
|
|
- return AjaxResult.error("邮箱地址已存在,无需添加");
|
|
|
+ successVO.setMsg("邮箱地址已存在,无需添加");
|
|
|
+ successVO.setStatus(0);
|
|
|
+ vo.setData(successVO);
|
|
|
+ vo.setCode(ResultCode.SAVE_FAILED.getCode());
|
|
|
+ vo.setMsg("邮箱地址已存在,无需添加");
|
|
|
+ return vo;
|
|
|
}
|
|
|
emailConfigService.saveEmailConfig(mailboxInfoVO);
|
|
|
+ successVO.setMsg(ResultCode.SAVE_SUCCESS.getMsg());
|
|
|
+ successVO.setStatus(1);
|
|
|
}catch (Exception e){
|
|
|
+ successVO.setMsg(ResultCode.SAVE_FAILED.getMsg());
|
|
|
+ successVO.setStatus(0);
|
|
|
+ vo.setCode(ResultCode.SAVE_FAILED.getCode());
|
|
|
logger.error(e.getMessage(),e);
|
|
|
- return AjaxResult.error("保存失败");
|
|
|
}
|
|
|
- return AjaxResult.success();
|
|
|
+ return vo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存邮箱配置
|
|
|
- * @param ids
|
|
|
+ * @param idVO
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("delete-email-config")
|
|
|
- public AjaxResult deleteEmailConfig(@RequestParam("ids") String ids){
|
|
|
+ public ResultVo deleteEmailConfig(@RequestBody IdVO idVO){
|
|
|
+ ResultVo vo = new ResultVo(ResultCode.DELETE_SUCCESS.getCode());
|
|
|
+ SuccessVO successVO = new SuccessVO();
|
|
|
+ vo.setData(successVO);
|
|
|
try{
|
|
|
- emailConfigService.deleteEmailConfig(ids);
|
|
|
+ emailConfigService.deleteEmailConfig(idVO.getIdList());
|
|
|
+ successVO.setMsg(ResultCode.DELETE_SUCCESS.getMsg());
|
|
|
+ successVO.setStatus(1);
|
|
|
}catch (Exception e){
|
|
|
logger.error(e.getMessage(),e);
|
|
|
- return AjaxResult.error();
|
|
|
+ successVO.setMsg(ResultCode.DELETE_FAILED.getMsg());
|
|
|
+ successVO.setStatus(0);
|
|
|
}
|
|
|
- return AjaxResult.success();
|
|
|
+ return vo;
|
|
|
}
|
|
|
|
|
|
@RequestMapping("connect-test")
|
|
|
- public AjaxResult connectTest(@RequestBody MailboxInfoVO mailboxInfoVO){
|
|
|
+ public ResultVo connectTest(@RequestBody MailboxInfoVO mailboxInfoVO){
|
|
|
+ ResultVo vo = new ResultVo(ResultCode.SUCCESS.getCode());
|
|
|
+ SuccessVO successVO = new SuccessVO();
|
|
|
+ vo.setData(successVO);
|
|
|
String msg = "";
|
|
|
try{
|
|
|
msg = emailConfigService.connectTest(mailboxInfoVO);
|
|
|
+ vo.setMsg(msg);
|
|
|
+ successVO.setMsg(msg);
|
|
|
+ successVO.setStatus(1);
|
|
|
}catch (Exception e){
|
|
|
- logger.error(e.getMessage(),e);
|
|
|
- return AjaxResult.error("链接失败");
|
|
|
+ vo.setMsg(e.getMessage());
|
|
|
+ successVO.setMsg(e.getMessage());
|
|
|
+ successVO.setStatus(0);
|
|
|
}
|
|
|
- return AjaxResult.success(msg);
|
|
|
+ return vo;
|
|
|
}
|
|
|
}
|