This commit is contained in:
parent
94dd8372a4
commit
9887cf5904
|
@ -85,6 +85,7 @@ public interface ParamConstants {
|
|||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum MAIL {
|
||||
HOST("meter.host", 1),
|
||||
PORT("meter.port", 2),
|
||||
|
|
|
@ -16,12 +16,14 @@ import java.util.List;
|
|||
public class SystemParameterController {
|
||||
@Resource
|
||||
private SystemParameterService SystemParameterService;
|
||||
|
||||
@PostMapping("/edit/email")
|
||||
public void editMail(@RequestBody List<SystemParameter> SystemParameter){
|
||||
SystemParameterService.editMail(SystemParameter);
|
||||
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
|
||||
SystemParameterService.editMail(systemParameter);
|
||||
}
|
||||
|
||||
@PostMapping("/testConnection")
|
||||
public void testConnection(@RequestBody HashMap<String, String> hashMap){
|
||||
public void testConnection(@RequestBody HashMap<String, String> hashMap) {
|
||||
SystemParameterService.testConnection(hashMap);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.apache.commons.collections.CollectionUtils;
|
|||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
@ -16,7 +17,6 @@ import java.util.Properties;
|
|||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
|
@ -39,7 +39,8 @@ public class SystemParameterService {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
public void editMail(List<SystemParameter> parameters){
|
||||
|
||||
public void editMail(List<SystemParameter> parameters) {
|
||||
List<SystemParameter> paramList = this.getParamList(ParamConstants.Classify.MAIL.getValue());
|
||||
boolean empty = paramList.size() < 2;
|
||||
parameters.forEach(parameter -> {
|
||||
|
@ -54,13 +55,14 @@ public class SystemParameterService {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<SystemParameter> getParamList(String type) {
|
||||
SystemParameterExample example = new SystemParameterExample();
|
||||
example.createCriteria().andParamKeyLike(type + "%");
|
||||
return systemParameterMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public void testConnection(HashMap<String, String> hashMap){
|
||||
public void testConnection(HashMap<String, String> hashMap) {
|
||||
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
|
||||
javaMailSender.setDefaultEncoding("UTF-8");
|
||||
javaMailSender.setHost(hashMap.get(ParamConstants.MAIL.PORT.getKey()));
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<el-form-item :label="$t('system_parameter_setting.SMTP_host')" prop="host">
|
||||
</el-form-item>
|
||||
<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-row>
|
||||
<el-row>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<el-form-item :label="$t('system_parameter_setting.SMTP_port')" prop="port">
|
||||
</el-form-item>
|
||||
<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-row>
|
||||
<el-row>
|
||||
|
@ -28,7 +28,7 @@
|
|||
<el-form-item :label="$t('system_parameter_setting.SMTP_account')" prop="account">
|
||||
</el-form-item>
|
||||
<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-row>
|
||||
<el-row>
|
||||
|
@ -114,30 +114,8 @@
|
|||
|
||||
|
||||
methods: {
|
||||
host() {
|
||||
let host = this.formInline.host;
|
||||
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) {
|
||||
change() {
|
||||
if (!this.formInline.host || !this.formInline.port || !this.formInline.account) {
|
||||
this.disabledConnection = true;
|
||||
this.disabledSave = true;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue