Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pension
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
mengmeng
pension
Commits
00e91bac
Commit
00e91bac
authored
Jan 27, 2021
by
baocunbin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Shen' into 'master'
订单中心:今日订单、未完成订单等API添加 See merge request
!1
parents
8f5a5179
1816f7f8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
190 additions
and
9 deletions
+190
-9
WebMvcConfig.java
hmit-api/src/main/java/io/hmit/config/WebMvcConfig.java
+1
-0
PensionOrderController.java
...dules/serviceOrder/controller/PensionOrderController.java
+94
-8
PensionOrderDao.java
...ava/io/hmit/modules/serviceOrder/dao/PensionOrderDao.java
+7
-1
PensionOrderService.java
...mit/modules/serviceOrder/service/PensionOrderService.java
+21
-0
PensionOrderServiceImpl.java
...es/serviceOrder/service/impl/PensionOrderServiceImpl.java
+56
-0
PensionOrderDao.xml
...rc/main/resources/mapper/serviceOrder/PensionOrderDao.xml
+11
-0
No files found.
hmit-api/src/main/java/io/hmit/config/WebMvcConfig.java
View file @
00e91bac
...
...
@@ -40,6 +40,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
authorizationInterceptor
).
addPathPatterns
(
"/api/**"
);
registry
.
addInterceptor
(
authorizationInterceptor
).
addPathPatterns
(
"/serviceOrder/pensionorder/**"
);
}
@Override
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/controller/PensionOrderController.java
View file @
00e91bac
package
io
.
hmit
.
modules
.
serviceOrder
.
controller
;
import
io.hmit.annotation.Login
;
import
io.hmit.annotation.LoginUser
;
import
io.hmit.common.constant.Constant
;
import
io.hmit.common.page.PageData
;
import
io.hmit.common.utils.Result
;
...
...
@@ -9,18 +11,20 @@ import io.hmit.common.validator.ValidatorUtils;
import
io.hmit.common.validator.group.AddGroup
;
import
io.hmit.common.validator.group.DefaultGroup
;
import
io.hmit.common.validator.group.UpdateGroup
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.modules.serviceOrder.dto.PensionOrderDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionOrderEntity
;
import
io.hmit.modules.serviceOrder.service.PensionOrderService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.Date
;
import
java.util.Map
;
...
...
@@ -37,20 +41,98 @@ public class PensionOrderController {
@Autowired
private
PensionOrderService
pensionOrderService
;
@Login
@GetMapping
(
"page"
)
@ApiOperation
(
"分页"
)
@ApiOperation
(
"
全部订单
分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
Constant
.
PAGE
,
value
=
"当前页码,从1开始"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
LIMIT
,
value
=
"每页显示记录数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER_FIELD
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"String"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER
,
value
=
"排序方式,可选值(asc、desc)"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
public
Result
<
PageData
<
PensionOrderDTO
>>
page
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionOrderDTO
>
page
=
pensionOrderService
.
page
(
params
);
public
Result
<
PageData
<
PensionOrderDTO
>>
page
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionOrderDTO
>
page
=
pensionOrderService
.
getAllOrderPage
(
params
,
user
.
getId
());
return
new
Result
<
PageData
<
PensionOrderDTO
>>().
ok
(
page
);
}
@Login
@GetMapping
(
"todayOrderPage"
)
@ApiOperation
(
"今日订单分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
Constant
.
PAGE
,
value
=
"当前页码,从1开始"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
LIMIT
,
value
=
"每页显示记录数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER_FIELD
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"String"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER
,
value
=
"排序方式,可选值(asc、desc)"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
public
Result
<
PageData
<
PensionOrderDTO
>>
todayOrderPage
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionOrderDTO
>
page
=
pensionOrderService
.
getTodayOrderPage
(
params
,
user
.
getId
());
return
new
Result
<
PageData
<
PensionOrderDTO
>>().
ok
(
page
);
}
@Login
@GetMapping
(
"incompleteOrderPage"
)
@ApiOperation
(
"未完成订单分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
Constant
.
PAGE
,
value
=
"当前页码,从1开始"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
LIMIT
,
value
=
"每页显示记录数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER_FIELD
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"String"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER
,
value
=
"排序方式,可选值(asc、desc)"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
public
Result
<
PageData
<
PensionOrderDTO
>>
incompleteOrderPage
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionOrderDTO
>
page
=
pensionOrderService
.
getIncompleteOrderPage
(
params
,
user
.
getId
());
return
new
Result
<
PageData
<
PensionOrderDTO
>>().
ok
(
page
);
}
@Login
@GetMapping
(
"takingOrderPage"
)
@ApiOperation
(
"已接单订单分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
Constant
.
PAGE
,
value
=
"当前页码,从1开始"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
LIMIT
,
value
=
"每页显示记录数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER_FIELD
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"String"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER
,
value
=
"排序方式,可选值(asc、desc)"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
public
Result
<
PageData
<
PensionOrderDTO
>>
takingOrderPage
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionOrderDTO
>
page
=
pensionOrderService
.
getTakingOrderPage
(
params
,
user
.
getId
());
return
new
Result
<
PageData
<
PensionOrderDTO
>>().
ok
(
page
);
}
@Login
@GetMapping
(
"finishedOrderPage"
)
@ApiOperation
(
"已完成订单分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
Constant
.
PAGE
,
value
=
"当前页码,从1开始"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
LIMIT
,
value
=
"每页显示记录数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER_FIELD
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"String"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER
,
value
=
"排序方式,可选值(asc、desc)"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
public
Result
<
PageData
<
PensionOrderDTO
>>
finishedOrderPage
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionOrderDTO
>
page
=
pensionOrderService
.
getFinishedOrderPage
(
params
,
user
.
getId
());
return
new
Result
<
PageData
<
PensionOrderDTO
>>().
ok
(
page
);
}
@Login
@GetMapping
(
"canceledOrderPage"
)
@ApiOperation
(
"已取消订单分页"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
Constant
.
PAGE
,
value
=
"当前页码,从1开始"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
LIMIT
,
value
=
"每页显示记录数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER_FIELD
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"String"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER
,
value
=
"排序方式,可选值(asc、desc)"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
public
Result
<
PageData
<
PensionOrderDTO
>>
canceledOrderPage
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionOrderDTO
>
page
=
pensionOrderService
.
getCanceledOrderPage
(
params
,
user
.
getId
());
return
new
Result
<
PageData
<
PensionOrderDTO
>>().
ok
(
page
);
}
@GetMapping
(
"{id}"
)
@ApiOperation
(
"信息"
)
public
Result
<
PensionOrderDTO
>
get
(
@PathVariable
(
"id"
)
Long
id
){
...
...
@@ -64,7 +146,9 @@ public class PensionOrderController {
public
Result
save
(
@RequestBody
PensionOrderDTO
dto
){
//校验数据
ValidatorUtils
.
validateEntity
(
dto
,
AddGroup
.
class
,
DefaultGroup
.
class
);
//设置日期
dto
.
setCreateDate
(
new
Date
());
dto
.
setUpdateDate
(
new
Date
());
pensionOrderService
.
save
(
dto
);
return
new
Result
();
...
...
@@ -75,8 +159,10 @@ public class PensionOrderController {
public
Result
update
(
@RequestBody
PensionOrderDTO
dto
){
//校验数据
ValidatorUtils
.
validateEntity
(
dto
,
UpdateGroup
.
class
,
DefaultGroup
.
class
);
pensionOrderService
.
update
(
dto
);
PensionOrderDTO
pensionOrderDTO
=
pensionOrderService
.
get
(
dto
.
getId
());
BeanUtils
.
copyProperties
(
dto
,
pensionOrderDTO
);
pensionOrderDTO
.
setUpdateDate
(
new
Date
());
pensionOrderService
.
update
(
pensionOrderDTO
);
return
new
Result
();
}
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dao/PensionOrderDao.java
View file @
00e91bac
package
io
.
hmit
.
modules
.
serviceOrder
.
dao
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
io.hmit.common.dao.BaseDao
;
import
io.hmit.modules.serviceOrder.entity.PensionOrderEntity
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -12,5 +13,10 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public
interface
PensionOrderDao
extends
BaseDao
<
PensionOrderEntity
>
{
IPage
<
PensionOrderEntity
>
getAllOrderPage
(
IPage
<
PensionOrderEntity
>
page
,
Long
userId
);
IPage
<
PensionOrderEntity
>
getTodayOrderPage
(
IPage
<
PensionOrderEntity
>
page
,
Long
userId
);
IPage
<
PensionOrderEntity
>
getOrderPageByStatus
(
IPage
<
PensionOrderEntity
>
page
,
Long
userId
,
Integer
status
);
}
\ No newline at end of file
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/PensionOrderService.java
View file @
00e91bac
package
io
.
hmit
.
modules
.
serviceOrder
.
service
;
import
io.hmit.common.page.PageData
;
import
io.hmit.common.service.CrudService
;
import
io.hmit.modules.serviceOrder.dto.PensionOrderDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionOrderEntity
;
import
java.util.Map
;
/**
* 订单表
*
...
...
@@ -12,4 +15,22 @@ import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
*/
public
interface
PensionOrderService
extends
CrudService
<
PensionOrderEntity
,
PensionOrderDTO
>
{
//查询全部订单
PageData
<
PensionOrderDTO
>
getAllOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//查询今日订单
PageData
<
PensionOrderDTO
>
getTodayOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//查询未完成订单
PageData
<
PensionOrderDTO
>
getIncompleteOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//查询已接单订单
PageData
<
PensionOrderDTO
>
getTakingOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//查询已完成订单
PageData
<
PensionOrderDTO
>
getFinishedOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//查询已取消订单
PageData
<
PensionOrderDTO
>
getCanceledOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
}
\ No newline at end of file
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/PensionOrderServiceImpl.java
View file @
00e91bac
package
io
.
hmit
.
modules
.
serviceOrder
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
io.hmit.common.constant.Constant
;
import
io.hmit.common.page.PageData
;
import
io.hmit.common.service.impl.CrudServiceImpl
;
import
io.hmit.modules.serviceOrder.dao.PensionOrderDao
;
import
io.hmit.modules.serviceOrder.dto.PensionOrderDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionOrderEntity
;
import
io.hmit.modules.serviceOrder.service.PensionOrderService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Map
;
...
...
@@ -20,6 +24,11 @@ import java.util.Map;
@Service
public
class
PensionOrderServiceImpl
extends
CrudServiceImpl
<
PensionOrderDao
,
PensionOrderEntity
,
PensionOrderDTO
>
implements
PensionOrderService
{
private
static
final
Integer
INCOMPLETE_ORDER
=
0
;
private
static
final
Integer
TAKING_ORDER
=
1
;
private
static
final
Integer
FINISHED_ORDER
=
2
;
private
static
final
Integer
CANCELED_ORDER
=
3
;
@Override
public
QueryWrapper
<
PensionOrderEntity
>
getWrapper
(
Map
<
String
,
Object
>
params
){
String
id
=
(
String
)
params
.
get
(
"id"
);
...
...
@@ -30,5 +39,52 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
return
wrapper
;
}
@Autowired
private
PensionOrderDao
pensionOrderDao
;
@Override
public
PageData
<
PensionOrderDTO
>
getAllOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
)
{
//分页
IPage
<
PensionOrderEntity
>
page
=
getPage
(
params
,
Constant
.
CREATE_DATE
,
false
);
//查询 -- 自定义分页
IPage
<
PensionOrderEntity
>
pensionOrderEntityIPage
=
pensionOrderDao
.
getAllOrderPage
(
page
,
userId
);
return
getPageData
(
pensionOrderEntityIPage
,
PensionOrderDTO
.
class
);
}
@Override
public
PageData
<
PensionOrderDTO
>
getTodayOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
)
{
IPage
<
PensionOrderEntity
>
page
=
getPage
(
params
,
Constant
.
CREATE_DATE
,
false
);
IPage
<
PensionOrderEntity
>
pensionOrderEntityIPage
=
pensionOrderDao
.
getTodayOrderPage
(
page
,
userId
);
return
getPageData
(
pensionOrderEntityIPage
,
PensionOrderDTO
.
class
);
}
@Override
public
PageData
<
PensionOrderDTO
>
getIncompleteOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
)
{
IPage
<
PensionOrderEntity
>
page
=
getPage
(
params
,
Constant
.
CREATE_DATE
,
false
);
IPage
<
PensionOrderEntity
>
pensionOrderEntityIPage
=
pensionOrderDao
.
getOrderPageByStatus
(
page
,
userId
,
INCOMPLETE_ORDER
);
return
getPageData
(
pensionOrderEntityIPage
,
PensionOrderDTO
.
class
);
}
@Override
public
PageData
<
PensionOrderDTO
>
getTakingOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
)
{
IPage
<
PensionOrderEntity
>
page
=
getPage
(
params
,
Constant
.
CREATE_DATE
,
false
);
IPage
<
PensionOrderEntity
>
pensionOrderEntityIPage
=
pensionOrderDao
.
getOrderPageByStatus
(
page
,
userId
,
TAKING_ORDER
);
return
getPageData
(
pensionOrderEntityIPage
,
PensionOrderDTO
.
class
);
}
@Override
public
PageData
<
PensionOrderDTO
>
getFinishedOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
)
{
IPage
<
PensionOrderEntity
>
page
=
getPage
(
params
,
Constant
.
CREATE_DATE
,
false
);
IPage
<
PensionOrderEntity
>
pensionOrderEntityIPage
=
pensionOrderDao
.
getOrderPageByStatus
(
page
,
userId
,
FINISHED_ORDER
);
return
getPageData
(
pensionOrderEntityIPage
,
PensionOrderDTO
.
class
);
}
@Override
public
PageData
<
PensionOrderDTO
>
getCanceledOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
)
{
IPage
<
PensionOrderEntity
>
page
=
getPage
(
params
,
Constant
.
CREATE_DATE
,
false
);
IPage
<
PensionOrderEntity
>
pensionOrderEntityIPage
=
pensionOrderDao
.
getOrderPageByStatus
(
page
,
userId
,
CANCELED_ORDER
);
return
getPageData
(
pensionOrderEntityIPage
,
PensionOrderDTO
.
class
);
}
}
\ No newline at end of file
hmit-api/src/main/resources/mapper/serviceOrder/PensionOrderDao.xml
View file @
00e91bac
...
...
@@ -28,5 +28,16 @@
<result
property=
"updateDate"
column=
"update_date"
/>
</resultMap>
<select
id=
"getAllOrderPage"
resultType=
"io.hmit.modules.serviceOrder.entity.PensionOrderEntity"
>
SELECT * FROM pension_order WHERE order_recipient_id = #{userId}
</select>
<select
id=
"getTodayOrderPage"
resultType=
"io.hmit.modules.serviceOrder.entity.PensionOrderEntity"
>
SELECT * FROM pension_order WHERE TO_DAYS(appointment_time) = TO_DAYS(NOW()) and order_recipient_id = #{userId}
</select>
<select
id=
"getOrderPageByStatus"
resultType=
"io.hmit.modules.serviceOrder.entity.PensionOrderEntity"
>
SELECT * FROM pension_order WHERE pension_order.status = #{status} and order_recipient_id = #{userId}
</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