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
944ce84a
Commit
944ce84a
authored
Dec 05, 2020
by
梁辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增自行上传检测报告(未完成)
parent
c277b7f4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
5 deletions
+97
-5
car-reptiles-system/src/main/java/me/zhengjie/modules/security/service/UserDetailsServiceImpl.java
+1
-0
car-reptiles-system/src/main/java/me/zhengjie/modules/system/domain/vo/report/ReportDownloadRespVo.java
+14
-0
car-reptiles-system/src/main/java/me/zhengjie/modules/system/domain/vo/report/ReportFileUploadVo.java
+21
-0
car-reptiles-system/src/main/java/me/zhengjie/modules/system/rest/ReportController.java
+20
-0
car-reptiles-system/src/main/java/me/zhengjie/modules/system/service/ReportService.java
+36
-4
car-reptiles-system/src/main/resources/config/application.yml
+5
-1
No files found.
car-reptiles-system/src/main/java/me/zhengjie/modules/security/service/UserDetailsServiceImpl.java
View file @
944ce84a
...
...
@@ -53,6 +53,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
*/
static
Map
<
String
,
JwtUserDto
>
userDtoCache
=
new
ConcurrentHashMap
<>();
@Override
public
JwtUserDto
loadUserByUsername
(
String
username
)
{
boolean
searchDb
=
true
;
...
...
car-reptiles-system/src/main/java/me/zhengjie/modules/system/domain/vo/report/ReportDownloadRespVo.java
0 → 100644
View file @
944ce84a
package
me
.
zhengjie
.
modules
.
system
.
domain
.
vo
.
report
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
ReportDownloadRespVo
{
@ApiModelProperty
(
"检测报告base64文件流"
)
private
String
reportBase64
;
@ApiModelProperty
(
"检测报告编号"
)
private
String
reportNum
;
}
car-reptiles-system/src/main/java/me/zhengjie/modules/system/domain/vo/report/ReportFileUploadVo.java
0 → 100644
View file @
944ce84a
package
me
.
zhengjie
.
modules
.
system
.
domain
.
vo
.
report
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.web.multipart.MultipartFile
;
@Data
public
class
ReportFileUploadVo
{
@ApiModelProperty
(
"检测报告"
)
private
MultipartFile
reportFile
;
@ApiModelProperty
(
"行驶证1"
)
private
MultipartFile
drivingLicensePic1
;
@ApiModelProperty
(
"行驶证2"
)
private
MultipartFile
drivingLicensePic2
;
@ApiModelProperty
(
"身份证"
)
private
MultipartFile
idCardPic
;
}
car-reptiles-system/src/main/java/me/zhengjie/modules/system/rest/ReportController.java
View file @
944ce84a
...
...
@@ -11,6 +11,7 @@ import me.zhengjie.modules.system.domain.vo.signature.SignatureVo;
import
me.zhengjie.modules.system.service.ReportService
;
import
me.zhengjie.utils.AssertUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -35,6 +36,25 @@ public class ReportController {
this
.
reportService
=
reportService
;
}
@ApiOperation
(
"上传车检文件"
)
@PostMapping
(
value
=
"/uploadReportFiles"
,
produces
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
public
ResultVo
uploadReportFiles
(
@RequestParam
(
name
=
"reportFile"
)
MultipartFile
reportFile
,
@RequestParam
(
name
=
"drivingLicensePic1"
)
MultipartFile
drivingLicensePic1
,
@RequestParam
(
name
=
"drivingLicensePic2"
)
MultipartFile
drivingLicensePic2
,
@RequestParam
(
name
=
"idCardPic"
)
MultipartFile
idCardPic
,
@RequestParam
(
name
=
"reportPdfId"
)
Integer
reportPdfId
){
return
ResultVo
.
success
();
}
@ApiOperation
(
"下载检测报告Base64文件"
)
@GetMapping
(
"/download/{reportPdfId}"
)
public
ResultVo
<
ReportDownloadRespVo
>
downloadReport
(
@PathVariable
Integer
reportPdfId
){
AssertUtil
.
isNotNull
(
reportPdfId
,
"缺少参数reportPdfId"
);
return
ResultVo
.
success
(
reportService
.
getReportBase64FileByReportPdfId
(
reportPdfId
));
}
@ApiOperation
(
"获取当前用户部门下所有启用的签章"
)
@GetMapping
(
"/signatureList"
)
public
ResultVo
<
List
<
SignatureVo
>>
signatureList
(){
...
...
car-reptiles-system/src/main/java/me/zhengjie/modules/system/service/ReportService.java
View file @
944ce84a
package
me
.
zhengjie
.
modules
.
system
.
service
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.StrUtil
;
...
...
@@ -32,7 +33,9 @@ import org.springframework.security.core.userdetails.UserDetails;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
sun.misc.BASE64Encoder
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -72,6 +75,7 @@ public class ReportService {
this
.
restTemplate
=
restTemplate
;
}
//调试用
static
{
reportVoList
=
Arrays
.
asList
(
TestReportVo
.
builder
().
InspectionNum
(
"450107690120200529155024739"
)
...
...
@@ -87,6 +91,27 @@ public class ReportService {
}
/**
* 根据检测报告id查询pdf并进行Base64转换
* @param reportPdfId
* @return
*/
public
ReportDownloadRespVo
getReportBase64FileByReportPdfId
(
Integer
reportPdfId
){
ReportPdfVo
reportPdfVo
=
reportPdfMapper
.
selectById
(
reportPdfId
);
AssertUtil
.
isTrue
(
reportPdfVo
!=
null
&&
StrUtil
.
isNotBlank
(
reportPdfVo
.
getPath
()),
"不存在该检测报告,请刷新后重试"
);
boolean
notEmpty
=
FileUtil
.
isNotEmpty
(
FileUtil
.
file
(
reportPdfVo
.
getPath
()));
AssertUtil
.
isTrue
(
notEmpty
,
"检测报告丢失,请刷新后重试"
);
//将pdf检测报告转Base64
BASE64Encoder
encoder
=
new
BASE64Encoder
();
String
reportBase64
=
encoder
.
encode
(
FileUtil
.
readBytes
(
reportPdfVo
.
getPath
()));
ReportDownloadRespVo
reportDownloadRespVo
=
new
ReportDownloadRespVo
();
reportDownloadRespVo
.
setReportBase64
(
reportBase64
);
reportDownloadRespVo
.
setReportNum
(
reportPdfVo
.
getReportNum
());
System
.
out
.
println
(
reportBase64
);
return
reportDownloadRespVo
;
}
/**
* 获取当前用户部门下所有签章
* @return
*/
...
...
@@ -189,8 +214,13 @@ public class ReportService {
.
lambda
().
eq
(
ReportPdfVo:
:
getReportNum
,
detailsReqVo
.
getReportNum
()));
//如果已经下载保存过PDF了则删除旧的pdf 再去抓取新的pdf
if
(
reportPdfVo
!=
null
&&
StrUtil
.
isNotBlank
(
reportPdfVo
.
getPath
())){
/*
if(reportPdfVo != null && StrUtil.isNotBlank(reportPdfVo.getPath())){
FileUtil.del(reportPdfVo.getPath());
}*/
//测试用
if
(
reportPdfVo
!=
null
&&
StrUtil
.
isNotBlank
(
reportPdfVo
.
getPath
())){
return
reportPdfVo
;
}
//获取当前用户的部门
...
...
@@ -233,12 +263,14 @@ public class ReportService {
AssertUtil
.
isNotNull
(
deptVo
,
"列表获取失败,未找到当前账号所属部门"
);
IPage
<
TestReportVo
>
page
=
new
Page
<>(
pageQueryVo
.
getCurrNo
(),
pageQueryVo
.
getSize
());
try
{
/*
try {
page = carReportUtil.reportPageList(deptVo.getEpAccount(),deptVo.getEpPassword(),pageQueryVo);
} catch (InterruptedException e) {
e.printStackTrace();
}
/*page.setTotal(1).setRecords(reportVoList);*/
}*/
//测试用
page
.
setTotal
(
1
).
setRecords
(
reportVoList
);
return
page
;
}
...
...
car-reptiles-system/src/main/resources/config/application.yml
View file @
944ce84a
...
...
@@ -5,7 +5,7 @@ spring:
freemarker
:
check-template-location
:
false
profiles
:
active
:
prod
active
:
dev
jackson
:
time-zone
:
GMT+8
data
:
...
...
@@ -30,6 +30,10 @@ spring:
password
:
${REDIS_PWD:}
#连接超时时间
timeout
:
5000
servlet
:
multipart
:
max-file-size
:
100MB
max-request-size
:
100MB
#最大请求文件的大小
task
:
pool
:
...
...
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