Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
c207f06e
Commit
c207f06e
authored
Apr 25, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加权限
parent
5710fb1c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
24 deletions
+108
-24
PrivilegeController.java
...boot/module/jxiop/biz/controller/PrivilegeController.java
+77
-0
ExDataSourcesImpl.java
...boot/module/jxiop/biz/service/impl/ExDataSourcesImpl.java
+31
-24
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/PrivilegeController.java
0 → 100644
View file @
c207f06e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.UserOrgTreeModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
/**
* @description:
* @author: tw
* @createDate: 2023/4/25
*/
@RestController
@Api
(
tags
=
"平台单位部门树"
)
@RequestMapping
(
value
=
"/companyClient"
)
public
class
PrivilegeController
extends
BaseController
{
@Autowired
private
RedisUtils
redisUtils
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/queryOrgTree"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"查询单位、子单位、部门树"
,
notes
=
"查询单位、子单位、部门树"
)
public
FeignClientResult
<
Collection
<
UserOrgTreeModel
>>
queryOrgTree
()
{
//获取当前登录人单位
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
Long
companyId
=
reginParams
.
getCompany
().
getSequenceNbr
();
FeignClientResult
<
Collection
<
UserOrgTreeModel
>>
de
=
Privilege
.
companyClient
.
queryOrgTree
(
companyId
);
return
de
;
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/subcompany"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"查询单位、子单位、部门树"
,
notes
=
"查询单位、子单位、部门树"
)
public
ResponseModel
<
List
<
CompanyModel
>>
subcompany
()
{
//获取当前登录人单位
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
Long
companyId
=
reginParams
.
getCompany
().
getSequenceNbr
();
FeignClientResult
<
Collection
<
CompanyModel
>>
de
=
Privilege
.
companyClient
.
querySubAgencyTree
(
companyId
);
CompanyModel
companyModel
=
new
CompanyModel
();
companyModel
.
setSequenceNbr
(
companyId
);
companyModel
.
setCompanyName
(
reginParams
.
getCompany
().
getCompanyName
());
companyModel
.
setChildren
(
de
.
getResult
());
List
<
CompanyModel
>
date
=
new
ArrayList
();
date
.
add
(
companyModel
);
return
ResponseHelper
.
buildResponse
(
date
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/ExDataSourcesImpl.java
View file @
c207f06e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.excel.DataSources
;
import
com.yeejoin.amos.boot.biz.common.excel.DataSources
;
import
com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.UserOrgTreeModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
java.util.Collection
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.util.LinkedHashMap
;
import
java.util.
List
;
import
java.util.
*
;
/**
/**
* @description:
* @description:
...
@@ -23,6 +31,10 @@ import java.util.List;
...
@@ -23,6 +31,10 @@ import java.util.List;
@Service
@Service
public
class
ExDataSourcesImpl
implements
DataSources
{
public
class
ExDataSourcesImpl
implements
DataSources
{
@Autowired
private
RedisUtils
redisUtils
;
@Override
@Override
public
String
[]
selectList
(
String
type
,
String
method
)
throws
Exception
{
public
String
[]
selectList
(
String
type
,
String
method
)
throws
Exception
{
String
[]
str
=
{};
String
[]
str
=
{};
...
@@ -40,13 +52,20 @@ public class ExDataSourcesImpl implements DataSources {
...
@@ -40,13 +52,20 @@ public class ExDataSourcesImpl implements DataSources {
private
String
[]
getArea
()
{
private
String
[]
getArea
()
{
FeignClientResult
<
Collection
<
CompanyModel
>>
de
=
Privilege
.
companyClient
.
queryAgencyTree
(
null
);
//获取当前登录人单位
Collection
<
CompanyModel
>
listco
=
new
ArrayList
<>();
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
Long
companyId
=
reginParams
.
getCompany
().
getSequenceNbr
();
FeignClientResult
<
Collection
<
UserOrgTreeModel
>>
de
=
Privilege
.
companyClient
.
queryOrgTree
(
companyId
);
Collection
<
UserOrgTreeModel
>
listco
=
new
ArrayList
<>();
String
[]
str
=
null
;
String
[]
str
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
de
))
{
if
(!
ObjectUtils
.
isEmpty
(
de
))
{
if
(
de
.
getStatus
()
==
200
)
{
if
(
de
.
getStatus
()
==
200
)
{
listco
=
de
.
getResult
();
listco
=
de
.
getResult
();
List
<
String
>
collect
=
this
.
getCompanyModel
(
listco
);
List
<
String
>
collect
=
new
ArrayList
<>();
this
.
getCompanyModel
(
listco
,
collect
);
str
=
collect
.
toArray
(
new
String
[
collect
.
size
()]);
str
=
collect
.
toArray
(
new
String
[
collect
.
size
()]);
}
else
{
}
else
{
throw
new
RuntimeException
(
de
.
getMessage
());
throw
new
RuntimeException
(
de
.
getMessage
());
...
@@ -57,14 +76,14 @@ public class ExDataSourcesImpl implements DataSources {
...
@@ -57,14 +76,14 @@ public class ExDataSourcesImpl implements DataSources {
public
List
<
String
>
getCompanyModel
(
Collection
<
CompanyModel
>
data
)
{
public
List
<
String
>
getCompanyModel
(
Collection
<
UserOrgTreeModel
>
data
,
List
<
String
>
datas
)
{
List
<
String
>
datas
=
new
ArrayList
<>();
if
(!
data
.
isEmpty
())
{
if
(!
data
.
isEmpty
())
{
for
(
Company
Model
datum
:
data
)
{
for
(
UserOrgTree
Model
datum
:
data
)
{
datas
.
add
(
datum
.
get
CompanyName
()
+
"@"
+
datum
.
getSequenceNbr
());
datas
.
add
(
datum
.
get
Id
()
+
"@"
+
datum
.
getName
());
if
(
datum
.
getChildren
()
!=
null
)
{
if
(
datum
.
getChildren
()
!=
null
)
{
this
.
getCompanyModel
children
((
List
<
LinkedHashMap
<
String
,
Object
>>
)
datum
.
getChildren
(),
datas
);
this
.
getCompanyModel
(
datum
.
getChildren
(),
datas
);
}
}
}
}
...
@@ -74,19 +93,7 @@ public class ExDataSourcesImpl implements DataSources {
...
@@ -74,19 +93,7 @@ public class ExDataSourcesImpl implements DataSources {
}
}
public
void
getCompanyModelchildren
(
List
<
LinkedHashMap
<
String
,
Object
>>
data
,
List
<
String
>
datas
)
{
if
(!
data
.
isEmpty
())
{
for
(
LinkedHashMap
<
String
,
Object
>
datum
:
data
)
{
datas
.
add
(
datum
.
get
(
"companyName"
)
+
"@"
+
datum
.
get
(
"sequenceNbr"
));
if
(
datum
.
get
(
"children"
)!=
null
)
{
this
.
getCompanyModelchildren
((
List
<
LinkedHashMap
<
String
,
Object
>>
)
datum
.
get
(
"children"
),
datas
);
}
}
}
}
private
String
[]
getDataDictionary
(
String
type
)
{
private
String
[]
getDataDictionary
(
String
type
)
{
List
<
String
>
collect
=
new
ArrayList
<>();
List
<
String
>
collect
=
new
ArrayList
<>();
...
...
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