Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
on-site-service
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
external
on-site-service
Commits
f1001688
Commit
f1001688
authored
Jul 14, 2022
by
lining
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 预约下单接口img信息处理
parent
e09a6220
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
261 additions
and
68 deletions
+261
-68
BizConstants.java
...ava/com/onsiteservice/constant/constant/BizConstants.java
+3
-0
RecordComponent.java
...java/com/onsiteservice/dao/component/RecordComponent.java
+76
-0
ServiceOrderImgMapper.java
...siteservice/dao/mapper/service/ServiceOrderImgMapper.java
+13
-0
ServiceOrderMapper.java
.../onsiteservice/dao/mapper/service/ServiceOrderMapper.java
+6
-0
ServiceOrderImgMapper.xml
...c/main/resources/mapper/service/ServiceOrderImgMapper.xml
+21
-0
ServiceOrderMapper.xml
dao/src/main/resources/mapper/service/ServiceOrderMapper.xml
+12
-18
ServiceOrder.java
...ain/java/com/onsiteservice/entity/order/ServiceOrder.java
+7
-0
ServiceOrderImg.java
...ava/com/onsiteservice/entity/service/ServiceOrderImg.java
+44
-0
ServiceOrderController.java
...vice/miniapp/controller/order/ServiceOrderController.java
+1
-1
ReserveServiceOrderDTO.java
.../miniapp/controller/order/dto/ReserveServiceOrderDTO.java
+6
-0
ServiceOrderVO.java
...teservice/miniapp/controller/order/vo/ServiceOrderVO.java
+3
-7
ServiceOrderBizMapper.java
...teservice/miniapp/mapper/order/ServiceOrderBizMapper.java
+1
-1
ServiceOrderService.java
...iteservice/miniapp/service/order/ServiceOrderService.java
+67
-40
ServiceOrderBizMapper.xml
...src/main/resources/mapper/order/ServiceOrderBizMapper.xml
+1
-1
No files found.
constant/src/main/java/com/onsiteservice/constant/constant/BizConstants.java
View file @
f1001688
...
@@ -13,5 +13,8 @@ public class BizConstants {
...
@@ -13,5 +13,8 @@ public class BizConstants {
public
static
final
String
ORDER_ID
=
"orderId"
;
public
static
final
String
ORDER_ID
=
"orderId"
;
}
}
public
static
class
FormatConstants
{
public
static
final
String
CATEGORY_SUBCLASS_SERVICE_NAME
=
"%s-%s"
;
}
}
}
dao/src/main/java/com/onsiteservice/dao/component/RecordComponent.java
0 → 100644
View file @
f1001688
package
com
.
onsiteservice
.
dao
.
component
;
import
com.onsiteservice.dao.mapper.service.ServiceOrderImgMapper
;
import
com.onsiteservice.dao.mapper.service.ServiceOrderLogMapper
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.entity.service.ServiceOrderImg
;
import
com.onsiteservice.entity.service.ServiceOrderLog
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/14 10:08
*/
@Component
@Slf4j
public
class
RecordComponent
{
@Resource
private
ServiceOrderImgMapper
serviceOrderImgMapper
;
@Resource
private
ServiceOrderLogMapper
serviceOrderLogMapper
;
@Async
public
void
recordServiceOrderImg
(
ServiceOrder
serviceOrder
,
List
<
String
>
urls
)
{
log
.
info
(
"recordServiceOrderImg serviceOrder: {}, urls: {}"
,
serviceOrder
,
urls
);
if
(
CollectionUtils
.
isEmpty
(
urls
))
{
return
;
}
List
<
ServiceOrderImg
>
serviceOrderImgList
=
urls
.
parallelStream
().
map
(
url
->
{
ServiceOrderImg
serviceOrderImg
=
new
ServiceOrderImg
();
serviceOrderImg
.
setOrderId
(
serviceOrder
.
getId
());
serviceOrderImg
.
setUrl
(
url
);
serviceOrderImg
.
setCreateTime
(
new
Date
());
return
serviceOrderImg
;
}).
collect
(
Collectors
.
toList
());
serviceOrderImgMapper
.
insertList
(
serviceOrderImgList
);
}
@Async
public
void
recordProcess
(
Long
orderId
,
Integer
processId
,
String
description
,
Long
hostId
,
String
remark
)
{
log
.
info
(
"recordProcess orderId: {}, processId: {}, description: {}, hostId: {}, remark: {}"
,
orderId
,
processId
,
description
,
hostId
,
remark
);
ServiceOrderLog
serviceOrderLog
=
new
ServiceOrderLog
();
serviceOrderLog
.
setOrderId
(
orderId
);
serviceOrderLog
.
setProcessId
(
processId
);
serviceOrderLog
.
setDescription
(
description
);
serviceOrderLog
.
setHostId
(
hostId
);
serviceOrderLog
.
setRemark
(
remark
);
serviceOrderLogMapper
.
insertSelective
(
serviceOrderLog
);
}
}
dao/src/main/java/com/onsiteservice/dao/mapper/service/ServiceOrderImgMapper.java
0 → 100644
View file @
f1001688
package
com
.
onsiteservice
.
dao
.
mapper
.
service
;
import
com.onsiteservice.dao.common.Mapper
;
import
com.onsiteservice.entity.service.ServiceOrderImg
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
ServiceOrderImgMapper
extends
Mapper
<
ServiceOrderImg
>
{
List
<
ServiceOrderImg
>
selectByOrderIdList
(
@Param
(
"list"
)
List
<
Long
>
orderIdList
);
}
\ No newline at end of file
dao/src/main/java/com/onsiteservice/dao/mapper/service/ServiceOrderMapper.java
View file @
f1001688
...
@@ -2,6 +2,12 @@ package com.onsiteservice.dao.mapper.service;
...
@@ -2,6 +2,12 @@ package com.onsiteservice.dao.mapper.service;
import
com.onsiteservice.dao.common.Mapper
;
import
com.onsiteservice.dao.common.Mapper
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
ServiceOrderMapper
extends
Mapper
<
ServiceOrder
>
{
public
interface
ServiceOrderMapper
extends
Mapper
<
ServiceOrder
>
{
List
<
ServiceOrder
>
selectServiceOrderPage
(
@Param
(
"orderStatus"
)
Integer
orderStatus
);
}
}
\ No newline at end of file
dao/src/main/resources/mapper/service/ServiceOrderImgMapper.xml
0 → 100644
View file @
f1001688
<?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=
"com.onsiteservice.dao.mapper.service.ServiceOrderImgMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.onsiteservice.entity.service.ServiceOrderImg"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"order_id"
jdbcType=
"BIGINT"
property=
"orderId"
/>
<result
column=
"url"
jdbcType=
"VARCHAR"
property=
"url"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
</resultMap>
<select
id=
"selectByOrderIdList"
resultType=
"com.onsiteservice.entity.service.ServiceOrderImg"
>
select * from service_order_img where order_id in
<foreach
collection=
"list"
open=
"("
separator=
","
close=
")"
item=
"orderId"
>
#{orderId}
</foreach>
</select>
</mapper>
\ No newline at end of file
dao/src/main/resources/mapper/service/ServiceOrderMapper.xml
View file @
f1001688
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.onsiteservice.dao.mapper.service.ServiceOrderMapper"
>
<mapper
namespace=
"com.onsiteservice.dao.mapper.service.ServiceOrderMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.onsiteservice.entity.order.ServiceOrder"
>
<!--
<select
id=
"selectServiceOrderPage"
resultType=
"com.onsiteservice.entity.order.ServiceOrder"
>
WARNING - @mbg.generated
select *
-->
from service_order
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
where
<result
column=
"account_no"
jdbcType=
"BIGINT"
property=
"accountNo"
/>
1=1
<result
column=
"address_id"
jdbcType=
"BIGINT"
property=
"addressId"
/>
<if
test=
"orderStatus != 0"
>
<result
column=
"expect_arrival_time"
jdbcType=
"TIMESTAMP"
property=
"expectArrivalTime"
/>
and order_status = #{orderStatus,jdbcType=INTEGER}
<result
column=
"num"
jdbcType=
"INTEGER"
property=
"num"
/>
</if>
<result
column=
"demand_img"
jdbcType=
"VARCHAR"
property=
"demandImg"
/>
order by create_time asc
<result
column=
"demand_desc"
jdbcType=
"VARCHAR"
property=
"demandDesc"
/>
</select>
<result
column=
"read_agreement"
jdbcType=
"INTEGER"
property=
"readAgreement"
/>
<result
column=
"price"
jdbcType=
"DECIMAL"
property=
"price"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
<result
column=
"order_status"
jdbcType=
"INTEGER"
property=
"orderStatus"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"modify_time"
jdbcType=
"TIMESTAMP"
property=
"modifyTime"
/>
</resultMap>
</mapper>
</mapper>
\ No newline at end of file
entity/src/main/java/com/onsiteservice/entity/order/ServiceOrder.java
View file @
f1001688
...
@@ -31,6 +31,13 @@ public class ServiceOrder implements Serializable {
...
@@ -31,6 +31,13 @@ public class ServiceOrder implements Serializable {
@ApiModelProperty
(
"订单号"
)
@ApiModelProperty
(
"订单号"
)
private
String
orderNo
;
private
String
orderNo
;
/**
* 服务名
*/
@Column
(
name
=
"service_name"
)
@ApiModelProperty
(
"服务名"
)
private
String
serviceName
;
/**
/**
* 账号
* 账号
*/
*/
...
...
entity/src/main/java/com/onsiteservice/entity/service/ServiceOrderImg.java
0 → 100644
View file @
f1001688
package
com
.
onsiteservice
.
entity
.
service
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.util.Date
;
import
javax.persistence.*
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
@Getter
@Setter
@ToString
@ApiModel
(
"订单图片表"
)
@Table
(
name
=
"service_order_img"
)
public
class
ServiceOrderImg
implements
Serializable
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
""
)
private
Long
id
;
/**
* 订单id
*/
@Column
(
name
=
"order_id"
)
@ApiModelProperty
(
"订单id"
)
private
Long
orderId
;
/**
* 图片oss地址
*/
@ApiModelProperty
(
"图片oss地址"
)
private
String
url
;
/**
* 创建时间
*/
@Column
(
name
=
"create_time"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/ServiceOrderController.java
View file @
f1001688
...
@@ -49,7 +49,7 @@ public class ServiceOrderController {
...
@@ -49,7 +49,7 @@ public class ServiceOrderController {
@ApiOperation
(
value
=
"分页查询订单"
)
@ApiOperation
(
value
=
"分页查询订单"
)
@PostMapping
(
"page"
)
@PostMapping
(
"page"
)
public
Result
<
PageInfoVO
<
ServiceOrderVO
>>
getPage
(
@RequestBody
@NonNull
@Validated
PageServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
public
Result
<
PageInfoVO
<
ServiceOrderVO
>>
getPage
(
@RequestBody
@NonNull
@Validated
PageServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
selectByUserId
(
dto
,
userId
);
return
serviceOrderService
.
getPage
(
dto
,
userId
);
}
}
@ApiOperation
(
value
=
"订单预约"
)
@ApiOperation
(
value
=
"订单预约"
)
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/ReserveServiceOrderDTO.java
View file @
f1001688
...
@@ -7,7 +7,9 @@ import lombok.Data;
...
@@ -7,7 +7,9 @@ import lombok.Data;
import
javax.validation.constraints.Future
;
import
javax.validation.constraints.Future
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
@Data
@Data
@ApiModel
(
"订单预约请求模型"
)
@ApiModel
(
"订单预约请求模型"
)
...
@@ -60,4 +62,8 @@ public class ReserveServiceOrderDTO {
...
@@ -60,4 +62,8 @@ public class ReserveServiceOrderDTO {
@NotNull
(
message
=
"请确认是否阅读协议"
)
@NotNull
(
message
=
"请确认是否阅读协议"
)
private
Boolean
readAgreement
;
private
Boolean
readAgreement
;
@ApiModelProperty
(
"服务图片数组"
)
@Size
(
max
=
8
,
message
=
"最多上传8张图片"
)
private
List
<
String
>
urls
;
}
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/vo/ServiceOrderVO.java
View file @
f1001688
package
com
.
onsiteservice
.
miniapp
.
controller
.
order
.
vo
;
package
com
.
onsiteservice
.
miniapp
.
controller
.
order
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
@Data
@Data
public
class
ServiceOrderVO
{
public
class
ServiceOrderVO
{
...
@@ -47,4 +41,6 @@ public class ServiceOrderVO {
...
@@ -47,4 +41,6 @@ public class ServiceOrderVO {
private
Date
modifyTime
;
private
Date
modifyTime
;
private
List
<
String
>
urls
;
}
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/mapper/order/ServiceOrderBizMapper.java
View file @
f1001688
...
@@ -14,6 +14,6 @@ import java.util.List;
...
@@ -14,6 +14,6 @@ import java.util.List;
*/
*/
public
interface
ServiceOrderBizMapper
{
public
interface
ServiceOrderBizMapper
{
List
<
ServiceOrder
>
selectServiceOrderPage
(
@Param
(
"dto"
)
PageServiceOrderDTO
dto
,
@Param
(
"u
id"
)
Long
ui
d
);
List
<
ServiceOrder
>
selectServiceOrderPage
(
@Param
(
"dto"
)
PageServiceOrderDTO
dto
,
@Param
(
"u
serId"
)
Long
userI
d
);
}
}
mini-app/src/main/java/com/onsiteservice/miniapp/service/order/ServiceOrderService.java
View file @
f1001688
...
@@ -13,6 +13,7 @@ import com.onsiteservice.dao.common.page.PageInfoVO;
...
@@ -13,6 +13,7 @@ import com.onsiteservice.dao.common.page.PageInfoVO;
import
com.onsiteservice.dao.mapper.service.*
;
import
com.onsiteservice.dao.mapper.service.*
;
import
com.onsiteservice.dao.mapper.user.UserMapper
;
import
com.onsiteservice.dao.mapper.user.UserMapper
;
import
com.onsiteservice.entity.address.ServiceAddress
;
import
com.onsiteservice.entity.address.ServiceAddress
;
import
com.onsiteservice.entity.category.ServiceCategory
;
import
com.onsiteservice.entity.category.ServiceSubclass
;
import
com.onsiteservice.entity.category.ServiceSubclass
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.entity.service.*
;
import
com.onsiteservice.entity.service.*
;
...
@@ -22,8 +23,10 @@ import com.onsiteservice.miniapp.controller.order.vo.ServiceOrderLogVO;
...
@@ -22,8 +23,10 @@ import com.onsiteservice.miniapp.controller.order.vo.ServiceOrderLogVO;
import
com.onsiteservice.miniapp.controller.order.vo.ServiceOrderVO
;
import
com.onsiteservice.miniapp.controller.order.vo.ServiceOrderVO
;
import
com.onsiteservice.miniapp.mapper.order.ServiceOrderBizMapper
;
import
com.onsiteservice.miniapp.mapper.order.ServiceOrderBizMapper
;
import
com.onsiteservice.util.AttrCopyUtils
;
import
com.onsiteservice.util.AttrCopyUtils
;
import
com.onsiteservice.util.ListUtils
;
import
com.onsiteservice.util.RandomUtils
;
import
com.onsiteservice.util.RandomUtils
;
import
com.onsiteservice.util.aliyun.SmsUtils
;
import
com.onsiteservice.util.aliyun.SmsUtils
;
import
com.onsiteservice.dao.component.RecordComponent
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -34,9 +37,8 @@ import org.springframework.util.CollectionUtils;
...
@@ -34,9 +37,8 @@ import org.springframework.util.CollectionUtils;
import
tk.mybatis.mapper.entity.Condition
;
import
tk.mybatis.mapper.entity.Condition
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.Comparator
;
import
java.util.*
;
import
java.util.List
;
import
java.util.function.Function
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -58,12 +60,16 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -58,12 +60,16 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
private
ServiceOrderBizMapper
serviceOrderBizMapper
;
private
ServiceOrderBizMapper
serviceOrderBizMapper
;
@Resource
@Resource
private
ServiceOrderMapper
serviceOrderMapper
;
private
ServiceOrderMapper
serviceOrderMapper
;
@Resource
private
ServiceOrderImgMapper
serviceOrderImgMapper
;
@Resource
@Resource
private
ServiceAddressMapper
serviceAddressMapper
;
private
ServiceAddressMapper
serviceAddressMapper
;
@Resource
@Resource
private
ServiceSubclassMapper
serviceSubclassMapper
;
private
ServiceSubclassMapper
serviceSubclassMapper
;
@Resource
private
ServiceCategoryMapper
serviceCategoryMapper
;
@Resource
@Resource
private
ServiceOrderLogMapper
serviceOrderLogMapper
;
private
ServiceOrderLogMapper
serviceOrderLogMapper
;
...
@@ -81,38 +87,32 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -81,38 +87,32 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
@Resource
@Resource
private
UserMapper
userMapper
;
private
UserMapper
userMapper
;
@Autowired
private
RecordComponent
recordComponent
;
public
ServiceOrderVO
selectById
(
Long
id
,
Long
userId
)
{
public
ServiceOrderVO
selectById
(
Long
id
,
Long
userId
)
{
log
.
info
(
"order selectById id: {}, userId: {}"
,
id
,
userId
);
// 订单信息
// 订单信息
Condition
c
=
new
Condition
(
ServiceOrder
.
class
);
Condition
c
=
new
Condition
(
ServiceOrder
.
class
);
c
.
createCriteria
().
andEqualTo
(
"id"
,
id
)
.
andEqualTo
(
BizConstants
.
UserConstants
.
ACCOUNT_NO
,
userId
)
;
c
.
createCriteria
().
andEqualTo
(
"id"
,
id
);
List
<
ServiceOrder
>
serviceOrderList
=
this
.
selectByCondition
(
c
);
List
<
ServiceOrder
>
serviceOrderList
=
this
.
selectByCondition
(
c
);
if
(
CollectionUtils
.
isEmpty
(
serviceOrderList
))
{
if
(
CollectionUtils
.
isEmpty
(
serviceOrderList
))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_NOT_EXIST
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_NOT_EXIST
);
}
}
ServiceOrder
serviceOrder
=
serviceOrderList
.
get
(
0
);
return
buildServiceOrderVO
(
serviceOrderList
).
get
(
0
);
ServiceOrderVO
serviceOrderVO
=
AttrCopyUtils
.
copy
(
serviceOrder
,
new
ServiceOrderVO
());
serviceOrderVO
.
setName
(
serviceOrderVO
.
getName
());
serviceOrderVO
.
setPhone
(
serviceOrderVO
.
getPhone
());
Condition
cc
=
new
Condition
(
ServiceAddress
.
class
);
cc
.
createCriteria
().
andEqualTo
(
"id"
,
serviceOrder
.
getAddressId
()).
andEqualTo
(
BizConstants
.
UserConstants
.
ACCOUNT_NO
,
userId
);
List
<
ServiceAddress
>
serviceAddressList
=
serviceAddressMapper
.
selectByCondition
(
cc
);
if
(!
CollectionUtils
.
isEmpty
(
serviceAddressList
))
{
// 订单地址信息
serviceOrderVO
.
setAddress
(
serviceAddressList
.
get
(
0
).
getAddress
());
}
return
serviceOrderVO
;
}
}
public
Result
<
PageInfoVO
<
ServiceOrderVO
>>
selectByUserId
(
PageServiceOrderDTO
dto
,
Long
uid
)
{
public
Result
<
PageInfoVO
<
ServiceOrderVO
>>
getPage
(
PageServiceOrderDTO
dto
,
Long
userId
)
{
log
.
info
(
"order getPage dto: {}, userId: {}"
,
dto
,
userId
);
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getSize
());
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getSize
());
List
<
ServiceOrder
>
serviceOrder
s
=
serviceOrderBizMapper
.
selectServiceOrderPage
(
dto
,
uid
);
List
<
ServiceOrder
>
serviceOrder
List
=
serviceOrderMapper
.
selectServiceOrderPage
(
dto
.
getOrderStatus
()
);
List
<
ServiceOrderVO
>
serviceOrderVOList
=
serviceOrders
.
parallelStream
().
map
(
e
->
AttrCopyUtils
.
copy
(
e
,
new
ServiceOrderVO
())).
collect
(
Collectors
.
toList
());
return
ResultGenerator
.
success
(
new
PageInfoVO
<>(
serviceOrderVOList
));
return
ResultGenerator
.
success
(
new
PageInfoVO
<>(
buildServiceOrderVO
(
serviceOrderList
)
));
}
}
...
@@ -124,6 +124,8 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -124,6 +124,8 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_SUBCLASS_NOT_EXIST
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_SUBCLASS_NOT_EXIST
);
}
}
ServiceCategory
serviceCategory
=
serviceCategoryMapper
.
selectByPrimaryKey
(
serviceSubclass
.
getCategoryId
());
ServiceAddress
serviceAddress
=
serviceAddressMapper
.
selectByPrimaryKey
(
dto
.
getAddressId
());
ServiceAddress
serviceAddress
=
serviceAddressMapper
.
selectByPrimaryKey
(
dto
.
getAddressId
());
if
(
Objects
.
isNull
(
serviceAddress
))
{
if
(
Objects
.
isNull
(
serviceAddress
))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ADDRESS_NOT_EXIST
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ADDRESS_NOT_EXIST
);
...
@@ -138,14 +140,21 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -138,14 +140,21 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
serviceOrder
.
setPhone
(
serviceAddress
.
getPhone
());
serviceOrder
.
setPhone
(
serviceAddress
.
getPhone
());
// 创建人
// 创建人
serviceOrder
.
setCreateBy
(
userId
);
serviceOrder
.
setCreateBy
(
userId
);
// 服务名
serviceOrder
.
setServiceName
(
String
.
format
(
BizConstants
.
FormatConstants
.
CATEGORY_SUBCLASS_SERVICE_NAME
,
serviceCategory
.
getServiceName
(),
serviceSubclass
.
getServiceName
()));
int
result
=
this
.
insertSelective
(
serviceOrder
);
int
result
=
this
.
insertSelective
(
serviceOrder
);
recordComponent
.
recordServiceOrderImg
(
serviceOrder
,
dto
.
getUrls
());
// TODO 发短信通知所有客服
// TODO 发短信通知所有客服
// 记录流程
// 记录流程
if
(
result
==
1
)
{
if
(
result
==
1
)
{
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
(),
ServiceOrderStatusEnum
.
RESERVE
.
getMsg
(),
null
,
null
);
record
Component
.
record
Process
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
(),
ServiceOrderStatusEnum
.
RESERVE
.
getMsg
(),
null
,
null
);
}
}
return
result
;
return
result
;
...
@@ -179,7 +188,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -179,7 +188,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
if
(
result
==
1
)
{
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
VALUATION
.
getMsg
(),
user
.
getUserName
(),
serviceValuator
.
getName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
VALUATION
.
getMsg
(),
user
.
getUserName
(),
serviceValuator
.
getName
());
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
(),
description
,
serviceValuator
.
getId
(),
dto
.
getRemark
());
record
Component
.
record
Process
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
(),
description
,
serviceValuator
.
getId
(),
dto
.
getRemark
());
}
}
return
result
;
return
result
;
...
@@ -207,7 +216,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -207,7 +216,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
if
(
result
==
1
)
{
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REVALUATION
.
getMsg
(),
user
.
getUserName
(),
serviceValuator
.
getName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REVALUATION
.
getMsg
(),
user
.
getUserName
(),
serviceValuator
.
getName
());
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
REVALUATION
.
getStatus
(),
description
,
serviceValuator
.
getId
(),
dto
.
getRemark
());
record
Component
.
record
Process
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
REVALUATION
.
getStatus
(),
description
,
serviceValuator
.
getId
(),
dto
.
getRemark
());
}
}
return
result
;
return
result
;
...
@@ -255,7 +264,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -255,7 +264,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
if
(
result
==
1
)
{
if
(
result
==
1
)
{
boolean
isAdmin
=
user
.
getRoleType
().
equals
(
ServiceUserTypeEnum
.
ADMIN
.
getId
());
boolean
isAdmin
=
user
.
getRoleType
().
equals
(
ServiceUserTypeEnum
.
ADMIN
.
getId
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
SEND
.
getMsg
(),
(
isAdmin
?
ServiceUserTypeEnum
.
ADMIN
.
getName
()
:
ServiceUserTypeEnum
.
VALUATOR
.
getName
())
+
user
.
getUserName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
SEND
.
getMsg
(),
(
isAdmin
?
ServiceUserTypeEnum
.
ADMIN
.
getName
()
:
ServiceUserTypeEnum
.
VALUATOR
.
getName
())
+
user
.
getUserName
());
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
SEND
.
getStatus
(),
description
,
null
,
null
);
record
Component
.
record
Process
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
SEND
.
getStatus
(),
description
,
null
,
null
);
}
}
return
result
;
return
result
;
...
@@ -279,7 +288,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -279,7 +288,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
// TODO 调用微信支付接口
// TODO 调用微信支付接口
if
(
result
==
1
)
{
if
(
result
==
1
)
{
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
PAY
.
getStatus
(),
ServiceOrderStatusEnum
.
PAY
.
getMsg
(),
null
,
null
);
record
Component
.
record
Process
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
PAY
.
getStatus
(),
ServiceOrderStatusEnum
.
PAY
.
getMsg
(),
null
,
null
);
}
}
return
result
;
return
result
;
...
@@ -314,7 +323,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -314,7 +323,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
if
(
result
==
1
)
{
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
DISPATCH
.
getMsg
(),
user
.
getUserName
(),
serviceWorker
.
getName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
DISPATCH
.
getMsg
(),
user
.
getUserName
(),
serviceWorker
.
getName
());
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
(),
description
,
serviceWorker
.
getId
(),
dto
.
getRemark
());
record
Component
.
record
Process
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
(),
description
,
serviceWorker
.
getId
(),
dto
.
getRemark
());
}
}
return
result
;
return
result
;
...
@@ -346,7 +355,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -346,7 +355,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
if
(
result
==
1
)
{
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REDISPATCH
.
getMsg
(),
user
.
getUserName
(),
serviceWorker
.
getName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REDISPATCH
.
getMsg
(),
user
.
getUserName
(),
serviceWorker
.
getName
());
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
REDISPATCH
.
getStatus
(),
description
,
serviceWorker
.
getId
(),
dto
.
getRemark
());
record
Component
.
record
Process
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
REDISPATCH
.
getStatus
(),
description
,
serviceWorker
.
getId
(),
dto
.
getRemark
());
}
}
return
result
;
return
result
;
...
@@ -381,7 +390,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -381,7 +390,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
if
(
result
==
1
)
{
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
FINISH
.
getMsg
(),
isUser
?
ServiceUserTypeEnum
.
USER
.
getName
()
:
ServiceUserTypeEnum
.
ADMIN
.
getName
()
+
user
.
getUserName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
FINISH
.
getMsg
(),
isUser
?
ServiceUserTypeEnum
.
USER
.
getName
()
:
ServiceUserTypeEnum
.
ADMIN
.
getName
()
+
user
.
getUserName
());
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
FINISH
.
getStatus
(),
description
,
null
,
null
);
record
Component
.
record
Process
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
FINISH
.
getStatus
(),
description
,
null
,
null
);
}
}
return
result
;
return
result
;
...
@@ -404,7 +413,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -404,7 +413,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
if
(
result
==
1
)
{
if
(
result
==
1
)
{
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
CANCEL
.
getStatus
(),
ServiceOrderStatusEnum
.
CANCEL
.
getMsg
(),
null
,
null
);
record
Component
.
record
Process
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
CANCEL
.
getStatus
(),
ServiceOrderStatusEnum
.
CANCEL
.
getMsg
(),
null
,
null
);
}
}
return
result
;
return
result
;
...
@@ -499,6 +508,8 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -499,6 +508,8 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
* @param finalExecuted 逻辑上谁最有可能是最终的上门人员
* @param finalExecuted 逻辑上谁最有可能是最终的上门人员
*/
*/
public
void
disableServiceValuatorAssign
(
ServiceOrder
serviceOrder
,
Long
userId
,
Boolean
finalExecuted
)
{
public
void
disableServiceValuatorAssign
(
ServiceOrder
serviceOrder
,
Long
userId
,
Boolean
finalExecuted
)
{
log
.
info
(
"disableServiceValuatorAssign serviceOrder: {}, userId: {}, finalExecuted: {}"
,
serviceOrder
,
userId
,
finalExecuted
);
ServiceValuatorAssign
serviceValuatorAssign
=
new
ServiceValuatorAssign
();
ServiceValuatorAssign
serviceValuatorAssign
=
new
ServiceValuatorAssign
();
serviceValuatorAssign
.
setModifyBy
(
userId
);
serviceValuatorAssign
.
setModifyBy
(
userId
);
serviceValuatorAssign
.
setDeleted
(
true
);
serviceValuatorAssign
.
setDeleted
(
true
);
...
@@ -535,6 +546,8 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -535,6 +546,8 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
* @param userId 用户id
* @param userId 用户id
*/
*/
public
void
disableServiceWorkerAssign
(
ServiceOrder
serviceOrder
,
Long
userId
,
Boolean
finalExecuted
)
{
public
void
disableServiceWorkerAssign
(
ServiceOrder
serviceOrder
,
Long
userId
,
Boolean
finalExecuted
)
{
log
.
info
(
"disableServiceWorkerAssign serviceOrder: {}, userId: {}, finalExecuted: {}"
,
serviceOrder
,
userId
,
finalExecuted
);
ServiceWorkerAssign
serviceWorkerAssign
=
new
ServiceWorkerAssign
();
ServiceWorkerAssign
serviceWorkerAssign
=
new
ServiceWorkerAssign
();
serviceWorkerAssign
.
setModifyBy
(
userId
);
serviceWorkerAssign
.
setModifyBy
(
userId
);
serviceWorkerAssign
.
setDeleted
(
true
);
serviceWorkerAssign
.
setDeleted
(
true
);
...
@@ -549,17 +562,31 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -549,17 +562,31 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
}
}
@Async
private
List
<
ServiceOrderVO
>
buildServiceOrderVO
(
List
<
ServiceOrder
>
serviceOrderList
){
public
void
recordProcess
(
Long
orderId
,
Integer
processId
,
String
description
,
Long
hostId
,
String
remark
)
{
// 地址信息
ServiceOrderLog
serviceOrderLog
=
new
ServiceOrderLog
();
List
<
Long
>
addressIdList
=
serviceOrderList
.
parallelStream
().
map
(
ServiceOrder:
:
getAddressId
).
collect
(
Collectors
.
toList
());
serviceOrderLog
.
setOrderId
(
orderId
);
List
<
ServiceAddress
>
serviceAddressList
=
serviceAddressMapper
.
selectByIdList
(
addressIdList
);
serviceOrderLog
.
setProcessId
(
processId
);
Map
<
Long
,
ServiceAddress
>
serviceAddressMap
=
serviceAddressList
.
parallelStream
().
collect
(
Collectors
.
toMap
(
ServiceAddress:
:
getId
,
Function
.
identity
()));
serviceOrderLog
.
setDescription
(
description
);
serviceOrderLog
.
setHostId
(
hostId
);
serviceOrderLog
.
setRemark
(
remark
);
serviceOrderLogMapper
.
insertSelective
(
serviceOrderLog
);
// 图片信息
List
<
Long
>
orderIdList
=
serviceOrderList
.
parallelStream
().
map
(
ServiceOrder:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
ServiceOrderImg
>
serviceOrderImgList
=
serviceOrderImgMapper
.
selectByOrderIdList
(
orderIdList
);
Map
<
Long
,
List
<
ServiceOrderImg
>>
serviceOrderImgMap
=
serviceOrderImgList
.
parallelStream
().
collect
(
Collectors
.
groupingBy
(
ServiceOrderImg:
:
getOrderId
));
return
serviceOrderList
.
parallelStream
().
map
(
e
->
{
ServiceOrderVO
serviceOrderVO
=
AttrCopyUtils
.
copy
(
e
,
new
ServiceOrderVO
());
ServiceAddress
sa
=
serviceAddressMap
.
getOrDefault
(
serviceOrderVO
.
getAddressId
(),
new
ServiceAddress
());
serviceOrderVO
.
setName
(
sa
.
getName
());
serviceOrderVO
.
setAddress
(
sa
.
getAddress
());
serviceOrderVO
.
setUrls
(
serviceOrderImgMap
.
getOrDefault
(
serviceOrderVO
.
getId
(),
new
ArrayList
<>()).
parallelStream
()
.
map
(
ServiceOrderImg:
:
getUrl
).
collect
(
Collectors
.
toList
()));
return
serviceOrderVO
;
}).
collect
(
Collectors
.
toList
());
}
}
}
}
mini-app/src/main/resources/mapper/order/ServiceOrderBizMapper.xml
View file @
f1001688
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
select *
select *
from service_order
from service_order
where
where
account_no = #{u
i
d,jdbcType=BIGINT}
account_no = #{u
serI
d,jdbcType=BIGINT}
<if
test=
"dto.orderStatus != 0"
>
<if
test=
"dto.orderStatus != 0"
>
and order_status = #{dto.orderStatus,jdbcType=INTEGER}
and order_status = #{dto.orderStatus,jdbcType=INTEGER}
</if>
</if>
...
...
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