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
81aa66ee
Commit
81aa66ee
authored
Aug 30, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
81bbab09
54d2561d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
592 additions
and
61 deletions
+592
-61
ValidityConstants.java
....plus.v1/yifu/common/core/constant/ValidityConstants.java
+2
-0
TInsuranceDetail.java
...loud/plus/v1/yifu/insurances/entity/TInsuranceDetail.java
+6
-0
TInsuranceDetailServiceImpl.java
...s/service/insurance/impl/TInsuranceDetailServiceImpl.java
+4
-7
TInsuranceDetailMapper.xml
...in/resources/mapper/insurances/TInsuranceDetailMapper.xml
+42
-40
TInsuranceRefundMapper.xml
...in/resources/mapper/insurances/TInsuranceRefundMapper.xml
+1
-1
OrderConstants.java
...fu/cloud/plus/v1/yifu/order/constants/OrderConstants.java
+28
-0
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
OrderDetailVO.java
...a/com/yifu/cloud/plus/v1/yifu/order/vo/OrderDetailVO.java
+76
-0
OrderReplyListVO.java
...om/yifu/cloud/plus/v1/yifu/order/vo/OrderReplyListVO.java
+58
-0
OrderController.java
.../cloud/plus/v1/yifu/order/controller/OrderController.java
+68
-4
TOrderMapper.java
...om/yifu/cloud/plus/v1/yifu/order/mapper/TOrderMapper.java
+21
-0
TOrderService.java
.../yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
+45
-0
TOrderServiceImpl.java
...ud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
+182
-3
TOrderEnclosureMapper.xml
...r-biz/src/main/resources/mapper/TOrderEnclosureMapper.xml
+1
-1
TOrderMapper.xml
...yifu-order-biz/src/main/resources/mapper/TOrderMapper.xml
+27
-0
TOrderReplyMapper.xml
...order-biz/src/main/resources/mapper/TOrderReplyMapper.xml
+1
-1
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/ValidityConstants.java
View file @
81aa66ee
...
...
@@ -66,6 +66,8 @@ public class ValidityConstants {
public
static
final
String
PATTERN_50
=
"^.{1,50}$"
;
/** 最多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})?)$"
;
...
...
yifu-insurances/yifu-insurances-api/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/entity/TInsuranceDetail.java
View file @
81aa66ee
...
...
@@ -303,6 +303,12 @@ public class TInsuranceDetail extends BaseEntity {
@Schema
(
description
=
"创建人所在部门名称"
)
private
String
createUserDeptName
;
/**
* 减员id
*/
@Schema
(
description
=
"减员id"
)
private
String
refundId
;
...
...
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/insurance/impl/TInsuranceDetailServiceImpl.java
View file @
81aa66ee
...
...
@@ -2920,14 +2920,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if
(
StringUtils
.
isNotBlank
(
refund
.
getRemark
())){
insuranceRefund
.
setRemark
(
refund
.
getRemark
());
}
if
(
null
==
refund
.
getReduceHandleStatus
()){
tInsuranceRefundService
.
save
(
insuranceRefund
);
}
else
{
tInsuranceRefundService
.
updateByInsDetailId
(
insuranceRefund
);
}
tInsuranceRefundService
.
save
(
insuranceRefund
);
LambdaUpdateWrapper
<
TInsuranceDetail
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
set
(
TInsuranceDetail
::
getUpdateBy
,
user
.
getId
())
.
set
(
TInsuranceDetail
::
getUpdateTime
,
LocalDateTime
.
now
())
.
set
(
TInsuranceDetail
::
getRefundId
,
insuranceRefund
.
getId
())
.
set
(
TInsuranceDetail
::
getReduceHandleStatus
,
CommonConstants
.
ONE_INT
);
updateWrapper
.
eq
(
TInsuranceDetail
::
getId
,
refund
.
getId
());
update
(
updateWrapper
);
...
...
@@ -3175,7 +3172,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail
.
setUpdateTime
(
LocalDateTime
.
now
());
detail
.
setReduceHandleStatus
(
CommonConstants
.
TWO_INT
);
detailList
.
add
(
detail
);
refund
.
setI
nsDetailId
(
record
.
get
Id
());
refund
.
setI
d
(
detail
.
getRefund
Id
());
refund
.
setReduceHandleStatus
(
CommonConstants
.
TWO_INT
);
refund
.
setUpdateBy
(
user
.
getId
());
refund
.
setUpdateTime
(
LocalDateTime
.
now
());
...
...
@@ -3256,7 +3253,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceDetail
.
setUpdateTime
(
LocalDateTime
.
now
());
successList
.
add
(
tInsuranceDetail
);
//更新减员记录
refund
.
setI
nsDetailId
(
tInsuranceDetail
.
get
Id
());
refund
.
setI
d
(
tInsuranceDetail
.
getRefund
Id
());
refund
.
setUpdateBy
(
user
.
getId
());
refund
.
setUpdateTime
(
LocalDateTime
.
now
());
refund
.
setReduceHandleStatus
(
refundType
);
...
...
yifu-insurances/yifu-insurances-biz/src/main/resources/mapper/insurances/TInsuranceDetailMapper.xml
View file @
81aa66ee
This diff is collapsed.
Click to expand it.
yifu-insurances/yifu-insurances-biz/src/main/resources/mapper/insurances/TInsuranceRefundMapper.xml
View file @
81aa66ee
...
...
@@ -57,7 +57,7 @@
</if>
REDUCE_HANDLE_STATUS = #{param.reduceHandleStatus}
where
I
NS_DETAIL_ID = #{param.insDetailI
d}
I
D = #{param.i
d}
</update>
<update
id=
"updateRefundMoney"
>
update
...
...
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/constants/OrderConstants.java
View file @
81aa66ee
...
...
@@ -18,6 +18,10 @@ public class OrderConstants {
* 订单id不可为空
*/
public
static
final
String
ORDER_ID_IS_EMPTY
=
"订单id不可为空"
;
/**
* 附件id不可为空
*/
public
static
final
String
ENCLOSURE_ID_IS_EMPTY
=
"附件id不可为空"
;
/**
* 订单已办结,不可操作
*/
...
...
@@ -26,4 +30,28 @@ public class OrderConstants {
* 操作成功
*/
public
static
final
String
OPERATE_SUCCESS
=
"操作成功"
;
/**
* 操作失败
*/
public
static
final
String
OPERATE_FAILED
=
"操作失败"
;
/**
* 订单编号不能为空
*/
public
static
final
String
ORDER_NO_IS_EMPTY
=
"订单编号不能为空"
;
/**
* 回复内容和附件,两者必填其一
*/
public
static
final
String
REPLY_CONTENT_AND_ENCLOSURE_IS_EMPTY
=
"回复内容和附件,两者必填其一"
;
/**
* “回复内容”,200字以内
*/
public
static
final
String
REPLY_CONTENT_MORE_THAN_200
=
"“回复内容”,200字以内"
;
/**
* 非法的附件类型
*/
public
static
final
String
ENCLOSURE_TYPE_IS_ERROR
=
"非法的附件类型"
;
/**
* 附件超出上传上限
*/
public
static
final
String
ENCLOSURE_SIZE_ERROR
=
"附件超出上传上限"
;
}
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/entity/TOrderEnclosure.java
View file @
81aa66ee
...
...
@@ -23,12 +23,12 @@ public class TOrderEnclosure implements Serializable {
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"主键"
)
private
Integer
id
;
private
String
id
;
/**
*
订单编号
*
附件标识是0时是订单编号,1时是回复表id
*/
@Schema
(
description
=
"
订单编号
"
)
@Schema
(
description
=
"
附件标识是0时是订单编号,1时是回复表id
"
)
private
String
orderNo
;
/**
...
...
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/entity/TOrderReply.java
View file @
81aa66ee
...
...
@@ -22,7 +22,7 @@ public class TOrderReply implements Serializable {
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@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 @
81aa66ee
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 @
81bbab09
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/OrderDetailVO.java
0 → 100644
View file @
81aa66ee
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderEnclosure
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* @author licancan
* @description 订单详情VO
* @date 2022-08-29 15:18:50
*/
@Data
@Schema
(
description
=
"订单详情VO"
)
public
class
OrderDetailVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
6669349004826405691L
;
/**
* 创建人姓名(下单人)
*/
@Schema
(
description
=
"创建人姓名(下单人)"
)
private
String
createName
;
/**
* 创建时间(下单时间)
*/
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Schema
(
description
=
"创建时间(下单时间)"
)
private
LocalDateTime
createTime
;
/**
* 项目编码
*/
@Schema
(
description
=
"项目编码"
)
private
String
deptNo
;
/**
* 项目名称
*/
@Schema
(
description
=
"项目名称"
)
private
String
deptName
;
/**
* 订单编号
*/
@Schema
(
description
=
"订单编号"
)
private
String
orderNo
;
/**
* 客户名称
*/
@Schema
(
description
=
"客户名称"
)
private
String
customerName
;
/**
* 订单状态 0待办理 1办理中 2已办结
*/
@Schema
(
description
=
"订单状态 0待办理 1办理中 2已办结"
)
private
Integer
orderStatus
;
/**
* 订单内容
*/
@Schema
(
description
=
"订单内容"
)
private
String
orderContent
;
/**
* 原始单据
*/
@Schema
(
description
=
"原始单据"
)
private
List
<
TOrderEnclosure
>
orderEnclosure
;
}
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/OrderReplyListVO.java
0 → 100644
View file @
81aa66ee
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderEnclosure
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* @author licancan
* @description 订单回复列表vo
* @date 2022-08-29 17:07:50
*/
@Data
@Schema
(
description
=
"订单回复列表vo"
)
public
class
OrderReplyListVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1376876766552447670L
;
/**
* 主键
*/
@Schema
(
description
=
"主键"
)
private
String
id
;
/**
* 订单编号
*/
@Schema
(
description
=
"订单编号"
)
private
String
orderNo
;
/**
* 创建人姓名(回复人)
*/
@Schema
(
description
=
"创建人姓名(回复人)"
)
private
String
createName
;
/**
* 创建时间(回复时间)
*/
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Schema
(
description
=
"创建时间(回复时间)"
)
private
LocalDateTime
createTime
;
/**
* 回复内容
*/
@Schema
(
description
=
"回复内容"
)
private
String
replyContent
;
/**
* 回复附件
*/
@Schema
(
description
=
"回复附件"
)
private
List
<
TOrderEnclosure
>
orderReplyEnclosure
;
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/controller/OrderController.java
View file @
81aa66ee
...
...
@@ -2,19 +2,23 @@ package com.yifu.cloud.plus.v1.yifu.order.controller;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.order.constants.OrderConstants
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderService
;
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.OrderListVO
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.util.List
;
/**
...
...
@@ -71,4 +75,64 @@ public class OrderController {
return
tOrderService
.
handleOrder
(
id
,
status
);
}
/**
* 通过id查询详情
*
* @author licancan
* @param id 订单id
* @return {@link R<OrderDetailVO>}
*/
@Operation
(
summary
=
"通过id查询详情"
,
description
=
"通过id查询详情"
)
@GetMapping
(
"/{id}"
)
public
R
<
OrderDetailVO
>
getInsuranceDetailById
(
@PathVariable
(
"id"
)
String
id
)
{
return
tOrderService
.
getOrderDetailById
(
id
);
}
/**
* 附件预览下载地址
*
* @author licancan
* @param id 附件表id
* @return {@link R}
*/
@Schema
(
description
=
"附件预览下载地址,附件表id"
)
@GetMapping
(
"/getEnclosureUrl/{id}"
)
public
R
getEnclosureUrl
(
@PathVariable
String
id
)
{
return
tOrderService
.
getEnclosureUrl
(
id
);
}
/**
* 添加回复
*
* @author licancan
* @param file 附件
* @param filePath 附件路径
* @param replyContent 回复内容
* @param orderNo 订单编号
* @return {@link R}
* @throws IOException
*/
@Schema
(
description
=
"添加回复"
)
@PostMapping
(
value
=
"/uploadReplyEnclosure"
)
public
R
uploadReplyEnclosure
(
@RequestBody
MultipartFile
file
,
String
filePath
,
String
replyContent
,
String
orderNo
)
throws
IOException
{
return
tOrderService
.
uploadReplyEnclosure
(
file
,
filePath
,
replyContent
,
orderNo
);
}
/**
* 订单回复列表分页查询
*
* @author licancan
* @param page
* @param orderNo
* @return {@link R<IPage< OrderReplyListVO>>}
*/
@Operation
(
summary
=
"订单回复列表分页查询"
,
description
=
"订单回复列表分页查询"
)
@GetMapping
(
"/getOrderReplyPageList"
)
public
R
<
IPage
<
OrderReplyListVO
>>
getOrderReplyPageList
(
Page
<
OrderReplyListVO
>
page
,
String
orderNo
)
{
if
(
Common
.
isEmpty
(
orderNo
)){
return
R
.
failed
(
OrderConstants
.
ORDER_NO_IS_EMPTY
);
}
return
R
.
ok
(
tOrderService
.
getOrderReplyPageList
(
page
,
orderNo
));
}
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/mapper/TOrderMapper.java
View file @
81aa66ee
...
...
@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrder
;
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.OrderListVO
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -47,4 +49,23 @@ public interface TOrderMapper extends BaseMapper<TOrder> {
* @return {@link List< OrderListVO>}
*/
List
<
OrderListVO
>
getOrderList
(
@Param
(
"param"
)
OrderListParam
param
);
/**
* 通过id查询详情
*
* @author licancan
* @param id
* @return {@link OrderDetailVO}
*/
OrderDetailVO
getOrderDetailById
(
@Param
(
"id"
)
String
id
);
/**
* 订单回复列表分页查询
*
* @author licancan
* @param page
* @param orderNo
* @return {@link IPage< OrderReplyListVO>}
*/
IPage
<
OrderReplyListVO
>
getOrderReplyPageList
(
Page
<
OrderReplyListVO
>
page
,
@Param
(
"orderNo"
)
String
orderNo
);
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
View file @
81aa66ee
...
...
@@ -6,9 +6,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrder
;
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.OrderListVO
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.util.List
;
/**
...
...
@@ -46,4 +50,45 @@ public interface TOrderService extends IService<TOrder> {
* @return {@link R<String>}
*/
R
<
String
>
handleOrder
(
String
id
,
Integer
status
);
/**
* 通过id查询详情
*
* @author licancan
* @param id
* @return {@link R<OrderDetailVO>}
*/
R
<
OrderDetailVO
>
getOrderDetailById
(
String
id
);
/**
* 附件预览下载地址
*
* @author licancan
* @param id 附件表id
* @return {@link R}
*/
R
getEnclosureUrl
(
String
id
);
/**
* 添加回复
*
* @author licancan
* @param file 附件
* @param filePath 附件路径
* @param replyContent 回复内容
* @param orderNo 订单编号
* @return {@link R}
* @throws IOException
*/
R
uploadReplyEnclosure
(
MultipartFile
file
,
String
filePath
,
String
replyContent
,
String
orderNo
)
throws
IOException
;
/**
* 订单回复列表分页查询
*
* @author licancan
* @param page
* @param orderNo
* @return {@link IPage< OrderReplyListVO>}
*/
IPage
<
OrderReplyListVO
>
getOrderReplyPageList
(
Page
<
OrderReplyListVO
>
page
,
String
orderNo
);
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
View file @
81aa66ee
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
com.yifu.cloud.plus.v1.yifu.order.constants.OrderConstants
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrder
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderEnclosure
;
import
com.yifu.cloud.plus.v1.yifu.order.entity.TOrderReply
;
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.TOrderReplyService
;
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.OrderListParam
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO
;
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.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Optional
;
/**
...
...
@@ -31,6 +47,12 @@ import java.util.Optional;
@Slf4j
@Service
public
class
TOrderServiceImpl
extends
ServiceImpl
<
TOrderMapper
,
TOrder
>
implements
TOrderService
{
@Resource
private
TOrderEnclosureService
tOrderEnclosureService
;
@Resource
private
TOrderReplyService
tOrderReplyService
;
@Resource
private
OSSUtil
ossUtil
;
/**
* 订单列表分页查询
...
...
@@ -77,7 +99,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
if
(
StringUtils
.
isEmpty
(
id
)){
return
R
.
failed
(
OrderConstants
.
ORDER_ID_IS_EMPTY
);
}
if
(
CommonConstants
.
TWO_INT
!=
status
&&
CommonConstants
.
THREE
_INT
!=
status
){
if
(
CommonConstants
.
ONE_INT
!=
status
&&
CommonConstants
.
TWO
_INT
!=
status
){
return
R
.
failed
(
OrderConstants
.
STATUS_ERROR
);
}
YifuUser
user
=
SecurityUtils
.
getUser
();
...
...
@@ -85,7 +107,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
if
(!
Optional
.
ofNullable
(
byId
).
isPresent
()){
return
R
.
failed
(
OrderConstants
.
DATA_IS_EMPTY
);
}
if
(
CommonConstants
.
T
HREE
_INT
==
byId
.
getOrderStatus
()){
if
(
CommonConstants
.
T
WO
_INT
==
byId
.
getOrderStatus
()){
return
R
.
failed
(
OrderConstants
.
ORDER_IS_HANDLED
);
}
byId
.
setOrderStatus
(
status
);
...
...
@@ -93,7 +115,164 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
byId
.
setUpdateName
(
user
.
getNickname
());
byId
.
setUpdateTime
(
LocalDateTime
.
now
());
this
.
updateById
(
byId
);
// todo 如果是办结完成同步给ekp
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
}
/**
* 通过id查询详情
*
* @param id
* @return {@link R<OrderDetailVO>}
* @author licancan
*/
@Override
public
R
<
OrderDetailVO
>
getOrderDetailById
(
String
id
)
{
if
(
StringUtils
.
isEmpty
(
id
)){
return
R
.
failed
(
OrderConstants
.
ORDER_ID_IS_EMPTY
);
}
OrderDetailVO
orderDetailVO
=
this
.
baseMapper
.
getOrderDetailById
(
id
);
//处理订单附件
if
(
Optional
.
ofNullable
(
orderDetailVO
).
isPresent
()){
List
<
TOrderEnclosure
>
list
=
tOrderEnclosureService
.
list
(
Wrappers
.<
TOrderEnclosure
>
query
().
lambda
()
.
eq
(
TOrderEnclosure:
:
getOrderNo
,
orderDetailVO
.
getOrderNo
())
.
eq
(
TOrderEnclosure:
:
getEnclosureFlag
,
CommonConstants
.
ZERO_INT
)
.
eq
(
TOrderEnclosure:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
orderDetailVO
.
setOrderEnclosure
(
list
);
}
else
{
orderDetailVO
.
setOrderEnclosure
(
Lists
.
newArrayList
());
}
}
return
R
.
ok
(
orderDetailVO
);
}
/**
* 附件预览下载地址
*
* @param id 附件表id
* @return {@link R}
* @author licancan
*/
@Override
public
R
getEnclosureUrl
(
String
id
)
{
if
(
StringUtils
.
isEmpty
(
id
)){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_ID_IS_EMPTY
);
}
TOrderEnclosure
orderEnclosure
=
tOrderEnclosureService
.
getById
(
id
);
if
(!
Optional
.
ofNullable
(
orderEnclosure
).
isPresent
())
{
return
R
.
failed
(
OrderConstants
.
DATA_IS_EMPTY
);
}
String
enclosureAddress
=
orderEnclosure
.
getEnclosureAddress
();
log
.
info
(
"key:"
+
enclosureAddress
);
URL
url
=
ossUtil
.
getObjectUrl
(
null
,
orderEnclosure
.
getEnclosureAddress
());
return
new
R
<>(
url
.
toString
());
}
/**
* 添加回复
*
* @author licancan
* @param file 附件
* @param filePath 附件路径
* @param replyContent 回复内容
* @param orderNo 订单编号
* @return {@link R}
* @throws IOException
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
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
)){
return
R
.
failed
(
OrderConstants
.
REPLY_CONTENT_AND_ENCLOSURE_IS_EMPTY
);
}
// 校验回复内容200字以内
if
(!
Common
.
isEmpty
(
replyContent
)
&&
!
ValidityUtil
.
validate200
(
replyContent
)){
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
)){
return
R
.
failed
(
OrderConstants
.
ENCLOSURE_SIZE_ERROR
);
}
}
TOrderReply
reply
=
new
TOrderReply
();
reply
.
setOrderNo
(
orderNo
);
reply
.
setReplyContent
(
Common
.
isEmpty
(
replyContent
)?
null
:
replyContent
);
reply
.
setCreateName
(
user
.
getNickname
());
reply
.
setCreateTime
(
LocalDateTime
.
now
());
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
());
}
}
else
{
return
R
.
failed
(
OrderConstants
.
OPERATE_FAILED
);
}
}
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
}
/**
* 订单回复列表分页查询
*
* @param page
* @param orderNo
* @return {@link IPage<OrderReplyListVO>}
* @author licancan
*/
@Override
public
IPage
<
OrderReplyListVO
>
getOrderReplyPageList
(
Page
<
OrderReplyListVO
>
page
,
String
orderNo
)
{
IPage
<
OrderReplyListVO
>
orderReplyList
=
baseMapper
.
getOrderReplyPageList
(
page
,
orderNo
);
if
(
CollectionUtils
.
isNotEmpty
(
orderReplyList
.
getRecords
())){
orderReplyList
.
getRecords
().
stream
().
forEach
(
e
->{
List
<
TOrderEnclosure
>
list
=
tOrderEnclosureService
.
list
(
Wrappers
.<
TOrderEnclosure
>
query
().
lambda
()
.
eq
(
TOrderEnclosure:
:
getOrderNo
,
e
.
getId
())
.
eq
(
TOrderEnclosure:
:
getEnclosureFlag
,
CommonConstants
.
ONE_INT
)
.
eq
(
TOrderEnclosure:
:
getDeleteFlag
,
CommonConstants
.
ZERO_INT
)
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
e
.
setOrderReplyEnclosure
(
list
);
}
else
{
e
.
setOrderReplyEnclosure
(
Lists
.
newArrayList
());
}
});
}
return
orderReplyList
;
}
}
yifu-order/yifu-order-biz/src/main/resources/mapper/TOrderEnclosureMapper.xml
View file @
81aa66ee
...
...
@@ -5,7 +5,7 @@
<mapper
namespace=
"com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderEnclosureMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yifu.cloud.plus.v1.yifu.order.entity.TOrderEnclosure"
>
<id
property=
"id"
column=
"ID"
jdbcType=
"
INTEGE
R"
/>
<id
property=
"id"
column=
"ID"
jdbcType=
"
VARCHA
R"
/>
<result
property=
"orderNo"
column=
"ORDER_NO"
jdbcType=
"VARCHAR"
/>
<result
property=
"enclosureName"
column=
"ENCLOSURE_NAME"
jdbcType=
"VARCHAR"
/>
<result
property=
"remark"
column=
"REMARK"
jdbcType=
"VARCHAR"
/>
...
...
yifu-order/yifu-order-biz/src/main/resources/mapper/TOrderMapper.xml
View file @
81aa66ee
...
...
@@ -115,4 +115,31 @@
ORDER BY t.ORDER_STATUS,t.CREATE_TIME DESC
</select>
<select
id=
"getOrderDetailById"
resultType=
"com.yifu.cloud.plus.v1.yifu.order.vo.OrderDetailVO"
>
select
t.CREATE_NAME as createName,
t.CREATE_TIME as createTime,
t.DEPT_NO as deptNo,
t.DEPT_NAME as deptName,
t.ORDER_NO as orderNo,
t.CUSTOMER_NAME as customerName,
t.ORDER_STATUS as orderStatus,
t.ORDER_CONTENT as orderContent
from t_order t
where t.ID = #{id}
</select>
<select
id=
"getOrderReplyPageList"
resultType=
"com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO"
>
select
t.ID as id,
t.ORDER_NO as orderNo,
t.CREATE_NAME as createName,
t.CREATE_TIME as createTime,
t.REPLY_CONTENT as replyContent
from t_order_reply t
where t.DELETE_FLAG = 0
and t.ORDER_NO = #{orderNo}
ORDER BY t.CREATE_TIME DESC
</select>
</mapper>
yifu-order/yifu-order-biz/src/main/resources/mapper/TOrderReplyMapper.xml
View file @
81aa66ee
...
...
@@ -5,7 +5,7 @@
<mapper
namespace=
"com.yifu.cloud.plus.v1.yifu.order.mapper.TOrderReplyMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yifu.cloud.plus.v1.yifu.order.entity.TOrderReply"
>
<id
property=
"id"
column=
"ID"
jdbcType=
"
INTEGE
R"
/>
<id
property=
"id"
column=
"ID"
jdbcType=
"
VARCHA
R"
/>
<result
property=
"orderNo"
column=
"ORDER_NO"
jdbcType=
"VARCHAR"
/>
<result
property=
"replyContent"
column=
"REPLY_CONTENT"
jdbcType=
"VARCHAR"
/>
<result
property=
"createName"
column=
"CREATE_NAME"
jdbcType=
"VARCHAR"
/>
...
...
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