parent
3dbbc6c958
commit
6bba28235a
|
@ -19,9 +19,9 @@ public class TestCaseCountController {
|
|||
@Resource
|
||||
TestCaseCountService testCaseCountService;
|
||||
|
||||
@PostMapping("/initDatas")
|
||||
@PostMapping("/initData")
|
||||
public Map<String, List<Map<String, String>>> initDatas(@RequestBody TestCaseCountRequest request) {
|
||||
Map<String, List<Map<String, String>>> returnMap = testCaseCountService.getSelectFilterDatas(request.getProjectId());
|
||||
Map<String, List<Map<String, String>>> returnMap = testCaseCountService.getSelectFilterData(request.getProjectId());
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package io.metersphere.reportstatistics.dto.request.emun;
|
||||
|
||||
public enum EnterpriseReportStatus {
|
||||
NEW, SENDED, SEND_FAILD
|
||||
NEW, SENDED, SEND_FAILED
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ public class EnterpriseTestReportService {
|
|||
request.setCreateTime(time);
|
||||
request.setUpdateTime(time);
|
||||
|
||||
boolean sendSucess = false;
|
||||
boolean sendSuccess = false;
|
||||
if (StringUtils.isEmpty(request.getStatus())) {
|
||||
request.setStatus(EnterpriseReportStatus.NEW.name());
|
||||
} else if (StringUtils.equalsIgnoreCase(request.getStatus(), "send")) {
|
||||
|
@ -160,14 +160,14 @@ public class EnterpriseTestReportService {
|
|||
try {
|
||||
this.sendEmail(request, false);
|
||||
request.setLastSendTime(time);
|
||||
sendSucess = true;
|
||||
sendSuccess = true;
|
||||
} catch (Exception e) {
|
||||
request.setStatus(EnterpriseReportStatus.SEND_FAILD.name());
|
||||
request.setStatus(EnterpriseReportStatus.SEND_FAILED.name());
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
enterpriseTestReportMapper.insert(request);
|
||||
if (sendSucess) {
|
||||
if (sendSuccess) {
|
||||
this.insertEnterpriseSendRecord(request);
|
||||
}
|
||||
return request;
|
||||
|
@ -175,20 +175,20 @@ public class EnterpriseTestReportService {
|
|||
|
||||
public EnterpriseTestReport send(EnterpriseTestReportWithBLOBs param) {
|
||||
EnterpriseTestReportWithBLOBs bloBs = enterpriseTestReportMapper.selectByPrimaryKey(param.getId());
|
||||
boolean sendSucess = false;
|
||||
boolean sendSuccess = false;
|
||||
if (bloBs != null) {
|
||||
try {
|
||||
this.sendEmail(bloBs, true);
|
||||
bloBs.setStatus(EnterpriseReportStatus.SENDED.name());
|
||||
bloBs.setLastSendTime(System.currentTimeMillis());
|
||||
sendSucess = true;
|
||||
sendSuccess = true;
|
||||
} catch (Exception e) {
|
||||
bloBs.setStatus(EnterpriseReportStatus.SEND_FAILD.name());
|
||||
bloBs.setStatus(EnterpriseReportStatus.SEND_FAILED.name());
|
||||
LogUtil.error("Send email error!", e);
|
||||
MSException.throwException("Send email error!");
|
||||
}
|
||||
enterpriseTestReportMapper.updateByPrimaryKeySelective(bloBs);
|
||||
if (sendSucess) {
|
||||
if (sendSuccess) {
|
||||
this.insertEnterpriseSendRecord(bloBs);
|
||||
}
|
||||
}
|
||||
|
@ -205,20 +205,20 @@ public class EnterpriseTestReportService {
|
|||
long time = System.currentTimeMillis();
|
||||
request.setUpdateTime(time);
|
||||
|
||||
boolean sendSucess = false;
|
||||
boolean sendSuccess = false;
|
||||
if (StringUtils.equalsIgnoreCase(request.getStatus(), "send")) {
|
||||
request.setStatus(EnterpriseReportStatus.SENDED.name());
|
||||
try {
|
||||
this.sendEmail(request, false);
|
||||
request.setLastSendTime(time);
|
||||
sendSucess = true;
|
||||
sendSuccess = true;
|
||||
} catch (Exception e) {
|
||||
request.setStatus(EnterpriseReportStatus.SEND_FAILD.name());
|
||||
request.setStatus(EnterpriseReportStatus.SEND_FAILED.name());
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
enterpriseTestReportMapper.updateByPrimaryKeySelective(request);
|
||||
if (sendSucess) {
|
||||
if (sendSuccess) {
|
||||
this.insertEnterpriseSendRecord(request);
|
||||
}
|
||||
return request;
|
||||
|
@ -499,7 +499,6 @@ public class EnterpriseTestReportService {
|
|||
// 读取图片字节数组
|
||||
try {
|
||||
InputStream in = fileSystemResource.getInputStream();
|
||||
System.out.println("文件大小(字节)=" + in.available());
|
||||
data = new byte[in.available()];
|
||||
in.read(data);
|
||||
in.close();
|
||||
|
@ -538,13 +537,13 @@ public class EnterpriseTestReportService {
|
|||
return returnList;
|
||||
}
|
||||
|
||||
public List<EnterpriseTestReportDTO> parseDTO(List<EnterpriseTestReport> modleList) {
|
||||
if (CollectionUtils.isEmpty(modleList)) {
|
||||
public List<EnterpriseTestReportDTO> parseDTO(List<EnterpriseTestReport> modelList) {
|
||||
if (CollectionUtils.isEmpty(modelList)) {
|
||||
return new ArrayList<>(0);
|
||||
} else {
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
List<String> idList = new ArrayList<>();
|
||||
modleList.forEach(item -> {
|
||||
modelList.forEach(item -> {
|
||||
idList.add(item.getId());
|
||||
if (!userIdList.contains(item.getCreateUser())) {
|
||||
userIdList.add(item.getCreateUser());
|
||||
|
@ -554,7 +553,7 @@ public class EnterpriseTestReportService {
|
|||
Map<String, Schedule> scheduleMap = scheduleByResourceIds.stream().collect(Collectors.toMap(Schedule::getResourceId, Schedule -> Schedule));
|
||||
List<EnterpriseTestReportDTO> returnList = new ArrayList<>();
|
||||
Map<String, User> userMap = baseUserService.queryNameByIds(userIdList);
|
||||
for (EnterpriseTestReport model : modleList) {
|
||||
for (EnterpriseTestReport model : modelList) {
|
||||
EnterpriseTestReportDTO dto = new EnterpriseTestReportDTO();
|
||||
BeanUtils.copyBean(dto, model);
|
||||
if (userMap.containsKey(dto.getCreateUser())) {
|
||||
|
|
|
@ -84,7 +84,7 @@ public class ReportStatisticsService {
|
|||
boolean isReportNeedUpdate = this.isReportNeedUpdate(blob);
|
||||
if (isReportNeedUpdate) {
|
||||
TestCaseCountRequest countRequest = JSON.parseObject(blob.getSelectOption(), TestCaseCountRequest.class);
|
||||
Map<String, Object> returnDataOption = this.reloadDatas(countRequest, JSON.toJSONString(dataOption.get("chartType")));
|
||||
Map<String, Object> returnDataOption = this.reloadData(countRequest, JSON.toJSONString(dataOption.get("chartType")));
|
||||
if (returnDataOption != null) {
|
||||
dataOption = returnDataOption;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class ReportStatisticsService {
|
|||
return blob;
|
||||
}
|
||||
|
||||
private Map<String, Object> reloadDatas(TestCaseCountRequest request, String chartType) {
|
||||
private Map<String, Object> reloadData(TestCaseCountRequest request, String chartType) {
|
||||
if (StringUtils.isEmpty(chartType)) {
|
||||
chartType = "bar";
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class ReportStatisticsService {
|
|||
loadOptionObject.put("xaxis", JSON.toJSONString(testCaseCountResponse.getBarChartDTO().getXAxis()));
|
||||
loadOptionObject.put("yAxis", JSON.toJSONString(testCaseCountResponse.getBarChartDTO().getYAxis()));
|
||||
loadOptionObject.put("tooltip", "{}");
|
||||
loadOptionObject.put("lable", "{}");
|
||||
loadOptionObject.put("label", "{}");
|
||||
if (!CollectionUtils.isEmpty(testCaseCountResponse.getBarChartDTO().getSeries())) {
|
||||
List<Series> list = testCaseCountResponse.getBarChartDTO().getSeries();
|
||||
for (Series model : list) {
|
||||
|
|
|
@ -146,16 +146,16 @@ public class TestAnalysisService {
|
|||
dto.setSeries(seriesList);
|
||||
}
|
||||
|
||||
private void formatLegend(Legend legend, List<String> datas, TestAnalysisChartRequest request) {
|
||||
private void formatLegend(Legend legend, List<String> dataList, TestAnalysisChartRequest request) {
|
||||
Map<String, Boolean> selected = new LinkedHashMap<>();
|
||||
List<String> list = new LinkedList<>();
|
||||
if (CollectionUtils.isEmpty(datas)) {
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
selected.put(ADD, request.isCreateCase());
|
||||
selected.put(UPDATE, request.isUpdateCase());
|
||||
list.add(ADD);
|
||||
list.add(UPDATE);
|
||||
} else {
|
||||
datas.forEach(item -> {
|
||||
dataList.forEach(item -> {
|
||||
selected.put(item + "-" + ADD, request.isCreateCase());
|
||||
selected.put(item + "-" + UPDATE, request.isUpdateCase());
|
||||
list.add(item + "-" + ADD);
|
||||
|
|
|
@ -12,7 +12,7 @@ import io.metersphere.reportstatistics.dto.table.TestCaseCountTableItemDataDTO;
|
|||
import io.metersphere.reportstatistics.dto.table.TestCaseCountTableRowDTO;
|
||||
import io.metersphere.reportstatistics.service.remote.apitest.ApiCaseRemoteService;
|
||||
import io.metersphere.reportstatistics.service.remote.apitest.ScenarioRemoteService;
|
||||
import io.metersphere.reportstatistics.service.remote.performancetest.PerformanceRemoteService;
|
||||
import io.metersphere.reportstatistics.service.remote.performance.PerformanceRemoteService;
|
||||
import io.metersphere.reportstatistics.service.remote.projectmanagement.TestCaseTemplateRemoteService;
|
||||
import io.metersphere.reportstatistics.service.remote.track.TestCaseRemoteService;
|
||||
import io.metersphere.request.member.QueryMemberRequest;
|
||||
|
@ -623,7 +623,7 @@ public class TestCaseCountService {
|
|||
}
|
||||
}
|
||||
|
||||
Map<String, TestCaseCountSummary> returmMap = new LinkedHashMap<>();
|
||||
Map<String, TestCaseCountSummary> returnMap = new LinkedHashMap<>();
|
||||
|
||||
if (StringUtils.equalsIgnoreCase(order, "desc")) {
|
||||
TreeMap<Long, List<TestCaseCountSummary>> treeMap = new TreeMap<>();
|
||||
|
@ -643,7 +643,7 @@ public class TestCaseCountService {
|
|||
|
||||
for (int i = sortedList.size(); i > 0; i--) {
|
||||
TestCaseCountSummary model = sortedList.get(i - 1);
|
||||
returmMap.put(model.groupName, model);
|
||||
returnMap.put(model.groupName, model);
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(order, "asc")) {
|
||||
TreeMap<Long, List<TestCaseCountSummary>> treeMap = new TreeMap<>();
|
||||
|
@ -658,15 +658,15 @@ public class TestCaseCountService {
|
|||
}
|
||||
for (List<TestCaseCountSummary> list : treeMap.values()) {
|
||||
for (TestCaseCountSummary model : list) {
|
||||
returmMap.put(model.groupName, model);
|
||||
returnMap.put(model.groupName, model);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
returmMap = summaryMap;
|
||||
returnMap = summaryMap;
|
||||
}
|
||||
|
||||
|
||||
return returmMap;
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
private Map<String, String> getUserIdMap() {
|
||||
|
@ -807,11 +807,11 @@ public class TestCaseCountService {
|
|||
dto.setLegend(legend);
|
||||
}
|
||||
|
||||
private void formatLegend(Legend legend, List<String> datas, TestCaseCountRequest yrequest) {
|
||||
private void formatLegend(Legend legend, List<String> dataList, TestCaseCountRequest yrequest) {
|
||||
Map<String, Boolean> selected = new LinkedHashMap<>();
|
||||
List<String> list = new LinkedList<>();
|
||||
legend.setSelected(selected);
|
||||
legend.setData(datas);
|
||||
legend.setData(dataList);
|
||||
}
|
||||
|
||||
private void formatTable(List<TestCaseCountTableDTO> dtos, Map<String, TestCaseCountSummary> summaryMap) {
|
||||
|
@ -830,7 +830,7 @@ public class TestCaseCountService {
|
|||
return map;
|
||||
}
|
||||
|
||||
public Map<String, List<Map<String, String>>> getSelectFilterDatas(String projectId) {
|
||||
public Map<String, List<Map<String, String>>> getSelectFilterData(String projectId) {
|
||||
Map<String, List<Map<String, String>>> returnMap = new HashMap<>();
|
||||
|
||||
//组装用户
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.reportstatistics.service.remote.performancetest;
|
||||
package io.metersphere.reportstatistics.service.remote.performance;
|
||||
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.reportstatistics.dto.TestCaseCountChartResult;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.reportstatistics.service.remote.performancetest;
|
||||
package io.metersphere.reportstatistics.service.remote.performance;
|
||||
|
||||
import io.metersphere.commons.constants.MicroServiceName;
|
||||
import io.metersphere.service.RemoteService;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.reportstatistics.service.remote.performancetest;
|
||||
package io.metersphere.reportstatistics.service.remote.performance;
|
||||
|
||||
import io.metersphere.commons.constants.MicroServiceName;
|
||||
import io.metersphere.service.RemoteService;
|
|
@ -13,7 +13,7 @@ public class ScheduleUtil {
|
|||
if (!CronExpression.isValidExpression(cron)) {
|
||||
return 0;
|
||||
}
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity("Caclulate Date").withSchedule(CronScheduleBuilder.cronSchedule(cron)).build();
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity("Calculate Date").withSchedule(CronScheduleBuilder.cronSchedule(cron)).build();
|
||||
Date time0 = trigger.getStartTime();
|
||||
Date time1 = trigger.getFireTimeAfter(time0);
|
||||
return time1 == null ? 0 : time1.getTime();
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
-- 更改状态
|
||||
update enterprise_test_report set status ='SEND_FAILED' where status = 'SEND_FAILD';
|
|
@ -9,6 +9,6 @@ export function getCountReport(param) {
|
|||
}
|
||||
|
||||
export function initCountData(param) {
|
||||
return post("/report/test/case/count/initDatas", param)
|
||||
return post("/report/test/case/count/initData", param)
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ export default {
|
|||
popoverWidth: "0px",//下拉框大小
|
||||
isShowSelect: false, // 是否显示树状选择器
|
||||
options: [],//select option选项
|
||||
returnDatas: [],//返回给父组件数组对象
|
||||
returnData: [],//返回给父组件数组对象
|
||||
returnDataKeys: [],//返回父组件数组主键值
|
||||
filterText: "",
|
||||
loading: false,
|
||||
|
@ -217,7 +217,7 @@ export default {
|
|||
// 多选
|
||||
if (Object.prototype.toString.call(this.defaultKey).indexOf("Array") != -1) {
|
||||
if (Object.prototype.toString.call(this.defaultKey[0]).indexOf("Object") != -1) {//对象
|
||||
this.setDatas(this.defaultKey);
|
||||
this.setDataFromInit(this.defaultKey);
|
||||
} else if (Object.prototype.toString.call(this.defaultKey[0]).indexOf("Number") != -1
|
||||
|| Object.prototype.toString.call(this.defaultKey[0]).indexOf("String") != -1) {
|
||||
this.setKeys(this.defaultKey);
|
||||
|
@ -270,7 +270,7 @@ export default {
|
|||
this.returnDataKeys = this.options.map((item) => {
|
||||
return item.value;
|
||||
});
|
||||
this.returnDatas = t;
|
||||
this.returnData = t;
|
||||
}
|
||||
|
||||
this.selectNodeIds = [];
|
||||
|
@ -290,7 +290,7 @@ export default {
|
|||
//单选:清空选中
|
||||
clean() {
|
||||
this.$refs.tree.setCurrentKey(null);//清除树选中key
|
||||
this.returnDatas = null;
|
||||
this.returnData = null;
|
||||
this.returnDataKeys = '';
|
||||
this.selectNodeIds = [];
|
||||
this.popoverHide();
|
||||
|
@ -309,7 +309,7 @@ export default {
|
|||
setData(data) {
|
||||
this.options = [];
|
||||
this.options.push({label: data[this.obj.label], value: data[this.obj.id]});
|
||||
this.returnDatas = data;
|
||||
this.returnData = data;
|
||||
this.returnDataKeys = data[this.obj.id]
|
||||
this.selectNodeIds = [];
|
||||
this.getChildNodeId(data, this.selectNodeIds);
|
||||
|
@ -328,13 +328,13 @@ export default {
|
|||
return {label: node.label, value: node.key};
|
||||
}
|
||||
});
|
||||
this.returnDatas = t;
|
||||
this.returnData = t;
|
||||
this.popoverHide()
|
||||
},
|
||||
//多选:设置、初始化对象
|
||||
setDatas(data) {
|
||||
setDataFromInit(data) {
|
||||
this.$refs.tree.setCheckedNodes(data);
|
||||
this.returnDatas = data;
|
||||
this.returnData = data;
|
||||
let t = [];
|
||||
data.map((item) => {//设置option选项
|
||||
t.push(item[this.obj.id]);
|
||||
|
@ -360,7 +360,7 @@ export default {
|
|||
//下拉框关闭执行
|
||||
popoverHide() {
|
||||
this.$emit('setSelectNodeIds', this.selectNodeIds);
|
||||
this.$emit('getValue', this.returnDataKeys, this.returnDatas ? this.returnDatas : {});
|
||||
this.$emit('getValue', this.returnDataKeys, this.returnData ? this.returnData : {});
|
||||
},
|
||||
// 多选,清空所有勾选
|
||||
clearSelectedNodes() {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
:content="$t('commons.report_statistics.table.draft')"/>
|
||||
<ms-tag v-else-if="scope.row.status == 'SENDED'" type="success" effect="plain"
|
||||
:content="$t('commons.report_statistics.table.sended')"/>
|
||||
<ms-tag v-else-if="scope.row.status == 'SEND_FAILD'" type="error" effect="plain"
|
||||
<ms-tag v-else-if="scope.row.status == 'SEND_FAILED'" type="error" effect="plain"
|
||||
:content="$t('commons.report_statistics.table.send_error')"/>
|
||||
<ms-tag v-else type="effect" effect="plain" :content="scope.row.status"/>
|
||||
</template>
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||
|
||||
public interface ExtTestAnalysisMapper {
|
||||
|
||||
List<TestAnalysisChartResult> getCraeteCaseReport(TestAnalysisChartRequest request);
|
||||
List<TestAnalysisChartResult> getCreateCaseReport(TestAnalysisChartRequest request);
|
||||
|
||||
List<TestAnalysisChartResult> getUpdateCaseReport(TestAnalysisChartRequest request);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="io.metersphere.base.mapper.ext.ExtTestAnalysisMapper">
|
||||
|
||||
<select id="getCraeteCaseReport" resultType="io.metersphere.dto.TestAnalysisChartResult">
|
||||
<select id="getCreateCaseReport" resultType="io.metersphere.dto.TestAnalysisChartResult">
|
||||
select dateStr, ifnull(tt.num,0) countNum
|
||||
from
|
||||
(
|
||||
|
|
Loading…
Reference in New Issue