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
e89670b1
Commit
e89670b1
authored
Dec 08, 2020
by
landerliang@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成文件上传功能
parent
3097b14e
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
241 additions
and
22 deletions
+241
-22
car-reptiles-system/src/main/java/me/zhengjie/modules/system/constants/MyConstants.java
+33
-0
car-reptiles-system/src/main/java/me/zhengjie/modules/system/domain/vo/report/ReportDetailsReqVo.java
+9
-0
car-reptiles-system/src/main/java/me/zhengjie/modules/system/domain/vo/report/ReportPdfVo.java
+9
-0
car-reptiles-system/src/main/java/me/zhengjie/modules/system/rest/ReportController.java
+10
-0
car-reptiles-system/src/main/java/me/zhengjie/modules/system/service/ReportService.java
+12
-4
car-reptiles-system/src/main/java/me/zhengjie/modules/system/util/CarReportUtil.java
+164
-18
car-reptiles-system/src/main/resources/config/application.yml
+4
-0
No files found.
car-reptiles-system/src/main/java/me/zhengjie/modules/system/constants/MyConstants.java
View file @
e89670b1
...
@@ -16,4 +16,37 @@ public class MyConstants {
...
@@ -16,4 +16,37 @@ public class MyConstants {
*/
*/
public
static
final
String
USER_TOKEN_CONTEXT_KEY
=
"user-token"
;
public
static
final
String
USER_TOKEN_CONTEXT_KEY
=
"user-token"
;
//////// 约定的上传检测报告的其他文件以 车牌号 + 文件名称的后缀 .jpg 来扫描
/**
* 车牌号文件后缀
*/
public
static
final
String
CARNUM_SUFFIX
=
"_1.jpg"
;
/**
* 身份证文件名后缀
*/
public
static
final
String
IDCARD_SUFFIX
=
"_2.jpg"
;
/**
* 申请表文件后缀
*/
public
static
final
String
APPLY_SUFFIX
=
"_3.jpg"
;
/**
* 维修凭证文件后缀
*/
/*public static final String CERTIFICATE_SUFFIX = "_4.jpg";*/
/**
* 行驶证1文件后缀
*/
public
static
final
String
DRIVER_SUFFIX1
=
"_4.jpg"
;
/**
* 行驶证2文件后缀
*/
public
static
final
String
DRIVER_SUFFIX2
=
"_5.jpg"
;
}
}
car-reptiles-system/src/main/java/me/zhengjie/modules/system/domain/vo/report/ReportDetailsReqVo.java
View file @
e89670b1
...
@@ -17,6 +17,15 @@ public class ReportDetailsReqVo {
...
@@ -17,6 +17,15 @@ public class ReportDetailsReqVo {
@ApiModelProperty
(
"检测报告编码"
)
@ApiModelProperty
(
"检测报告编码"
)
private
String
reportNum
;
private
String
reportNum
;
@ApiModelProperty
(
"业务流水key"
)
private
String
businessKey
;
@ApiModelProperty
(
"唯一字符串"
)
private
String
uniqueString
;
private
String
vehicleId
;
@ApiModelProperty
(
"开始时间"
)
@ApiModelProperty
(
"开始时间"
)
private
Date
startTime
;
private
Date
startTime
;
...
...
car-reptiles-system/src/main/java/me/zhengjie/modules/system/domain/vo/report/ReportPdfVo.java
View file @
e89670b1
package
me
.
zhengjie
.
modules
.
system
.
domain
.
vo
.
report
;
package
me
.
zhengjie
.
modules
.
system
.
domain
.
vo
.
report
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -29,6 +30,14 @@ public class ReportPdfVo {
...
@@ -29,6 +30,14 @@ public class ReportPdfVo {
@ApiModelProperty
(
"关联的检测报告编号"
)
@ApiModelProperty
(
"关联的检测报告编号"
)
private
String
reportNum
;
private
String
reportNum
;
@ApiModelProperty
(
"业务流水key"
)
private
String
businessKey
;
@ApiModelProperty
(
"唯一字符串"
)
private
String
uniqueString
;
private
String
vehicleId
;
@ApiModelProperty
(
"车牌号"
)
@ApiModelProperty
(
"车牌号"
)
private
String
carNum
;
private
String
carNum
;
...
...
car-reptiles-system/src/main/java/me/zhengjie/modules/system/rest/ReportController.java
View file @
e89670b1
...
@@ -110,6 +110,13 @@ public class ReportController {
...
@@ -110,6 +110,13 @@ public class ReportController {
return
ResultVo
.
success
(
reportService
.
findCurrentDeptSignature
());
return
ResultVo
.
success
(
reportService
.
findCurrentDeptSignature
());
}
}
@ApiOperation
(
"上传当前检测报告"
)
@GetMapping
(
"/uploadCurrent/{reportPdfId}"
)
public
ResultVo
uploadCurrentReport
(
@PathVariable
Integer
reportPdfId
){
AssertUtil
.
isNotNull
(
reportPdfId
,
"缺少参数reportPdfId"
);
reportService
.
uploadReport
(
reportPdfId
,
null
);
return
ResultVo
.
success
();
}
@ApiOperation
(
"上传报告"
)
@ApiOperation
(
"上传报告"
)
@PostMapping
(
"/upload"
)
@PostMapping
(
"/upload"
)
...
@@ -134,6 +141,9 @@ public class ReportController {
...
@@ -134,6 +141,9 @@ public class ReportController {
@ApiOperation
(
"检测报告详情"
)
@ApiOperation
(
"检测报告详情"
)
public
ResultVo
<
ReportPdfVo
>
signatureReport
(
@RequestBody
ReportDetailsReqVo
detailsReqVo
){
public
ResultVo
<
ReportPdfVo
>
signatureReport
(
@RequestBody
ReportDetailsReqVo
detailsReqVo
){
AssertUtil
.
isNotBlank
(
detailsReqVo
.
getCarNum
(),
"缺少参数车牌号"
);
AssertUtil
.
isNotBlank
(
detailsReqVo
.
getCarNum
(),
"缺少参数车牌号"
);
AssertUtil
.
isNotBlank
(
detailsReqVo
.
getBusinessKey
(),
"缺少参数businessKey"
);
AssertUtil
.
isNotBlank
(
detailsReqVo
.
getUniqueString
(),
"缺少参数uniqueString"
);
AssertUtil
.
isNotBlank
(
detailsReqVo
.
getVehicleId
(),
"缺少参数vehicleId"
);
AssertUtil
.
isNotBlank
(
detailsReqVo
.
getReportNum
(),
"缺少参数检测报告编号"
);
AssertUtil
.
isNotBlank
(
detailsReqVo
.
getReportNum
(),
"缺少参数检测报告编号"
);
AssertUtil
.
isNotNull
(
detailsReqVo
.
getStartTime
(),
"缺少参数开始检测时间"
);
AssertUtil
.
isNotNull
(
detailsReqVo
.
getStartTime
(),
"缺少参数开始检测时间"
);
AssertUtil
.
isNotNull
(
detailsReqVo
.
getEndTime
(),
"缺少参数检测结束时间"
);
AssertUtil
.
isNotNull
(
detailsReqVo
.
getEndTime
(),
"缺少参数检测结束时间"
);
...
...
car-reptiles-system/src/main/java/me/zhengjie/modules/system/service/ReportService.java
View file @
e89670b1
...
@@ -132,7 +132,7 @@ public class ReportService {
...
@@ -132,7 +132,7 @@ public class ReportService {
List
<
String
>
filePath
=
new
ArrayList
<>();
List
<
String
>
filePath
=
new
ArrayList
<>();
try
{
try
{
int
i
=
0
;
/*
int i =0;
for (MultipartFile file : files) {
for (MultipartFile file : files) {
String reportPath = carReportUtil.getReportPath(reportPdfVo.getReportNum() + "_" + i , ".jpg");
String reportPath = carReportUtil.getReportPath(reportPdfVo.getReportNum() + "_" + i , ".jpg");
if(FileUtil.exist(reportPath)){
if(FileUtil.exist(reportPath)){
...
@@ -141,10 +141,12 @@ public class ReportService {
...
@@ -141,10 +141,12 @@ public class ReportService {
FileUtil.writeBytes(file.getBytes(),reportPath);
FileUtil.writeBytes(file.getBytes(),reportPath);
filePath.add(reportPath);
filePath.add(reportPath);
i++;
i++;
}
}*/
carReportUtil
.
uploadReport
(
currUserDept
.
getEpAccount
(),
currUserDept
.
getEpPassword
(),
reportPdfVo
,
filePath
);
//carReportUtil.uploadReport(currUserDept.getEpAccount(),currUserDept.getEpPassword(),reportPdfVo);
carReportUtil
.
uploadReportPost
(
currUserDept
.
getEpAccount
(),
currUserDept
.
getEpPassword
(),
reportPdfVo
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
BusinessException
(
e
.
getMessage
());
throw
new
BusinessException
(
e
.
get
Localized
Message
());
}
finally
{
}
finally
{
//删除刚才保存的文件
//删除刚才保存的文件
filePath
.
forEach
(
path
->
{
filePath
.
forEach
(
path
->
{
...
@@ -248,6 +250,9 @@ public class ReportService {
...
@@ -248,6 +250,9 @@ public class ReportService {
reportPdfVo
.
setReportNum
(
detailsReqVo
.
getReportNum
());
reportPdfVo
.
setReportNum
(
detailsReqVo
.
getReportNum
());
reportPdfVo
.
setCreateTime
(
DateUtil
.
date
());
reportPdfVo
.
setCreateTime
(
DateUtil
.
date
());
reportPdfVo
.
setReportName
(
name
);
reportPdfVo
.
setReportName
(
name
);
reportPdfVo
.
setVehicleId
(
detailsReqVo
.
getVehicleId
());
reportPdfVo
.
setUniqueString
(
detailsReqVo
.
getUniqueString
());
reportPdfVo
.
setBusinessKey
(
detailsReqVo
.
getBusinessKey
());
reportPdfMapper
.
insert
(
reportPdfVo
);
reportPdfMapper
.
insert
(
reportPdfVo
);
}
else
{
}
else
{
reportPdfVo
.
setCarNum
(
detailsReqVo
.
getCarNum
());
reportPdfVo
.
setCarNum
(
detailsReqVo
.
getCarNum
());
...
@@ -255,6 +260,9 @@ public class ReportService {
...
@@ -255,6 +260,9 @@ public class ReportService {
reportPdfVo
.
setReportNum
(
detailsReqVo
.
getReportNum
());
reportPdfVo
.
setReportNum
(
detailsReqVo
.
getReportNum
());
reportPdfVo
.
setCreateTime
(
DateUtil
.
date
());
reportPdfVo
.
setCreateTime
(
DateUtil
.
date
());
reportPdfVo
.
setReportName
(
name
);
reportPdfVo
.
setReportName
(
name
);
reportPdfVo
.
setUniqueString
(
detailsReqVo
.
getUniqueString
());
reportPdfVo
.
setVehicleId
(
detailsReqVo
.
getVehicleId
());
reportPdfVo
.
setBusinessKey
(
detailsReqVo
.
getBusinessKey
());
reportPdfMapper
.
updateById
(
reportPdfVo
);
reportPdfMapper
.
updateById
(
reportPdfVo
);
}
}
...
...
car-reptiles-system/src/main/java/me/zhengjie/modules/system/util/CarReportUtil.java
View file @
e89670b1
...
@@ -3,6 +3,8 @@ package me.zhengjie.modules.system.util;
...
@@ -3,6 +3,8 @@ package me.zhengjie.modules.system.util;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpStatus
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
...
@@ -12,6 +14,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -12,6 +14,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.gargoylesoftware.htmlunit.BrowserVersion
;
import
com.gargoylesoftware.htmlunit.BrowserVersion
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhengjie.exception.BusinessException
;
import
me.zhengjie.exception.BusinessException
;
import
me.zhengjie.modules.system.constants.MyConstants
;
import
me.zhengjie.modules.system.domain.vo.report.*
;
import
me.zhengjie.modules.system.domain.vo.report.*
;
import
me.zhengjie.utils.AssertUtil
;
import
me.zhengjie.utils.AssertUtil
;
import
org.jsoup.Jsoup
;
import
org.jsoup.Jsoup
;
...
@@ -24,12 +27,10 @@ import org.openqa.selenium.htmlunit.HtmlUnitDriver;
...
@@ -24,12 +27,10 @@ import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import
org.openqa.selenium.support.ui.Select
;
import
org.openqa.selenium.support.ui.Select
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.multipart.MultipartFile
;
import
sun.misc.BASE64Encoder
;
import
sun.misc.BASE64Encoder
;
import
java.util.ArrayList
;
import
java.io.File
;
import
java.util.Arrays
;
import
java.util.*
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
/**
/**
...
@@ -46,22 +47,164 @@ public class CarReportUtil {
...
@@ -46,22 +47,164 @@ public class CarReportUtil {
private
String
getStationUrl
;
private
String
getStationUrl
;
@Value
(
"${like.url}"
)
@Value
(
"${like.url}"
)
private
String
likeUrl
;
private
String
likeUrl
;
@Value
(
"${like.uploadFileUrl}"
)
private
String
uploadFileUrl
;
@Value
(
"${like.host}"
)
@Value
(
"${like.host}"
)
private
String
host
;
private
String
host
;
@Value
(
"${file.linux.report}"
)
@Value
(
"${file.linux.report}"
)
private
String
linuxReport
;
private
String
linuxReport
;
@Value
(
"${file.windows.report}"
)
@Value
(
"${file.windows.report}"
)
private
String
winReport
;
private
String
winReport
;
@Value
(
"${uploadFilePath}"
)
private
String
uploadFilePath
;
/**
* 上传post
* @param formData
* @param url
* @param cookies
* @return
*/
private
static
HttpResponse
uploadPost
(
Map
<
String
,
Object
>
formData
,
String
url
,
Object
[]
cookies
){
//上传检测报告
HttpResponse
reportResp
=
HttpUtil
.
createPost
(
url
).
header
(
"Cookie"
,
cookies
[
0
].
toString
()
+
";"
+
cookies
[
1
].
toString
()
+
";"
+
cookies
[
2
].
toString
())
.
contentType
(
formData
.
get
(
"contentType"
).
toString
()).
form
(
"Filename"
,
formData
.
get
(
"Filename"
).
toString
())
.
form
(
"umclData"
,
formData
.
get
(
"umclData"
).
toString
())
.
form
(
"folder"
,
formData
.
get
(
"folder"
).
toString
())
.
form
(
"businessKey"
,
formData
.
get
(
"businessKey"
).
toString
())
.
form
(
"FileGroup"
,
formData
.
get
(
"FileGroup"
).
toString
())
.
form
(
"BusinessType"
,
formData
.
get
(
"BusinessType"
).
toString
())
.
form
(
"fileext"
,
"*.pdf;*.jpg;*.png"
)
.
form
(
"UniqueString"
,
formData
.
get
(
"UniqueString"
).
toString
())
.
form
(
"VehicleID"
,
formData
.
get
(
"VehicleID"
).
toString
())
.
form
(
"params"
,
formData
.
get
(
"params"
).
toString
())
.
form
(
"FileData"
,
(
File
)
formData
.
get
(
"FileData"
)).
execute
();
return
reportResp
;
}
/**
* 上传文件post
* @param username
* @param password
* @param reportPdfVo
*/
public
void
uploadReportPost
(
String
username
,
String
password
,
ReportPdfVo
reportPdfVo
){
//登录环保系统获取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
(
"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
(
"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
(
"FileData"
,
FileUtil
.
file
(
reportPdfVo
.
getPath
()));
HttpResponse
reportResp
=
uploadPost
(
formData
,
uploadFileUrl
,
cookies
);
if
(
reportResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传检测报告失败!\n"
;
}
//申请表上传
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
);
if
(
applyResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传检测申请表失败!\n"
;
}
}
//身份证上传
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
);
if
(
applyResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传身份证失败!\n"
;
}
}
//行驶证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
);
if
(
applyResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传行驶证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
);
if
(
applyResp
.
getStatus
()
!=
HttpStatus
.
HTTP_OK
){
errMsgList
+=
"上传行驶证2文件失败!\n"
;
}
}
//维修凭证上传
/*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);
if(applyResp.getStatus() != HttpStatus.HTTP_OK){
errMsgList += "上传维修凭证失败!\n";
}
}*/
//如果有错误信息则抛出给客户端
if
(
StrUtil
.
isNotBlank
(
errMsgList
)){
throw
new
BusinessException
(
errMsgList
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getLocalizedMessage
());
throw
new
BusinessException
(
e
.
getLocalizedMessage
());
}
}
/**
/**
* 上传检测报告
* 上传检测报告
* @param username 环保系统登录账号
* @param username 环保系统登录账号
* @param reportPdfVo 检测报告信息
* @param reportPdfVo 检测报告信息
* @param password 环保系统登录密码
* @param password 环保系统登录密码
* @param reportPath 要上传的检测报告路径
* @param paths 其他文件的路径
*/
*/
public
void
uploadReport
(
String
username
,
String
password
,
ReportPdfVo
reportPdfVo
,
List
<
String
>
paths
)
throws
InterruptedException
{
public
void
uploadReport
(
String
username
,
String
password
,
ReportPdfVo
reportPdfVo
)
throws
InterruptedException
{
WebDriver
driver
=
null
;
WebDriver
driver
=
null
;
...
@@ -169,10 +312,13 @@ public class CarReportUtil {
...
@@ -169,10 +312,13 @@ public class CarReportUtil {
JavascriptExecutor
javascriptExecutor
=
(
JavascriptExecutor
)
frameDriver
;
JavascriptExecutor
javascriptExecutor
=
(
JavascriptExecutor
)
frameDriver
;
javascriptExecutor
.
executeScript
(
"document.getElementById('uploadify4').style.display='block';"
);
javascriptExecutor
.
executeScript
(
"document.getElementById('uploadify4').style.display='block';"
);
//检测测报告第一页
//检测测报告第一页
WebElement
pic1
=
frameDriver
.
findElement
(
new
By
.
ById
(
"
uploadify
4"
));
WebElement
pic1
=
frameDriver
.
findElement
(
new
By
.
ById
(
"
fileQueue
4"
));
pic1
.
sendKeys
(
paths
.
get
(
0
));
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"));
WebElement pic2 = frameDriver.findElement(new By.ByXPath("//*[@id=\"tb_85\"]/tbody/tr[1]/td/label"));
pic2.sendKeys(paths.get(1));
pic2.sendKeys(paths.get(1));
...
@@ -190,18 +336,18 @@ public class CarReportUtil {
...
@@ -190,18 +336,18 @@ public class CarReportUtil {
//检测申请表
//检测申请表
WebElement pic6 = frameDriver.findElement(new By.ByXPath("//*[@id=\"tb_40\"]/tbody/tr[1]/td/label"));
WebElement pic6 = frameDriver.findElement(new By.ByXPath("//*[@id=\"tb_40\"]/tbody/tr[1]/td/label"));
pic6
.
sendKeys
(
paths
.
get
(
5
));
pic6.sendKeys(paths.get(5));
*/
if
(
paths
.
size
()>
6
){
/*
if(paths.size()>6){
//维修凭证
//维修凭证
WebElement pic7 = frameDriver.findElement(new By.ByXPath("//*[@id=\"chb_14\"]/tbody/tr[1]/td/label"));
WebElement pic7 = frameDriver.findElement(new By.ByXPath("//*[@id=\"chb_14\"]/tbody/tr[1]/td/label"));
pic7.sendKeys(paths.get(6));
pic7.sendKeys(paths.get(6));
}
}
*/
//点击上传已勾选的文件
//点击上传已勾选的文件
frameDriver
.
findElement
(
new
By
.
ById
(
"Button3"
)).
click
();
/*frameDriver.findElement(new By.ById("Button3")).click();*/
//校验是否上传成功
//校验是否上传成功
...
@@ -214,19 +360,19 @@ public class CarReportUtil {
...
@@ -214,19 +360,19 @@ public class CarReportUtil {
WebElement
divContent
=
frameDriver
.
findElement
(
new
By
.
ById
(
"divContent"
));
WebElement
divContent
=
frameDriver
.
findElement
(
new
By
.
ById
(
"divContent"
));
//如果全部成功
//如果全部成功
if
(
divContent
.
getText
().
contains
(
"
red
"
)){
if
(
divContent
.
getText
().
contains
(
"
green
"
)){
frameDriver
.
close
();
frameDriver
.
close
();
driver
.
close
();
driver
.
close
();
log
.
info
(
">> ======== 资料已上传完成 =========== <<"
);
log
.
info
(
">> ======== 资料已上传完成 =========== <<"
);
}
else
{
}
else
{
List
<
WebElement
>
elements
=
divContent
.
findElements
(
new
By
.
ByXPath
(
"//*[@id=\"divContent\"]/span[contains(@style,\"color: red;\")]"
));
/*
List<WebElement> elements = divContent.findElements(new By.ByXPath("//*[@id=\"divContent\"]/span[contains(@style,\"color: red;\")]"));
String errMsgList = "";
String errMsgList = "";
for(WebElement elem: elements){
for(WebElement elem: elements){
errMsgList += elem.getText() +"\n";
errMsgList += elem.getText() +"\n";
}
}
*/
frameDriver
.
close
();
frameDriver
.
close
();
driver
.
close
();
driver
.
close
();
throw
new
BusinessException
(
errMsgList
);
throw
new
BusinessException
(
"检测报告上传失败"
);
}
}
...
...
car-reptiles-system/src/main/resources/config/application.yml
View file @
e89670b1
...
@@ -75,6 +75,7 @@ reptiles:
...
@@ -75,6 +75,7 @@ reptiles:
#环保检索配置
#环保检索配置
like
:
like
:
host
:
http://10.48.21.198:8899/
host
:
http://10.48.21.198:8899/
uploadFileUrl
:
http://10.48.21.198:8899/uploadFile/UploadFileData/SaveUploadVIMFiles
url
:
http://10.48.21.198:8899/businesscom/common/DataAndPhotoPageQuery
url
:
http://10.48.21.198:8899/businesscom/common/DataAndPhotoPageQuery
inspectReportUrl
:
http://10.48.21.198:8899/Addins_NanNing/Template/InspectionReport_GasMethod_NN.aspx
inspectReportUrl
:
http://10.48.21.198:8899/Addins_NanNing/Template/InspectionReport_GasMethod_NN.aspx
...
@@ -82,6 +83,9 @@ like:
...
@@ -82,6 +83,9 @@ like:
kinggrid
:
kinggrid
:
url
:
http://sign.kinggrid.com/OfficeServer.jsp
url
:
http://sign.kinggrid.com/OfficeServer.jsp
#上传检测报告其他文件的存放目录
uploadFilePath
:
C:\\reptiles\\uploadPicture\\
#签章服务的url
#签章服务的url
signature
:
signature
:
carSignature
:
carSignature
:
...
...
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