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 f66f8cf9
authored
Jul 10, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
技术员日历、技术员甘特图剥离到独立的service实现中
1 parent
5706bb32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
77 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerServiceImpl.java
View file @
f66f8cf
...
...
@@ -477,81 +477,4 @@ public class EngineerServiceImpl implements EngineerService {
return
(
age
<=
0
)
?
""
:
Integer
.
toString
(
age
);
}
@Override
public
Result
<?>
getEngineersGanttList
(
EngineersGanttReqDTO
reqDTO
)
{
// 按日期返回技术员们当天的服务甘特图,不需要翻页
log
.
info
(
"getEngineersGanttList: {}"
,
reqDTO
);
List
<
OrderAppointmentEntity
>
orderAppointments
=
orderAppointmentDao
.
findByDateAndEngineerCodeIn
(
reqDTO
.
getDate
(),
reqDTO
.
getEngineerCodes
());
List
<
String
>
orderIds
=
orderAppointments
.
stream
().
map
(
OrderAppointmentEntity:
:
getOrderId
).
collect
(
Collectors
.
toList
());
Map
<
String
,
OrderRequestEntity
>
mapOrderRequest
=
getOrdersByOrderIds
(
orderIds
);
HashMap
<
String
,
List
<
EngineersGanttRespDTO
.
Order
>>
mapEngineers
=
new
HashMap
<>();
for
(
OrderAppointmentEntity
e
:
orderAppointments
)
{
log
.
info
(
"===== order_id: [{}]"
,
e
.
getOrderId
());
EngineersGanttRespDTO
.
Order
order
=
new
EngineersGanttRespDTO
.
Order
();
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
order
.
setStartTime
(
e
.
getExpectStartTime
()).
setEndTime
(
e
.
getExpectEndTime
());
order
.
setOrderId
(
e
.
getOrderId
()).
setPreStatus
(
e
.
getPreStatus
());
order
.
setTips
(
getOrderTips
(
e
.
getOrderId
()));
order
.
setAppointmentStatus
(
mapOrderRequest
.
get
(
e
.
getOrderId
()).
getAppointmentStatus
());
List
<
EngineersGanttRespDTO
.
Order
>
orders
=
null
;
if
(
mapEngineers
.
containsKey
(
e
.
getEngineerCode
()))
{
orders
=
mapEngineers
.
get
(
e
.
getEngineerCode
());
}
else
{
orders
=
new
ArrayList
<>();
}
orders
.
add
(
order
);
mapEngineers
.
put
(
e
.
getEngineerCode
(),
orders
);
}
List
<
EngineersGanttRespDTO
.
GanttChart
>
engineers
=
new
ArrayList
<>();
for
(
String
engineerCode
:
reqDTO
.
getEngineerCodes
())
{
EngineerInfoEntity
engineerInfo
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
EngineersGanttRespDTO
.
GanttChart
engineer
=
new
EngineersGanttRespDTO
.
GanttChart
();
engineer
.
setEngineerCode
(
engineerCode
)
.
setStartTime
(
String
.
format
(
"%s 08:00"
,
reqDTO
.
getDate
()))
.
setEndTime
(
String
.
format
(
"%s 18:00"
,
reqDTO
.
getDate
()))
.
setHoliday
(
false
)
// todo
.
setEngineerName
(
engineerInfo
.
getName
())
.
setGrade
(
engineerInfo
.
getGrade
());
CapacityEngineerStatEntity
capacityEngineerStat
=
capacityEngineerStatDao
.
getByEngineerCodeAndWorkday
(
engineerCode
,
reqDTO
.
getDate
());
if
(
capacityEngineerStat
==
null
)
{
log
.
warn
(
"技术员当日的容量数据不存在,{}{}"
,
engineerCode
,
reqDTO
.
getDate
());
}
else
{
engineer
.
setCapTotal
(
capacityEngineerStat
.
getCapTotal
().
toString
()).
setCapUsed
(
capacityEngineerStat
.
getCapUsed
().
toString
());
}
if
(
mapEngineers
.
containsKey
(
engineerCode
))
{
engineer
.
setOrders
(
mapEngineers
.
get
(
engineerCode
));
}
// engineer.setErrorTip(); todo
engineers
.
add
(
engineer
);
}
EngineersGanttRespDTO
data
=
new
EngineersGanttRespDTO
().
setDate
(
reqDTO
.
getDate
()).
setEngineers
(
engineers
);
return
Result
.
success
(
data
);
}
public
Map
<
String
,
OrderRequestEntity
>
getOrdersByOrderIds
(
List
<
String
>
orderIds
)
{
List
<
OrderRequestEntity
>
orders
=
orderRequestDao
.
findAllByOrderIdIn
(
orderIds
);
return
orders
.
stream
()
.
collect
(
Collectors
.
toMap
(
OrderRequestEntity:
:
getOrderId
,
order
->
order
));
}
private
List
<?>
getOrderTips
(
String
orderId
)
{
log
.
info
(
"==> getOrderTips: orderId[{}]"
,
orderId
);
OrderRequestEntity
order
=
orderRequestDao
.
getByOrderId
(
orderId
);
if
(
order
==
null
)
{
log
.
error
(
"对应的订单不存在!{}"
,
orderId
);
return
null
;
}
List
<
LabelValueDTO
>
tips
=
new
ArrayList
<>();
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"工单号码"
).
setValue
(
orderId
));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"类型/品牌"
).
setValue
(
String
.
format
(
"%s %s"
,
order
.
getBrand
(),
order
.
getType
())));
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"电话/地址"
).
setValue
(
String
.
format
(
"%s %s\n %s"
,
order
.
getName
(),
order
.
getPhone
(),
order
.
getAddress
())));
if
(
StringUtils
.
isNotBlank
(
order
.
getApplyNote
()))
{
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"备注"
).
setValue
(
order
.
getApplyNote
()));
}
tips
.
add
(
new
LabelValueDTO
().
setLabel
(
"标签"
).
setValue
(
order
.
getTags
()));
return
tips
;
}
}
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