Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AmosBankRoot
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
1
Merge Requests
1
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
bank
AmosBankRoot
Commits
6f3dd1bd
Commit
6f3dd1bd
authored
Jun 11, 2020
by
zhengjiangtao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据隔离
parent
b593c33a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
3 deletions
+93
-3
TopographyServiceImpl.java
...yeejoin/amos/bank/service/impl/TopographyServiceImpl.java
+93
-3
No files found.
AmosBankService/src/main/java/com/yeejoin/amos/bank/service/impl/TopographyServiceImpl.java
View file @
6f3dd1bd
...
@@ -11,6 +11,7 @@ import java.util.stream.Collectors;
...
@@ -11,6 +11,7 @@ import java.util.stream.Collectors;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
...
@@ -37,6 +38,8 @@ import com.yeejoin.amos.op.core.jpa.GenericManagerImpl;
...
@@ -37,6 +38,8 @@ import com.yeejoin.amos.op.core.jpa.GenericManagerImpl;
import
com.yeejoin.amos.spc.business.remote.RemoteSecurityService
;
import
com.yeejoin.amos.spc.business.remote.RemoteSecurityService
;
import
com.yeejoin.amos.spc.business.remote.RemoteWebSocketServer
;
import
com.yeejoin.amos.spc.business.remote.RemoteWebSocketServer
;
import
fr.opensagres.xdocreport.template.velocity.internal.Foreach
;
/**
/**
* 拓扑图service
* 拓扑图service
*
*
...
@@ -44,6 +47,15 @@ import com.yeejoin.amos.spc.business.remote.RemoteWebSocketServer;
...
@@ -44,6 +47,15 @@ import com.yeejoin.amos.spc.business.remote.RemoteWebSocketServer;
*/
*/
@Service
@Service
public
class
TopographyServiceImpl
extends
GenericManagerImpl
<
TopographyTree
,
String
>
implements
ITopographyService
{
public
class
TopographyServiceImpl
extends
GenericManagerImpl
<
TopographyTree
,
String
>
implements
ITopographyService
{
//平台字典管理中配置value为key值
private
static
final
String
BNAK_ORG_KEY
=
"BANK_ORG"
;
//平台字典管理中配置value为key值
private
static
final
String
BNAK_XIAN_KEY
=
"xian"
;
//平台字典管理中配置value为key值
private
static
final
String
BNAK_KEJICHU_KEY
=
"科技处"
;
@Autowired
@Autowired
private
ITopographyTreeRepository
iTopographyTreeDao
;
private
ITopographyTreeRepository
iTopographyTreeDao
;
...
@@ -73,7 +85,12 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
...
@@ -73,7 +85,12 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
@Override
@Override
public
List
<
TopographyTreeDTO
>
getTree
(
String
orgcode
,
int
type
)
{
public
List
<
TopographyTreeDTO
>
getTree
(
String
orgcode
,
int
type
)
{
List
<
TopographyTreeDTO
>
list
=
iTopographyTreeDao
.
findByTypeAndOrgCode
(
type
,
orgcode
).
stream
().
map
(
t
->
convert
(
t
)).
collect
(
Collectors
.
toList
());
List
<
TopographyTreeDTO
>
list
=
iTopographyTreeDao
.
findByTypeAndOrgCode
(
type
,
orgcode
).
stream
().
map
(
t
->
convert
(
t
)).
collect
(
Collectors
.
toList
());
boolean
judgeDeviceAuth
=
JudgeDeviceAuth
(
list
,
orgcode
);
if
(
false
==
judgeDeviceAuth
)
{
return
new
ArrayList
<
TopographyTreeDTO
>();
}
Map
<
String
,
TopographyTreeDTO
>
map
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
n
->
n
.
getId
(),
n
->
n
));
Map
<
String
,
TopographyTreeDTO
>
map
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
n
->
n
.
getId
(),
n
->
n
));
list
.
forEach
(
n
->
{
list
.
forEach
(
n
->
{
if
(
n
.
getParent
()
!=
null
)
{
if
(
n
.
getParent
()
!=
null
)
{
...
@@ -90,6 +107,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
...
@@ -90,6 +107,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
topographyTreeDTO
.
setParent
(
node
.
getParentCode
());
topographyTreeDTO
.
setParent
(
node
.
getParentCode
());
topographyTreeDTO
.
setTreeCode
(
node
.
getTreeCode
());
topographyTreeDTO
.
setTreeCode
(
node
.
getTreeCode
());
topographyTreeDTO
.
setGroup
(
node
.
getGroup
());
topographyTreeDTO
.
setGroup
(
node
.
getGroup
());
topographyTreeDTO
.
setOrgCode
(
node
.
getOrgCode
());
return
topographyTreeDTO
;
return
topographyTreeDTO
;
}
}
...
@@ -144,10 +162,10 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
...
@@ -144,10 +162,10 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
@Override
@Override
public
String
getSelfOrgCode
()
{
public
String
getSelfOrgCode
()
{
List
<
DictionarieValueModel
>
listDictionaryByDictCode
=
remoteSecurityService
.
listDictionaryByDictCode
(
"BANK_ORG"
);
List
<
DictionarieValueModel
>
listDictionaryByDictCode
=
remoteSecurityService
.
listDictionaryByDictCode
(
BNAK_ORG_KEY
);
StringBuffer
sb
=
new
StringBuffer
();
StringBuffer
sb
=
new
StringBuffer
();
listDictionaryByDictCode
.
forEach
(
e
->{
listDictionaryByDictCode
.
forEach
(
e
->{
if
(
"xian"
.
equals
(
e
.
getDictDataKey
())||
"kejichu"
.
equals
(
e
.
getDictDataKey
()))
{
if
(
BNAK_XIAN_KEY
.
equals
(
e
.
getDictDataKey
())||
BNAK_KEJICHU_KEY
.
equals
(
e
.
getDictDataKey
()))
{
sb
.
append
(
'#'
).
append
(
e
.
getDictDataValue
());
sb
.
append
(
'#'
).
append
(
e
.
getDictDataValue
());
}
}
});
});
...
@@ -375,5 +393,77 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
...
@@ -375,5 +393,77 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
}
}
}
}
/**
* 判断该用户登选择公司有无查看该拓扑的权限
* @param list
* @param userOrgCode
* @return
*/
private
boolean
JudgeDeviceAuth
(
List
<
TopographyTreeDTO
>
list
,
String
orgCode
)
{
String
userOrgCode
=
null
;
if
(
orgCode
.
startsWith
(
"%#"
))
{
userOrgCode
=
truncateHeadString
(
orgCode
,
2
);
}
else
{
userOrgCode
=
orgCode
;
}
for
(
TopographyTreeDTO
topographyTreeDTO
:
list
)
{
if
(!
StringUtils
.
isEmpty
(
topographyTreeDTO
.
getOrgCode
()))
{
if
(
topographyTreeDTO
.
getOrgCode
().
contains
(
"#"
))
{
String
[]
array
=
topographyTreeDTO
.
getOrgCode
().
split
(
"#"
);
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
String
str
=
array
[
i
];
if
(
str
.
contains
(
"-"
))
{
String
[]
split
=
str
.
split
(
"-"
);
for
(
int
j
=
0
;
j
<
split
.
length
;
j
++)
{
if
(
userOrgCode
.
equals
(
split
[
j
]))
{
return
true
;
}
}
}
else
{
if
(
userOrgCode
.
equals
(
str
))
{
return
true
;
}
}
}
}
else
{
String
[]
arr
=
topographyTreeDTO
.
getOrgCode
().
split
(
"-"
);
for
(
int
i
=
0
;
i
<
arr
.
length
;
i
++)
{
if
(
userOrgCode
.
equals
(
arr
[
i
]))
{
return
true
;
}
}
}
}
}
return
false
;
}
/**
* 去除字符串前n个字符
* @param origin 要操作的字符串
* @param count 去掉字符串的数量
* @return
*/
public
static
String
truncateHeadString
(
String
origin
,
int
count
)
{
if
(
origin
==
null
||
origin
.
length
()
<
count
)
{
return
null
;
}
char
[]
arr
=
origin
.
toCharArray
();
char
[]
ret
=
new
char
[
arr
.
length
-
count
];
for
(
int
i
=
0
;
i
<
ret
.
length
;
i
++)
{
ret
[
i
]
=
arr
[
i
+
count
];
}
return
String
.
copyValueOf
(
ret
);
}
}
}
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