Commit 87defca5 authored by 雍欢's avatar 雍欢

@Transactional

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