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 7b2db42d
authored
Jul 25, 2023
by
张晓
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://gitlab.dituhui.com/bsh/project/project
into develop
2 parents
9cb3db32
dc59e8c0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
43 deletions
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerGanttServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
project-order/src/main/java/com/dituhui/pea/order/common/OrderAssignCheck.java
View file @
7b2db42
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.entity.*
;
import
lombok.Data
;
...
...
@@ -21,11 +22,6 @@ import java.util.stream.Collectors;
@Component
@Slf4j
public
class
OrderAssignCheck
{
@Autowired
OrderRequestMPDao
orderRequestMPDao
;
@Autowired
OrderAppointmentMPDao
orderAppointmentMPDao
;
@Autowired
SkillInfoMPDao
skillInfoMPDao
;
...
...
@@ -39,6 +35,9 @@ public class OrderAssignCheck {
@Autowired
OrgGroupMPDao
orgGroupMPDao
;
@Autowired
OrderInfoMPDao
orderInfoMPDao
;
@Data
public
class
Result
{
private
Boolean
canAssign
;
...
...
@@ -63,7 +62,7 @@ public class OrderAssignCheck {
public
Result
orderAssignCheck
(
String
orderId
,
String
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
curY
=
Double
.
parseDouble
(
order
.
getY
());
...
...
@@ -142,33 +141,22 @@ public class OrderAssignCheck {
private
List
<
OrderSegment
>
getEngineerOrderSegments
(
String
engineerCode
,
LocalDate
dt
)
{
List
<
OrderSegment
>
orderSegments
=
new
ArrayList
<>();
List
<
OrderAppointment
>
appointments
=
orderAppointmentMPDao
.
selectByEngineerCodeAndDt
(
engineerCode
,
dt
);
List
<
String
>
orderIds
=
new
ArrayList
<>();
for
(
OrderAppointment
o:
appointments
)
{
// 过滤掉已经取消的订单
if
(
o
.
getStatus
().
equals
(
"NOT_ASSIGNED"
)
||
o
.
getStatus
().
equals
(
"CANCELED"
))
{
continue
;
}
orderIds
.
add
(
o
.
getOrderId
());
}
if
(
orderIds
.
isEmpty
()){
LambdaQueryWrapper
<
OrderInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
OrderInfo:
:
getDt
,
dt
);
lqw
.
eq
(
OrderInfo:
:
getEngineerCode
,
engineerCode
);
lqw
.
eq
(
OrderInfo:
:
getOrderStatus
,
"NORMAL"
);
lqw
.
in
(
OrderInfo:
:
getAppointmentStatus
,
List
.
of
(
"PRE"
,
"CONFIRM"
));
List
<
OrderInfo
>
appointments
=
orderInfoMPDao
.
selectList
(
lqw
);
if
(
appointments
.
isEmpty
()){
return
orderSegments
;
}
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
);
for
(
OrderInfo
o:
appointments
)
{
OrderSegment
seg
=
new
OrderSegment
();
seg
.
setOrderId
(
o
.
getOrderId
());
seg
.
setX
(
Double
.
parseDouble
(
o
.
getX
()));
seg
.
setY
(
Double
.
parseDouble
(
o
.
getY
()));
seg
.
setStart
(
this
.
timestamp2Point
(
o
a
.
getExpect
StartTime
()));
seg
.
setEnd
(
this
.
timestamp2Point
(
o
a
.
getExpect
EndTime
()));
seg
.
setStart
(
this
.
timestamp2Point
(
o
.
getPlan
StartTime
()));
seg
.
setEnd
(
this
.
timestamp2Point
(
o
.
getPlan
EndTime
()));
orderSegments
.
add
(
seg
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerGanttServiceImpl.java
View file @
7b2db42
...
...
@@ -24,10 +24,8 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
@Autowired
private
CapacityEngineerStatDao
capacityEngineerStatDao
;
@Autowired
private
EngineerInfoDao
engineerInfoDao
;
@Autowired
private
EngineerUtils
engineerUtils
;
@Autowired
...
...
@@ -38,9 +36,11 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
private
String
getHourMinute
(
LocalDateTime
time
){
return
this
.
getHourMinute
(
time
,
0
);
}
private
String
getHourMinute
(
LocalDateTime
time
,
int
deltaMinute
){
return
DateUtils
.
formatDateTime
(
time
.
plusMinutes
(
deltaMinute
),
"HH:mm"
);
}
@Override
public
Result
<?>
getEngineersGanttList
(
EngineersGanttDTO
.
Request
reqDTO
)
{
// 按日期返回技术员们当天的服务甘特图,不需要翻页
...
...
@@ -59,8 +59,13 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
EngineersGanttDTO
.
Slot
slot
=
new
EngineersGanttDTO
.
Slot
();
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
slot
.
setOrderId
(
e
.
getOrderId
());
slot
.
setBtime
(
getHourMinute
(
e
.
getPlanStartTime
()));
slot
.
setEtime
(
getHourMinute
(
e
.
getPlanEndTime
()));
if
(
checkOrderIsFinish
(
e
.
getServiceStatus
()))
{
slot
.
setBtime
(
getHourMinute
(
e
.
getActualStartTime
()));
slot
.
setEtime
(
getHourMinute
(
e
.
getActualEndTime
()));
}
else
{
slot
.
setBtime
(
getHourMinute
(
e
.
getPlanStartTime
()));
slot
.
setEtime
(
getHourMinute
(
e
.
getPlanEndTime
()));
}
slot
.
setTooltip
(
getOrderTips
(
e
.
getOrderId
()));
OrderSkillProjection
orderSkill
=
orderInfoDao
.
getOrderSkillCaptionByOrderId
(
e
.
getOrderId
());
if
(
orderSkill
!=
null
)
{
...
...
@@ -78,8 +83,13 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
if
(
e
.
getArriveElapsed
()
>
0
)
{
// 有在途,起止时间,分别是订单的开始时间减去在途时间、订单的开始时间
slot
=
new
EngineersGanttDTO
.
Slot
();
slot
.
setBtime
(
getHourMinute
(
e
.
getPlanStartTime
(),
-
e
.
getArriveElapsed
()));
slot
.
setEtime
(
getHourMinute
(
e
.
getPlanStartTime
()));
if
(
checkOrderIsFinish
(
e
.
getServiceStatus
()))
{
slot
.
setBtime
(
getHourMinute
(
e
.
getActualStartTime
(),
-
e
.
getArriveElapsed
()));
slot
.
setEtime
(
getHourMinute
(
e
.
getActualStartTime
()));
}
else
{
slot
.
setBtime
(
getHourMinute
(
e
.
getPlanStartTime
(),
-
e
.
getArriveElapsed
()));
slot
.
setEtime
(
getHourMinute
(
e
.
getPlanStartTime
()));
}
slot
.
setShapeSize
(
"mini"
);
slot
.
setBgColor
(
getColor
(
"ONWAY"
));
slots
.
add
(
slot
);
...
...
@@ -150,12 +160,6 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
}
}
public
Map
<
String
,
OrderInfoEntity
>
getOrdersByOrderIds
(
List
<
String
>
orderIds
)
{
List
<
OrderInfoEntity
>
orders
=
orderInfoDao
.
findAllByOrderIdIn
(
orderIds
);
return
orders
.
stream
().
collect
(
Collectors
.
toMap
(
OrderInfoEntity:
:
getOrderId
,
order
->
order
));
}
private
List
<
LabelValueDTO
>
getOrderTips
(
String
orderId
)
{
// log.info("==> getOrderTips: orderId[{}]", orderId);
OrderInfoEntity
order
=
orderInfoDao
.
getByOrderId
(
orderId
);
...
...
@@ -174,6 +178,10 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
return
tips
;
}
private
boolean
checkOrderIsFinish
(
String
serviceStatus
){
String
[]
array
=
{
"FINISHED"
,
"UNFINISHED"
};
return
Arrays
.
asList
(
array
).
contains
(
serviceStatus
);
}
private
String
getColor
(
String
colorType
){
String
[][]
bgColor
=
{
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
7b2db42
...
...
@@ -149,7 +149,7 @@ public class OrderAssignImpl implements OrderAssign {
Timestamp
planStartTime
=
Timestamp
.
valueOf
(
result
.
getStart
());
Timestamp
planEndTime
=
Timestamp
.
valueOf
(
result
.
getEnd
());
// 更新order_
request
表状态
// 更新order_
info
表状态
LambdaUpdateWrapper
<
OrderInfo
>
wrapper
=
new
LambdaUpdateWrapper
<>();
wrapper
.
set
(
OrderInfo:
:
getAppointmentStatus
,
"CONFIRM"
);
wrapper
.
set
(
OrderInfo:
:
getAppointmentMethod
,
"MANUAL"
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
View file @
7b2db42
...
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.order.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.common.ListUtils
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.*
;
...
...
@@ -127,11 +128,18 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
Comparator
<
OrderInfo
>
dtDesc
=
Comparator
.
comparing
(
OrderInfo:
:
getDt
).
reversed
();
List
<
OrderInfo
>
results
=
orders
.
stream
().
sorted
(
dtDesc
).
collect
(
Collectors
.
toList
());
LocalDate
lastDt
=
results
.
get
(
0
).
getDt
();
LocalDate
lastDt
=
results
.
get
(
0
).
getDt
();
//最新预约
List
<
OrderAppointmentListResp
.
OrderAppointment
>
items
=
new
ArrayList
<>();
for
(
OrderInfo
o
:
results
)
{
EngineerInfo
eg
=
egInfo
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
if
(
eg
==
null
)
{
log
.
warn
(
"未获得工程师{}基础信息, 订单:{}"
,
o
.
getEngineerCode
(),
o
.
getOrderId
());
continue
;
}
String
skill
=
egSkill
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
if
(
skill
==
null
)
{
log
.
warn
(
"未获得工程师{}基础技能, 订单:{}"
,
o
.
getEngineerCode
(),
o
.
getOrderId
());
}
// 获取工程师姓名
String
engineerName
=
(
eg
!=
null
)
?
eg
.
getName
()
:
o
.
getEngineerCode
();
...
...
@@ -146,7 +154,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
item
.
setTitle
(
title
);
item
.
setEngineerCode
(
o
.
getEngineerCode
());
item
.
setExpectTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getExpectTimeBegin
()));
item
.
setTimelines
(
this
.
packOrderTimeline
(
timelines
.
get
(
o
.
getSubId
()
)));
item
.
setTimelines
(
this
.
packOrderTimeline
(
timelines
.
get
OrDefault
(
o
.
getSubId
(),
null
)));
item
.
setItems
(
this
.
packEngineerItems
(
eg
,
skill
,
groups
.
get
(
eg
.
getGroupId
())));
items
.
add
(
item
);
...
...
@@ -365,7 +373,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
private
List
<
KV
>
packOrderTimeline
(
List
<
OrderTimeline
>
timelines
)
{
List
<
KV
>
items
=
new
ArrayList
<>();
if
(
timelines
==
null
)
{
if
(
ListUtils
.
isEmpty
(
timelines
))
{
return
items
;
}
for
(
OrderTimeline
o
:
timelines
)
{
...
...
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