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 d055e92a
authored
Jul 07, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了按某一个级别,返回下面所有的技术员的接口
1 parent
31282576
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
101 additions
and
26 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/OrganizationController.java
project-order/src/main/java/com/dituhui/pea/order/dao/EngineerInfoDao.java
project-order/src/main/java/com/dituhui/pea/order/dao/OrgGroupDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrderChangeListReqDTO.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrganizationEngineersRespDTO.java → project-order/src/main/java/com/dituhui/pea/order/dto/OrganizationEngineersByTeamsDTO.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrganizationEngineersDTO.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrganizationEngineersReqDTO.java
project-order/src/main/java/com/dituhui/pea/order/service/OrganizationService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrganizationServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/OrganizationController.java
View file @
d055e92
...
@@ -3,7 +3,8 @@ package com.dituhui.pea.order.controller;
...
@@ -3,7 +3,8 @@ package com.dituhui.pea.order.controller;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dto.LevelReqDTO
;
import
com.dituhui.pea.order.dto.LevelReqDTO
;
import
com.dituhui.pea.order.dto.OrganizationEngineersReqDTO
;
import
com.dituhui.pea.order.dto.OrganizationEngineersDTO
;
import
com.dituhui.pea.order.dto.OrganizationEngineersByTeamsDTO
;
import
com.dituhui.pea.order.service.OrganizationService
;
import
com.dituhui.pea.order.service.OrganizationService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -42,7 +43,7 @@ public class OrganizationController {
...
@@ -42,7 +43,7 @@ public class OrganizationController {
}
}
@GetMapping
(
"/organization/engineer/list"
)
@GetMapping
(
"/organization/engineer/list"
)
public
Result
<?>
get
TeamsEngineers
(
OrganizationEngineersReqDTO
reqDTO
)
{
public
Result
<?>
get
EngineersByTeams
(
OrganizationEngineersByTeamsDTO
.
Request
reqDTO
)
{
Result
<?>
res
=
null
;
Result
<?>
res
=
null
;
try
{
try
{
res
=
organizationService
.
getEngineersByTeams
(
reqDTO
.
getTeamIds
());
res
=
organizationService
.
getEngineersByTeams
(
reqDTO
.
getTeamIds
());
...
@@ -51,4 +52,15 @@ public class OrganizationController {
...
@@ -51,4 +52,15 @@ public class OrganizationController {
}
}
return
res
;
return
res
;
}
}
@GetMapping
(
"/organization/engineer/all"
)
public
Result
<?>
getEngineersByOrganization
(
OrganizationEngineersDTO
.
Request
reqDTO
)
{
Result
<?>
res
=
null
;
try
{
res
=
organizationService
.
getEngineersByLevel
(
reqDTO
.
getLevelType
(),
reqDTO
.
getLevelValue
());
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
}
}
project-order/src/main/java/com/dituhui/pea/order/dao/EngineerInfoDao.java
View file @
d055e92
...
@@ -5,7 +5,13 @@ import com.dituhui.pea.order.entity.EngineerInfoEntity;
...
@@ -5,7 +5,13 @@ import com.dituhui.pea.order.entity.EngineerInfoEntity;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
@Repository
public
interface
EngineerInfoDao
extends
JpaRepository
<
EngineerInfoEntity
,
Integer
>
{
public
interface
EngineerInfoDao
extends
JpaRepository
<
EngineerInfoEntity
,
Integer
>
{
EngineerInfoEntity
getByEngineerCode
(
String
engineerCode
);
EngineerInfoEntity
getByEngineerCode
(
String
engineerCode
);
List
<
EngineerInfoEntity
>
findByGroupId
(
String
groupId
);
List
<
EngineerInfoEntity
>
findByGroupIdIn
(
List
<
String
>
groupIds
);
}
}
project-order/src/main/java/com/dituhui/pea/order/dao/OrgGroupDao.java
View file @
d055e92
...
@@ -13,5 +13,7 @@ public interface OrgGroupDao extends JpaRepository<OrgGroupEntity, Integer> {
...
@@ -13,5 +13,7 @@ public interface OrgGroupDao extends JpaRepository<OrgGroupEntity, Integer> {
List
<
OrgGroupEntity
>
findAllByBranchId
(
String
branchId
);
List
<
OrgGroupEntity
>
findAllByBranchId
(
String
branchId
);
List
<
OrgGroupEntity
>
findAllByClusterId
(
String
clusterId
);
OrgGroupEntity
getByGroupId
(
String
groupId
);
OrgGroupEntity
getByGroupId
(
String
groupId
);
}
}
project-order/src/main/java/com/dituhui/pea/order/dto/OrderChangeListReqDTO.java
View file @
d055e92
...
@@ -6,10 +6,8 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
...
@@ -6,10 +6,8 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer
;
import
com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer
;
import
com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer
;
import
com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
@lombok
.
Data
@lombok
.
Data
public
class
OrderChangeListReqDTO
{
public
class
OrderChangeListReqDTO
{
...
...
project-order/src/main/java/com/dituhui/pea/order/dto/OrganizationEngineers
Resp
DTO.java
→
project-order/src/main/java/com/dituhui/pea/order/dto/OrganizationEngineers
ByTeams
DTO.java
View file @
d055e92
package
com
.
dituhui
.
pea
.
order
.
dto
;
package
com
.
dituhui
.
pea
.
order
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
org.checkerframework.checker.units.qual.Acceleration
;
import
java.util.List
;
import
java.util.List
;
@lombok
.
Data
public
class
OrganizationEngineersByTeamsDTO
{
@Accessors
(
chain
=
true
)
public
class
OrganizationEngineersRespDTO
{
@Data
public
static
class
Request
{
private
List
<
String
>
teamIds
;
}
@Data
@Accessors
(
chain
=
true
)
public
static
class
Result
{
private
List
<?>
engineers
;
private
List
<?>
engineers
;
}
@
lombok
.
Data
@Data
public
static
class
Engineer
{
public
static
class
Engineer
{
/**
/**
* 技术员id
* 技术员id
...
...
project-order/src/main/java/com/dituhui/pea/order/dto/OrganizationEngineersDTO.java
0 → 100644
View file @
d055e92
package
com
.
dituhui
.
pea
.
order
.
dto
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
public
class
OrganizationEngineersDTO
{
@Data
@Accessors
(
chain
=
true
)
public
static
class
Request
{
private
String
levelType
;
private
String
levelValue
;
}
@Data
@Accessors
(
chain
=
true
)
public
static
class
Result
{
private
List
<
Engineer
>
engineers
;
private
String
levelType
;
private
String
levelValue
;
}
@Data
@Accessors
(
chain
=
true
)
public
static
class
Engineer
{
private
String
engineerCode
;
private
String
engineerName
;
private
String
phone
;
}
}
project-order/src/main/java/com/dituhui/pea/order/dto/OrganizationEngineersReqDTO.java
deleted
100644 → 0
View file @
3128257
package
com
.
dituhui
.
pea
.
order
.
dto
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
@lombok
.
Data
public
class
OrganizationEngineersReqDTO
{
private
List
<
String
>
teamIds
;
}
project-order/src/main/java/com/dituhui/pea/order/service/OrganizationService.java
View file @
d055e92
...
@@ -10,4 +10,6 @@ public interface OrganizationService {
...
@@ -10,4 +10,6 @@ public interface OrganizationService {
Result
<?>
getEngineersByTeams
(
List
<
String
>
teamIds
);
Result
<?>
getEngineersByTeams
(
List
<
String
>
teamIds
);
Result
<?>
getTeamsByLevel
(
String
levelType
,
String
levelValue
);
Result
<?>
getTeamsByLevel
(
String
levelType
,
String
levelValue
);
Result
<?>
getEngineersByLevel
(
String
levelType
,
String
levelValue
);
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrganizationServiceImpl.java
View file @
d055e92
...
@@ -2,9 +2,7 @@ package com.dituhui.pea.order.service.impl;
...
@@ -2,9 +2,7 @@ package com.dituhui.pea.order.service.impl;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.OrganizationEngineersRespDTO
;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.dto.OrganizationTeamsRespDTO
;
import
com.dituhui.pea.order.dto.OrganizationTreeRespDTO
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.service.OrganizationService
;
import
com.dituhui.pea.order.service.OrganizationService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -14,6 +12,7 @@ import org.springframework.stereotype.Service;
...
@@ -14,6 +12,7 @@ import org.springframework.stereotype.Service;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
@Service
@Slf4j
@Slf4j
...
@@ -71,16 +70,16 @@ public class OrganizationServiceImpl implements OrganizationService {
...
@@ -71,16 +70,16 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override
@Override
public
Result
<?>
getEngineersByTeams
(
List
<
String
>
teamIds
)
{
public
Result
<?>
getEngineersByTeams
(
List
<
String
>
teamIds
)
{
List
<
OrganizationEngineers
Resp
DTO
.
Engineer
>
engineers
=
new
ArrayList
<>();
List
<
OrganizationEngineers
ByTeams
DTO
.
Engineer
>
engineers
=
new
ArrayList
<>();
for
(
OrgTeamEngineerEntity
e
:
orgTeamEngineerDao
.
findAllByTeamIdIn
(
teamIds
))
{
for
(
OrgTeamEngineerEntity
e
:
orgTeamEngineerDao
.
findAllByTeamIdIn
(
teamIds
))
{
EngineerInfoEntity
engineerInfoEntity
=
engineerInfoDao
.
getByEngineerCode
(
e
.
getEngineerCode
());
EngineerInfoEntity
engineerInfoEntity
=
engineerInfoDao
.
getByEngineerCode
(
e
.
getEngineerCode
());
if
(
engineerInfoEntity
==
null
)
{
if
(
engineerInfoEntity
==
null
)
{
log
.
error
(
"技术员信息不存在!engineer_code: {}"
,
e
.
getEngineerCode
());
log
.
error
(
"技术员信息不存在!engineer_code: {}"
,
e
.
getEngineerCode
());
continue
;
continue
;
}
}
engineers
.
add
(
new
OrganizationEngineers
Resp
DTO
.
Engineer
(
e
.
getTeamId
(),
e
.
getEngineerCode
(),
engineerInfoEntity
.
getName
()));
engineers
.
add
(
new
OrganizationEngineers
ByTeams
DTO
.
Engineer
(
e
.
getTeamId
(),
e
.
getEngineerCode
(),
engineerInfoEntity
.
getName
()));
}
}
return
Result
.
success
(
new
OrganizationEngineers
RespDTO
().
setEngineers
(
engineers
));
return
Result
.
success
(
new
OrganizationEngineers
ByTeamsDTO
.
Result
().
setEngineers
(
engineers
));
}
}
@Override
@Override
...
@@ -110,6 +109,33 @@ public class OrganizationServiceImpl implements OrganizationService {
...
@@ -110,6 +109,33 @@ public class OrganizationServiceImpl implements OrganizationService {
return
Result
.
success
(
new
OrganizationTeamsRespDTO
().
setTeams
(
teams
));
return
Result
.
success
(
new
OrganizationTeamsRespDTO
().
setTeams
(
teams
));
}
}
@Override
public
Result
<?>
getEngineersByLevel
(
String
levelType
,
String
levelValue
)
{
List
<
EngineerInfoEntity
>
engineers
=
null
;
assert
"group"
.
equals
(
levelType
)
||
"branch"
.
equals
(
levelType
)
||
"cluster"
.
equals
(
levelType
);
if
(
"group"
.
equals
(
levelType
))
{
engineers
=
engineerInfoDao
.
findByGroupId
(
levelType
);
}
else
if
(
"branch"
.
equals
(
levelType
))
{
List
<
String
>
groupIds
=
orgGroupDao
.
findAllByBranchId
(
levelValue
).
stream
()
.
map
(
OrgGroupEntity:
:
getGroupId
).
collect
(
Collectors
.
toList
());
engineers
=
engineerInfoDao
.
findByGroupIdIn
(
groupIds
);
}
else
{
// "cluster".equals(levelType)
List
<
String
>
groupIds
=
orgGroupDao
.
findAllByClusterId
(
levelValue
).
stream
()
.
map
(
OrgGroupEntity:
:
getGroupId
).
collect
(
Collectors
.
toList
());
engineers
=
engineerInfoDao
.
findByGroupIdIn
(
groupIds
);
}
List
<
OrganizationEngineersDTO
.
Engineer
>
engineers1
=
engineers
.
stream
().
map
(
entity
->
{
return
new
OrganizationEngineersDTO
.
Engineer
()
.
setEngineerCode
(
entity
.
getEngineerCode
())
.
setEngineerName
(
entity
.
getName
())
.
setPhone
(
entity
.
getPhone
());
}).
collect
(
Collectors
.
toList
());
OrganizationEngineersDTO
.
Result
rs
=
new
OrganizationEngineersDTO
.
Result
();
rs
.
setLevelType
(
levelType
).
setLevelValue
(
levelValue
).
setEngineers
(
engineers1
);
return
Result
.
success
(
rs
);
}
private
List
<?>
getTreeByRoot
()
{
private
List
<?>
getTreeByRoot
()
{
List
<
OrganizationTreeRespDTO
.
Cluster
>
clusters
=
new
ArrayList
<>();
List
<
OrganizationTreeRespDTO
.
Cluster
>
clusters
=
new
ArrayList
<>();
for
(
OrgClusterEntity
c
:
orgClusterDao
.
findAll
())
{
for
(
OrgClusterEntity
c
:
orgClusterDao
.
findAll
())
{
...
...
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