| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- package com.ydtech.modules.admin.model;
- import cn.afterturn.easypoi.excel.annotation.Excel;
- import com.baomidou.mybatisplus.annotation.FieldFill;
- import com.baomidou.mybatisplus.annotation.TableField;
- import com.baomidou.mybatisplus.annotation.TableId;
- import com.baomidou.mybatisplus.annotation.TableName;
- import com.fasterxml.jackson.annotation.JsonFormat;
- import com.ydtech.core.page.HttpResult;
- import com.ydtech.exception.SystemException;
- import com.ydtech.modules.base.model.BaseEntity;
- import com.ydtech.security.utils.PasswordUtils;
- import io.swagger.annotations.ApiModel;
- import io.swagger.annotations.ApiModelProperty;
- import lombok.Data;
- import org.apache.ibatis.annotations.Select;
- import springfox.documentation.annotations.ApiIgnore;
- import javax.validation.constraints.NotBlank;
- import javax.validation.constraints.Size;
- import java.util.Date;
- /**
- * 用户
- *
- * @TableName sys_user
- */
- @TableName(value = "sys_user")
- @Data
- @ApiModel
- public class SysUser extends BaseEntity {
- @TableField(exist = false)
- private static final long serialVersionUID = 1L;
- /**
- * 编号
- */
- @ApiModelProperty(value = "用户ID")
- @TableId(value = "id")
- private String id;
- /**
- * 姓名
- */
- @Excel(name = "姓名")
- @ApiModelProperty(value = "姓名")
- @NotBlank(message = "姓名不能为空")
- @Size(min = 0, max = 30, message = "姓名长度不能超过30个字符")
- @TableField(value = "name")
- private String name;
- /**
- * 密码
- */
- @Excel(name = "密码")
- @ApiModelProperty(value = "密码")
- @TableField(value = "password")
- private String password;
- /**
- * 盐
- */
- @TableField(value = "salt")
- private String salt;
- /**
- * 手机号
- */
- @Excel(name = "手机号")
- @ApiModelProperty(value = "手机号")
- @NotBlank(message = "手机号不能为空")
- @TableField(value = "mobile")
- private String mobile;
- /**
- * 状态 1:正常 0:离司 2:新注册
- */
- @ApiModelProperty(value = "状态 1:正常 0:删除 2:新注册 3:审批不通过")
- @TableField(value = "status")
- private Integer status;
- /**
- * 机构ID
- */
- @ApiModelProperty(value = "机构ID")
- @NotBlank(message = "机构不能为空")
- @TableField(value = "dept_id")
- private String deptId;
- /**
- * 微信id
- */
- @TableField(value = "openid")
- private String openid;
- /**
- * 审批意见
- */
- @ApiModelProperty(value = "审批意见")
- @TableField(value = "approval_opinion")
- private String approvalOpinion;
- @ApiModelProperty(value = "身份证号")
- @TableField(value = "identity")
- private String identity;
- //------------------
- /**
- * 角色ID
- */
- @ApiModelProperty(value = "角色ID")
- @TableField(exist = false)
- private String roleId;
- /**
- * 角色名称
- */
- @Excel(name = "角色")
- @ApiModelProperty(value = "角色名称")
- @TableField(exist = false)
- private String roleName;
- /**
- * 机构名称
- */
- @ApiModelProperty(value = "机构名称")
- @TableField(exist = false)
- private String deptName;
- @TableField(exist = false)
- @Excel(name = "状态")
- private String excelStatus;
- @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
- @Excel(name = "离职时间")
- @TableField(value = "logout_time")
- private Date logoutTime;
- @TableField(exist = false)
- @Excel(name = "推荐人ID")
- private String referrerId;
- @TableField(exist = false)
- @Excel(name = "推荐人名称")
- private String referrerName;
- /**
- * 验证用户
- *
- * @author: lig
- * @date: 2023年07月03日 0003
- */
- @ApiIgnore
- public static void verifyUser(SysUser user){
- // 账号不存在、密码错误
- if (user == null) {
- throw new SystemException("账号不存在");
- }
- // 账号锁定
- if (user.getStatus() == 0) {
- throw new SystemException("账号已被锁定,请联系管理员");
- }
- // // 新注册用户需要审核
- // if (user.getStatus() == 2) {
- // throw new SystemException("新注册用户需要审核,请联系管理员");
- // }
- // 新注册用户审核不通过
- if (user.getStatus() == 3) {
- throw new SystemException("新注册用户审核不通过,请联系管理员");
- }
- }
- }
|