提交 2a66c28e authored 作者: 孙洁清's avatar 孙洁清

Merge remote-tracking branch 'origin/master'

# Conflicts: # src/main/java/com/zjty/autotest/config/ProjectInitRun.java # src/main/java/com/zjty/autotest/dao/AutoResultSetDao.java # src/main/java/com/zjty/autotest/service/impl/AsyncServiceImpl.java # src/main/java/com/zjty/autotest/service/impl/AutoResultSetServiceImpl.java
上级 8bb6ef68
......@@ -14,6 +14,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 控制器层
* @author Administrator
......@@ -60,5 +62,12 @@ public class TestReportController {
}
return ResponseResult.errorResult(AppHttpCodeEnum.ERROR);
}
@RequestMapping(value="/status",method=RequestMethod.POST)
public ResponseResult findStatus(@RequestBody Map searchMap){
return testReportService.findStatus(searchMap);
}
@RequestMapping(value="/all",method= RequestMethod.GET)
public ResponseResult findAllStatus(){
return testReportService.findAllStatus();
}
}
......@@ -7,6 +7,9 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Map;
/**
* 数据访问接口
* @author Administrator
......@@ -22,4 +25,7 @@ public interface TestReportDao extends JpaRepository<TestReport,String>, JpaSpec
TestReport findByResultId(@Param("resultId") String resultId);
@Modifying
int deleteByResultId(@Param("resultId") String resultId);
@Query(value = "select result_id,status from test_report ",nativeQuery = true)
List<Map<String,Object>> findAllStatus();
}
......@@ -2,9 +2,11 @@ package com.zjty.autotest.mq;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class CacheManager {
private static Map<String,Object> cacheMap=new HashMap<>();
private static Map<String,Integer> statusMap=new HashMap<>();
public static Object getCache(String key){
return cacheMap.get(key);
......
......@@ -4,6 +4,8 @@ import com.zjty.autotest.pojo.sjq.EvaReport;
import com.zjty.autotest.pojo.sjq.TestReport;
import com.zjty.autotest.pojo.sjq.common.ResponseResult;
import java.util.Map;
public interface TestReportService{
ResponseResult deleteByResultId(String id);
......@@ -20,4 +22,8 @@ public interface TestReportService{
* 根据id查询输出
*/
ResponseResult findByIdOutData(String resultId);
ResponseResult findStatus(Map searchMap);
ResponseResult findAllStatus();
}
......@@ -116,11 +116,6 @@ public class AsyncServiceImpl implements AsyncService {
pageContents.add(pageContentTest);
}
evaReport.setPageContents(pageContents);
// }
/*List<PageRoute> pageRoutes = new ArrayList<>();
PageRoute pageRoute = new PageRoute();
......@@ -152,6 +147,8 @@ public class AsyncServiceImpl implements AsyncService {
String out = JSON.toJSONString(evaReport);
String in = JSON.toJSONString(testChannel);
System.out.println(id);
System.out.println("输出:"+out);
System.out.println("输入:"+in);
TestReport testReport = new TestReport();
testReport.setResultId(id);
testReport.setOutReport(out);
......
......@@ -12,6 +12,7 @@ import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.zjty.autotest.dao.TestReportDao;
import com.zjty.autotest.pojo.sjq.AutoResultSet;
import com.zjty.autotest.pojo.sjq.EvaReport;
import com.zjty.autotest.pojo.sjq.TestReport;
import com.zjty.autotest.pojo.sjq.common.AppHttpCodeEnum;
......@@ -94,7 +95,7 @@ public class TestReportServiceImpl implements TestReportService {
if(testReport!=null){
testReport.setId(idWorker.nextId()+"");
testReport.setOutReport(testReport.getOutReport());
testReport.setOutReport(testReport.getInputReport());
testReport.setInputReport(testReport.getInputReport());
testReport.setResultId(testReport.getResultId());
testReportDao.save(testReport);
return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
......@@ -137,6 +138,43 @@ public class TestReportServiceImpl implements TestReportService {
return ResponseResult.okResult(out);
}
@Override
public ResponseResult findStatus(Map searchMap) {
Specification<TestReport> specification = createSpecification(searchMap);
List<TestReport> testReports = testReportDao.findAll(specification);
return ResponseResult.okResult(testReports);
}
@Override
public ResponseResult findAllStatus() {
List<Map<String, Object>> allStatus = testReportDao.findAllStatus();
for (Map<String, Object> status : allStatus) {
}
return ResponseResult.okResult(allStatus);
}
/**
* 动态条件构建
* @param searchMap
* @return
*/
private Specification<TestReport> createSpecification(Map searchMap) {
return new Specification<TestReport>() {
@Override
public Predicate toPredicate(Root<TestReport> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
List<Predicate> predicateList = new ArrayList<Predicate>();
if (searchMap.get("resultId") != null && !"".equals(searchMap.get("resultId"))) {
predicateList.add(cb.like(root.get("resultId").as(String.class), "%" + (String) searchMap.get("resultId") + "%"));
}
return cb.and( predicateList.toArray(new Predicate[predicateList.size()]));
}
};
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论