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 6bfb64f6
authored
Jun 14, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-dingwf-mvp616' into develop
2 parents
fbc19f0f
72c9a5b2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
12 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderAppointmentDao.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderRequestDao.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/WorkbenchServiceImpl.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderAppointmentDao.java
View file @
6bfb64f
...
@@ -9,5 +9,5 @@ import java.util.List;
...
@@ -9,5 +9,5 @@ import java.util.List;
public
interface
OrderAppointmentDao
extends
JpaRepository
<
OrderAppointmentEntity
,
Integer
>
{
public
interface
OrderAppointmentDao
extends
JpaRepository
<
OrderAppointmentEntity
,
Integer
>
{
@Query
(
"from OrderAppointmentEntity a where DATE_FORMAT(a.expectStartTime, '%Y-%m-%d') = :date and a.engineerCode in :engineerCodes"
)
@Query
(
"from OrderAppointmentEntity a where DATE_FORMAT(a.expectStartTime, '%Y-%m-%d') = :date and a.engineerCode in :engineerCodes"
)
List
<
?
>
findByDateAndEngineerCodeIn
(
String
date
,
List
<?>
engineerCodes
);
List
<
OrderAppointmentEntity
>
findByDateAndEngineerCodeIn
(
String
date
,
List
<?>
engineerCodes
);
}
}
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrderRequestDao.java
View file @
6bfb64f
...
@@ -4,8 +4,12 @@ import com.alibaba.cloud.integration.order.entity.OrderRequestEntity;
...
@@ -4,8 +4,12 @@ import com.alibaba.cloud.integration.order.entity.OrderRequestEntity;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
@Repository
public
interface
OrderRequestDao
extends
JpaRepository
<
OrderRequestEntity
,
Long
>
{
public
interface
OrderRequestDao
extends
JpaRepository
<
OrderRequestEntity
,
Long
>
{
OrderRequestEntity
getByOrderId
(
String
orderId
);
OrderRequestEntity
getByOrderId
(
String
orderId
);
List
<
OrderRequestEntity
>
findAllByOrderId
(
List
<
String
>
orderIds
);
}
}
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/WorkbenchServiceImpl.java
View file @
6bfb64f
...
@@ -15,6 +15,8 @@ import org.springframework.data.domain.Pageable;
...
@@ -15,6 +15,8 @@ import org.springframework.data.domain.Pageable;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Slf4j
@Slf4j
@Service
@Service
...
@@ -73,25 +75,26 @@ public class WorkbenchServiceImpl implements WorkbenchService {
...
@@ -73,25 +75,26 @@ public class WorkbenchServiceImpl implements WorkbenchService {
public
Result
<?>
getEngineersGanttList
(
WorkbenchEngineersGanttReqDTO
reqDTO
)
{
public
Result
<?>
getEngineersGanttList
(
WorkbenchEngineersGanttReqDTO
reqDTO
)
{
// 按日期返回技术员们当天的服务甘特图,不需要翻页
// 按日期返回技术员们当天的服务甘特图,不需要翻页
log
.
info
(
"getEngineersGanttList: {}"
,
reqDTO
);
log
.
info
(
"getEngineersGanttList: {}"
,
reqDTO
);
List
<?>
orderAppointments
=
orderAppointmentDao
.
findByDateAndEngineerCodeIn
(
reqDTO
.
getDate
(),
reqDTO
.
getEngineerCodes
());
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
<
WorkbenchEngineersGanttRespDTO
.
Order
>>
mapEngineers
=
new
HashMap
<>();
HashMap
<
String
,
List
<
WorkbenchEngineersGanttRespDTO
.
Order
>>
mapEngineers
=
new
HashMap
<>();
for
(
Object
e
:
orderAppointments
)
{
for
(
OrderAppointmentEntity
e
:
orderAppointments
)
{
OrderAppointmentEntity
entity
=
(
OrderAppointmentEntity
)
e
;
log
.
info
(
"===== order_id: [{}]"
,
e
.
getOrderId
());
log
.
info
(
"===== order_id: [{}]"
,
entity
.
getOrderId
());
WorkbenchEngineersGanttRespDTO
.
Order
order
=
new
WorkbenchEngineersGanttRespDTO
.
Order
();
WorkbenchEngineersGanttRespDTO
.
Order
order
=
new
WorkbenchEngineersGanttRespDTO
.
Order
();
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
order
.
setStartTime
(
e
ntity
.
getExpectStartTime
()).
setEndTime
(
entity
.
getExpectEndTime
());
order
.
setStartTime
(
e
.
getExpectStartTime
()).
setEndTime
(
e
.
getExpectEndTime
());
order
.
setOrderId
(
e
ntity
.
getOrderId
()).
setOrderStatus
(
entity
.
getStatus
());
order
.
setOrderId
(
e
.
getOrderId
()).
setOrderStatus
(
e
.
getStatus
());
order
.
setTips
(
getOrderTips
(
e
ntity
.
getOrderId
()));
order
.
setTips
(
getOrderTips
(
e
.
getOrderId
()));
//todo 查询order-request表,获取 appointment_status字段
order
.
setAppointmentStatus
(
mapOrderRequest
.
get
(
e
.
getOrderId
()).
getAppointmentStatus
());
List
<
WorkbenchEngineersGanttRespDTO
.
Order
>
orders
=
null
;
List
<
WorkbenchEngineersGanttRespDTO
.
Order
>
orders
=
null
;
if
(
mapEngineers
.
containsKey
(
e
ntity
.
getEngineerCode
()))
{
if
(
mapEngineers
.
containsKey
(
e
.
getEngineerCode
()))
{
orders
=
mapEngineers
.
get
(
e
ntity
.
getEngineerCode
());
orders
=
mapEngineers
.
get
(
e
.
getEngineerCode
());
}
else
{
}
else
{
orders
=
new
ArrayList
<>();
orders
=
new
ArrayList
<>();
}
}
orders
.
add
(
order
);
orders
.
add
(
order
);
mapEngineers
.
put
(
e
ntity
.
getEngineerCode
(),
orders
);
mapEngineers
.
put
(
e
.
getEngineerCode
(),
orders
);
}
}
List
<
WorkbenchEngineersGanttRespDTO
.
GanttChart
>
engineers
=
new
ArrayList
<>();
List
<
WorkbenchEngineersGanttRespDTO
.
GanttChart
>
engineers
=
new
ArrayList
<>();
...
@@ -119,6 +122,13 @@ public class WorkbenchServiceImpl implements WorkbenchService {
...
@@ -119,6 +122,13 @@ public class WorkbenchServiceImpl implements WorkbenchService {
return
Result
.
success
(
data
);
return
Result
.
success
(
data
);
}
}
public
Map
<
String
,
OrderRequestEntity
>
getOrdersByOrderIds
(
List
<
String
>
orderIds
)
{
List
<
OrderRequestEntity
>
orders
=
orderRequestDao
.
findAllByOrderId
(
orderIds
);
return
orders
.
stream
()
.
collect
(
Collectors
.
toMap
(
OrderRequestEntity:
:
getOrderId
,
order
->
order
));
}
private
List
<?>
getOrderTips
(
String
orderId
)
{
private
List
<?>
getOrderTips
(
String
orderId
)
{
log
.
info
(
"==> getOrdertips: orderId[{}]"
,
orderId
);
log
.
info
(
"==> getOrdertips: orderId[{}]"
,
orderId
);
OrderRequestEntity
order
=
orderRequestDao
.
getByOrderId
(
orderId
);
OrderRequestEntity
order
=
orderRequestDao
.
getByOrderId
(
orderId
);
...
...
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