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
61387519
Commit
61387519
authored
Jan 29, 2021
by
lings
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into lings
parents
e117429a
3670ce25
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
633 additions
and
205 deletions
+633
-205
SwaggerConfig.java
hmit-api/src/main/java/io/hmit/config/SwaggerConfig.java
+1
-0
WebMvcConfig.java
hmit-api/src/main/java/io/hmit/config/WebMvcConfig.java
+2
-1
ApiLoginController.java
.../src/main/java/io/hmit/controller/ApiLoginController.java
+27
-1
UserInfoDTO.java
hmit-api/src/main/java/io/hmit/dto/UserInfoDTO.java
+47
-0
UserEntity.java
hmit-api/src/main/java/io/hmit/entity/UserEntity.java
+22
-1
NewsController.java
.../hmit/modules/serviceOrder/controller/NewsController.java
+15
-0
PensionOrderController.java
...dules/serviceOrder/controller/PensionOrderController.java
+61
-92
PensionServiceController.java
...les/serviceOrder/controller/PensionServiceController.java
+18
-3
PensionServiceTypeController.java
...serviceOrder/controller/PensionServiceTypeController.java
+32
-0
PensionOrderDao.java
...ava/io/hmit/modules/serviceOrder/dao/PensionOrderDao.java
+6
-9
NewsDTO.java
...c/main/java/io/hmit/modules/serviceOrder/dto/NewsDTO.java
+5
-1
PensionOrderDTO.java
...ava/io/hmit/modules/serviceOrder/dto/PensionOrderDTO.java
+27
-0
PensionOrderServiceDTO.java
...hmit/modules/serviceOrder/dto/PensionOrderServiceDTO.java
+9
-2
PensionServiceDTO.java
...a/io/hmit/modules/serviceOrder/dto/PensionServiceDTO.java
+1
-1
ReservationDTO.java
...java/io/hmit/modules/serviceOrder/dto/ReservationDTO.java
+38
-0
PensionOrderEntity.java
.../hmit/modules/serviceOrder/entity/PensionOrderEntity.java
+4
-0
PensionServiceEntity.java
...mit/modules/serviceOrder/entity/PensionServiceEntity.java
+8
-2
PensionOrderService.java
...mit/modules/serviceOrder/service/PensionOrderService.java
+9
-18
PensionServiceTypeService.java
...dules/serviceOrder/service/PensionServiceTypeService.java
+7
-1
PensionOrderServiceImpl.java
...es/serviceOrder/service/impl/PensionOrderServiceImpl.java
+29
-50
PensionServiceServiceImpl.java
.../serviceOrder/service/impl/PensionServiceServiceImpl.java
+7
-1
PensionServiceTypeServiceImpl.java
...viceOrder/service/impl/PensionServiceTypeServiceImpl.java
+65
-1
RoleServiceServiceImpl.java
...les/serviceOrder/service/impl/RoleServiceServiceImpl.java
+2
-1
RoleUserServiceImpl.java
...odules/serviceOrder/service/impl/RoleUserServiceImpl.java
+3
-1
PensionOrderDao.xml
...rc/main/resources/mapper/serviceOrder/PensionOrderDao.xml
+44
-16
PensionServiceDao.xml
.../main/resources/mapper/serviceOrder/PensionServiceDao.xml
+3
-2
TypeServiceTest.java
hmit-api/src/test/java/io/hmit/test/TypeServiceTest.java
+101
-0
Constant.java
...ommon/src/main/java/io/hmit/common/constant/Constant.java
+40
-1
No files found.
hmit-api/src/main/java/io/hmit/config/SwaggerConfig.java
View file @
61387519
...
...
@@ -27,6 +27,7 @@ public class SwaggerConfig {
@Bean
public
Docket
createRestApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
host
(
"byyl.zjhmit.com"
)
.
apiInfo
(
apiInfo
())
.
select
()
//加了ApiOperation注解的类,才生成接口文档
...
...
hmit-api/src/main/java/io/hmit/config/WebMvcConfig.java
View file @
61387519
...
...
@@ -41,6 +41,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
authorizationInterceptor
).
addPathPatterns
(
"/api/**"
);
registry
.
addInterceptor
(
authorizationInterceptor
).
addPathPatterns
(
"/serviceOrder/pensionorder/**"
);
registry
.
addInterceptor
(
authorizationInterceptor
).
addPathPatterns
(
"/serviceOrder/pensionservicetype/**"
);
}
@Override
...
...
@@ -79,4 +80,4 @@ public class WebMvcConfig implements WebMvcConfigurer {
converter
.
setObjectMapper
(
mapper
);
return
converter
;
}
}
\ No newline at end of file
}
hmit-api/src/main/java/io/hmit/controller/ApiLoginController.java
View file @
61387519
...
...
@@ -2,12 +2,16 @@ package io.hmit.controller;
import
io.hmit.annotation.Login
;
import
io.hmit.common.utils.ConvertUtils
;
import
io.hmit.common.utils.Result
;
import
io.hmit.common.validator.ValidatorUtils
;
import
io.hmit.dto.LoginDTO
;
import
io.hmit.dto.UserInfoDTO
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.service.TokenService
;
import
io.hmit.service.UserService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -53,4 +57,26 @@ public class ApiLoginController {
return
new
Result
();
}
}
\ No newline at end of file
@Login
@GetMapping
(
"getUserInfoById"
)
@ApiOperation
(
"根据ID查询用户信息"
)
@ApiImplicitParam
(
name
=
"roleId"
,
value
=
"用户角色"
,
paramType
=
"query"
,
dataType
=
"int"
)
public
Result
<
UserInfoDTO
>
getUserInfoById
(
Long
userId
)
{
UserInfoDTO
data
=
ConvertUtils
.
sourceToTarget
(
userService
.
getUserByUserId
(
userId
),
UserInfoDTO
.
class
);
return
new
Result
().
ok
(
data
);
}
@Login
@PostMapping
(
"update"
)
@ApiOperation
(
"修改用户信息"
)
public
Result
getUserInfoById
(
@RequestBody
UserInfoDTO
userInfoDTO
)
{
UserEntity
userEntity
=
ConvertUtils
.
sourceToTarget
(
userInfoDTO
,
UserEntity
.
class
);
userService
.
updateById
(
userEntity
);
return
new
Result
();
}
}
hmit-api/src/main/java/io/hmit/dto/UserInfoDTO.java
0 → 100644
View file @
61387519
package
io
.
hmit
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/27
*/
@Data
@ApiModel
(
value
=
"用户信息"
)
public
class
UserInfoDTO
{
@ApiModelProperty
(
value
=
"用户id"
)
private
Long
id
;
/**
* 用户名
*/
@ApiModelProperty
(
value
=
"用户名"
)
private
String
username
;
/**
* 手机号
*/
@ApiModelProperty
(
value
=
"手机号"
)
private
String
mobile
;
/**
* 生日
*/
@ApiModelProperty
(
value
=
"生日"
)
private
Date
birthday
;
/**
* 地址_地区
*/
@ApiModelProperty
(
value
=
"地址_地区"
)
private
String
addressArea
;
/**
* 详细地址
*/
@ApiModelProperty
(
value
=
"详细地址"
)
private
String
address
;
}
hmit-api/src/main/java/io/hmit/entity/UserEntity.java
View file @
61387519
...
...
@@ -42,4 +42,25 @@ public class UserEntity implements Serializable {
*/
private
Date
createDate
;
}
\ No newline at end of file
/**
* 关联sys_user中的id
*/
private
Long
userId
;
/**
* 微信openid
*/
private
String
openid
;
/**
* 生日
*/
private
Date
birthday
;
/**
* 地址_地区
*/
private
String
addressArea
;
/**
* 详细地址
*/
private
String
address
;
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/controller/NewsController.java
View file @
61387519
...
...
@@ -9,6 +9,7 @@ import io.hmit.common.validator.group.AddGroup;
import
io.hmit.common.validator.group.DefaultGroup
;
import
io.hmit.common.validator.group.UpdateGroup
;
import
io.hmit.modules.serviceOrder.dto.NewsDTO
;
import
io.hmit.modules.serviceOrder.service.NewsDocumentService
;
import
io.hmit.modules.serviceOrder.service.NewsService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -36,6 +38,9 @@ public class NewsController {
@Autowired
private
NewsService
newsService
;
@Autowired
private
NewsDocumentService
newsDocumentService
;
@GetMapping
(
"page"
)
@ApiOperation
(
"分页"
)
@ApiImplicitParams
({
...
...
@@ -47,6 +52,12 @@ public class NewsController {
public
Result
<
PageData
<
NewsDTO
>>
page
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
NewsDTO
>
page
=
newsService
.
page
(
params
);
Map
<
String
,
Object
>
params2
=
new
HashMap
<>();
page
.
getList
().
stream
().
forEach
(
item
->{
params2
.
put
(
"newId"
,
item
.
getId
());
item
.
setNewsDocumentDTOList
(
newsDocumentService
.
list
(
params2
));
});
return
new
Result
<
PageData
<
NewsDTO
>>().
ok
(
page
);
}
...
...
@@ -55,6 +66,10 @@ public class NewsController {
public
Result
<
NewsDTO
>
get
(
@PathVariable
(
"id"
)
Long
id
){
NewsDTO
data
=
newsService
.
get
(
id
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"newId"
,
data
.
getId
());
data
.
setNewsDocumentDTOList
(
newsDocumentService
.
list
(
params
));
return
new
Result
<
NewsDTO
>().
ok
(
data
);
}
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/controller/PensionOrderController.java
View file @
61387519
...
...
@@ -12,12 +12,12 @@ 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.dto.ReservationDTO
;
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
;
...
...
@@ -40,7 +40,7 @@ public class PensionOrderController {
@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"
)
,
...
...
@@ -50,106 +50,78 @@ public class PensionOrderController {
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("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
(
value
=
"
未完成订单分页"
,
notes
=
"未完成和已接单类似,但此处返回状态为0的
订单"
)
@GetMapping
(
"
getOrderPageByStatus
"
)
@ApiOperation
(
value
=
"
根据状态返回订单(带图片)"
,
notes
=
"不能查看未接单
订单"
)
@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
=
"status"
,
value
=
"订单状态: 0未接单 1已接单 2已完成 3已取消"
,
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
.
get
IncompleteOrderPage
(
params
,
user
.
getId
(
));
public
Result
<
PageData
<
PensionOrderDTO
>>
getOrderPageByStatus
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionOrderDTO
>
page
=
pensionOrderService
.
get
OrderPageByStatus
(
params
,
user
.
getId
(),
Integer
.
parseInt
(
params
.
get
(
"status"
).
toString
()
));
return
new
Result
<
PageData
<
PensionOrderDTO
>>().
ok
(
page
);
}
@Login
@GetMapping
(
"
takingOrderPage
"
)
@ApiOperation
(
"
已接单订单分页
"
)
@GetMapping
(
"
getTodayOrderPageWithCover
"
)
@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
=
"status"
,
value
=
"订单状态: 0未接单 1已接单 2已完成 3已取消"
,
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
());
public
Result
<
PageData
<
PensionOrderDTO
>>
getTodayOrderPageByStatus
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionOrderDTO
>
page
=
pensionOrderService
.
getTodayOrderPage
(
params
);
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
);
}
@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("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
(
"orderInfo/{id}"
)
@ApiOperation
(
"预约订单详情"
)
@ApiOperation
(
"预约订单详情
(带图片)
"
)
public
Result
<
PensionOrderDTO
>
getOrderInfo
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@PathVariable
(
"id"
)
Long
id
){
PensionOrderDTO
data
=
pensionOrderService
.
getOrderInfoByIdAndUserId
(
id
,
user
.
getId
()
);
PensionOrderDTO
data
=
pensionOrderService
.
getOrderInfoByIdAndUserId
OrStatus
(
id
,
null
,
null
);
return
new
Result
<
PensionOrderDTO
>().
ok
(
data
);
}
...
...
@@ -158,14 +130,14 @@ public class PensionOrderController {
@ApiOperation
(
"接单"
)
public
Result
takingOrder
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@PathVariable
(
"id"
)
Long
id
){
PensionOrderDTO
pensionOrderDTO
=
pensionOrderService
.
getOrderInfoByIdAndStatus
(
id
,
0
);
PensionOrderDTO
pensionOrderDTO
=
pensionOrderService
.
getOrderInfoByIdAndStatus
(
id
,
Constant
.
OrderStatus
.
BOOKED
.
geStatus
()
);
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
.
setStatus
(
Constant
.
OrderStatus
.
ORDER
.
geStatus
());
pensionOrderDTO
.
setStatusName
(
"已接单"
);
pensionOrderService
.
update
(
pensionOrderDTO
);
...
...
@@ -176,8 +148,18 @@ public class PensionOrderController {
@ApiOperation
(
"信息"
)
public
Result
<
PensionOrderDTO
>
get
(
@PathVariable
(
"id"
)
Long
id
){
PensionOrderDTO
data
=
pensionOrderService
.
get
(
id
);
// return new Result<PensionOrderDTO>().ok(data);
return
null
;
return
new
Result
<
PensionOrderDTO
>().
ok
(
data
);
}
@Login
@PostMapping
(
"reservationOrder"
)
@ApiOperation
(
"预约保存"
)
public
Result
reservationOrder
(
@ApiIgnore
@LoginUser
UserEntity
user
,
@RequestBody
ReservationDTO
dto
){
PensionOrderDTO
data
=
new
PensionOrderDTO
().
assemblePensionOrder
(
dto
,
user
);
pensionOrderService
.
reservation
(
data
);
return
new
Result
();
}
@PostMapping
...
...
@@ -186,17 +168,6 @@ public class PensionOrderController {
//校验数据
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
());
pensionOrderService
.
save
(
dto
);
return
new
Result
();
...
...
@@ -207,10 +178,8 @@ public class PensionOrderController {
public
Result
update
(
@RequestBody
PensionOrderDTO
dto
){
//校验数据
ValidatorUtils
.
validateEntity
(
dto
,
UpdateGroup
.
class
,
DefaultGroup
.
class
);
PensionOrderDTO
pensionOrderDTO
=
pensionOrderService
.
get
(
dto
.
getId
());
BeanUtils
.
copyProperties
(
dto
,
pensionOrderDTO
);
pensionOrderDTO
.
setUpdateDate
(
new
Date
());
pensionOrderService
.
update
(
pensionOrderDTO
);
pensionOrderService
.
update
(
dto
);
return
new
Result
();
}
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/controller/PensionServiceController.java
View file @
61387519
package
io
.
hmit
.
modules
.
serviceOrder
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
io.hmit.common.constant.Constant
;
import
io.hmit.common.page.PageData
;
import
io.hmit.common.utils.Result
;
...
...
@@ -10,6 +12,7 @@ import io.hmit.common.validator.group.AddGroup;
import
io.hmit.common.validator.group.DefaultGroup
;
import
io.hmit.common.validator.group.UpdateGroup
;
import
io.hmit.modules.serviceOrder.dto.PensionServiceDTO
;
import
io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO
;
import
io.hmit.modules.serviceOrder.service.PensionServiceService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -37,13 +40,16 @@ public class PensionServiceController {
@Autowired
private
PensionServiceService
pensionServiceService
;
private
BaseMapper
baseMapper
;
@GetMapping
(
"page"
)
@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"
)
@ApiImplicitParam
(
name
=
Constant
.
ORDER
,
value
=
"排序方式,可选值(asc、desc)"
,
paramType
=
"query"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"serviceTypeId"
,
value
=
"服务大类ID"
,
paramType
=
"query"
,
dataType
=
"int"
)
})
public
Result
<
PageData
<
PensionServiceDTO
>>
page
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
PageData
<
PensionServiceDTO
>
page
=
pensionServiceService
.
page
(
params
);
...
...
@@ -53,16 +59,25 @@ public class PensionServiceController {
@GetMapping
(
"{id}"
)
@ApiOperation
(
"信息"
)
//@RequiresPermissions("serviceOrder:pensionservice:info")
public
Result
<
PensionServiceDTO
>
get
(
@PathVariable
(
"id"
)
Long
id
){
PensionServiceDTO
data
=
pensionServiceService
.
get
(
id
);
return
new
Result
<
PensionServiceDTO
>().
ok
(
data
);
}
@GetMapping
(
"getByServiceTypeId/{serviceTypeId}"
)
@ApiOperation
(
"根据服务大类获取详情"
)
public
Result
<
PensionServiceDTO
>
getByServiceTypeId
(
@PathVariable
(
"serviceTypeId"
)
Long
serviceTypeId
){
List
<
PensionServiceDTO
>
data
=
baseMapper
.
selectList
(
new
QueryWrapper
<
PensionServiceDTO
>().
lambda
()
.
eq
(
PensionServiceDTO:
:
getServiceTypeId
,
serviceTypeId
));
return
new
Result
<
PensionServiceDTO
>().
ok
(
data
.
get
(
0
));
}
@PostMapping
@ApiOperation
(
"保存"
)
//@RequiresPermissions("serviceOrder:pensionservice:save")
public
Result
save
(
@RequestBody
PensionServiceDTO
dto
){
//校验数据
ValidatorUtils
.
validateEntity
(
dto
,
AddGroup
.
class
,
DefaultGroup
.
class
);
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/controller/PensionServiceTypeController.java
View file @
61387519
package
io
.
hmit
.
modules
.
serviceOrder
.
controller
;
import
com.baomidou.mybatisplus.extension.api.R
;
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,6 +12,7 @@ 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.PensionServiceTypeDTO
;
import
io.hmit.modules.serviceOrder.service.PensionServiceTypeService
;
import
io.swagger.annotations.Api
;
...
...
@@ -51,6 +55,33 @@ public class PensionServiceTypeController {
return
new
Result
<
PageData
<
PensionServiceTypeDTO
>>().
ok
(
page
);
}
@GetMapping
(
"list"
)
@ApiOperation
(
"根据用户角色获取服务列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"roleId"
,
value
=
"用户角色Id"
,
paramType
=
"query"
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
"isFree"
,
value
=
"是否免费:1 是, 2 否"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
public
Result
<
List
<
PensionServiceTypeDTO
>>
getServiceList
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
List
<
PensionServiceTypeDTO
>
list
=
pensionServiceTypeService
.
getServiceListByRole
(
params
);
return
new
Result
<
List
<
PensionServiceTypeDTO
>>().
ok
(
list
);
}
@GetMapping
(
"getAllList"
)
@ApiOperation
(
"获取所有大类"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"roleId"
,
value
=
"用户角色Id"
,
paramType
=
"query"
,
dataType
=
"int"
)
})
public
Result
<
List
<
PensionServiceTypeDTO
>>
getALlList
(
@ApiIgnore
@RequestParam
Map
<
String
,
Object
>
params
){
List
<
PensionServiceTypeDTO
>
list
=
pensionServiceTypeService
.
getALLListByRole
(
params
);
return
new
Result
<
List
<
PensionServiceTypeDTO
>>().
ok
(
list
);
}
@Login
@GetMapping
(
"{id}"
)
@ApiOperation
(
"信息"
)
public
Result
<
PensionServiceTypeDTO
>
get
(
@PathVariable
(
"id"
)
Long
id
){
...
...
@@ -92,4 +123,5 @@ public class PensionServiceTypeController {
return
new
Result
();
}
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dao/PensionOrderDao.java
View file @
61387519
...
...
@@ -2,6 +2,7 @@ package io.hmit.modules.serviceOrder.dao;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
io.hmit.common.dao.BaseDao
;
import
io.hmit.modules.serviceOrder.dto.PensionOrderDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionOrderEntity
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -14,16 +15,12 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public
interface
PensionOrderDao
extends
BaseDao
<
PensionOrderEntity
>
{
IPage
<
PensionOrder
Entity
>
getAllOrderPage
(
IPage
<
PensionOrderEntity
>
page
,
Long
userId
);
IPage
<
PensionOrder
DTO
>
getTodayNoProceedOrderPage
(
IPage
<
PensionOrderEntity
>
page
);
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
getOrderInfoByIdAndStatus
(
Long
orderId
,
Integer
status
);
PensionOrderEntity
getOrderInfoByIdAndUserId
(
Long
orderId
,
Long
userId
);
IPage
<
PensionOrderDTO
>
getOrderPageByStatusOrUserId
(
IPage
<
PensionOrderEntity
>
page
,
Long
userId
,
Integer
status
);
PensionOrder
Entity
getOrderInfoByIdAndStatus
(
Long
ord
erId
,
Integer
status
);
PensionOrder
DTO
getOrderInfoByIdAndUserIdOrStatus
(
Long
orderId
,
Long
us
erId
,
Integer
status
);
}
\ No newline at end of file
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dto/NewsDTO.java
View file @
61387519
...
...
@@ -6,6 +6,7 @@ import lombok.Data;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -28,6 +29,9 @@ public class NewsDTO implements Serializable {
@ApiModelProperty
(
value
=
"内容"
)
private
String
content
;
@ApiModelProperty
(
value
=
"附件列表"
)
private
List
<
NewsDocumentDTO
>
newsDocumentDTOList
;
@ApiModelProperty
(
value
=
"发布时间"
)
private
Date
pubDate
;
...
...
@@ -47,4 +51,4 @@ public class NewsDTO implements Serializable {
private
Date
updateDate
;
}
\ No newline at end of file
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dto/PensionOrderDTO.java
View file @
61387519
package
io
.
hmit
.
modules
.
serviceOrder
.
dto
;
import
io.hmit.common.constant.Constant
;
import
io.hmit.entity.UserEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.UUID
;
/**
...
...
@@ -64,6 +67,9 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty
(
value
=
"接单人电话"
)
private
String
orderRecipientPhone
;
@ApiModelProperty
(
value
=
"实际金额"
)
private
String
actPrice
;
@ApiModelProperty
(
value
=
"部门ID"
)
private
Long
deptId
;
...
...
@@ -85,5 +91,26 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateDate
;
@ApiModelProperty
(
value
=
"封面"
)
private
String
icon
;
public
PensionOrderDTO
assemblePensionOrder
(
ReservationDTO
reservationDTO
,
UserEntity
user
){
PensionOrderDTO
pensionOrder
=
new
PensionOrderDTO
();
pensionOrder
.
setOrderNum
(
""
);
pensionOrder
.
setStatus
(
Constant
.
OrderStatus
.
BOOKED
.
geStatus
());
pensionOrder
.
setStatusName
(
Constant
.
OrderStatus
.
BOOKED
.
getMessage
());
pensionOrder
.
setAddress
(
reservationDTO
.
getAddress
());
pensionOrder
.
setServiceId
(
reservationDTO
.
getServiceId
());
pensionOrder
.
setServiceName
(
reservationDTO
.
getServiceName
());
pensionOrder
.
setRemark
(
reservationDTO
.
getRemark
());
pensionOrder
.
setCreator
(
user
.
getId
());
pensionOrder
.
setCreatorName
(
user
.
getUsername
());
pensionOrder
.
setCreatorTel
(
user
.
getMobile
());
pensionOrder
.
setAppointmentPerson
(
reservationDTO
.
getAppointmentPerson
());
pensionOrder
.
setAppointmentPhone
(
reservationDTO
.
getAppointmentPhone
());
pensionOrder
.
setAppointmentTime
(
reservationDTO
.
getAppointmentTime
());
return
pensionOrder
;
}
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dto/PensionOrderServiceDTO.java
View file @
61387519
...
...
@@ -43,5 +43,12 @@ public class PensionOrderServiceDTO implements Serializable {
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateDate
;
}
\ No newline at end of file
public
PensionOrderServiceDTO
assemblePensionOrderService
(
PensionOrderDTO
pensionOrderDTO
){
PensionOrderServiceDTO
dto
=
new
PensionOrderServiceDTO
();
dto
.
setOrderId
(
pensionOrderDTO
.
getId
());
dto
.
setServiceId
(
pensionOrderDTO
.
getServiceId
());
dto
.
setRemark
(
""
);
return
dto
;
}
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dto/PensionServiceDTO.java
View file @
61387519
...
...
@@ -23,7 +23,7 @@ public class PensionServiceDTO implements Serializable {
private
Long
id
;
@ApiModelProperty
(
value
=
"服务名称"
)
private
String
n
ame
;
private
String
serviceN
ame
;
@ApiModelProperty
(
value
=
"服务类型"
)
private
Long
serviceTypeId
;
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dto/ReservationDTO.java
0 → 100644
View file @
61387519
package
io
.
hmit
.
modules
.
serviceOrder
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/28
*/
@Data
@ApiModel
(
value
=
"老人预约服务"
)
public
class
ReservationDTO
{
@ApiModelProperty
(
value
=
"订单所属的服务id"
)
private
Long
serviceId
;
@ApiModelProperty
(
value
=
"订单所属的服务名称"
)
private
String
serviceName
;
@ApiModelProperty
(
value
=
"详细地址"
)
private
String
address
;
@ApiModelProperty
(
value
=
"预约人"
)
private
String
appointmentPerson
;
@ApiModelProperty
(
value
=
"预约人电话"
)
private
String
appointmentPhone
;
@ApiModelProperty
(
value
=
"预约时间"
)
private
Date
appointmentTime
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remark
;
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/entity/PensionOrderEntity.java
View file @
61387519
...
...
@@ -75,6 +75,10 @@ public class PensionOrderEntity extends BaseEntity {
* 接单人电话
*/
private
String
orderRecipientPhone
;
/**
* 实际金额
*/
private
String
actPrice
;
/**
* 部门ID
*/
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/entity/PensionServiceEntity.java
View file @
61387519
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import
io.hmit.common.entity.BaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.apache.ibatis.annotations.Property
;
import
java.math.BigDecimal
;
import
java.util.Date
;
...
...
@@ -23,7 +24,8 @@ public class PensionServiceEntity extends BaseEntity {
/**
* 服务名称
*/
private
String
name
;
// @Property(value = "name")
private
String
serviceName
;
/**
* 服务类型
*/
...
...
@@ -36,6 +38,10 @@ public class PensionServiceEntity extends BaseEntity {
* 首页图标地址
*/
private
String
icon
;
/**
* 是否免费
*/
private
String
isFree
;
/**
* 详情页大图地址
*/
...
...
@@ -72,4 +78,4 @@ public class PensionServiceEntity extends BaseEntity {
* 更新时间
*/
private
Date
updateDate
;
}
\ No newline at end of file
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/PensionOrderService.java
View file @
61387519
...
...
@@ -19,27 +19,18 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
PageData
<
PensionOrderDTO
>
getAllOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//查询今日订单
PageData
<
PensionOrderDTO
>
getTodayOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
PageData
<
PensionOrderDTO
>
getTodayOrderPage
(
Map
<
String
,
Object
>
params
);
//
查询未完成订单
P
ageData
<
PensionOrderDTO
>
getIncompleteOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//
根据订单Id和订单状态查询 (接单时使用)
P
ensionOrderDTO
getOrderInfoByIdAndStatus
(
Long
orderId
,
Integer
status
);
//
查询已接单订单
PageData
<
PensionOrderDTO
>
getTakingOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//
服务订单预约
void
reservation
(
PensionOrderDTO
pensionOrderDTO
);
//查询已完成订单
PageData
<
PensionOrderDTO
>
getFinishedOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//查询已取消订单
PageData
<
PensionOrderDTO
>
getCanceledOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
);
//查询未接单订单
PageData
<
PensionOrderDTO
>
getNoProceedOrderPage
(
Map
<
String
,
Object
>
params
);
PageData
<
PensionOrderDTO
>
getOrderPageByStatus
(
Map
<
String
,
Object
>
params
,
Long
userId
,
Integer
status
);
//查询预约订单详情
PensionOrderDTO
getOrderInfoByIdAndUserId
(
Long
id
,
Long
userId
);
//根据订单Id和订单状态查询
PensionOrderDTO
getOrderInfoByIdAndStatus
(
Long
orderId
,
Integer
status
);
//根据用户ID或订单状态查询(带图)
PensionOrderDTO
getOrderInfoByIdAndUserIdOrStatus
(
Long
orderId
,
Long
userId
,
Integer
status
);
}
\ No newline at end of file
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/PensionServiceTypeService.java
View file @
61387519
...
...
@@ -4,6 +4,9 @@ import io.hmit.common.service.CrudService;
import
io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity
;
import
java.util.List
;
import
java.util.Map
;
/**
* 服务种类表
*
...
...
@@ -12,4 +15,7 @@ import io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity;
*/
public
interface
PensionServiceTypeService
extends
CrudService
<
PensionServiceTypeEntity
,
PensionServiceTypeDTO
>
{
}
\ No newline at end of file
List
<
PensionServiceTypeDTO
>
getALLListByRole
(
Map
<
String
,
Object
>
params
);
List
<
PensionServiceTypeDTO
>
getServiceListByRole
(
Map
<
String
,
Object
>
params
);
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/PensionOrderServiceImpl.java
View file @
61387519
...
...
@@ -8,8 +8,11 @@ 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.dto.PensionOrderServiceDTO
;
import
io.hmit.modules.serviceOrder.dto.ReservationDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionOrderEntity
;
import
io.hmit.modules.serviceOrder.service.PensionOrderService
;
import
io.hmit.modules.serviceOrder.service.PensionOrderServiceService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -25,11 +28,6 @@ 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"
);
...
...
@@ -43,74 +41,55 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Autowired
private
PensionOrderDao
pensionOrderDao
;
@Autowired
private
PensionOrderServiceService
pensionOrderServiceService
;
//查询全部订单
@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
);
IPage
<
PensionOrderDTO
>
pensionOrderEntityIPage
=
pensionOrderDao
.
getOrderPageByStatusOrUserId
(
page
,
userId
,
null
);
return
getPageData
(
pensionOrderEntityIPage
,
PensionOrderDTO
.
class
);
}
//查询今日订单
@Override
public
PageData
<
PensionOrderDTO
>
get
IncompleteOrderPage
(
Map
<
String
,
Object
>
params
,
Long
userId
)
{
public
PageData
<
PensionOrderDTO
>
get
TodayOrderPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
PensionOrderEntity
>
page
=
getPage
(
params
,
Constant
.
CREATE_DATE
,
false
);
IPage
<
PensionOrderEntity
>
pensionOrderEntityIPage
=
pensionOrderDao
.
getOrderPageByStatus
(
page
,
userId
,
INCOMPLETE_ORDER
);
return
getPageData
(
pensionOrderEntityIPage
,
PensionOrderDTO
.
class
);
// IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getTodayOrderPage(page, userId); //TODO 今日订单中展示未接单订单
IPage
<
PensionOrderDTO
>
pensionOrderDTOIPage
=
pensionOrderDao
.
getTodayNoProceedOrderPage
(
page
);
return
getPageData
(
pensionOrderDTOIPage
,
PensionOrderDTO
.
class
);
}
//根据订单Id和订单状态查询 (接单时使用)
@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
);
public
PensionOrderDTO
getOrderInfoByIdAndStatus
(
Long
id
,
Integer
status
)
{
PensionOrderEntity
orderEntity
=
pensionOrderDao
.
getOrderInfoByIdAndStatus
(
id
,
status
);
return
ConvertUtils
.
sourceToTarget
(
orderEntity
,
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
);
}
public
void
reservation
(
PensionOrderDTO
pensionOrderDTO
)
{
save
(
pensionOrderDTO
);
PensionOrderServiceDTO
orderServiceDTO
=
new
PensionOrderServiceDTO
().
assemblePensionOrderService
(
pensionOrderDTO
);
pensionOrderServiceService
.
save
(
orderServiceDTO
);
@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
);
}
@Override
public
PageData
<
PensionOrderDTO
>
get
NoProceedOrderPage
(
Map
<
String
,
Object
>
param
s
)
{
public
PageData
<
PensionOrderDTO
>
get
OrderPageByStatus
(
Map
<
String
,
Object
>
params
,
Long
userId
,
Integer
statu
s
)
{
IPage
<
PensionOrderEntity
>
page
=
getPage
(
params
,
Constant
.
CREATE_DATE
,
false
);
IPage
<
PensionOrder
Entity
>
pensionOrderEntityIPage
=
pensionOrderDao
.
getNoProceedOrderPage
(
page
);
return
getPageData
(
pensionOrder
Entity
IPage
,
PensionOrderDTO
.
class
);
IPage
<
PensionOrder
DTO
>
pensionOrderDTOIPage
=
pensionOrderDao
.
getOrderPageByStatusOrUserId
(
page
,
userId
,
status
);
return
getPageData
(
pensionOrder
DTO
IPage
,
PensionOrderDTO
.
class
);
}
//根据用户ID或订单状态查询(带图)
@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
);
public
PensionOrderDTO
getOrderInfoByIdAndUserIdOrStatus
(
Long
orderId
,
Long
userId
,
Integer
status
)
{
PensionOrderDTO
pensionOrderDTO
=
pensionOrderDao
.
getOrderInfoByIdAndUserIdOrStatus
(
orderId
,
userId
,
status
);
return
pensionOrderDTO
;
}
@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/java/io/hmit/modules/serviceOrder/service/impl/PensionServiceServiceImpl.java
View file @
61387519
...
...
@@ -9,6 +9,7 @@ import io.hmit.modules.serviceOrder.service.PensionServiceService;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -23,12 +24,17 @@ public class PensionServiceServiceImpl extends CrudServiceImpl<PensionServiceDao
@Override
public
QueryWrapper
<
PensionServiceEntity
>
getWrapper
(
Map
<
String
,
Object
>
params
){
String
id
=
(
String
)
params
.
get
(
"id"
);
String
serviceTypeId
=
params
.
get
(
"serviceTypeId"
)
==
null
?
""
:
params
.
get
(
"serviceTypeId"
).
toString
();
String
isFree
=
(
String
)
params
.
get
(
"isFree"
);
QueryWrapper
<
PensionServiceEntity
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
id
),
"id"
,
id
);
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
serviceTypeId
),
"service_type_id"
,
serviceTypeId
);
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
isFree
),
"is_free"
,
isFree
);
return
wrapper
;
}
}
\ No newline at end of file
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/PensionServiceTypeServiceImpl.java
View file @
61387519
package
io
.
hmit
.
modules
.
serviceOrder
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
io.hmit.common.service.impl.CrudServiceImpl
;
import
io.hmit.modules.serviceOrder.dao.PensionServiceDao
;
import
io.hmit.modules.serviceOrder.dao.PensionServiceTypeDao
;
import
io.hmit.modules.serviceOrder.dto.PensionServiceDTO
;
import
io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO
;
import
io.hmit.modules.serviceOrder.dto.RoleUserDTO
;
import
io.hmit.modules.serviceOrder.entity.PensionServiceEntity
;
import
io.hmit.modules.serviceOrder.entity.PensionServiceTypeEntity
;
import
io.hmit.modules.serviceOrder.service.PensionServiceService
;
import
io.hmit.modules.serviceOrder.service.PensionServiceTypeService
;
import
io.hmit.modules.serviceOrder.service.RoleServiceService
;
import
io.hmit.modules.serviceOrder.service.RoleUserService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 服务种类表
...
...
@@ -20,6 +33,21 @@ import java.util.Map;
@Service
public
class
PensionServiceTypeServiceImpl
extends
CrudServiceImpl
<
PensionServiceTypeDao
,
PensionServiceTypeEntity
,
PensionServiceTypeDTO
>
implements
PensionServiceTypeService
{
@Autowired
private
RoleServiceService
roleServiceService
;
@Autowired
private
PensionServiceService
pensionServiceService
;
@Autowired
private
RoleUserService
roleUserService
;
@Autowired
private
PensionServiceDao
pensionServiceDao
;
// @Autowired
private
BaseMapper
baseMapper
;
@Override
public
QueryWrapper
<
PensionServiceTypeEntity
>
getWrapper
(
Map
<
String
,
Object
>
params
){
String
id
=
(
String
)
params
.
get
(
"id"
);
...
...
@@ -31,4 +59,40 @@ public class PensionServiceTypeServiceImpl extends CrudServiceImpl<PensionServic
}
}
\ No newline at end of file
@Override
public
List
<
PensionServiceTypeDTO
>
getALLListByRole
(
Map
<
String
,
Object
>
params
)
{
List
<
Long
>
servicesTypeIds
=
roleServiceService
.
list
(
params
).
stream
().
map
(
dto
->
dto
.
getServiceTypeId
()).
collect
(
Collectors
.
toList
());
List
<
PensionServiceTypeDTO
>
resultList
=
new
ArrayList
<>();
for
(
Long
typeId:
servicesTypeIds
)
{
PensionServiceTypeDTO
pensionServiceTypeDTO
=
get
(
typeId
);
resultList
.
add
(
pensionServiceTypeDTO
);
}
return
resultList
;
}
@Override
public
List
<
PensionServiceTypeDTO
>
getServiceListByRole
(
Map
<
String
,
Object
>
params
)
{
// List<Long> userRole = roleUserService.list(params).stream().map(dto -> dto.getRoleId()).collect(Collectors.toList());
List
<
Long
>
allServicesTypeIds
=
roleServiceService
.
list
(
params
).
stream
().
map
(
dto
->
dto
.
getServiceTypeId
()).
collect
(
Collectors
.
toList
());
String
isFree
=
(
String
)
params
.
get
(
"isFree"
);
List
<
PensionServiceEntity
>
pensionServices
=
pensionServiceDao
.
selectList
(
new
QueryWrapper
<
PensionServiceEntity
>()
.
in
(
"service_type_id"
,
allServicesTypeIds
)
.
eq
(
StringUtils
.
isNotBlank
(
isFree
),
"is_free"
,
isFree
).
select
(
"DISTINCT service_type_id"
));
// pensionServices.stream().collect(Collectors.groupingBy(PensionServiceEntity::getServiceTypeId))
List
<
PensionServiceTypeDTO
>
resultList
=
new
ArrayList
<>();
for
(
PensionServiceEntity
pensionService:
pensionServices
)
{
PensionServiceTypeDTO
pensionServiceTypeDTO
=
get
(
pensionService
.
getServiceTypeId
());
resultList
.
add
(
pensionServiceTypeDTO
);
}
return
resultList
;
}
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/RoleServiceServiceImpl.java
View file @
61387519
...
...
@@ -23,10 +23,11 @@ public class RoleServiceServiceImpl extends CrudServiceImpl<RoleServiceDao, Role
@Override
public
QueryWrapper
<
RoleServiceEntity
>
getWrapper
(
Map
<
String
,
Object
>
params
){
String
id
=
(
String
)
params
.
get
(
"id"
);
String
o
=
(
String
)
params
.
get
(
"id"
)
;
String
roleId
=
params
.
get
(
"roleId"
)
!=
null
?
params
.
get
(
"roleId"
).
toString
():
""
;
QueryWrapper
<
RoleServiceEntity
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
id
),
"id"
,
id
);
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
roleId
),
"role_id"
,
roleId
);
return
wrapper
;
}
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/RoleUserServiceImpl.java
View file @
61387519
...
...
@@ -23,12 +23,14 @@ public class RoleUserServiceImpl extends CrudServiceImpl<RoleUserDao, RoleUserEn
@Override
public
QueryWrapper
<
RoleUserEntity
>
getWrapper
(
Map
<
String
,
Object
>
params
){
String
id
=
(
String
)
params
.
get
(
"id"
);
String
userId
=
params
.
get
(
"userId"
)
!=
null
?
params
.
get
(
"userId"
).
toString
():
""
;
QueryWrapper
<
RoleUserEntity
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
id
),
"id"
,
id
);
wrapper
.
eq
(
StringUtils
.
isNotBlank
(
userId
),
"user_id"
,
userId
);
return
wrapper
;
}
}
\ No newline at end of file
}
hmit-api/src/main/resources/mapper/serviceOrder/PensionOrderDao.xml
View file @
61387519
...
...
@@ -28,28 +28,56 @@
<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
id=
"getOrderInfoByIdAndStatus"
resultType=
"io.hmit.modules.serviceOrder.entity.PensionOrderEntity"
>
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.status = #{status}
</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
id=
"getOrderPageByStatusOrUserId"
resultType=
"io.hmit.modules.serviceOrder.dto.PensionOrderDTO"
>
select po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.order_recipient_id,
po.order_recipient_name, po.order_recipient_phone, po.dept_id, po.creator, po.creator_name,
po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
from pension_order po, pension_service ps
where po.service_id = ps.id
<if
test=
"status != null and status == 0"
>
<if
test=
"userId != null"
>
and order_recipient_id is null
</if>
and po.status = 0
</if>
<if
test=
"status != null and status != 0"
>
<if
test=
"userId != null"
>
and order_recipient_id = #{userId}
</if>
and po.status = #{status}
</if>
<if
test=
"status == null and userId != null"
>
and order_recipient_id = #{userId}
</if>
</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
id=
"getOrderInfoByIdAndUserIdOrStatus"
resultType=
"io.hmit.modules.serviceOrder.dto.PensionOrderDTO"
>
select po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.order_recipient_id,
po.order_recipient_name, po.order_recipient_phone, po.dept_id, po.creator, po.creator_name,
po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
from pension_order po, pension_service ps
where po.service_id = ps.id and po.id = #{orderId}
<if
test=
"userId != null"
>
and po.order_recipient_id = #{userId}
</if>
<if
test=
"status != null"
>
and po.status = #{status}
</if>
</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
id=
"getTodayNoProceedOrderPage"
resultType=
"io.hmit.modules.serviceOrder.dto.PensionOrderDTO"
>
select po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.order_recipient_id,
po.order_recipient_name, po.order_recipient_phone, po.dept_id, po.creator, po.creator_name,
po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
from pension_order po, pension_service ps
where po.service_id = ps.id and TO_DAYS(appointment_time) = TO_DAYS(NOW()) and po.status = 0 and order_recipient_id IS NULL
</select>
</mapper>
hmit-api/src/main/resources/mapper/serviceOrder/PensionServiceDao.xml
View file @
61387519
...
...
@@ -5,9 +5,10 @@
<resultMap
type=
"io.hmit.modules.serviceOrder.entity.PensionServiceEntity"
id=
"pensionServiceMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"
n
ame"
column=
"name"
/>
<result
property=
"
serviceN
ame"
column=
"name"
/>
<result
property=
"serviceTypeId"
column=
"service_type_id"
/>
<result
property=
"sort"
column=
"sort"
/>
<result
property=
"isFree"
column=
"is_free"
/>
<result
property=
"icon"
column=
"icon"
/>
<result
property=
"detailPicture"
column=
"detail_picture"
/>
<result
property=
"price"
column=
"price"
/>
...
...
@@ -23,4 +24,4 @@
</resultMap>
</mapper>
\ No newline at end of file
</mapper>
hmit-api/src/test/java/io/hmit/test/TypeServiceTest.java
0 → 100644
View file @
61387519
package
io
.
hmit
.
test
;
import
io.hmit.modules.serviceOrder.dto.PensionServiceDTO
;
import
io.hmit.modules.serviceOrder.dto.PensionServiceTypeDTO
;
import
io.hmit.modules.serviceOrder.dto.RoleDTO
;
import
io.hmit.modules.serviceOrder.dto.RoleServiceDTO
;
import
io.hmit.modules.serviceOrder.service.PensionServiceService
;
import
io.hmit.modules.serviceOrder.service.PensionServiceTypeService
;
import
io.hmit.modules.serviceOrder.service.RoleService
;
import
io.hmit.modules.serviceOrder.service.RoleServiceService
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.management.relation.Role
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/27
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
TypeServiceTest
{
@Autowired
private
PensionServiceTypeService
pensionServiceTypeService
;
@Autowired
private
PensionServiceService
pensionServiceService
;
@Autowired
private
RoleServiceService
roleServiceService
;
@Autowired
private
RoleService
roleService
;
@Test
public
void
test
(){
System
.
out
.
println
(
"hello world!!"
);
}
@Test
public
void
getList
(){
List
<
Long
>
roleIds
=
new
ArrayList
<>();
roleIds
.
add
(
1354991196866453506L
);
roleIds
.
add
(
1354991197348798465L
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
List
<
Long
>
servicesTypeIds
=
pensionServiceTypeService
.
list
(
params
).
stream
().
map
(
PensionServiceTypeDTO:
:
getId
).
collect
(
Collectors
.
toList
());
roleIds
.
forEach
(
roleId
->
{
for
(
Long
typeId:
servicesTypeIds
){
RoleServiceDTO
roleServiceDTO
=
new
RoleServiceDTO
();
roleServiceDTO
.
setRoleId
(
roleId
);
roleServiceDTO
.
setServiceTypeId
(
typeId
);
roleServiceService
.
save
(
roleServiceDTO
);
}
});
}
@Test
public
void
updateTime
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
List
<
PensionServiceDTO
>
pensionServiceDTOS
=
pensionServiceService
.
list
(
params
);
pensionServiceDTOS
.
stream
().
forEach
(
item
->{
item
.
setServiceTime
(
"周一 ~ 周日 09:00-18:00"
);
item
.
setTimesNum
(
18
);
item
.
setRemark
(
"为老人提供免费的"
+
item
.
getServiceName
()+
"服务"
);
pensionServiceService
.
update
(
item
);
});
}
@Test
public
void
saveServiceType
(){
List
<
String
>
names
=
new
ArrayList
<>();
names
.
add
(
"健康检查"
);
names
.
add
(
"家政服务"
);
names
.
add
(
"心理慰藉"
);
names
.
add
(
"理发"
);
names
.
add
(
"送药上门"
);
names
.
add
(
"健康养生"
);
names
.
add
(
"临终关怀"
);
names
.
forEach
(
name
->{
PensionServiceTypeDTO
pensionServiceTypeDTO
=
new
PensionServiceTypeDTO
();
pensionServiceTypeDTO
.
setName
(
name
);
pensionServiceTypeDTO
.
setSort
(
1
);
pensionServiceTypeDTO
.
setIcon
(
""
);
pensionServiceTypeDTO
.
setRemark
(
""
);
pensionServiceTypeService
.
save
(
pensionServiceTypeDTO
);
});
}
}
hmit-common/src/main/java/io/hmit/common/constant/Constant.java
View file @
61387519
...
...
@@ -178,4 +178,43 @@ public interface Constant {
return
value
;
}
}
}
\ No newline at end of file
/**
* 订单状态
*/
enum
OrderStatus
{
/**
* 未接单/已预约
*/
BOOKED
(
0
,
"未接单"
),
/**
* 已接单
*/
ORDER
(
1
,
"已接单"
),
/**
* 已完成
*/
DONE
(
2
,
"已完成"
),
/**
* 已取消
*/
CANCEL
(
3
,
"已取消"
);
private
int
status
;
private
String
message
;
OrderStatus
(
int
status
,
String
message
){
this
.
status
=
status
;
this
.
message
=
message
;
}
public
int
geStatus
(){
return
status
;
}
public
String
getMessage
()
{
return
message
;
}
}
}
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