fix: 添加日志,调整代码格式
This commit is contained in:
parent
744de357c3
commit
4ba24afeee
|
@ -112,6 +112,7 @@ public class MailService {
|
|||
emails.add(u.getEmail());
|
||||
});
|
||||
users = emails.toArray(new String[0]);
|
||||
LogUtil.info("收件人地址"+users);
|
||||
helper.setText(getContent(Template, context), true);
|
||||
helper.setTo(users);
|
||||
try {
|
||||
|
@ -195,7 +196,8 @@ public class MailService {
|
|||
|
||||
public void sendTestPlanStartNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
|
||||
Map<String, String> context = getTestPlanContext(testPlan);
|
||||
context.put("creator", testPlan.getCreator());
|
||||
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
|
||||
context.put("creator", user.getName());
|
||||
try {
|
||||
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanStart.html"), StandardCharsets.UTF_8);
|
||||
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
|
||||
|
@ -205,8 +207,9 @@ public class MailService {
|
|||
}
|
||||
|
||||
public void sendTestPlanEndNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
|
||||
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
|
||||
Map<String, String> context = getTestPlanContext(testPlan);
|
||||
context.put("creator", userIds.toString());
|
||||
context.put("creator", user.getName());
|
||||
try {
|
||||
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanEnd.html"), StandardCharsets.UTF_8);
|
||||
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
|
||||
|
@ -216,8 +219,9 @@ public class MailService {
|
|||
}
|
||||
|
||||
public void sendTestPlanDeleteNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
|
||||
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
|
||||
Map<String, String> context = getTestPlanContext(testPlan);
|
||||
context.put("creator", userIds.toString());
|
||||
context.put("creator", user.getName());
|
||||
try {
|
||||
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanDelete.html"), StandardCharsets.UTF_8);
|
||||
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.base.mapper.ext.ExtSystemParameterMapper;
|
|||
import io.metersphere.commons.constants.ParamConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.EncryptUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.ldap.domain.LdapInfo;
|
||||
|
@ -99,6 +100,7 @@ public class SystemParameterService {
|
|||
try {
|
||||
javaMailSender.testConnection();
|
||||
} catch (MessagingException e) {
|
||||
LogUtil.error(e);
|
||||
MSException.throwException(Translator.get("connection_failed"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,26 +145,26 @@ export default {
|
|||
data.isReadOnly = true;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = !data.isReadOnly
|
||||
data.webhook = ""
|
||||
data.webhook = ''
|
||||
}
|
||||
},
|
||||
handleEditTask(index,data) {
|
||||
data.isSet = true
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = false
|
||||
data.webhook = ""
|
||||
data.isReadOnly = false;
|
||||
data.webhook = ''
|
||||
} else {
|
||||
data.isReadOnly = true
|
||||
data.isReadOnly = true;
|
||||
}
|
||||
},
|
||||
handleAddTaskModel(type) {
|
||||
let Task = {};
|
||||
Task.event = [];
|
||||
Task.userIds = [];
|
||||
Task.type = "";
|
||||
Task.webhook = "";
|
||||
Task.type = '';
|
||||
Task.webhook = '';
|
||||
Task.isSet = true;
|
||||
Task.identification = "";
|
||||
Task.identification = '';
|
||||
if (type === 'jenkinsTask') {
|
||||
Task.taskType = 'JENKINS_TASK'
|
||||
this.form.jenkinsTask.push(Task)
|
||||
|
|
|
@ -146,18 +146,18 @@ export default {
|
|||
handleEdit(index, data) {
|
||||
data.isReadOnly = true;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = !data.isReadOnly
|
||||
data.webhook = ""
|
||||
data.isReadOnly = !data.isReadOnly;
|
||||
data.webhook = '';
|
||||
}
|
||||
},
|
||||
handleAddTaskModel(type) {
|
||||
let Task = {};
|
||||
Task.event = [];
|
||||
Task.userIds = [];
|
||||
Task.type = "";
|
||||
Task.webhook = "";
|
||||
Task.type = '';
|
||||
Task.webhook = '';
|
||||
Task.isSet = true;
|
||||
Task.identification = "";
|
||||
Task.identification = '';
|
||||
if (type === 'jenkinsTask') {
|
||||
Task.taskType = 'JENKINS_TASK'
|
||||
this.form.jenkinsTask.push(Task)
|
||||
|
@ -194,21 +194,21 @@ export default {
|
|||
handleEditTask(index,data) {
|
||||
data.isSet = true
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = false
|
||||
data.webhook = ""
|
||||
data.isReadOnly = false;
|
||||
data.webhook = ''
|
||||
} else {
|
||||
data.isReadOnly = true
|
||||
data.isReadOnly = true;
|
||||
}
|
||||
|
||||
},
|
||||
addTask(data) {
|
||||
let list = []
|
||||
data.isSet = false
|
||||
list.push(data)
|
||||
let list = [];
|
||||
data.isSet = false;
|
||||
list.push(data);
|
||||
let param = {};
|
||||
param.messageDetail = list
|
||||
param.messageDetail = list;
|
||||
this.result = this.$post("/notice/save/message/task", param, () => {
|
||||
this.initForm()
|
||||
this.initForm();
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
})
|
||||
},
|
||||
|
@ -216,7 +216,7 @@ export default {
|
|||
if (!data[index].identification) {
|
||||
data.splice(index, 1)
|
||||
} else {
|
||||
data[index].isSet = false
|
||||
data[index].isSet = false;
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -147,8 +147,8 @@ export default {
|
|||
handleEdit(index, data) {
|
||||
data.isReadOnly = true;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = !data.isReadOnly
|
||||
data.webhook = ""
|
||||
data.isReadOnly = !data.isReadOnly;
|
||||
data.webhook = ''
|
||||
}
|
||||
},
|
||||
handleAddTaskModel(type) {
|
||||
|
@ -166,13 +166,13 @@ export default {
|
|||
}
|
||||
},
|
||||
handleEditTask(index,data) {
|
||||
data.isSet = true
|
||||
data.testId = this.testId
|
||||
data.isSet = true;
|
||||
data.testId = this.testId;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = false
|
||||
data.webhook = ""
|
||||
data.isReadOnly = false;
|
||||
data.webhook = ''
|
||||
} else {
|
||||
data.isReadOnly = true
|
||||
data.isReadOnly = true;
|
||||
}
|
||||
},
|
||||
handleAddTask(index, data) {
|
||||
|
@ -192,9 +192,9 @@ export default {
|
|||
}
|
||||
},
|
||||
addTask(data) {
|
||||
let list = []
|
||||
data.isSet = false
|
||||
list.push(data)
|
||||
let list = [];
|
||||
data.isSet = false;
|
||||
list.push(data);
|
||||
let param = {};
|
||||
param.messageDetail = list
|
||||
this.result = this.$post("/notice/save/message/task", param, () => {
|
||||
|
|
|
@ -151,26 +151,26 @@ export default {
|
|||
data.isReadOnly = true;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = !data.isReadOnly
|
||||
data.webhook = ""
|
||||
data.webhook = '';
|
||||
}
|
||||
},
|
||||
handleEditTask(index,data) {
|
||||
data.isSet = true
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = false
|
||||
data.webhook = ""
|
||||
data.isReadOnly = false;
|
||||
data.webhook = '';
|
||||
} else {
|
||||
data.isReadOnly = true
|
||||
data.isReadOnly = true;
|
||||
}
|
||||
},
|
||||
handleAddTaskModel(type) {
|
||||
let Task = {};
|
||||
Task.event = [];
|
||||
Task.userIds = [];
|
||||
Task.type = "";
|
||||
Task.webhook = "";
|
||||
Task.type = '';
|
||||
Task.webhook = '';
|
||||
Task.isSet = true;
|
||||
Task.identification = "";
|
||||
Task.identification = '';
|
||||
if (type === 'jenkinsTask') {
|
||||
Task.taskType = 'JENKINS_TASK'
|
||||
this.form.jenkinsTask.push(Task)
|
||||
|
|
|
@ -151,27 +151,27 @@ export default {
|
|||
handleEdit(index, data) {
|
||||
data.isReadOnly = true;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = !data.isReadOnly
|
||||
data.webhook = ""
|
||||
data.isReadOnly = !data.isReadOnly;
|
||||
data.webhook = '';
|
||||
}
|
||||
},
|
||||
handleEditTask(index,data) {
|
||||
data.isSet = true
|
||||
data.isSet = true;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = false
|
||||
data.webhook = ""
|
||||
data.isReadOnly = false;
|
||||
data.webhook = '';
|
||||
} else {
|
||||
data.isReadOnly = true
|
||||
data.isReadOnly = true;
|
||||
}
|
||||
},
|
||||
handleAddTaskModel(type) {
|
||||
let Task = {};
|
||||
Task.event = [];
|
||||
Task.userIds = [];
|
||||
Task.type = "";
|
||||
Task.webhook = "";
|
||||
Task.type = '';
|
||||
Task.webhook = '';
|
||||
Task.isSet = true;
|
||||
Task.identification = "";
|
||||
Task.identification = '';
|
||||
if (type === 'jenkinsTask') {
|
||||
Task.taskType = 'JENKINS_TASK'
|
||||
this.form.jenkinsTask.push(Task)
|
||||
|
@ -207,13 +207,13 @@ export default {
|
|||
}
|
||||
},
|
||||
addTask(data) {
|
||||
let list = []
|
||||
data.isSet = false
|
||||
list.push(data)
|
||||
let list = [];
|
||||
data.isSet = false;
|
||||
list.push(data);
|
||||
let param = {};
|
||||
param.messageDetail = list
|
||||
param.messageDetail = list;
|
||||
this.result = this.$post("/notice/save/message/task", param, () => {
|
||||
this.initForm()
|
||||
this.initForm();
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue