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
5e215e69
Commit
5e215e69
authored
Jul 13, 2022
by
lining
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 最终上门维修工/估价员逻辑,上门时间检验
parent
6bb90954
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
93 additions
and
43 deletions
+93
-43
ServiceValuatorAssignMapper.java
...rvice/dao/mapper/service/ServiceValuatorAssignMapper.java
+6
-0
ServiceWorkerAssignMapper.java
...service/dao/mapper/service/ServiceWorkerAssignMapper.java
+6
-0
ServiceValuatorAssignMapper.xml
.../resources/mapper/service/ServiceValuatorAssignMapper.xml
+24
-11
ServiceWorkerAssignMapper.xml
...in/resources/mapper/service/ServiceWorkerAssignMapper.xml
+23
-11
ServiceOrder.java
...ain/java/com/onsiteservice/entity/order/ServiceOrder.java
+0
-7
ServiceValuatorAssign.java
...m/onsiteservice/entity/service/ServiceValuatorAssign.java
+6
-0
ServiceWorkerAssign.java
...com/onsiteservice/entity/service/ServiceWorkerAssign.java
+6
-0
DispatchServiceOrderDTO.java
...miniapp/controller/order/dto/DispatchServiceOrderDTO.java
+2
-0
ReserveServiceOrderDTO.java
.../miniapp/controller/order/dto/ReserveServiceOrderDTO.java
+2
-0
ValuationServiceOrderDTO.java
...iniapp/controller/order/dto/ValuationServiceOrderDTO.java
+2
-0
ServiceOrderService.java
...iteservice/miniapp/service/order/ServiceOrderService.java
+10
-7
ServiceValuatorService.java
...ervice/miniapp/service/worker/ServiceValuatorService.java
+3
-4
ServiceWorkerService.java
...eservice/miniapp/service/worker/ServiceWorkerService.java
+3
-3
No files found.
dao/src/main/java/com/onsiteservice/dao/mapper/service/ServiceValuatorAssignMapper.java
View file @
5e215e69
...
...
@@ -2,6 +2,12 @@ package com.onsiteservice.dao.mapper.service;
import
com.onsiteservice.dao.common.Mapper
;
import
com.onsiteservice.entity.service.ServiceValuatorAssign
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
ServiceValuatorAssignMapper
extends
Mapper
<
ServiceValuatorAssign
>
{
List
<
ServiceValuatorAssign
>
selectByDeletedAndIdListAndAssignTime
(
@Param
(
"list"
)
List
<
Long
>
valuatorIds
);
}
\ No newline at end of file
dao/src/main/java/com/onsiteservice/dao/mapper/service/ServiceWorkerAssignMapper.java
View file @
5e215e69
...
...
@@ -2,6 +2,12 @@ package com.onsiteservice.dao.mapper.service;
import
com.onsiteservice.dao.common.Mapper
;
import
com.onsiteservice.entity.service.ServiceWorkerAssign
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
ServiceWorkerAssignMapper
extends
Mapper
<
ServiceWorkerAssign
>
{
List
<
ServiceWorkerAssign
>
selectByDeletedAndIdListAndAssignTime
(
@Param
(
"list"
)
List
<
Long
>
workerIds
);
}
\ No newline at end of file
dao/src/main/resources/mapper/service/ServiceValuatorAssignMapper.xml
View file @
5e215e69
<?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.ServiceValuatorAssignMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.onsiteservice.entity.service.ServiceValuatorAssign"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"valuator_id"
jdbcType=
"BIGINT"
property=
"valuatorId"
/>
<result
column=
"order_id"
jdbcType=
"BIGINT"
property=
"orderId"
/>
<result
column=
"assign_time"
jdbcType=
"TIMESTAMP"
property=
"assignTime"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"modify_time"
jdbcType=
"TIMESTAMP"
property=
"modifyTime"
/>
</resultMap>
<resultMap
id=
"BaseResultMap"
type=
"com.onsiteservice.entity.service.ServiceValuatorAssign"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"valuator_id"
jdbcType=
"BIGINT"
property=
"valuatorId"
/>
<result
column=
"order_id"
jdbcType=
"BIGINT"
property=
"orderId"
/>
<result
column=
"assign_time"
jdbcType=
"TIMESTAMP"
property=
"assignTime"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"modify_time"
jdbcType=
"TIMESTAMP"
property=
"modifyTime"
/>
</resultMap>
<select
id=
"selectByDeletedAndIdListAndAssignTime"
resultType=
"com.onsiteservice.entity.service.ServiceValuatorAssign"
>
select * from service_valuator_assign
where deleted=0
and valuator_id in
<foreach
collection=
"list"
item=
"valuatorId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
${valuatorId}
</foreach>
and assign_time >=sysdate()
</select>
</mapper>
\ No newline at end of file
dao/src/main/resources/mapper/service/ServiceWorkerAssignMapper.xml
View file @
5e215e69
<?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.ServiceWorkerAssignMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.onsiteservice.entity.service.ServiceWorkerAssign"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"worker_id"
jdbcType=
"BIGINT"
property=
"workerId"
/>
<result
column=
"order_id"
jdbcType=
"BIGINT"
property=
"orderId"
/>
<result
column=
"assign_time"
jdbcType=
"TIMESTAMP"
property=
"assignTime"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"modify_time"
jdbcType=
"TIMESTAMP"
property=
"modifyTime"
/>
</resultMap>
<resultMap
id=
"BaseResultMap"
type=
"com.onsiteservice.entity.service.ServiceWorkerAssign"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"worker_id"
jdbcType=
"BIGINT"
property=
"workerId"
/>
<result
column=
"order_id"
jdbcType=
"BIGINT"
property=
"orderId"
/>
<result
column=
"assign_time"
jdbcType=
"TIMESTAMP"
property=
"assignTime"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"modify_time"
jdbcType=
"TIMESTAMP"
property=
"modifyTime"
/>
</resultMap>
<select
id=
"selectByDeletedAndIdListAndAssignTime"
resultType=
"com.onsiteservice.entity.service.ServiceWorkerAssign"
>
select * from service_worker_assign
where deleted=0
and worker_id in
<foreach
collection=
"list"
item=
"workerId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
${workerId}
</foreach>
and assign_time >=sysdate()
</select>
</mapper>
\ No newline at end of file
entity/src/main/java/com/onsiteservice/entity/order/ServiceOrder.java
View file @
5e215e69
...
...
@@ -69,13 +69,6 @@ public class ServiceOrder implements Serializable {
@ApiModelProperty
(
"服务数量"
)
private
Integer
num
;
/**
* 服务需求图片
*/
@Column
(
name
=
"demand_img"
)
@ApiModelProperty
(
"服务需求图片"
)
private
String
demandImg
;
/**
* 服务需求说明
*/
...
...
entity/src/main/java/com/onsiteservice/entity/service/ServiceValuatorAssign.java
View file @
5e215e69
...
...
@@ -64,8 +64,14 @@ public class ServiceValuatorAssign implements Serializable {
@ApiModelProperty
(
"修改人"
)
private
Long
modifyBy
;
@Column
(
name
=
"deleted"
)
@ApiModelProperty
(
"删除标记"
)
private
Boolean
deleted
;
@Column
(
name
=
"final_executed"
)
@ApiModelProperty
(
"最终上门的估价员"
)
private
Boolean
finalExecuted
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
entity/src/main/java/com/onsiteservice/entity/service/ServiceWorkerAssign.java
View file @
5e215e69
...
...
@@ -64,8 +64,14 @@ public class ServiceWorkerAssign implements Serializable {
@ApiModelProperty
(
"修改人"
)
private
Long
modifyBy
;
@Column
(
name
=
"deleted"
)
@ApiModelProperty
(
"删除标记"
)
private
Boolean
deleted
;
@Column
(
name
=
"final_executed"
)
@ApiModelProperty
(
"最终上门的维修工"
)
private
Boolean
finalExecuted
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/DispatchServiceOrderDTO.java
View file @
5e215e69
...
...
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.Future
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
...
...
@@ -33,6 +34,7 @@ public class DispatchServiceOrderDTO {
@ApiModelProperty
(
value
=
"期望维修工上门时间"
,
required
=
true
)
@NotNull
(
message
=
"请选择上门时间"
)
@Future
(
message
=
"上门时间必须为将来的某个时间点"
)
private
Date
expectArrivalTime
;
}
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/ReserveServiceOrderDTO.java
View file @
5e215e69
...
...
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.Future
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
...
...
@@ -29,6 +30,7 @@ public class ReserveServiceOrderDTO {
*/
@ApiModelProperty
(
value
=
"期望上门时间"
,
required
=
true
)
@NotNull
(
message
=
"请选择上门时间"
)
@Future
(
message
=
"上门时间必须为将来的某个时间点"
)
private
Date
expectArrivalTime
;
/**
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/dto/ValuationServiceOrderDTO.java
View file @
5e215e69
...
...
@@ -6,6 +6,7 @@ import lombok.Data;
import
lombok.extern.log4j.Log4j2
;
import
org.checkerframework.checker.units.qual.A
;
import
javax.validation.constraints.Future
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
...
...
@@ -35,6 +36,7 @@ public class ValuationServiceOrderDTO {
@ApiModelProperty
(
value
=
"期望估价员上门时间"
,
required
=
true
)
@NotNull
(
message
=
"请选择上门时间"
)
@Future
(
message
=
"上门时间必须为将来的某个时间点"
)
private
Date
expectArrivalTime
;
}
mini-app/src/main/java/com/onsiteservice/miniapp/service/order/ServiceOrderService.java
View file @
5e215e69
...
...
@@ -201,7 +201,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_VALUATOR_NOT_EXIST
);
}
disableServiceValuatorAssign
(
serviceOrder
,
userId
);
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
false
);
int
result
=
serviceValuatorAssignMapper
.
insertSelective
(
buildServiceValuatorAssign
(
dto
,
userId
));
...
...
@@ -232,7 +232,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_SEND
);
}
disableServiceValuatorAssign
(
serviceOrder
,
userId
);
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
true
);
// 估价价格
serviceOrder
.
setPrice
(
dto
.
getPrice
());
...
...
@@ -336,7 +336,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_WORKER_NOT_EXIST
);
}
disableServiceWorkerAssign
(
serviceOrder
,
userId
);
disableServiceWorkerAssign
(
serviceOrder
,
userId
,
false
);
int
result
=
serviceWorkerAssignMapper
.
insertSelective
(
buildServiceWorkerAssign
(
dto
,
userId
));
...
...
@@ -372,7 +372,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
NO_AUTH_FINISH_ORDER
);
}
disableServiceWorkerAssign
(
serviceOrder
,
userId
);
disableServiceWorkerAssign
(
serviceOrder
,
userId
,
true
);
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
FINISH
.
getStatus
());
serviceOrder
.
setModifyBy
(
userId
);
...
...
@@ -396,7 +396,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_CANCEL
);
}
disableServiceValuatorAssign
(
serviceOrder
,
userId
);
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
true
);
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
CANCEL
.
getStatus
());
serviceOrder
.
setModifyBy
(
userId
);
...
...
@@ -496,11 +496,13 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
*
* @param serviceOrder 订单
* @param userId 用户id
* @param finalExecuted 逻辑上谁最有可能是最终的上门人员
*/
public
void
disableServiceValuatorAssign
(
ServiceOrder
serviceOrder
,
Long
userId
)
{
public
void
disableServiceValuatorAssign
(
ServiceOrder
serviceOrder
,
Long
userId
,
boolean
finalExecuted
)
{
ServiceValuatorAssign
serviceValuatorAssign
=
new
ServiceValuatorAssign
();
serviceValuatorAssign
.
setModifyBy
(
userId
);
serviceValuatorAssign
.
setDeleted
(
true
);
serviceValuatorAssign
.
setFinalExecuted
(
finalExecuted
);
Condition
c
=
new
Condition
(
ServiceValuatorAssign
.
class
);
c
.
createCriteria
().
andEqualTo
(
BizConstants
.
OrderConstants
.
ORDER_ID
,
serviceOrder
.
getId
());
...
...
@@ -530,10 +532,11 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
* @param serviceOrder 订单
* @param userId 用户id
*/
public
void
disableServiceWorkerAssign
(
ServiceOrder
serviceOrder
,
Long
userId
)
{
public
void
disableServiceWorkerAssign
(
ServiceOrder
serviceOrder
,
Long
userId
,
boolean
finalExecuted
)
{
ServiceWorkerAssign
serviceWorkerAssign
=
new
ServiceWorkerAssign
();
serviceWorkerAssign
.
setModifyBy
(
userId
);
serviceWorkerAssign
.
setDeleted
(
true
);
serviceWorkerAssign
.
setFinalExecuted
(
finalExecuted
);
Condition
c
=
new
Condition
(
ServiceWorkerAssign
.
class
);
c
.
createCriteria
().
andEqualTo
(
BizConstants
.
OrderConstants
.
ORDER_ID
,
serviceOrder
.
getId
());
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/service/worker/ServiceValuatorService.java
View file @
5e215e69
...
...
@@ -61,18 +61,17 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> {
// 估价员id列表
List
<
Long
>
valuatorIds
=
serviceValuatorList
.
parallelStream
().
map
(
ServiceValuator:
:
getId
).
collect
(
Collectors
.
toList
());
// 已被指派的时间
List
<
ServiceValuatorAssign
>
serviceValuatorAssignList
=
serviceValuatorAssignMapper
.
selectBy
IdList
(
valuatorIds
);
List
<
ServiceValuatorAssign
>
serviceValuatorAssignList
=
serviceValuatorAssignMapper
.
selectBy
DeletedAndIdListAndAssignTime
(
valuatorIds
);
Map
<
Long
,
List
<
ServiceValuatorAssign
>>
serviceValuatorAssignMap
=
serviceValuatorAssignList
.
parallelStream
()
// 未过期的指派时间
.
filter
(
e
->
e
.
getAssignTime
().
getTime
()
>=
System
.
currentTimeMillis
())
.
filter
(
e
->
!
e
.
getDeleted
())
.
collect
(
Collectors
.
groupingBy
(
ServiceValuatorAssign:
:
getValuatorId
));
return
serviceValuatorList
.
parallelStream
().
map
(
e1
->
{
ServiceValuatorVO
serviceValuatorVO
=
AttrCopyUtils
.
copy
(
e1
,
new
ServiceValuatorVO
());
// 估价员已经被指派的时间
List
<
ServiceValuatorAssign
>
assigns
=
serviceValuatorAssignMap
.
getOrDefault
(
e1
.
getId
(),
Lists
.
newArrayList
());
List
<
Date
>
assignTimes
=
assigns
.
parallelStream
().
map
(
ServiceValuatorAssign:
:
getAssignTime
).
collect
(
Collectors
.
toList
());
serviceValuatorVO
.
setAssignTime
(
assignTimes
);
return
new
ServiceValuatorVO
();
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/service/worker/ServiceWorkerService.java
View file @
5e215e69
...
...
@@ -57,17 +57,17 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> {
// 估价员id列表
List
<
Long
>
workerIds
=
serviceWorkerList
.
parallelStream
().
map
(
ServiceWorker:
:
getId
).
collect
(
Collectors
.
toList
());
// 已被指派的时间
List
<
ServiceWorkerAssign
>
serviceWorkerAssignList
=
serviceWorkerAssignMapper
.
selectBy
IdList
(
workerIds
);
List
<
ServiceWorkerAssign
>
serviceWorkerAssignList
=
serviceWorkerAssignMapper
.
selectBy
DeletedAndIdListAndAssignTime
(
workerIds
);
Map
<
Long
,
List
<
ServiceWorkerAssign
>>
serviceWorkerAssignMap
=
serviceWorkerAssignList
.
parallelStream
()
.
filter
(
e
->
e
.
getAssignTime
().
getTime
()
>=
System
.
currentTimeMillis
())
.
filter
(
e
->
!
e
.
getDeleted
())
.
collect
(
Collectors
.
groupingBy
(
ServiceWorkerAssign:
:
getWorkerId
));
return
serviceWorkerList
.
parallelStream
().
map
(
e1
->
{
ServiceWorkerVO
serviceWorkerVO
=
AttrCopyUtils
.
copy
(
e1
,
new
ServiceWorkerVO
());
// 维修工已经被指派的时间
List
<
ServiceWorkerAssign
>
assigns
=
serviceWorkerAssignMap
.
getOrDefault
(
e1
.
getId
(),
Lists
.
newArrayList
());
List
<
Date
>
assignTimes
=
assigns
.
parallelStream
().
map
(
ServiceWorkerAssign:
:
getAssignTime
).
collect
(
Collectors
.
toList
());
serviceWorkerVO
.
setAssignTime
(
assignTimes
);
return
new
ServiceWorkerVO
();
...
...
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