Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3226b96f
authored
Jun 12, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
1 parent
48299c87
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
16 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/DispatchServiceImpl.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/DispatchServiceImpl.java
View file @
3226b96
...
...
@@ -10,12 +10,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.lang.management.PlatformManagedObject
;
import
java.sql.Timestamp
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
interface
GroupTag
{
...
...
@@ -62,10 +62,10 @@ public class DispatchServiceImpl implements DispatchService {
item
.
setOrderId
(
o
.
getOrderId
());
item
.
setCategory
(
String
.
format
(
"%s-%s"
,
o
.
getType
(),
o
.
getBrand
()));
item
.
setSkill
(
o
.
getSkill
());
item
.
setRemark
(
o
.
get
Description
());
item
.
setRemark
(
o
.
get
ApplyNote
());
item
.
setCustomerName
(
o
.
getName
());
String
description
=
String
.
format
(
"%s:%s%s-%s
%s:%s"
,
o
.
getOrderId
(),
o
.
getSkill
(),
String
description
=
String
.
format
(
"%s:%s%s-%s
\n
%s:%s"
,
o
.
getOrderId
(),
o
.
getSkill
(),
o
.
getType
(),
o
.
getBrand
(),
o
.
getName
(),
o
.
getAddress
());
item
.
setDescription
(
description
);
...
...
@@ -94,12 +94,24 @@ public class DispatchServiceImpl implements DispatchService {
// 获取groupIds
List
<
String
>
groupIds
=
this
.
queryOrgGroupIds
(
levelType
,
levelIds
);
// 获取engineer列表
List
<
EngineerInfo
>
engineers
=
this
.
queryEngineers
(
groupIds
);
// 获取engineerCodes
List
<
String
>
engineerCodes
=
this
.
queryEngineerCodes
(
groupIds
);
List
<
String
>
engineerCodes
=
engineers
.
stream
().
map
(
EngineerInfo:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
// 获取技术员订单ID列表
HashMap
<
String
,
List
<
String
>>
engineerOrders
=
this
.
queryEngineerOrderIds
(
engineerCodes
,
date
);
// 获取订单列表
List
<
String
>
orderIds
=
new
ArrayList
<>();
List
<
String
>
orderIds
=
this
.
queryOrderAppointmentOrderIds
(
engineerCodes
,
date
);
// 获取订单列表
List
<
OrderRequest
>
orders
=
this
.
queryOrderRequestByOrderIds
(
orderIds
);
List
<
OrderRequest
>
orders
=
this
.
queryOrderRequestByOrderId
(
orderIds
);
for
(
EngineerInfo
e
:
engineers
)
{
}
return
null
;
}
...
...
@@ -125,9 +137,9 @@ public class DispatchServiceImpl implements DispatchService {
return
orderRequestMPDao
.
selectList
(
lqw
);
}
private
List
<
OrderRequest
>
queryOrderRequestByOrderId
(
List
<
String
>
orderIds
)
{
private
List
<
OrderRequest
>
queryOrderRequestByOrderId
s
(
List
<
String
>
orderIds
)
{
List
<
OrderRequest
>
orders
=
new
ArrayList
<>();
if
(
orderIds
.
isEmpty
()){
if
(
orderIds
.
isEmpty
())
{
return
orders
;
}
LambdaQueryWrapper
<
OrderRequest
>
lqw
=
new
LambdaQueryWrapper
<>();
...
...
@@ -135,25 +147,36 @@ public class DispatchServiceImpl implements DispatchService {
return
orderRequestMPDao
.
selectList
(
lqw
);
}
private
List
<
String
>
queryOrderAppointment
OrderIds
(
List
<
String
>
engineerCodes
,
String
date
)
{
private
HashMap
<
String
,
List
<
String
>>
queryEngineer
OrderIds
(
List
<
String
>
engineerCodes
,
String
date
)
{
// 获取工程师服务单列表
List
<
String
>
orderIds
=
new
ArrayList
<>();
HashMap
<
String
,
List
<
String
>>
map
=
new
HashMap
<>();
LambdaQueryWrapper
<
OrderAppointment
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
OrderAppointment:
:
getEngineerCode
,
engineerCodes
);
lqw
.
ge
(
OrderAppointment:
:
getExpectTime
,
this
.
getTimestampFromDate
(
date
,
"00:00:00"
));
lqw
.
le
(
OrderAppointment:
:
getExpectTime
,
this
.
getTimestampFromDate
(
date
,
"23:59:59"
));
lqw
.
select
(
OrderAppointment:
:
getOrderId
);
return
orderAppointmentMPDao
.
selectList
(
lqw
).
stream
().
map
(
OrderAppointment:
:
getOrderId
).
collect
(
Collectors
.
toList
());
lqw
.
select
(
OrderAppointment:
:
getEngineerCode
,
OrderAppointment:
:
getOrderId
);
List
<
OrderAppointment
>
records
=
orderAppointmentMPDao
.
selectList
(
lqw
);
Map
<
String
,
List
<
OrderAppointment
>>
gg
=
records
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderAppointment:
:
getEngineerCode
));
for
(
String
engineerCode
:
gg
.
keySet
())
{
List
<
String
>
orderIds
=
new
ArrayList
<>();
for
(
OrderAppointment
o
:
gg
.
get
(
engineerCode
))
{
orderIds
.
add
(
o
.
getOrderId
());
}
map
.
put
(
engineerCode
,
orderIds
);
}
return
map
;
}
private
List
<
String
>
queryEngineerCode
s
(
List
<
String
>
groupIds
)
{
private
List
<
EngineerInfo
>
queryEngineer
s
(
List
<
String
>
groupIds
)
{
// 通过groupIds获取技术员列表
LambdaQueryWrapper
<
EngineerInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
EngineerInfo:
:
getGroupId
,
groupIds
);
lqw
.
eq
(
EngineerInfo:
:
getBeanStatus
,
1
);
List
<
EngineerInfo
>
engineers
=
engineerInfoMPDao
.
selectList
(
lqw
);
return
engineers
.
stream
().
map
(
EngineerInfo:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
return
engineerInfoMPDao
.
selectList
(
lqw
);
}
private
List
<
String
>
queryOrgGroupIds
(
String
levelType
,
List
<
String
>
levelIds
)
{
...
...
@@ -176,7 +199,7 @@ public class DispatchServiceImpl implements DispatchService {
return
map
;
}
public
Timestamp
getTimestampFromDate
(
String
date
,
String
time
){
public
Timestamp
getTimestampFromDate
(
String
date
,
String
time
)
{
return
Timestamp
.
valueOf
(
date
+
" "
+
time
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment