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
70abf9cf
Commit
70abf9cf
authored
Aug 29, 2022
by
李灿灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单详情接口
parent
deb58761
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
216 additions
and
5 deletions
+216
-5
OrderConstants.java
...fu/cloud/plus/v1/yifu/order/constants/OrderConstants.java
+4
-0
OrderDetailVO.java
...a/com/yifu/cloud/plus/v1/yifu/order/vo/OrderDetailVO.java
+76
-0
OrderController.java
.../cloud/plus/v1/yifu/order/controller/OrderController.java
+29
-4
TOrderMapper.java
...om/yifu/cloud/plus/v1/yifu/order/mapper/TOrderMapper.java
+10
-0
TOrderService.java
.../yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
+19
-0
TOrderServiceImpl.java
...ud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
+64
-1
TOrderMapper.xml
...yifu-order-biz/src/main/resources/mapper/TOrderMapper.xml
+14
-0
No files found.
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/constants/OrderConstants.java
View file @
70abf9cf
...
...
@@ -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不可为空"
;
/**
* 订单已办结,不可操作
*/
...
...
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/OrderDetailVO.java
0 → 100644
View file @
70abf9cf
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-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/controller/OrderController.java
View file @
70abf9cf
...
...
@@ -4,15 +4,14 @@ 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.R
;
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
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
javax.annotation.Resource
;
import
java.util.List
;
...
...
@@ -71,4 +70,30 @@ 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
);
}
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/mapper/TOrderMapper.java
View file @
70abf9cf
...
...
@@ -5,6 +5,7 @@ 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
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -47,4 +48,13 @@ 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
);
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
View file @
70abf9cf
...
...
@@ -6,6 +6,7 @@ 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
;
...
...
@@ -46,4 +47,22 @@ 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
);
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
View file @
70abf9cf
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.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.mapper.TOrderMapper
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderEnclosureService
;
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
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
javax.annotation.Resource
;
import
java.net.URL
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
...
...
@@ -31,6 +38,10 @@ import java.util.Optional;
@Slf4j
@Service
public
class
TOrderServiceImpl
extends
ServiceImpl
<
TOrderMapper
,
TOrder
>
implements
TOrderService
{
@Resource
private
TOrderEnclosureService
tOrderEnclosureService
;
@Resource
private
OSSUtil
ossUtil
;
/**
* 订单列表分页查询
...
...
@@ -93,7 +104,59 @@ 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
());
}
}
yifu-order/yifu-order-biz/src/main/resources/mapper/TOrderMapper.xml
View file @
70abf9cf
...
...
@@ -115,4 +115,18 @@
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>
</mapper>
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