parent
a3c0127a7a
commit
b679fb75ba
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,99 @@
|
|||||||
|
package org.jeecg.modules.aop;
|
||||||
|
|
||||||
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.AfterThrowing;
|
||||||
|
import org.aspectj.lang.annotation.Around;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
|
import org.jeecg.common.api.dto.LogDTO;
|
||||||
|
import org.jeecg.common.system.vo.LoginUser;
|
||||||
|
import org.jeecg.modules.base.service.BaseCommonService;
|
||||||
|
import org.jeecg.modules.system.entity.SysTenantPack;
|
||||||
|
import org.jeecg.modules.system.entity.SysTenantPackUser;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author taoYan
|
||||||
|
* @Date 2023/2/16 14:27
|
||||||
|
**/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class TenantPackUserLogAspect {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BaseCommonService baseCommonService;
|
||||||
|
|
||||||
|
@Pointcut("@annotation(org.jeecg.modules.aop.TenantLog)")
|
||||||
|
public void tenantLogPointCut() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Around("tenantLogPointCut()")
|
||||||
|
public Object aroundMethod(ProceedingJoinPoint joinPoint)throws Throwable {
|
||||||
|
//System.out.println("环绕通知>>>>>>>>>");
|
||||||
|
|
||||||
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
|
Method method = signature.getMethod();
|
||||||
|
TenantLog log = method.getAnnotation(TenantLog.class);
|
||||||
|
if(log != null){
|
||||||
|
int opType = log.value();
|
||||||
|
Integer logType = null;
|
||||||
|
String content = null;
|
||||||
|
Integer tenantId = null;
|
||||||
|
//获取参数
|
||||||
|
Object[] args = joinPoint.getArgs();
|
||||||
|
if(args.length>0){
|
||||||
|
for(Object obj: args){
|
||||||
|
if(obj instanceof SysTenantPack){
|
||||||
|
// logType=3 租户操作日志
|
||||||
|
logType = 3;
|
||||||
|
SysTenantPack pack = (SysTenantPack)obj;
|
||||||
|
if(opType==2){
|
||||||
|
content = "创建了角色权限 "+ pack.getPackName();
|
||||||
|
}
|
||||||
|
tenantId = pack.getTenantId();
|
||||||
|
break;
|
||||||
|
}else if(obj instanceof SysTenantPackUser){
|
||||||
|
logType = 3;
|
||||||
|
SysTenantPackUser packUser = (SysTenantPackUser)obj;
|
||||||
|
if(opType==2){
|
||||||
|
content = "将 "+packUser.getRealname()+" 添加到角色 "+ packUser.getPackName();
|
||||||
|
}else if(opType==4){
|
||||||
|
content = "移除了 "+packUser.getPackName()+" 成员 "+ packUser.getRealname();
|
||||||
|
}
|
||||||
|
tenantId = packUser.getTenantId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(logType!=null){
|
||||||
|
LogDTO dto = new LogDTO();
|
||||||
|
dto.setLogType(logType);
|
||||||
|
dto.setLogContent(content);
|
||||||
|
dto.setOperateType(opType);
|
||||||
|
dto.setTenantId(tenantId);
|
||||||
|
//获取登录用户信息
|
||||||
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
if(sysUser!=null){
|
||||||
|
dto.setUserid(sysUser.getUsername());
|
||||||
|
dto.setUsername(sysUser.getRealname());
|
||||||
|
|
||||||
|
}
|
||||||
|
dto.setCreateTime(new Date());
|
||||||
|
//保存系统日志
|
||||||
|
baseCommonService.addLog(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return joinPoint.proceed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterThrowing("tenantLogPointCut()")
|
||||||
|
public void afterThrowing()throws Throwable{
|
||||||
|
System.out.println("异常通知");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
package org.jeecg.modules.system.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 产品包菜单关系表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2022-12-31
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("sys_tenant_pack_perms")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="sys_tenant_pack_perms对象", description="产品包菜单关系表")
|
||||||
|
public class SysPackPermission implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**主键编号*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键编号")
|
||||||
|
private String id;
|
||||||
|
/**租户产品包名称*/
|
||||||
|
@Excel(name = "租户产品包名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "租户产品包名称")
|
||||||
|
private String packId;
|
||||||
|
/**菜单id*/
|
||||||
|
@Excel(name = "菜单id", width = 15)
|
||||||
|
@ApiModelProperty(value = "菜单id")
|
||||||
|
private String permissionId;
|
||||||
|
/**创建人*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
/**创建时间*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
/**更新人*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
/**更新时间*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
package org.jeecg.modules.system.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 租户产品包
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2022-12-31
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("sys_tenant_pack")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="sys_tenant_pack对象", description="租户产品包")
|
||||||
|
public class SysTenantPack implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**主键id*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键id")
|
||||||
|
private String id;
|
||||||
|
/**租户id*/
|
||||||
|
@Excel(name = "租户id", width = 15)
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
/**产品包名*/
|
||||||
|
@Excel(name = "产品包名", width = 15)
|
||||||
|
@ApiModelProperty(value = "产品包名")
|
||||||
|
private String packName;
|
||||||
|
/**开启状态(0 未开启 1开启)*/
|
||||||
|
@Excel(name = "开启状态(0 未开启 1开启)", width = 15)
|
||||||
|
@ApiModelProperty(value = "开启状态(0 未开启 1开启)")
|
||||||
|
private String status;
|
||||||
|
/**备注*/
|
||||||
|
@Excel(name = "备注", width = 15)
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remarks;
|
||||||
|
/**创建人*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
/**创建时间*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
/**更新人*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
/**更新时间*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**菜单id 临时字段用于新增编辑菜单id传递*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String permissionIds;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
private String packCode;
|
||||||
|
|
||||||
|
public SysTenantPack(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysTenantPack(Integer tenantId, String packName, String packCode){
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
this.packCode = packCode;
|
||||||
|
this.packName = packName;
|
||||||
|
this.status = "1";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
package org.jeecg.modules.system.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 租户产品包用户关系表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-02-16
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("sys_tenant_pack_user")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="sys_tenant_pack_user对象", description="租户产品包用户关系表")
|
||||||
|
public class SysTenantPackUser implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**id*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private java.lang.String id;
|
||||||
|
/**租户产品包ID*/
|
||||||
|
@Excel(name = "租户产品包ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "租户产品包ID")
|
||||||
|
private java.lang.String packId;
|
||||||
|
/**用户ID*/
|
||||||
|
@Excel(name = "用户ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "用户ID")
|
||||||
|
private java.lang.String userId;
|
||||||
|
/**租户ID*/
|
||||||
|
@Excel(name = "租户ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "租户ID")
|
||||||
|
private java.lang.Integer tenantId;
|
||||||
|
/**创建人*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private java.lang.String createBy;
|
||||||
|
/**创建时间*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private java.util.Date createTime;
|
||||||
|
/**更新人*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private java.lang.String updateBy;
|
||||||
|
/**更新时间*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private java.util.Date updateTime;
|
||||||
|
|
||||||
|
private transient String realname;
|
||||||
|
|
||||||
|
private transient String packName;
|
||||||
|
|
||||||
|
private transient String packCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 正常状态1 申请状态0
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
public SysTenantPackUser(){
|
||||||
|
|
||||||
|
}
|
||||||
|
public SysTenantPackUser(Integer tenantId, String packId, String userId) {
|
||||||
|
this.packId = packId;
|
||||||
|
this.userId = userId;
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
this.status = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysTenantPackUser(SysTenantPackUser param, String userId, String realname) {
|
||||||
|
this.userId = userId;
|
||||||
|
this.realname = realname;
|
||||||
|
this.packId = param.getPackId();
|
||||||
|
this.tenantId = param.getTenantId();
|
||||||
|
this.packName = param.getPackName();
|
||||||
|
this.status = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package org.jeecg.modules.system.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: sys_user_tenant_relation
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2022-12-23
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("sys_user_tenant")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="sys_user_tenant对象", description="sys_user_tenant")
|
||||||
|
public class SysUserTenant implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**主键id*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键id")
|
||||||
|
private String id;
|
||||||
|
/**用户id*/
|
||||||
|
@Excel(name = "用户id", width = 15)
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private String userId;
|
||||||
|
/**租户id*/
|
||||||
|
@Excel(name = "租户id", width = 15)
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
/**状态(1 正常 2 冻结 3 待审核 4 拒绝)*/
|
||||||
|
@Excel(name = "状态(1 正常 2 冻结 3 待审核 4 拒绝)", width = 15)
|
||||||
|
@ApiModelProperty(value = "状态(1 正常 2 冻结 3 待审核 4 拒绝)")
|
||||||
|
private String status;
|
||||||
|
/**创建人登录名称*/
|
||||||
|
@ApiModelProperty(value = "创建人登录名称")
|
||||||
|
private String createBy;
|
||||||
|
/**创建日期*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(value = "创建日期")
|
||||||
|
private Date createTime;
|
||||||
|
/**更新人登录名称*/
|
||||||
|
@ApiModelProperty(value = "更新人登录名称")
|
||||||
|
private String updateBy;
|
||||||
|
/**更新日期*/
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(value = "更新日期")
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package org.jeecg.modules.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.jeecg.modules.system.entity.SysPackPermission;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 产品包菜单关系表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2022-12-31
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SysPackPermissionMapper extends BaseMapper<SysPackPermission> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过产品包id获取菜单id
|
||||||
|
* @param packId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> getPermissionsByPackId(@Param("packId") String packId);
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package org.jeecg.modules.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.jeecg.modules.system.entity.SysTenantPack;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 租户产品包
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2022-12-31
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SysTenantPackMapper extends BaseMapper<SysTenantPack> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package org.jeecg.modules.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.modules.system.entity.SysTenantPackUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 租户产品包用户关系
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-02-16
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface SysTenantPackUserMapper extends BaseMapper<SysTenantPackUser> {
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue