This commit is contained in:
chenjianxing 2020-11-23 20:22:10 +08:00
commit 7ddb5f51a3
16 changed files with 80 additions and 64 deletions

View File

@ -112,6 +112,7 @@ public class MailService {
emails.add(u.getEmail()); emails.add(u.getEmail());
}); });
users = emails.toArray(new String[0]); users = emails.toArray(new String[0]);
LogUtil.info("收件人地址"+users);
helper.setText(getContent(Template, context), true); helper.setText(getContent(Template, context), true);
helper.setTo(users); helper.setTo(users);
try { try {
@ -195,7 +196,8 @@ public class MailService {
public void sendTestPlanStartNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) { public void sendTestPlanStartNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
Map<String, String> context = getTestPlanContext(testPlan); Map<String, String> context = getTestPlanContext(testPlan);
context.put("creator", testPlan.getCreator()); User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
context.put("creator", user.getName());
try { try {
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanStart.html"), StandardCharsets.UTF_8); String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanStart.html"), StandardCharsets.UTF_8);
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate); 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) { public void sendTestPlanEndNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
Map<String, String> context = getTestPlanContext(testPlan); Map<String, String> context = getTestPlanContext(testPlan);
context.put("creator", userIds.toString()); context.put("creator", user.getName());
try { try {
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanEnd.html"), StandardCharsets.UTF_8); String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanEnd.html"), StandardCharsets.UTF_8);
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate); 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) { public void sendTestPlanDeleteNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
Map<String, String> context = getTestPlanContext(testPlan); Map<String, String> context = getTestPlanContext(testPlan);
context.put("creator", userIds.toString()); context.put("creator", user.getName());
try { try {
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanDelete.html"), StandardCharsets.UTF_8); String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanDelete.html"), StandardCharsets.UTF_8);
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate); sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);

View File

@ -7,6 +7,7 @@ import io.metersphere.base.mapper.ext.ExtSystemParameterMapper;
import io.metersphere.commons.constants.ParamConstants; import io.metersphere.commons.constants.ParamConstants;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.EncryptUtils; import io.metersphere.commons.utils.EncryptUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.dto.BaseSystemConfigDTO;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.ldap.domain.LdapInfo; import io.metersphere.ldap.domain.LdapInfo;
@ -99,6 +100,7 @@ public class SystemParameterService {
try { try {
javaMailSender.testConnection(); javaMailSender.testConnection();
} catch (MessagingException e) { } catch (MessagingException e) {
LogUtil.error(e);
MSException.throwException(Translator.get("connection_failed")); MSException.throwException(Translator.get("connection_failed"));
} }
} }

View File

@ -318,6 +318,17 @@ public class UserService {
} }
public void updateUser(User user) { public void updateUser(User user) {
// todo 提取重复代码
if (StringUtils.isNotBlank(user.getEmail())) {
UserExample example = new UserExample();
UserExample.Criteria criteria = example.createCriteria();
criteria.andEmailEqualTo(user.getEmail());
criteria.andIdNotEqualTo(user.getId());
if (userMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("user_email_already_exists"));
}
}
user.setUpdateTime(System.currentTimeMillis()); user.setUpdateTime(System.currentTimeMillis());
userMapper.updateByPrimaryKeySelective(user); userMapper.updateByPrimaryKeySelective(user);
// 禁用用户之后剔除在线用户 // 禁用用户之后剔除在线用户

View File

@ -141,7 +141,7 @@ public class TestPlanService {
} }
} }
public List<TestPlan> getTestPlanByName(String name) { public synchronized List<TestPlan> getTestPlanByName(String name) {
TestPlanExample example = new TestPlanExample(); TestPlanExample example = new TestPlanExample();
example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId()) example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
.andNameEqualTo(name); .andNameEqualTo(name);

View File

@ -145,26 +145,26 @@ export default {
data.isReadOnly = true; data.isReadOnly = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = !data.isReadOnly data.isReadOnly = !data.isReadOnly
data.webhook = "" data.webhook = ''
} }
}, },
handleEditTask(index,data) { handleEditTask(index,data) {
data.isSet = true data.isSet = true
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = false data.isReadOnly = false;
data.webhook = "" data.webhook = ''
} else { } else {
data.isReadOnly = true data.isReadOnly = true;
} }
}, },
handleAddTaskModel(type) { handleAddTaskModel(type) {
let Task = {}; let Task = {};
Task.event = []; Task.event = [];
Task.userIds = []; Task.userIds = [];
Task.type = ""; Task.type = '';
Task.webhook = ""; Task.webhook = '';
Task.isSet = true; Task.isSet = true;
Task.identification = ""; Task.identification = '';
if (type === 'jenkinsTask') { if (type === 'jenkinsTask') {
Task.taskType = 'JENKINS_TASK' Task.taskType = 'JENKINS_TASK'
this.form.jenkinsTask.push(Task) this.form.jenkinsTask.push(Task)

View File

@ -146,18 +146,18 @@ export default {
handleEdit(index, data) { handleEdit(index, data) {
data.isReadOnly = true; data.isReadOnly = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = !data.isReadOnly data.isReadOnly = !data.isReadOnly;
data.webhook = "" data.webhook = '';
} }
}, },
handleAddTaskModel(type) { handleAddTaskModel(type) {
let Task = {}; let Task = {};
Task.event = []; Task.event = [];
Task.userIds = []; Task.userIds = [];
Task.type = ""; Task.type = '';
Task.webhook = ""; Task.webhook = '';
Task.isSet = true; Task.isSet = true;
Task.identification = ""; Task.identification = '';
if (type === 'jenkinsTask') { if (type === 'jenkinsTask') {
Task.taskType = 'JENKINS_TASK' Task.taskType = 'JENKINS_TASK'
this.form.jenkinsTask.push(Task) this.form.jenkinsTask.push(Task)
@ -194,21 +194,21 @@ export default {
handleEditTask(index,data) { handleEditTask(index,data) {
data.isSet = true data.isSet = true
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = false data.isReadOnly = false;
data.webhook = "" data.webhook = ''
} else { } else {
data.isReadOnly = true data.isReadOnly = true;
} }
}, },
addTask(data) { addTask(data) {
let list = [] let list = [];
data.isSet = false data.isSet = false;
list.push(data) list.push(data);
let param = {}; let param = {};
param.messageDetail = list param.messageDetail = list;
this.result = this.$post("/notice/save/message/task", param, () => { this.result = this.$post("/notice/save/message/task", param, () => {
this.initForm() this.initForm();
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
}) })
}, },
@ -216,7 +216,7 @@ export default {
if (!data[index].identification) { if (!data[index].identification) {
data.splice(index, 1) data.splice(index, 1)
} else { } else {
data[index].isSet = false data[index].isSet = false;
} }
}, },

View File

@ -147,8 +147,8 @@ export default {
handleEdit(index, data) { handleEdit(index, data) {
data.isReadOnly = true; data.isReadOnly = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = !data.isReadOnly data.isReadOnly = !data.isReadOnly;
data.webhook = "" data.webhook = ''
} }
}, },
handleAddTaskModel(type) { handleAddTaskModel(type) {
@ -166,13 +166,13 @@ export default {
} }
}, },
handleEditTask(index,data) { handleEditTask(index,data) {
data.isSet = true data.isSet = true;
data.testId = this.testId data.testId = this.testId;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = false data.isReadOnly = false;
data.webhook = "" data.webhook = ''
} else { } else {
data.isReadOnly = true data.isReadOnly = true;
} }
}, },
handleAddTask(index, data) { handleAddTask(index, data) {
@ -192,9 +192,9 @@ export default {
} }
}, },
addTask(data) { addTask(data) {
let list = [] let list = [];
data.isSet = false data.isSet = false;
list.push(data) list.push(data);
let param = {}; let param = {};
param.messageDetail = list param.messageDetail = list
this.result = this.$post("/notice/save/message/task", param, () => { this.result = this.$post("/notice/save/message/task", param, () => {

View File

@ -151,26 +151,26 @@ export default {
data.isReadOnly = true; data.isReadOnly = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = !data.isReadOnly data.isReadOnly = !data.isReadOnly
data.webhook = "" data.webhook = '';
} }
}, },
handleEditTask(index,data) { handleEditTask(index,data) {
data.isSet = true data.isSet = true
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = false data.isReadOnly = false;
data.webhook = "" data.webhook = '';
} else { } else {
data.isReadOnly = true data.isReadOnly = true;
} }
}, },
handleAddTaskModel(type) { handleAddTaskModel(type) {
let Task = {}; let Task = {};
Task.event = []; Task.event = [];
Task.userIds = []; Task.userIds = [];
Task.type = ""; Task.type = '';
Task.webhook = ""; Task.webhook = '';
Task.isSet = true; Task.isSet = true;
Task.identification = ""; Task.identification = '';
if (type === 'jenkinsTask') { if (type === 'jenkinsTask') {
Task.taskType = 'JENKINS_TASK' Task.taskType = 'JENKINS_TASK'
this.form.jenkinsTask.push(Task) this.form.jenkinsTask.push(Task)

View File

@ -151,27 +151,27 @@ export default {
handleEdit(index, data) { handleEdit(index, data) {
data.isReadOnly = true; data.isReadOnly = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = !data.isReadOnly data.isReadOnly = !data.isReadOnly;
data.webhook = "" data.webhook = '';
} }
}, },
handleEditTask(index,data) { handleEditTask(index,data) {
data.isSet = true data.isSet = true;
if (data.type === 'EMAIL') { if (data.type === 'EMAIL') {
data.isReadOnly = false data.isReadOnly = false;
data.webhook = "" data.webhook = '';
} else { } else {
data.isReadOnly = true data.isReadOnly = true;
} }
}, },
handleAddTaskModel(type) { handleAddTaskModel(type) {
let Task = {}; let Task = {};
Task.event = []; Task.event = [];
Task.userIds = []; Task.userIds = [];
Task.type = ""; Task.type = '';
Task.webhook = ""; Task.webhook = '';
Task.isSet = true; Task.isSet = true;
Task.identification = ""; Task.identification = '';
if (type === 'jenkinsTask') { if (type === 'jenkinsTask') {
Task.taskType = 'JENKINS_TASK' Task.taskType = 'JENKINS_TASK'
this.form.jenkinsTask.push(Task) this.form.jenkinsTask.push(Task)
@ -207,13 +207,13 @@ export default {
} }
}, },
addTask(data) { addTask(data) {
let list = [] let list = [];
data.isSet = false data.isSet = false;
list.push(data) list.push(data);
let param = {}; let param = {};
param.messageDetail = list param.messageDetail = list;
this.result = this.$post("/notice/save/message/task", param, () => { this.result = this.$post("/notice/save/message/task", param, () => {
this.initForm() this.initForm();
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
}) })
}, },

View File

@ -58,11 +58,8 @@
<el-form-item :label="$t('test_track.plan.plan_stage')" :label-width="formLabelWidth" prop="stage"> <el-form-item :label="$t('test_track.plan.plan_stage')" :label-width="formLabelWidth" prop="stage">
<el-select v-model="form.stage" clearable :placeholder="$t('test_track.plan.input_plan_stage')"> <el-select v-model="form.stage" clearable :placeholder="$t('test_track.plan.input_plan_stage')">
<el-option :label="$t('test_track.plan.smoke_test')" value="smoke"></el-option> <el-option :label="$t('test_track.plan.smoke_test')" value="smoke"></el-option>
<!--<el-option :label="$t('test_track.plan.functional_test')" value="functional"></el-option>-->
<!--<el-option :label="$t('test_track.plan.integration_testing')" value="integration"></el-option>-->
<el-option :label="$t('test_track.plan.system_test')" value="system"></el-option> <el-option :label="$t('test_track.plan.system_test')" value="system"></el-option>
<el-option :label="$t('test_track.plan.regression_test')" value="regression"></el-option> <el-option :label="$t('test_track.plan.regression_test')" value="regression"></el-option>
<!--<el-option :label="$t('test_track.plan.version_validation')" value="version"></el-option>-->
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>

View File

@ -208,11 +208,9 @@ export default {
methods: { methods: {
initTableData() { initTableData() {
if (this.planId) { if (this.planId) {
// param.planId = this.planId;
this.condition.planId = this.planId; this.condition.planId = this.planId;
} }
if (this.selectNodeIds && this.selectNodeIds.length > 0) { if (this.selectNodeIds && this.selectNodeIds.length > 0) {
// param.nodeIds = this.selectNodeIds;
this.condition.nodeIds = this.selectNodeIds; this.condition.nodeIds = this.selectNodeIds;
} }
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => { this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {

View File

@ -293,6 +293,8 @@
this.projectId = data[0].id; this.projectId = data[0].id;
this.projectName = data[0].name; this.projectName = data[0].name;
this.search(); this.search();
//
this.getProjectNode(this.projectId)
} }
}) })
} }

View File

@ -129,6 +129,10 @@ export default {
pre { pre {
margin: 0 0; margin: 0 0;
white-space: pre-wrap;
word-wrap: break-word;
width: 100%;
line-height: 20px;
} }
.comment-delete { .comment-delete {

View File

@ -231,7 +231,6 @@
this.selectIds.add(item.id); this.selectIds.add(item.id);
}); });
} else { } else {
// this.selectIds.clear();
this.testReviews.forEach(item => { this.testReviews.forEach(item => {
if (this.selectIds.has(item.id)) { if (this.selectIds.has(item.id)) {
this.selectIds.delete(item.id); this.selectIds.delete(item.id);

View File

@ -389,7 +389,7 @@ export default {
this.saveReport(reportId); this.saveReport(reportId);
}, },
saveReport(reportId) { saveReport(reportId) {
// this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId});
}, },
getComments(testCase) { getComments(testCase) {
let id = ''; let id = '';

View File

@ -301,7 +301,6 @@ export default {
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;
}, },
handleEdit(testCase, index) { handleEdit(testCase, index) {
// console.log(testCase)
this.isReadOnly = false; this.isReadOnly = false;
if (!checkoutTestManagerOrTestUser()) { if (!checkoutTestManagerOrTestUser()) {
this.isReadOnly = true; this.isReadOnly = true;