Commit f058c2db by 梁辉

找回分页查询检测报告列表

parent 3863eecd
...@@ -188,7 +188,7 @@ public class ReportService { ...@@ -188,7 +188,7 @@ public class ReportService {
ReportPdfVo reportPdfVo = reportPdfMapper.selectOne(new QueryWrapper<ReportPdfVo>() ReportPdfVo reportPdfVo = reportPdfMapper.selectOne(new QueryWrapper<ReportPdfVo>()
.lambda().eq(ReportPdfVo::getReportNum, detailsReqVo.getReportNum())); .lambda().eq(ReportPdfVo::getReportNum, detailsReqVo.getReportNum()));
//如果已经下载保存过PDF了则删除旧的pdf //如果已经下载保存过PDF了则删除旧的pdf 再去抓取新的pdf
if(reportPdfVo != null && StrUtil.isNotBlank(reportPdfVo.getPath())){ if(reportPdfVo != null && StrUtil.isNotBlank(reportPdfVo.getPath())){
FileUtil.del(reportPdfVo.getPath()); FileUtil.del(reportPdfVo.getPath());
} }
...@@ -233,12 +233,12 @@ public class ReportService { ...@@ -233,12 +233,12 @@ public class ReportService {
AssertUtil.isNotNull(deptVo,"列表获取失败,未找到当前账号所属部门"); AssertUtil.isNotNull(deptVo,"列表获取失败,未找到当前账号所属部门");
IPage<TestReportVo> page = new Page<>(pageQueryVo.getCurrNo(),pageQueryVo.getSize()); IPage<TestReportVo> page = new Page<>(pageQueryVo.getCurrNo(),pageQueryVo.getSize());
/*try { try {
page = carReportUtil.reportPageList(deptVo.getEpAccount(),deptVo.getEpPassword(),pageQueryVo); page = carReportUtil.reportPageList(deptVo.getEpAccount(),deptVo.getEpPassword(),pageQueryVo);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
}*/ }
page.setTotal(1).setRecords(reportVoList); /*page.setTotal(1).setRecords(reportVoList);*/
return page; return page;
} }
......
...@@ -478,4 +478,49 @@ public class CarReportUtil { ...@@ -478,4 +478,49 @@ public class CarReportUtil {
return null; return null;
} }
/**
* 获取检测报告
* @param username 环保系统登录账号
* @param password 环保系统登录密码
* @param reportPageQueryVo 分页条件vo
* @return
* @throws InterruptedException
*/
public IPage<TestReportVo> reportPageList (String username,String password,ReportPageQueryVo reportPageQueryVo) throws InterruptedException {
//登录环保检测系统
WebDriver driver = loginEp(username, password,null);
WebElement inspecReportBtn = driver.findElement(new By.ById("mainMenuTree_3_a"));
AssertUtil.isNotNull(inspecReportBtn,"抓取报告单菜单失败");
String[] reportA = inspecReportBtn.getAttribute("onclick").split("/");
//抓取当前登录用户的站点名称
WebElement stationSpan = driver.findElement(new By.ById("orgName"));
AssertUtil.isNotBlank(stationSpan.getText(),"获取不到当前用户的站点名称");
Object[] cookies = driver.manage().getCookies().toArray();
//获取所有站点信息
String stationJsonStr = HttpUtil.createGet(getStationUrl + System.currentTimeMillis())
.header("Cookie", cookies[0].toString() + ";" + cookies[1].toString() + ";" + cookies[2].toString()).execute().body();
AssertUtil.isNotBlank(stationJsonStr,"获取不到所有站点信息");
JSONArray stationList = JSONUtil.parseArray(stationJsonStr);
String stationCode = "";
for (Object station:stationList){
JSONObject stat = (JSONObject) station;
if(stat.getStr("Name").equals(stationSpan.getText())){
stationCode = stat.getStr("Code");
}
}
AssertUtil.isNotBlank(stationCode,"获取不到当前用户的站点编码");
IPage<TestReportVo> testReportVoIPage = postReportList(stationCode, cookies, reportPageQueryVo);
testReportVoIPage.getRecords().forEach(testReportVo -> {
testReportVo.setSiteName(stationSpan.getText() );
});
//获取
return testReportVoIPage;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment