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 4251365e
authored
Jul 25, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
1 parent
636de92d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
27 deletions
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
View file @
4251365
package
com
.
dituhui
.
pea
.
order
.
common
;
package
com
.
dituhui
.
pea
.
order
.
common
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -21,11 +22,6 @@ import java.util.stream.Collectors;
...
@@ -21,11 +22,6 @@ import java.util.stream.Collectors;
@Component
@Component
@Slf4j
@Slf4j
public
class
OrderAssignCheck
{
public
class
OrderAssignCheck
{
@Autowired
OrderRequestMPDao
orderRequestMPDao
;
@Autowired
OrderAppointmentMPDao
orderAppointmentMPDao
;
@Autowired
@Autowired
SkillInfoMPDao
skillInfoMPDao
;
SkillInfoMPDao
skillInfoMPDao
;
...
@@ -39,6 +35,9 @@ public class OrderAssignCheck {
...
@@ -39,6 +35,9 @@ public class OrderAssignCheck {
@Autowired
@Autowired
OrgGroupMPDao
orgGroupMPDao
;
OrgGroupMPDao
orgGroupMPDao
;
@Autowired
OrderInfoMPDao
orderInfoMPDao
;
@Data
@Data
public
class
Result
{
public
class
Result
{
private
Boolean
canAssign
;
private
Boolean
canAssign
;
...
@@ -63,7 +62,7 @@ public class OrderAssignCheck {
...
@@ -63,7 +62,7 @@ public class OrderAssignCheck {
public
Result
orderAssignCheck
(
String
orderId
,
String
engineerCode
)
{
public
Result
orderAssignCheck
(
String
orderId
,
String
engineerCode
)
{
log
.
info
(
"begin orderAssignCheck:orderId={}, engineerCode={}"
,
orderId
,
engineerCode
);
log
.
info
(
"begin orderAssignCheck:orderId={}, engineerCode={}"
,
orderId
,
engineerCode
);
Order
Request
order
=
orderRequest
MPDao
.
getByOrderId
(
orderId
);
Order
Info
order
=
orderInfo
MPDao
.
getByOrderId
(
orderId
);
double
curX
=
Double
.
parseDouble
(
order
.
getX
());
double
curX
=
Double
.
parseDouble
(
order
.
getX
());
double
curY
=
Double
.
parseDouble
(
order
.
getY
());
double
curY
=
Double
.
parseDouble
(
order
.
getY
());
...
@@ -142,33 +141,22 @@ public class OrderAssignCheck {
...
@@ -142,33 +141,22 @@ public class OrderAssignCheck {
private
List
<
OrderSegment
>
getEngineerOrderSegments
(
String
engineerCode
,
LocalDate
dt
)
{
private
List
<
OrderSegment
>
getEngineerOrderSegments
(
String
engineerCode
,
LocalDate
dt
)
{
List
<
OrderSegment
>
orderSegments
=
new
ArrayList
<>();
List
<
OrderSegment
>
orderSegments
=
new
ArrayList
<>();
List
<
OrderAppointment
>
appointments
=
orderAppointmentMPDao
.
selectByEngineerCodeAndDt
(
engineerCode
,
dt
);
LambdaQueryWrapper
<
OrderInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
List
<
String
>
orderIds
=
new
ArrayList
<>();
lqw
.
eq
(
OrderInfo:
:
getDt
,
dt
);
for
(
OrderAppointment
o:
appointments
)
{
lqw
.
eq
(
OrderInfo:
:
getEngineerCode
,
engineerCode
);
// 过滤掉已经取消的订单
lqw
.
eq
(
OrderInfo:
:
getOrderStatus
,
"NORMAL"
);
if
(
o
.
getStatus
().
equals
(
"NOT_ASSIGNED"
)
||
o
.
getStatus
().
equals
(
"CANCELED"
))
{
lqw
.
in
(
OrderInfo:
:
getAppointmentStatus
,
List
.
of
(
"PRE"
,
"CONFIRM"
));
continue
;
List
<
OrderInfo
>
appointments
=
orderInfoMPDao
.
selectList
(
lqw
);
}
if
(
appointments
.
isEmpty
()){
orderIds
.
add
(
o
.
getOrderId
());
}
if
(
orderIds
.
isEmpty
()){
return
orderSegments
;
return
orderSegments
;
}
}
for
(
OrderInfo
o:
appointments
)
{
Map
<
String
,
List
<
OrderAppointment
>>
m
=
appointments
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderAppointment:
:
getOrderId
));
List
<
OrderRequest
>
orderRequests
=
orderRequestMPDao
.
selectByOrderIds
(
orderIds
);
for
(
OrderRequest
o:
orderRequests
)
{
List
<
OrderAppointment
>
tmp
=
m
.
getOrDefault
(
o
.
getOrderId
(),
new
ArrayList
<>());
if
(
tmp
.
isEmpty
())
{
continue
;
}
OrderAppointment
oa
=
tmp
.
get
(
0
);
OrderSegment
seg
=
new
OrderSegment
();
OrderSegment
seg
=
new
OrderSegment
();
seg
.
setOrderId
(
o
.
getOrderId
());
seg
.
setOrderId
(
o
.
getOrderId
());
seg
.
setX
(
Double
.
parseDouble
(
o
.
getX
()));
seg
.
setX
(
Double
.
parseDouble
(
o
.
getX
()));
seg
.
setY
(
Double
.
parseDouble
(
o
.
getY
()));
seg
.
setY
(
Double
.
parseDouble
(
o
.
getY
()));
seg
.
setStart
(
this
.
timestamp2Point
(
o
a
.
getExpect
StartTime
()));
seg
.
setStart
(
this
.
timestamp2Point
(
o
.
getPlan
StartTime
()));
seg
.
setEnd
(
this
.
timestamp2Point
(
o
a
.
getExpect
EndTime
()));
seg
.
setEnd
(
this
.
timestamp2Point
(
o
.
getPlan
EndTime
()));
orderSegments
.
add
(
seg
);
orderSegments
.
add
(
seg
);
}
}
...
...
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