提交 9887cf59 编写于 作者: W wenyann

修改

上级 94dd8372
...@@ -85,6 +85,7 @@ public interface ParamConstants { ...@@ -85,6 +85,7 @@ public interface ParamConstants {
this.value = value; this.value = value;
} }
} }
public static enum MAIL { public static enum MAIL {
HOST("meter.host", 1), HOST("meter.host", 1),
PORT("meter.port", 2), PORT("meter.port", 2),
......
...@@ -15,13 +15,15 @@ import java.util.List; ...@@ -15,13 +15,15 @@ import java.util.List;
@RequestMapping(value = "/system") @RequestMapping(value = "/system")
public class SystemParameterController { public class SystemParameterController {
@Resource @Resource
private SystemParameterService SystemParameterService; private SystemParameterService SystemParameterService;
@PostMapping("/edit/email") @PostMapping("/edit/email")
public void editMail(@RequestBody List<SystemParameter> SystemParameter){ public void editMail(@RequestBody List<SystemParameter> systemParameter) {
SystemParameterService.editMail(SystemParameter); SystemParameterService.editMail(systemParameter);
} }
@PostMapping("/testConnection") @PostMapping("/testConnection")
public void testConnection(@RequestBody HashMap<String, String> hashMap){ public void testConnection(@RequestBody HashMap<String, String> hashMap) {
SystemParameterService.testConnection(hashMap); SystemParameterService.testConnection(hashMap);
} }
......
...@@ -9,6 +9,7 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -9,6 +9,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
...@@ -16,7 +17,6 @@ import java.util.Properties; ...@@ -16,7 +17,6 @@ import java.util.Properties;
import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.mail.javamail.JavaMailSenderImpl;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -39,7 +39,8 @@ public class SystemParameterService { ...@@ -39,7 +39,8 @@ public class SystemParameterService {
} }
return result; return result;
} }
public void editMail(List<SystemParameter> parameters){
public void editMail(List<SystemParameter> parameters) {
List<SystemParameter> paramList = this.getParamList(ParamConstants.Classify.MAIL.getValue()); List<SystemParameter> paramList = this.getParamList(ParamConstants.Classify.MAIL.getValue());
boolean empty = paramList.size() < 2; boolean empty = paramList.size() < 2;
parameters.forEach(parameter -> { parameters.forEach(parameter -> {
...@@ -54,13 +55,14 @@ public class SystemParameterService { ...@@ -54,13 +55,14 @@ public class SystemParameterService {
} }
}); });
} }
public List<SystemParameter> getParamList(String type) { public List<SystemParameter> getParamList(String type) {
SystemParameterExample example = new SystemParameterExample(); SystemParameterExample example = new SystemParameterExample();
example.createCriteria().andParamKeyLike(type + "%"); example.createCriteria().andParamKeyLike(type + "%");
return systemParameterMapper.selectByExample(example); return systemParameterMapper.selectByExample(example);
} }
public void testConnection(HashMap<String, String> hashMap){ public void testConnection(HashMap<String, String> hashMap) {
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl(); JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
javaMailSender.setDefaultEncoding("UTF-8"); javaMailSender.setDefaultEncoding("UTF-8");
javaMailSender.setHost(hashMap.get(ParamConstants.MAIL.PORT.getKey())); javaMailSender.setHost(hashMap.get(ParamConstants.MAIL.PORT.getKey()));
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<el-form-item :label="$t('system_parameter_setting.SMTP_host')" prop="host"> <el-form-item :label="$t('system_parameter_setting.SMTP_host')" prop="host">
</el-form-item> </el-form-item>
<el-input v-model="formInline.host" :placeholder="$t('system_parameter_setting.SMTP_host')" <el-input v-model="formInline.host" :placeholder="$t('system_parameter_setting.SMTP_host')"
v-on:input="host('host')"></el-input> v-on:input="change()"></el-input>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-form-item :label="$t('system_parameter_setting.SMTP_port')" prop="port"> <el-form-item :label="$t('system_parameter_setting.SMTP_port')" prop="port">
</el-form-item> </el-form-item>
<el-input v-model="formInline.port" :placeholder="$t('system_parameter_setting.SMTP_port')" <el-input v-model="formInline.port" :placeholder="$t('system_parameter_setting.SMTP_port')"
v-on:input="port('port')"></el-input> v-on:input="change()"></el-input>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<el-form-item :label="$t('system_parameter_setting.SMTP_account')" prop="account"> <el-form-item :label="$t('system_parameter_setting.SMTP_account')" prop="account">
</el-form-item> </el-form-item>
<el-input v-model="formInline.account" :placeholder="$t('system_parameter_setting.SMTP_account')" <el-input v-model="formInline.account" :placeholder="$t('system_parameter_setting.SMTP_account')"
v-on:input="account('account')"></el-input> v-on:input="change()"></el-input>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
...@@ -114,30 +114,8 @@ ...@@ -114,30 +114,8 @@
methods: { methods: {
host() { change() {
let host = this.formInline.host; if (!this.formInline.host || !this.formInline.port || !this.formInline.account) {
if (!host) {
this.disabledConnection = true;
this.disabledSave = true;
} else {
this.disabledConnection = false;
this.disabledSave = false;
}
},
port() {
let port = this.formInline.port;
if (!port) {
this.disabledConnection = true;
this.disabledSave = true;
} else {
this.disabledConnection = false;
this.disabledSave = false;
}
},
account() {
let account = this.formInline.account;
if (!account) {
this.disabledConnection = true; this.disabledConnection = true;
this.disabledSave = true; this.disabledSave = true;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册