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 286bc4bf
authored
Jul 07, 2023
by
王力
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_engineer_filter' into 'develop'
Dev engineer filter See merge request !165
2 parents
b8b99416
70692180
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
129 additions
and
29 deletions
project-order/src/main/java/com/dituhui/pea/order/dao/EngineerSkillGroupMPDao.java
project-order/src/main/java/com/dituhui/pea/order/dao/SkillGroupMPDao.java
project-order/src/main/java/com/dituhui/pea/order/dao/SkillInfoMPDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/EngineerSkillListResp.java
project-order/src/main/java/com/dituhui/pea/order/entity/EngineerSkillGroup.java
project-order/src/main/java/com/dituhui/pea/order/entity/SkillGroup.java
project-order/src/main/java/com/dituhui/pea/order/entity/SkillInfo.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dao/EngineerSkillGroupMPDao.java
0 → 100644
View file @
286bc4b
package
com
.
dituhui
.
pea
.
order
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.dituhui.pea.order.entity.EngineerInfo
;
import
com.dituhui.pea.order.entity.EngineerSkillGroup
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
@Mapper
public
interface
EngineerSkillGroupMPDao
extends
BaseMapper
<
EngineerSkillGroup
>
{
@Select
(
"select * from engineer_skill_group where engineer_code = #{engineerCode}"
)
List
<
EngineerSkillGroup
>
selectByEngineerCode
(
String
engineerCode
);
}
project-order/src/main/java/com/dituhui/pea/order/dao/SkillGroupMPDao.java
0 → 100644
View file @
286bc4b
package
com
.
dituhui
.
pea
.
order
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.dituhui.pea.order.entity.SkillGroup
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
@Mapper
public
interface
SkillGroupMPDao
extends
BaseMapper
<
SkillGroup
>
{
@Select
(
"select * from skill_group where skill_group_code = #{groupCode}"
)
SkillGroup
selectByGroupCode
(
String
groupCode
);
}
project-order/src/main/java/com/dituhui/pea/order/dao/SkillInfoMPDao.java
0 → 100644
View file @
286bc4b
package
com
.
dituhui
.
pea
.
order
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.dituhui.pea.order.entity.SkillInfo
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
SkillInfoMPDao
extends
BaseMapper
<
SkillInfo
>
{
}
project-order/src/main/java/com/dituhui/pea/order/dto/EngineerSkillListResp.java
View file @
286bc4b
...
...
@@ -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/entity/EngineerSkillGroup.java
0 → 100644
View file @
286bc4b
package
com
.
dituhui
.
pea
.
order
.
entity
;
import
lombok.Data
;
import
java.sql.Timestamp
;
@Data
public
class
EngineerSkillGroup
{
private
Integer
id
;
private
String
engineerCode
;
private
String
skillGroupCode
;
private
String
description
;
private
Integer
beanStatus
;
private
Integer
status
;
private
String
memo
;
private
Timestamp
createTime
;
private
Timestamp
updateTime
;
}
\ No newline at end of file
project-order/src/main/java/com/dituhui/pea/order/entity/SkillGroup.java
0 → 100644
View file @
286bc4b
package
com
.
dituhui
.
pea
.
order
.
entity
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
@Data
public
class
SkillGroup
{
private
Integer
id
;
private
String
skillCode
;
private
String
brand
;
private
String
type
;
private
String
skill
;
private
Integer
takeTime
;
private
Integer
takeEngineer
;
private
Integer
lowElectricianCert
;
private
Integer
gasCert
;
private
Integer
priority
;
private
String
skillGroupCode
;
private
String
layerId
;
private
String
typeCategory
;
private
String
skillCategory
;
private
String
memo
;
private
LocalDateTime
createTime
;
private
LocalDateTime
updateTime
;
}
project-order/src/main/java/com/dituhui/pea/order/entity/SkillInfo.java
0 → 100644
View file @
286bc4b
package
com
.
dituhui
.
pea
.
order
.
entity
;
import
lombok.Data
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
@Data
public
class
SkillInfo
{
private
Integer
id
;
private
String
skillGroupCode
;
private
String
skillGroup
;
private
String
describe
;
private
String
category
;
private
String
memo
;
private
LocalDateTime
createTime
;
private
LocalDate
updateTime
;
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerServiceImpl.java
View file @
286bc4b
...
...
@@ -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