Commit 5d59c4b5 by landerliang@163.com

最终测试版本1.0 修复了pdf签章定位问题

parent 0edfec5f
...@@ -44,6 +44,4 @@ public class ReportPdfVo { ...@@ -44,6 +44,4 @@ public class ReportPdfVo {
@ApiModelProperty("保存时间") @ApiModelProperty("保存时间")
private Date createTime; private Date createTime;
@ApiModelProperty("pdf模板类型 0-正常 1-多出一行")
private Integer pdfType;
} }
...@@ -144,9 +144,8 @@ public class ReportService { ...@@ -144,9 +144,8 @@ public class ReportService {
//下载报告pdf 并写入数据库 //下载报告pdf 并写入数据库
reportPdfVo = new ReportPdfVo(); reportPdfVo = new ReportPdfVo();
Map<String, Object> result = carReportUtil.downloadReport(account, password, reportDetailsReqVo); String path = carReportUtil.downloadReport(account, password, reportDetailsReqVo);
reportPdfVo.setPath(result.get("path").toString()); reportPdfVo.setPath(path);
reportPdfVo.setPdfType(Integer.valueOf(result.get("pdfType").toString()));
reportPdfVo.setVehicleId(testReportVo.getVehicleID()); reportPdfVo.setVehicleId(testReportVo.getVehicleID());
reportPdfVo.setUniqueString(testReportVo.getUniqueString()); reportPdfVo.setUniqueString(testReportVo.getUniqueString());
reportPdfVo.setReportName(testReportVo.getInspectionNum()); reportPdfVo.setReportName(testReportVo.getInspectionNum());
...@@ -343,13 +342,10 @@ public class ReportService { ...@@ -343,13 +342,10 @@ public class ReportService {
DeptVo deptVo = getCurrUserDept(); DeptVo deptVo = getCurrUserDept();
AssertUtil.isNotNull(deptVo,"列表获取失败,未找到当前账号所属部门"); AssertUtil.isNotNull(deptVo,"列表获取失败,未找到当前账号所属部门");
String reportPath = ""; String reportPath = "";
Integer pdfType = 0;
try { try {
//下载检测报告 //下载检测报告
Map<String, Object> result = carReportUtil.downloadReport(deptVo.getEpAccount(), deptVo.getEpPassword(), detailsReqVo); reportPath = carReportUtil.downloadReport(deptVo.getEpAccount(), deptVo.getEpPassword(), detailsReqVo);
reportPath = result.get("path").toString();
pdfType = Integer.valueOf(result.get("pdfType").toString());
}catch (Exception e) { }catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
}finally { }finally {
...@@ -366,7 +362,6 @@ public class ReportService { ...@@ -366,7 +362,6 @@ public class ReportService {
reportPdfVo.setVehicleId(detailsReqVo.getVehicleId()); reportPdfVo.setVehicleId(detailsReqVo.getVehicleId());
reportPdfVo.setUniqueString(detailsReqVo.getUniqueString()); reportPdfVo.setUniqueString(detailsReqVo.getUniqueString());
reportPdfVo.setBusinessKey(detailsReqVo.getBusinessKey()); reportPdfVo.setBusinessKey(detailsReqVo.getBusinessKey());
reportPdfVo.setPdfType(pdfType);
reportPdfMapper.insert(reportPdfVo); reportPdfMapper.insert(reportPdfVo);
} else { } else {
reportPdfVo.setCarNum(detailsReqVo.getCarNum()); reportPdfVo.setCarNum(detailsReqVo.getCarNum());
...@@ -376,7 +371,6 @@ public class ReportService { ...@@ -376,7 +371,6 @@ public class ReportService {
reportPdfVo.setReportName(name); reportPdfVo.setReportName(name);
reportPdfVo.setUniqueString(detailsReqVo.getUniqueString()); reportPdfVo.setUniqueString(detailsReqVo.getUniqueString());
reportPdfVo.setVehicleId(detailsReqVo.getVehicleId()); reportPdfVo.setVehicleId(detailsReqVo.getVehicleId());
reportPdfVo.setPdfType(pdfType);
reportPdfVo.setBusinessKey(detailsReqVo.getBusinessKey()); reportPdfVo.setBusinessKey(detailsReqVo.getBusinessKey());
reportPdfMapper.updateById(reportPdfVo); reportPdfMapper.updateById(reportPdfVo);
} }
......
...@@ -695,7 +695,7 @@ public class CarReportUtil { ...@@ -695,7 +695,7 @@ public class CarReportUtil {
* @param detailsReqVo * @param detailsReqVo
* @return * @return
*/ */
public Map<String,Object> downloadReport(String username,String password,ReportDetailsReqVo detailsReqVo) { public String downloadReport(String username,String password,ReportDetailsReqVo detailsReqVo) {
//登录环保 //登录环保
WebDriver driver = null; WebDriver driver = null;
try { try {
...@@ -818,25 +818,7 @@ public class CarReportUtil { ...@@ -818,25 +818,7 @@ public class CarReportUtil {
reportDriver.switchTo().parentFrame(); reportDriver.switchTo().parentFrame();
log.info(">> 检测报告下载完成!"); log.info(">> 检测报告下载完成!");
Map<String, Object> resp = new HashMap<String,Object>(); return getReportPath(fileName, ".pdf");
String reportPath = getReportPath(fileName, ".pdf");
resp.put("path",reportPath);
Elements wordCalids = parse1.getElementsByClass("word_calid");
boolean flag = false;
for (Element element:wordCalids) {
if(!element.html().contains("-")){
flag = true;
}
}
if(reportHtml.contains("<td class=\"readyStatus\" colspan=\"2\"> OBD系统故障指示器 </td>")){
resp.put("pdfType",1);
} /*else if(flag) {
resp.put("pdfType",2);
}*/ else {
resp.put("pdfType",0);
}
//resp.put("pdfType",(reportHtml.contains("<td class=\"readyStatus\" colspan=\"2\"> OBD系统故障指示器 </td>")?1:0));
return resp;
} catch (InterruptedException | UnsupportedEncodingException e) { } catch (InterruptedException | UnsupportedEncodingException e) {
driver.close(); driver.close();
log.error(e.getMessage()); log.error(e.getMessage());
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
Target Server Version : 50732 Target Server Version : 50732
File Encoding : 65001 File Encoding : 65001
Date: 12/12/2020 15:28:13 Date: 14/12/2020 11:39:03
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
...@@ -456,10 +456,9 @@ CREATE TABLE `t_report_pdf` ( ...@@ -456,10 +456,9 @@ CREATE TABLE `t_report_pdf` (
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '存放时间', `create_time` datetime(0) NULL DEFAULT NULL COMMENT '存放时间',
`unique_string` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '唯一字符串', `unique_string` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '唯一字符串',
`vehicle_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `vehicle_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`pdf_type` int(1) NOT NULL DEFAULT 0 COMMENT 'pdf模板类型 0-正常 1-多出一行',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uniq_reportNum`(`report_num`) USING BTREE COMMENT '检测报告编码唯一' UNIQUE INDEX `uniq_reportNum`(`report_num`) USING BTREE COMMENT '检测报告编码唯一'
) ENGINE = InnoDB AUTO_INCREMENT = 36 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = DYNAMIC; ) ENGINE = InnoDB AUTO_INCREMENT = 38 CHARACTER SET = utf8 COLLATE = utf8_bin ROW_FORMAT = DYNAMIC;
-- ---------------------------- -- ----------------------------
-- Table structure for t_signature -- Table structure for t_signature
......
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