fix(项目报告): 修复项目报告发送邮件失败的问题
--bug=1018499 --user=宋天阳 【报表管理】发送报告提示异常 https://www.tapd.cn/55049933/s/1269178
This commit is contained in:
parent
53aa0fe219
commit
271b375b43
|
@ -11,10 +11,8 @@ public class EnterpriseReportContentStep implements Serializable {
|
||||||
private String type;
|
private String type;
|
||||||
//type为report
|
//type为report
|
||||||
private String reportRecordId;
|
private String reportRecordId;
|
||||||
// @JsonProperty("reportRecordData")
|
private Map<String, Object> reportRecordData;
|
||||||
private Map<String, String> reportRecordData;
|
|
||||||
private String recordImageContent;
|
private String recordImageContent;
|
||||||
// @JsonProperty("tableData")
|
|
||||||
private Map<String, String> tableData;
|
private Map<String, String> tableData;
|
||||||
//type为txt
|
//type为txt
|
||||||
private String previewContext;
|
private String previewContext;
|
||||||
|
|
|
@ -3,8 +3,8 @@ package io.metersphere.reportstatistics.service;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.EnterpriseTestReportMapper;
|
import io.metersphere.base.mapper.EnterpriseTestReportMapper;
|
||||||
import io.metersphere.base.mapper.EnterpriseTestReportSendRecordMapper;
|
import io.metersphere.base.mapper.EnterpriseTestReportSendRecordMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtEnterpriseTestReportMapper;
|
|
||||||
import io.metersphere.base.mapper.ext.BaseUserGroupMapper;
|
import io.metersphere.base.mapper.ext.BaseUserGroupMapper;
|
||||||
|
import io.metersphere.base.mapper.ext.ExtEnterpriseTestReportMapper;
|
||||||
import io.metersphere.commons.constants.ScheduleGroup;
|
import io.metersphere.commons.constants.ScheduleGroup;
|
||||||
import io.metersphere.commons.constants.ScheduleStatus;
|
import io.metersphere.commons.constants.ScheduleStatus;
|
||||||
import io.metersphere.commons.constants.ScheduleType;
|
import io.metersphere.commons.constants.ScheduleType;
|
||||||
|
@ -408,7 +408,8 @@ public class EnterpriseTestReportService {
|
||||||
StringBuffer tableBuffer = new StringBuffer();
|
StringBuffer tableBuffer = new StringBuffer();
|
||||||
tableBuffer.append("<table cellspacing=\"0\" cellpadding=\"0\" style=\"width: 100%;border: 1px\">");
|
tableBuffer.append("<table cellspacing=\"0\" cellpadding=\"0\" style=\"width: 100%;border: 1px\">");
|
||||||
try {
|
try {
|
||||||
TestCaseCountTableDataDTO showTable = JSON.parseObject(step.getReportRecordData().get("showTable"), TestCaseCountTableDataDTO.class);
|
String showTableJsonStr = JSON.toJSONString(step.getReportRecordData().get("showTable"));
|
||||||
|
TestCaseCountTableDataDTO showTable = JSON.parseObject(showTableJsonStr, TestCaseCountTableDataDTO.class);
|
||||||
tableBuffer.append("<tr style=\"font-size: 14px;font-weight: 700;color: #909399;text-align: left;\">");
|
tableBuffer.append("<tr style=\"font-size: 14px;font-weight: 700;color: #909399;text-align: left;\">");
|
||||||
for (TestCaseCountTableItemDataDTO itemData : showTable.getHeads()) {
|
for (TestCaseCountTableItemDataDTO itemData : showTable.getHeads()) {
|
||||||
String tableHeadValue = itemData.getValue();
|
String tableHeadValue = itemData.getValue();
|
||||||
|
@ -454,6 +455,7 @@ public class EnterpriseTestReportService {
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
LogUtil.error("解析表格数据出错!", e);
|
||||||
}
|
}
|
||||||
tableBuffer.append("</table>");
|
tableBuffer.append("</table>");
|
||||||
returnReportContentBuffer.append(tableBuffer);
|
returnReportContentBuffer.append(tableBuffer);
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default {
|
||||||
placeholder: {
|
placeholder: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
errorInfor: String,
|
errorInfo: String,
|
||||||
addTagOnKeys: {
|
addTagOnKeys: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [13, 188, 9]
|
default: () => [13, 188, 9]
|
||||||
|
@ -119,8 +119,8 @@ export default {
|
||||||
this.innerTags.push(tag)
|
this.innerTags.push(tag)
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
if (tag !== "" && this.errorInfor) {
|
if (tag !== "" && this.errorInfo) {
|
||||||
this.$error(this.errorInfor);
|
this.$error(this.errorInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -245,16 +245,16 @@ export default {
|
||||||
if (command === 'jpg') {
|
if (command === 'jpg') {
|
||||||
imageType = 'image/jpg';
|
imageType = 'image/jpg';
|
||||||
}
|
}
|
||||||
let returnImageDatas = "";
|
let returnImageData = "";
|
||||||
if (document.getElementById(this.reportId)) {
|
if (document.getElementById(this.reportId)) {
|
||||||
let chartsCanvas = document.getElementById(this.reportId).querySelectorAll('canvas')[0];
|
let chartsCanvas = document.getElementById(this.reportId).querySelectorAll('canvas')[0];
|
||||||
if (chartsCanvas) {
|
if (chartsCanvas) {
|
||||||
// toDataURL()是canvas对象的一种方法,用于将canvas对象转换为base64位编码
|
// toDataURL()是canvas对象的一种方法,用于将canvas对象转换为base64位编码
|
||||||
returnImageDatas = chartsCanvas && chartsCanvas.toDataURL(imageType);
|
returnImageData = chartsCanvas && chartsCanvas.toDataURL(imageType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$emit("getImage", returnImageDatas);
|
this.$emit("getImage", returnImageData);
|
||||||
return returnImageDatas;
|
return returnImageData;
|
||||||
},
|
},
|
||||||
exportCommand(command) {
|
exportCommand(command) {
|
||||||
let fileName = 'report_pic.' + command;
|
let fileName = 'report_pic.' + command;
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
props: {
|
props: {
|
||||||
tableData: Array,
|
tableData: Array,
|
||||||
groupName: String,
|
groupName: String,
|
||||||
showColoums: Array,
|
showColumns: Array,
|
||||||
fullScreen: {
|
fullScreen: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default() {
|
default() {
|
||||||
|
@ -80,8 +80,8 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isShowColumn(type) {
|
isShowColumn(type) {
|
||||||
if(this.showColoums){
|
if (this.showColumns) {
|
||||||
return this.showColoums.findIndex(item => item=== type) >= 0;
|
return this.showColumns.findIndex(item => item === type) >= 0;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initDatas() {
|
initData() {
|
||||||
if (this.$refs.reportItemPic && this.$refs.reportItemPic.length > 0) {
|
if (this.$refs.reportItemPic && this.$refs.reportItemPic.length > 0) {
|
||||||
this.$refs.reportItemPic.forEach(item => {
|
this.$refs.reportItemPic.forEach(item => {
|
||||||
item.initData();
|
item.initData();
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
ref="analysisChart" :load-option="loadOption" :pie-option="pieOption"/>
|
ref="analysisChart" :load-option="loadOption" :pie-option="pieOption"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-row">
|
<div class="ms-row">
|
||||||
<report-table :full-screen="false" :group-name="options.xaxis" :show-coloums="options.yaxis"
|
<report-table :full-screen="false" :group-name="options.xaxis" :show-columns="options.yaxis"
|
||||||
:tableData="tableData"/>
|
:tableData="tableData"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -71,7 +71,7 @@ export default {
|
||||||
deleteDetail() {
|
deleteDetail() {
|
||||||
this.$emit("deleteDetail", this.reportDetail);
|
this.$emit("deleteDetail", this.reportDetail);
|
||||||
},
|
},
|
||||||
editAttachDataName(comman) {
|
editAttachDataName(common) {
|
||||||
this.reportDetail.nameIsEdit = !this.reportDetail.nameIsEdit;
|
this.reportDetail.nameIsEdit = !this.reportDetail.nameIsEdit;
|
||||||
},
|
},
|
||||||
initPic() {
|
initPic() {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
:label-width="formLabelWidth"
|
:label-width="formLabelWidth"
|
||||||
prop="addressee">
|
prop="addressee">
|
||||||
<ms-input-tag :currentScenario="form" prop="addressee"
|
<ms-input-tag :currentScenario="form" prop="addressee"
|
||||||
:error-infor="$t('commons.report_statistics.alert.mail_is_exist')"
|
:error-info="$t('commons.report_statistics.alert.mail_is_exist')"
|
||||||
:placeholder="$t('mail.enter_mail_addressee')"
|
:placeholder="$t('mail.enter_mail_addressee')"
|
||||||
@onblur="validateForm">
|
@onblur="validateForm">
|
||||||
</ms-input-tag>
|
</ms-input-tag>
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
:label-width="formLabelWidth"
|
:label-width="formLabelWidth"
|
||||||
prop="duplicated">
|
prop="duplicated">
|
||||||
<ms-input-tag :currentScenario="form" prop="duplicated"
|
<ms-input-tag :currentScenario="form" prop="duplicated"
|
||||||
:error-infor="$t('commons.report_statistics.alert.mail_is_exist')"
|
:error-info="$t('commons.report_statistics.alert.mail_is_exist')"
|
||||||
:placeholder="$t('mail.enter_mail_duplicate')"
|
:placeholder="$t('mail.enter_mail_duplicate')"
|
||||||
@onblur="validateForm"/>
|
@onblur="validateForm"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -126,7 +126,7 @@
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
|
||||||
</ms-form-divider>
|
</ms-form-divider>
|
||||||
<email-compnent :read-only="false" :data.sync="form.reportContent" ref="emailCompnent"/>
|
<email-component :read-only="false" :data.sync="form.reportContent" ref="emailComponent"/>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
|
@ -168,7 +168,7 @@ import {getUUID, listenGoBack, removeGoBackListener} from "metersphere-frontend/
|
||||||
import {getCurrentProjectID, getCurrentUserId} from "metersphere-frontend/src/utils/token";
|
import {getCurrentProjectID, getCurrentUserId} from "metersphere-frontend/src/utils/token";
|
||||||
import MsInputTag from "@/business/compnent/form/MsInputTag";
|
import MsInputTag from "@/business/compnent/form/MsInputTag";
|
||||||
import MsFormDivider from "metersphere-frontend/src/components/MsFormDivider";
|
import MsFormDivider from "metersphere-frontend/src/components/MsFormDivider";
|
||||||
import EmailCompnent from "@/business/enterprisereport/components/container/EmailComponent";
|
import EmailComponent from "@/business/enterprisereport/components/container/EmailComponent";
|
||||||
import ReportStatisticsDialog from "@/business/enterprisereport/components/dialog/SelectReportStatisticsDialog";
|
import ReportStatisticsDialog from "@/business/enterprisereport/components/dialog/SelectReportStatisticsDialog";
|
||||||
import EmailPreviewDialog from "@/business/enterprisereport/components/dialog/EmailPreviewDialog";
|
import EmailPreviewDialog from "@/business/enterprisereport/components/dialog/EmailPreviewDialog";
|
||||||
import {getUesrGroup} from "@/api/user";
|
import {getUesrGroup} from "@/api/user";
|
||||||
|
@ -177,7 +177,7 @@ import {createEnterpriseReport, updateEnterpriseReport} from "@/api/enterprise-r
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ProjectReportEditDialog",
|
name: "ProjectReportEditDialog",
|
||||||
components: {MsFormDivider, MsInputTag, EmailCompnent, ReportStatisticsDialog, EmailPreviewDialog},
|
components: {MsFormDivider, MsInputTag, EmailComponent, ReportStatisticsDialog, EmailPreviewDialog},
|
||||||
data() {
|
data() {
|
||||||
var checkEmail = (rule, value, callback) => {
|
var checkEmail = (rule, value, callback) => {
|
||||||
if (value.length === 0) {
|
if (value.length === 0) {
|
||||||
|
@ -371,8 +371,8 @@ export default {
|
||||||
//检查是否符合邮件规范
|
//检查是否符合邮件规范
|
||||||
this.$refs['planFrom'].validate((valid) => {
|
this.$refs['planFrom'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.$refs.emailCompnent) {
|
if (this.$refs.emailComponent) {
|
||||||
this.$refs.emailCompnent.initDatas();
|
this.$refs.emailComponent.initData();
|
||||||
}
|
}
|
||||||
|
|
||||||
let param = JSON.parse(JSON.stringify(this.form));
|
let param = JSON.parse(JSON.stringify(this.form));
|
||||||
|
@ -440,8 +440,8 @@ export default {
|
||||||
this.form = JSON.parse(JSON.stringify(this.baseForm));
|
this.form = JSON.parse(JSON.stringify(this.baseForm));
|
||||||
},
|
},
|
||||||
previewReport() {
|
previewReport() {
|
||||||
if (this.$refs.emailCompnent) {
|
if (this.$refs.emailComponent) {
|
||||||
this.$refs.emailCompnent.initDatas();
|
this.$refs.emailComponent.initData();
|
||||||
}
|
}
|
||||||
this.$refs.emailPreviewDialog.open(this.form)
|
this.$refs.emailPreviewDialog.open(this.form)
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
:chart-width="chartWidth" :load-option="loadOption" :pie-option="pieOption"/>
|
:chart-width="chartWidth" :load-option="loadOption" :pie-option="pieOption"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="ms-row" v-if="!isHide">
|
<div class="ms-row" v-if="!isHide">
|
||||||
<test-case-count-table :group-name="getGroupNameStr(options.xaxis)" :show-coloums="options.yaxis"
|
<test-case-count-table :group-name="getGroupNameStr(options.xaxis)" :show-columns="options.yaxis"
|
||||||
:tableData="tableData"/>
|
:tableData="tableData"/>
|
||||||
</div>
|
</div>
|
||||||
</el-main>
|
</el-main>
|
||||||
|
|
|
@ -163,16 +163,16 @@ export default {
|
||||||
if (command === 'jpg') {
|
if (command === 'jpg') {
|
||||||
imageType = 'image/jpg';
|
imageType = 'image/jpg';
|
||||||
}
|
}
|
||||||
let returnImageDatas = "";
|
let returnImageData = "";
|
||||||
if (document.getElementById('picChart')) {
|
if (document.getElementById('picChart')) {
|
||||||
let chartsCanvas = document.getElementById('picChart').querySelectorAll('canvas')[0];
|
let chartsCanvas = document.getElementById('picChart').querySelectorAll('canvas')[0];
|
||||||
if (chartsCanvas) {
|
if (chartsCanvas) {
|
||||||
// toDataURL()是canvas对象的一种方法,用于将canvas对象转换为base64位编码
|
// toDataURL()是canvas对象的一种方法,用于将canvas对象转换为base64位编码
|
||||||
returnImageDatas = chartsCanvas && chartsCanvas.toDataURL(imageType);
|
returnImageData = chartsCanvas && chartsCanvas.toDataURL(imageType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$emit("getImage", returnImageDatas);
|
this.$emit("getImage", returnImageData);
|
||||||
return returnImageDatas;
|
return returnImageData;
|
||||||
},
|
},
|
||||||
exportCommand(command) {
|
exportCommand(command) {
|
||||||
let fileName = 'report_pic.' + command;
|
let fileName = 'report_pic.' + command;
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
props: {
|
props: {
|
||||||
tableData: Array,
|
tableData: Array,
|
||||||
groupName: String,
|
groupName: String,
|
||||||
showColoums: Array,
|
showColumns: Array,
|
||||||
fullScreen: {
|
fullScreen: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default() {
|
default() {
|
||||||
|
@ -80,8 +80,8 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isShowColumn(type) {
|
isShowColumn(type) {
|
||||||
if(this.showColoums){
|
if (this.showColumns) {
|
||||||
return this.showColoums.findIndex(item => item=== type) >= 0;
|
return this.showColumns.findIndex(item => item === type) >= 0;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue