parent
66c14eea89
commit
d99fa9b568
|
@ -50,9 +50,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -86,18 +83,34 @@ public class ApiAutomationService {
|
|||
private ApiScenarioReportMapper apiScenarioReportMapper;
|
||||
|
||||
public List<ApiScenarioDTO> list(ApiScenarioRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
if (request.isSelectThisWeedData()) {
|
||||
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
||||
if (weekFirstTime != null) {
|
||||
request.setCreateTime(weekFirstTime.getTime());
|
||||
}
|
||||
}
|
||||
request = this.initRequest(request,true,true);
|
||||
List<ApiScenarioDTO> list = extApiScenarioMapper.list(request);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化部分参数
|
||||
* @param request
|
||||
* @param setDefultOrders
|
||||
* @param checkThisWeekData
|
||||
* @return
|
||||
*/
|
||||
private ApiScenarioRequest initRequest(ApiScenarioRequest request,boolean setDefultOrders, boolean checkThisWeekData) {
|
||||
if(setDefultOrders){
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
}
|
||||
if(checkThisWeekData){
|
||||
if (request.isSelectThisWeedData()) {
|
||||
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
||||
if (weekFirstTime != null) {
|
||||
request.setCreateTime(weekFirstTime.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
public List<String> selectIdsNotExistsInPlan(String projectId, String planId) {
|
||||
return extApiScenarioMapper.selectIdsNotExistsInPlan(projectId, planId);
|
||||
|
|
|
@ -79,22 +79,35 @@ public class ApiDefinitionService {
|
|||
private static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
|
||||
|
||||
public List<ApiDefinitionResult> list(ApiDefinitionRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
|
||||
//判断是否查询本周数据
|
||||
if (request.isSelectThisWeedData()) {
|
||||
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
||||
if (weekFirstTime != null) {
|
||||
request.setCreateTime(weekFirstTime.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
request = this.initRequest(request,true,true);
|
||||
List<ApiDefinitionResult> resList = extApiDefinitionMapper.list(request);
|
||||
calculateResult(resList);
|
||||
return resList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化部分参数
|
||||
* @param request
|
||||
* @param setDefultOrders
|
||||
* @param checkThisWeekData
|
||||
* @return
|
||||
*/
|
||||
private ApiDefinitionRequest initRequest(ApiDefinitionRequest request,boolean setDefultOrders, boolean checkThisWeekData) {
|
||||
if(setDefultOrders){
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
}
|
||||
if(checkThisWeekData){
|
||||
if (request.isSelectThisWeedData()) {
|
||||
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
||||
if (weekFirstTime != null) {
|
||||
request.setCreateTime(weekFirstTime.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
public ApiDefinition get(String id) {
|
||||
return apiDefinitionMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
|
|
@ -83,14 +83,8 @@ public class ApiTestCaseService {
|
|||
}
|
||||
|
||||
public List<ApiTestCaseDTO> listSimple(ApiTestCaseRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
if (request.isSelectThisWeedData()) {
|
||||
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
||||
if (weekFirstTime != null) {
|
||||
request.setCreateTime(weekFirstTime.getTime());
|
||||
}
|
||||
}
|
||||
request = this.initRequest(request,true,true);
|
||||
|
||||
List<ApiTestCaseDTO> apiTestCases = extApiTestCaseMapper.listSimple(request);
|
||||
if (CollectionUtils.isEmpty(apiTestCases)) {
|
||||
return apiTestCases;
|
||||
|
@ -99,6 +93,29 @@ public class ApiTestCaseService {
|
|||
return apiTestCases;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化部分参数
|
||||
* @param request
|
||||
* @param setDefultOrders
|
||||
* @param checkThisWeekData
|
||||
* @return
|
||||
*/
|
||||
private ApiTestCaseRequest initRequest(ApiTestCaseRequest request, boolean setDefultOrders, boolean checkThisWeekData) {
|
||||
if(setDefultOrders){
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
}
|
||||
if(checkThisWeekData){
|
||||
if (request.isSelectThisWeedData()) {
|
||||
Map<String, Date> weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime");
|
||||
if (weekFirstTime != null) {
|
||||
request.setCreateTime(weekFirstTime.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
public void buildUserInfo(List<? extends ApiTestCaseDTO> apiTestCases) {
|
||||
List<String> userIds = new ArrayList();
|
||||
userIds.addAll(apiTestCases.stream().map(ApiTestCaseDTO::getCreateUserId).collect(Collectors.toList()));
|
||||
|
|
Loading…
Reference in New Issue