Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pension
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mengmeng
pension
Commits
d1bea003
Commit
d1bea003
authored
Mar 11, 2021
by
mlchun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.订单图片关联 附件上传接口完成
parent
a73e2dd7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
103 additions
and
5 deletions
+103
-5
PensionOrderDocumentDTO.java
...mit/modules/serviceOrder/dto/PensionOrderDocumentDTO.java
+1
-1
PensionOrderDocumentEntity.java
...dules/serviceOrder/entity/PensionOrderDocumentEntity.java
+1
-1
application.yml
hmit-admin/src/main/resources/application.yml
+5
-0
PensionOrderDocumentController.java
...rviceOrder/controller/PensionOrderDocumentController.java
+35
-0
PensionOrderDocumentDTO.java
...mit/modules/serviceOrder/dto/PensionOrderDocumentDTO.java
+1
-1
PensionOrderDocumentEntity.java
...dules/serviceOrder/entity/PensionOrderDocumentEntity.java
+1
-1
PensionDocumentService.java
.../modules/serviceOrder/service/PensionDocumentService.java
+5
-0
PensionDocumentServiceImpl.java
...serviceOrder/service/impl/PensionDocumentServiceImpl.java
+45
-0
application.yml
hmit-api/src/main/resources/application.yml
+9
-1
No files found.
hmit-admin/src/main/java/io/hmit/modules/serviceOrder/dto/PensionOrderDocumentDTO.java
View file @
d1bea003
...
@@ -22,7 +22,7 @@ public class PensionOrderDocumentDTO implements Serializable {
...
@@ -22,7 +22,7 @@ public class PensionOrderDocumentDTO implements Serializable {
@ApiModelProperty
(
value
=
""
)
@ApiModelProperty
(
value
=
""
)
private
Long
id
;
private
Long
id
;
@ApiModelProperty
(
value
=
"
服务
id"
)
@ApiModelProperty
(
value
=
"
订单
id"
)
private
Long
orderId
;
private
Long
orderId
;
@ApiModelProperty
(
value
=
"文件id"
)
@ApiModelProperty
(
value
=
"文件id"
)
...
...
hmit-admin/src/main/java/io/hmit/modules/serviceOrder/entity/PensionOrderDocumentEntity.java
View file @
d1bea003
...
@@ -20,7 +20,7 @@ public class PensionOrderDocumentEntity extends BaseEntity {
...
@@ -20,7 +20,7 @@ public class PensionOrderDocumentEntity extends BaseEntity {
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/**
/**
*
服务
id
*
订单
id
*/
*/
private
Long
orderId
;
private
Long
orderId
;
/**
/**
...
...
hmit-admin/src/main/resources/application.yml
View file @
d1bea003
...
@@ -38,6 +38,11 @@ spring:
...
@@ -38,6 +38,11 @@ spring:
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
activiti
:
activiti
:
check-process-definitions
:
false
check-process-definitions
:
false
# mvc:
# static-path-pattern: /static/**
# resources:
# static-locations: file:${QR.download-path},classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, classpath:/public/
#静态资源对外暴露的访问路径
fdfs
:
fdfs
:
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/controller/PensionOrderDocumentController.java
View file @
d1bea003
package
io
.
hmit
.
modules
.
serviceOrder
.
controller
;
package
io
.
hmit
.
modules
.
serviceOrder
.
controller
;
import
io.hmit.annotation.Login
;
import
io.hmit.annotation.LoginUser
;
import
io.hmit.common.constant.Constant
;
import
io.hmit.common.constant.Constant
;
import
io.hmit.common.page.PageData
;
import
io.hmit.common.page.PageData
;
import
io.hmit.common.utils.Result
;
import
io.hmit.common.utils.Result
;
...
@@ -8,16 +10,25 @@ import io.hmit.common.validator.ValidatorUtils;
...
@@ -8,16 +10,25 @@ import io.hmit.common.validator.ValidatorUtils;
import
io.hmit.common.validator.group.AddGroup
;
import
io.hmit.common.validator.group.AddGroup
;
import
io.hmit.common.validator.group.DefaultGroup
;
import
io.hmit.common.validator.group.DefaultGroup
;
import
io.hmit.common.validator.group.UpdateGroup
;
import
io.hmit.common.validator.group.UpdateGroup
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.modules.serviceOrder.dto.PensionOrderDocumentDTO
;
import
io.hmit.modules.serviceOrder.dto.PensionOrderDocumentDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionDocumentEntity
;
import
io.hmit.modules.serviceOrder.service.PensionDocumentService
;
import
io.hmit.modules.serviceOrder.service.PensionOrderDocumentService
;
import
io.hmit.modules.serviceOrder.service.PensionOrderDocumentService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
springfox.documentation.annotations.ApiIgnore
;
import
springfox.documentation.annotations.ApiIgnore
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -34,6 +45,9 @@ public class PensionOrderDocumentController {
...
@@ -34,6 +45,9 @@ public class PensionOrderDocumentController {
@Autowired
@Autowired
private
PensionOrderDocumentService
pensionOrderDocumentService
;
private
PensionOrderDocumentService
pensionOrderDocumentService
;
@Autowired
private
PensionDocumentService
pensionDocumentService
;
@GetMapping
(
"page"
)
@GetMapping
(
"page"
)
@ApiOperation
(
"分页"
)
@ApiOperation
(
"分页"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
...
@@ -89,4 +103,25 @@ public class PensionOrderDocumentController {
...
@@ -89,4 +103,25 @@ public class PensionOrderDocumentController {
return
new
Result
();
return
new
Result
();
}
}
/**
* 上传文件
*/
@PostMapping
(
"/uploadFile"
)
@ApiOperation
(
"附件上传"
)
public
Result
<
Map
<
String
,
Object
>>
uploadFile
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"orderId"
)
Long
orderId
){
Map
<
String
,
Object
>
fileMap
=
pensionDocumentService
.
uploadFile
(
file
);
if
(
null
!=
fileMap
)
{
PensionOrderDocumentDTO
dto
=
new
PensionOrderDocumentDTO
();
dto
.
setCreateDate
(
new
Date
());
dto
.
setOrderId
(
orderId
);
dto
.
setDocId
(
Long
.
parseLong
(
fileMap
.
get
(
"docId"
).
toString
()));
dto
.
setFileName
(
fileMap
.
get
(
"fileName"
).
toString
());
dto
.
setFilePath
(
fileMap
.
get
(
"filePath"
).
toString
());
pensionOrderDocumentService
.
save
(
dto
);
}
else
{
return
null
;
}
return
new
Result
<
Map
<
String
,
Object
>>().
ok
(
fileMap
);
}
}
}
\ No newline at end of file
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dto/PensionOrderDocumentDTO.java
View file @
d1bea003
...
@@ -22,7 +22,7 @@ public class PensionOrderDocumentDTO implements Serializable {
...
@@ -22,7 +22,7 @@ public class PensionOrderDocumentDTO implements Serializable {
@ApiModelProperty
(
value
=
""
)
@ApiModelProperty
(
value
=
""
)
private
Long
id
;
private
Long
id
;
@ApiModelProperty
(
value
=
"
服务
id"
)
@ApiModelProperty
(
value
=
"
订单
id"
)
private
Long
orderId
;
private
Long
orderId
;
@ApiModelProperty
(
value
=
"文件id"
)
@ApiModelProperty
(
value
=
"文件id"
)
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/entity/PensionOrderDocumentEntity.java
View file @
d1bea003
...
@@ -20,7 +20,7 @@ public class PensionOrderDocumentEntity extends BaseEntity {
...
@@ -20,7 +20,7 @@ public class PensionOrderDocumentEntity extends BaseEntity {
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/**
/**
*
服务
id
*
订单
id
*/
*/
private
Long
orderId
;
private
Long
orderId
;
/**
/**
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/PensionDocumentService.java
View file @
d1bea003
...
@@ -3,6 +3,9 @@ package io.hmit.modules.serviceOrder.service;
...
@@ -3,6 +3,9 @@ package io.hmit.modules.serviceOrder.service;
import
io.hmit.common.service.CrudService
;
import
io.hmit.common.service.CrudService
;
import
io.hmit.modules.serviceOrder.dto.PensionDocumentDTO
;
import
io.hmit.modules.serviceOrder.dto.PensionDocumentDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionDocumentEntity
;
import
io.hmit.modules.serviceOrder.entity.PensionDocumentEntity
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.Map
;
/**
/**
* 文件信息表
* 文件信息表
...
@@ -12,4 +15,6 @@ import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity;
...
@@ -12,4 +15,6 @@ import io.hmit.modules.serviceOrder.entity.PensionDocumentEntity;
*/
*/
public
interface
PensionDocumentService
extends
CrudService
<
PensionDocumentEntity
,
PensionDocumentDTO
>
{
public
interface
PensionDocumentService
extends
CrudService
<
PensionDocumentEntity
,
PensionDocumentDTO
>
{
Map
<
String
,
Object
>
uploadFile
(
MultipartFile
file
);
}
}
\ No newline at end of file
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/PensionDocumentServiceImpl.java
View file @
d1bea003
...
@@ -2,13 +2,19 @@ package io.hmit.modules.serviceOrder.service.impl;
...
@@ -2,13 +2,19 @@ package io.hmit.modules.serviceOrder.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
io.hmit.common.service.impl.CrudServiceImpl
;
import
io.hmit.common.service.impl.CrudServiceImpl
;
import
io.hmit.common.utils.Result
;
import
io.hmit.modules.serviceOrder.dao.PensionDocumentDao
;
import
io.hmit.modules.serviceOrder.dao.PensionDocumentDao
;
import
io.hmit.modules.serviceOrder.dto.PensionDocumentDTO
;
import
io.hmit.modules.serviceOrder.dto.PensionDocumentDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionDocumentEntity
;
import
io.hmit.modules.serviceOrder.entity.PensionDocumentEntity
;
import
io.hmit.modules.serviceOrder.service.PensionDocumentService
;
import
io.hmit.modules.serviceOrder.service.PensionDocumentService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -30,5 +36,44 @@ public class PensionDocumentServiceImpl extends CrudServiceImpl<PensionDocumentD
...
@@ -30,5 +36,44 @@ public class PensionDocumentServiceImpl extends CrudServiceImpl<PensionDocumentD
return
wrapper
;
return
wrapper
;
}
}
@Value
(
"${QR.download-path}"
)
private
String
QRPath
;
@Override
public
Map
<
String
,
Object
>
uploadFile
(
MultipartFile
file
)
{
if
(
file
.
isEmpty
())
{
return
null
;
}
//生成随机时间错
Long
currenttime
=
System
.
currentTimeMillis
();
//上传文件
String
file_path
=
"/static/"
+
currenttime
+
"-"
+
file
.
getOriginalFilename
();
String
file_path_act
=
QRPath
+
currenttime
+
"-"
+
file
.
getOriginalFilename
();
System
.
out
.
println
(
file_path_act
);
File
fileAct
=
new
File
(
file_path_act
);
if
(!
fileAct
.
getParentFile
().
exists
())
{
fileAct
.
getParentFile
().
mkdirs
();
}
try
{
file
.
transferTo
(
fileAct
);
}
catch
(
IllegalStateException
|
IOException
e
)
{
e
.
printStackTrace
();
}
//保存文件信息
PensionDocumentEntity
pensionDocumentEntity
=
new
PensionDocumentEntity
();
pensionDocumentEntity
.
setFileName
(
fileAct
.
getName
());
pensionDocumentEntity
.
setFilePath
(
file_path
);
pensionDocumentEntity
.
setFilePathAct
(
fileAct
.
getPath
());
pensionDocumentEntity
.
setFileSize
(
Double
.
parseDouble
(
String
.
valueOf
(
file
.
getSize
())));
pensionDocumentEntity
.
setFileType
(
file
.
getContentType
());
pensionDocumentEntity
.
setStatus
(
"1"
);
insert
(
pensionDocumentEntity
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"fileName"
,
fileAct
.
getName
());
result
.
put
(
"filePath"
,
file_path
);
result
.
put
(
"docId"
,
pensionDocumentEntity
.
getId
());
return
result
;
}
}
}
\ No newline at end of file
hmit-api/src/main/resources/application.yml
View file @
d1bea003
...
@@ -38,6 +38,11 @@ spring:
...
@@ -38,6 +38,11 @@ spring:
max-wait
:
-1ms
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait
:
-1ms
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle
:
10
# 连接池中的最大空闲连接
max-idle
:
10
# 连接池中的最大空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
# mvc:
# static-path-pattern: /static/**
# resources:
# static-locations: file:${QR.download-path},classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, classpath:/public/
# #静态资源对外暴露的访问路径
hmit
:
hmit
:
redis
:
redis
:
...
@@ -64,4 +69,7 @@ mybatis-plus:
...
@@ -64,4 +69,7 @@ mybatis-plus:
map-underscore-to-camel-case
:
true
map-underscore-to-camel-case
:
true
cache-enabled
:
false
cache-enabled
:
false
call-setters-on-nulls
:
true
call-setters-on-nulls
:
true
jdbc-type-for-null
:
'
null'
jdbc-type-for-null
:
'
null'
\ No newline at end of file
QR
:
# download-path: /home/resourse/bsqzc/ D:/123/ /home/websoft/java_jar/bl_workorder/myfile/
download-path
:
D:/123/
\ No newline at end of file
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