Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
long-tern-care-service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hubin
long-tern-care-service
Commits
ebd4ba94
Commit
ebd4ba94
authored
Jun 16, 2021
by
zhangch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
适用机构的feignService接口
parent
f37191ca
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
9 deletions
+89
-9
OrganFeignService.java
...src/main/java/com/hungraim/ltc/api/OrganFeignService.java
+22
-0
OrganController.java
...ain/java/com/hungraim/ltc/controller/OrganController.java
+35
-0
OrganServiceImpl.java
.../java/com/hungraim/ltc/service/impl/OrganServiceImpl.java
+32
-9
No files found.
apply/apply-api/src/main/java/com/hungraim/ltc/api/OrganFeignService.java
0 → 100644
View file @
ebd4ba94
package
com
.
hungraim
.
ltc
.
api
;
import
com.hungraim.ltc.util.Result
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
java.util.List
;
@FeignClient
(
"LTC-APPLY-SERVICE"
)
public
interface
OrganFeignService
{
/**
* 根据organId以及isInvolveChild返回一个organIds集合
* 返回一个好办organId的ids集合,如果isInvolveChild的值为true,则包含organId的下层机构,如果为false,就只返回只存在organId的ids集合
*
* @param organId 适用机构id
* @param isInvolveChild 是否包含下层机构
* @return 返回一个ids集合
*/
@GetMapping
(
"/api.apply/organ/child"
)
Result
<
List
<
Long
>>
getOrganChild
(
Long
organId
,
Boolean
isInvolveChild
);
}
apply/apply-service/src/main/java/com/hungraim/ltc/controller/OrganController.java
0 → 100644
View file @
ebd4ba94
package
com
.
hungraim
.
ltc
.
controller
;
import
com.hungraim.ltc.service.OrganService
;
import
com.hungraim.ltc.util.Result
;
import
com.hungraim.ltc.util.ResultCode
;
import
lombok.AllArgsConstructor
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/api.apply/organ"
)
@AllArgsConstructor
public
class
OrganController
{
private
final
OrganService
organService
;
/**
* 根据organId以及isInvolveChild返回一个organIds集合
* 返回一个好办organId的ids集合,如果isInvolveChild的值为true,则包含organId的下层机构,如果为false,就只返回只存在organId的ids集合
*
* @param organId 适用机构id
* @param isInvolveChild 是否包含下层机构
* @return 返回一个ids集合
*/
@GetMapping
(
"/child"
)
public
Result
<
List
<
Long
>>
getOrganChild
(
Long
organId
,
Boolean
isInvolveChild
)
{
if
(
null
==
organId
||
null
==
isInvolveChild
)
{
return
Result
.
failed
(
ResultCode
.
REQUEST_PARAM_ERROR
);
}
return
Result
.
success
(
organService
.
getOrganIds
(
organId
,
isInvolveChild
));
}
}
apply/apply-service/src/main/java/com/hungraim/ltc/service/impl/OrganServiceImpl.java
View file @
ebd4ba94
...
@@ -16,21 +16,44 @@ public class OrganServiceImpl implements OrganService {
...
@@ -16,21 +16,44 @@ public class OrganServiceImpl implements OrganService {
private
final
FndOrganMapper
fndOrganMapper
;
private
final
FndOrganMapper
fndOrganMapper
;
/**
* 获取机构ids
*
* @param organId 父机构id
* @param organIds 机构list
*/
private
void
getOrganList
(
Long
organId
,
List
<
Long
>
organIds
)
{
QueryWrapper
<
ChFndOrgan
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"STATUS"
,
"1"
);
queryWrapper
.
eq
(
"PARENT_ID"
,
organId
);
List
<
ChFndOrgan
>
organs
=
fndOrganMapper
.
selectList
(
queryWrapper
);
if
(
organs
!=
null
&&
organs
.
size
()
!=
0
)
{
for
(
ChFndOrgan
chFndOrgan
:
organs
)
{
String
childOrganId
=
chFndOrgan
.
getOrganId
();
organIds
.
add
(
Long
.
valueOf
(
childOrganId
));
if
(
"1"
.
equals
(
chFndOrgan
.
getIsLeaf
()))
{
getOrganList
(
Long
.
valueOf
(
childOrganId
),
organIds
);
}
}
}
}
@Override
@Override
public
List
<
Long
>
getOrganIds
(
Long
organId
,
Boolean
isInvolveChild
)
{
public
List
<
Long
>
getOrganIds
(
Long
organId
,
Boolean
isInvolveChild
)
{
List
<
Long
>
organIds
=
new
ArrayList
<>();
List
<
Long
>
organIds
=
new
ArrayList
<>();
if
(
isInvolveChild
)
{
if
(
isInvolveChild
)
{
if
(
organId
!=
null
)
{
if
(
organId
!=
null
)
{
organIds
.
add
(
organId
);
organIds
.
add
(
organId
);
QueryWrapper
<
ChFndOrgan
>
queryWrapper
=
new
QueryWrapper
<>();
getOrganList
(
organId
,
organIds
);
queryWrapper
.
eq
(
"PARENT_ID"
,
organId
);
// QueryWrapper<ChFndOrgan> queryWrapper = new QueryWrapper<>();
queryWrapper
.
eq
(
"STATUS"
,
"1"
);
// queryWrapper.eq("PARENT_ID", organId);
List
<
ChFndOrgan
>
chFndOrgans
=
fndOrganMapper
.
selectList
(
queryWrapper
);
// queryWrapper.eq("STATUS", "1");
if
(
chFndOrgans
!=
null
)
{
// List<ChFndOrgan> chFndOrgans = fndOrganMapper.selectList(queryWrapper);
for
(
ChFndOrgan
chFndOrgan
:
chFndOrgans
)
{
// if (chFndOrgans != null) {
organIds
.
add
(
Long
.
valueOf
(
chFndOrgan
.
getOrganId
()));
// for (ChFndOrgan chFndOrgan : chFndOrgans) {
}
// organIds.add(Long.valueOf(chFndOrgan.getOrganId()));
}
// }
// }
}
}
}
}
return
organIds
;
return
organIds
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment