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
e6b6e9da
Commit
e6b6e9da
authored
Jan 27, 2021
by
mengmeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Shen' into 'master'
预约订单列表、预约订单详情接口 See merge request
!2
parents
7634a7a7
f5fcb234
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
109 additions
and
7 deletions
+109
-7
PensionOrderController.java
...dules/serviceOrder/controller/PensionOrderController.java
+54
-6
PensionOrderDao.java
...ava/io/hmit/modules/serviceOrder/dao/PensionOrderDao.java
+7
-0
PensionOrderService.java
...mit/modules/serviceOrder/service/PensionOrderService.java
+9
-0
PensionOrderServiceImpl.java
...es/serviceOrder/service/impl/PensionOrderServiceImpl.java
+26
-0
PensionDocumentDao.xml
...main/resources/mapper/serviceOrder/PensionDocumentDao.xml
+1
-1
PensionOrderDao.xml
...rc/main/resources/mapper/serviceOrder/PensionOrderDao.xml
+12
-0
No files found.
hmit-api/src/main/java/io/hmit/modules/serviceOrder/controller/PensionOrderController.java
View file @
e6b6e9da
package
io
.
hmit
.
modules
.
serviceOrder
.
controller
;
import
io.hmit.annotation.Login
;
import
io.hmit.annotation.LoginUser
;
import
io.hmit.common.constant.Constant
;
...
...
@@ -13,7 +12,6 @@ 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
;
...
...
@@ -27,7 +25,6 @@ import springfox.documentation.annotations.ApiIgnore;
import
java.util.Date
;
import
java.util.Map
;
/**
* 订单表
*
...
...
@@ -75,7 +72,7 @@ public class PensionOrderController {
@Login
@GetMapping
(
"incompleteOrderPage"
)
@ApiOperation
(
"未完成订单分页
"
)
@ApiOperation
(
value
=
"未完成订单分页"
,
notes
=
"未完成和已接单类似,但此处返回状态为0的订单
"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
Constant
.
PAGE
,
value
=
"当前页码,从1开始"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
LIMIT
,
value
=
"每页显示记录数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
...
...
@@ -133,12 +130,54 @@ public class PensionOrderController {
return
new
Result
<
PageData
<
PensionOrderDTO
>>().
ok
(
page
);
}
@Login
@GetMapping
(
"noProceedOrderPage"
)
@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
>>
noProceedOrderPage
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionOrderDTO
>
page
=
pensionOrderService
.
getNoProceedOrderPage
(
params
);
return
new
Result
<
PageData
<
PensionOrderDTO
>>().
ok
(
page
);
}
@Login
@GetMapping
(
"orderInfo/{id}"
)
@ApiOperation
(
"预约订单详情"
)
public
Result
<
PensionOrderDTO
>
getOrderInfo
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@PathVariable
(
"id"
)
Long
id
){
PensionOrderDTO
data
=
pensionOrderService
.
getOrderInfoByIdAndUserId
(
id
,
user
.
getId
());
return
new
Result
<
PensionOrderDTO
>().
ok
(
data
);
}
@Login
@PutMapping
(
"takingOrder/{id}"
)
@ApiOperation
(
"接单"
)
public
Result
takingOrder
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@PathVariable
(
"id"
)
Long
id
){
PensionOrderDTO
pensionOrderDTO
=
pensionOrderService
.
getOrderInfoByIdAndStatus
(
id
,
0
);
Date
recipientTime
=
new
Date
();
pensionOrderDTO
.
setOrderRecipientId
(
user
.
getId
());
pensionOrderDTO
.
setOrderRecipientName
(
user
.
getUsername
());
pensionOrderDTO
.
setOrderRecipientPhone
(
user
.
getMobile
());
pensionOrderDTO
.
setOrderRecipientTime
(
recipientTime
);
pensionOrderDTO
.
setUpdateDate
(
recipientTime
);
pensionOrderDTO
.
setStatus
(
1
);
//TODO 后期添加到Constant或新建枚举类
pensionOrderDTO
.
setStatusName
(
"已接单"
);
pensionOrderService
.
update
(
pensionOrderDTO
);
return
new
Result
();
}
@GetMapping
(
"{id}"
)
@ApiOperation
(
"信息"
)
public
Result
<
PensionOrderDTO
>
get
(
@PathVariable
(
"id"
)
Long
id
){
PensionOrderDTO
data
=
pensionOrderService
.
get
(
id
);
return
n
ew
Result
<
PensionOrderDTO
>().
ok
(
data
)
;
// return new Result<PensionOrderDTO>().ok(data);
return
n
ull
;
}
@PostMapping
...
...
@@ -146,6 +185,15 @@ public class PensionOrderController {
public
Result
save
(
@RequestBody
PensionOrderDTO
dto
){
//校验数据
ValidatorUtils
.
validateEntity
(
dto
,
AddGroup
.
class
,
DefaultGroup
.
class
);
dto
.
setId
(
null
);
dto
.
setOrderNum
(
null
);
dto
.
setStatus
(
0
);
dto
.
setStatusName
(
"未接单"
);
dto
.
setOrderRecipientTime
(
null
);
dto
.
setOrderRecipientPhone
(
null
);
dto
.
setOrderRecipientName
(
null
);
dto
.
setOrderRecipientId
(
null
);
//设置日期
dto
.
setCreateDate
(
new
Date
());
dto
.
setUpdateDate
(
new
Date
());
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dao/PensionOrderDao.java
View file @
e6b6e9da
...
...
@@ -19,4 +19,11 @@ public interface PensionOrderDao extends BaseDao<PensionOrderEntity> {
IPage
<
PensionOrderEntity
>
getTodayOrderPage
(
IPage
<
PensionOrderEntity
>
page
,
Long
userId
);
IPage
<
PensionOrderEntity
>
getOrderPageByStatus
(
IPage
<
PensionOrderEntity
>
page
,
Long
userId
,
Integer
status
);
IPage
<
PensionOrderEntity
>
getNoProceedOrderPage
(
IPage
<
PensionOrderEntity
>
page
);
PensionOrderEntity
getOrderInfoByIdAndUserId
(
Long
orderId
,
Long
userId
);
PensionOrderEntity
getOrderInfoByIdAndStatus
(
Long
orderId
,
Integer
status
);
}
\ No newline at end of file
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/PensionOrderService.java
View file @
e6b6e9da
...
...
@@ -33,4 +33,13 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//查询已取消订单
PageData
<
PensionOrderDTO
>
getCanceledOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//查询未接单订单
PageData
<
PensionOrderDTO
>
getNoProceedOrderPage
(
Map
<
String
,
Object
>
params
);
//查询预约订单详情
PensionOrderDTO
getOrderInfoByIdAndUserId
(
Long
id
,
Long
userId
);
//根据订单Id和订单状态查询
PensionOrderDTO
getOrderInfoByIdAndStatus
(
Long
orderId
,
Integer
status
);
}
\ No newline at end of file
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/PensionOrderServiceImpl.java
View file @
e6b6e9da
...
...
@@ -5,6 +5,7 @@ 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.common.utils.ConvertUtils
;
import
io.hmit.modules.serviceOrder.dao.PensionOrderDao
;
import
io.hmit.modules.serviceOrder.dto.PensionOrderDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionOrderEntity
;
...
...
@@ -87,4 +88,29 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
return
getPageData
(
pensionOrderEntityIPage
,
PensionOrderDTO
.
class
);
}
@Override
public
PageData
<
PensionOrderDTO
>
getNoProceedOrderPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
PensionOrderEntity
>
page
=
getPage
(
params
,
Constant
.
CREATE_DATE
,
false
);
IPage
<
PensionOrderEntity
>
pensionOrderEntityIPage
=
pensionOrderDao
.
getNoProceedOrderPage
(
page
);
return
getPageData
(
pensionOrderEntityIPage
,
PensionOrderDTO
.
class
);
}
@Override
public
PensionOrderDTO
getOrderInfoByIdAndUserId
(
Long
id
,
Long
userId
)
{
PensionOrderEntity
orderEntity
=
pensionOrderDao
.
getOrderInfoByIdAndUserId
(
id
,
userId
);
orderEntity
.
setServiceId
(
null
);
orderEntity
.
setOrderRecipientId
(
null
);
orderEntity
.
setDeptId
(
null
);
orderEntity
.
setCreator
(
null
);
orderEntity
.
setUpdater
(
null
);
orderEntity
.
setUpdateDate
(
null
);
return
ConvertUtils
.
sourceToTarget
(
orderEntity
,
PensionOrderDTO
.
class
);
}
@Override
public
PensionOrderDTO
getOrderInfoByIdAndStatus
(
Long
id
,
Integer
status
)
{
PensionOrderEntity
orderEntity
=
pensionOrderDao
.
getOrderInfoByIdAndStatus
(
id
,
status
);
return
ConvertUtils
.
sourceToTarget
(
orderEntity
,
PensionOrderDTO
.
class
);
}
}
\ No newline at end of file
hmit-api/src/main/resources/mapper/serviceOrder/PensionDocumentDao.xml
View file @
e6b6e9da
serviceOrder
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"io.hmit.modules.serviceOrder.dao.PensionDocumentDao"
>
...
...
hmit-api/src/main/resources/mapper/serviceOrder/PensionOrderDao.xml
View file @
e6b6e9da
...
...
@@ -40,4 +40,16 @@
SELECT * FROM pension_order WHERE pension_order.status = #{status} and order_recipient_id = #{userId}
</select>
<select
id=
"getNoProceedOrderPage"
resultType=
"io.hmit.modules.serviceOrder.entity.PensionOrderEntity"
>
SELECT * FROM pension_order WHERE pension_order.status = 0 AND order_recipient_id IS NULL
</select>
<select
id=
"getOrderInfoByIdAndUserId"
resultType=
"io.hmit.modules.serviceOrder.entity.PensionOrderEntity"
>
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.order_recipient_id = #{userId}
</select>
<select
id=
"getOrderInfoByIdAndStatus"
resultType=
"io.hmit.modules.serviceOrder.entity.PensionOrderEntity"
>
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.status = #{status}
</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