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 70692180
authored
Jul 07, 2023
by
wangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改技术员技能,返回技能组ID
1 parent
d42f6666
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
29 deletions
project-order/src/main/java/com/dituhui/pea/order/dto/EngineerSkillListResp.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dto/EngineerSkillListResp.java
View file @
7069218
...
...
@@ -19,6 +19,6 @@ public class EngineerSkillListResp {
private
String
engineerName
;
private
String
groupName
;
private
String
updateTime
;
private
List
<
String
>
category
Ids
;
private
List
<
String
>
skillGroup
Ids
;
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerServiceImpl.java
View file @
7069218
...
...
@@ -29,7 +29,7 @@ public class EngineerServiceImpl implements EngineerService {
private
EngineerInfoMPDao
engineerInfoMPDao
;
@Autowired
private
EngineerSkill
MPDao
engineerSkill
MPDao
;
private
EngineerSkill
GroupMPDao
engineerSkillGroup
MPDao
;
@Autowired
private
OrgGroupMPDao
orgGroupMPDao
;
...
...
@@ -49,6 +49,7 @@ public class EngineerServiceImpl implements EngineerService {
@Autowired
private
CapacityEngineerStatDao
capacityEngineerStatDao
;
@Transactional
@Override
public
Result
<?>
getEngineerInfoList
(
String
levelType
,
String
levelValue
,
long
page
,
long
size
,
String
kind
,
String
key
)
{
...
...
@@ -126,23 +127,23 @@ public class EngineerServiceImpl implements EngineerService {
@Transactional
@Override
public
Result
<?>
engineerSkillUpdate
(
String
engineerCode
,
List
<
String
>
category
Ids
)
{
public
Result
<?>
engineerSkillUpdate
(
String
engineerCode
,
List
<
String
>
skillGroup
Ids
)
{
// 更新技术员技能
// 先将所有技能更新为0-不可用状态
LambdaUpdateWrapper
<
EngineerSkill
>
wrapper
=
new
LambdaUpdateWrapper
<>();
wrapper
.
eq
(
EngineerSkill
:
:
getEngineerCode
,
engineerCode
).
set
(
EngineerSkill
:
:
getStatus
,
0
);
engineerSkillMPDao
.
update
(
null
,
wrapper
);
if
(
category
Ids
.
isEmpty
())
{
LambdaUpdateWrapper
<
EngineerSkill
Group
>
wrapper
=
new
LambdaUpdateWrapper
<>();
wrapper
.
eq
(
EngineerSkill
Group:
:
getEngineerCode
,
engineerCode
).
set
(
EngineerSkillGroup
:
:
getStatus
,
0
);
engineerSkill
Group
MPDao
.
update
(
null
,
wrapper
);
if
(
skillGroup
Ids
.
isEmpty
())
{
return
null
;
}
// 更新categoryIds状态为1
wrapper
.
eq
(
EngineerSkill:
:
getEngineerCode
,
engineerCode
);
wrapper
.
in
(
EngineerSkill
:
:
getCategoryId
,
category
Ids
);
wrapper
.
set
(
EngineerSkill:
:
getStatus
,
1
);
int
n
=
engineerSkillMPDao
.
update
(
null
,
wrapper
);
if
(
category
Ids
.
size
()
==
n
)
{
wrapper
.
eq
(
EngineerSkill
Group
:
:
getEngineerCode
,
engineerCode
);
wrapper
.
in
(
EngineerSkill
Group:
:
getSkillGroupCode
,
skillGroup
Ids
);
wrapper
.
set
(
EngineerSkill
Group
:
:
getStatus
,
1
);
int
n
=
engineerSkill
Group
MPDao
.
update
(
null
,
wrapper
);
if
(
skillGroup
Ids
.
size
()
==
n
)
{
// 更新记录条数等于提交记录条数
return
null
;
}
...
...
@@ -152,15 +153,15 @@ public class EngineerServiceImpl implements EngineerService {
List
<
String
>
engineerCodes
=
new
ArrayList
<>(
Collections
.
singletonList
(
engineerCode
));
HashMap
<
String
,
List
<
String
>>
engineerSkills
=
this
.
queryEngineerSkills
(
engineerCodes
,
statuses
);
Set
<
String
>
sInput
=
new
HashSet
<>(
category
Ids
);
Set
<
String
>
sInput
=
new
HashSet
<>(
skillGroup
Ids
);
Set
<
String
>
sDB
=
new
HashSet
<>(
engineerSkills
.
get
(
engineerCode
));
sInput
.
removeAll
(
sDB
);
for
(
String
category
Id
:
sInput
)
{
EngineerSkill
e
=
new
EngineerSkill
();
for
(
String
skillGroup
Id
:
sInput
)
{
EngineerSkill
Group
e
=
new
EngineerSkillGroup
();
e
.
setEngineerCode
(
engineerCode
);
e
.
set
CategoryId
(
category
Id
);
e
.
set
SkillGroupCode
(
skillGroup
Id
);
e
.
setStatus
(
1
);
engineerSkillMPDao
.
insert
(
e
);
engineerSkill
Group
MPDao
.
insert
(
e
);
}
return
null
;
}
...
...
@@ -282,21 +283,21 @@ public class EngineerServiceImpl implements EngineerService {
if
(
engineerCodes
.
isEmpty
())
{
return
map
;
}
LambdaQueryWrapper
<
EngineerSkill
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
EngineerSkill:
:
getEngineerCode
,
engineerCodes
);
lqw
.
in
(
EngineerSkill:
:
getStatus
,
statuses
);
List
<
EngineerSkill
>
records
=
engineerSkill
MPDao
.
selectList
(
lqw
);
LambdaQueryWrapper
<
EngineerSkill
Group
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
EngineerSkill
Group
:
:
getEngineerCode
,
engineerCodes
);
lqw
.
in
(
EngineerSkill
Group
:
:
getStatus
,
statuses
);
List
<
EngineerSkill
Group
>
records
=
engineerSkillGroup
MPDao
.
selectList
(
lqw
);
Comparator
<
EngineerSkill
>
ec
=
Comparator
.
comparing
(
EngineerSkill
:
:
getEngineerCode
,
String
.
CASE_INSENSITIVE_ORDER
);
List
<
EngineerSkill
>
results
=
records
.
stream
().
sorted
(
ec
).
collect
(
Collectors
.
toList
());
Comparator
<
EngineerSkill
Group
>
ec
=
Comparator
.
comparing
(
EngineerSkillGroup
:
:
getEngineerCode
,
String
.
CASE_INSENSITIVE_ORDER
);
List
<
EngineerSkill
Group
>
results
=
records
.
stream
().
sorted
(
ec
).
collect
(
Collectors
.
toList
());
// 根据engineerCode分组
Map
<
String
,
List
<
EngineerSkill
>>
g
=
results
.
stream
().
collect
(
Collectors
.
groupingBy
(
EngineerSkill
:
:
getEngineerCode
));
Map
<
String
,
List
<
EngineerSkill
Group
>>
g
=
results
.
stream
().
collect
(
Collectors
.
groupingBy
(
EngineerSkillGroup
:
:
getEngineerCode
));
for
(
String
engineerCode
:
g
.
keySet
())
{
// 技术员技能ID列表
List
<
String
>
skill
Ids
=
g
.
get
(
engineerCode
).
stream
().
map
(
EngineerSkill:
:
getCategoryId
).
collect
(
Collectors
.
toList
());
map
.
put
(
engineerCode
,
skillIds
);
List
<
String
>
skill
GroupIds
=
g
.
get
(
engineerCode
).
stream
().
map
(
EngineerSkillGroup:
:
getSkillGroupCode
).
collect
(
Collectors
.
toList
());
map
.
put
(
engineerCode
,
skill
Group
Ids
);
}
return
map
;
}
...
...
@@ -371,8 +372,8 @@ public class EngineerServiceImpl implements EngineerService {
List
<
String
>
engineerCodes
=
engineers
.
stream
().
map
(
EngineerInfo:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
// 获取技术员的可用技能列表
List
<
Integer
>
statuses
=
new
ArrayList
<
Integer
>(
List
.
of
(
1
)
);
HashMap
<
String
,
List
<
String
>>
engineerSkills
=
this
.
queryEngineerSkills
(
engineerCodes
,
statuses
);
List
<
Integer
>
statuses
=
Collections
.
singletonList
(
1
);
HashMap
<
String
,
List
<
String
>>
engineerSkill
Group
s
=
this
.
queryEngineerSkills
(
engineerCodes
,
statuses
);
List
<
String
>
emptySkills
=
Collections
.
emptyList
();
List
<
EngineerSkillListResp
.
EngineerSkill
>
items
=
new
ArrayList
<>();
...
...
@@ -384,7 +385,7 @@ public class EngineerServiceImpl implements EngineerService {
skill
.
setUpdateTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
e
.
getUpdateTime
()));
// 获取一个工程师的技能列表
skill
.
set
CategoryIds
(
engineerSkill
s
.
getOrDefault
(
e
.
getEngineerCode
(),
emptySkills
));
skill
.
set
SkillGroupIds
(
engineerSkillGroup
s
.
getOrDefault
(
e
.
getEngineerCode
(),
emptySkills
));
items
.
add
(
skill
);
}
...
...
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