Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
car-reptiles
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
梁辉
car-reptiles
Commits
c410f4fa
Commit
c410f4fa
authored
Dec 15, 2020
by
landerliang@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复自动扫描不到未上传的检测报告问题,以及给自动签章上传的方法加上异步注解,修改了上传其他文件的后缀
parent
ce3fa1f0
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
264 additions
and
251 deletions
+264
-251
car-reptiles-system/src/main/java/me/zhengjie/modules/system/constants/MyConstants.java
+6
-6
car-reptiles-system/src/main/java/me/zhengjie/modules/system/domain/vo/report/ReportUploadReqVo.java
+5
-0
car-reptiles-system/src/main/java/me/zhengjie/modules/system/rest/ReportController.java
+15
-10
car-reptiles-system/src/main/java/me/zhengjie/modules/system/service/ReportService.java
+10
-46
car-reptiles-system/src/main/java/me/zhengjie/modules/system/util/CarReportUtil.java
+219
-186
car-reptiles-system/src/main/resources/config/application.yml
+1
-1
car-reptiles-system/src/test/java/me/zhengjie/EladminSystemApplicationTests.java
+8
-2
No files found.
car-reptiles-system/src/main/java/me/zhengjie/modules/system/constants/MyConstants.java
View file @
c410f4fa
...
...
@@ -23,26 +23,26 @@ public class MyConstants {
/**
* 身份证文件名后缀
*/
public
static
final
String
IDCARD_SUFFIX
=
"_
1
.jpg"
;
public
static
final
String
IDCARD_SUFFIX
=
"_
sfz
.jpg"
;
/**
* 申请表文件后缀
*
检测
申请表文件后缀
*/
public
static
final
String
APPLY_SUFFIX
=
"_
2
.jpg"
;
public
static
final
String
APPLY_SUFFIX
=
"_
jcsqb
.jpg"
;
/**
* 维修凭证文件后缀
*/
public
static
final
String
CERTIFICATE_SUFFIX
=
"_
3
.jpg"
;
public
static
final
String
CERTIFICATE_SUFFIX
=
"_
wxpz
.jpg"
;
/**
* 行驶证1文件后缀
*/
public
static
final
String
DRIVER_SUFFIX1
=
"_
4
.jpg"
;
public
static
final
String
DRIVER_SUFFIX1
=
"_
xsz1
.jpg"
;
/**
* 行驶证2文件后缀
*/
public
static
final
String
DRIVER_SUFFIX2
=
"_
5
.jpg"
;
public
static
final
String
DRIVER_SUFFIX2
=
"_
xsz2
.jpg"
;
}
car-reptiles-system/src/main/java/me/zhengjie/modules/system/domain/vo/report/ReportUploadReqVo.java
View file @
c410f4fa
...
...
@@ -3,10 +3,15 @@ package me.zhengjie.modules.system.domain.vo.report;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author Lander
*/
@Data
public
class
ReportUploadReqVo
{
@ApiModelProperty
(
"检测报告pdf自增ID"
)
private
Integer
reportPdfId
;
@ApiModelProperty
(
"是否上传换检测报告 0-仅上传其他文件 1-连同检测报告一起上传"
)
private
Integer
type
;
}
car-reptiles-system/src/main/java/me/zhengjie/modules/system/rest/ReportController.java
View file @
c410f4fa
...
...
@@ -43,7 +43,7 @@ public class ReportController {
@ApiOperation
(
"上传车检文件"
)
/*
@ApiOperation("上传车检文件")
@PostMapping(value = "/uploadReportFilesNotCertificate")
@ResponseBody
public ResultVo uploadReportFiles(@RequestParam(name = "reportFile")MultipartFile reportFile,
...
...
@@ -69,8 +69,12 @@ public class ReportController {
multipartFiles.add(applyTable);
reportService.uploadReport(reportPdfId, multipartFiles);
return ResultVo.success();
}
@ApiOperation
(
"上传车检文件"
)
}*/
/* @ApiOperation("上传车检文件")
@ResponseBody
@PostMapping(value = "/uploadReportFiles")
public ResultVo uploadReportFiles(@RequestParam(name = "reportFile")MultipartFile reportFile,
...
...
@@ -98,7 +102,7 @@ public class ReportController {
multipartFiles.add(certificatePic);
reportService.uploadReport(reportPdfId, multipartFiles);
return ResultVo.success();
}
}
*/
@ApiOperation
(
"下载检测报告Base64文件"
)
...
...
@@ -115,21 +119,22 @@ public class ReportController {
}
@ApiOperation
(
"上传当前检测报告"
)
@GetMapping
(
"/uploadCurrent/{reportPdfId}"
)
public
ResultVo
uploadCurrentReport
(
@PathVariable
Integer
reportPdfId
){
AssertUtil
.
isNotNull
(
reportPdfId
,
"缺少参数reportPdfId"
);
reportService
.
uploadReport
(
reportPdfId
,
null
);
@PostMapping
(
"/uploadCurrent"
)
public
ResultVo
uploadCurrentReport
(
@RequestBody
ReportUploadReqVo
reqVo
){
AssertUtil
.
isNotNull
(
reqVo
.
getReportPdfId
(),
"缺少参数reportPdfId"
);
AssertUtil
.
isNotNull
(
reqVo
.
getType
(),
"缺少参数type"
);
reportService
.
uploadReport
(
reqVo
);
return
ResultVo
.
success
();
}
@ApiOperation
(
"上传报告"
)
/*
@ApiOperation("上传报告")
@PostMapping("/upload")
public ResultVo uploadReport(ReportUploadReqVo reqVo, @RequestParam(name = "files")List<MultipartFile> files){
AssertUtil.isNotNull(reqVo.getReportPdfId(),"缺少参数reportPdfId");
AssertUtil.isTrue(files.size()==4,"请按照提示选择文件上传");
reportService.uploadReport(reqVo.getReportPdfId(),files);
return ResultVo.success();
}
}
*/
@ApiOperation
(
"签章检测报告"
)
@PostMapping
(
"/signature"
)
...
...
car-reptiles-system/src/main/java/me/zhengjie/modules/system/service/ReportService.java
View file @
c410f4fa
...
...
@@ -30,6 +30,7 @@ import org.springframework.http.HttpEntity;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.userdetails.UserDetails
;
...
...
@@ -82,21 +83,6 @@ public class ReportService {
this
.
taskErrorMapper
=
taskErrorMapper
;
}
//调试用
static
{
reportVoList
=
Arrays
.
asList
(
TestReportVo
.
builder
().
InspectionNum
(
"450107690120200529155024739"
)
.
BusinessKey
(
"450107690120200529155024739"
)
.
VIN
(
"2142435346475678"
)
.
IUIDATE
(
"2020-06-13 11:07:12.2345"
)
.
ESignNo
(
"1000001"
).
DetectStartTime
(
"2020-06-13T10:38:07"
).
DetectEndTime
(
"2020-06-13T12:38:07"
)
.
InspectionReportNo
(
"450107690120200529155024739"
).
IUTYPE
(
"A"
).
NewVDCT
(
"1"
).
PDFCount
(
"4"
).
siteName
(
"金盾西乡塘检测站"
)
.
SceneCode
(
"1231"
).
UniqueString
(
"450107690120200529155024739"
).
VDCT
(
"1"
).
VehicleID
(
"1231313213123"
).
VerifyResult
(
"1"
).
VLPN
(
"测试11111"
).
VLPNColor
(
"蓝"
)
.
StationCode
(
"4501001"
).
build
()
);
}
/**
* 获取上传文件显示页面
...
...
@@ -125,13 +111,16 @@ public class ReportService {
/**
* 自动下载检测报告并签章上传
*
*/
@Async
public
void
autoDownloadAndSignAndUploadReport
(
String
account
,
String
password
,
String
snKey1
,
String
snKey2
,
String
snKey3
,
String
snName1
,
String
snName2
,
String
snName3
){
try
{
List
<
TestReportVo
>
testReportVos
=
carReportUtil
.
taskReportList
(
account
,
password
);
log
.
info
(
">> 定时扫描未签章上传的检测报告,扫描结果:{} 条数据"
,
testReportVos
.
size
());
for
(
TestReportVo
testReportVo:
testReportVos
){
//根据报告编码查询数据库是否已下载 未下载则进行自动下载签章和上传
ReportPdfVo
reportPdfVo
=
reportPdfMapper
.
selectOne
(
new
QueryWrapper
<
ReportPdfVo
>().
lambda
().
eq
(
ReportPdfVo:
:
getReportNum
,
testReportVo
.
getInspectionNum
()));
...
...
@@ -182,14 +171,14 @@ public class ReportService {
ReportPdfVo
reportPdfVos
=
JSONUtil
.
toBean
(
JSONUtil
.
toJsonPrettyStr
(
responseEntity
.
getBody
().
getData
()),
ReportPdfVo
.
class
);
reportPdfMapper
.
updateById
(
reportPdfVos
);
//上传文件
carReportUtil
.
u
ploadReportPost
(
account
,
password
,
reportPdfVo
,
signatureVo1
.
getDeptId
());
//上传文件
(连同检测报告全部文件)
carReportUtil
.
autoU
ploadReportPost
(
account
,
password
,
reportPdfVo
,
signatureVo1
.
getDeptId
());
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
//记录错误信息
log
.
error
(
e
.
get
Cause
().
get
Message
());
log
.
error
(
e
.
get
Localized
Message
());
TaskErrorVo
taskErrorVo
=
new
TaskErrorVo
();
taskErrorVo
.
setCreateTime
(
DateUtil
.
date
());
taskErrorVo
.
setErrMsg
(
e
.
getCause
().
getMessage
()==
null
?
e
.
getMessage
():
e
.
getCause
().
getMessage
());
...
...
@@ -230,37 +219,12 @@ public class ReportService {
/**
* 上传检测报告以及其他文件到公安
* @param reportPdfId
* @param files
*/
public
void
uploadReport
(
Integer
reportPdfId
,
List
<
MultipartFile
>
files
){
ReportPdfVo
reportPdfVo
=
reportPdfMapper
.
selectById
(
re
portPdfId
);
public
void
uploadReport
(
ReportUploadReqVo
reqVo
){
ReportPdfVo
reportPdfVo
=
reportPdfMapper
.
selectById
(
re
qVo
.
getReportPdfId
()
);
AssertUtil
.
isNotNull
(
reportPdfVo
,
"不存在该检测报告,请刷新页面"
);
DeptVo
currUserDept
=
getCurrUserDept
();
List
<
String
>
filePath
=
new
ArrayList
<>();
try
{
/*int i =0;
for (MultipartFile file : files) {
String reportPath = carReportUtil.getReportPath(reportPdfVo.getReportNum() + "_" + i , ".jpg");
if(FileUtil.exist(reportPath)){
FileUtil.del(reportPath);
}
FileUtil.writeBytes(file.getBytes(),reportPath);
filePath.add(reportPath);
i++;
}*/
//carReportUtil.uploadReport(currUserDept.getEpAccount(),currUserDept.getEpPassword(),reportPdfVo);
carReportUtil
.
uploadReportPost
(
currUserDept
.
getEpAccount
(),
currUserDept
.
getEpPassword
(),
reportPdfVo
,
currUserDept
.
getDeptId
());
}
catch
(
Exception
e
)
{
throw
new
BusinessException
(
e
.
getLocalizedMessage
());
}
finally
{
//删除刚才保存的文件
filePath
.
forEach
(
path
->
{
FileUtil
.
del
(
path
);
});
}
carReportUtil
.
uploadReportPost
(
currUserDept
.
getEpAccount
(),
currUserDept
.
getEpPassword
(),
reportPdfVo
,
currUserDept
.
getDeptId
(),
reqVo
.
getType
());
}
...
...
car-reptiles-system/src/main/java/me/zhengjie/modules/system/util/CarReportUtil.java
View file @
c410f4fa
...
...
@@ -25,10 +25,7 @@ import org.jsoup.Jsoup;
import
org.jsoup.nodes.Document
;
import
org.jsoup.nodes.Element
;
import
org.jsoup.select.Elements
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.JavascriptExecutor
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebElement
;
import
org.openqa.selenium.*
;
import
org.openqa.selenium.htmlunit.HtmlUnitDriver
;
import
org.openqa.selenium.support.ui.Select
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -144,17 +141,25 @@ public class CarReportUtil {
return
reportResp
;
}
/**
* 上传文件post
* @param username
* @param password
* @param reportPdfVo
*/
public
void
u
ploadReportPost
(
String
username
,
String
password
,
ReportPdfVo
reportPdfVo
,
Long
deptid
){
public
void
autoU
ploadReportPost
(
String
username
,
String
password
,
ReportPdfVo
reportPdfVo
,
Long
deptid
){
//登录环保系统获取token
WebDriver
driver
=
null
;
try
{
//检测报告文件和其他至少四个文件(检测申请表、身份证、行驶证1、行驶证2)都有了才上传
if
(
FileUtil
.
exist
(
reportPdfVo
.
getPath
())&&
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
APPLY_SUFFIX
)&&
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
IDCARD_SUFFIX
)&&
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX1
)&&
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX2
)){
String
errMsgList
=
""
;
//登录环保
...
...
@@ -162,24 +167,23 @@ public class CarReportUtil {
Object
[]
cookies
=
driver
.
manage
().
getCookies
().
toArray
();
Map
<
String
,
Object
>
formData
=
new
HashMap
<>();
AssertUtil
.
isTrue
(
FileUtil
.
exist
(
reportPdfVo
.
getPath
()),
"未扫描到当前检测报告文件"
);
//检测报告上传
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------ae0ei4Ef1gL6GI3GI3KM7gL6Ef1gL6"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
reportPdfVo
.
getPath
()).
getName
());
formData
.
put
(
"umclData"
,
"{\"UploadFileDataID\":0,\"MAI_ID\":0}"
);
formData
.
put
(
"folder"
,
"/Addins/Template/"
);
formData
.
put
(
"businessKey"
,
reportPdfVo
.
getBusinessKey
());
formData
.
put
(
"FileGroup"
,
"04"
);
formData
.
put
(
"businessKey"
,
StrUtil
.
isNotBlank
(
reportPdfVo
.
getBusinessKey
())?
reportPdfVo
.
getBusinessKey
():
reportPdfVo
.
getReportNum
());
formData
.
put
(
"BusinessType"
,
"11"
);
formData
.
put
(
"fileext"
,
"*.pdf;*.jpg;*.png"
);
formData
.
put
(
"UniqueString"
,
reportPdfVo
.
getUniqueString
());
formData
.
put
(
"VehicleID"
,
reportPdfVo
.
getVehicleId
());
formData
.
put
(
"params"
,
"Submit Query"
);
//检测报告上传
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------ae0ei4Ef1gL6GI3GI3KM7gL6Ef1gL6"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
reportPdfVo
.
getPath
()).
getName
());
formData
.
put
(
"FileGroup"
,
"04"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
reportPdfVo
.
getPath
()));
HttpResponse
reportResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
UploadRecordVo
uploadRecordVo
=
new
UploadRecordVo
();
uploadRecordVo
.
setBusinessKey
(
reportPdfVo
.
getBusinessKey
());
uploadRecordVo
.
setCarNum
(
reportPdfVo
.
getCarNum
());
...
...
@@ -201,8 +205,8 @@ public class CarReportUtil {
//申请表上传
if
(
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
APPLY_SUFFIX
)){
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------gL6ei4cH2GI3ei4ae0ei4ae0ei4KM7"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
APPLY_SUFFIX
).
getName
());
formData
.
put
(
"FileGroup"
,
"21"
);
...
...
@@ -224,18 +228,16 @@ public class CarReportUtil {
uploadRecord
.
setState
(
1
);
}
uploadRecordService
.
saveRecord
(
uploadRecord
);
}
//身份证上传
if
(
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
IDCARD_SUFFIX
)){
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------GI3gL6cH2GI3gL6GI3GI3KM7KM7ae0"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
IDCARD_SUFFIX
).
getName
());
formData
.
put
(
"FileGroup"
,
"02"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
IDCARD_SUFFIX
));
HttpResponse
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
UploadRecordVo
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
.
setReportNum
(
reportPdfVo
.
getReportNum
());
uploadRecord
.
setCarNum
(
reportPdfVo
.
getCarNum
());
uploadRecord
.
setBusinessKey
(
reportPdfVo
.
getBusinessKey
());
...
...
@@ -250,17 +252,15 @@ public class CarReportUtil {
uploadRecord
.
setState
(
1
);
}
uploadRecordService
.
saveRecord
(
uploadRecord
);
}
//行驶证1文件上传
if
(
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX1
)){
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------ei4Ef1ei4Ef1gL6KM7ei4cH2ei4cH2"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX1
).
getName
());
formData
.
put
(
"FileGroup"
,
"03"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX1
));
HttpResponse
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
UploadRecordVo
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
.
setReportNum
(
reportPdfVo
.
getReportNum
());
uploadRecord
.
setCarNum
(
reportPdfVo
.
getCarNum
());
uploadRecord
.
setCreateTime
(
DateUtil
.
date
());
...
...
@@ -275,17 +275,15 @@ public class CarReportUtil {
uploadRecord
.
setState
(
1
);
}
uploadRecordService
.
saveRecord
(
uploadRecord
);
}
//行驶证2文件上传
if
(
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX2
)){
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------GI3KM7Ij5GI3gL6ae0Ij5ae0KM7cH2"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX2
).
getName
());
formData
.
put
(
"FileGroup"
,
"19"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX2
));
HttpResponse
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
UploadRecordVo
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
.
setReportNum
(
reportPdfVo
.
getReportNum
());
uploadRecord
.
setCarNum
(
reportPdfVo
.
getCarNum
());
uploadRecord
.
setCreateTime
(
DateUtil
.
date
());
...
...
@@ -300,7 +298,6 @@ public class CarReportUtil {
uploadRecord
.
setState
(
1
);
}
uploadRecordService
.
saveRecord
(
uploadRecord
);
}
//维修凭证上传
...
...
@@ -309,9 +306,9 @@ public class CarReportUtil {
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
CERTIFICATE_SUFFIX
).
getName
());
formData
.
put
(
"FileGroup"
,
"02"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
CERTIFICATE_SUFFIX
));
HttpResponse
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
UploadRecordVo
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
.
setReportNum
(
reportPdfVo
.
getReportNum
());
uploadRecord
.
setCarNum
(
reportPdfVo
.
getCarNum
());
uploadRecord
.
setBusinessKey
(
reportPdfVo
.
getBusinessKey
());
...
...
@@ -329,198 +326,232 @@ public class CarReportUtil {
uploadRecordService
.
saveRecord
(
uploadRecord
);
}
//如果有错误信息则抛出给客户端
//如果有上传失败的则输出控制台
if
(
StrUtil
.
isNotBlank
(
errMsgList
)){
throw
new
BusinessException
(
errMsgList
);
log
.
error
(
"检测报告:{},车牌号:{} 上传错误信息:{}"
,
reportPdfVo
.
getReportNum
(),
reportPdfVo
.
getCarNum
(),
errMsgList
);
}
}
else
{
log
.
warn
(
">> 自动上传签章的文件未准备好,本次不做上传!"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getLocalizedMessage
()
);
e
.
printStackTrace
(
);
throw
new
BusinessException
(
e
.
getLocalizedMessage
());
}
}
/**
* 上传检测报告
* @param username 环保系统登录账号
* @param reportPdfVo 检测报告信息
* @param password 环保系统登录密码
* 上传文件post
* @param username
* @param password
* @param reportPdfVo
* @param uploadReport 是否上传检测报告 0不上传 1上传
*/
public
void
uploadReport
(
String
username
,
String
password
,
ReportPdfVo
reportPdfVo
)
throws
InterruptedException
{
public
void
uploadReport
Post
(
String
username
,
String
password
,
ReportPdfVo
reportPdfVo
,
Long
deptid
,
Integer
uploadReport
)
{
//登录环保系统获取token
WebDriver
driver
=
null
;
try
{
String
errMsgList
=
""
;
//登录环保
driver
=
loginEp
(
username
,
password
,
BrowserVersion
.
INTERNET_EXPLORER
);
Object
[]
cookies
=
driver
.
manage
().
getCookies
().
toArray
();
Map
<
String
,
Object
>
formData
=
new
HashMap
<>();
formData
.
put
(
"umclData"
,
"{\"UploadFileDataID\":0,\"MAI_ID\":0}"
);
formData
.
put
(
"folder"
,
"/Addins/Template/"
);
formData
.
put
(
"businessKey"
,
StrUtil
.
isNotBlank
(
reportPdfVo
.
getBusinessKey
())?
reportPdfVo
.
getBusinessKey
():
reportPdfVo
.
getReportNum
());
formData
.
put
(
"BusinessType"
,
"11"
);
formData
.
put
(
"fileext"
,
"*.pdf;*.jpg;*.png"
);
formData
.
put
(
"UniqueString"
,
reportPdfVo
.
getUniqueString
());
formData
.
put
(
"VehicleID"
,
reportPdfVo
.
getVehicleId
());
formData
.
put
(
"params"
,
"Submit Query"
);
//给线程睡眠10s
Thread
.
sleep
(
3000
);
//抓取检测报告超链接
WebElement
inspecReportBtn
=
driver
.
findElement
(
new
By
.
ById
(
"mainMenuTree_9_a"
));
inspecReportBtn
.
click
();
//延迟加载html
driver
.
manage
().
timeouts
().
implicitlyWait
(
60
,
TimeUnit
.
SECONDS
)
.
setScriptTimeout
(
60
,
TimeUnit
.
SECONDS
).
pageLoadTimeout
(
120
,
TimeUnit
.
SECONDS
);
//给线程睡眠10s
Thread
.
sleep
(
4000
);
//点击上传资料的超链接后,抓取frame窗口的元素
WebElement
homeFrame
=
driver
.
findElement
(
new
By
.
ByXPath
(
"//*[@id=\"tabs\"]/div[2]/div[2]/div/iframe"
));
//切换到iframe页面
WebDriver
frameDriver
=
driver
.
switchTo
().
frame
(
homeFrame
);
//延迟加载html
frameDriver
.
manage
().
timeouts
().
implicitlyWait
(
120
,
TimeUnit
.
SECONDS
)
.
setScriptTimeout
(
120
,
TimeUnit
.
SECONDS
).
pageLoadTimeout
(
120
,
TimeUnit
.
SECONDS
);
//给线程睡眠4s
Thread
.
sleep
(
4000
);
WebElement
element
=
frameDriver
.
findElement
(
new
By
.
ByXPath
(
"/html/body/form/div/div/table[1]/tbody/tr/td[2]/table/tbody/tr"
));
List
<
WebElement
>
inputs
=
element
.
findElements
(
new
By
.
ByTagName
(
"input"
));
inputs
.
get
(
0
).
click
();
//延迟加载html
frameDriver
.
manage
().
timeouts
().
implicitlyWait
(
120
,
TimeUnit
.
SECONDS
)
.
setScriptTimeout
(
120
,
TimeUnit
.
SECONDS
).
pageLoadTimeout
(
120
,
TimeUnit
.
SECONDS
);
//给线程睡眠4s
Thread
.
sleep
(
4000
);
//抓取文件组下拉选项
Select
fileGroupSelect
=
new
Select
(
frameDriver
.
findElement
(
new
By
.
ByXPath
(
"//select[@id='wjz']"
)));
fileGroupSelect
.
selectByIndex
(
1
);
//抓取选择检测数据按钮
WebElement
checkTestDataBtn
=
frameDriver
.
findElement
(
new
By
.
ById
(
"selectInsp"
));
checkTestDataBtn
.
click
();
//延迟加载html
frameDriver
.
manage
().
timeouts
().
implicitlyWait
(
60
,
TimeUnit
.
SECONDS
)
.
setScriptTimeout
(
60
,
TimeUnit
.
SECONDS
).
pageLoadTimeout
(
60
,
TimeUnit
.
SECONDS
);
//给线程睡眠4s
Thread
.
sleep
(
3000
);
//抓取选择检测数据弹窗
WebElement
testDataFrame
=
frameDriver
.
findElement
(
new
By
.
ByXPath
(
"/html/body/div[8]"
));
//抓取车牌号输入框
WebElement
carNumInput
=
testDataFrame
.
findElement
(
new
By
.
ByXPath
(
"/html/body/div[8]/div[2]/div[1]/div/table[1]/tbody/tr[1]/td[2]/input"
));
//抓取车主姓名输入框
WebElement
driverName
=
testDataFrame
.
findElement
(
new
By
.
ByXPath
(
"/html/body/div[8]/div[2]/div[1]/div/table[1]/tbody/tr[2]/td[2]/input"
));
//抓取车架号或其他信息输入框
WebElement
otherInput
=
testDataFrame
.
findElement
(
new
By
.
ByXPath
(
"/html/body/div[8]/div[2]/div[1]/div/table[1]/tbody/tr[1]/td[4]/input"
));
//抓取表单重置按钮
WebElement
reset
=
testDataFrame
.
findElement
(
new
By
.
ByXPath
(
"/html/body/div[8]/div[2]/div[1]/div/table[1]/tbody/tr[2]/td[3]/input[1]"
));
//抓取表单提交按钮
WebElement
submit
=
testDataFrame
.
findElement
(
new
By
.
ByXPath
(
"/html/body/div[8]/div[2]/div[1]/div/table[1]/tbody/tr[2]/td[3]/input[2]"
));
//写死只筛选车牌号码
carNumInput
.
sendKeys
(
reportPdfVo
.
getCarNum
());
//开始检索
submit
.
click
();
//延迟加载html
frameDriver
.
manage
().
timeouts
().
implicitlyWait
(
60
,
TimeUnit
.
SECONDS
)
.
setScriptTimeout
(
60
,
TimeUnit
.
SECONDS
).
pageLoadTimeout
(
60
,
TimeUnit
.
SECONDS
);
//给线程睡眠4s
Thread
.
sleep
(
3000
);
//抓取检索出来的记录
List
<
WebElement
>
tableTrList
=
frameDriver
.
findElements
(
new
By
.
ByXPath
(
"/html/body/div[8]/div[2]/div[1]/div/div/div/div/div[2]/div[2]/table/tbody/tr"
));
if
(
tableTrList
.
size
()<
1
){
log
.
warn
(
">> 没有该车辆信息的检测记录"
);
throw
new
BusinessException
(
"上传文档失败,没有该车辆信息的检测记录"
);
}
//选择第一条记录(最新检测的记录)
tableTrList
.
get
(
0
).
click
();
//是否需要上传检测报告
if
(
uploadReport
==
1
){
AssertUtil
.
isTrue
(
FileUtil
.
exist
(
reportPdfVo
.
getPath
()),
"未扫描到当前检测报告文件"
);
//检测报告上传
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------ae0ei4Ef1gL6GI3GI3KM7gL6Ef1gL6"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
reportPdfVo
.
getPath
()).
getName
());
formData
.
put
(
"FileGroup"
,
"04"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
reportPdfVo
.
getPath
()));
HttpResponse
reportResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
UploadRecordVo
uploadRecordVo
=
new
UploadRecordVo
();
uploadRecordVo
.
setBusinessKey
(
reportPdfVo
.
getBusinessKey
());
uploadRecordVo
.
setCarNum
(
reportPdfVo
.
getCarNum
());
uploadRecordVo
.
setReportNum
(
reportPdfVo
.
getReportNum
());
uploadRecordVo
.
setFileType
(
0
);
uploadRecordVo
.
setCreateTime
(
DateUtil
.
date
());
uploadRecordVo
.
setDeptId
(
deptid
);
uploadRecordVo
.
setPath
(
reportPdfVo
.
getPath
());
//要上传的报告记录
WebElement
record
=
null
;
for
(
WebElement
webElement
:
tableTrList
)
{
//判断返回的列表记录是否包含当前检测报告的检测编号
if
(
webElement
.
getText
().
contains
(
reportPdfVo
.
getReportNum
())){
record
=
webElement
;
if
(
reportResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传检测报告失败!\n"
;
//上传状态
uploadRecordVo
.
setState
(
0
);
}
else
{
//上传状态
uploadRecordVo
.
setState
(
1
);
}
uploadRecordService
.
saveRecord
(
uploadRecordVo
);
}
AssertUtil
.
isNotNull
(
record
,
"没有该车辆信息的检测记录"
);
//确定选择
frameDriver
.
findElement
(
new
By
.
ByXPath
(
"/html/body/div[8]/div[2]/div[2]/a[1]"
)).
click
();
//上传方式选择本地上传
frameDriver
.
findElement
(
new
By
.
ByXPath
(
"//*[@id=\"form1\"]/div/div/table[3]/tbody/tr/td[2]/label[2]"
)).
click
();
//将file元素改为可见
JavascriptExecutor
javascriptExecutor
=
(
JavascriptExecutor
)
frameDriver
;
javascriptExecutor
.
executeScript
(
"document.getElementById('uploadify4').style.display='block';"
);
//检测测报告第一页
WebElement
pic1
=
frameDriver
.
findElement
(
new
By
.
ById
(
"fileQueue4"
));
pic1
.
sendKeys
(
reportPdfVo
.
getPath
());
//点击上传检测报告
frameDriver
.
findElement
(
new
By
.
ByXPath
(
"//*[@id=\"tb_4\"]/tbody/tr[2]/td[2]/input"
)).
click
();
/*//检测报告第二页
WebElement pic2 = frameDriver.findElement(new By.ByXPath("//*[@id=\"tb_85\"]/tbody/tr[1]/td/label"));
pic2.sendKeys(paths.get(1));
//申请表上传
if
(
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
APPLY_SUFFIX
)){
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------gL6ei4cH2GI3ei4ae0ei4ae0ei4KM7"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
APPLY_SUFFIX
).
getName
());
formData
.
put
(
"FileGroup"
,
"21"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
APPLY_SUFFIX
));
HttpResponse
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
//行驶证1
WebElement pic3 = frameDriver.findElement(new By.ByXPath("//*[@id=\"tb_3\"]/tbody/tr[1]/td/label"));
pic3.sendKeys(paths.get(2));
UploadRecordVo
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
.
setReportNum
(
reportPdfVo
.
getReportNum
());
uploadRecord
.
setCarNum
(
reportPdfVo
.
getCarNum
());
uploadRecord
.
setBusinessKey
(
reportPdfVo
.
getBusinessKey
());
uploadRecord
.
setDeptId
(
deptid
);
uploadRecord
.
setCreateTime
(
DateUtil
.
date
());
uploadRecord
.
setPath
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
APPLY_SUFFIX
);
uploadRecord
.
setFileType
(
1
);
if
(
applyResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传检测申请表失败!\n"
;
uploadRecord
.
setState
(
0
);
}
else
{
uploadRecord
.
setState
(
1
);
}
uploadRecordService
.
saveRecord
(
uploadRecord
);
}
else
{
errMsgList
+=
"没有找到申请表,申请表本次未上传\n"
;
}
//驶证2
WebElement pic4 = frameDriver.findElement(new By.ByXPath("//*[@id=\"tb_33\"]/tbody/tr[1]/td/label"));
pic4.sendKeys(paths.get(3));
//身份证
WebElement pic5 = frameDriver.findElement(new By.ByXPath("//*[@id=\"tb_39\"]/tbody/tr[1]/td/label"));
pic5.sendKeys(paths.get(4));
//身份证上传
if
(
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
IDCARD_SUFFIX
)){
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------GI3gL6cH2GI3gL6GI3GI3KM7KM7ae0"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
IDCARD_SUFFIX
).
getName
());
formData
.
put
(
"FileGroup"
,
"02"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
IDCARD_SUFFIX
));
HttpResponse
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
//检测申请表
WebElement pic6 = frameDriver.findElement(new By.ByXPath("//*[@id=\"tb_40\"]/tbody/tr[1]/td/label"));
pic6.sendKeys(paths.get(5));*/
UploadRecordVo
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
.
setReportNum
(
reportPdfVo
.
getReportNum
());
uploadRecord
.
setCarNum
(
reportPdfVo
.
getCarNum
());
uploadRecord
.
setBusinessKey
(
reportPdfVo
.
getBusinessKey
());
uploadRecord
.
setCreateTime
(
DateUtil
.
date
());
uploadRecord
.
setFileType
(
2
);
uploadRecord
.
setPath
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
IDCARD_SUFFIX
);
uploadRecord
.
setDeptId
(
deptid
);
if
(
applyResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传身份证失败!\n"
;
uploadRecord
.
setState
(
0
);
}
else
{
uploadRecord
.
setState
(
1
);
}
uploadRecordService
.
saveRecord
(
uploadRecord
);
}
else
{
errMsgList
+=
"没有找到身份证,身份证本次未上传\n"
;
}
/*if(paths.size()>6){
//维修凭证
WebElement pic7 = frameDriver.findElement(new By.ByXPath("//*[@id=\"chb_14\"]/tbody/tr[1]/td/label"));
pic7.sendKeys(paths.get(6));
}*/
//行驶证1文件上传
if
(
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX1
)){
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------ei4Ef1ei4Ef1gL6KM7ei4cH2ei4cH2"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX1
).
getName
());
formData
.
put
(
"FileGroup"
,
"03"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX1
));
HttpResponse
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
UploadRecordVo
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
.
setReportNum
(
reportPdfVo
.
getReportNum
());
uploadRecord
.
setCarNum
(
reportPdfVo
.
getCarNum
());
uploadRecord
.
setCreateTime
(
DateUtil
.
date
());
uploadRecord
.
setBusinessKey
(
reportPdfVo
.
getBusinessKey
());
uploadRecord
.
setFileType
(
3
);
uploadRecord
.
setPath
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX1
);
uploadRecord
.
setDeptId
(
deptid
);
if
(
applyResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传行驶证1文件失败!\n"
;
uploadRecord
.
setState
(
0
);
}
else
{
uploadRecord
.
setState
(
1
);
}
uploadRecordService
.
saveRecord
(
uploadRecord
);
}
else
{
errMsgList
+=
"没有找到行驶证1,行驶证1本次未上传\n"
;
}
//行驶证2文件上传
if
(
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX2
)){
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------GI3KM7Ij5GI3gL6ae0Ij5ae0KM7cH2"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX2
).
getName
());
formData
.
put
(
"FileGroup"
,
"19"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX2
));
HttpResponse
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
//点击上传已勾选的文件
/*frameDriver.findElement(new By.ById("Button3")).click();*/
UploadRecordVo
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
.
setReportNum
(
reportPdfVo
.
getReportNum
());
uploadRecord
.
setCarNum
(
reportPdfVo
.
getCarNum
());
uploadRecord
.
setCreateTime
(
DateUtil
.
date
());
uploadRecord
.
setBusinessKey
(
reportPdfVo
.
getBusinessKey
());
uploadRecord
.
setPath
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
DRIVER_SUFFIX2
);
uploadRecord
.
setDeptId
(
deptid
);
uploadRecord
.
setFileType
(
4
);
if
(
applyResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传行驶证2文件失败!\n"
;
uploadRecord
.
setState
(
0
);
}
else
{
uploadRecord
.
setState
(
1
);
}
uploadRecordService
.
saveRecord
(
uploadRecord
);
}
else
{
errMsgList
+=
"没有找到行驶证2,行驶证2本次未上传\n"
;
}
//校验是否上传成功
//延迟加载html
frameDriver
.
manage
().
timeouts
().
implicitlyWait
(
60
,
TimeUnit
.
SECONDS
)
.
setScriptTimeout
(
60
,
TimeUnit
.
SECONDS
).
pageLoadTimeout
(
60
,
TimeUnit
.
SECONDS
);
//给线程睡眠4s
Thread
.
sleep
(
2000
);
//维修凭证上传
if
(
FileUtil
.
exist
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
CERTIFICATE_SUFFIX
)){
formData
.
put
(
"contentType"
,
"multipart/form-data; boundary=----------GI3gL6cH2GI3gL6GI3GI3KM7KM7ae0"
);
formData
.
put
(
"Filename"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
CERTIFICATE_SUFFIX
).
getName
());
formData
.
put
(
"FileGroup"
,
"02"
);
formData
.
put
(
"FileData"
,
FileUtil
.
file
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
CERTIFICATE_SUFFIX
));
HttpResponse
applyResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
WebElement
divContent
=
frameDriver
.
findElement
(
new
By
.
ById
(
"divContent"
));
UploadRecordVo
uploadRecord
=
new
UploadRecordVo
();
uploadRecord
.
setReportNum
(
reportPdfVo
.
getReportNum
());
uploadRecord
.
setCarNum
(
reportPdfVo
.
getCarNum
());
uploadRecord
.
setBusinessKey
(
reportPdfVo
.
getBusinessKey
());
uploadRecord
.
setCreateTime
(
DateUtil
.
date
());
uploadRecord
.
setPath
(
uploadFilePath
+
reportPdfVo
.
getCarNum
()
+
MyConstants
.
CERTIFICATE_SUFFIX
);
uploadRecord
.
setDeptId
(
deptid
);
uploadRecord
.
setFileType
(
5
);
if
(
applyResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传维修凭证失败!\n"
;
uploadRecord
.
setState
(
0
);
//如果全部成功
if
(
divContent
.
getText
().
contains
(
"green"
)){
frameDriver
.
close
();
driver
.
close
();
log
.
info
(
">> ======== 资料已上传完成 =========== <<"
);
}
else
{
/*List<WebElement> elements = divContent.findElements(new By.ByXPath("//*[@id=\"divContent\"]/span[contains(@style,\"color: red;\")]"));
String errMsgList = "";
for(WebElement elem: elements){
errMsgList += elem.getText() +"\n";
}*/
frameDriver
.
close
();
driver
.
close
();
throw
new
BusinessException
(
"检测报告上传失败"
);
uploadRecord
.
setState
(
1
);
}
uploadRecordService
.
saveRecord
(
uploadRecord
);
}
else
{
errMsgList
+=
"没有找到维修凭证,维修凭证本次未上传\n"
;
}
//如果有错误信息则抛出给客户端
if
(
StrUtil
.
isNotBlank
(
errMsgList
)){
throw
new
BusinessException
(
errMsgList
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
BusinessException
(
e
.
getLocalizedMessage
());
}
}
...
...
@@ -688,6 +719,8 @@ public class CarReportUtil {
return
driver
;
}
/**
* 下载检测报告 并 转 PDF
* @param username
...
...
@@ -819,10 +852,10 @@ public class CarReportUtil {
log
.
info
(
">> 检测报告下载完成!"
);
return
getReportPath
(
fileName
,
".pdf"
);
}
catch
(
InterruptedException
|
UnsupportedEncodingException
e
)
{
}
catch
(
InterruptedException
|
UnsupportedEncodingException
|
UnhandledAlertException
e
)
{
driver
.
close
();
log
.
error
(
e
.
getMessage
()
);
throw
new
BusinessException
(
"
服务器繁忙请重试
"
);
e
.
printStackTrace
(
);
throw
new
BusinessException
(
"
检测报告下载失败
"
);
}
...
...
@@ -919,7 +952,7 @@ public class CarReportUtil {
//将结果转vo对象
InspecPageVo
pageVo
=
JSONUtil
.
toBean
(
queryResult
,
InspecPageVo
.
class
);
List
<
TestReportVo
>
collect
=
pageVo
.
getRows
().
stream
().
filter
(
i
->
i
.
getPDFCount
().
equals
(
0
)).
collect
(
Collectors
.
toList
());
List
<
TestReportVo
>
collect
=
pageVo
.
getRows
().
stream
().
filter
(
i
->
i
.
getPDFCount
().
equals
(
"0"
)).
collect
(
Collectors
.
toList
());
pageVo
.
setRows
(
collect
);
pageVo
.
setTotal
(
collect
.
size
());
return
pageVo
.
getRows
();
...
...
car-reptiles-system/src/main/resources/config/application.yml
View file @
c410f4fa
...
...
@@ -5,7 +5,7 @@ spring:
freemarker
:
check-template-location
:
false
profiles
:
active
:
prod
active
:
dev
jackson
:
time-zone
:
GMT+8
data
:
...
...
car-reptiles-system/src/test/java/me/zhengjie/EladminSystemApplicationTests.java
View file @
c410f4fa
package
me
.
zhengjie
;
import
cn.hutool.core.io.FileUtil
;
import
me.zhengjie.utils.DateUtil
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@SpringBootTest
public
class
EladminSystemApplicationTests
{
@Test
...
...
@@ -17,6 +17,12 @@ public class EladminSystemApplicationTests {
System
.
out
.
println
(
DateUtil
.
fromTimeStamp
(
1592023087L
).
toString
());
}
@Test
public
void
testFileExit
()
{
String
filePath
=
"C:\\reptiles\\uploadPicture\\粤JHB607_jcsqb.jpg"
;
System
.
out
.
println
(
FileUtil
.
exist
(
filePath
));
}
public
static
void
main
(
String
[]
args
)
{
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment