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
b79864b0
Commit
b79864b0
authored
Aug 29, 2022
by
李灿灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单 部分接口
parent
a674ae2f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
479 additions
and
0 deletions
+479
-0
OrderConstants.java
...fu/cloud/plus/v1/yifu/order/constants/OrderConstants.java
+29
-0
constants.md
.../com/yifu/cloud/plus/v1/yifu/order/constants/constants.md
+0
-0
OrderListParam.java
.../com/yifu/cloud/plus/v1/yifu/order/vo/OrderListParam.java
+72
-0
OrderListVO.java
...ava/com/yifu/cloud/plus/v1/yifu/order/vo/OrderListVO.java
+68
-0
vo.md
.../src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/vo.md
+0
-0
OrderController.java
.../cloud/plus/v1/yifu/order/controller/OrderController.java
+74
-0
controller.md
...om/yifu/cloud/plus/v1/yifu/order/controller/controller.md
+0
-0
TOrderMapper.java
...om/yifu/cloud/plus/v1/yifu/order/mapper/TOrderMapper.java
+33
-0
TOrderService.java
.../yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
+35
-0
TOrderServiceImpl.java
...ud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
+80
-0
TOrderMapper.xml
...yifu-order-biz/src/main/resources/mapper/TOrderMapper.xml
+88
-0
No files found.
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/constants/OrderConstants.java
0 → 100644
View file @
b79864b0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
constants
;
/**
* @author licancan
* @description 订单常量
* @date 2022-08-29 11:36:21
*/
public
class
OrderConstants
{
/**
* 状态不合法
*/
public
static
final
String
STATUS_ERROR
=
"状态不合法"
;
/**
* 数据不存在
*/
public
static
final
String
DATA_IS_EMPTY
=
"数据不存在"
;
/**
* 订单id不可为空
*/
public
static
final
String
ORDER_ID_IS_EMPTY
=
"订单id不可为空"
;
/**
* 订单已办结,不可操作
*/
public
static
final
String
ORDER_IS_HANDLED
=
"订单已办结,不可操作"
;
/**
* 操作成功
*/
public
static
final
String
OPERATE_SUCCESS
=
"操作成功"
;
}
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/constants/constants.md
deleted
100644 → 0
View file @
a674ae2f
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/OrderListParam.java
0 → 100644
View file @
b79864b0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author licancan
* @description 订单列表入参
* @date 2022-08-29 09:10:02
*/
@Data
@Schema
(
description
=
"订单列表入参"
)
public
class
OrderListParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2575913025864285604L
;
/**
* 订单编号
*/
@Schema
(
description
=
"订单编号"
)
private
String
orderNo
;
/**
* 订单开始时间
*/
@Schema
(
description
=
"订单开始时间"
)
private
String
startDate
;
/**
* 订单结束时间
*/
@Schema
(
description
=
"订单结束时间"
)
private
String
endDate
;
/**
* 创建人姓名(下单人)
*/
@Schema
(
description
=
"创建人姓名(下单人)"
)
private
String
createName
;
/**
* 客户名称
*/
@Schema
(
description
=
"客户名称"
)
private
String
customerName
;
/**
* 项目名称
*/
@Schema
(
description
=
"项目名称"
)
private
String
deptName
;
/**
* 项目编码
*/
@Schema
(
description
=
"项目编码"
)
private
String
deptNo
;
/**
* 订单状态 0待办理 1办理中 2已办结
*/
@Schema
(
description
=
"订单状态 0待办理 1办理中 2已办结"
)
private
Integer
orderStatus
;
/**
* 订单id集合
*/
@Schema
(
description
=
"订单id集合"
)
private
List
<
String
>
idList
;
}
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/OrderListVO.java
0 → 100644
View file @
b79864b0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* @author licancan
* @description 订单列表VO
* @date 2022-08-29 09:16:07
*/
@Data
@Schema
(
description
=
"订单列表VO"
)
public
class
OrderListVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
4067597933537194227L
;
/**
* 主键
*/
@Schema
(
description
=
"主键"
)
private
String
id
;
/**
* 订单编号
*/
@Schema
(
description
=
"订单编号"
)
private
String
orderNo
;
/**
* 创建时间(下单时间)
*/
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Schema
(
description
=
"创建时间(下单时间)"
)
private
LocalDateTime
createTime
;
/**
* 创建人姓名(下单人)
*/
@Schema
(
description
=
"创建人姓名(下单人)"
)
private
String
createName
;
/**
* 客户名称
*/
@Schema
(
description
=
"客户名称"
)
private
String
customerName
;
/**
* 项目名称
*/
@Schema
(
description
=
"项目名称"
)
private
String
deptName
;
/**
* 项目编码
*/
@Schema
(
description
=
"项目编码"
)
private
String
deptNo
;
/**
* 订单状态 0待办理 1办理中 2已办结
*/
@Schema
(
description
=
"订单状态 0待办理 1办理中 2已办结"
)
private
Integer
orderStatus
;
}
yifu-order/yifu-order-api/src/main/java/com/yifu/cloud/plus/v1/yifu/order/vo/vo.md
deleted
100644 → 0
View file @
a674ae2f
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/controller/OrderController.java
0 → 100644
View file @
b79864b0
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.R
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderService
;
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.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
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author licancan
* @description 订单controller
* @date 2022-08-29 09:05:23
*/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/order"
)
@Tag
(
name
=
"订单相关"
)
public
class
OrderController
{
@Resource
private
TOrderService
tOrderService
;
/**
* 订单列表分页查询
*
* @author licancan
* @param page
* @param param
* @return {@link R<IPage<OrderListVO>>}
*/
@Operation
(
summary
=
"订单列表分页查询"
,
description
=
"订单列表分页查询"
)
@GetMapping
(
"/getOrderPageList"
)
public
R
<
IPage
<
OrderListVO
>>
getOrderPageList
(
Page
<
OrderListParam
>
page
,
OrderListParam
param
)
{
return
R
.
ok
(
tOrderService
.
getOrderPageList
(
page
,
param
));
}
/**
* 订单列表不分页查询
*
* @author licancan
* @param param
* @return {@link R<List<OrderListVO>>}
*/
@Operation
(
summary
=
"订单列表不分页查询"
,
description
=
"订单列表不分页查询"
)
@GetMapping
(
"/getOrderList"
)
public
R
<
List
<
OrderListVO
>>
getOrderList
(
OrderListParam
param
)
{
return
R
.
ok
(
tOrderService
.
getOrderList
(
param
));
}
/**
* 变更订单状态
*
* @author licancan
* @param id
* @param status
* @return {@link R< String>}
*/
@GetMapping
(
"/handleOrder"
)
@Operation
(
summary
=
"变更订单状态"
,
description
=
"变更订单状态"
)
public
R
<
String
>
handleOrder
(
@RequestParam
String
id
,
@RequestParam
Integer
status
)
{
return
tOrderService
.
handleOrder
(
id
,
status
);
}
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/controller/controller.md
deleted
100644 → 0
View file @
a674ae2f
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/mapper/TOrderMapper.java
View file @
b79864b0
...
...
@@ -2,8 +2,15 @@ package com.yifu.cloud.plus.v1.yifu.order.mapper;
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.OrderListParam
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author licancan
...
...
@@ -13,5 +20,31 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public
interface
TOrderMapper
extends
BaseMapper
<
TOrder
>
{
/**
* 订单列表分页查询
*
* @author licancan
* @param page
* @param param
* @return {@link IPage<OrderListVO>}
*/
IPage
<
OrderListVO
>
getOrderPageList
(
Page
<
OrderListParam
>
page
,
@Param
(
"param"
)
OrderListParam
param
);
/**
* 导出勾选查询结果
*
* @author licancan
* @param idList
* @return {@link List<OrderListVO>}
*/
List
<
OrderListVO
>
getOrderListBySelect
(
@Param
(
"idList"
)
List
<
String
>
idList
);
/**
* 导出非勾选查询结果
*
* @author licancan
* @param param
* @return {@link List< OrderListVO>}
*/
List
<
OrderListVO
>
getOrderList
(
@Param
(
"param"
)
OrderListParam
param
);
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/TOrderService.java
View file @
b79864b0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
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.OrderListParam
;
import
com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO
;
import
java.util.List
;
/**
* @author licancan
...
...
@@ -11,4 +18,32 @@ import com.yifu.cloud.plus.v1.yifu.order.entity.TOrder;
*/
public
interface
TOrderService
extends
IService
<
TOrder
>
{
/**
* 订单列表分页查询
*
* @author licancan
* @param page
* @param param
* @return {@link IPage<OrderListVO>}
*/
IPage
<
OrderListVO
>
getOrderPageList
(
Page
<
OrderListParam
>
page
,
OrderListParam
param
);
/**
* 订单列表不分页查询
*
* @author licancan
* @param param
* @return {@link List<OrderListVO>}
*/
List
<
OrderListVO
>
getOrderList
(
OrderListParam
param
);
/**
* 变更订单状态
*
* @author licancan
* @param id
* @param status
* @return {@link R<String>}
*/
R
<
String
>
handleOrder
(
String
id
,
Integer
status
);
}
yifu-order/yifu-order-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/order/service/impl/TOrderServiceImpl.java
View file @
b79864b0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
order
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
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.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.mapper.TOrderMapper
;
import
com.yifu.cloud.plus.v1.yifu.order.service.TOrderService
;
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.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
/**
* @author licancan
* @description 针对表【t_order(订单表)】的数据库操作Service实现
...
...
@@ -16,4 +32,68 @@ import org.springframework.stereotype.Service;
@Service
public
class
TOrderServiceImpl
extends
ServiceImpl
<
TOrderMapper
,
TOrder
>
implements
TOrderService
{
/**
* 订单列表分页查询
*
* @param page
* @param param
* @return {@link IPage <OrderListVO>}
* @author licancan
*/
@Override
public
IPage
<
OrderListVO
>
getOrderPageList
(
Page
<
OrderListParam
>
page
,
OrderListParam
param
)
{
IPage
<
OrderListVO
>
orderList
=
baseMapper
.
getOrderPageList
(
page
,
param
);
return
orderList
;
}
/**
* 订单列表不分页查询
*
* @param param
* @return {@link List<OrderListVO>}
* @author licancan
*/
@Override
public
List
<
OrderListVO
>
getOrderList
(
OrderListParam
param
)
{
List
<
OrderListVO
>
list
;
if
(
CollectionUtils
.
isNotEmpty
(
param
.
getIdList
())){
list
=
baseMapper
.
getOrderListBySelect
(
param
.
getIdList
());
}
else
{
list
=
baseMapper
.
getOrderList
(
param
);
}
return
list
;
}
/**
* 变更订单状态
*
* @param id
* @param status
* @return {@link R <String>}
* @author licancan
*/
@Override
public
R
<
String
>
handleOrder
(
String
id
,
Integer
status
)
{
if
(
StringUtils
.
isEmpty
(
id
)){
return
R
.
failed
(
OrderConstants
.
ORDER_ID_IS_EMPTY
);
}
if
(
CommonConstants
.
TWO_INT
!=
status
&&
CommonConstants
.
THREE_INT
!=
status
){
return
R
.
failed
(
OrderConstants
.
STATUS_ERROR
);
}
YifuUser
user
=
SecurityUtils
.
getUser
();
TOrder
byId
=
this
.
getById
(
id
);
if
(!
Optional
.
ofNullable
(
byId
).
isPresent
()){
return
R
.
failed
(
OrderConstants
.
DATA_IS_EMPTY
);
}
if
(
CommonConstants
.
THREE_INT
==
byId
.
getOrderStatus
()){
return
R
.
failed
(
OrderConstants
.
ORDER_IS_HANDLED
);
}
byId
.
setOrderStatus
(
status
);
byId
.
setUpdateBy
(
user
.
getId
());
byId
.
setUpdateName
(
user
.
getNickname
());
byId
.
setUpdateTime
(
LocalDateTime
.
now
());
this
.
updateById
(
byId
);
return
R
.
ok
(
OrderConstants
.
OPERATE_SUCCESS
);
}
}
yifu-order/yifu-order-biz/src/main/resources/mapper/TOrderMapper.xml
View file @
b79864b0
...
...
@@ -27,4 +27,92 @@
UPDATE_BY,UPDATE_NAME,UPDATE_TIME,
DELETE_FLAG
</sql>
<select
id=
"getOrderPageList"
resultType=
"com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO"
>
select t.id as id,
t.ORDER_NO as orderNo,
t.CREATE_TIME as createTime,
t.CREATE_NAME as createName,
t.CUSTOMER_NAME as customerName,
t.DEPT_NAME as deptName,
t.DEPT_NO as deptNo,
t.ORDER_STATUS as orderStatus
from t_order t
where t.DELETE_FLAG = 0
<if
test=
"param.orderNo != null and param.orderNo.trim() != ''"
>
and t.ORDER_NO = #{param.orderNo}
</if>
<if
test=
"param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''"
>
and t.CREATE_TIME
<![CDATA[ >= ]]>
concat(#{param.startDate}, ' 00:00:00') and t.CREATE_TIME
<![CDATA[ <= ]]>
concat(#{param.endDate}, ' 23:59:59')
</if>
<if
test=
"param.createName != null and param.createName.trim() != ''"
>
and t.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
</if>
<if
test=
"param.customerName != null and param.customerName.trim() != ''"
>
and t.CUSTOMER_NAME = #{param.customerName}
</if>
<if
test=
"param.deptName != null and param.deptName.trim() != ''"
>
and t.DEPT_NAME = #{param.deptName}
</if>
<if
test=
"param.deptNo != null and param.deptNo.trim() != ''"
>
and t.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
</if>
<if
test=
"param.orderStatus != null"
>
and t.ORDER_STATUS = #{param.orderStatus}
</if>
ORDER BY t.ORDER_STATUS,t.CREATE_TIME DESC
</select>
<select
id=
"getOrderListBySelect"
resultType=
"com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO"
>
select t.id as id,
t.ORDER_NO as orderNo,
t.CREATE_TIME as createTime,
t.CREATE_NAME as createName,
t.CUSTOMER_NAME as customerName,
t.DEPT_NAME as deptName,
t.DEPT_NO as deptNo,
t.ORDER_STATUS as orderStatus
from t_order t
where t.DELETE_FLAG = 0 and t.id in
<foreach
collection=
"idList"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
ORDER BY t.ORDER_STATUS,t.CREATE_TIME DESC
</select>
<select
id=
"getOrderList"
resultType=
"com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO"
>
select t.id as id,
t.ORDER_NO as orderNo,
t.CREATE_TIME as createTime,
t.CREATE_NAME as createName,
t.CUSTOMER_NAME as customerName,
t.DEPT_NAME as deptName,
t.DEPT_NO as deptNo,
t.ORDER_STATUS as orderStatus
from t_order t
where t.DELETE_FLAG = 0
<if
test=
"param.orderNo != null and param.orderNo.trim() != ''"
>
and t.ORDER_NO = #{param.orderNo}
</if>
<if
test=
"param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''"
>
and t.CREATE_TIME
<![CDATA[ >= ]]>
concat(#{param.startDate}, ' 00:00:00') and t.CREATE_TIME
<![CDATA[ <= ]]>
concat(#{param.endDate}, ' 23:59:59')
</if>
<if
test=
"param.createName != null and param.createName.trim() != ''"
>
and t.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
</if>
<if
test=
"param.customerName != null and param.customerName.trim() != ''"
>
and t.CUSTOMER_NAME = #{param.customerName}
</if>
<if
test=
"param.deptName != null and param.deptName.trim() != ''"
>
and t.DEPT_NAME = #{param.deptName}
</if>
<if
test=
"param.deptNo != null and param.deptNo.trim() != ''"
>
and t.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
</if>
<if
test=
"param.orderStatus != null"
>
and t.ORDER_STATUS = #{param.orderStatus}
</if>
ORDER BY t.ORDER_STATUS,t.CREATE_TIME DESC
</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