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 a55dfd99
authored
Nov 20, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:工单列表返回添加工程师出发地
1 parent
5d7a522a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
19 deletions
project-order/src/main/java/com/dituhui/pea/order/dto/OrderServiceList.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceListServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrderServiceList.java
View file @
a55dfd9
...
...
@@ -107,4 +107,19 @@ public class OrderServiceList {
private
String
planStartTime
;
private
String
planEndTime
;
/**
* 常规出发地,1配件仓,2家庭住址,3工作地址 默认工作地址
*/
private
Integer
departure
;
/**
* 出发地点x
*/
private
String
departureX
;
/**
* 出发地点y
*/
private
String
departureY
;
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceListServiceImpl.java
View file @
a55dfd9
...
...
@@ -8,6 +8,7 @@ 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.EngineerBusinessListResp
;
import
com.dituhui.pea.order.dto.OrderServiceList
;
import
com.dituhui.pea.order.dto.OrderServiceListReq
;
import
com.dituhui.pea.order.dto.OrderServiceListResp
;
...
...
@@ -37,6 +38,12 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
@Autowired
private
OrderInfoDao
orderInfoDao
;
@Autowired
private
EngineerBusinessDao
engineerBusinessDao
;
@Autowired
private
OrgWarehouseInfoDao
orgWarehouseInfoDao
;
@Transactional
@Override
public
Result
<
OrderServiceListResp
>
getOrderServiceList
(
OrderServiceListReq
reqDTO
)
throws
BusinessException
{
...
...
@@ -61,17 +68,8 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getTeamIds
()),
OrderInfo:
:
getOrgTeamId
,
reqDTO
.
getTeamIds
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getAppointmentType
()),
OrderInfo:
:
getAppointmentMethod
,
reqDTO
.
getAppointmentType
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getAppointmentStatus
()),
OrderInfo:
:
getAppointmentStatus
,
reqDTO
.
getAppointmentStatus
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getPriorities
()),
OrderInfo:
:
getBeanPriority
,
reqDTO
.
getPriorities
());
lqw
.
orderByDesc
(
OrderInfo:
:
getCreateTime
);
if
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getPriorities
()))
{
List
<
Integer
>
p
=
reqDTO
.
getPriorities
();
if
(
p
.
contains
(
0
)
&&
p
.
contains
(
1
))
{
lqw
.
ge
(
OrderInfo:
:
getPriority
,
1
);
}
else
if
(
p
.
contains
(
0
)
&&
!
p
.
contains
(
1
))
{
lqw
.
le
(
OrderInfo:
:
getPriority
,
1
);
}
else
if
(
p
.
contains
(
1
)
&&
!
p
.
contains
(
0
))
{
lqw
.
ge
(
OrderInfo:
:
getPriority
,
5
);
}
}
if
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getEngineerCodes
()))
{
lqw
.
and
(
w
->
...
...
@@ -105,7 +103,9 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
List
<
OrderInfo
>
orders
=
pg
.
getRecords
();
// 获取技术员姓名
Map
<
String
,
String
>
engineerNames
=
this
.
getEngineerNames
(
orders
);
Map
<
String
,
EngineerInfoEntity
>
engineerNames
=
this
.
getEngineerNames
(
orders
);
// 获取技术员业务信息
Map
<
String
,
EngineerBusinessEntity
>
engineerBusiness
=
this
.
getEngineerBusiness
(
engineerNames
);
// 获取branch
Map
<
String
,
String
>
branchNames
=
this
.
getBranchNames
(
orders
);
...
...
@@ -134,6 +134,12 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
List
<
String
>
names
=
this
.
getOrderEngineerNames
(
o
.
getEngineerCode
(),
o
.
getEngineerCodeSub
(),
engineerNames
);
record
.
setEngineerNum
(
names
.
size
());
//工程师数量
record
.
setEngineerNames
(
String
.
join
(
"、"
,
names
));
//工程师姓名列表
if
(
engineerBusiness
.
containsKey
(
o
.
getEngineerCode
()))
{
EngineerBusinessEntity
businessEntity
=
engineerBusiness
.
get
(
o
.
getEngineerCode
());
record
.
setDepartureX
(
businessEntity
.
getX
());
record
.
setDepartureY
(
businessEntity
.
getY
());
record
.
setDeparture
(
businessEntity
.
getDeparture
());
}
}
record
.
setExpectTimeBegin
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getExpectTimeBegin
()));
...
...
@@ -169,7 +175,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
List
<
OrderInfoEntity
>
byMultipleOrders
=
orderInfoDao
.
findByMultipleOrdersAndOrderIdNot
(
o
.
getMultipleOrders
(),
o
.
getOrderId
());
List
<
OrderServiceList
>
multipleItems
=
new
ArrayList
<>();
for
(
OrderInfoEntity
info
:
byMultipleOrders
)
{
multipleItems
.
add
(
toMultipleOrders
(
info
,
branchNames
,
engineerNames
));
multipleItems
.
add
(
toMultipleOrders
(
info
,
branchNames
,
engineerNames
,
engineerBusiness
));
}
record
.
setMultipleOrderList
(
multipleItems
);
}
...
...
@@ -187,7 +193,47 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
return
Result
.
success
(
res
);
}
private
OrderServiceList
toMultipleOrders
(
OrderInfoEntity
o
,
Map
<
String
,
String
>
branchNames
,
Map
<
String
,
String
>
engineerNames
)
{
/**
* 获取团队配件仓地址
*
* @param orders
* @return
*/
private
Map
<
String
,
OrgWarehouseInfoEntity
>
getTeamWarehouseInfo
(
List
<
OrderInfo
>
orders
)
{
Map
<
String
,
OrgWarehouseInfoEntity
>
orgWarehouseInfoEntityMap
=
new
HashMap
<>();
for
(
OrderInfo
r
:
orders
)
{
if
(
StringUtils
.
isEmpty
(
r
.
getOrgTeamId
()))
{
continue
;
}
if
(
orgWarehouseInfoEntityMap
.
containsKey
(
r
.
getOrgTeamId
()))
{
continue
;
}
OrgWarehouseInfoEntity
byTeamAssigned
=
orgWarehouseInfoDao
.
getByTeamAssigned
(
r
.
getOrgTeamId
());
if
(
ObjectUtil
.
isNull
(
byTeamAssigned
))
{
continue
;
}
orgWarehouseInfoEntityMap
.
put
(
r
.
getOrgTeamId
(),
byTeamAssigned
);
}
return
orgWarehouseInfoEntityMap
;
}
private
Map
<
String
,
EngineerBusinessEntity
>
getEngineerBusiness
(
Map
<
String
,
EngineerInfoEntity
>
engineerNames
)
{
// 获取技术员姓名
Set
<
String
>
engineerCodes
=
new
HashSet
<>();
for
(
String
engineerCode
:
engineerNames
.
keySet
())
{
if
(
StringUtils
.
isNotEmpty
(
engineerCode
))
{
engineerCodes
.
add
(
engineerCode
);
}
}
if
(
engineerCodes
.
isEmpty
())
{
return
new
HashMap
<>();
}
List
<
EngineerBusinessEntity
>
engineers
=
engineerBusinessDao
.
findByEngineerCodeIn
(
new
ArrayList
<>(
engineerCodes
));
return
engineers
.
stream
().
collect
(
Collectors
.
toMap
(
EngineerBusinessEntity:
:
getEngineerCode
,
e
->
e
));
}
private
OrderServiceList
toMultipleOrders
(
OrderInfoEntity
o
,
Map
<
String
,
String
>
branchNames
,
Map
<
String
,
EngineerInfoEntity
>
engineerNames
,
Map
<
String
,
EngineerBusinessEntity
>
engineerBusiness
)
{
OrderServiceList
record
=
new
OrderServiceList
();
record
.
setOrderId
(
o
.
getOrderId
());
record
.
setType
(
o
.
getType
());
...
...
@@ -210,6 +256,12 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
List
<
String
>
names
=
this
.
getOrderEngineerNames
(
o
.
getEngineerCode
(),
o
.
getEngineerCodeSub
(),
engineerNames
);
record
.
setEngineerNum
(
names
.
size
());
//工程师数量
record
.
setEngineerNames
(
String
.
join
(
"、"
,
names
));
//工程师姓名列表
if
(
engineerBusiness
.
containsKey
(
o
.
getEngineerCode
()))
{
EngineerBusinessEntity
businessEntity
=
engineerBusiness
.
get
(
o
.
getEngineerCode
());
record
.
setDepartureX
(
businessEntity
.
getX
());
record
.
setDepartureY
(
businessEntity
.
getY
());
record
.
setDeparture
(
businessEntity
.
getDeparture
());
}
}
record
.
setExpectTimeBegin
(
TimeUtils
.
IsoLocalDateTime2String
(
o
.
getExpectTimeBegin
()));
...
...
@@ -232,7 +284,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
return
record
;
}
private
Map
<
String
,
String
>
getEngineerNames
(
List
<
OrderInfo
>
orders
)
{
private
Map
<
String
,
EngineerInfoEntity
>
getEngineerNames
(
List
<
OrderInfo
>
orders
)
{
// 获取技术员姓名
Set
<
String
>
engineerCodes
=
new
HashSet
<>();
for
(
OrderInfo
r
:
orders
)
{
...
...
@@ -247,7 +299,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
return
new
HashMap
<>();
}
List
<
EngineerInfoEntity
>
engineers
=
engineerInfoDao
.
findByEngineerCodeIn
(
new
ArrayList
<>(
engineerCodes
));
return
engineers
.
stream
().
collect
(
Collectors
.
toMap
(
EngineerInfoEntity:
:
getEngineerCode
,
EngineerInfoEntity:
:
getNam
e
));
return
engineers
.
stream
().
collect
(
Collectors
.
toMap
(
EngineerInfoEntity:
:
getEngineerCode
,
e
->
e
));
}
private
Map
<
String
,
String
>
getBranchNames
(
List
<
OrderInfo
>
orders
)
{
...
...
@@ -265,7 +317,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
return
records
.
stream
().
collect
(
Collectors
.
toMap
(
OrgBranchEntity:
:
getBranchId
,
OrgBranchEntity:
:
getBranchName
));
}
private
List
<
String
>
getOrderEngineerNames
(
String
engineerCode
,
String
engineerCodeSub
,
Map
<
String
,
String
>
engineerNames
)
{
private
List
<
String
>
getOrderEngineerNames
(
String
engineerCode
,
String
engineerCodeSub
,
Map
<
String
,
EngineerInfoEntity
>
engineerNames
)
{
// 获取订单技术员姓名信息
List
<
String
>
names
=
new
ArrayList
<>();
List
<
String
>
codes
=
new
ArrayList
<>()
{
...
...
@@ -275,9 +327,9 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
}
};
for
(
String
code
:
codes
)
{
String
name
=
engineerNames
.
getOrDefault
(
code
,
""
);
if
(
StringUtils
.
isNotEmpty
(
name
))
{
names
.
add
(
name
);
EngineerInfoEntity
engineerInfo
=
engineerNames
.
getOrDefault
(
code
,
null
);
if
(
ObjectUtil
.
isNotNull
(
engineerInfo
))
{
names
.
add
(
engineerInfo
.
getName
()
);
}
}
return
names
;
...
...
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