Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
shuaje committed May 8, 2018
1 parent 929d7a0 commit 0c87fd5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,26 @@ public class SysEmailConfig extends BaseModel {
/**
* SMTP服务器
*/
@TableField(value="smtp_host")
@TableField(value = "smtp_host")
private String smtpHost;
/** SMTP服务器端口
*/
@TableField(value = "smtp_port")
private String smtpPort;
/**
* 名称
*/
@TableField(value="sender_name")
@TableField(value = "sender_name")
private String senderName;
/**
* 发邮件邮箱账号
*/
@TableField(value="sender_account")
@TableField(value = "sender_account")
private String senderAccount;
/**
* 发邮件邮箱密码
*/
@TableField(value="sender_password")
@TableField(value = "sender_password")
private String senderPassword;
/**
* 发送邮箱鉴权
Expand All @@ -51,6 +55,14 @@ public void setSmtpHost(String smtpHost) {
this.smtpHost = smtpHost;
}

public String getSmtpPort() {
return smtpPort;
}

public void setSmtpPort(String smtpPort) {
this.smtpPort = smtpPort;
}

public String getSenderName() {
return senderName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void sendEmail(SysEmail record) {
} else {
SysEmailConfig emailConfig = emailConfigs.get(0);
email.setHost(emailConfig.getSmtpHost());
email.setPort(emailConfig.getSmtpPort());
email.setName(emailConfig.getSenderName());
email.setFrom(emailConfig.getSenderName() + "," + emailConfig.getSenderAccount());
email.setPassword(emailConfig.getSenderPassword());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@

/**
* 邮件配置管理控制类
*
*
* @author ShenHuaJie
* @version 2016年5月20日 下午3:13:31
*/
@RestController
@Api(value = "邮件配置管理", description = "邮件配置管理")
@RequestMapping(value = "emailConfig")
public class SysEmailConfigController extends BaseController<SysEmailConfig, ISysEmailConfigService> {
@Override
@ApiOperation(value = "查询邮件配置")
@RequiresPermissions("sys.email.config.read")
@RequestMapping(value = "/read/list", method = RequestMethod.PUT)
Expand All @@ -41,21 +42,23 @@ public Object get(ModelMap modelMap, @RequestBody SysEmailConfig param) {
return super.get(modelMap, param);
}

@Override
@ApiOperation(value = "修改邮件配置")
@RequiresPermissions("sys.email.config.update")
@RequestMapping(method = RequestMethod.POST)
public Object update(ModelMap modelMap, @RequestBody SysEmailConfig param) {
if (param.getId() != null) {
SysEmailConfig result = service.queryById(param.getId());
if (param.getSenderPassword() != null && !param.getSenderPassword().equals(result.getSenderPassword())) {
param.setSenderPassword(SecurityUtil.encryptMd5(param.getSenderPassword()));
param.setSenderPassword(SecurityUtil.encryptDes(param.getSenderPassword()));
}
} else if (DataUtil.isNotEmpty(param.getSenderPassword())) {
param.setSenderPassword(SecurityUtil.encryptMd5(param.getSenderPassword()));
param.setSenderPassword(SecurityUtil.encryptDes(param.getSenderPassword()));
}
return super.update(modelMap, param);
}

@Override
@ApiOperation(value = "删除邮件配置")
@RequiresPermissions("sys.email.config.delete")
@RequestMapping(method = RequestMethod.DELETE)
Expand Down

0 comments on commit 0c87fd5

Please sign in to comment.