smtp修改

This commit is contained in:
wenyann 2020-07-07 16:29:01 +08:00
parent 6a1168a187
commit a0483661bd
2 changed files with 27 additions and 11 deletions

View File

@ -40,17 +40,24 @@ public class SystemParameterService {
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() <= 0;
parameters.forEach(parameter -> { parameters.forEach(parameter -> {
SystemParameterExample example = new SystemParameterExample();
if (parameter.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())) { if (parameter.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())) {
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString(); if (!StringUtils.isBlank(parameter.getParamValue())) {
parameter.setParamValue(string); String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
parameter.setParamValue(string);
}
} }
if (empty) { example.createCriteria().andParamKeyEqualTo(parameter.getParamKey());
systemParameterMapper.insert(parameter); if (systemParameterMapper.countByExample(example) > 0) {
} else {
systemParameterMapper.updateByPrimaryKey(parameter); systemParameterMapper.updateByPrimaryKey(parameter);
} else {
systemParameterMapper.insert(parameter);
} }
example.clear();
}); });
} }
@ -105,8 +112,11 @@ public class SystemParameterService {
} }
} else { } else {
paramList.stream().filter(param -> param.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())).forEach(param -> { paramList.stream().filter(param -> param.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())).forEach(param -> {
String string = EncryptUtils.aesDecrypt(param.getParamValue()).toString(); if (!StringUtils.isBlank(param.getParamValue())) {
param.setParamValue(string); String string = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
param.setParamValue(string);
}
}); });
} }
paramList.sort(Comparator.comparingInt(SystemParameter::getSort)); paramList.sort(Comparator.comparingInt(SystemParameter::getSort));

View File

@ -127,9 +127,15 @@
this.$set(this.formInline, "port", response.data[1].paramValue); this.$set(this.formInline, "port", response.data[1].paramValue);
this.$set(this.formInline, "account", response.data[2].paramValue); this.$set(this.formInline, "account", response.data[2].paramValue);
this.$set(this.formInline, "password", response.data[3].paramValue); this.$set(this.formInline, "password", response.data[3].paramValue);
this.$set(this.formInline, "SSL", JSON.parse(response.data[4].paramValue)); if(response.data[4].paramValue!=""){
this.$set(this.formInline, "TLS", JSON.parse(response.data[5].paramValue)); this.$set(this.formInline, "SSL", JSON.parse(response.data[4].paramValue));
this.$set(this.formInline, "SMTP", JSON.parse(response.data[6].paramValue)); }
if(response.data[5].paramValue!=""){
this.$set(this.formInline, "TLS", JSON.parse(response.data[5].paramValue));
}
if(response.data[6].paramValue!=""){
this.$set(this.formInline, "SMTP", JSON.parse(response.data[6].paramValue));
}
}) })
}, },
change() { change() {