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 eafad965
authored
Jul 14, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 调整为精确类型
1 parent
f6d35dce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
project-interface/src/main/java/com/dituhui/pea/order/IOrganization.java
project-order/src/main/java/com/dituhui/pea/order/controller/PublicOrganizationController.java
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
project-interface/src/main/java/com/dituhui/pea/order/IOrganization.java
View file @
eafad96
...
...
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RequestParam
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.pojo.OrganizationDTO
;
/**
* 组织结构相关接口
...
...
@@ -24,7 +25,7 @@ public interface IOrganization {
* @return
*/
@RequestMapping
(
value
=
"/pea-order/organization/list"
,
method
=
RequestMethod
.
GET
)
public
Result
<
?
>
getAllOrganizations
(
@RequestParam
(
"levelType"
)
String
levelType
,
public
Result
<
List
<
OrganizationDTO
>
>
getAllOrganizations
(
@RequestParam
(
"levelType"
)
String
levelType
,
@RequestParam
(
"organizationIds"
)
List
<
String
>
organizationIds
);
}
project-order/src/main/java/com/dituhui/pea/order/controller/PublicOrganizationController.java
View file @
eafad96
...
...
@@ -9,6 +9,7 @@ import com.alibaba.druid.util.StringUtils;
import
com.alibaba.nacos.client.naming.utils.CollectionUtils
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.ResultEnum
;
import
com.dituhui.pea.order.IOrganization
;
import
com.dituhui.pea.order.service.OrganizationService
;
import
com.dituhui.pea.pojo.OrganizationDTO
;
...
...
@@ -24,20 +25,20 @@ public class PublicOrganizationController implements IOrganization {
private
OrganizationService
organizationService
;
@Override
public
Result
<
?
>
getAllOrganizations
(
String
levelType
,
List
<
String
>
organizationIds
)
{
public
Result
<
List
<
OrganizationDTO
>
>
getAllOrganizations
(
String
levelType
,
List
<
String
>
organizationIds
)
{
if
(
StringUtils
.
isEmpty
(
levelType
))
{
return
Result
.
failed
(
"缺少参数levelType"
);
return
Result
.
instance
(
ResultEnum
.
COMMON_FAILED
.
getCode
(),
"缺少参数levelType"
,
null
);
}
if
(
CollectionUtils
.
isEmpty
(
organizationIds
))
{
return
Result
.
failed
(
"缺少参数organizationIds"
);
return
Result
.
instance
(
ResultEnum
.
COMMON_FAILED
.
getCode
(),
"缺少参数organizationIds"
,
null
);
}
Result
<
?
>
res
=
null
;
Result
<
List
<
OrganizationDTO
>
>
res
=
null
;
try
{
List
<
OrganizationDTO
>
orgs
=
organizationService
.
getAllOrganizations
(
levelType
,
organizationIds
);
res
=
Result
.
success
(
orgs
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
()
);
return
Result
.
instance
(
ResultEnum
.
COMMON_FAILED
.
getCode
(),
e
.
getMessage
(),
null
);
}
return
res
;
}
...
...
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
View file @
eafad96
...
...
@@ -151,10 +151,10 @@ public class UserService {
List
<
OrganizationDTO
>
allOrgs
=
resources
.
stream
().
filter
(
r
->
r
.
getType
()
==
3
).
map
(
r
->
{
List
<
OrganizationDTO
>
orgs
=
Lists
.
newArrayList
();
String
[]
temp
=
r
.
getExtra
().
split
(
"\\|"
);
Result
<
?
>
result
=
organizationService
.
getAllOrganizations
(
temp
[
0
],
Result
<
List
<
OrganizationDTO
>
>
result
=
organizationService
.
getAllOrganizations
(
temp
[
0
],
Arrays
.
asList
(
temp
[
1
].
split
(
","
)));
if
(
StringUtils
.
equals
(
ResultEnum
.
SUCCESS
.
getCode
(),
result
.
getCode
()))
{
orgs
=
(
List
<
OrganizationDTO
>)
result
.
getResult
();
orgs
=
result
.
getResult
();
}
return
orgs
;
}).
flatMap
(
a
->
a
.
stream
()).
collect
(
Collectors
.
toList
());
...
...
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