Commit 44454d4e by landerliang@163.com

自动签章上传,先判断当前车牌号下是否不为空,为空则不进行报告下载,节省资源

parent 010404dc
......@@ -137,13 +137,14 @@ public class ReportService {
reportDetailsReqVo.setCarNum(testReportVo.getVLPN());
reportDetailsReqVo.setReportNum(testReportVo.getInspectionNum());
//下载报告pdf 并写入数据库
reportPdfVo = new ReportPdfVo();
//下载报告pdf
String path = carReportUtil.authDownloadReport(account, password, reportDetailsReqVo);
//如果下载成功
if(StrUtil.isNotBlank(path)){
// 写入数据库
reportPdfVo = new ReportPdfVo();
reportPdfVo.setPath(path);
reportPdfVo.setVehicleId(testReportVo.getVehicleID());
reportPdfVo.setUniqueString(testReportVo.getUniqueString());
......@@ -337,7 +338,6 @@ public class ReportService {
AssertUtil.isNotNull(deptVo,"列表获取失败,未找到当前账号所属部门");
String reportPath = "";
try {
//下载检测报告
reportPath = carReportUtil.downloadReport(deptVo.getEpAccount(), deptVo.getEpPassword(), detailsReqVo);
}catch (Exception e) {
......
......@@ -766,6 +766,9 @@ public class CarReportUtil {
WebDriver driver = null;
try {
//判断是否已拍照有文件再进行下载
if(!FileUtil.isDirEmpty(FileUtil.file(uploadFilePath + detailsReqVo.getCarNum()))){
//把检测报告编号作为该报告文件的文件名
String fileName = detailsReqVo.getReportNum();
//如果已经下载有检测报告则直接return
......@@ -906,6 +909,9 @@ public class CarReportUtil {
}
return getReportPath(fileName, ".pdf");
}
} catch (InterruptedException | UnsupportedEncodingException | UnhandledAlertException e) {
e.printStackTrace();
}
......@@ -1115,7 +1121,7 @@ public class CarReportUtil {
/**
* 获取最新条没上传文件的检测报告
* 获取最新条没上传文件的检测报告
* @param stationCode
* @param cookies
* @return
......@@ -1140,7 +1146,7 @@ public class CarReportUtil {
MyContext.PHOTO_TABLE_NAME,MyContext.PHOTO_WHERE,fldsVo.getFld(),conditionVoList,null,5);
JSONObject body = JSONUtil.createObj();
body.put("data",queryDataVo);
body.put("rows",5);
body.put("rows",10);
body.put("page",1);
body.put("sort","DetectEndTime");
body.put("order","DESC");
......
......@@ -18,6 +18,16 @@ public class LoginCacheTest {
@Resource(name = "userDetailsService")
private UserDetailsServiceImpl userDetailsService;
@Test
public void testIsDirEmptry(){
String dirPath = "C:\\Users\\Lander.LAPTOP-6VMQUJS1\\Desktop\\pdf";
boolean dirEmpty = FileUtil.isDirEmpty(FileUtil.file(dirPath));
System.out.println("当前文件夹是否为空:" + dirEmpty);
if(!dirEmpty){
System.out.println("不为空");
}
}
@Test
public void testCreateFileDirect(){
......
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