提交 ccc7a4ce 编写于 作者: ibizdev's avatar ibizdev

zhouweidong 发布系统代码 [ibiz-uaa,UAA鉴权]

上级 e33032d0
......@@ -55,14 +55,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Lazy
protected cn.ibizlab.core.uaa.service.ISysUserRoleService sysuserroleService;
@Autowired
@Lazy
protected cn.ibizlab.core.uaa.service.logic.ISysUserdeleteSysUserLogic deletesysuserLogic;
@Autowired
@Lazy
protected cn.ibizlab.core.uaa.service.logic.ISysUsersaveSysUserLogic savesysuserLogic;
protected int batchSize = 500;
@Override
......
package cn.ibizlab.core.uaa.service.logic;
@Deprecated
public interface ISysUserdeleteSysUserLogic {
......
package cn.ibizlab.core.uaa.service.logic;
@Deprecated
public interface ISysUsersaveSysUserLogic {
......
package cn.ibizlab.core.uaa.service.logic.impl;
@Deprecated
public class SysUserdeleteSysUserLogicImpl{
}
package cn.ibizlab.core.uaa.service.logic.impl;
@Deprecated
public class SysUsersaveSysUserLogicImpl{
}
......@@ -6,7 +6,7 @@
<!--输出实体[SYS_AUTHLOG]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_authlog-6-1">
<changeSet author="root" id="tab-sys_authlog-6-1">
<createTable tableName="IBZAUTHLOG">
<column name="LOGID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_AUTHLOG_LOGID"/>
......@@ -32,7 +32,7 @@
<!--输出实体[SYS_OPEN_ACCESS]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_open_access-37-2">
<changeSet author="root" id="tab-sys_open_access-37-2">
<createTable tableName="IBZOPENACCESS">
<column name="ACCESSID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_OPEN_ACCESS_ACCESSID"/>
......@@ -64,7 +64,7 @@
<!--输出实体[SYS_PSSYSTEM]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_pssystem-1-3">
<changeSet author="root" id="tab-sys_pssystem-1-3">
<createTable tableName="IBZPSSYSTEM">
<column name="PSSYSTEMID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_PSSYSTEM_PSSYSTEMID"/>
......@@ -84,7 +84,7 @@
<!--输出实体[SYS_PERMISSION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_permission-8-4">
<changeSet author="root" id="tab-sys_permission-8-4">
<createTable tableName="IBZPERMISSION">
<column name="SYS_PERMISSIONID" remarks="" type="VARCHAR(200)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_PERMISSION_SYS_PERMISSI"/>
......@@ -106,7 +106,7 @@
<!--输出实体[SYS_ROLE]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_role-50-5">
<changeSet author="root" id="tab-sys_role-50-5">
<createTable tableName="IBZROLE">
<column name="SYS_ROLEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_ROLE_SYS_ROLEID"/>
......@@ -130,7 +130,7 @@
<!--输出实体[SYS_ROLE_PERMISSION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_role_permission-25-6">
<changeSet author="root" id="tab-sys_role_permission-25-6">
<createTable tableName="IBZROLE_PERMISSION">
<column name="SYS_ROLE_PERMISSIONID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_ROLE_PERMISSION_SYS_ROL"/>
......@@ -150,7 +150,7 @@
<!--输出实体[SYS_USER_AUTH]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_user_auth-24-7">
<changeSet author="root" id="tab-sys_user_auth-24-7">
<createTable tableName="IBZUSERAUTH">
<column name="AUTHID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_USER_AUTH_AUTHID"/>
......@@ -168,7 +168,7 @@
<!--输出实体[SYS_USER_ROLE]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_user_role-15-8">
<changeSet author="root" id="tab-sys_user_role-15-8">
<createTable tableName="IBZUSER_ROLE">
<column name="SYS_USER_ROLEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_USER_ROLE_SYS_USER_ROLE"/>
......@@ -189,13 +189,13 @@
<!--输出实体[SYS_PSSYSTEM]外键关系 -->
<!--输出实体[SYS_PERMISSION]外键关系 -->
<!--输出实体[SYS_ROLE]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_role-50-9">
<changeSet author="root" id="fk-sys_role-50-9">
<addForeignKeyConstraint baseColumnNames="PROLEID" baseTableName="IBZROLE" constraintName="DER1N_SYS_ROLE_SYS_ROLE_PROLEI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SYS_ROLEID" referencedTableName="IBZROLE" validate="true"/>
</changeSet>
<!--输出实体[SYS_ROLE_PERMISSION]外键关系 -->
<!--输出实体[SYS_USER_AUTH]外键关系 -->
<!--输出实体[SYS_USER_ROLE]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_user_role-15-10">
<changeSet author="root" id="fk-sys_user_role-15-10">
<addForeignKeyConstraint baseColumnNames="SYS_ROLEID" baseTableName="IBZUSER_ROLE" constraintName="DER1N_SYS_USER_ROLE_SYS_ROLE_S" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SYS_ROLEID" referencedTableName="IBZROLE" validate="true"/>
</changeSet>
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:tns="http://www.jboss.org/drools" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.mvel.org/2.0" id="Definition" name="" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<process id="cn.ibizlab.core.extensions.service.logic.execute" isClosed="false" isExecutable="true" name="uaa_sysuser_deletesysuser.execLogic" processType="Private" tns:packageName="cn.ibizlab.core.extensions.service.logic.execute">
<extensionElements>
<tns:import name="java.util.Map"/>
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
</extensionElements>
<startEvent id="begin" isInterrupting="true"/>
<endEvent id="prepareparam1_end" name="end"/>
<callActivity activiti:exclusive="true" calledElement="cn.ibizlab.core.uaa.service.logic.sysuserdeletesysuser" id="deleteSysUser" name="SysUserdeleteSysUserRuleFlow.bpmn"/>
<sequenceFlow id="begin_deleteSysUser" sourceRef="begin" targetRef="deleteSysUser"/>
<sequenceFlow id="deleteSysUser_deleteSysUser" sourceRef="deleteSysUser" targetRef="prepareparam1_end"/>
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:tns="http://www.jboss.org/drools" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.mvel.org/2.0" id="Definition" name="" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<process id="cn.ibizlab.core.extensions.service.logic.execute" isClosed="false" isExecutable="true" name="uaa_sysuser_savesysuser.execLogic" processType="Private" tns:packageName="cn.ibizlab.core.extensions.service.logic.execute">
<extensionElements>
<tns:import name="java.util.Map"/>
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
</extensionElements>
<startEvent id="begin" isInterrupting="true"/>
<endEvent id="prepareparam1_end" name="end"/>
<callActivity activiti:exclusive="true" calledElement="cn.ibizlab.core.uaa.service.logic.sysusersavesysuser" id="saveSysUser" name="SysUsersaveSysUserRuleFlow.bpmn"/>
<sequenceFlow id="begin_saveSysUser" sourceRef="begin" targetRef="saveSysUser"/>
<sequenceFlow id="saveSysUser_saveSysUser" sourceRef="saveSysUser" targetRef="prepareparam1_end"/>
</process>
</definitions>
......@@ -5,6 +5,10 @@
<tns:import name="java.util.Map" />
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
<tns:metaData express="" name="sysuserdeletesysuserdefault" type="entity"/>
<tns:metaData express="T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(cn.ibizlab.core.uaa.service.ISysUserService))" name="sysuserservice" type="service"/>
<tns:metaData express="T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(cn.ibizlab.core.uaa.service.ISysUserService))" name="iBzSysSysuserDefaultService" type="service"/>
<tns:metaData express="T(cn.ibizlab.util.security.AuthenticationUser).getAuthenticationUser()" name="curuser" type="session"/>
<tns:global identifier="sysuserdeletesysuserdefault" type="cn.ibizlab.core.uaa.domain.SysUser" />
</extensionElements>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="sysuserdeletesysuserdeaction1" id="deaction1" implementation="http://www.jboss.org/drools/rule" name="同步删除用户"/>
......
......@@ -5,6 +5,10 @@
<tns:import name="java.util.Map" />
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
<tns:metaData express="" name="sysusersavesysuserdefault" type="entity"/>
<tns:metaData express="T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(cn.ibizlab.core.uaa.service.ISysUserService))" name="sysuserservice" type="service"/>
<tns:metaData express="T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(cn.ibizlab.core.uaa.service.ISysUserService))" name="iBzSysSysuserDefaultService" type="service"/>
<tns:metaData express="T(cn.ibizlab.util.security.AuthenticationUser).getAuthenticationUser()" name="curuser" type="session"/>
<tns:global identifier="sysusersavesysuserdefault" type="cn.ibizlab.core.uaa.domain.SysUser" />
</extensionElements>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="sysusersavesysuserprepareparam1" id="prepareparam1" implementation="http://www.jboss.org/drools/rule" name="设置用户为管理员"/>
......
......@@ -367,6 +367,17 @@
<version>${rocketmq.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.3.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.10.RELEASE</version>
</dependency>
</dependencies>
......
......@@ -69,7 +69,7 @@ public class SysAppResource {
SysApp domain = sysappMapping.toDomain(sysappdto);
domain .setId(sysapp_id);
sysappService.update(domain );
SysAppDTO dto = sysappMapping.toDto(domain );
SysAppDTO dto = sysappMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -116,8 +116,10 @@ public class SysAppResource {
@ApiOperation(value = "保存应用", tags = {"应用" }, notes = "保存应用")
@RequestMapping(method = RequestMethod.POST, value = "/sysapps/save")
public ResponseEntity<Boolean> save(@RequestBody SysAppDTO sysappdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysappService.save(sysappMapping.toDomain(sysappdto)));
public ResponseEntity<SysAppDTO> save(@RequestBody SysAppDTO sysappdto) {
SysApp domain = sysappMapping.toDomain(sysappdto);
sysappService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysappMapping.toDto(domain));
}
@ApiOperation(value = "批量保存应用", tags = {"应用" }, notes = "批量保存应用")
......
......@@ -70,7 +70,7 @@ public class SysAuthLogResource {
SysAuthLog domain = sysauthlogMapping.toDomain(sysauthlogdto);
domain .setLogid(sysauthlog_id);
sysauthlogService.update(domain );
SysAuthLogDTO dto = sysauthlogMapping.toDto(domain );
SysAuthLogDTO dto = sysauthlogMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -122,8 +122,10 @@ public class SysAuthLogResource {
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysAuthLog-Save-all')")
@ApiOperation(value = "保存认证日志", tags = {"认证日志" }, notes = "保存认证日志")
@RequestMapping(method = RequestMethod.POST, value = "/sysauthlogs/save")
public ResponseEntity<Boolean> save(@RequestBody SysAuthLogDTO sysauthlogdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysauthlogService.save(sysauthlogMapping.toDomain(sysauthlogdto)));
public ResponseEntity<SysAuthLogDTO> save(@RequestBody SysAuthLogDTO sysauthlogdto) {
SysAuthLog domain = sysauthlogMapping.toDomain(sysauthlogdto);
sysauthlogService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysauthlogMapping.toDto(domain));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysAuthLog-Save-all')")
......
......@@ -72,7 +72,7 @@ public class SysOpenAccessResource {
SysOpenAccess domain = sysopenaccessMapping.toDomain(sysopenaccessdto);
domain .setId(sysopenaccess_id);
sysopenaccessService.update(domain );
SysOpenAccessDTO dto = sysopenaccessMapping.toDto(domain );
SysOpenAccessDTO dto = sysopenaccessMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -124,8 +124,10 @@ public class SysOpenAccessResource {
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Save-all')")
@ApiOperation(value = "保存第三方认证平台", tags = {"第三方认证平台" }, notes = "保存第三方认证平台")
@RequestMapping(method = RequestMethod.POST, value = "/sysopenaccesses/save")
public ResponseEntity<Boolean> save(@RequestBody SysOpenAccessDTO sysopenaccessdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysopenaccessService.save(sysopenaccessMapping.toDomain(sysopenaccessdto)));
public ResponseEntity<SysOpenAccessDTO> save(@RequestBody SysOpenAccessDTO sysopenaccessdto) {
SysOpenAccess domain = sysopenaccessMapping.toDomain(sysopenaccessdto);
sysopenaccessService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysopenaccessMapping.toDto(domain));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Save-all')")
......
......@@ -73,7 +73,7 @@ public class SysPermissionResource {
SysPermission domain = syspermissionMapping.toDomain(syspermissiondto);
domain .setPermissionid(syspermission_id);
syspermissionService.update(domain );
SysPermissionDTO dto = syspermissionMapping.toDto(domain );
SysPermissionDTO dto = syspermissionMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -125,8 +125,10 @@ public class SysPermissionResource {
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysPermission-Save-all')")
@ApiOperation(value = "保存权限/资源", tags = {"权限/资源" }, notes = "保存权限/资源")
@RequestMapping(method = RequestMethod.POST, value = "/syspermissions/save")
public ResponseEntity<Boolean> save(@RequestBody SysPermissionDTO syspermissiondto) {
return ResponseEntity.status(HttpStatus.OK).body(syspermissionService.save(syspermissionMapping.toDomain(syspermissiondto)));
public ResponseEntity<SysPermissionDTO> save(@RequestBody SysPermissionDTO syspermissiondto) {
SysPermission domain = syspermissionMapping.toDomain(syspermissiondto);
syspermissionService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(syspermissionMapping.toDto(domain));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysPermission-Save-all')")
......
......@@ -73,7 +73,7 @@ public class SysRolePermissionResource {
SysRolePermission domain = sysrolepermissionMapping.toDomain(sysrolepermissiondto);
domain .setRolepermissionid(sysrolepermission_id);
sysrolepermissionService.update(domain );
SysRolePermissionDTO dto = sysrolepermissionMapping.toDto(domain );
SysRolePermissionDTO dto = sysrolepermissionMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -125,8 +125,10 @@ public class SysRolePermissionResource {
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysRolePermission-Save-all')")
@ApiOperation(value = "保存角色权限关系", tags = {"角色权限关系" }, notes = "保存角色权限关系")
@RequestMapping(method = RequestMethod.POST, value = "/sysrolepermissions/save")
public ResponseEntity<Boolean> save(@RequestBody SysRolePermissionDTO sysrolepermissiondto) {
return ResponseEntity.status(HttpStatus.OK).body(sysrolepermissionService.save(sysrolepermissionMapping.toDomain(sysrolepermissiondto)));
public ResponseEntity<SysRolePermissionDTO> save(@RequestBody SysRolePermissionDTO sysrolepermissiondto) {
SysRolePermission domain = sysrolepermissionMapping.toDomain(sysrolepermissiondto);
sysrolepermissionService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysrolepermissionMapping.toDto(domain));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysRolePermission-Save-all')")
......@@ -250,10 +252,11 @@ public class SysRolePermissionResource {
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysRolePermission-Save-all')")
@ApiOperation(value = "根据权限/资源保存角色权限关系", tags = {"角色权限关系" }, notes = "根据权限/资源保存角色权限关系")
@RequestMapping(method = RequestMethod.POST, value = "/syspermissions/{syspermission_id}/sysrolepermissions/save")
public ResponseEntity<Boolean> saveBySysPermission(@PathVariable("syspermission_id") String syspermission_id, @RequestBody SysRolePermissionDTO sysrolepermissiondto) {
public ResponseEntity<SysRolePermissionDTO> saveBySysPermission(@PathVariable("syspermission_id") String syspermission_id, @RequestBody SysRolePermissionDTO sysrolepermissiondto) {
SysRolePermission domain = sysrolepermissionMapping.toDomain(sysrolepermissiondto);
domain.setPermissionid(syspermission_id);
return ResponseEntity.status(HttpStatus.OK).body(sysrolepermissionService.save(domain));
sysrolepermissionService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysrolepermissionMapping.toDto(domain));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysRolePermission-Save-all')")
......@@ -380,10 +383,11 @@ public class SysRolePermissionResource {
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysRolePermission-Save-all')")
@ApiOperation(value = "根据系统角色保存角色权限关系", tags = {"角色权限关系" }, notes = "根据系统角色保存角色权限关系")
@RequestMapping(method = RequestMethod.POST, value = "/sysroles/{sysrole_id}/sysrolepermissions/save")
public ResponseEntity<Boolean> saveBySysRole(@PathVariable("sysrole_id") String sysrole_id, @RequestBody SysRolePermissionDTO sysrolepermissiondto) {
public ResponseEntity<SysRolePermissionDTO> saveBySysRole(@PathVariable("sysrole_id") String sysrole_id, @RequestBody SysRolePermissionDTO sysrolepermissiondto) {
SysRolePermission domain = sysrolepermissionMapping.toDomain(sysrolepermissiondto);
domain.setRoleid(sysrole_id);
return ResponseEntity.status(HttpStatus.OK).body(sysrolepermissionService.save(domain));
sysrolepermissionService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysrolepermissionMapping.toDto(domain));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysRolePermission-Save-all')")
......
......@@ -73,7 +73,7 @@ public class SysRoleResource {
SysRole domain = sysroleMapping.toDomain(sysroledto);
domain .setRoleid(sysrole_id);
sysroleService.update(domain );
SysRoleDTO dto = sysroleMapping.toDto(domain );
SysRoleDTO dto = sysroleMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -144,8 +144,10 @@ public class SysRoleResource {
@PreAuthorize("hasPermission(this.sysroleMapping.toDomain(#sysroledto),'ibzuaa-SysRole-Save')")
@ApiOperation(value = "保存系统角色", tags = {"系统角色" }, notes = "保存系统角色")
@RequestMapping(method = RequestMethod.POST, value = "/sysroles/save")
public ResponseEntity<Boolean> save(@RequestBody SysRoleDTO sysroledto) {
return ResponseEntity.status(HttpStatus.OK).body(sysroleService.save(sysroleMapping.toDomain(sysroledto)));
public ResponseEntity<SysRoleDTO> save(@RequestBody SysRoleDTO sysroledto) {
SysRole domain = sysroleMapping.toDomain(sysroledto);
sysroleService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysroleMapping.toDto(domain));
}
@PreAuthorize("hasPermission(this.sysroleMapping.toDomain(#sysroledtos),'ibzuaa-SysRole-Save')")
......
......@@ -72,7 +72,7 @@ public class SysUserAuthResource {
SysUserAuth domain = sysuserauthMapping.toDomain(sysuserauthdto);
domain .setId(sysuserauth_id);
sysuserauthService.update(domain );
SysUserAuthDTO dto = sysuserauthMapping.toDto(domain );
SysUserAuthDTO dto = sysuserauthMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -123,8 +123,10 @@ public class SysUserAuthResource {
@ApiOperation(value = "保存账号绑定", tags = {"账号绑定" }, notes = "保存账号绑定")
@RequestMapping(method = RequestMethod.POST, value = "/sysuserauths/save")
public ResponseEntity<Boolean> save(@RequestBody SysUserAuthDTO sysuserauthdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysuserauthService.save(sysuserauthMapping.toDomain(sysuserauthdto)));
public ResponseEntity<SysUserAuthDTO> save(@RequestBody SysUserAuthDTO sysuserauthdto) {
SysUserAuth domain = sysuserauthMapping.toDomain(sysuserauthdto);
sysuserauthService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysuserauthMapping.toDto(domain));
}
@ApiOperation(value = "批量保存账号绑定", tags = {"账号绑定" }, notes = "批量保存账号绑定")
......
......@@ -72,7 +72,7 @@ public class SysUserResource {
SysUser domain = sysuserMapping.toDomain(sysuserdto);
domain .setUserid(sysuser_id);
sysuserService.update(domain );
SysUserDTO dto = sysuserMapping.toDto(domain );
SysUserDTO dto = sysuserMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -134,8 +134,10 @@ public class SysUserResource {
@ApiOperation(value = "保存系统用户", tags = {"系统用户" }, notes = "保存系统用户")
@RequestMapping(method = RequestMethod.POST, value = "/sysusers/save")
public ResponseEntity<Boolean> save(@RequestBody SysUserDTO sysuserdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysuserService.save(sysuserMapping.toDomain(sysuserdto)));
public ResponseEntity<SysUserDTO> save(@RequestBody SysUserDTO sysuserdto) {
SysUser domain = sysuserMapping.toDomain(sysuserdto);
sysuserService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysuserMapping.toDto(domain));
}
@ApiOperation(value = "批量保存系统用户", tags = {"系统用户" }, notes = "批量保存系统用户")
......
......@@ -73,7 +73,7 @@ public class SysUserRoleResource {
SysUserRole domain = sysuserroleMapping.toDomain(sysuserroledto);
domain .setUserroleid(sysuserrole_id);
sysuserroleService.update(domain );
SysUserRoleDTO dto = sysuserroleMapping.toDto(domain );
SysUserRoleDTO dto = sysuserroleMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -124,8 +124,10 @@ public class SysUserRoleResource {
@ApiOperation(value = "保存用户角色关系", tags = {"用户角色关系" }, notes = "保存用户角色关系")
@RequestMapping(method = RequestMethod.POST, value = "/sysuserroles/save")
public ResponseEntity<Boolean> save(@RequestBody SysUserRoleDTO sysuserroledto) {
return ResponseEntity.status(HttpStatus.OK).body(sysuserroleService.save(sysuserroleMapping.toDomain(sysuserroledto)));
public ResponseEntity<SysUserRoleDTO> save(@RequestBody SysUserRoleDTO sysuserroledto) {
SysUserRole domain = sysuserroleMapping.toDomain(sysuserroledto);
sysuserroleService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysuserroleMapping.toDto(domain));
}
@ApiOperation(value = "批量保存用户角色关系", tags = {"用户角色关系" }, notes = "批量保存用户角色关系")
......@@ -245,10 +247,11 @@ public class SysUserRoleResource {
@ApiOperation(value = "根据系统角色保存用户角色关系", tags = {"用户角色关系" }, notes = "根据系统角色保存用户角色关系")
@RequestMapping(method = RequestMethod.POST, value = "/sysroles/{sysrole_id}/sysuserroles/save")
public ResponseEntity<Boolean> saveBySysRole(@PathVariable("sysrole_id") String sysrole_id, @RequestBody SysUserRoleDTO sysuserroledto) {
public ResponseEntity<SysUserRoleDTO> saveBySysRole(@PathVariable("sysrole_id") String sysrole_id, @RequestBody SysUserRoleDTO sysuserroledto) {
SysUserRole domain = sysuserroleMapping.toDomain(sysuserroledto);
domain.setRoleid(sysrole_id);
return ResponseEntity.status(HttpStatus.OK).body(sysuserroleService.save(domain));
sysuserroleService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysuserroleMapping.toDto(domain));
}
@ApiOperation(value = "根据系统角色批量保存用户角色关系", tags = {"用户角色关系" }, notes = "根据系统角色批量保存用户角色关系")
......@@ -371,10 +374,11 @@ public class SysUserRoleResource {
@ApiOperation(value = "根据系统用户保存用户角色关系", tags = {"用户角色关系" }, notes = "根据系统用户保存用户角色关系")
@RequestMapping(method = RequestMethod.POST, value = "/sysusers/{sysuser_id}/sysuserroles/save")
public ResponseEntity<Boolean> saveBySysUser(@PathVariable("sysuser_id") String sysuser_id, @RequestBody SysUserRoleDTO sysuserroledto) {
public ResponseEntity<SysUserRoleDTO> saveBySysUser(@PathVariable("sysuser_id") String sysuser_id, @RequestBody SysUserRoleDTO sysuserroledto) {
SysUserRole domain = sysuserroleMapping.toDomain(sysuserroledto);
domain.setUserid(sysuser_id);
return ResponseEntity.status(HttpStatus.OK).body(sysuserroleService.save(domain));
sysuserroleService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysuserroleMapping.toDto(domain));
}
@ApiOperation(value = "根据系统用户批量保存用户角色关系", tags = {"用户角色关系" }, notes = "根据系统用户批量保存用户角色关系")
......
......@@ -6,6 +6,7 @@ import cn.ibizlab.util.domain.DELogic;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.errors.BadRequestAlertException;
import cn.ibizlab.util.helper.DEFieldCacheMap;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
......@@ -35,9 +36,9 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -65,7 +66,7 @@ public class DELogicAspect {
* @return
* @throws Throwable
*/
@Around("execution(* cn.ibizlab.core.*.service.*.*(..))")
@Around("execution(* cn.ibizlab.core.*.service.*.*(..)) && !execution(* cn.ibizlab.core.es.service.*.*(..))")
public Object executeLogic(ProceedingJoinPoint point) throws Throwable {
Object args[] = point.getArgs();
if (ObjectUtils.isEmpty(args) || args.length == 0) {
......@@ -76,7 +77,7 @@ public class DELogicAspect {
String action = point.getSignature().getName();
EntityBase entity = null;
if ("remove".equalsIgnoreCase(action) || "get".equalsIgnoreCase(action)) {
entity = getEntity(service);
entity = getEntity(service.getClass());
String id = DEFieldCacheMap.getDEKeyField(entity.getClass());
if(StringUtils.isEmpty(id)) {
log.debug("无法获取实体主键属性[{}]",entity.getClass().getSimpleName());
......@@ -89,6 +90,9 @@ public class DELogicAspect {
if (entity != null) {
executeBeforeLogic(entity, action);
Object result = point.proceed();
if("get".equalsIgnoreCase(action) && result instanceof EntityBase){
entity = (EntityBase) result;
}
executeLogic(entity, action);
executeAfterLogic(entity, action);
return result;
......@@ -253,7 +257,7 @@ public class DELogicAspect {
//自己 bpmn 及 drl
refFiles.add(bpmnFile);
File drlFile = getDrl(bpmnFile);
if (drlFile.exists()) {
if (drlFile != null && drlFile.exists()) {
refFiles.add(drlFile);
}
//子 bpmn 及 drl
......@@ -305,10 +309,9 @@ public class DELogicAspect {
*
* @param service
* @return
* @throws Exception
*/
private EntityBase getEntity(Object service) throws Exception {
Method[] methods = service.getClass().getDeclaredMethods();
private EntityBase getEntity(Class service) {
Method[] methods = service.getDeclaredMethods();
for (Method method : methods) {
for (Class cls : method.getParameterTypes()) {
try {
......@@ -316,10 +319,13 @@ public class DELogicAspect {
if (arg instanceof EntityBase) {
return (EntityBase) arg;
}
} catch (InstantiationException e) {
} catch (Exception e) {
}
}
}
if(!ObjectUtils.isEmpty(service.getSuperclass()) && !service.getSuperclass().getName().equals(Object.class.getName())) {
return getEntity(service.getSuperclass());
}
throw new BadRequestAlertException("获取实体信息失败", "DELogicAspect", "getEntity");
}
......@@ -357,7 +363,7 @@ public class DELogicAspect {
}
}
/**
/**
* 本地逻辑
*
* @param entity
......@@ -367,9 +373,8 @@ public class DELogicAspect {
*/
private File getLocalModel(String entity, String action, LogicExecMode logicExecMode) {
String logicName = String.format("%s.bpmn", logicExecMode.text);
String filePath = File.separator + "rules" + File.separator + entity.toLowerCase() + File.separator + action + File.separator + logicName;
URL url = this.getClass().getResource(filePath.replace("\\", "/"));
return ObjectUtils.isEmpty(url) ? null : new File(url.getPath());
String filePath = File.separator + "rules" + File.separator + entity + File.separator + action.toLowerCase() + File.separator + logicName;
return getBpmnFile(filePath);
}
/**
......@@ -380,7 +385,7 @@ public class DELogicAspect {
*/
private File getSubBpmn(String logicName) {
String filePath = String.format("/rules/%s", logicName);
return ObjectUtils.isEmpty(this.getClass().getResource(filePath)) ? null : new File(this.getClass().getResource(filePath).getPath());
return getBpmnFile(filePath);
}
/**
......@@ -391,10 +396,38 @@ public class DELogicAspect {
*/
private File getDrl(File bpmn) {
if (bpmn.getPath().endsWith("RuleFlow.bpmn")) {
return new File(bpmn.getPath().replace("RuleFlow.bpmn", "Rule.drl"));
return getBpmnFile(bpmn.getPath().replace("RuleFlow.bpmn", "Rule.drl"));
} else {
return new File(bpmn.getPath().replace(".bpmn", ".drl"));
return getBpmnFile(bpmn.getPath().replace(".bpmn", ".drl"));
}
}
/**
* 获取 bpmn
*
* @param filePath
* @return
*/
private File getBpmnFile(String filePath) {
InputStream in = null;
File bpmn = null;
try {
in = this.getClass().getResourceAsStream(filePath.replace("\\", "/"));
if (in != null) {
bpmn = new File(filePath);
FileUtils.copyToFile(in, bpmn);
}
} catch (IOException e) {
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return bpmn;
}
/**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册