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 6abb93c3
authored
Nov 30, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:后续工程师工单添加辅助工程师校验
1 parent
046915fe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
10 deletions
project-order/src/main/java/com/dituhui/pea/order/dao/OrderInfoDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/DispatchEngineerOrderListResp.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dao/OrderInfoDao.java
View file @
6abb93c
...
...
@@ -19,6 +19,8 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
List
<
OrderInfoEntity
>
findByDtAndEngineerCodeIn
(
LocalDate
date
,
List
<
String
>
engineerCodes
);
List
<
OrderInfoEntity
>
findByDtAndEngineerCodeSubIn
(
LocalDate
date
,
List
<
String
>
engineerCodes
);
List
<
OrderInfoEntity
>
findByDtAndServiceStatusNotAndEngineerCodeIn
(
LocalDate
date
,
String
serviceSatus
,
List
<
String
>
engineerCodes
);
List
<
OrderInfoEntity
>
findByDtAndEngineerCode
(
LocalDate
date
,
String
engineerCode
);
...
...
project-order/src/main/java/com/dituhui/pea/order/dto/DispatchEngineerOrderListResp.java
View file @
6abb93c
...
...
@@ -100,5 +100,15 @@ public class DispatchEngineerOrderListResp {
private
Integer
isCutoff
=
0
;
private
String
beanTags
;
/**
* 辅助工程师工号
*/
private
String
engineerCodeSub
=
""
;
/**
* 是否是辅助单
*/
private
Boolean
isSub
=
false
;
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
View file @
6abb93c
...
...
@@ -10,7 +10,6 @@ import com.dituhui.pea.order.common.TimeUtils;
import
com.dituhui.pea.order.common.jackson.JsonUtil
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.dto.param.CapacityQueryDTO
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.*
;
import
com.dituhui.pea.order.service.CommonService
;
...
...
@@ -172,9 +171,9 @@ public class DispatchServiceImpl implements DispatchService {
}
// 获取engineerCodes
List
<
String
>
engineerCodes
=
engineers
.
stream
().
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
Set
<
String
>
skillGroupCodes
=
Sets
.
newConcurrentHashSet
();
if
(
CollectionUtils
.
isNotEmpty
(
reqDTO
.
getOrderIds
()))
{
List
<
OrderInfoEntity
>
infoEntities
=
orderInfoDao
.
findAllByOrderIdIn
(
reqDTO
.
getOrderIds
());
Set
<
String
>
skillGroupCodes
=
Sets
.
newConcurrentHashSet
();
for
(
OrderInfoEntity
orderInfo
:
infoEntities
)
{
//查询对应的技能信息
SkillInfoEntity
skill
=
skillInfo
.
get
(
String
.
format
(
"%s%s%s"
,
orderInfo
.
getBrand
(),
orderInfo
.
getType
(),
orderInfo
.
getSkill
()));
...
...
@@ -183,11 +182,12 @@ public class DispatchServiceImpl implements DispatchService {
}
skillGroupCodes
.
add
(
skill
.
getSkillGroupCode
());
}
engineerCodes
=
handleEngineerLeave
(
engineerCodes
,
date
,
skillGroupCodes
);
}
engineerCodes
=
handleEngineerLeave
(
engineerCodes
,
date
,
skillGroupCodes
);
// 获取技术员已指派单列表
Map
<
String
,
List
<
OrderInfoEntity
>>
engineerOrders
=
this
.
queryEngineerOrders
(
engineerCodes
,
date
);
Map
<
String
,
List
<
OrderInfoEntity
>>
subEngineerOrders
=
this
.
querySubEngineerOrders
(
engineerCodes
,
date
);
// 获取技术员的容量
HashMap
<
String
,
CapacityEngineerStatEntity
>
engineerCap
=
this
.
queryCapacityEngineerStat
(
engineerCodes
,
reqDTO
.
getDate
());
...
...
@@ -202,8 +202,10 @@ public class DispatchServiceImpl implements DispatchService {
// 技术员已指派的订单列表
List
<
OrderInfoEntity
>
records
=
engineerOrders
.
getOrDefault
(
e
.
getEngineerCode
(),
new
ArrayList
<>());
List
<
OrderInfoEntity
>
subRecords
=
subEngineerOrders
.
getOrDefault
(
e
.
getEngineerCode
(),
new
ArrayList
<>());
records
.
addAll
(
subRecords
);
for
(
OrderInfoEntity
o
:
records
)
{
addOrderToItems
(
o
,
items
,
skillInfo
,
true
);
addOrderToItems
(
o
,
items
,
skillInfo
,
true
,
e
.
getEngineerCode
()
);
}
// 获取容量
...
...
@@ -245,9 +247,11 @@ public class DispatchServiceImpl implements DispatchService {
private
List
<
String
>
handleEngineerLeave
(
List
<
String
>
engineerCodes
,
LocalDate
targetDate
,
Set
<
String
>
skillGroupCodes
)
{
List
engineerCodes2
=
new
ArrayList
();
for
(
String
engineerCode
:
engineerCodes
)
{
List
skilllEngineerCodes
=
engineerInfoDao
.
findByEngineerCodesBySkillCodes
(
engineerCode
,
skillGroupCodes
);
if
(
skilllEngineerCodes
.
size
()
<
skillGroupCodes
.
size
())
{
continue
;
if
(
CollectionUtils
.
isNotEmpty
(
skillGroupCodes
))
{
List
skilllEngineerCodes
=
engineerInfoDao
.
findByEngineerCodesBySkillCodes
(
engineerCode
,
skillGroupCodes
);
if
(
skilllEngineerCodes
.
size
()
<
skillGroupCodes
.
size
())
{
continue
;
}
}
//获取工作队休息时间, 判定目标时间是否在工作队休息日中
if
(!
engineerCalendarService
.
engineerTargetLeave
(
engineerCode
,
targetDate
))
{
...
...
@@ -257,7 +261,7 @@ public class DispatchServiceImpl implements DispatchService {
return
engineerCodes2
;
}
private
void
addOrderToItems
(
OrderInfoEntity
o
,
List
<
DispatchEngineerOrderListResp
.
OrderInfo
>
items
,
HashMap
<
String
,
SkillInfoEntity
>
skillInfo
,
boolean
isContinue
)
{
private
void
addOrderToItems
(
OrderInfoEntity
o
,
List
<
DispatchEngineerOrderListResp
.
OrderInfo
>
items
,
HashMap
<
String
,
SkillInfoEntity
>
skillInfo
,
boolean
isContinue
,
String
engineerCode
)
{
DispatchEngineerOrderListResp
.
OrderInfo
item
=
new
DispatchEngineerOrderListResp
.
OrderInfo
();
item
.
setOrderId
(
o
.
getOrderId
());
item
.
setDescription
(
String
.
format
(
"%s:%s-%s-%s\n%s:%s-%s-%s"
,
o
.
getOrderId
(),
o
.
getBrand
(),
o
.
getType
(),
...
...
@@ -309,11 +313,15 @@ public class DispatchServiceImpl implements DispatchService {
item
.
setIsSpecialTime
(
o
.
getIsSpecialTime
());
item
.
setIsCutoff
(
o
.
getIsCutoff
());
item
.
setBeanTags
(
o
.
getBeanTags
());
item
.
setEngineerCodeSub
(
o
.
getEngineerCodeSub
());
if
(
StringUtils
.
isNotBlank
(
o
.
getEngineerCodeSub
())
&&
o
.
getIsMultiple
()
==
1
&&
o
.
getEngineerCodeSub
().
equals
(
engineerCode
))
{
item
.
setIsSub
(
true
);
}
if
(
isContinue
&&
StringUtils
.
isNotEmpty
(
o
.
getMultipleOrders
()))
{
List
<
OrderInfoEntity
>
byMultipleOrders
=
orderInfoDao
.
findByMultipleOrdersAndOrderIdNot
(
o
.
getMultipleOrders
(),
o
.
getOrderId
());
List
<
DispatchEngineerOrderListResp
.
OrderInfo
>
multipleItems
=
new
ArrayList
<>();
for
(
OrderInfoEntity
info
:
byMultipleOrders
)
{
addOrderToItems
(
info
,
multipleItems
,
skillInfo
,
false
);
addOrderToItems
(
info
,
multipleItems
,
skillInfo
,
false
,
engineerCode
);
}
item
.
setMultipleOrderList
(
multipleItems
);
}
...
...
@@ -651,7 +659,6 @@ public class DispatchServiceImpl implements DispatchService {
private
Map
<
String
,
List
<
OrderInfoEntity
>>
queryEngineerOrders
(
List
<
String
>
engineerCodes
,
LocalDate
date
)
{
// 获取工程师服务单列表
List
<
OrderInfoEntity
>
records
=
orderInfoDao
.
findByDtAndEngineerCodeIn
(
date
,
engineerCodes
);
// 排序
records
.
sort
(
Comparator
.
comparing
(
OrderInfoEntity:
:
getEngineerCode
));
records
.
sort
(
Comparator
.
comparing
(
OrderInfoEntity:
:
getPlanStartTime
));
...
...
@@ -665,6 +672,23 @@ public class DispatchServiceImpl implements DispatchService {
}
private
Map
<
String
,
List
<
OrderInfoEntity
>>
querySubEngineerOrders
(
List
<
String
>
engineerCodes
,
LocalDate
date
)
{
// 获取工程师服务单列表
List
<
OrderInfoEntity
>
subRecords
=
orderInfoDao
.
findByDtAndEngineerCodeSubIn
(
date
,
engineerCodes
);
// 排序
subRecords
.
sort
(
Comparator
.
comparing
(
OrderInfoEntity:
:
getEngineerCode
));
subRecords
.
sort
(
Comparator
.
comparing
(
OrderInfoEntity:
:
getPlanStartTime
));
//过滤
List
<
OrderInfoEntity
>
orders
=
subRecords
.
stream
()
.
filter
(
r
->
!
r
.
getOrderStatus
().
equals
(
OrderStatusEnum
.
CANCELED
))
.
collect
(
Collectors
.
toList
());
return
orders
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderInfoEntity:
:
getEngineerCodeSub
));
}
public
List
<
EngineerInfoEntity
>
queryEngineers
(
List
<
String
>
teamIds
,
List
<
String
>
engineerCodes
,
String
key
)
{
CriteriaBuilder
criteriaBuilder
=
entityManager
.
getCriteriaBuilder
();
CriteriaQuery
<
EngineerInfoEntity
>
criteriaQuery
=
criteriaBuilder
.
createQuery
(
EngineerInfoEntity
.
class
);
...
...
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