Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
test
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
邬友楠
test
Commits
87defca5
Commit
87defca5
authored
Jul 06, 2020
by
雍欢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
@Transactional
parent
0e28035b
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
301 additions
and
225 deletions
+301
-225
ValidStatus.java
...u-common/src/main/java/com/huigou/domain/ValidStatus.java
+3
-3
AccessApplicationImpl.java
...a/com/huigou/uasp/bmp/opm/impl/AccessApplicationImpl.java
+19
-1
AgentApplicationImpl.java
...va/com/huigou/uasp/bmp/opm/impl/AgentApplicationImpl.java
+4
-1
ManagementApplicationImpl.java
...m/huigou/uasp/bmp/opm/impl/ManagementApplicationImpl.java
+13
-0
OrgApplicationImpl.java
...java/com/huigou/uasp/bmp/opm/impl/OrgApplicationImpl.java
+23
-0
OrgTemplateApplicationImpl.java
.../huigou/uasp/bmp/opm/impl/OrgTemplateApplicationImpl.java
+3
-1
OrgTypeApplicationImpl.java
.../com/huigou/uasp/bmp/opm/impl/OrgTypeApplicationImpl.java
+6
-0
PermissionApplicationImpl.java
...m/huigou/uasp/bmp/opm/impl/PermissionApplicationImpl.java
+3
-2
RoleBizManagementApplicationImpl.java
...u/uasp/bmp/opm/impl/RoleBizManagementApplicationImpl.java
+3
-0
SysFunctionApplicationImpl.java
.../huigou/uasp/bmp/opm/impl/SysFunctionApplicationImpl.java
+8
-0
TMAuthorizeApplicationImpl.java
.../huigou/uasp/bmp/opm/impl/TMAuthorizeApplicationImpl.java
+2
-0
TenantApplicationImpl.java
...a/com/huigou/uasp/bmp/opm/impl/TenantApplicationImpl.java
+4
-0
UIElementApplicationImpl.java
...om/huigou/uasp/bmp/opm/impl/UIElementApplicationImpl.java
+4
-1
UserGroupApplicationImpl.java
...om/huigou/uasp/bmp/opm/impl/UserGroupApplicationImpl.java
+6
-1
pom.xml
huigou-data/pom.xml
+110
-106
CommonDomainService.java
...a/com/huigou/data/domain/service/CommonDomainService.java
+42
-55
.gitignore
huigou-demo/.gitignore
+10
-0
OrgFunTests.java
...rc/test/java/com/huigou/uasp/bmp/fn/impl/OrgFunTests.java
+0
-54
pom.xml
pom.xml
+38
-0
No files found.
huigou-common/src/main/java/com/huigou/domain/ValidStatus.java
View file @
87defca5
...
...
@@ -11,11 +11,11 @@ import com.huigou.exception.ApplicationException;
public
enum
ValidStatus
{
LOGIC_DELETE
(-
1
,
"删除"
),
DISABLED
(
0
,
"禁用"
),
ENABLED
(
1
,
"启用"
);
p
rivate
final
Integer
id
;
p
ublic
final
Integer
id
;
p
rivate
final
String
displayName
;
p
ublic
final
String
displayName
;
private
ValidStatus
(
int
id
,
String
displayName
)
{
ValidStatus
(
int
id
,
String
displayName
)
{
this
.
id
=
id
;
this
.
displayName
=
displayName
;
}
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/AccessApplicationImpl.java
View file @
87defca5
...
...
@@ -145,6 +145,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
}
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
saveRole
(
Role
role
)
{
Assert
.
notNull
(
role
,
"参数role不能为空。"
);
...
...
@@ -204,6 +205,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
return
queryDescriptor
.
getSqlByName
(
name
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
deleteRoles
(
List
<
String
>
ids
)
{
...
...
@@ -239,11 +241,13 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
this
.
roleRepository
.
delete
(
roles
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateRolesSequence
(
Map
<
String
,
Integer
>
params
)
{
this
.
commonDomainService
.
updateSequence
(
Role
.
class
,
params
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
moveRoles
(
List
<
String
>
ids
,
String
parentId
)
{
Role
parentRole
=
this
.
loadRole
(
parentId
);
...
...
@@ -252,6 +256,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
this
.
commonDomainService
.
moveTree
(
Role
.
class
,
ids
,
parentId
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
moveTenantRoles
(
List
<
String
>
ids
,
String
parentId
)
{
Role
parentRole
=
this
.
loadRole
(
parentId
);
...
...
@@ -334,7 +339,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
}
@Override
@Transactional
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
void
saveInitPermissionResourceKind
()
{
Map
<
String
,
String
>
map
=
PermissionResourceKind
.
getData
();
for
(
String
resourceKindId
:
map
.
keySet
())
{
...
...
@@ -353,12 +358,14 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
}
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
savePermission
(
Permission
permission
)
{
permission
=
(
Permission
)
this
.
commonDomainService
.
saveTreeEntity
(
permission
,
this
.
permissionRepository
,
true
,
false
);
return
permission
.
getId
();
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updatePermission
(
Permission
permission
)
{
Permission
dbPermission
=
this
.
loadPermission
(
permission
.
getId
());
...
...
@@ -370,6 +377,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
this
.
commonDomainService
.
saveTreeEntity
(
dbPermission
,
permissionRepository
,
oldName
,
true
,
false
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updatePermissionsStatus
(
List
<
String
>
ids
,
Integer
status
)
{
this
.
commonDomainService
.
updateStatus
(
Permission
.
class
,
ids
,
status
);
...
...
@@ -381,6 +389,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
return
this
.
permissionRepository
.
findOne
(
id
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deletePermissions
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
@@ -401,12 +410,14 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
this
.
permissionRepository
.
delete
(
permissions
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updatePermissionsSequence
(
Map
<
String
,
Integer
>
permissions
)
{
Assert
.
notEmpty
(
permissions
,
"参数permissions不能为空。"
);
this
.
commonDomainService
.
updateSequence
(
Permission
.
class
,
permissions
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
movePermissions
(
List
<
String
>
ids
,
String
parentId
)
{
this
.
commonDomainService
.
moveForTree
(
Permission
.
class
,
ids
,
CommonDomainConstants
.
PARENT_ID_COLUMN_NAME
,
parentId
);
...
...
@@ -426,6 +437,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
this
.
uiElementPermissionRepository
.
save
(
uiElementPermissions
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteUIElementPermissions
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
ID_NOT_BLANK
));
...
...
@@ -445,6 +457,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
return
this
.
commonDomainService
.
getNextSequence
(
Permission
.
class
,
CommonDomainConstants
.
PARENT_ID_FIELD_NAME
,
parentId
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
allocateRoles
(
String
orgId
,
List
<
String
>
roleIds
)
{
Assert
.
hasText
(
orgId
,
"参数orgId不能为空。"
);
...
...
@@ -461,6 +474,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
this
.
orgApplication
.
updateOrg
(
org
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deallocateRoles
(
String
orgId
,
List
<
String
>
roleIds
)
{
Assert
.
hasText
(
orgId
,
"参数orgId不能为空。"
);
...
...
@@ -506,6 +520,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
return
generalRepository
.
query
(
sql
,
params
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
allocateFunPermissions
(
String
roleId
,
String
oneLevelPermissionId
,
List
<
String
>
permissionIds
)
{
Assert
.
hasText
(
roleId
,
"角色ID不能为空。"
);
...
...
@@ -558,6 +573,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
this
.
rolePermissionRepository
.
save
(
rolePermissions
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deallocateFunPermissions
(
String
roleId
,
List
<
String
>
permissionIds
)
{
Assert
.
hasText
(
roleId
,
"参数roleId不能为空。"
);
...
...
@@ -773,6 +789,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
}
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
synThreeMemberPermission
()
{
String
sql
=
this
.
getAccessQuerySqlByName
(
"queryThreeMemberPermssion"
);
...
...
@@ -811,6 +828,7 @@ public class AccessApplicationImpl extends BaseApplication implements AccessAppl
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
quoteRole
(
String
sourceOrgId
,
String
destOrgId
)
{
List
<
String
>
roleIds
=
roleRepository
.
findByOrgId
(
sourceOrgId
).
stream
()
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/AgentApplicationImpl.java
View file @
87defca5
...
...
@@ -7,6 +7,7 @@ import java.util.Map;
import
com.huigou.uasp.bmp.opm.proxy.AgentApplicationProxy
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
com.huigou.context.MessageSourceContext
;
...
...
@@ -31,7 +32,7 @@ public class AgentApplicationImpl extends BaseApplication implements AgentApplic
this
.
agentRepository
=
agentRepository
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
saveAgent
(
Agent
agent
)
{
Assert
.
notNull
(
agent
,
"参数agent不能为空。"
);
...
...
@@ -65,6 +66,7 @@ public class AgentApplicationImpl extends BaseApplication implements AgentApplic
return
null
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteAgents
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
@@ -79,6 +81,7 @@ public class AgentApplicationImpl extends BaseApplication implements AgentApplic
this
.
agentRepository
.
delete
(
agents
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteAgentProcs
(
String
agentId
,
List
<
String
>
ids
)
{
Assert
.
hasText
(
agentId
,
"参数agentId不能为空。"
);
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/ManagementApplicationImpl.java
View file @
87defca5
...
...
@@ -24,6 +24,7 @@ import com.huigou.uasp.bmp.opm.repository.org.OrgRepository;
import
com.huigou.util.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
java.util.ArrayList
;
...
...
@@ -76,6 +77,7 @@ public class ManagementApplicationImpl extends BaseApplication implements Manage
this
.
permissionBuilder
=
permissionBuilder
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
saveBaseManagementType
(
BaseManagementType
baseManagementType
,
String
bizManagementTypeId
)
{
Assert
.
notNull
(
baseManagementType
,
"参数baseManagementType不能为空。"
);
...
...
@@ -92,6 +94,7 @@ public class ManagementApplicationImpl extends BaseApplication implements Manage
return
baseManagementType
.
getId
();
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteBaseManagementTypes
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
@@ -107,11 +110,13 @@ public class ManagementApplicationImpl extends BaseApplication implements Manage
return
this
.
commonDomainService
.
getNextSequence
(
BaseManagementType
.
class
,
CommonDomainConstants
.
FOLDER_ID_FIELD_NAME
,
folderId
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateBaseManagementTypeSequence
(
Map
<
String
,
Integer
>
params
)
{
this
.
commonDomainService
.
updateSequence
(
BaseManagementType
.
class
,
params
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
moveBaseManagementTypes
(
List
<
String
>
ids
,
String
folderId
)
{
this
.
commonDomainService
.
moveForFolder
(
BaseManagementType
.
class
,
ids
,
folderId
);
...
...
@@ -129,6 +134,7 @@ public class ManagementApplicationImpl extends BaseApplication implements Manage
return
this
.
sqlExecutorDao
.
executeSlicedQuery
(
queryDescriptor
,
queryRequest
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
saveBizManagementType
(
BizManagementType
bizManagementType
)
{
BizManagementType
dbBizManagementType
;
...
...
@@ -147,6 +153,7 @@ public class ManagementApplicationImpl extends BaseApplication implements Manage
return
dbBizManagementType
.
getId
();
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteBizManagementTypes
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
ID_NOT_BLANK
));
...
...
@@ -176,12 +183,14 @@ public class ManagementApplicationImpl extends BaseApplication implements Manage
return
this
.
commonDomainService
.
getNextSequence
(
BizManagementType
.
class
,
CommonDomainConstants
.
PARENT_ID_FIELD_NAME
,
parentId
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateBizManagementTypeSequence
(
Map
<
String
,
Integer
>
params
)
{
this
.
commonDomainService
.
updateSequence
(
BizManagementType
.
class
,
params
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
moveBizManagementTypes
(
List
<
String
>
ids
,
String
parentId
)
{
this
.
commonDomainService
.
moveForTree
(
BizManagementType
.
class
,
ids
,
CommonDomainConstants
.
PARENT_ID_COLUMN_NAME
,
parentId
);
...
...
@@ -254,6 +263,7 @@ public class ManagementApplicationImpl extends BaseApplication implements Manage
}
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
allocateManagers
(
List
<
String
>
managerIds
,
String
manageTypeId
,
String
subordinationId
)
{
Assert
.
notEmpty
(
managerIds
,
"参数manageTypeId不能为空。"
);
...
...
@@ -266,6 +276,7 @@ public class ManagementApplicationImpl extends BaseApplication implements Manage
internalAllocateBizManagement
(
managerIds
,
manageTypeId
,
subordinationIds
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
allocateSubordinations
(
String
managerId
,
String
manageTypeId
,
List
<
String
>
subordinationIds
)
{
Assert
.
hasText
(
managerId
,
"参数managerId不能为空。"
);
...
...
@@ -278,6 +289,7 @@ public class ManagementApplicationImpl extends BaseApplication implements Manage
internalAllocateBizManagement
(
managerIds
,
manageTypeId
,
subordinationIds
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteBizManagements
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
@@ -359,6 +371,7 @@ public class ManagementApplicationImpl extends BaseApplication implements Manage
permissionBuilder
.
removeCache
();
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
quoteBizManagement
(
String
sourceOrgId
,
String
destOrgId
)
{
if
(!
orgRepository
.
exists
(
sourceOrgId
)
||
!
orgRepository
.
exists
(
destOrgId
))
{
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/OrgApplicationImpl.java
View file @
87defca5
...
...
@@ -133,6 +133,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
return
licenseChecker
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
saveOrgPropertyDefinition
(
OrgPropertyDefinition
orgPropertyDefinition
)
{
Assert
.
notNull
(
orgPropertyDefinition
,
"参数orgPropertyDefinition不能为空。"
);
...
...
@@ -158,6 +159,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
return
this
.
orgPropertyDefinitionRepository
.
findOne
(
id
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteOrgPropertyDefinitions
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
@@ -174,6 +176,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
this
.
orgPropertyDefinitionRepository
.
delete
(
orgPropertyDefinitions
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateOrgPropertyDefinitionsSequence
(
Map
<
String
,
Integer
>
params
)
{
this
.
commonDomainService
.
updateSequence
(
OrgPropertyDefinition
.
class
,
params
);
...
...
@@ -510,6 +513,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
return
internalInsertOrg
(
org
,
orgType
).
getId
();
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateOrg
(
Org
org
)
{
Assert
.
notNull
(
org
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
OBJECT_NOT_NULL
));
...
...
@@ -630,6 +634,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
this
.
generalRepository
.
updateByNativeSql
(
jpql
,
params
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
logicDeleteOrg
(
List
<
String
>
ids
)
{
ArrayList
<
ValidStatus
>
fromStatuses
=
new
ArrayList
<
ValidStatus
>(
2
);
...
...
@@ -871,6 +876,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
this
.
updateOrgStatus
(
id
,
fromStatuses
,
ValidStatus
.
ENABLED
,
"还原组织"
,
isEnableSubordinatePsm
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
insertPersonMembers
(
List
<
String
>
personIds
,
String
positionId
,
ValidStatus
status
,
Boolean
autoEnableOldPsm
)
{
for
(
String
personId
:
personIds
)
{
...
...
@@ -880,6 +886,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
}
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
insertPersonMember
(
Person
person
,
Org
position
,
ValidStatus
psmStatus
,
boolean
autoEnableOldPsm
)
{
if
(
psmStatus
==
null
)
{
...
...
@@ -935,6 +942,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
return
personMemberId
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateOrgSequence
(
Map
<
String
,
String
>
params
)
{
String
newFullSequence
,
sequence
;
...
...
@@ -970,6 +978,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
enableOrg
(
String
id
,
Boolean
isEnableSubordinatePsm
)
{
ArrayList
<
ValidStatus
>
fromStatuses
=
new
ArrayList
<
ValidStatus
>();
...
...
@@ -977,12 +986,14 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
this
.
updateOrgStatus
(
id
,
fromStatuses
,
ValidStatus
.
ENABLED
,
"启用组织"
,
isEnableSubordinatePsm
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
enableSubordinatePsm
(
String
orgId
,
String
personId
)
{
enablePerson
(
personId
,
false
);
enableOrg
(
orgId
,
false
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
disableOrg
(
String
id
)
{
ArrayList
<
ValidStatus
>
fromStatuses
=
new
ArrayList
<
ValidStatus
>(
1
);
...
...
@@ -1175,6 +1186,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
return
this
.
orgRepository
.
findOrgByLoginName
(
loginName
.
toUpperCase
());
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
changePersonMainOrg
(
String
id
,
String
personMemberId
,
boolean
isDisableOldMasterPsm
)
{
// 1、判断设置后的人员成员是否存在
...
...
@@ -1313,6 +1325,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
return
personId
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updatePerson
(
Person
person
)
{
Assert
.
notNull
(
person
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
OBJECT_NOT_NULL
));
...
...
@@ -1335,6 +1348,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
}
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updatePersonSimple
(
Person
person
)
{
Assert
.
notNull
(
person
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
OBJECT_NOT_NULL
));
...
...
@@ -1355,12 +1369,14 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
* @param operateType 操作类型
* @param isEnableSubordinatePsm 是否允许从属人员成员
*/
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
private
void
updatePersonStatus
(
String
id
,
Collection
<
ValidStatus
>
fromStatuses
,
ValidStatus
toStatus
,
String
operateType
,
boolean
isEnableSubordinatePsm
)
{
Org
personMember
=
this
.
orgRepository
.
findMainOrgByPersonId
(
id
);
Assert
.
notNull
(
personMember
,
String
.
format
(
"未找到人员ID“%s”对应的人员。"
,
id
));
this
.
updateOrgStatus
(
personMember
.
getId
(),
fromStatuses
,
toStatus
,
operateType
,
isEnableSubordinatePsm
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
logicDeletePerson
(
String
id
)
{
List
<
ValidStatus
>
fromStatuses
=
new
ArrayList
<
ValidStatus
>();
...
...
@@ -1369,6 +1385,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
this
.
updatePersonStatus
(
id
,
fromStatuses
,
ValidStatus
.
LOGIC_DELETE
,
"删除人员"
,
true
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
physicalDeletePerson
(
String
id
)
{
Assert
.
hasText
(
id
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
ID_NOT_BLANK
));
...
...
@@ -1416,6 +1433,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
return
this
.
personRepository
.
findByCaNo
(
caNo
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
enablePerson
(
String
id
,
boolean
isEnableSubordinatePsm
)
{
ArrayList
<
ValidStatus
>
fromStatuses
=
new
ArrayList
<
ValidStatus
>();
...
...
@@ -1423,6 +1441,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
updatePersonStatus
(
id
,
fromStatuses
,
ValidStatus
.
ENABLED
,
"启用人员"
,
isEnableSubordinatePsm
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
disablePerson
(
String
id
)
{
ArrayList
<
ValidStatus
>
fromStatuses
=
new
ArrayList
<
ValidStatus
>();
...
...
@@ -1430,6 +1449,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
updatePersonStatus
(
id
,
fromStatuses
,
ValidStatus
.
DISABLED
,
"禁用人员"
,
true
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
initPassword
(
String
personId
)
{
Assert
.
hasText
(
personId
,
String
.
format
(
CommonDomainConstants
.
PARAMETER_NOT_NULL_FORMAT
,
"personId"
));
...
...
@@ -1439,6 +1459,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
this
.
personRepository
.
save
(
person
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
initPassword
(
String
personId
,
String
newPassword
)
{
Assert
.
hasText
(
personId
,
String
.
format
(
CommonDomainConstants
.
PARAMETER_NOT_NULL_FORMAT
,
"personId"
));
...
...
@@ -1503,6 +1524,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
}
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updatePassword
(
String
oldPassword
,
String
newPassword
)
{
Operator
operator
=
ThreadLocalUtil
.
getOperator
();
...
...
@@ -1530,6 +1552,7 @@ public class OrgApplicationImpl extends BaseApplication implements OrgApplicatio
return
this
.
sqlExecutorDao
.
executeSlicedQuery
(
queryModel
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
adjustPersonOrgStructure
(
String
personMemberId
,
String
positionId
,
boolean
isDisableOldPsm
,
boolean
isUpdateMainPosition
)
{
Org
personMember
=
this
.
loadOrg
(
personMemberId
);
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/OrgTemplateApplicationImpl.java
View file @
87defca5
...
...
@@ -44,6 +44,7 @@ public class OrgTemplateApplicationImpl extends BaseApplication implements OrgTe
this
.
orgTypeRepository
=
orgTypeRepository
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
insertOrgTemplates
(
String
parentId
,
List
<
String
>
orgTypeIds
)
{
Assert
.
hasText
(
parentId
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
PARENT_ID_NOT_BLANK
));
...
...
@@ -98,7 +99,7 @@ public class OrgTemplateApplicationImpl extends BaseApplication implements OrgTe
}
@Override
@Transactional
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
void
deleteOrgTemplates
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
@@ -115,6 +116,7 @@ public class OrgTemplateApplicationImpl extends BaseApplication implements OrgTe
this
.
orgTemplateRepository
.
delete
(
orgTemplates
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateOrgTemplateSequence
(
Map
<
String
,
Integer
>
params
)
{
this
.
commonDomainService
.
updateSequence
(
OrgTemplate
.
class
,
params
);
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/OrgTypeApplicationImpl.java
View file @
87defca5
...
...
@@ -6,6 +6,7 @@ import java.util.Map;
import
com.huigou.uasp.bmp.opm.proxy.OrgTypeApplicationProxy
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
com.huigou.context.MessageSourceContext
;
...
...
@@ -50,6 +51,7 @@ public class OrgTypeApplicationImpl extends BaseApplication implements OrgTypeAp
this
.
orgRepository
=
orgRepository
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
saveOrgType
(
OrgType
orgType
)
{
Assert
.
notNull
(
orgType
,
"参数orgType不能为空。"
);
...
...
@@ -58,6 +60,7 @@ public class OrgTypeApplicationImpl extends BaseApplication implements OrgTypeAp
return
orgType
.
getId
();
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteOrgTypes
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
@@ -82,6 +85,7 @@ public class OrgTypeApplicationImpl extends BaseApplication implements OrgTypeAp
this
.
orgTypeRepository
.
delete
(
orgTypes
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
moveOrgType
(
List
<
String
>
ids
,
String
folderId
)
{
this
.
commonDomainService
.
moveForFolder
(
OrgType
.
class
,
ids
,
folderId
);
...
...
@@ -99,11 +103,13 @@ public class OrgTypeApplicationImpl extends BaseApplication implements OrgTypeAp
return
this
.
sqlExecutorDao
.
executeSlicedQuery
(
queryDescriptor
,
queryRequest
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateOrgTypeSequence
(
Map
<
String
,
Integer
>
params
)
{
this
.
commonDomainService
.
updateSequence
(
OrgType
.
class
,
params
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
Integer
getNextSequence
(
String
folderId
)
{
return
this
.
commonDomainService
.
getNextSequence
(
OrgType
.
class
,
CommonDomainConstants
.
FOLDER_ID_FIELD_NAME
,
folderId
);
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/PermissionApplicationImpl.java
View file @
87defca5
...
...
@@ -55,7 +55,7 @@ public class PermissionApplicationImpl extends BaseApplication implements Permis
}
@Override
@Transactional
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
void
buildPermission
(
List
<?
extends
TreeEntity
>
treeEntitys
,
PermissionResourceKind
resourceKind
)
{
Permission
parent
=
null
,
permission
;
String
parentId
=
null
;
...
...
@@ -96,7 +96,7 @@ public class PermissionApplicationImpl extends BaseApplication implements Permis
}
@Override
@Transactional
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
void
updatePermission
(
TreeEntity
treeEntity
,
String
oldName
,
String
oldFullName
,
PermissionResourceKind
resourceKind
)
{
if
(!
treeEntity
.
getName
().
equals
(
oldName
))
{
// 更新权限
...
...
@@ -139,6 +139,7 @@ public class PermissionApplicationImpl extends BaseApplication implements Permis
return
permission
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
movePermission
(
String
parentResourceId
,
List
<
String
>
resourceIds
,
PermissionResourceKind
resourceKind
)
{
Permission
moveToParent
=
null
;
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/RoleBizManagementApplicationImpl.java
View file @
87defca5
...
...
@@ -13,6 +13,7 @@ import com.huigou.uasp.bmp.opm.repository.org.OrgRepository;
import
com.huigou.uasp.bmp.opm.repository.org.RoleRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -56,6 +57,7 @@ public class RoleBizManagementApplicationImpl implements RoleBizManagementApplic
this
.
roleBizManagementMapper
=
roleBizManagementMapper
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
allocateSubordinations
(
String
managerId
,
String
manageTypeId
,
List
<
String
>
subordinationIds
)
{
List
<
RoleBizManagement
>
managements
=
subordinationIds
.
stream
().
distinct
()
...
...
@@ -80,6 +82,7 @@ public class RoleBizManagementApplicationImpl implements RoleBizManagementApplic
return
roleBizManagementMapper
.
slicedQuerySubordination
(
queryRequest
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteByIds
(
List
<
String
>
id
)
{
id
.
forEach
(
roleBizManagementRepository:
:
delete
);
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/SysFunctionApplicationImpl.java
View file @
87defca5
...
...
@@ -15,6 +15,8 @@ import com.huigou.uasp.bmp.opm.repository.org.ResourceOperationRepository;
import
com.huigou.uasp.bmp.opm.repository.org.SysFunctionRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
java.util.ArrayList
;
...
...
@@ -68,6 +70,7 @@ public class SysFunctionApplicationImpl extends BaseApplication implements SysFu
sysFunction
.
checkConstraints
(
other
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
insertSysFunction
(
SysFunction
sysFunction
)
{
Assert
.
notNull
(
sysFunction
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
PARAMETER_NOT_NULL_FORMAT
,
"sysFunction"
));
...
...
@@ -76,6 +79,7 @@ public class SysFunctionApplicationImpl extends BaseApplication implements SysFu
return
sysFunction
.
getId
();
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
updateSysFunction
(
SysFunction
sysFunction
)
{
SysFunction
dbSysFunction
=
this
.
sysFunctionRepository
.
findOne
(
sysFunction
.
getId
());
...
...
@@ -113,6 +117,7 @@ public class SysFunctionApplicationImpl extends BaseApplication implements SysFu
return
this
.
sysFunctionRepository
.
findOne
(
id
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteSysFunctions
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
@@ -128,6 +133,7 @@ public class SysFunctionApplicationImpl extends BaseApplication implements SysFu
this
.
sysFunctionRepository
.
delete
(
sysFunctions
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateSysFunctionsStatus
(
List
<
String
>
ids
,
Integer
status
)
{
this
.
commonDomainService
.
updateStatus
(
SysFunction
.
class
,
ids
,
status
);
...
...
@@ -146,6 +152,7 @@ public class SysFunctionApplicationImpl extends BaseApplication implements SysFu
return
this
.
commonDomainService
.
getNextSequence
(
SysFunction
.
class
,
CommonDomainConstants
.
PARENT_ID_FIELD_NAME
,
parentId
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
@Override
public
void
updateSysFunctionsSequence
(
Map
<
String
,
Integer
>
params
)
{
Assert
.
isTrue
(
params
!=
null
&&
params
.
size
()
>
0
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
PARAMETER_NOT_NULL_FORMAT
,
"params"
));
...
...
@@ -205,6 +212,7 @@ public class SysFunctionApplicationImpl extends BaseApplication implements SysFu
}
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
moveFunctions
(
String
parentId
,
List
<
String
>
ids
)
{
Assert
.
hasText
(
parentId
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
PARENT_ID_NOT_BLANK
));
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/TMAuthorizeApplicationImpl.java
View file @
87defca5
...
...
@@ -19,6 +19,7 @@ import com.huigou.uasp.log.domain.model.ApplicationSystem;
import
com.huigou.util.SDO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
java.util.ArrayList
;
...
...
@@ -83,6 +84,7 @@ public class TMAuthorizeApplicationImpl extends BaseApplication implements TMAut
return
queryDescriptor
.
getSqlByName
(
name
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
saveTMAuthorizes
(
List
<
TMAuthorize
>
tmAuthorizes
,
String
subordinationId
,
String
systemId
,
String
roleKindId
)
{
Assert
.
notNull
(
tmAuthorizes
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
OBJECT_NOT_NULL
));
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/TenantApplicationImpl.java
View file @
87defca5
...
...
@@ -12,6 +12,7 @@ import com.huigou.uasp.bmp.opm.repository.org.TenantRepository;
import
com.huigou.util.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
java.util.List
;
...
...
@@ -33,6 +34,7 @@ public class TenantApplicationImpl extends BaseApplication implements TenantAppl
this
.
orgApplication
=
orgApplication
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
saveTenant
(
Tenant
tenant
)
{
Assert
.
notNull
(
tenant
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
OBJECT_NOT_NULL
));
...
...
@@ -41,6 +43,7 @@ public class TenantApplicationImpl extends BaseApplication implements TenantAppl
return
dbTenant
.
getId
();
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteTenants
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
@@ -53,6 +56,7 @@ public class TenantApplicationImpl extends BaseApplication implements TenantAppl
tenantRepository
.
delete
(
tenants
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateTenantStatus
(
List
<
String
>
ids
,
Integer
status
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/UIElementApplicationImpl.java
View file @
87defca5
...
...
@@ -26,6 +26,7 @@ public class UIElementApplicationImpl extends BaseApplication implements UIEleme
this
.
uiElementRepository
=
uiElementRepository
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
saveUIElement
(
UIElement
uiElement
)
{
Assert
.
notNull
(
uiElement
,
"参数uiElement不能为空。"
);
...
...
@@ -40,6 +41,7 @@ public class UIElementApplicationImpl extends BaseApplication implements UIEleme
return
this
.
uiElementRepository
.
findOne
(
id
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteUIElements
(
List
<
String
>
ids
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
ID_NOT_BLANK
));
...
...
@@ -52,6 +54,7 @@ public class UIElementApplicationImpl extends BaseApplication implements UIEleme
this
.
uiElementRepository
.
deleteInBatch
(
uiElements
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
void
updateUIElementsStatus
(
List
<
String
>
ids
,
Integer
status
)
{
this
.
commonDomainService
.
updateStatus
(
UIElement
.
class
,
ids
,
status
);
}
...
...
@@ -67,7 +70,7 @@ public class UIElementApplicationImpl extends BaseApplication implements UIEleme
}
@Override
@Transactional
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
void
moveUIElements
(
List
<
String
>
ids
,
String
folderId
)
{
this
.
commonDomainService
.
moveForFolder
(
UIElement
.
class
,
ids
,
folderId
);
}
...
...
huigou-core-impl/src/main/java/com/huigou/uasp/bmp/opm/impl/UserGroupApplicationImpl.java
View file @
87defca5
...
...
@@ -52,6 +52,7 @@ public class UserGroupApplicationImpl extends BaseApplication implements UserGro
this
.
userGroupDetailRepository
=
userGroupDetailRepository
;
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
String
saveUserGroup
(
UserGroup
userGroup
)
{
Assert
.
notNull
(
userGroup
,
"参数userGroup不能为空。"
);
...
...
@@ -67,6 +68,7 @@ public class UserGroupApplicationImpl extends BaseApplication implements UserGro
return
userGroup
.
getId
();
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
private
void
saveUserGroupDetail
(
String
id
,
List
<
UserGroupDetail
>
details
)
{
if
(
details
!=
null
&&
details
.
size
()
>
0
)
{
List
<
UserGroupDetail
>
datas
=
new
ArrayList
<>();
...
...
@@ -83,7 +85,7 @@ public class UserGroupApplicationImpl extends BaseApplication implements UserGro
}
@Override
@Transactional
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
void
cleanUserGroupRepeatDetail
(
String
groupId
)
{
Assert
.
hasText
(
groupId
,
"参数groupId不能为空。"
);
UserGroup
userGroup
=
this
.
userGroupRepository
.
findOne
(
groupId
);
...
...
@@ -123,6 +125,7 @@ public class UserGroupApplicationImpl extends BaseApplication implements UserGro
userGroupRepository
.
delete
(
userGroups
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
updateUserGroupsStatus
(
List
<
String
>
ids
,
Integer
status
)
{
Assert
.
notEmpty
(
ids
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_NOT_BLANK
));
...
...
@@ -130,6 +133,7 @@ public class UserGroupApplicationImpl extends BaseApplication implements UserGro
this
.
commonDomainService
.
updateStatus
(
UserGroup
.
class
,
ids
,
status
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
moveUserGroups
(
List
<
String
>
ids
,
String
folderId
)
{
this
.
commonDomainService
.
moveForFolder
(
UserGroup
.
class
,
ids
,
folderId
);
...
...
@@ -151,6 +155,7 @@ public class UserGroupApplicationImpl extends BaseApplication implements UserGro
return
this
.
sqlExecutorDao
.
executeSlicedQuery
(
queryDescriptor
,
queryRequest
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Override
public
void
deleteUserGroupDetails
(
String
groupId
,
List
<
String
>
ids
)
{
List
<
UserGroupDetail
>
userGroupDetails
=
this
.
userGroupDetailRepository
.
findAll
(
ids
);
...
...
huigou-data/pom.xml
View file @
87defca5
...
...
@@ -20,6 +20,10 @@
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jdbc
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-jpa
</artifactId>
...
...
huigou-data/src/main/java/com/huigou/data/domain/service/CommonDomainService.java
View file @
87defca5
...
...
@@ -10,6 +10,7 @@ import javax.persistence.criteria.CriteriaQuery;
import
javax.persistence.criteria.Root
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
...
...
@@ -67,11 +68,10 @@ public class CommonDomainService {
/**
* 获取下一个排序号
*
* @param clazz
* 实体类型
* @param clazz 实体类型
* @return 下一个排序号
*/
@Transactional
@Transactional
(
rollbackFor
=
RuntimeException
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Integer
getNextSequence
(
Class
<?
extends
IdentifiedEntity
>
clazz
)
{
return
getNextSequence
(
clazz
,
null
,
null
);
}
...
...
@@ -79,20 +79,17 @@ public class CommonDomainService {
/**
* 获取下一个排序号
*
* @param clazz
* 实体类型
* @param parentIdFieldName
* 父ID字段名称
* @param parentId
* 父ID
* @param clazz 实体类型
* @param parentIdFieldName 父ID字段名称
* @param parentId 父ID
* @return 下一个排序号
*/
@Transactional
@Transactional
(
rollbackFor
=
RuntimeException
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Integer
getNextSequence
(
Class
<?
extends
IdentifiedEntity
>
clazz
,
String
parentIdFieldName
,
String
parentId
)
{
CriteriaBuilder
cb
=
generalRepository
.
getCriteriaBuilder
();
CriteriaQuery
<
Integer
>
query
=
cb
.
createQuery
(
Integer
.
class
);
Root
<?>
root
=
query
.
from
(
clazz
);
query
.
select
(
cb
.
max
(
root
.<
Integer
>
get
(
CommonDomainConstants
.
SEQUENCE_FIELD_NAME
)));
query
.
select
(
cb
.
max
(
root
.<
Integer
>
get
(
CommonDomainConstants
.
SEQUENCE_FIELD_NAME
)));
if
(!
StringUtil
.
isBlank
(
parentIdFieldName
))
{
query
.
where
(
cb
.
equal
(
root
.
get
(
parentIdFieldName
),
parentId
));
}
...
...
@@ -103,14 +100,10 @@ public class CommonDomainService {
/**
* 移动
*
* @param clazz
* 实体类型
* @param parentIdFieldName
* 父ID字段名称
* @param parentId
* 父ID
* @param ids
* ID列表
* @param clazz 实体类型
* @param parentIdFieldName 父ID字段名称
* @param parentId 父ID
* @param ids ID列表
*/
@Transactional
public
void
move
(
Class
<?
extends
AbstractEntity
>
clazz
,
List
<
String
>
ids
,
String
parentIdFieldName
,
String
parentId
)
{
...
...
@@ -134,14 +127,10 @@ public class CommonDomainService {
/**
* 移动树
*
* @param clazz
* 实体类型
* @param parentIdFieldName
* 父ID字段名称
* @param parentId
* 父ID
* @param ids
* ID列表
* @param clazz 实体类型
* @param parentIdFieldName 父ID字段名称
* @param parentId 父ID
* @param ids ID列表
*/
@SuppressWarnings
(
"unchecked"
)
public
void
moveForTree
(
Class
<?
extends
TreeEntity
>
clazz
,
List
<
String
>
ids
,
String
parentIdFieldName
,
String
parentId
)
{
...
...
@@ -231,12 +220,9 @@ public class CommonDomainService {
/**
* 移动
*
* @param clazz
* 移动实体类型
* @param folderId
* 文件夹
* @param ids
* ID列表
* @param clazz 移动实体类型
* @param folderId 文件夹
* @param ids ID列表
*/
@Transactional
public
void
moveForFolder
(
Class
<?
extends
AbstractEntity
>
clazz
,
List
<
String
>
ids
,
String
folderId
)
{
...
...
@@ -268,6 +254,7 @@ public class CommonDomainService {
return
this
.
generalRepository
.
query
(
jpql
,
params
);
}
@Transactional
(
rollbackFor
=
RuntimeException
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
void
updateSequence
(
Class
<?
extends
AbstractEntity
>
clazz
,
Map
<
String
,
Integer
>
params
)
{
Assert
.
notNull
(
clazz
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
CLAZZ_NOT_NULL
));
Assert
.
notEmpty
(
params
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
PARAMETER_NOT_NULL_FORMAT
,
"params"
));
...
...
@@ -328,7 +315,7 @@ public class CommonDomainService {
this
.
generalRepository
.
updateByNativeSql
(
jpql
,
params
);
}
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
BaseInfoWithFolderAbstractEntity
saveBaseInfoWithFolderEntity
(
BaseInfoWithFolderAbstractEntity
entity
,
JpaRepository
repository
)
{
Assert
.
notNull
(
entity
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
OBJECT_NOT_NULL
));
Assert
.
notNull
(
repository
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
REPOSITORY_NOT_NULL
));
...
...
@@ -357,7 +344,7 @@ public class CommonDomainService {
return
entity
;
}
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
FlowBillAbstractEntity
saveFlowBillEntity
(
FlowBillAbstractEntity
entity
,
JpaRepository
repository
)
{
Assert
.
notNull
(
entity
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
OBJECT_NOT_NULL
));
Assert
.
notNull
(
repository
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
REPOSITORY_NOT_NULL
));
...
...
@@ -376,12 +363,12 @@ public class CommonDomainService {
return
entity
;
}
@SuppressWarnings
({
"rawtypes"
})
@SuppressWarnings
({
"rawtypes"
})
public
TreeEntity
saveTreeEntity
(
TreeEntity
entity
,
JpaRepository
repository
)
{
return
saveTreeEntity
(
entity
,
repository
,
true
);
}
@SuppressWarnings
({
"rawtypes"
})
@SuppressWarnings
({
"rawtypes"
})
public
TreeEntity
saveTreeEntity
(
TreeEntity
entity
,
JpaRepository
repository
,
boolean
useDefaultCheck
)
{
return
saveTreeEntity
(
entity
,
repository
,
useDefaultCheck
,
true
);
}
...
...
@@ -397,7 +384,7 @@ public class CommonDomainService {
// return result;
// }
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
TreeEntity
saveTreeEntity
(
TreeEntity
entity
,
JpaRepository
repository
,
boolean
useDefaultCheck
,
boolean
globalCode
)
{
Assert
.
notNull
(
entity
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
PARAMETER_NOT_NULL_FORMAT
,
"entity"
));
Assert
.
notNull
(
repository
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
REPOSITORY_NOT_NULL
));
...
...
@@ -475,7 +462,7 @@ public class CommonDomainService {
return
entity
;
}
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
BaseInfoAbstractEntity
saveBaseInfoEntity
(
BaseInfoAbstractEntity
entity
,
JpaRepository
repository
)
{
Assert
.
notNull
(
entity
,
MessageSourceContext
.
getMessage
(
MessageConstants
.
OBJECT_NOT_NULL
));
...
...
huigou-demo/.gitignore
0 → 100644
View file @
87defca5
/.settings
/.idea
/target
.classpath
.project
.tern-project
*.iml
/bin
/lib
src/main/resource/rebel.xml
\ No newline at end of file
huigou-xt/src/test/java/com/huigou/uasp/bmp/fn/impl/OrgFunTests.java
deleted
100644 → 0
View file @
0e28035b
package
com
.
huigou
.
uasp
.
bmp
.
fn
.
impl
;
import
com.huigou.context.OrgUnit
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.util.List
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
"classpath:applicationContext.xml"
)
public
class
OrgFunTests
{
@Autowired
private
OrgFun
orgFun
;
@Test
public
void
findSubordinations
()
{
String
orgFullId
=
"/E3B4E5C5C6454F81921CF58B7597CE2F.ogn/18FFF477AEEE4609B798015231B400C3.dpt/C18E23AAAA6940E09DF7C122332C51E0.pos/5EEB2DC861694A65933CB4CE9A8D870A@C18E23AAAA6940E09DF7C122332C51E0.psm"
;
// "/7609EDB28F974C5F948CAA24D5ADAB85.ogn"
List
<
OrgUnit
>
units
=
orgFun
.
findSubordinations
(
orgFullId
,
"admin"
,
null
,
true
,
false
);
System
.
out
.
println
(
units
);
}
@Test
public
void
findSubordinationsForNearestManager
()
{
String
orgFullId
=
"/E3B4E5C5C6454F81921CF58B7597CE2F.ogn/18FFF477AEEE4609B798015231B400C3.dpt/C18E23AAAA6940E09DF7C122332C51E0.pos/5EEB2DC861694A65933CB4CE9A8D870A@C18E23AAAA6940E09DF7C122332C51E0.psm"
;
List
<
OrgUnit
>
units
=
orgFun
.
findSubordinationsForNearestManager
(
orgFullId
,
"admin"
,
null
,
false
);
System
.
out
.
println
(
units
);
}
@Test
public
void
findManagers
()
{
String
orgFullId
=
"/E3B4E5C5C6454F81921CF58B7597CE2F.ogn/18FFF477AEEE4609B798015231B400C3.dpt/C18E23AAAA6940E09DF7C122332C51E0.pos/5EEB2DC861694A65933CB4CE9A8D870A@C18E23AAAA6940E09DF7C122332C51E0.psm"
;
List
<
OrgUnit
>
units
=
orgFun
.
findManagers
(
orgFullId
,
"admin"
,
true
,
null
);
System
.
out
.
println
(
units
);
}
@Test
public
void
findNearestManagers
()
{
String
orgFullId
=
"/E3B4E5C5C6454F81921CF58B7597CE2F.ogn/18FFF477AEEE4609B798015231B400C3.dpt/C18E23AAAA6940E09DF7C122332C51E0.pos/5EEB2DC861694A65933CB4CE9A8D870A@C18E23AAAA6940E09DF7C122332C51E0.psm"
;
List
<
OrgUnit
>
units
=
orgFun
.
findNearestManagers
(
orgFullId
,
"admin"
);
System
.
out
.
println
(
units
);
}
@Test
public
void
hasManageType
()
{
String
orgFullId
=
"/E3B4E5C5C6454F81921CF58B7597CE2F.ogn/18FFF477AEEE4609B798015231B400C3.dpt/C18E23AAAA6940E09DF7C122332C51E0.pos/5EEB2DC861694A65933CB4CE9A8D870A@C18E23AAAA6940E09DF7C122332C51E0.psm"
;
System
.
out
.
println
(
"hasManageType: "
+
orgFun
.
hasManageType
(
orgFullId
,
"admin"
));
}
}
pom.xml
View file @
87defca5
...
...
@@ -990,12 +990,24 @@
<groupId>
org.activiti
</groupId>
<artifactId>
activiti-engine
</artifactId>
<version>
${activiti.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.springframework
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.activiti
</groupId>
<artifactId>
activiti-spring
</artifactId>
<version>
${activiti.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.springframework
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- asm -->
...
...
@@ -1567,12 +1579,28 @@
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-jpa
</artifactId>
<version>
${spring-data-jpa.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-aop
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-tx
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-redis
</artifactId>
<version>
${spring-data-redis.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-aop
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
...
...
@@ -1919,6 +1947,16 @@
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-mongodb
</artifactId>
<version>
${spring-data-mongodb.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-aop
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-tx
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
io.github.classgraph
</groupId>
...
...
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