Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
e332fee1
Commit
e332fee1
authored
Jul 27, 2020
by
v_vjyjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
b08fee79
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
center-manage/app/base/service/impl/common/companySve.js
+17
-17
No files found.
center-manage/app/base/service/impl/common/companySve.js
View file @
e332fee1
...
...
@@ -5,7 +5,7 @@ class CompanyService extends ServiceBase {
constructor
()
{
super
(
"common"
,
ServiceBase
.
getDaoName
(
CompanyService
));
}
async
getMyApps
(
appids
,
isSuper
)
{
async
getMyApps
(
appids
,
isSuper
)
{
let
appsrtn
=
null
if
(
isSuper
)
{
appsrtn
=
this
.
db
.
models
.
app
.
findAll
({
...
...
@@ -24,14 +24,14 @@ class CompanyService extends ServiceBase {
}
return
appsrtn
}
async
bindApps
(
appids
,
companyid
)
{
async
bindApps
(
appids
,
companyid
)
{
var
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
)
{
let
u
=
await
self
.
dao
.
update
({
appids
:
appids
,
id
:
companyid
},
t
)
return
appids
})
}
async
setOrgs
(
p
,
cmk
)
{
async
setOrgs
(
p
,
cmk
)
{
var
self
=
this
let
curNodeData
=
p
.
curdata
let
opathstr
=
curNodeData
.
orgpath
...
...
@@ -39,20 +39,20 @@ class CompanyService extends ServiceBase {
let
strjson
=
JSON
.
stringify
(
p
.
orgJson
)
p
.
id
=
p
.
company_id
p
.
orgJson
=
strjson
let
oldopath
=
''
if
(
!
oldNodeData
)
{
//如果不传老对象,表示当前操作是删除节点操作,检查是否存在用户,如果已经存在
let
oldopath
=
''
if
(
!
oldNodeData
)
{
//如果不传老对象,表示当前操作是删除节点操作,检查是否存在用户,如果已经存在
//那么就提示不能删除
let
us
=
await
self
.
db
.
models
.
user
.
findOne
({
where
:
{
opath
:
{
[
self
.
db
.
Op
.
like
]:
`%
${
opathstr
}
%`
}
}})
if
(
us
)
{
let
companytmp
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
id
:
p
.
company_id
}});
let
us
=
await
self
.
db
.
models
.
user
.
findOne
({
where
:
{
opath
:
{
[
self
.
db
.
Op
.
like
]:
`%
${
opathstr
}
%`
}
}
})
if
(
us
)
{
let
companytmp
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
id
:
p
.
company_id
}
});
return
{
orgJson
:
JSON
.
parse
(
companytmp
.
orgJson
)
}
}
else
{
}
else
{
let
u
=
await
this
.
dao
.
update
(
p
)
let
companytmp
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
id
:
p
.
company_id
}});
let
companytmp
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
id
:
p
.
company_id
}
});
return
{
orgJson
:
JSON
.
parse
(
companytmp
.
orgJson
)
}
}
}
else
{
oldopath
=
oldNodeData
.
orgpath
}
else
{
oldopath
=
oldNodeData
.
orgpath
==
''
?
'123456'
:
oldNodeData
.
orgpath
}
return
this
.
db
.
transaction
(
async
function
(
t
)
{
...
...
@@ -85,14 +85,14 @@ class CompanyService extends ServiceBase {
//令用户缓存失效
await
self
.
cacheManager
[
"UserCache"
].
invalidate
(
u
.
userName
)
}
}
else
{
//不是岗位节点,检查修改后的路径是否和原始一致,如果不一致,那么需要查出原始的用户数据
}
else
{
//不是岗位节点,检查修改后的路径是否和原始一致,如果不一致,那么需要查出原始的用户数据
//把原来的路径替换当前新的code
if
(
opathstr
!=
oldopath
)
{
if
(
opathstr
!=
oldopath
)
{
let
us2
=
await
self
.
db
.
models
.
user
.
findAll
({
where
:
{
opath
:
{
[
self
.
db
.
Op
.
like
]:
`%
${
oldopath
}
%`
}
},
transaction
:
t
})
for
(
let
u
of
us2
)
{
let
curpath
=
u
.
opath
let
newpath
=
curpath
.
replace
(
oldNodeData
.
code
,
curNodeData
.
code
)
u
.
opath
=
newpath
let
curpath
=
u
.
opath
let
newpath
=
curpath
.
replace
(
oldNodeData
.
code
,
curNodeData
.
code
)
u
.
opath
=
newpath
u
.
save
({
transaction
:
t
})
//令用户缓存失效
await
self
.
cacheManager
[
"UserCache"
].
invalidate
(
u
.
userName
)
...
...
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