Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
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
fangxinjiang
yifu-mvp
Commits
ba1b46ad
Commit
ba1b46ad
authored
Aug 30, 2022
by
李灿灿
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-licancan' into 'develop'
Feature licancan See merge request fangxinjiang/yifu!212
parents
81aa66ee
255f24b8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
38 deletions
+46
-38
TOrderEnclosure.java
...yifu/cloud/plus/v1/yifu/order/entity/TOrderEnclosure.java
+1
-1
OrderController.java
.../cloud/plus/v1/yifu/order/controller/OrderController.java
+1
-1
TOrderService.java
.../yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
+1
-1
TOrderServiceImpl.java
...ud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
+43
-35
No files found.
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/entity/TOrderEnclosure.java
View file @
ba1b46ad
...
...
@@ -28,7 +28,7 @@ public class TOrderEnclosure implements Serializable {
/**
* 附件标识是0时是订单编号,1时是回复表id
*/
@
Schema
(
description
=
"附件标识是0时是订单编号,1时是回复表id"
)
@
JsonIgnore
private
String
orderNo
;
/**
...
...
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/controller/OrderController.java
View file @
ba1b46ad
...
...
@@ -114,7 +114,7 @@ public class OrderController {
*/
@Schema
(
description
=
"添加回复"
)
@PostMapping
(
value
=
"/uploadReplyEnclosure"
)
public
R
uploadReplyEnclosure
(
@RequestBody
MultipartFile
file
,
String
filePath
,
String
replyContent
,
String
orderNo
)
throws
IOException
{
public
R
uploadReplyEnclosure
(
@RequestBody
MultipartFile
[]
file
,
String
filePath
,
String
replyContent
,
String
orderNo
)
throws
IOException
{
return
tOrderService
.
uploadReplyEnclosure
(
file
,
filePath
,
replyContent
,
orderNo
);
}
...
...
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
View file @
ba1b46ad
...
...
@@ -80,7 +80,7 @@ public interface TOrderService extends IService<TOrder> {
* @return {@link R}
* @throws IOException
*/
R
uploadReplyEnclosure
(
MultipartFile
file
,
String
filePath
,
String
replyContent
,
String
orderNo
)
throws
IOException
;
R
uploadReplyEnclosure
(
MultipartFile
[]
file
,
String
filePath
,
String
replyContent
,
String
orderNo
)
throws
IOException
;
/**
* 订单回复列表分页查询
...
...
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
View file @
ba1b46ad
...
...
@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.compress.utils.Lists
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -183,12 +184,12 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
R
uploadReplyEnclosure
(
MultipartFile
file
,
String
filePath
,
String
replyContent
,
String
orderNo
)
throws
IOException
{
public
R
uploadReplyEnclosure
(
MultipartFile
[]
file
,
String
filePath
,
String
replyContent
,
String
orderNo
)
throws
IOException
{
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
Common
.
isEmpty
(
orderNo
)){
return
R
.
failed
(
OrderConstants
.
ORDER_NO_IS_EMPTY
);
}
if
(
Common
.
isEmpty
(
replyContent
)
&&
Common
.
isEmpty
(
file
)){
if
(
Common
.
isEmpty
(
replyContent
)
&&
ArrayUtils
.
isEmpty
(
file
)){
return
R
.
failed
(
OrderConstants
.
REPLY_CONTENT_AND_ENCLOSURE_IS_EMPTY
);
}
// 校验回复内容200字以内
...
...
@@ -196,14 +197,19 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
return
R
.
failed
(
OrderConstants
.
REPLY_CONTENT_MORE_THAN_200
);
}
if
(!
Common
.
isEmpty
(
file
)){
if
(!
Common
.
checkInsuranceFile
(
file
.
getOriginalFilename
())){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_TYPE_IS_ERROR
);
}
if
(
file
.
getSize
()
>
(
CommonConstants
.
FIFTY_INT
*
CommonConstants
.
BYTE
*
CommonConstants
.
BYTE
)){
if
(
ArrayUtils
.
isNotEmpty
(
file
)){
if
(
file
.
length
>
CommonConstants
.
TWENTY_INT
){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_SIZE_ERROR
);
}
for
(
MultipartFile
multipartFile
:
file
)
{
if
(!
Common
.
checkInsuranceFile
(
multipartFile
.
getOriginalFilename
())){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_TYPE_IS_ERROR
);
}
if
(
multipartFile
.
getSize
()
>
(
CommonConstants
.
FIFTY_INT
*
CommonConstants
.
BYTE
*
CommonConstants
.
BYTE
)){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_SIZE_ERROR
);
}
}
}
TOrderReply
reply
=
new
TOrderReply
();
...
...
@@ -214,34 +220,36 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
reply
.
setDeleteFlag
(
CommonConstants
.
ZERO_INT
);
boolean
save
=
tOrderReplyService
.
save
(
reply
);
//todo 同步推送ekp
if
(
save
&&
!
Common
.
isEmpty
(
file
)){
String
fileName
=
System
.
currentTimeMillis
()
+
"_"
+
file
.
getOriginalFilename
();
//filePath不传默认存储空间的根目录
//支持的附件格式
String
key
=
""
;
if
(!
Common
.
isNotNull
(
filePath
))
{
key
=
fileName
;
}
else
{
key
=
filePath
+
"/"
+
fileName
;
}
boolean
flag
=
ossUtil
.
uploadFileByStream
(
file
.
getInputStream
(),
key
,
null
);
if
(
flag
)
{
log
.
info
(
"文件:"
+
fileName
+
"上传至存储空间"
+
ossUtil
.
getBucketName
()
+
"成功!"
);
TOrderEnclosure
orderEnclosure
=
new
TOrderEnclosure
();
orderEnclosure
.
setOrderNo
(
reply
.
getId
());
orderEnclosure
.
setEnclosureName
(
file
.
getOriginalFilename
());
orderEnclosure
.
setEnclosureFlag
(
CommonConstants
.
ONE_INT
);
orderEnclosure
.
setEnclosureAddress
(
key
);
orderEnclosure
.
setDeleteFlag
(
CommonConstants
.
ZERO_INT
);
try
{
tOrderEnclosureService
.
save
(
orderEnclosure
);
}
catch
(
Exception
e
)
{
log
.
error
(
"OSS文件上传接口异常:"
+
e
.
getMessage
());
ossUtil
.
deleteObject
(
null
,
key
);
return
R
.
failed
(
"failed:"
+
e
.
getMessage
());
if
(
save
&&
ArrayUtils
.
isNotEmpty
(
file
)){
for
(
MultipartFile
multipartFile
:
file
)
{
String
fileName
=
System
.
currentTimeMillis
()
+
"_"
+
multipartFile
.
getOriginalFilename
();
//filePath不传默认存储空间的根目录
//支持的附件格式
String
key
=
""
;
if
(!
Common
.
isNotNull
(
filePath
))
{
key
=
fileName
;
}
else
{
key
=
filePath
+
"/"
+
fileName
;
}
boolean
flag
=
ossUtil
.
uploadFileByStream
(
multipartFile
.
getInputStream
(),
key
,
null
);
if
(
flag
)
{
log
.
info
(
"文件:"
+
fileName
+
"上传至存储空间"
+
ossUtil
.
getBucketName
()
+
"成功!"
);
TOrderEnclosure
orderEnclosure
=
new
TOrderEnclosure
();
orderEnclosure
.
setOrderNo
(
reply
.
getId
());
orderEnclosure
.
setEnclosureName
(
multipartFile
.
getOriginalFilename
());
orderEnclosure
.
setEnclosureFlag
(
CommonConstants
.
ONE_INT
);
orderEnclosure
.
setEnclosureAddress
(
key
);
orderEnclosure
.
setDeleteFlag
(
CommonConstants
.
ZERO_INT
);
try
{
tOrderEnclosureService
.
save
(
orderEnclosure
);
}
catch
(
Exception
e
)
{
log
.
error
(
"OSS文件上传接口异常:"
+
e
.
getMessage
());
ossUtil
.
deleteObject
(
null
,
key
);
return
R
.
failed
(
"failed:"
+
e
.
getMessage
());
}
}
else
{
return
R
.
failed
(
OrderConstants
.
OPERATE_FAILED
);
}
}
else
{
return
R
.
failed
(
OrderConstants
.
OPERATE_FAILED
);
}
}
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
...
...
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