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) {
List<SystemParameter> paramList = this.getParamList(ParamConstants.Classify.MAIL.getValue());
boolean empty = paramList.size() < 2;
boolean empty = paramList.size() <= 0;
parameters.forEach(parameter -> {
SystemParameterExample example = new SystemParameterExample();
if (parameter.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())) {
if (!StringUtils.isBlank(parameter.getParamValue())) {
String string = EncryptUtils.aesEncrypt(parameter.getParamValue()).toString();
parameter.setParamValue(string);
}
if (empty) {
systemParameterMapper.insert(parameter);
} else {
systemParameterMapper.updateByPrimaryKey(parameter);
}
example.createCriteria().andParamKeyEqualTo(parameter.getParamKey());
if (systemParameterMapper.countByExample(example) > 0) {
systemParameterMapper.updateByPrimaryKey(parameter);
} else {
systemParameterMapper.insert(parameter);
}
example.clear();
});
}
@ -105,8 +112,11 @@ public class SystemParameterService {
}
} else {
paramList.stream().filter(param -> param.getParamKey().equals(ParamConstants.MAIL.PASSWORD.getKey())).forEach(param -> {
if (!StringUtils.isBlank(param.getParamValue())) {
String string = EncryptUtils.aesDecrypt(param.getParamValue()).toString();
param.setParamValue(string);
}
});
}
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, "account", response.data[2].paramValue);
this.$set(this.formInline, "password", response.data[3].paramValue);
if(response.data[4].paramValue!=""){
this.$set(this.formInline, "SSL", JSON.parse(response.data[4].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() {