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
6a2b3a4f
Commit
6a2b3a4f
authored
Aug 30, 2022
by
李灿灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单按照测试用例调整
parent
518edf96
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
102 additions
and
62 deletions
+102
-62
ValidityConstants.java
....plus.v1/yifu/common/core/constant/ValidityConstants.java
+2
-0
OrderConstants.java
...fu/cloud/plus/v1/yifu/order/constants/OrderConstants.java
+4
-4
TOrderEnclosure.java
...yifu/cloud/plus/v1/yifu/order/entity/TOrderEnclosure.java
+3
-3
TOrderReply.java
...com/yifu/cloud/plus/v1/yifu/order/entity/TOrderReply.java
+1
-1
ValidityUtil.java
.../com/yifu/cloud/plus/v1/yifu/order/util/ValidityUtil.java
+26
-0
util.md
.../main/java/com/yifu/cloud/plus/v1/yifu/order/util/util.md
+0
-0
OrderReplyListVO.java
...om/yifu/cloud/plus/v1/yifu/order/vo/OrderReplyListVO.java
+7
-2
TOrderServiceImpl.java
...ud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
+54
-48
TOrderMapper.xml
...yifu-order-biz/src/main/resources/mapper/TOrderMapper.xml
+5
-4
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/ValidityConstants.java
View file @
6a2b3a4f
...
@@ -66,6 +66,8 @@ public class ValidityConstants {
...
@@ -66,6 +66,8 @@ public class ValidityConstants {
public
static
final
String
PATTERN_50
=
"^.{1,50}$"
;
public
static
final
String
PATTERN_50
=
"^.{1,50}$"
;
/** 最多60位 规则 */
/** 最多60位 规则 */
public
static
final
String
PATTERN_60
=
"^.{1,60}$"
;
public
static
final
String
PATTERN_60
=
"^.{1,60}$"
;
/** 最多200位 规则 */
public
static
final
String
PATTERN_200
=
"^.{1,200}$"
;
/** 不超过两位小数的正数 */
/** 不超过两位小数的正数 */
public
static
final
String
POSITIVE_INTEGER_PATTERN_TWO_FLOAT
=
"^[+]?([0-9]+(.[0-9]{1,2})?)$"
;
public
static
final
String
POSITIVE_INTEGER_PATTERN_TWO_FLOAT
=
"^[+]?([0-9]+(.[0-9]{1,2})?)$"
;
...
...
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/constants/OrderConstants.java
View file @
6a2b3a4f
...
@@ -39,13 +39,13 @@ public class OrderConstants {
...
@@ -39,13 +39,13 @@ public class OrderConstants {
*/
*/
public
static
final
String
ORDER_NO_IS_EMPTY
=
"订单编号不能为空"
;
public
static
final
String
ORDER_NO_IS_EMPTY
=
"订单编号不能为空"
;
/**
/**
* 回复内容
不能为空
* 回复内容
和附件,两者必填其一
*/
*/
public
static
final
String
REPLY_CONTENT_
IS_EMPTY
=
"回复内容不能为空
"
;
public
static
final
String
REPLY_CONTENT_
AND_ENCLOSURE_IS_EMPTY
=
"回复内容和附件,两者必填其一
"
;
/**
/**
*
附件不能为空
*
“回复内容”,200字以内
*/
*/
public
static
final
String
ENCLOSURE_IS_EMPTY
=
"附件不能为空
"
;
public
static
final
String
REPLY_CONTENT_MORE_THAN_200
=
"“回复内容”,200字以内
"
;
/**
/**
* 非法的附件类型
* 非法的附件类型
*/
*/
...
...
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/entity/TOrderEnclosure.java
View file @
6a2b3a4f
...
@@ -23,12 +23,12 @@ public class TOrderEnclosure implements Serializable {
...
@@ -23,12 +23,12 @@ public class TOrderEnclosure implements Serializable {
*/
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"主键"
)
@Schema
(
description
=
"主键"
)
private
Integer
id
;
private
String
id
;
/**
/**
*
订单编号
*
附件标识是0时是订单编号,1时是回复表id
*/
*/
@Schema
(
description
=
"
订单编号
"
)
@Schema
(
description
=
"
附件标识是0时是订单编号,1时是回复表id
"
)
private
String
orderNo
;
private
String
orderNo
;
/**
/**
...
...
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/entity/TOrderReply.java
View file @
6a2b3a4f
...
@@ -22,7 +22,7 @@ public class TOrderReply implements Serializable {
...
@@ -22,7 +22,7 @@ public class TOrderReply implements Serializable {
*/
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"主键"
)
@Schema
(
description
=
"主键"
)
private
Integer
id
;
private
String
id
;
/**
/**
* 订单编号
* 订单编号
...
...
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/util/ValidityUtil.java
0 → 100644
View file @
6a2b3a4f
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
util
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
/**
* @author licancan
* @description 校验工具类
* @date 2022-08-30 10:30:16
*/
public
class
ValidityUtil
{
/**
* 验证字符串 最多200位
*
* @author licancan
* @param str
* @return {@link boolean}
*/
public
static
boolean
validate200
(
final
String
str
){
if
(
Common
.
isEmpty
(
str
)){
return
Boolean
.
FALSE
;
}
return
str
.
matches
(
ValidityConstants
.
PATTERN_200
)
;
}
}
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/util/util.md
deleted
100644 → 0
View file @
518edf96
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/OrderReplyListVO.java
View file @
6a2b3a4f
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
vo
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderEnclosure
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderEnclosure
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -20,10 +19,16 @@ import java.util.List;
...
@@ -20,10 +19,16 @@ import java.util.List;
public
class
OrderReplyListVO
implements
Serializable
{
public
class
OrderReplyListVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1376876766552447670L
;
private
static
final
long
serialVersionUID
=
-
1376876766552447670L
;
/**
* 主键
*/
@Schema
(
description
=
"主键"
)
private
String
id
;
/**
/**
* 订单编号
* 订单编号
*/
*/
@
JsonIgnore
@
Schema
(
description
=
"订单编号"
)
private
String
orderNo
;
private
String
orderNo
;
/**
/**
...
...
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
View file @
6a2b3a4f
...
@@ -18,6 +18,7 @@ import com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderMapper;
...
@@ -18,6 +18,7 @@ import com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderMapper;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderEnclosureService
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderEnclosureService
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderReplyService
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderReplyService
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderService
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderService
;
import
com.yifu.cloud.plus.v1.yifu.order.util.ValidityUtil
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderDetailVO
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderDetailVO
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderListParam
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderListParam
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO
;
...
@@ -181,64 +182,69 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
...
@@ -181,64 +182,69 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
* @throws IOException
* @throws IOException
*/
*/
@Override
@Override
@Transactional
@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
();
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
Common
.
isEmpty
(
orderNo
)){
if
(
Common
.
isEmpty
(
orderNo
)){
return
R
.
failed
(
OrderConstants
.
ORDER_NO_IS_EMPTY
);
return
R
.
failed
(
OrderConstants
.
ORDER_NO_IS_EMPTY
);
}
}
if
(
Common
.
isEmpty
(
replyContent
)){
if
(
Common
.
isEmpty
(
replyContent
)
&&
Common
.
isEmpty
(
file
)
){
return
R
.
failed
(
OrderConstants
.
REPLY_CONTENT_IS_EMPTY
);
return
R
.
failed
(
OrderConstants
.
REPLY_CONTENT_
AND_ENCLOSURE_
IS_EMPTY
);
}
}
//
todo 校验回复内容的长度
//
校验回复内容200字以内
if
(
Common
.
isEmpty
(
file
)){
if
(!
Common
.
isEmpty
(
replyContent
)
&&
!
ValidityUtil
.
validate200
(
replyContent
)){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_IS_EMPTY
);
return
R
.
failed
(
OrderConstants
.
REPLY_CONTENT_MORE_THAN_200
);
}
}
if
(!
Common
.
checkInsuranceFile
(
file
.
getOriginalFilename
())){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_TYPE_IS_ERROR
);
if
(!
Common
.
isEmpty
(
file
)){
}
if
(!
Common
.
checkInsuranceFile
(
file
.
getOriginalFilename
())){
if
(
file
.
getSize
()
>
(
CommonConstants
.
FIFTY_INT
*
CommonConstants
.
BYTE
*
CommonConstants
.
BYTE
)){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_TYPE_IS_ERROR
);
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_SIZE_ERROR
);
}
}
String
fileName
=
System
.
currentTimeMillis
()
+
"_"
+
file
.
getOriginalFilename
();
if
(
file
.
getSize
()
>
(
CommonConstants
.
FIFTY_INT
*
CommonConstants
.
BYTE
*
CommonConstants
.
BYTE
)){
//filePath不传默认存储空间的根目录
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_SIZE_ERROR
);
//支持的附件格式
}
String
key
=
""
;
if
(!
Common
.
isNotNull
(
filePath
))
{
key
=
fileName
;
}
else
{
key
=
filePath
+
"/"
+
fileName
;
}
}
boolean
flag
=
ossUtil
.
uploadFileByStream
(
file
.
getInputStream
(),
key
,
null
);
if
(
flag
)
{
TOrderReply
reply
=
new
TOrderReply
();
log
.
info
(
"文件:"
+
fileName
+
"上传至存储空间"
+
ossUtil
.
getBucketName
()
+
"成功!"
);
reply
.
setOrderNo
(
orderNo
);
TOrderEnclosure
orderEnclosure
=
new
TOrderEnclosure
();
reply
.
setReplyContent
(
Common
.
isEmpty
(
replyContent
)?
null
:
replyContent
);
orderEnclosure
.
setOrderNo
(
orderNo
);
reply
.
setCreateName
(
user
.
getNickname
());
orderEnclosure
.
setEnclosureName
(
file
.
getOriginalFilename
());
reply
.
setCreateTime
(
LocalDateTime
.
now
());
orderEnclosure
.
setEnclosureFlag
(
CommonConstants
.
ONE_INT
);
reply
.
setDeleteFlag
(
CommonConstants
.
ZERO_INT
);
orderEnclosure
.
setEnclosureAddress
(
key
);
boolean
save
=
tOrderReplyService
.
save
(
reply
);
orderEnclosure
.
setDeleteFlag
(
CommonConstants
.
ZERO_INT
);
//todo 同步推送ekp
try
{
if
(
save
&&
!
Common
.
isEmpty
(
file
)){
boolean
b
=
tOrderEnclosureService
.
save
(
orderEnclosure
);
String
fileName
=
System
.
currentTimeMillis
()
+
"_"
+
file
.
getOriginalFilename
();
if
(
b
){
//filePath不传默认存储空间的根目录
TOrderReply
reply
=
new
TOrderReply
();
//支持的附件格式
reply
.
setOrderNo
(
orderNo
);
String
key
=
""
;
reply
.
setReplyContent
(
replyContent
);
if
(!
Common
.
isNotNull
(
filePath
))
{
reply
.
setCreateName
(
user
.
getNickname
());
key
=
fileName
;
reply
.
setCreateTime
(
LocalDateTime
.
now
());
}
else
{
reply
.
setDeleteFlag
(
CommonConstants
.
ZERO_INT
);
key
=
filePath
+
"/"
+
fileName
;
tOrderReplyService
.
save
(
reply
);
}
//todo 同步推送ekp
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
());
}
}
}
catch
(
Exception
e
)
{
}
else
{
log
.
error
(
"OSS文件上传接口异常:"
+
e
.
getMessage
());
return
R
.
failed
(
OrderConstants
.
OPERATE_FAILED
);
ossUtil
.
deleteObject
(
null
,
key
);
return
R
.
failed
(
"failed:"
+
e
.
getMessage
());
}
}
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
}
else
{
return
R
.
failed
(
OrderConstants
.
OPERATE_FAILED
);
}
}
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
}
}
/**
/**
...
@@ -255,7 +261,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
...
@@ -255,7 +261,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
if
(
CollectionUtils
.
isNotEmpty
(
orderReplyList
.
getRecords
())){
if
(
CollectionUtils
.
isNotEmpty
(
orderReplyList
.
getRecords
())){
orderReplyList
.
getRecords
().
stream
().
forEach
(
e
->{
orderReplyList
.
getRecords
().
stream
().
forEach
(
e
->{
List
<
TOrderEnclosure
>
list
=
tOrderEnclosureService
.
list
(
Wrappers
.<
TOrderEnclosure
>
query
().
lambda
()
List
<
TOrderEnclosure
>
list
=
tOrderEnclosureService
.
list
(
Wrappers
.<
TOrderEnclosure
>
query
().
lambda
()
.
eq
(
TOrderEnclosure:
:
getOrderNo
,
e
.
get
OrderNo
())
.
eq
(
TOrderEnclosure:
:
getOrderNo
,
e
.
get
Id
())
.
eq
(
TOrderEnclosure:
:
getEnclosureFlag
,
CommonConstants
.
ONE_INT
)
.
eq
(
TOrderEnclosure:
:
getEnclosureFlag
,
CommonConstants
.
ONE_INT
)
.
eq
(
TOrderEnclosure:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TOrderEnclosure:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
);
);
...
...
yifu-order/yifu-order-biz/src/main/resources/mapper/TOrderMapper.xml
View file @
6a2b3a4f
...
@@ -131,10 +131,11 @@
...
@@ -131,10 +131,11 @@
<select
id=
"getOrderReplyPageList"
resultType=
"com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO"
>
<select
id=
"getOrderReplyPageList"
resultType=
"com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO"
>
select
select
t.ORDER_NO as orderNo,
t.ID as id,
t.CREATE_NAME as createName,
t.ORDER_NO as orderNo,
t.CREATE_TIME as createTime,
t.CREATE_NAME as createName,
t.REPLY_CONTENT as replyContent
t.CREATE_TIME as createTime,
t.REPLY_CONTENT as replyContent
from t_order_reply t
from t_order_reply t
where t.DELETE_FLAG = 0
where t.DELETE_FLAG = 0
and t.ORDER_NO = #{orderNo}
and t.ORDER_NO = #{orderNo}
...
...
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