feat(dict): 添加字典明细查询功能并重构系统服务代码结构
This commit is contained in:
+1
-1
@@ -20,11 +20,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -21,9 +21,9 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+2
-2
@@ -22,10 +22,10 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -19,9 +19,9 @@ import cn.odboy.base.KitObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 邮件配置类,数据存覆盖式存入数据存
|
||||
|
||||
+3
-3
@@ -20,11 +20,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+2
-2
@@ -21,10 +21,10 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -23,10 +23,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
+2
-2
@@ -22,10 +22,10 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -22,9 +22,9 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("system_quartz_log")
|
||||
|
||||
+3
-3
@@ -23,11 +23,11 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
|
||||
+4
-4
@@ -21,13 +21,13 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -2,9 +2,9 @@ package cn.odboy.system.dal.model.export;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+2
-2
@@ -17,10 +17,10 @@ package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+3
-3
@@ -17,11 +17,11 @@ package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import java.util.Set;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryDeptArgs {
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryMenuArgs {
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryQuartzJobArgs {
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryRoleArgs {
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryStorageArgs {
|
||||
|
||||
+2
-2
@@ -17,12 +17,12 @@ package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+3
-3
@@ -16,12 +16,12 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发送邮件时,接收参数的类
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@ package cn.odboy.system.dal.model.response;
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -17,9 +17,9 @@ package cn.odboy.system.dal.model.response;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 构建前端路由时用到
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@ package cn.odboy.system.dal.model.response;
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -16,9 +16,9 @@
|
||||
package cn.odboy.system.dal.model.response;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+2
-2
@@ -5,10 +5,10 @@ import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
+1
-1
@@ -20,9 +20,9 @@ import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Set;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+2
-2
@@ -16,11 +16,11 @@
|
||||
package cn.odboy.system.dal.model.response;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+3
-3
@@ -17,12 +17,12 @@ package cn.odboy.system.dal.model.response;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
|
||||
+1
-1
@@ -16,8 +16,8 @@
|
||||
package cn.odboy.system.dal.model.response;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 在线用户
|
||||
|
||||
+4
-4
@@ -1,18 +1,18 @@
|
||||
package cn.odboy.system.dal.model.response;
|
||||
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemUserVo extends SystemUserTb {
|
||||
public class SystemUserVo extends KitBaseUserTimeTb {
|
||||
|
||||
@ApiModelProperty(value = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
+5
-1
@@ -17,11 +17,13 @@ package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemDictDetailTb;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryDictDetailArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemDictDetailVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典明细 Mapper
|
||||
@@ -31,5 +33,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface SystemDictDetailMapper extends BaseMapper<SystemDictDetailTb> {
|
||||
|
||||
IPage<SystemDictDetailTb> selectPageByArgs(Page<SystemDictDetailTb> page, @Param("args") SystemQueryDictDetailArgs args);
|
||||
IPage<SystemDictDetailVo> selectPageByArgs(Page<SystemDictDetailTb> page, @Param("args") SystemQueryDictDetailArgs args);
|
||||
|
||||
List<SystemDictDetailVo> listDictDetailByName(@Param("name") String name);
|
||||
}
|
||||
|
||||
+4
@@ -15,9 +15,12 @@
|
||||
*/
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleDeptTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色部门关联 Mapper
|
||||
@@ -27,4 +30,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SystemRoleDeptMapper extends BaseMapper<SystemRoleDeptTb> {
|
||||
|
||||
Set<SystemDeptTb> listUserDeptByRoleId(@Param("roleId") Long roleId);
|
||||
}
|
||||
|
||||
+4
@@ -15,9 +15,12 @@
|
||||
*/
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserJobTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户职位关联 Mapper
|
||||
@@ -27,4 +30,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SystemUserJobMapper extends BaseMapper<SystemUserJobTb> {
|
||||
|
||||
Set<SystemJobTb> listUserJobByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,8 +18,8 @@ package cn.odboy.system.dal.mysql;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.Set;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户 Mapper
|
||||
|
||||
+4
@@ -15,11 +15,15 @@
|
||||
*/
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserRoleTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.Set;
|
||||
|
||||
@Mapper
|
||||
public interface SystemUserRoleMapper extends BaseMapper<SystemUserRoleTb> {
|
||||
|
||||
Set<SystemRoleTb> listUserRoleByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
+6
-6
@@ -15,17 +15,17 @@ import cn.odboy.util.KitIPUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -62,7 +62,7 @@ public class SystemUserOnlineInfoDAO {
|
||||
userOnlineVo.setKey(KitDesEncryptUtil.desEncrypt(token));
|
||||
userOnlineVo.setLoginTime(new Date());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
log.error("保存在线用户信息失败", e);
|
||||
}
|
||||
String loginKey = tokenProvider.loginKey(token);
|
||||
redisHelper.set(loginKey, userOnlineVo, properties.getJwt().getTokenValidityInSeconds(), TimeUnit.MILLISECONDS);
|
||||
|
||||
+17
-3
@@ -22,6 +22,9 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户认证
|
||||
*/
|
||||
@Service
|
||||
public class SystemAuthService {
|
||||
|
||||
@@ -38,11 +41,15 @@ public class SystemAuthService {
|
||||
@Autowired
|
||||
private SystemCaptchaService systemCaptchaService;
|
||||
|
||||
/**
|
||||
* 登录 -> TestPassed
|
||||
*/
|
||||
public SystemAuthVo doLogin(SystemUserLoginArgs loginArgs, HttpServletRequest request) throws Exception {
|
||||
KitValidUtil.notNull(loginArgs);
|
||||
|
||||
// 密码解密
|
||||
String password = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginArgs.getPassword());
|
||||
String password =
|
||||
KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginArgs.getPassword());
|
||||
// 校验验证码
|
||||
systemCaptchaService.validate(loginArgs.getUuid(), loginArgs.getCode());
|
||||
// 获取用户信息
|
||||
@@ -53,7 +60,8 @@ public class SystemAuthService {
|
||||
}
|
||||
|
||||
// 登录验证
|
||||
Authentication authentication = new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities());
|
||||
Authentication authentication =
|
||||
new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities());
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
|
||||
// 生成令牌
|
||||
@@ -74,14 +82,20 @@ public class SystemAuthService {
|
||||
return authInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录人信息 -> TestPassed
|
||||
*/
|
||||
public SystemUserJwtVo getCurrentUserInfo() {
|
||||
SystemUserJwtVo jwtUser = (SystemUserJwtVo) KitSecurityHelper.getCurrentUser();
|
||||
SystemUserJwtVo jwtUser = (SystemUserJwtVo)KitSecurityHelper.getCurrentUser();
|
||||
if (jwtUser.getUser() != null) {
|
||||
jwtUser.getUser().setPassword(null);
|
||||
}
|
||||
return jwtUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录 -> TestPassed
|
||||
*/
|
||||
public void doLogout(HttpServletRequest request) {
|
||||
String token = tokenProvider.getToken(request);
|
||||
systemUserOnlineInfoDAO.logoutByToken(token);
|
||||
|
||||
+14
-4
@@ -10,9 +10,9 @@ import cn.odboy.framework.redis.KitRedisHelper;
|
||||
import cn.odboy.system.dal.model.response.SystemCaptchaVo;
|
||||
import cn.odboy.system.dal.redis.SystemCacheKey;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
@@ -25,18 +25,22 @@ public class SystemCaptchaService {
|
||||
@Autowired
|
||||
private AppProperties properties;
|
||||
|
||||
/**
|
||||
* 获取登录验证码 -> TestPassed
|
||||
*/
|
||||
public SystemCaptchaVo getLoginCaptcha() {
|
||||
// 获取运算的结果
|
||||
Captcha captcha = properties.getLogin().getCaptchaSetting().getCaptcha();
|
||||
String uuid = SystemCacheKey.CAPTCHA_LOGIN + IdUtil.simpleUUID();
|
||||
//当验证码类型为 arithmetic时且长度 >= 2 时, captcha.text()的结果有几率为浮点型
|
||||
String captchaValue = captcha.text();
|
||||
if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() &&
|
||||
captchaValue.contains(SystemConst.SYMBOL_DOT)) {
|
||||
if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains(
|
||||
SystemConst.SYMBOL_DOT)) {
|
||||
captchaValue = captchaValue.split("\\.")[0];
|
||||
}
|
||||
// 保存
|
||||
redisHelper.set(uuid, captchaValue, properties.getLogin().getCaptchaSetting().getExpiration(), TimeUnit.MINUTES);
|
||||
redisHelper.set(uuid, captchaValue, properties.getLogin().getCaptchaSetting().getExpiration(),
|
||||
TimeUnit.MINUTES);
|
||||
// 验证码信息
|
||||
SystemCaptchaVo captchaVo = new SystemCaptchaVo();
|
||||
captchaVo.setUuid(uuid);
|
||||
@@ -44,6 +48,12 @@ public class SystemCaptchaService {
|
||||
return captchaVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证验证码 -> TestPassed
|
||||
*
|
||||
* @param uuid 验证码uuid
|
||||
* @param inputCode 用户输入的验证码
|
||||
*/
|
||||
public void validate(String uuid, String inputCode) {
|
||||
// 查询验证码
|
||||
String code = redisHelper.get(uuid, String.class);
|
||||
|
||||
+26
-20
@@ -18,18 +18,19 @@ package cn.odboy.system.service;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.model.response.SystemDeptVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleVo;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.response.SystemUserVo;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据权限 Service
|
||||
* 数据权限
|
||||
*
|
||||
* @author odboy
|
||||
*/
|
||||
@@ -44,7 +45,7 @@ public class SystemDataService {
|
||||
private SystemRoleDeptService systemRoleDeptService;
|
||||
|
||||
/**
|
||||
* 获取数据权限
|
||||
* 获取数据权限 -> TestPassed
|
||||
*
|
||||
* @param user /
|
||||
* @return /
|
||||
@@ -52,16 +53,19 @@ public class SystemDataService {
|
||||
public List<Long> queryDeptIdByArgs(SystemUserVo user) {
|
||||
List<Long> deptIds = new ArrayList<>();
|
||||
// 查询用户角色
|
||||
List<SystemRoleVo> roleList = systemUserRoleService.queryRoleByUsersId(user.getId());
|
||||
Set<SystemRoleTb> roleList = systemUserRoleService.listUserRoleByUserId(user.getId());
|
||||
// 获取对应的部门ID
|
||||
for (SystemRoleVo role : roleList) {
|
||||
for (SystemRoleTb role : roleList) {
|
||||
SystemDataScopeEnum dataScopeEnum = SystemDataScopeEnum.find(role.getDataScope());
|
||||
switch (Objects.requireNonNull(dataScopeEnum)) {
|
||||
case THIS_LEVEL:
|
||||
deptIds.add(user.getDept().getId());
|
||||
Long currentDeptId = user.getDept().getId();
|
||||
deptIds.add(currentDeptId);
|
||||
break;
|
||||
case CUSTOMIZE:
|
||||
deptIds.addAll(this.queryCustomDataPermissionByArgs(deptIds, role));
|
||||
// 优化 283ms -> 51 ms
|
||||
List<Long> customDeptIds = this.queryCustomDataPermissionByArgs(deptIds, role.getId());
|
||||
deptIds.addAll(customDeptIds);
|
||||
break;
|
||||
default:
|
||||
return new ArrayList<>();
|
||||
@@ -71,19 +75,21 @@ public class SystemDataService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自定义的数据权限
|
||||
* 获取自定义的数据权限 -> TestPassed
|
||||
*
|
||||
* @param deptIds 部门ID
|
||||
* @param role 角色
|
||||
* @return 数据权限ID
|
||||
* @param deptIds 部门ID(外部数据)
|
||||
* @param roleId 角色ID
|
||||
* @return 数据权限ID(所有部门ID数据)
|
||||
*/
|
||||
private List<Long> queryCustomDataPermissionByArgs(List<Long> deptIds, SystemRoleVo role) {
|
||||
List<SystemDeptTb> deptList = systemRoleDeptService.listDeptByRoleId(role.getId());
|
||||
private List<Long> queryCustomDataPermissionByArgs(List<Long> deptIds, Long roleId) {
|
||||
Set<SystemDeptTb> deptList = systemRoleDeptService.listUserDeptByRoleId(roleId);
|
||||
Map<Long, List<SystemDeptTb>> deptPidMap =
|
||||
systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid));
|
||||
for (SystemDeptTb dept : deptList) {
|
||||
deptIds.add(dept.getId());
|
||||
List<SystemDeptVo> deptChildren = systemDeptService.listDeptByPid(dept.getId());
|
||||
List<SystemDeptTb> deptChildren = deptPidMap.getOrDefault(dept.getId(), null);
|
||||
if (CollUtil.isNotEmpty(deptChildren)) {
|
||||
deptIds.addAll(systemDeptService.queryChildDeptIdByDeptIds(deptChildren));
|
||||
deptIds.addAll(systemDeptService.queryChildDeptIdByDeptIds(deptChildren, deptPidMap));
|
||||
}
|
||||
}
|
||||
return deptIds;
|
||||
|
||||
+47
-25
@@ -16,7 +16,6 @@
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
@@ -37,6 +36,10 @@ import cn.odboy.util.KitClassUtil;
|
||||
import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -48,10 +51,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemDeptService {
|
||||
@@ -64,19 +63,22 @@ public class SystemDeptService {
|
||||
private SystemRoleDeptService systemRoleDeptService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* 创建 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveDept(SystemCreateDeptArgs args) {
|
||||
KitValidUtil.notNull(args);
|
||||
systemDeptMapper.insert(KitBeanUtil.copyToClass(args, SystemDeptTb.class));
|
||||
|
||||
SystemDeptTb record = KitBeanUtil.copyToClass(args, SystemDeptTb.class);
|
||||
systemDeptMapper.insert(record);
|
||||
|
||||
this.updateDeptSubCnt(args.getPid());
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -84,7 +86,7 @@ public class SystemDeptService {
|
||||
public void updateDeptById(SystemDeptTb args) {
|
||||
KitValidUtil.notNull(args);
|
||||
// 旧的父部门
|
||||
Long oldPid = this.getDeptVoById(args.getId()).getPid();
|
||||
Long oldPid = this.getDeptById(args.getId()).getPid();
|
||||
// 新的父部门
|
||||
Long newPid = args.getPid();
|
||||
if (args.getPid() != null && args.getId().equals(args.getPid())) {
|
||||
@@ -92,11 +94,21 @@ public class SystemDeptService {
|
||||
}
|
||||
SystemDeptTb dept = systemDeptMapper.selectById(args.getId());
|
||||
args.setId(dept.getId());
|
||||
systemDeptMapper.insertOrUpdate(args);
|
||||
systemDeptMapper.updateById(args);
|
||||
this.updateDeptSubCnt(oldPid);
|
||||
this.updateDeptSubCnt(newPid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门id获取部门信息 -> TestPassed
|
||||
*
|
||||
* @param id 部门id
|
||||
* @return /
|
||||
*/
|
||||
private SystemDeptTb getDeptById(Long id) {
|
||||
return systemDeptMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
@@ -115,7 +127,7 @@ public class SystemDeptService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新父节点中子节点数目
|
||||
* 更新父节点中子节点数目 -> TestPassed
|
||||
*
|
||||
* @param deptId /
|
||||
*/
|
||||
@@ -158,8 +170,7 @@ public class SystemDeptService {
|
||||
wrapper.eq(args.getPid() != null, SystemDeptTb::getPid, args.getPid());
|
||||
wrapper.isNull(args.getPidIsNull() != null, SystemDeptTb::getPid);
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemDeptTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemDeptTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
wrapper.orderByAsc(SystemDeptTb::getDeptSort);
|
||||
return systemDeptMapper.selectList(wrapper);
|
||||
@@ -226,20 +237,24 @@ public class SystemDeptService {
|
||||
private void queryRelationDeptByArgs(List<SystemDeptVo> deptTbList, Set<SystemDeptVo> depts) {
|
||||
for (SystemDeptVo dept : deptTbList) {
|
||||
depts.add(dept);
|
||||
List<SystemDeptVo> deptList = this.listDeptByPid(dept.getId());
|
||||
List<SystemDeptVo> deptList = this.listDeptVoByPid(dept.getId());
|
||||
if (CollUtil.isNotEmpty(deptList)) {
|
||||
queryRelationDeptByArgs(deptList, depts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Long> queryChildDeptIdByDeptIds(List<SystemDeptVo> deptList) {
|
||||
private List<SystemDeptVo> listDeptVoByPid(Long pid) {
|
||||
return KitBeanUtil.copyToList(this.listDeptByPid(pid), SystemDeptVo.class);
|
||||
}
|
||||
|
||||
public List<Long> queryChildDeptIdByDeptIds(List<SystemDeptTb> deptList, Map<Long, List<SystemDeptTb>> deptPidMap) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
for (SystemDeptVo systemDeptTb : deptList) {
|
||||
for (SystemDeptTb systemDeptTb : deptList) {
|
||||
if (systemDeptTb != null && systemDeptTb.getEnabled()) {
|
||||
List<SystemDeptVo> deptList1 = this.listDeptByPid(systemDeptTb.getId());
|
||||
List<SystemDeptTb> deptList1 = deptPidMap.getOrDefault(systemDeptTb.getId(), null);
|
||||
if (CollUtil.isNotEmpty(deptList1)) {
|
||||
list.addAll(queryChildDeptIdByDeptIds(deptList1));
|
||||
list.addAll(this.queryChildDeptIdByDeptIds(deptList1, deptPidMap));
|
||||
}
|
||||
list.add(systemDeptTb.getId());
|
||||
}
|
||||
@@ -259,7 +274,7 @@ public class SystemDeptService {
|
||||
deptList.addAll(this.listRootDept());
|
||||
return deptList;
|
||||
}
|
||||
deptList.addAll(this.listDeptByPid(dept.getPid()));
|
||||
deptList.addAll(this.listDeptVoByPid(dept.getPid()));
|
||||
return querySuperiorDeptByPid(this.getDeptVoById(dept.getPid()), deptList);
|
||||
}
|
||||
|
||||
@@ -318,11 +333,11 @@ public class SystemDeptService {
|
||||
deptSet.add(dept);
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isEmpty(trees)) {
|
||||
if (CollUtil.isEmpty(trees)) {
|
||||
trees = deptSet;
|
||||
}
|
||||
KitPageResult<SystemDeptVo> baseResult = new KitPageResult<>();
|
||||
baseResult.setContent(CollectionUtil.isEmpty(trees) ? new ArrayList<>(deptSet) : new ArrayList<>(trees));
|
||||
baseResult.setContent(CollUtil.isEmpty(trees) ? new ArrayList<>(deptSet) : new ArrayList<>(trees));
|
||||
baseResult.setTotalElements(deptSet.size());
|
||||
return baseResult;
|
||||
}
|
||||
@@ -359,8 +374,8 @@ public class SystemDeptService {
|
||||
// 根部门
|
||||
depts.add(this.getDeptVoById(id));
|
||||
// 子部门
|
||||
List<SystemDeptVo> deptList = this.listDeptByPid(id);
|
||||
if (CollectionUtil.isNotEmpty(deptList)) {
|
||||
List<SystemDeptVo> deptList = this.listDeptVoByPid(id);
|
||||
if (CollUtil.isNotEmpty(deptList)) {
|
||||
queryRelationDeptByArgs(deptList, depts);
|
||||
}
|
||||
}
|
||||
@@ -465,10 +480,10 @@ public class SystemDeptService {
|
||||
return vo;
|
||||
}
|
||||
|
||||
public List<SystemDeptVo> listDeptByPid(long pid) {
|
||||
public List<SystemDeptTb> listDeptByPid(long pid) {
|
||||
LambdaQueryWrapper<SystemDeptTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDeptTb::getPid, pid);
|
||||
return KitBeanUtil.copyToList(systemDeptMapper.selectList(wrapper), SystemDeptVo.class);
|
||||
return systemDeptMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
public void exportDeptXlsx(HttpServletResponse response, SystemQueryDeptArgs args) throws Exception {
|
||||
@@ -483,4 +498,11 @@ public class SystemDeptService {
|
||||
}
|
||||
KitExcelExporter.exportSimple(response, "部门数据", SystemDeptExportRowVo.class, rowVos);
|
||||
}
|
||||
|
||||
public List<SystemDeptTb> listPidNonNull() {
|
||||
LambdaQueryWrapper<SystemDeptTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDeptTb::getEnabled, 1);
|
||||
wrapper.isNotNull(SystemDeptTb::getPid);
|
||||
return systemDeptMapper.selectList(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+26
-24
@@ -31,15 +31,15 @@ import cn.odboy.util.KitValidUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemDictDetailService {
|
||||
@@ -50,7 +50,7 @@ public class SystemDictDetailService {
|
||||
private SystemDictMapper systemDictMapper;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* 创建 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ public class SystemDictDetailService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ public class SystemDictDetailService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 删除 -> TestPassed
|
||||
*
|
||||
* @param id /
|
||||
*/
|
||||
@@ -94,31 +94,30 @@ public class SystemDictDetailService {
|
||||
}
|
||||
}
|
||||
|
||||
private List<SystemDictDetailTb> listDictDetailByDictId(Long dictId) {
|
||||
LambdaQueryWrapper<SystemDictDetailTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDictDetailTb::getDictId, dictId);
|
||||
return systemDictDetailMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* 分页查询 -> TestPassed
|
||||
*
|
||||
* @param args 条件
|
||||
* @param page 分页参数
|
||||
* @return /
|
||||
*/
|
||||
public KitPageResult<SystemDictDetailVo> searchDictDetail(SystemQueryDictDetailArgs args, Page<SystemDictDetailTb> page) {
|
||||
IPage<SystemDictDetailVo> iPage = systemDictDetailMapper.selectPageByArgs(page, args).convert(i -> KitBeanUtil.copyToClass(i, SystemDictDetailVo.class));
|
||||
List<Long> dictIds = iPage.getRecords().stream().map(SystemDictDetailVo::getDictId).collect(Collectors.toList());
|
||||
Map<Long, SystemDictTb> id2ItemMap = systemDictMapper.selectByIds(dictIds).stream().collect(Collectors.toMap(SystemDictTb::getId, i -> i));
|
||||
public KitPageResult<SystemDictDetailVo> searchDictDetail(SystemQueryDictDetailArgs args,
|
||||
Page<SystemDictDetailTb> page) {
|
||||
IPage<SystemDictDetailVo> iPage = systemDictDetailMapper.selectPageByArgs(page, args);
|
||||
List<Long> dictIds =
|
||||
iPage.getRecords().stream().map(SystemDictDetailVo::getDictId).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(dictIds)) {
|
||||
Map<Long, SystemDictTb> id2ItemMap =
|
||||
systemDictMapper.selectByIds(dictIds).stream().collect(Collectors.toMap(SystemDictTb::getId, i -> i));
|
||||
for (SystemDictDetailVo record : iPage.getRecords()) {
|
||||
record.setDict(id2ItemMap.get(record.getDictId()));
|
||||
}
|
||||
}
|
||||
return KitPageUtil.toPage(iPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典名称获取字典详情
|
||||
* 根据字典名称获取字典详情 -> TestPassed
|
||||
*
|
||||
* @param name 字典名称
|
||||
* @return /
|
||||
@@ -127,15 +126,18 @@ public class SystemDictDetailService {
|
||||
if (StrUtil.isBlank(name)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
SystemDictTb systemDictTb = systemDictMapper.getByName(name);
|
||||
if (systemDictTb == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<SystemDictDetailTb> detailTbs = this.listDictDetailByDictId(systemDictTb.getId());
|
||||
List<SystemDictDetailVo> detailVos = KitBeanUtil.copyToList(detailTbs, SystemDictDetailVo.class);
|
||||
List<SystemDictDetailVo> detailVos = systemDictDetailMapper.listDictDetailByName(name);
|
||||
if (CollUtil.isNotEmpty(detailVos)) {
|
||||
SystemDictDetailVo systemDictDetailVo = detailVos.stream().findFirst().orElse(null);
|
||||
if (systemDictDetailVo != null) {
|
||||
SystemDictTb systemDictTb = systemDictMapper.selectById(systemDictDetailVo.getDictId());
|
||||
if (systemDictTb != null) {
|
||||
for (SystemDictDetailVo detailVo : detailVos) {
|
||||
detailVo.setDict(systemDictTb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return detailVos;
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -29,13 +29,13 @@ import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemDictService {
|
||||
@@ -46,7 +46,7 @@ public class SystemDictService {
|
||||
private SystemDictDetailService systemDictDetailService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* 创建 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -57,7 +57,7 @@ public class SystemDictService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ public class SystemDictService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 删除 -> TestPassed
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
@@ -83,7 +83,7 @@ public class SystemDictService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* 分页查询 -> TestPassed
|
||||
*
|
||||
* @param args 条件
|
||||
* @param page 分页参数
|
||||
|
||||
+4
-4
@@ -30,11 +30,11 @@ import cn.odboy.system.dal.model.request.SystemSendEmailArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemEmailConfigMapper;
|
||||
import cn.odboy.util.KitDesEncryptUtil;
|
||||
import cn.odboy.util.KitResourceTemplateUtil;
|
||||
import java.util.Collections;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Collections;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -48,7 +48,7 @@ public class SystemEmailService {
|
||||
private AppProperties properties;
|
||||
|
||||
/**
|
||||
* 更新邮件配置
|
||||
* 更新邮件配置 -> TestPassed
|
||||
*
|
||||
* @param emailConfig 邮箱配置
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ public class SystemEmailService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件
|
||||
* 发送邮件 -> TestPassed
|
||||
*
|
||||
* @param sendEmailRequest 邮件发送的内容
|
||||
*/
|
||||
@@ -109,7 +109,7 @@ public class SystemEmailService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验邮箱验证码
|
||||
* 校验邮箱验证码 -> TestPassed
|
||||
*/
|
||||
public void checkEmailCaptchaV1(SystemCaptchaBizEnum biEnum, String email, String code) {
|
||||
String redisKey = biEnum.getRedisKey() + email;
|
||||
|
||||
+12
-13
@@ -29,13 +29,13 @@ import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemJobService {
|
||||
@@ -46,7 +46,7 @@ public class SystemJobService {
|
||||
private SystemUserJobService systemUserJobService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* 创建 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -61,7 +61,7 @@ public class SystemJobService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -73,11 +73,11 @@ public class SystemJobService {
|
||||
throw new BadRequestException("职位名称已存在");
|
||||
}
|
||||
args.setId(job.getId());
|
||||
systemJobMapper.insertOrUpdate(args);
|
||||
systemJobMapper.updateById(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 删除 -> TestPassed
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
@@ -89,7 +89,7 @@ public class SystemJobService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* 分页查询 -> TestPassed
|
||||
*
|
||||
* @param args 条件
|
||||
* @param page 分页参数
|
||||
@@ -102,7 +102,7 @@ public class SystemJobService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部数据
|
||||
* 查询全部数据 -> TestPassed
|
||||
*/
|
||||
public List<SystemJobTb> queryJobByArgs(SystemQueryJobArgs args) {
|
||||
LambdaQueryWrapper<SystemJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
@@ -111,7 +111,7 @@ public class SystemJobService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证是否被用户关联
|
||||
* 验证是否被用户关联 -> TestPassed
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
@@ -132,8 +132,7 @@ public class SystemJobService {
|
||||
wrapper.like(StrUtil.isNotBlank(args.getName()), SystemJobTb::getName, args.getName());
|
||||
wrapper.eq(args.getEnabled() != null, SystemJobTb::getEnabled, args.getEnabled());
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemJobTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemJobTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByDesc(SystemJobTb::getJobSort, SystemJobTb::getId);
|
||||
|
||||
+10
-10
@@ -36,14 +36,14 @@ import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SystemLocalStorageService {
|
||||
@@ -56,7 +56,7 @@ public class SystemLocalStorageService {
|
||||
private AppProperties properties;
|
||||
|
||||
/**
|
||||
* 上传
|
||||
* 上传 -> TestPassed
|
||||
*
|
||||
* @param name 文件名称
|
||||
* @param multipartFile 文件
|
||||
@@ -94,7 +94,7 @@ public class SystemLocalStorageService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args 文件信息
|
||||
*/
|
||||
@@ -106,7 +106,7 @@ public class SystemLocalStorageService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* 多选删除 -> TestPassed
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ public class SystemLocalStorageService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* 分页查询 -> TestPassed
|
||||
*
|
||||
* @param args 条件
|
||||
* @param page 分页参数
|
||||
@@ -159,7 +159,6 @@ public class SystemLocalStorageService {
|
||||
return systemLocalStorageMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
|
||||
public SystemLocalStorageTb uploadPictureV1(MultipartFile file) {
|
||||
// 判断文件是否为图片
|
||||
String suffix = KitFileUtil.getSuffix(file.getOriginalFilename());
|
||||
@@ -171,7 +170,8 @@ public class SystemLocalStorageService {
|
||||
|
||||
public void exportLocalStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) {
|
||||
List<SystemLocalStorageTb> systemLocalStorageTbs = this.queryLocalStorageByArgs(args);
|
||||
List<SystemLocalStorageExportRowVo> rowVos = KitBeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class);
|
||||
List<SystemLocalStorageExportRowVo> rowVos =
|
||||
KitBeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class);
|
||||
KitExcelExporter.exportSimple(response, "文件上传记录数据", SystemLocalStorageExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+13
-17
@@ -16,7 +16,6 @@
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
@@ -37,6 +36,10 @@ import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -46,15 +49,10 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemMenuService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private SystemMenuMapper systemMenuMapper;
|
||||
@Autowired
|
||||
@@ -81,8 +79,8 @@ public class SystemMenuService {
|
||||
args.setPid(null);
|
||||
}
|
||||
if (args.getIFrame()) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) ||
|
||||
args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath()
|
||||
.toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) {
|
||||
throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -105,8 +103,8 @@ public class SystemMenuService {
|
||||
}
|
||||
SystemMenuTb menu = systemMenuMapper.selectById(args.getId());
|
||||
if (args.getIFrame()) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) ||
|
||||
args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath()
|
||||
.toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) {
|
||||
throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -220,7 +218,7 @@ public class SystemMenuService {
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemMenuVo> listMenuByUserId(Long currentUserId) {
|
||||
List<SystemRoleVo> roles = systemUserRoleService.queryRoleByUsersId(currentUserId);
|
||||
List<SystemRoleVo> roles = systemUserRoleService.queryRoleVoByUsersId(currentUserId);
|
||||
Set<Long> roleIds = roles.stream().map(SystemRoleVo::getId).collect(Collectors.toSet());
|
||||
return new ArrayList<>(systemRoleMenuService.queryMenuByRoleIds(roleIds));
|
||||
}
|
||||
@@ -336,7 +334,7 @@ public class SystemMenuService {
|
||||
}
|
||||
}
|
||||
menuVo.setMeta(new SystemMenuMetaVo(menu.getTitle(), menu.getIcon(), !menu.getCache()));
|
||||
if (CollectionUtil.isNotEmpty(menuList)) {
|
||||
if (CollUtil.isNotEmpty(menuList)) {
|
||||
menuVo.setAlwaysShow(true);
|
||||
menuVo.setRedirect("noredirect");
|
||||
menuVo.setChildren(buildMenuVo(menuList));
|
||||
@@ -404,13 +402,11 @@ public class SystemMenuService {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.isNull(args.getPidIsNull() != null, SystemMenuTb::getPid);
|
||||
wrapper.eq(args.getPid() != null, SystemMenuTb::getPid, args.getPid());
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()),
|
||||
c -> c.like(SystemMenuTb::getTitle, args.getBlurry()).or()
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemMenuTb::getTitle, args.getBlurry()).or()
|
||||
.like(SystemMenuTb::getComponentName, args.getBlurry()).or()
|
||||
.like(SystemMenuTb::getPermission, args.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemMenuTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemMenuTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
wrapper.orderByAsc(SystemMenuTb::getMenuSort);
|
||||
return systemMenuMapper.selectList(wrapper);
|
||||
@@ -440,7 +436,7 @@ public class SystemMenuService {
|
||||
public List<SystemMenuVo> listMenuSuperior(List<Long> ids) {
|
||||
Set<SystemMenuVo> menus;
|
||||
List<SystemMenuVo> systemMenuTbs;
|
||||
if (CollectionUtil.isNotEmpty(ids)) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
menus = new LinkedHashSet<>(this.listMenuByIds(ids));
|
||||
for (SystemMenuVo menu : menus) {
|
||||
List<SystemMenuVo> menuList = this.querySuperiorMenuByArgs(menu, new ArrayList<>());
|
||||
|
||||
+13
-13
@@ -20,13 +20,6 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitIPUtil;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import oshi.SystemInfo;
|
||||
@@ -39,6 +32,13 @@ import oshi.software.os.OSFileStore;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
import oshi.util.FormatUtil;
|
||||
import oshi.util.Util;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -47,7 +47,7 @@ public class SystemMonitorService {
|
||||
private final DecimalFormat df = new DecimalFormat("0.00");
|
||||
|
||||
/**
|
||||
* 查询服务器监控信息
|
||||
* 查询服务器监控信息 -> TestPassed
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@@ -101,7 +101,7 @@ public class SystemMonitorService {
|
||||
diskInfo.put("available", KitFileUtil.getSize(available));
|
||||
diskInfo.put("used", KitFileUtil.getSize(used));
|
||||
if (total != 0) {
|
||||
diskInfo.put("usageRate", df.format(used / (double) total * 100));
|
||||
diskInfo.put("usageRate", df.format(used / (double)total * 100));
|
||||
} else {
|
||||
diskInfo.put("usageRate", 0);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class SystemMonitorService {
|
||||
if (used == 0) {
|
||||
swapInfo.put("usageRate", 0);
|
||||
} else {
|
||||
swapInfo.put("usageRate", df.format(used / (double) total * 100));
|
||||
swapInfo.put("usageRate", df.format(used / (double)total * 100));
|
||||
}
|
||||
return swapInfo;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class SystemMonitorService {
|
||||
memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable()));
|
||||
memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable()));
|
||||
memoryInfo.put("usageRate",
|
||||
df.format((memory.getTotal() - memory.getAvailable()) / (double) memory.getTotal() * 100));
|
||||
df.format((memory.getTotal() - memory.getAvailable()) / (double)memory.getTotal() * 100));
|
||||
return memoryInfo;
|
||||
}
|
||||
|
||||
@@ -183,8 +183,8 @@ public class SystemMonitorService {
|
||||
ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];
|
||||
long irq =
|
||||
ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];
|
||||
long softIrq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] -
|
||||
prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
|
||||
long softIrq =
|
||||
ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
|
||||
long steal =
|
||||
ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];
|
||||
long totalCpu = user + nice + sys + idle + ioWait + irq + softIrq + steal;
|
||||
|
||||
+3
@@ -17,6 +17,9 @@ public class SystemOperationLogService {
|
||||
@Autowired
|
||||
private SystemOperationLogMapper systemOperationLogMapper;
|
||||
|
||||
/**
|
||||
* 查询用户操作日志
|
||||
*/
|
||||
public IPage<SystemOperationLogTb> searchUserLog(KitPageArgs<SystemQueryOperationLogArgs> pageArgs) {
|
||||
LambdaQueryWrapper<SystemOperationLogTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemOperationLogTb::getUsername, KitSecurityHelper.getCurrentUsername());
|
||||
|
||||
+2
-2
@@ -21,9 +21,9 @@ import cn.odboy.system.dal.model.request.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemOssStorageVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
+13
-9
@@ -38,15 +38,15 @@ import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.quartz.CronExpression;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemQuartzJobService {
|
||||
@@ -203,13 +203,15 @@ public class SystemQuartzJobService {
|
||||
* @param page 分页参数
|
||||
* @return /
|
||||
*/
|
||||
public KitPageResult<SystemQuartzJobTb> searchQuartzJobByArgs(SystemQueryQuartzJobArgs args, Page<SystemQuartzJobTb> page) {
|
||||
public KitPageResult<SystemQuartzJobTb> searchQuartzJobByArgs(SystemQueryQuartzJobArgs args,
|
||||
Page<SystemQuartzJobTb> page) {
|
||||
LambdaQueryWrapper<SystemQuartzJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
this.injectQuartzJobQueryParams(args, wrapper);
|
||||
return KitPageUtil.toPage(systemQuartzJobMapper.selectPage(page, wrapper));
|
||||
}
|
||||
|
||||
private void injectQuartzJobQueryParams(SystemQueryQuartzJobArgs args, LambdaQueryWrapper<SystemQuartzJobTb> wrapper) {
|
||||
private void injectQuartzJobQueryParams(SystemQueryQuartzJobArgs args,
|
||||
LambdaQueryWrapper<SystemQuartzJobTb> wrapper) {
|
||||
KitValidUtil.notNull(args);
|
||||
wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzJobTb::getJobName, args.getJobName());
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
@@ -218,12 +220,14 @@ public class SystemQuartzJobService {
|
||||
wrapper.orderByDesc(SystemQuartzJobTb::getId);
|
||||
}
|
||||
|
||||
private void injectQuartzLogQueryParams(SystemQueryQuartzJobArgs args, LambdaQueryWrapper<SystemQuartzLogTb> wrapper) {
|
||||
private void injectQuartzLogQueryParams(SystemQueryQuartzJobArgs args,
|
||||
LambdaQueryWrapper<SystemQuartzLogTb> wrapper) {
|
||||
if (args != null) {
|
||||
wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzLogTb::getJobName, args.getJobName());
|
||||
wrapper.eq(args.getIsSuccess() != null, SystemQuartzLogTb::getIsSuccess, args.getIsSuccess());
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemQuartzLogTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
wrapper.between(SystemQuartzLogTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByDesc(SystemQuartzLogTb::getId);
|
||||
|
||||
+13
-21
@@ -21,13 +21,12 @@ import cn.odboy.system.dal.dataobject.SystemRoleDeptTb;
|
||||
import cn.odboy.system.dal.mysql.SystemDeptMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleDeptMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemRoleDeptService {
|
||||
@@ -60,23 +59,6 @@ public class SystemRoleDeptService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id查询
|
||||
*
|
||||
* @param roleId /
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemDeptTb> listDeptByRoleId(Long roleId) {
|
||||
LambdaQueryWrapper<SystemRoleDeptTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemRoleDeptTb::getRoleId, roleId);
|
||||
List<SystemRoleDeptTb> systemRoleDeptTbs = systemRoleDeptMapper.selectList(wrapper);
|
||||
if (systemRoleDeptTbs.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Long> deptIds = systemRoleDeptTbs.stream().map(SystemRoleDeptTb::getDeptId).collect(Collectors.toList());
|
||||
return systemDeptMapper.selectByIds(deptIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门ID统计角色数量
|
||||
*
|
||||
@@ -92,4 +74,14 @@ public class SystemRoleDeptService {
|
||||
wrapper.in(SystemRoleDeptTb::getDeptId, deptIds);
|
||||
return systemRoleDeptMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id查询部门信息
|
||||
*
|
||||
* @param roleId 角色id
|
||||
* @return /
|
||||
*/
|
||||
public Set<SystemDeptTb> listUserDeptByRoleId(Long roleId) {
|
||||
return systemRoleDeptMapper.listUserDeptByRoleId(roleId);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -23,14 +23,14 @@ import cn.odboy.system.dal.mysql.SystemMenuMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMenuMapper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemRoleMenuService {
|
||||
|
||||
+17
-22
@@ -16,19 +16,18 @@
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.export.SystemRoleExportRowVo;
|
||||
import cn.odboy.system.dal.model.request.SystemCreateRoleArgs;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryRoleArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleCodeVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleVo;
|
||||
import cn.odboy.system.dal.model.response.SystemUserVo;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
@@ -37,16 +36,16 @@ import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemRoleService {
|
||||
@@ -74,8 +73,8 @@ public class SystemRoleService {
|
||||
SystemRoleTb roleTb = KitBeanUtil.copyToClass(args, SystemRoleTb.class);
|
||||
systemRoleMapper.insert(roleTb);
|
||||
// 判断是否有部门数据, 若有, 则需创建关联
|
||||
if (CollectionUtil.isNotEmpty(args.getDepts())) {
|
||||
systemRoleDeptService.batchInsertRoleDept(args.getDepts(), args.getId());
|
||||
if (CollUtil.isNotEmpty(args.getDepts())) {
|
||||
systemRoleDeptService.batchInsertRoleDept(args.getDepts(), roleTb.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +112,7 @@ public class SystemRoleService {
|
||||
// 删除关联部门数据
|
||||
systemRoleDeptService.batchDeleteRoleDept(Collections.singleton(args.getId()));
|
||||
// 判断是否有部门数据, 若有, 则需更新关联
|
||||
if (CollectionUtil.isNotEmpty(args.getDepts())) {
|
||||
if (CollUtil.isNotEmpty(args.getDepts())) {
|
||||
systemRoleDeptService.batchInsertRoleDept(args.getDepts(), args.getId());
|
||||
}
|
||||
}
|
||||
@@ -147,7 +146,8 @@ public class SystemRoleService {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRoleByIds(Set<Long> ids) {
|
||||
List<Integer> roleLevels = systemRoleMapper.selectByIds(ids).stream().map(SystemRoleTb::getLevel).distinct().collect(Collectors.toList());
|
||||
List<Integer> roleLevels = systemRoleMapper.selectByIds(ids).stream().map(SystemRoleTb::getLevel).distinct()
|
||||
.collect(Collectors.toList());
|
||||
for (Integer roleLevel : roleLevels) {
|
||||
checkRoleLevels(roleLevel);
|
||||
}
|
||||
@@ -180,12 +180,10 @@ public class SystemRoleService {
|
||||
KitValidUtil.notNull(args);
|
||||
// 查询角色基本信息
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()),
|
||||
c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
.like(SystemRoleTb::getDescription, args.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
wrapper.orderByAsc(SystemRoleTb::getLevel);
|
||||
List<SystemRoleTb> roles;
|
||||
@@ -211,21 +209,20 @@ public class SystemRoleService {
|
||||
return KitPageUtil.toPage(roles, total);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户权限信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 权限信息
|
||||
*/
|
||||
public List<SystemRoleCodeVo> buildUserRolePermissions(SystemUserTb user) {
|
||||
public List<SystemRoleCodeVo> buildUserRolePermissions(SystemUserVo user) {
|
||||
Set<String> permissions = new HashSet<>();
|
||||
// 如果是管理员直接返回
|
||||
if (user.getIsAdmin()) {
|
||||
permissions.add("admin");
|
||||
return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList());
|
||||
}
|
||||
List<SystemRoleVo> roles = systemUserRoleService.queryRoleByUsersId(user.getId());
|
||||
List<SystemRoleVo> roles = systemUserRoleService.queryRoleVoByUsersId(user.getId());
|
||||
permissions = roles.stream().flatMap(role -> role.getMenus().stream()).map(SystemMenuVo::getPermission)
|
||||
.filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
||||
return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList());
|
||||
@@ -245,12 +242,10 @@ public class SystemRoleService {
|
||||
public Long countRoleByArgs(SystemQueryRoleArgs args) {
|
||||
KitValidUtil.notNull(args);
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()),
|
||||
c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
.like(SystemRoleTb::getDescription, args.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
return systemRoleMapper.selectCount(wrapper);
|
||||
}
|
||||
@@ -273,7 +268,7 @@ public class SystemRoleService {
|
||||
* @return /
|
||||
*/
|
||||
private int checkRoleLevels(Integer level) {
|
||||
List<Integer> levels = systemUserRoleService.queryRoleByUsersId(KitSecurityHelper.getCurrentUserId()).stream()
|
||||
List<Integer> levels = systemUserRoleService.queryRoleVoByUsersId(KitSecurityHelper.getCurrentUserId()).stream()
|
||||
.map(SystemRoleVo::getLevel).collect(Collectors.toList());
|
||||
int min = Collections.min(levels);
|
||||
if (level != null) {
|
||||
|
||||
+1
-1
@@ -3,9 +3,9 @@ package cn.odboy.system.service;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.mysql.SystemUserMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemUserDeptService {
|
||||
|
||||
+5
-7
@@ -20,12 +20,12 @@ import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserJobTb;
|
||||
import cn.odboy.system.dal.mysql.SystemUserJobMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemUserJobService {
|
||||
@@ -71,9 +71,7 @@ public class SystemUserJobService {
|
||||
return systemUserJobMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
public List<SystemUserJobTb> listUserJobByUserId(Long userId) {
|
||||
LambdaQueryWrapper<SystemUserJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemUserJobTb::getUserId, userId);
|
||||
return systemUserJobMapper.selectList(wrapper);
|
||||
public Set<SystemJobTb> listUserJobByUserId(Long userId) {
|
||||
return systemUserJobMapper.listUserJobByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
+31
-33
@@ -28,16 +28,15 @@ import cn.odboy.system.dal.mysql.SystemUserRoleMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SystemUserRoleService {
|
||||
@@ -88,11 +87,9 @@ public class SystemUserRoleService {
|
||||
// 查询关联的菜单信息
|
||||
Set<SystemMenuVo> menus = systemRoleMenuService.queryMenuByRoleIds(Collections.singleton(role.getId()));
|
||||
roleVo.setMenus(menus);
|
||||
|
||||
// 查询关联的部门信息
|
||||
List<SystemDeptTb> depts = systemRoleDeptService.listDeptByRoleId(role.getId());
|
||||
roleVo.setDepts(new LinkedHashSet<>(depts));
|
||||
|
||||
Set<SystemDeptTb> depts = systemRoleDeptService.listUserDeptByRoleId(role.getId());
|
||||
roleVo.setDepts(depts);
|
||||
return roleVo;
|
||||
}
|
||||
|
||||
@@ -102,16 +99,8 @@ public class SystemUserRoleService {
|
||||
* @param userId 用户ID
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemRoleVo> queryRoleByUsersId(Long userId) {
|
||||
// 查询用户角色关联
|
||||
LambdaQueryWrapper<SystemUserRoleTb> userRoleWrapper = new LambdaQueryWrapper<>();
|
||||
userRoleWrapper.eq(SystemUserRoleTb::getUserId, userId);
|
||||
List<SystemUserRoleTb> userRoles = systemUserRoleMapper.selectList(userRoleWrapper);
|
||||
if (CollUtil.isEmpty(userRoles)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Set<Long> roleIds = userRoles.stream().map(SystemUserRoleTb::getRoleId).collect(Collectors.toSet());
|
||||
List<SystemRoleTb> roles = systemRoleMapper.selectByIds(roleIds);
|
||||
public List<SystemRoleVo> queryRoleVoByUsersId(Long userId) {
|
||||
Set<SystemRoleTb> roles = this.listUserRoleByUserId(userId);
|
||||
return roles.stream().map(this::convertToRoleVo).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -123,13 +112,24 @@ public class SystemUserRoleService {
|
||||
*/
|
||||
public Integer getDeptLevelByRoles(Set<SystemRoleTb> roles) {
|
||||
if (CollUtil.isEmpty(roles)) {
|
||||
// 最小权限
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
Set<SystemRoleTb> roleSet = new HashSet<>();
|
||||
for (SystemRoleTb role : roles) {
|
||||
roleSet.add(systemRoleMapper.selectById(role.getId()));
|
||||
List<Long> roleIds =
|
||||
roles.stream().map(SystemRoleTb::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(roleIds)) {
|
||||
// 最小权限
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return Collections.min(roleSet.stream().map(SystemRoleTb::getLevel).collect(Collectors.toList()));
|
||||
List<Integer> roleLevels = systemRoleMapper.selectList(
|
||||
new LambdaQueryWrapper<SystemRoleTb>().select(SystemRoleTb::getLevel).isNotNull(SystemRoleTb::getLevel)
|
||||
.in(SystemRoleTb::getId, roleIds)).stream().map(SystemRoleTb::getLevel).distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(roleLevels)) {
|
||||
// 最小权限
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return Collections.min(roleLevels);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,20 +139,14 @@ public class SystemUserRoleService {
|
||||
*/
|
||||
public void checkLevel(SystemUserVo args) {
|
||||
Integer currentLevel = Collections.min(
|
||||
this.queryRoleByUsersId(KitSecurityHelper.getCurrentUserId()).stream()
|
||||
.map(SystemRoleVo::getLevel).collect(Collectors.toList()));
|
||||
this.queryRoleVoByUsersId(KitSecurityHelper.getCurrentUserId()).stream().map(SystemRoleVo::getLevel)
|
||||
.collect(Collectors.toList()));
|
||||
Integer optLevel = this.getDeptLevelByRoles(args.getRoles());
|
||||
if (currentLevel > optLevel) {
|
||||
throw new BadRequestException("角色权限不足");
|
||||
}
|
||||
}
|
||||
|
||||
public List<SystemUserRoleTb> listUserRoleByUserId(Long userId) {
|
||||
LambdaQueryWrapper<SystemUserRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemUserRoleTb::getUserId, userId);
|
||||
return systemUserRoleMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
public long countUserByRoleIds(Set<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return 0L;
|
||||
@@ -161,4 +155,8 @@ public class SystemUserRoleService {
|
||||
wrapper.in(SystemUserRoleTb::getRoleId, ids);
|
||||
return systemUserRoleMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
public Set<SystemRoleTb> listUserRoleByUserId(Long userId) {
|
||||
return systemUserRoleMapper.listUserRoleByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
+61
-69
@@ -16,7 +16,6 @@
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
@@ -26,15 +25,13 @@ import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.server.core.KitFileLocalUploadHelper;
|
||||
import cn.odboy.system.constant.SystemCaptchaBizEnum;
|
||||
import cn.odboy.system.constant.SystemZhConst;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.export.SystemUserExportRowVo;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.model.request.SystemUpdateUserPasswordArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemDeptVo;
|
||||
import cn.odboy.system.dal.model.response.SystemRoleVo;
|
||||
import cn.odboy.system.dal.model.response.SystemUserVo;
|
||||
import cn.odboy.system.dal.mysql.SystemUserMapper;
|
||||
@@ -50,24 +47,22 @@ import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Service
|
||||
public class SystemUserService {
|
||||
@@ -75,10 +70,6 @@ public class SystemUserService {
|
||||
@Autowired
|
||||
private SystemUserMapper systemUserMapper;
|
||||
@Autowired
|
||||
private SystemJobService systemJobService;
|
||||
@Autowired
|
||||
private SystemRoleService systemRoleService;
|
||||
@Autowired
|
||||
private SystemDeptService systemDeptService;
|
||||
@Autowired
|
||||
private SystemUserJobService systemUserJobService;
|
||||
@@ -99,7 +90,6 @@ public class SystemUserService {
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*
|
||||
@@ -108,24 +98,25 @@ public class SystemUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveUser(SystemUserVo args) {
|
||||
systemUserRoleService.checkLevel(args);
|
||||
SystemUserTb record = KitBeanUtil.copyToClass(args, SystemUserTb.class);
|
||||
// 默认密码 123456
|
||||
args.setPassword(passwordEncoder.encode("123456"));
|
||||
args.setDeptId(args.getDept().getId());
|
||||
if (this.getUserByUsername(args.getUsername()) != null) {
|
||||
record.setPassword(passwordEncoder.encode("123456"));
|
||||
record.setDeptId(args.getDept().getId());
|
||||
if (this.getUserByUsername(record.getUsername()) != null) {
|
||||
throw new BadRequestException("用户名已存在");
|
||||
}
|
||||
if (this.getUserByEmail(args.getEmail()) != null) {
|
||||
if (this.getUserByEmail(record.getEmail()) != null) {
|
||||
throw new BadRequestException("邮箱已存在");
|
||||
}
|
||||
if (this.getUserByPhone(args.getPhone()) != null) {
|
||||
if (this.getUserByPhone(record.getPhone()) != null) {
|
||||
throw new BadRequestException("手机号已存在");
|
||||
}
|
||||
// 保存用户
|
||||
systemUserMapper.insert(args);
|
||||
systemUserMapper.insert(record);
|
||||
// 保存用户岗位
|
||||
systemUserJobService.batchInsertUserJob(args.getJobs(), args.getId());
|
||||
systemUserJobService.batchInsertUserJob(args.getJobs(), record.getId());
|
||||
// 保存用户角色
|
||||
systemUserRoleService.batchInsertUserRole(args.getRoles(), args.getId());
|
||||
systemUserRoleService.batchInsertUserRole(args.getRoles(), record.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,7 +151,7 @@ public class SystemUserService {
|
||||
user.setPhone(args.getPhone());
|
||||
user.setNickName(args.getNickName());
|
||||
user.setGender(args.getGender());
|
||||
systemUserMapper.insertOrUpdate(user);
|
||||
systemUserMapper.updateById(user);
|
||||
// 清除用户登录缓存
|
||||
systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername());
|
||||
// 更新用户岗位
|
||||
@@ -204,18 +195,18 @@ public class SystemUserService {
|
||||
// 校验权限
|
||||
for (Long id : ids) {
|
||||
Integer currentLevel = Collections.min(
|
||||
systemUserRoleService.queryRoleByUsersId(currentUserId).stream()
|
||||
.map(SystemRoleVo::getLevel).collect(Collectors.toList()));
|
||||
systemUserRoleService.queryRoleVoByUsersId(currentUserId).stream().map(SystemRoleVo::getLevel)
|
||||
.collect(Collectors.toList()));
|
||||
Integer optLevel = Collections.min(
|
||||
systemUserRoleService.queryRoleByUsersId(id).stream().map(SystemRoleVo::getLevel)
|
||||
systemUserRoleService.queryRoleVoByUsersId(id).stream().map(SystemRoleVo::getLevel)
|
||||
.collect(Collectors.toList()));
|
||||
if (currentLevel > optLevel) {
|
||||
throw new BadRequestException(
|
||||
"角色权限不足, 不能删除:" + this.getUserById(id).getUsername());
|
||||
throw new BadRequestException("角色权限不足, 不能删除:" + this.getUserById(id).getUsername());
|
||||
}
|
||||
}
|
||||
// 清理缓存
|
||||
List<String> usernameList = systemUserMapper.selectByIds(ids).stream().map(SystemUserTb::getUsername).distinct().collect(Collectors.toList());
|
||||
List<String> usernameList = systemUserMapper.selectByIds(ids).stream().map(SystemUserTb::getUsername).distinct()
|
||||
.collect(Collectors.toList());
|
||||
for (String username : usernameList) {
|
||||
systemUserInfoDAO.deleteUserLoginInfoByUserName(username);
|
||||
}
|
||||
@@ -235,10 +226,8 @@ public class SystemUserService {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateUserPasswordByUsername(String username, SystemUpdateUserPasswordArgs args) throws Exception {
|
||||
String oldPass =
|
||||
KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getOldPass());
|
||||
String newPass =
|
||||
KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getNewPass());
|
||||
String oldPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getOldPass());
|
||||
String newPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getNewPass());
|
||||
SystemUserTb user = this.getUserByUsername(username);
|
||||
if (!passwordEncoder.matches(oldPass, user.getPassword())) {
|
||||
throw new BadRequestException("修改失败,旧密码错误");
|
||||
@@ -335,16 +324,17 @@ public class SystemUserService {
|
||||
*/
|
||||
public KitPageResult<SystemUserVo> searchUserByArgs(SystemQueryUserArgs args, Page<SystemUserTb> page) {
|
||||
// 查询用户基本信息
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = buildUserQueryWrapper(args);
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = this.buildUserQueryWrapper(args);
|
||||
IPage<SystemUserTb> userPage = systemUserMapper.selectPage(page, wrapper);
|
||||
List<SystemUserTb> users = userPage.getRecords();
|
||||
// 转换为SystemUserVo并关联查询
|
||||
List<SystemUserVo> userVos = users.stream().map(this::convertToUserVo).collect(Collectors.toList());
|
||||
List<SystemUserVo> userVos =
|
||||
users.stream().map(m -> this.convertToUserVo(m, false)).collect(Collectors.toList());
|
||||
return KitPageUtil.toPage(userVos, userPage.getTotal());
|
||||
}
|
||||
|
||||
public long countUserByArgs(SystemQueryUserArgs args) {
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = buildUserQueryWrapper(args);
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = this.buildUserQueryWrapper(args);
|
||||
return systemUserMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
@@ -400,13 +390,11 @@ public class SystemUserService {
|
||||
wrapper.in(SystemUserTb::getDeptId, args.getDeptIds());
|
||||
}
|
||||
if (StrUtil.isNotBlank(args.getBlurry())) {
|
||||
wrapper.and(w -> w.like(SystemUserTb::getUsername, args.getBlurry())
|
||||
.or().like(SystemUserTb::getNickName, args.getBlurry())
|
||||
.or().like(SystemUserTb::getEmail, args.getBlurry()));
|
||||
wrapper.and(w -> w.like(SystemUserTb::getUsername, args.getBlurry()).or()
|
||||
.like(SystemUserTb::getNickName, args.getBlurry()).or().like(SystemUserTb::getEmail, args.getBlurry()));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemUserTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemUserTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
wrapper.orderByDesc(SystemUserTb::getCreateTime);
|
||||
return wrapper;
|
||||
@@ -416,32 +404,26 @@ public class SystemUserService {
|
||||
* 转换为SystemUserVo并关联查询部门、角色、岗位信息
|
||||
*
|
||||
* @param user 用户基本信息
|
||||
* @param includePassword 是否包含用户密码
|
||||
* @return 包含关联信息的SystemUserVo
|
||||
*/
|
||||
private SystemUserVo convertToUserVo(SystemUserTb user) {
|
||||
private SystemUserVo convertToUserVo(SystemUserTb user, boolean includePassword) {
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
if (!includePassword) {
|
||||
// 查询用户时,清空密码
|
||||
user.setPassword(null);
|
||||
}
|
||||
SystemUserVo userVo = KitBeanUtil.copyToClass(user, SystemUserVo.class);
|
||||
// 查询关联的部门信息
|
||||
if (user.getDeptId() != null) {
|
||||
SystemDeptVo dept = systemDeptService.getDeptVoById(user.getDeptId());
|
||||
userVo.setDept(dept);
|
||||
userVo.setDept(systemDeptService.getDeptVoById(user.getDeptId()));
|
||||
}
|
||||
// 查询关联的岗位信息
|
||||
List<SystemUserJobTb> userJobs = systemUserJobService.listUserJobByUserId(user.getId());
|
||||
if (CollUtil.isNotEmpty(userJobs)) {
|
||||
Set<Long> jobIds = userJobs.stream().map(SystemUserJobTb::getJobId).collect(Collectors.toSet());
|
||||
List<SystemJobTb> jobs = systemJobService.listByIds(jobIds);
|
||||
userVo.setJobs(new LinkedHashSet<>(jobs));
|
||||
}
|
||||
userVo.setJobs(systemUserJobService.listUserJobByUserId(user.getId()));
|
||||
// 查询关联的角色信息
|
||||
List<SystemUserRoleTb> userRoles = systemUserRoleService.listUserRoleByUserId(user.getId());
|
||||
if (CollUtil.isNotEmpty(userRoles)) {
|
||||
Set<Long> roleIds = userRoles.stream().map(SystemUserRoleTb::getRoleId).collect(Collectors.toSet());
|
||||
List<SystemRoleTb> roles = systemRoleService.listByIds(roleIds);
|
||||
userVo.setRoles(new LinkedHashSet<>(roles));
|
||||
}
|
||||
userVo.setRoles(systemUserRoleService.listUserRoleByUserId(user.getId()));
|
||||
return userVo;
|
||||
}
|
||||
|
||||
@@ -452,8 +434,12 @@ public class SystemUserService {
|
||||
return systemUserMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
public SystemUserVo getUserVoWithPasswordByUsername(String username) {
|
||||
return this.convertToUserVo(this.getUserByUsername(username), true);
|
||||
}
|
||||
|
||||
public SystemUserVo getUserVoByUsername(String username) {
|
||||
return this.convertToUserVo(this.getUserByUsername(username));
|
||||
return this.convertToUserVo(this.getUserByUsername(username), false);
|
||||
}
|
||||
|
||||
public SystemUserTb getUserByEmail(String email) {
|
||||
@@ -470,21 +456,24 @@ public class SystemUserService {
|
||||
return systemUserMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
public KitPageResult<SystemUserVo> aggregationSearchUserByArgs(Page<SystemUserTb> page, SystemQueryUserArgs args, String currentUsername) {
|
||||
public KitPageResult<SystemUserVo> aggregationSearchUserByArgs(Page<SystemUserTb> page, SystemQueryUserArgs args,
|
||||
String currentUsername) {
|
||||
if (!ObjectUtils.isEmpty(args.getDeptId())) {
|
||||
args.getDeptIds().add(args.getDeptId());
|
||||
// 先查找是否存在子节点
|
||||
List<SystemDeptVo> data = systemDeptService.listDeptByPid(args.getDeptId());
|
||||
List<SystemDeptTb> data = systemDeptService.listDeptByPid(args.getDeptId());
|
||||
Map<Long, List<SystemDeptTb>> deptPidMap =
|
||||
systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid));
|
||||
// 然后把子节点的ID都加入到集合中
|
||||
args.getDeptIds().addAll(systemDeptService.queryChildDeptIdByDeptIds(data));
|
||||
args.getDeptIds().addAll(systemDeptService.queryChildDeptIdByDeptIds(data, deptPidMap));
|
||||
}
|
||||
// 数据权限
|
||||
List<Long> dataScopes = systemDataService.queryDeptIdByArgs(this.getUserVoByUsername(currentUsername));
|
||||
// args.getDeptIds() 不为空并且数据权限不为空则取交集
|
||||
if (!CollectionUtils.isEmpty(args.getDeptIds()) && !CollectionUtils.isEmpty(dataScopes)) {
|
||||
if (!CollUtil.isEmpty(args.getDeptIds()) && !CollUtil.isEmpty(dataScopes)) {
|
||||
// 取交集
|
||||
args.getDeptIds().retainAll(dataScopes);
|
||||
if (!CollectionUtil.isEmpty(args.getDeptIds())) {
|
||||
if (!CollUtil.isEmpty(args.getDeptIds())) {
|
||||
return this.searchUserByArgs(args, page);
|
||||
}
|
||||
} else {
|
||||
@@ -497,15 +486,18 @@ public class SystemUserService {
|
||||
|
||||
public void exportUserXlsx(HttpServletResponse response, SystemQueryUserArgs args) {
|
||||
long totalCount = this.countUserByArgs(args);
|
||||
KitExcelExporter.exportByPage(response, "用户数据", SystemUserExportRowVo.class, totalCount, (long pageNum, long pageSize) -> {
|
||||
KitExcelExporter.exportByPage(response, "用户数据", SystemUserExportRowVo.class, totalCount,
|
||||
(long pageNum, long pageSize) -> {
|
||||
KitPageResult<SystemUserVo> pageResult = this.searchUserByArgs(args, new Page<>(pageNum, pageSize));
|
||||
List<SystemUserExportRowVo> rowVos = new ArrayList<>();
|
||||
for (SystemUserVo dataObject : pageResult.getContent()) {
|
||||
SystemUserExportRowVo rowVo = new SystemUserExportRowVo();
|
||||
rowVo.setUsername(dataObject.getUsername());
|
||||
rowVo.setRoles(dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setRoles(
|
||||
dataObject.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setDept(dataObject.getDept().getName());
|
||||
rowVo.setJobs(dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setJobs(
|
||||
dataObject.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.joining(",")));
|
||||
rowVo.setEmail(dataObject.getEmail());
|
||||
rowVo.setStatus(dataObject.getEnabled() ? SystemZhConst.ENABLE_STR : SystemZhConst.DISABLE_STR);
|
||||
rowVo.setMobile(dataObject.getPhone());
|
||||
|
||||
+15
-10
@@ -39,13 +39,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -69,7 +69,8 @@ public class SystemMinioStorageServiceImpl extends ServiceImpl<SystemOssStorageM
|
||||
private SystemOssStorageMapper systemOssStorageMapper;
|
||||
|
||||
@Override
|
||||
public KitPageResult<SystemOssStorageVo> searchOssStorage(SystemQueryStorageArgs args, Page<SystemOssStorageTb> page) {
|
||||
public KitPageResult<SystemOssStorageVo> searchOssStorage(SystemQueryStorageArgs args,
|
||||
Page<SystemOssStorageTb> page) {
|
||||
IPage<SystemOssStorageVo> ossStorageTbs = this.selectOssStorageByArgs(args, page);
|
||||
for (SystemOssStorageVo storageVo : ossStorageTbs.getRecords()) {
|
||||
storageVo.setFileSizeDesc(KitFileUtil.getSize(storageVo.getFileSize()));
|
||||
@@ -77,7 +78,8 @@ public class SystemMinioStorageServiceImpl extends ServiceImpl<SystemOssStorageM
|
||||
return KitPageUtil.toPage(ossStorageTbs);
|
||||
}
|
||||
|
||||
private IPage<SystemOssStorageVo> selectOssStorageByArgs(SystemQueryStorageArgs args, Page<SystemOssStorageTb> page) {
|
||||
private IPage<SystemOssStorageVo> selectOssStorageByArgs(SystemQueryStorageArgs args,
|
||||
Page<SystemOssStorageTb> page) {
|
||||
KitValidUtil.notNull(args);
|
||||
LambdaQueryWrapper<SystemOssStorageTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()),
|
||||
@@ -86,10 +88,12 @@ public class SystemMinioStorageServiceImpl extends ServiceImpl<SystemOssStorageM
|
||||
.like(SystemOssStorageTb::getFileMime, args.getBlurry()).or()
|
||||
.like(SystemOssStorageTb::getFileMd5, args.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemOssStorageTb::getUpdateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
wrapper.between(SystemOssStorageTb::getUpdateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
}
|
||||
wrapper.orderByAsc(SystemOssStorageTb::getId);
|
||||
return systemOssStorageMapper.selectPage(page, wrapper).convert(i -> KitBeanUtil.copyToClass(i, SystemOssStorageVo.class));
|
||||
return systemOssStorageMapper.selectPage(page, wrapper)
|
||||
.convert(i -> KitBeanUtil.copyToClass(i, SystemOssStorageVo.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,9 +155,10 @@ public class SystemMinioStorageServiceImpl extends ServiceImpl<SystemOssStorageM
|
||||
@Override
|
||||
public void exportOssStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) {
|
||||
List<SystemOssStorageVo> systemOssStorageVos = this.queryOssStorage(args);
|
||||
// KitXlsxExportUtil.exportFile(response, "OSS文件上传记录数据", systemOssStorageVos, SystemOssStorageExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(KitBeanUtil.copyProperties(dataObject, SystemOssStorageExportRowVo.class)));
|
||||
List<SystemOssStorageExportRowVo> rowVos = KitBeanUtil.copyToList(systemOssStorageVos, SystemOssStorageExportRowVo.class);
|
||||
// KitXlsxExportUtil.exportFile(response, "OSS文件上传记录数据", systemOssStorageVos, SystemOssStorageExportRowVo.class,
|
||||
// (dataObject) -> CollUtil.newArrayList(KitBeanUtil.copyProperties(dataObject, SystemOssStorageExportRowVo.class)));
|
||||
List<SystemOssStorageExportRowVo> rowVos =
|
||||
KitBeanUtil.copyToList(systemOssStorageVos, SystemOssStorageExportRowVo.class);
|
||||
KitExcelExporter.exportSimple(response, "OSS文件上传记录数据", SystemOssStorageExportRowVo.class, rowVos);
|
||||
}
|
||||
|
||||
|
||||
+12
-1
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemDictDetailMapper">
|
||||
<select id="selectPageByArgs" resultType="cn.odboy.system.dal.dataobject.SystemDictDetailTb">
|
||||
<select id="selectPageByArgs" resultType="cn.odboy.system.dal.model.response.SystemDictDetailVo">
|
||||
SELECT
|
||||
t1.*
|
||||
FROM system_dict_detail t1 LEFT JOIN system_dict t2 ON t1.dict_id = t2.id
|
||||
@@ -15,4 +15,15 @@
|
||||
</where>
|
||||
ORDER BY t1.dict_sort
|
||||
</select>
|
||||
<select id="listDictDetailByName" resultType="cn.odboy.system.dal.model.response.SystemDictDetailVo">
|
||||
SELECT t1.*
|
||||
FROM system_dict_detail t1
|
||||
LEFT JOIN system_dict t2 ON t1.dict_id = t2.id
|
||||
<where>
|
||||
<if test="name != null and name != ''">
|
||||
AND t2.name = #{name}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t1.dict_sort
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemRoleDeptMapper">
|
||||
<select id="listUserDeptByRoleId" resultType="cn.odboy.system.dal.dataobject.SystemDeptTb">
|
||||
SELECT DISTINCT t1.*, t1.dept_id as id
|
||||
FROM system_dept t1
|
||||
LEFT JOIN system_roles_depts t2 ON t1.dept_id = t2.dept_id
|
||||
WHERE t2.role_id = #{roleId}
|
||||
</select>
|
||||
</mapper>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemUserJobMapper">
|
||||
<select id="listUserJobByUserId" resultType="cn.odboy.system.dal.dataobject.SystemJobTb">
|
||||
SELECT DISTINCT t1.*
|
||||
FROM system_job t1
|
||||
LEFT JOIN system_users_jobs t2 ON t1.id = t2.job_id
|
||||
WHERE t1.enabled = 1
|
||||
AND t2.user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemUserRoleMapper">
|
||||
<select id="listUserRoleByUserId" resultType="cn.odboy.system.dal.dataobject.SystemRoleTb">
|
||||
SELECT DISTINCT t1.*, t1.role_id as id
|
||||
FROM system_role t1
|
||||
LEFT JOIN system_users_roles t2 ON t1.role_id = t2.role_id
|
||||
WHERE t2.user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
+5
-1
@@ -17,11 +17,13 @@ package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemDictDetailTb;
|
||||
import cn.odboy.system.dal.model.request.SystemQueryDictDetailArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemDictDetailVo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典明细 Mapper
|
||||
@@ -31,5 +33,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface SystemDictDetailMapper extends BaseMapper<SystemDictDetailTb> {
|
||||
|
||||
IPage<SystemDictDetailTb> selectPageByArgs(Page<SystemDictDetailTb> page, @Param("args") SystemQueryDictDetailArgs args);
|
||||
IPage<SystemDictDetailVo> selectPageByArgs(Page<SystemDictDetailTb> page, @Param("args") SystemQueryDictDetailArgs args);
|
||||
|
||||
List<SystemDictDetailVo> listDictDetailByName(@Param("name") String name);
|
||||
}
|
||||
|
||||
+9
-7
@@ -14,13 +14,13 @@ import cn.odboy.system.framework.permission.core.handler.UserDetailsHandler;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import cn.odboy.util.KitRsaEncryptUtil;
|
||||
import cn.odboy.util.KitValidUtil;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 用户认证
|
||||
@@ -42,13 +42,14 @@ public class SystemAuthService {
|
||||
private SystemCaptchaService systemCaptchaService;
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* 登录 -> TestPassed
|
||||
*/
|
||||
public SystemAuthVo doLogin(SystemUserLoginArgs loginArgs, HttpServletRequest request) throws Exception {
|
||||
KitValidUtil.notNull(loginArgs);
|
||||
|
||||
// 密码解密
|
||||
String password = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginArgs.getPassword());
|
||||
String password =
|
||||
KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), loginArgs.getPassword());
|
||||
// 校验验证码
|
||||
systemCaptchaService.validate(loginArgs.getUuid(), loginArgs.getCode());
|
||||
// 获取用户信息
|
||||
@@ -59,7 +60,8 @@ public class SystemAuthService {
|
||||
}
|
||||
|
||||
// 登录验证
|
||||
Authentication authentication = new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities());
|
||||
Authentication authentication =
|
||||
new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities());
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
|
||||
// 生成令牌
|
||||
@@ -81,10 +83,10 @@ public class SystemAuthService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录人信息
|
||||
* 获取当前登录人信息 -> TestPassed
|
||||
*/
|
||||
public SystemUserJwtVo getCurrentUserInfo() {
|
||||
SystemUserJwtVo jwtUser = (SystemUserJwtVo) KitSecurityHelper.getCurrentUser();
|
||||
SystemUserJwtVo jwtUser = (SystemUserJwtVo)KitSecurityHelper.getCurrentUser();
|
||||
if (jwtUser.getUser() != null) {
|
||||
jwtUser.getUser().setPassword(null);
|
||||
}
|
||||
@@ -92,7 +94,7 @@ public class SystemAuthService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
* 退出登录 -> TestPassed
|
||||
*/
|
||||
public void doLogout(HttpServletRequest request) {
|
||||
String token = tokenProvider.getToken(request);
|
||||
|
||||
+7
-6
@@ -10,9 +10,9 @@ import cn.odboy.framework.redis.KitRedisHelper;
|
||||
import cn.odboy.system.dal.model.response.SystemCaptchaVo;
|
||||
import cn.odboy.system.dal.redis.SystemCacheKey;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
@@ -26,7 +26,7 @@ public class SystemCaptchaService {
|
||||
private AppProperties properties;
|
||||
|
||||
/**
|
||||
* 获取登录验证码
|
||||
* 获取登录验证码 -> TestPassed
|
||||
*/
|
||||
public SystemCaptchaVo getLoginCaptcha() {
|
||||
// 获取运算的结果
|
||||
@@ -34,12 +34,13 @@ public class SystemCaptchaService {
|
||||
String uuid = SystemCacheKey.CAPTCHA_LOGIN + IdUtil.simpleUUID();
|
||||
//当验证码类型为 arithmetic时且长度 >= 2 时, captcha.text()的结果有几率为浮点型
|
||||
String captchaValue = captcha.text();
|
||||
if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() &&
|
||||
captchaValue.contains(SystemConst.SYMBOL_DOT)) {
|
||||
if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains(
|
||||
SystemConst.SYMBOL_DOT)) {
|
||||
captchaValue = captchaValue.split("\\.")[0];
|
||||
}
|
||||
// 保存
|
||||
redisHelper.set(uuid, captchaValue, properties.getLogin().getCaptchaSetting().getExpiration(), TimeUnit.MINUTES);
|
||||
redisHelper.set(uuid, captchaValue, properties.getLogin().getCaptchaSetting().getExpiration(),
|
||||
TimeUnit.MINUTES);
|
||||
// 验证码信息
|
||||
SystemCaptchaVo captchaVo = new SystemCaptchaVo();
|
||||
captchaVo.setUuid(uuid);
|
||||
@@ -48,7 +49,7 @@ public class SystemCaptchaService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证验证码
|
||||
* 验证验证码 -> TestPassed
|
||||
*
|
||||
* @param uuid 验证码uuid
|
||||
* @param inputCode 用户输入的验证码
|
||||
|
||||
+8
-8
@@ -20,14 +20,14 @@ import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.response.SystemUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 数据权限
|
||||
@@ -45,7 +45,7 @@ public class SystemDataService {
|
||||
private SystemRoleDeptService systemRoleDeptService;
|
||||
|
||||
/**
|
||||
* 获取数据权限
|
||||
* 获取数据权限 -> TestPassed
|
||||
*
|
||||
* @param user /
|
||||
* @return /
|
||||
@@ -64,7 +64,7 @@ public class SystemDataService {
|
||||
break;
|
||||
case CUSTOMIZE:
|
||||
// 优化 283ms -> 51 ms
|
||||
List<Long> customDeptIds = this.queryCustomDataPermissionV2ByArgs(deptIds, role.getId());
|
||||
List<Long> customDeptIds = this.queryCustomDataPermissionByArgs(deptIds, role.getId());
|
||||
deptIds.addAll(customDeptIds);
|
||||
break;
|
||||
default:
|
||||
@@ -75,16 +75,16 @@ public class SystemDataService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自定义的数据权限
|
||||
* 获取自定义的数据权限 -> TestPassed
|
||||
*
|
||||
* @param deptIds 部门ID(外部数据)
|
||||
* @param roleId 角色ID
|
||||
* @return 数据权限ID(所有部门ID数据)
|
||||
*/
|
||||
private List<Long> queryCustomDataPermissionV2ByArgs(List<Long> deptIds, Long roleId) {
|
||||
private List<Long> queryCustomDataPermissionByArgs(List<Long> deptIds, Long roleId) {
|
||||
Set<SystemDeptTb> deptList = systemRoleDeptService.listUserDeptByRoleId(roleId);
|
||||
Map<Long, List<SystemDeptTb>> deptPidMap = systemDeptService.listPidNonNull().stream()
|
||||
.collect(Collectors.groupingBy(SystemDeptTb::getPid));
|
||||
Map<Long, List<SystemDeptTb>> deptPidMap =
|
||||
systemDeptService.listPidNonNull().stream().collect(Collectors.groupingBy(SystemDeptTb::getPid));
|
||||
for (SystemDeptTb dept : deptList) {
|
||||
deptIds.add(dept.getId());
|
||||
List<SystemDeptTb> deptChildren = deptPidMap.getOrDefault(dept.getId(), null);
|
||||
|
||||
+19
-11
@@ -36,6 +36,10 @@ import cn.odboy.util.KitClassUtil;
|
||||
import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -47,10 +51,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemDeptService {
|
||||
@@ -63,19 +63,22 @@ public class SystemDeptService {
|
||||
private SystemRoleDeptService systemRoleDeptService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* 创建 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveDept(SystemCreateDeptArgs args) {
|
||||
KitValidUtil.notNull(args);
|
||||
systemDeptMapper.insert(KitBeanUtil.copyToClass(args, SystemDeptTb.class));
|
||||
|
||||
SystemDeptTb record = KitBeanUtil.copyToClass(args, SystemDeptTb.class);
|
||||
systemDeptMapper.insert(record);
|
||||
|
||||
this.updateDeptSubCnt(args.getPid());
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -91,11 +94,17 @@ public class SystemDeptService {
|
||||
}
|
||||
SystemDeptTb dept = systemDeptMapper.selectById(args.getId());
|
||||
args.setId(dept.getId());
|
||||
systemDeptMapper.insertOrUpdate(args);
|
||||
systemDeptMapper.updateById(args);
|
||||
this.updateDeptSubCnt(oldPid);
|
||||
this.updateDeptSubCnt(newPid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门id获取部门信息 -> TestPassed
|
||||
*
|
||||
* @param id 部门id
|
||||
* @return /
|
||||
*/
|
||||
private SystemDeptTb getDeptById(Long id) {
|
||||
return systemDeptMapper.selectById(id);
|
||||
}
|
||||
@@ -118,7 +127,7 @@ public class SystemDeptService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新父节点中子节点数目
|
||||
* 更新父节点中子节点数目 -> TestPassed
|
||||
*
|
||||
* @param deptId /
|
||||
*/
|
||||
@@ -161,8 +170,7 @@ public class SystemDeptService {
|
||||
wrapper.eq(args.getPid() != null, SystemDeptTb::getPid, args.getPid());
|
||||
wrapper.isNull(args.getPidIsNull() != null, SystemDeptTb::getPid);
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemDeptTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemDeptTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
wrapper.orderByAsc(SystemDeptTb::getDeptSort);
|
||||
return systemDeptMapper.selectList(wrapper);
|
||||
|
||||
+26
-24
@@ -31,15 +31,15 @@ import cn.odboy.util.KitValidUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemDictDetailService {
|
||||
@@ -50,7 +50,7 @@ public class SystemDictDetailService {
|
||||
private SystemDictMapper systemDictMapper;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* 创建 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ public class SystemDictDetailService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ public class SystemDictDetailService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 删除 -> TestPassed
|
||||
*
|
||||
* @param id /
|
||||
*/
|
||||
@@ -94,31 +94,30 @@ public class SystemDictDetailService {
|
||||
}
|
||||
}
|
||||
|
||||
private List<SystemDictDetailTb> listDictDetailByDictId(Long dictId) {
|
||||
LambdaQueryWrapper<SystemDictDetailTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDictDetailTb::getDictId, dictId);
|
||||
return systemDictDetailMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* 分页查询 -> TestPassed
|
||||
*
|
||||
* @param args 条件
|
||||
* @param page 分页参数
|
||||
* @return /
|
||||
*/
|
||||
public KitPageResult<SystemDictDetailVo> searchDictDetail(SystemQueryDictDetailArgs args, Page<SystemDictDetailTb> page) {
|
||||
IPage<SystemDictDetailVo> iPage = systemDictDetailMapper.selectPageByArgs(page, args).convert(i -> KitBeanUtil.copyToClass(i, SystemDictDetailVo.class));
|
||||
List<Long> dictIds = iPage.getRecords().stream().map(SystemDictDetailVo::getDictId).collect(Collectors.toList());
|
||||
Map<Long, SystemDictTb> id2ItemMap = systemDictMapper.selectByIds(dictIds).stream().collect(Collectors.toMap(SystemDictTb::getId, i -> i));
|
||||
public KitPageResult<SystemDictDetailVo> searchDictDetail(SystemQueryDictDetailArgs args,
|
||||
Page<SystemDictDetailTb> page) {
|
||||
IPage<SystemDictDetailVo> iPage = systemDictDetailMapper.selectPageByArgs(page, args);
|
||||
List<Long> dictIds =
|
||||
iPage.getRecords().stream().map(SystemDictDetailVo::getDictId).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(dictIds)) {
|
||||
Map<Long, SystemDictTb> id2ItemMap =
|
||||
systemDictMapper.selectByIds(dictIds).stream().collect(Collectors.toMap(SystemDictTb::getId, i -> i));
|
||||
for (SystemDictDetailVo record : iPage.getRecords()) {
|
||||
record.setDict(id2ItemMap.get(record.getDictId()));
|
||||
}
|
||||
}
|
||||
return KitPageUtil.toPage(iPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典名称获取字典详情
|
||||
* 根据字典名称获取字典详情 -> TestPassed
|
||||
*
|
||||
* @param name 字典名称
|
||||
* @return /
|
||||
@@ -127,15 +126,18 @@ public class SystemDictDetailService {
|
||||
if (StrUtil.isBlank(name)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
SystemDictTb systemDictTb = systemDictMapper.getByName(name);
|
||||
if (systemDictTb == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<SystemDictDetailTb> detailTbs = this.listDictDetailByDictId(systemDictTb.getId());
|
||||
List<SystemDictDetailVo> detailVos = KitBeanUtil.copyToList(detailTbs, SystemDictDetailVo.class);
|
||||
List<SystemDictDetailVo> detailVos = systemDictDetailMapper.listDictDetailByName(name);
|
||||
if (CollUtil.isNotEmpty(detailVos)) {
|
||||
SystemDictDetailVo systemDictDetailVo = detailVos.stream().findFirst().orElse(null);
|
||||
if (systemDictDetailVo != null) {
|
||||
SystemDictTb systemDictTb = systemDictMapper.selectById(systemDictDetailVo.getDictId());
|
||||
if (systemDictTb != null) {
|
||||
for (SystemDictDetailVo detailVo : detailVos) {
|
||||
detailVo.setDict(systemDictTb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return detailVos;
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -29,13 +29,13 @@ import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemDictService {
|
||||
@@ -46,7 +46,7 @@ public class SystemDictService {
|
||||
private SystemDictDetailService systemDictDetailService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* 创建 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -57,7 +57,7 @@ public class SystemDictService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ public class SystemDictService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 删除 -> TestPassed
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
@@ -83,7 +83,7 @@ public class SystemDictService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* 分页查询 -> TestPassed
|
||||
*
|
||||
* @param args 条件
|
||||
* @param page 分页参数
|
||||
|
||||
+4
-4
@@ -30,11 +30,11 @@ import cn.odboy.system.dal.model.request.SystemSendEmailArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemEmailConfigMapper;
|
||||
import cn.odboy.util.KitDesEncryptUtil;
|
||||
import cn.odboy.util.KitResourceTemplateUtil;
|
||||
import java.util.Collections;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Collections;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -48,7 +48,7 @@ public class SystemEmailService {
|
||||
private AppProperties properties;
|
||||
|
||||
/**
|
||||
* 更新邮件配置
|
||||
* 更新邮件配置 -> TestPassed
|
||||
*
|
||||
* @param emailConfig 邮箱配置
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ public class SystemEmailService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件
|
||||
* 发送邮件 -> TestPassed
|
||||
*
|
||||
* @param sendEmailRequest 邮件发送的内容
|
||||
*/
|
||||
@@ -109,7 +109,7 @@ public class SystemEmailService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验邮箱验证码
|
||||
* 校验邮箱验证码 -> TestPassed
|
||||
*/
|
||||
public void checkEmailCaptchaV1(SystemCaptchaBizEnum biEnum, String email, String code) {
|
||||
String redisKey = biEnum.getRedisKey() + email;
|
||||
|
||||
+12
-13
@@ -29,13 +29,13 @@ import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemJobService {
|
||||
@@ -46,7 +46,7 @@ public class SystemJobService {
|
||||
private SystemUserJobService systemUserJobService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* 创建 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -61,7 +61,7 @@ public class SystemJobService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
@@ -73,11 +73,11 @@ public class SystemJobService {
|
||||
throw new BadRequestException("职位名称已存在");
|
||||
}
|
||||
args.setId(job.getId());
|
||||
systemJobMapper.insertOrUpdate(args);
|
||||
systemJobMapper.updateById(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 删除 -> TestPassed
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
@@ -89,7 +89,7 @@ public class SystemJobService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* 分页查询 -> TestPassed
|
||||
*
|
||||
* @param args 条件
|
||||
* @param page 分页参数
|
||||
@@ -102,7 +102,7 @@ public class SystemJobService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部数据
|
||||
* 查询全部数据 -> TestPassed
|
||||
*/
|
||||
public List<SystemJobTb> queryJobByArgs(SystemQueryJobArgs args) {
|
||||
LambdaQueryWrapper<SystemJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
@@ -111,7 +111,7 @@ public class SystemJobService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证是否被用户关联
|
||||
* 验证是否被用户关联 -> TestPassed
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
@@ -132,8 +132,7 @@ public class SystemJobService {
|
||||
wrapper.like(StrUtil.isNotBlank(args.getName()), SystemJobTb::getName, args.getName());
|
||||
wrapper.eq(args.getEnabled() != null, SystemJobTb::getEnabled, args.getEnabled());
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemJobTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemJobTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByDesc(SystemJobTb::getJobSort, SystemJobTb::getId);
|
||||
|
||||
+10
-10
@@ -36,14 +36,14 @@ import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SystemLocalStorageService {
|
||||
@@ -56,7 +56,7 @@ public class SystemLocalStorageService {
|
||||
private AppProperties properties;
|
||||
|
||||
/**
|
||||
* 上传
|
||||
* 上传 -> TestPassed
|
||||
*
|
||||
* @param name 文件名称
|
||||
* @param multipartFile 文件
|
||||
@@ -94,7 +94,7 @@ public class SystemLocalStorageService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* 编辑 -> TestPassed
|
||||
*
|
||||
* @param args 文件信息
|
||||
*/
|
||||
@@ -106,7 +106,7 @@ public class SystemLocalStorageService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* 多选删除 -> TestPassed
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ public class SystemLocalStorageService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* 分页查询 -> TestPassed
|
||||
*
|
||||
* @param args 条件
|
||||
* @param page 分页参数
|
||||
@@ -159,7 +159,6 @@ public class SystemLocalStorageService {
|
||||
return systemLocalStorageMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
|
||||
public SystemLocalStorageTb uploadPictureV1(MultipartFile file) {
|
||||
// 判断文件是否为图片
|
||||
String suffix = KitFileUtil.getSuffix(file.getOriginalFilename());
|
||||
@@ -171,7 +170,8 @@ public class SystemLocalStorageService {
|
||||
|
||||
public void exportLocalStorageXlsx(HttpServletResponse response, SystemQueryStorageArgs args) {
|
||||
List<SystemLocalStorageTb> systemLocalStorageTbs = this.queryLocalStorageByArgs(args);
|
||||
List<SystemLocalStorageExportRowVo> rowVos = KitBeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class);
|
||||
List<SystemLocalStorageExportRowVo> rowVos =
|
||||
KitBeanUtil.copyToList(systemLocalStorageTbs, SystemLocalStorageExportRowVo.class);
|
||||
KitExcelExporter.exportSimple(response, "文件上传记录数据", SystemLocalStorageExportRowVo.class, rowVos);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-13
@@ -36,6 +36,10 @@ import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -45,15 +49,10 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemMenuService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private SystemMenuMapper systemMenuMapper;
|
||||
@Autowired
|
||||
@@ -80,8 +79,8 @@ public class SystemMenuService {
|
||||
args.setPid(null);
|
||||
}
|
||||
if (args.getIFrame()) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) ||
|
||||
args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath()
|
||||
.toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) {
|
||||
throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -104,8 +103,8 @@ public class SystemMenuService {
|
||||
}
|
||||
SystemMenuTb menu = systemMenuMapper.selectById(args.getId());
|
||||
if (args.getIFrame()) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) ||
|
||||
args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTP) || args.getPath()
|
||||
.toLowerCase().startsWith(SystemTransferProtocolConst.PREFIX_HTTPS))) {
|
||||
throw new BadRequestException(SystemTransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -403,13 +402,11 @@ public class SystemMenuService {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.isNull(args.getPidIsNull() != null, SystemMenuTb::getPid);
|
||||
wrapper.eq(args.getPid() != null, SystemMenuTb::getPid, args.getPid());
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()),
|
||||
c -> c.like(SystemMenuTb::getTitle, args.getBlurry()).or()
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemMenuTb::getTitle, args.getBlurry()).or()
|
||||
.like(SystemMenuTb::getComponentName, args.getBlurry()).or()
|
||||
.like(SystemMenuTb::getPermission, args.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemMenuTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemMenuTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
wrapper.orderByAsc(SystemMenuTb::getMenuSort);
|
||||
return systemMenuMapper.selectList(wrapper);
|
||||
|
||||
+13
-13
@@ -20,13 +20,6 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitIPUtil;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import oshi.SystemInfo;
|
||||
@@ -39,6 +32,13 @@ import oshi.software.os.OSFileStore;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
import oshi.util.FormatUtil;
|
||||
import oshi.util.Util;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -47,7 +47,7 @@ public class SystemMonitorService {
|
||||
private final DecimalFormat df = new DecimalFormat("0.00");
|
||||
|
||||
/**
|
||||
* 查询服务器监控信息
|
||||
* 查询服务器监控信息 -> TestPassed
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@@ -101,7 +101,7 @@ public class SystemMonitorService {
|
||||
diskInfo.put("available", KitFileUtil.getSize(available));
|
||||
diskInfo.put("used", KitFileUtil.getSize(used));
|
||||
if (total != 0) {
|
||||
diskInfo.put("usageRate", df.format(used / (double) total * 100));
|
||||
diskInfo.put("usageRate", df.format(used / (double)total * 100));
|
||||
} else {
|
||||
diskInfo.put("usageRate", 0);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class SystemMonitorService {
|
||||
if (used == 0) {
|
||||
swapInfo.put("usageRate", 0);
|
||||
} else {
|
||||
swapInfo.put("usageRate", df.format(used / (double) total * 100));
|
||||
swapInfo.put("usageRate", df.format(used / (double)total * 100));
|
||||
}
|
||||
return swapInfo;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class SystemMonitorService {
|
||||
memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable()));
|
||||
memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable()));
|
||||
memoryInfo.put("usageRate",
|
||||
df.format((memory.getTotal() - memory.getAvailable()) / (double) memory.getTotal() * 100));
|
||||
df.format((memory.getTotal() - memory.getAvailable()) / (double)memory.getTotal() * 100));
|
||||
return memoryInfo;
|
||||
}
|
||||
|
||||
@@ -183,8 +183,8 @@ public class SystemMonitorService {
|
||||
ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];
|
||||
long irq =
|
||||
ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];
|
||||
long softIrq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] -
|
||||
prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
|
||||
long softIrq =
|
||||
ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
|
||||
long steal =
|
||||
ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];
|
||||
long totalCpu = user + nice + sys + idle + ioWait + irq + softIrq + steal;
|
||||
|
||||
+3
@@ -17,6 +17,9 @@ public class SystemOperationLogService {
|
||||
@Autowired
|
||||
private SystemOperationLogMapper systemOperationLogMapper;
|
||||
|
||||
/**
|
||||
* 查询用户操作日志
|
||||
*/
|
||||
public IPage<SystemOperationLogTb> searchUserLog(KitPageArgs<SystemQueryOperationLogArgs> pageArgs) {
|
||||
LambdaQueryWrapper<SystemOperationLogTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemOperationLogTb::getUsername, KitSecurityHelper.getCurrentUsername());
|
||||
|
||||
+2
-2
@@ -21,9 +21,9 @@ import cn.odboy.system.dal.model.request.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.dal.model.response.SystemOssStorageVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
+13
-9
@@ -38,15 +38,15 @@ import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.quartz.CronExpression;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemQuartzJobService {
|
||||
@@ -203,13 +203,15 @@ public class SystemQuartzJobService {
|
||||
* @param page 分页参数
|
||||
* @return /
|
||||
*/
|
||||
public KitPageResult<SystemQuartzJobTb> searchQuartzJobByArgs(SystemQueryQuartzJobArgs args, Page<SystemQuartzJobTb> page) {
|
||||
public KitPageResult<SystemQuartzJobTb> searchQuartzJobByArgs(SystemQueryQuartzJobArgs args,
|
||||
Page<SystemQuartzJobTb> page) {
|
||||
LambdaQueryWrapper<SystemQuartzJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
this.injectQuartzJobQueryParams(args, wrapper);
|
||||
return KitPageUtil.toPage(systemQuartzJobMapper.selectPage(page, wrapper));
|
||||
}
|
||||
|
||||
private void injectQuartzJobQueryParams(SystemQueryQuartzJobArgs args, LambdaQueryWrapper<SystemQuartzJobTb> wrapper) {
|
||||
private void injectQuartzJobQueryParams(SystemQueryQuartzJobArgs args,
|
||||
LambdaQueryWrapper<SystemQuartzJobTb> wrapper) {
|
||||
KitValidUtil.notNull(args);
|
||||
wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzJobTb::getJobName, args.getJobName());
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
@@ -218,12 +220,14 @@ public class SystemQuartzJobService {
|
||||
wrapper.orderByDesc(SystemQuartzJobTb::getId);
|
||||
}
|
||||
|
||||
private void injectQuartzLogQueryParams(SystemQueryQuartzJobArgs args, LambdaQueryWrapper<SystemQuartzLogTb> wrapper) {
|
||||
private void injectQuartzLogQueryParams(SystemQueryQuartzJobArgs args,
|
||||
LambdaQueryWrapper<SystemQuartzLogTb> wrapper) {
|
||||
if (args != null) {
|
||||
wrapper.like(StrUtil.isNotBlank(args.getJobName()), SystemQuartzLogTb::getJobName, args.getJobName());
|
||||
wrapper.eq(args.getIsSuccess() != null, SystemQuartzLogTb::getIsSuccess, args.getIsSuccess());
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemQuartzLogTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
wrapper.between(SystemQuartzLogTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByDesc(SystemQuartzLogTb::getId);
|
||||
|
||||
+3
-3
@@ -21,12 +21,12 @@ import cn.odboy.system.dal.dataobject.SystemRoleDeptTb;
|
||||
import cn.odboy.system.dal.mysql.SystemDeptMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleDeptMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemRoleDeptService {
|
||||
|
||||
+3
-3
@@ -23,14 +23,14 @@ import cn.odboy.system.dal.mysql.SystemMenuMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMenuMapper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemRoleMenuService {
|
||||
|
||||
+10
-14
@@ -36,16 +36,16 @@ import cn.odboy.util.KitValidUtil;
|
||||
import cn.odboy.util.xlsx.KitExcelExporter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemRoleService {
|
||||
@@ -146,7 +146,8 @@ public class SystemRoleService {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRoleByIds(Set<Long> ids) {
|
||||
List<Integer> roleLevels = systemRoleMapper.selectByIds(ids).stream().map(SystemRoleTb::getLevel).distinct().collect(Collectors.toList());
|
||||
List<Integer> roleLevels = systemRoleMapper.selectByIds(ids).stream().map(SystemRoleTb::getLevel).distinct()
|
||||
.collect(Collectors.toList());
|
||||
for (Integer roleLevel : roleLevels) {
|
||||
checkRoleLevels(roleLevel);
|
||||
}
|
||||
@@ -179,12 +180,10 @@ public class SystemRoleService {
|
||||
KitValidUtil.notNull(args);
|
||||
// 查询角色基本信息
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()),
|
||||
c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
.like(SystemRoleTb::getDescription, args.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
wrapper.orderByAsc(SystemRoleTb::getLevel);
|
||||
List<SystemRoleTb> roles;
|
||||
@@ -210,7 +209,6 @@ public class SystemRoleService {
|
||||
return KitPageUtil.toPage(roles, total);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户权限信息
|
||||
*
|
||||
@@ -244,12 +242,10 @@ public class SystemRoleService {
|
||||
public Long countRoleByArgs(SystemQueryRoleArgs args) {
|
||||
KitValidUtil.notNull(args);
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()),
|
||||
c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemRoleTb::getName, args.getBlurry()).or()
|
||||
.like(SystemRoleTb::getDescription, args.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(args.getCreateTime()) && args.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0),
|
||||
args.getCreateTime().get(1));
|
||||
wrapper.between(SystemRoleTb::getCreateTime, args.getCreateTime().get(0), args.getCreateTime().get(1));
|
||||
}
|
||||
return systemRoleMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,9 +3,9 @@ package cn.odboy.system.service;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.mysql.SystemUserMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemUserDeptService {
|
||||
|
||||
+3
-3
@@ -20,12 +20,12 @@ import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserJobTb;
|
||||
import cn.odboy.system.dal.mysql.SystemUserJobMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class SystemUserJobService {
|
||||
|
||||
+11
-12
@@ -28,16 +28,15 @@ import cn.odboy.system.dal.mysql.SystemUserRoleMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitBeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemUserRoleService {
|
||||
@@ -116,16 +115,16 @@ public class SystemUserRoleService {
|
||||
// 最小权限
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
List<Long> roleIds = roles.stream().map(SystemRoleTb::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
List<Long> roleIds =
|
||||
roles.stream().map(SystemRoleTb::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(roleIds)) {
|
||||
// 最小权限
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
List<Integer> roleLevels = systemRoleMapper.selectList(new LambdaQueryWrapper<SystemRoleTb>()
|
||||
.select(SystemRoleTb::getLevel)
|
||||
.isNotNull(SystemRoleTb::getLevel)
|
||||
.in(SystemRoleTb::getId, roleIds)
|
||||
).stream().map(SystemRoleTb::getLevel).distinct().collect(Collectors.toList());
|
||||
List<Integer> roleLevels = systemRoleMapper.selectList(
|
||||
new LambdaQueryWrapper<SystemRoleTb>().select(SystemRoleTb::getLevel).isNotNull(SystemRoleTb::getLevel)
|
||||
.in(SystemRoleTb::getId, roleIds)).stream().map(SystemRoleTb::getLevel).distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(roleLevels)) {
|
||||
// 最小权限
|
||||
return Integer.MAX_VALUE;
|
||||
@@ -140,8 +139,8 @@ public class SystemUserRoleService {
|
||||
*/
|
||||
public void checkLevel(SystemUserVo args) {
|
||||
Integer currentLevel = Collections.min(
|
||||
this.queryRoleVoByUsersId(KitSecurityHelper.getCurrentUserId()).stream()
|
||||
.map(SystemRoleVo::getLevel).collect(Collectors.toList()));
|
||||
this.queryRoleVoByUsersId(KitSecurityHelper.getCurrentUserId()).stream().map(SystemRoleVo::getLevel)
|
||||
.collect(Collectors.toList()));
|
||||
Integer optLevel = this.getDeptLevelByRoles(args.getRoles());
|
||||
if (currentLevel > optLevel) {
|
||||
throw new BadRequestException("角色权限不足");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user