Commit 44454d4e by landerliang@163.com

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

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