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 f70f6c4c
authored
Nov 14, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:工程师列表,甘特图筛选添加订单技能过滤
1 parent
e24f9c0f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
8 deletions
project-order/src/main/java/com/dituhui/pea/order/dao/EngineerInfoDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/DispatchEngineerOrderListReq.java
project-order/src/main/java/com/dituhui/pea/order/dto/EngineersGanttDTO.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerGanttServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dao/EngineerInfoDao.java
View file @
f70f6c4
...
@@ -78,6 +78,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
...
@@ -78,6 +78,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
/**
/**
* 查询在指定技能组中至少满足 skillGroupCodes.size 个技能的工程师
* 查询在指定技能组中至少满足 skillGroupCodes.size 个技能的工程师
*
* @param skillGroupCodes 技能组编码
* @param skillGroupCodes 技能组编码
* @param skillGroupNumber 至少拥有其中skillGroupCodes.size 个技能
* @param skillGroupNumber 至少拥有其中skillGroupCodes.size 个技能
* @param teamId 工作队ID
* @param teamId 工作队ID
...
@@ -91,7 +92,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
...
@@ -91,7 +92,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
" LEFT JOIN engineer_info ei ON ei.engineer_code = tabA.engineer_code "
+
" LEFT JOIN engineer_info ei ON ei.engineer_code = tabA.engineer_code "
+
" WHERE ote.team_id = :teamId AND ei.id is not null"
+
" WHERE ote.team_id = :teamId AND ei.id is not null"
+
" order by ei.engineer_code desc"
,
nativeQuery
=
true
)
" order by ei.engineer_code desc"
,
nativeQuery
=
true
)
Set
<
EngineerInfoEntity
>
listBySkillGroupCode
(
@Param
(
"skillGroupCodes"
)
Collection
<
String
>
skillGroupCodes
,
@Param
(
"skillGroupNumber"
)
int
skillGroupNumber
,
@Param
(
"teamId"
)
String
teamId
);
Set
<
EngineerInfoEntity
>
listBySkillGroupCode
(
@Param
(
"skillGroupCodes"
)
Collection
<
String
>
skillGroupCodes
,
@Param
(
"skillGroupNumber"
)
int
skillGroupNumber
,
@Param
(
"teamId"
)
String
teamId
);
@Query
(
value
=
"SELECT ei.* from engineer_info ei left join engineer_skill_group esg on ei.engineer_code = esg.engineer_code "
+
@Query
(
value
=
"SELECT ei.* from engineer_info ei left join engineer_skill_group esg on ei.engineer_code = esg.engineer_code "
+
...
@@ -127,4 +128,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
...
@@ -127,4 +128,7 @@ public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integ
@Query
(
value
=
"SELECT ei.* from org_team_engineer ote left join engineer_info ei ON ote.engineer_code = ei.engineer_code "
+
@Query
(
value
=
"SELECT ei.* from org_team_engineer ote left join engineer_info ei ON ote.engineer_code = ei.engineer_code "
+
"WHERE ote.team_id = :teamId AND ote.engineer_code = :engineerCode AND ote.`status` = 1"
,
nativeQuery
=
true
)
"WHERE ote.team_id = :teamId AND ote.engineer_code = :engineerCode AND ote.`status` = 1"
,
nativeQuery
=
true
)
EngineerInfoEntity
selectEngineerByEngineerCodeAndTeamId
(
@Param
(
"engineerCode"
)
String
engineerCode
,
@Param
(
"teamId"
)
String
teamId
);
EngineerInfoEntity
selectEngineerByEngineerCodeAndTeamId
(
@Param
(
"engineerCode"
)
String
engineerCode
,
@Param
(
"teamId"
)
String
teamId
);
@Query
(
value
=
"SELECT DISTINCT esg.engineer_code FROM engineer_skill_group esg WHERE engineer_code in (:engineerCodes) and skill_group_code in (:skillGroupCodes)"
,
nativeQuery
=
true
)
List
<
String
>
findByEngineerCodesBySkillCodes
(
@Param
(
"engineerCodes"
)
List
<
String
>
engineerCodes
,
@Param
(
"skillGroupCodes"
)
Set
<
String
>
skillGroupCodes
);
}
}
project-order/src/main/java/com/dituhui/pea/order/dto/DispatchEngineerOrderListReq.java
View file @
f70f6c4
...
@@ -18,5 +18,6 @@ public class DispatchEngineerOrderListReq {
...
@@ -18,5 +18,6 @@ public class DispatchEngineerOrderListReq {
private
List
<
String
>
groupIds
;
private
List
<
String
>
groupIds
;
private
List
<
String
>
teamIds
;
private
List
<
String
>
teamIds
;
private
List
<
String
>
engineerCodes
;
private
List
<
String
>
engineerCodes
;
private
List
<
String
>
orderIds
;
private
String
key
;
private
String
key
;
}
}
project-order/src/main/java/com/dituhui/pea/order/dto/EngineersGanttDTO.java
View file @
f70f6c4
...
@@ -26,6 +26,7 @@ public class EngineersGanttDTO {
...
@@ -26,6 +26,7 @@ public class EngineersGanttDTO {
private
List
<
String
>
branchIds
;
private
List
<
String
>
branchIds
;
private
List
<
String
>
groupIds
;
private
List
<
String
>
groupIds
;
private
List
<
String
>
teamIds
;
private
List
<
String
>
teamIds
;
private
List
<
String
>
orderIds
;
private
String
key
;
private
String
key
;
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
View file @
f70f6c4
...
@@ -12,12 +12,14 @@ import com.dituhui.pea.order.dto.DispatchEngineerOrderListReq;
...
@@ -12,12 +12,14 @@ import com.dituhui.pea.order.dto.DispatchEngineerOrderListReq;
import
com.dituhui.pea.order.dto.DispatchEngineerOrderListResp
;
import
com.dituhui.pea.order.dto.DispatchEngineerOrderListResp
;
import
com.dituhui.pea.order.dto.DispatchOrderListReq
;
import
com.dituhui.pea.order.dto.DispatchOrderListReq
;
import
com.dituhui.pea.order.dto.DispatchOrderListResp
;
import
com.dituhui.pea.order.dto.DispatchOrderListResp
;
import
com.dituhui.pea.order.dto.param.CapacityQueryDTO
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.*
;
import
com.dituhui.pea.order.enums.*
;
import
com.dituhui.pea.order.service.CommonService
;
import
com.dituhui.pea.order.service.CommonService
;
import
com.dituhui.pea.order.service.DispatchService
;
import
com.dituhui.pea.order.service.DispatchService
;
import
com.dituhui.pea.order.service.OrderInfoService
;
import
com.dituhui.pea.order.service.OrderInfoService
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
com.google.common.collect.Sets
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -166,9 +168,21 @@ public class DispatchServiceImpl implements DispatchService {
...
@@ -166,9 +168,21 @@ public class DispatchServiceImpl implements DispatchService {
res
.
setEngineers
(
egs
);
res
.
setEngineers
(
egs
);
return
Result
.
success
(
res
);
return
Result
.
success
(
res
);
}
}
// 获取engineerCodes
// 获取engineerCodes
List
<
String
>
engineerCodes
=
engineers
.
stream
().
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
List
<
String
>
engineerCodes
=
engineers
.
stream
().
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
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
()));
if
(
Objects
.
isNull
(
skill
))
{
throw
new
BusinessException
(
"查询不到对应的技能组信息:"
+
String
.
join
(
","
,
orderInfo
.
getType
(),
orderInfo
.
getSkill
()));
}
skillGroupCodes
.
add
(
skill
.
getSkillGroupCode
());
}
engineerCodes
=
engineerInfoDao
.
findByEngineerCodesBySkillCodes
(
engineerCodes
,
skillGroupCodes
);
}
// 获取技术员已指派单列表
// 获取技术员已指派单列表
Map
<
String
,
List
<
OrderInfoEntity
>>
engineerOrders
=
this
.
queryEngineerOrders
(
engineerCodes
,
date
);
Map
<
String
,
List
<
OrderInfoEntity
>>
engineerOrders
=
this
.
queryEngineerOrders
(
engineerCodes
,
date
);
...
@@ -179,6 +193,9 @@ public class DispatchServiceImpl implements DispatchService {
...
@@ -179,6 +193,9 @@ public class DispatchServiceImpl implements DispatchService {
// 获取技术员已指派单列表
// 获取技术员已指派单列表
List
<
DispatchEngineerOrderListResp
.
EngineerInfo
>
egs
=
new
ArrayList
<>();
List
<
DispatchEngineerOrderListResp
.
EngineerInfo
>
egs
=
new
ArrayList
<>();
for
(
EngineerInfoEntity
e
:
engineers
)
{
for
(
EngineerInfoEntity
e
:
engineers
)
{
if
(!
engineerCodes
.
contains
(
e
.
getEngineerCode
()))
{
continue
;
}
List
<
DispatchEngineerOrderListResp
.
OrderInfo
>
items
=
new
ArrayList
<>();
List
<
DispatchEngineerOrderListResp
.
OrderInfo
>
items
=
new
ArrayList
<>();
// 技术员已指派的订单列表
// 技术员已指派的订单列表
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerGanttServiceImpl.java
View file @
f70f6c4
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.common.DateUtils
;
import
com.dituhui.pea.order.common.DateUtils
;
import
com.dituhui.pea.order.common.EngineerUtils
;
import
com.dituhui.pea.order.common.EngineerUtils
;
...
@@ -10,7 +11,9 @@ import com.dituhui.pea.order.dto.LabelValueDTO;
...
@@ -10,7 +11,9 @@ import com.dituhui.pea.order.dto.LabelValueDTO;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
import
com.dituhui.pea.order.service.EngineerGanttService
;
import
com.dituhui.pea.order.service.EngineerGanttService
;
import
com.google.common.collect.Sets
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -35,6 +38,8 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
...
@@ -35,6 +38,8 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
private
OrderInfoDao
orderInfoDao
;
private
OrderInfoDao
orderInfoDao
;
@Autowired
@Autowired
private
EngineerBusinessDao
engineerBusinessDao
;
private
EngineerBusinessDao
engineerBusinessDao
;
@Autowired
private
SkillInfoDao
skillInfoDao
;
private
String
getHourMinute
(
LocalDateTime
time
)
{
private
String
getHourMinute
(
LocalDateTime
time
)
{
return
this
.
getHourMinute
(
time
,
0
);
return
this
.
getHourMinute
(
time
,
0
);
...
@@ -51,7 +56,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
...
@@ -51,7 +56,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
List
<
String
>
engineerCodes
=
reqDTO
.
getEngineerCodes
();
List
<
String
>
engineerCodes
=
reqDTO
.
getEngineerCodes
();
if
(
engineerCodes
==
null
||
engineerCodes
.
isEmpty
())
{
if
(
engineerCodes
==
null
||
engineerCodes
.
isEmpty
())
{
// 需要根据levelType/levelValue/brandIds/branchIds/groupIds/teamIds/key,后端查询匹配
// 需要根据levelType/levelValue/brandIds/branchIds/groupIds/teamIds/key,后端查询匹配
engineerCodes
=
findEngineers
(
reqDTO
.
getLevelType
(),
reqDTO
.
getLevelValue
(),
reqDTO
.
getBranchIds
(),
reqDTO
.
getGroupIds
(),
reqDTO
.
getTeamIds
(),
reqDTO
.
getKey
());
engineerCodes
=
findEngineers
(
reqDTO
.
getLevelType
(),
reqDTO
.
getLevelValue
(),
reqDTO
.
getBranchIds
(),
reqDTO
.
getGroupIds
(),
reqDTO
.
getTeamIds
(),
reqDTO
.
getKey
()
,
reqDTO
.
getOrderIds
()
);
log
.
info
(
"根据多条件,查询返回符合条件的技术员列表:{}"
,
engineerCodes
);
log
.
info
(
"根据多条件,查询返回符合条件的技术员列表:{}"
,
engineerCodes
);
}
}
...
@@ -149,7 +154,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
...
@@ -149,7 +154,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
return
Result
.
success
(
res
);
return
Result
.
success
(
res
);
}
}
private
List
<
String
>
findEngineers
(
String
levelType
,
String
levelValue
,
List
<
String
>
branchIds
,
List
<
String
>
groupIds
,
List
<
String
>
teamIds
,
String
key
)
{
private
List
<
String
>
findEngineers
(
String
levelType
,
String
levelValue
,
List
<
String
>
branchIds
,
List
<
String
>
groupIds
,
List
<
String
>
teamIds
,
String
key
,
List
<
String
>
orderIds
)
{
// brandIds, groupIds, teamIds, 以team -> group -> branch 为顺序判断,前者优先;
// brandIds, groupIds, teamIds, 以team -> group -> branch 为顺序判断,前者优先;
List
<
String
>
engineerCodes
=
new
ArrayList
<>();
List
<
String
>
engineerCodes
=
new
ArrayList
<>();
if
(
teamIds
!=
null
&&
teamIds
.
size
()
>
0
)
{
if
(
teamIds
!=
null
&&
teamIds
.
size
()
>
0
)
{
...
@@ -171,12 +176,25 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
...
@@ -171,12 +176,25 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
engineerCodes
.
addAll
(
engineerUtils
.
getEngineersByLevel
(
levelType
,
levelValue
).
stream
().
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
()));
engineerCodes
.
addAll
(
engineerUtils
.
getEngineersByLevel
(
levelType
,
levelValue
).
stream
().
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
()));
}
}
engineerCodes
=
new
ArrayList
<>(
new
HashSet
<>(
engineerCodes
));
engineerCodes
=
new
ArrayList
<>(
new
HashSet
<>(
engineerCodes
));
if
(
StringUtils
.
isBlank
(
key
))
{
if
(
StringUtils
.
isNotBlank
(
key
))
{
return
engineerCodes
;
}
else
{
// 最后,还需要根据key进行过滤(需要结合数据库表)
// 最后,还需要根据key进行过滤(需要结合数据库表)
return
engineerUtils
.
filterEngineersByKey
(
engineerCodes
,
key
).
stream
().
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
engineerCodes
=
engineerUtils
.
filterEngineersByKey
(
engineerCodes
,
key
).
stream
().
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtils
.
isNotEmpty
(
orderIds
))
{
List
<
OrderInfoEntity
>
infoEntities
=
orderInfoDao
.
findAllByOrderIdIn
(
orderIds
);
Set
<
String
>
skillGroupCodes
=
Sets
.
newConcurrentHashSet
();
for
(
OrderInfoEntity
orderInfo
:
infoEntities
)
{
//查询对应的技能信息
SkillInfoEntity
skill
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
orderInfo
.
getBrand
(),
orderInfo
.
getType
(),
orderInfo
.
getSkill
());
if
(
Objects
.
isNull
(
skill
))
{
throw
new
BusinessException
(
"查询不到对应的技能组信息:"
+
String
.
join
(
","
,
orderInfo
.
getType
(),
orderInfo
.
getSkill
()));
}
}
skillGroupCodes
.
add
(
skill
.
getSkillGroupCode
());
}
engineerCodes
=
engineerInfoDao
.
findByEngineerCodesBySkillCodes
(
engineerCodes
,
skillGroupCodes
);
}
return
engineerCodes
;
}
}
private
List
<
LabelValueDTO
>
getOnwayTips
(
OrderInfoEntity
order
)
{
private
List
<
LabelValueDTO
>
getOnwayTips
(
OrderInfoEntity
order
)
{
...
...
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