SysUser.java 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. package com.ydtech.modules.admin.model;
  2. import cn.afterturn.easypoi.excel.annotation.Excel;
  3. import com.baomidou.mybatisplus.annotation.TableField;
  4. import com.baomidou.mybatisplus.annotation.TableId;
  5. import com.baomidou.mybatisplus.annotation.TableName;
  6. import com.fasterxml.jackson.annotation.JsonFormat;
  7. import com.ydtech.exception.SystemException;
  8. import com.ydtech.modules.base.model.BaseEntity;
  9. import io.swagger.annotations.ApiModel;
  10. import io.swagger.annotations.ApiModelProperty;
  11. import lombok.Data;
  12. import springfox.documentation.annotations.ApiIgnore;
  13. import javax.validation.constraints.NotBlank;
  14. import javax.validation.constraints.Size;
  15. import java.util.Date;
  16. /**
  17. * 用户
  18. *
  19. * @TableName sys_user
  20. */
  21. @TableName(value = "sys_user")
  22. @Data
  23. @ApiModel
  24. public class SysUser extends BaseEntity {
  25. @TableField(exist = false)
  26. private static final long serialVersionUID = 1L;
  27. /**
  28. * 编号
  29. */
  30. @ApiModelProperty(value = "用户ID")
  31. @TableId(value = "id")
  32. private String id;
  33. @ApiModelProperty(value = "头像")
  34. @TableField(value = "head_sculpture")
  35. private String headSculpture;
  36. /**
  37. * 姓名
  38. */
  39. @Excel(name = "姓名")
  40. @ApiModelProperty(value = "姓名")
  41. @NotBlank(message = "姓名不能为空")
  42. @Size(min = 0, max = 30, message = "姓名长度不能超过30个字符")
  43. @TableField(value = "name")
  44. private String name;
  45. /**
  46. * 密码
  47. */
  48. @Excel(name = "密码")
  49. @ApiModelProperty(value = "密码")
  50. @TableField(value = "password")
  51. private String password;
  52. /**
  53. * 盐
  54. */
  55. @TableField(value = "salt")
  56. private String salt;
  57. /**
  58. * 手机号
  59. */
  60. @Excel(name = "手机号")
  61. @ApiModelProperty(value = "手机号")
  62. @NotBlank(message = "手机号不能为空")
  63. @TableField(value = "mobile")
  64. private String mobile;
  65. /**
  66. * 状态 1:正常 0:离司 2:新注册
  67. */
  68. @ApiModelProperty(value = "状态 1:正常 0:删除 2:新注册 3:审批不通过")
  69. @TableField(value = "status")
  70. private Integer status;
  71. /**
  72. * 机构ID
  73. */
  74. @ApiModelProperty(value = "机构ID")
  75. @NotBlank(message = "机构不能为空")
  76. @TableField(value = "dept_id")
  77. private String deptId;
  78. /**
  79. * 微信id
  80. */
  81. @TableField(value = "openid")
  82. private String openid;
  83. /**
  84. * 审批意见
  85. */
  86. @ApiModelProperty(value = "审批意见")
  87. @TableField(value = "approval_opinion")
  88. private String approvalOpinion;
  89. @ApiModelProperty(value = "身份证号")
  90. @TableField(value = "identity")
  91. private String identity;
  92. //------------------
  93. @ApiModelProperty(value = "是否有闪电增员权限")
  94. @TableField(exist = false)
  95. private Integer isHasAddUser;
  96. /**
  97. * 角色ID
  98. */
  99. @ApiModelProperty(value = "角色ID")
  100. @TableField(exist = false)
  101. private String roleId;
  102. /**
  103. * 角色名称
  104. */
  105. @Excel(name = "角色")
  106. @ApiModelProperty(value = "角色名称")
  107. @TableField(exist = false)
  108. private String roleName;
  109. /**
  110. * 机构名称
  111. */
  112. @ApiModelProperty(value = "机构名称")
  113. @TableField(exist = false)
  114. private String deptName;
  115. @TableField(exist = false)
  116. @Excel(name = "状态")
  117. private String excelStatus;
  118. @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
  119. @Excel(name = "离职时间")
  120. @TableField(value = "logout_time")
  121. private Date logoutTime;
  122. @Excel(name = "出单员归属业务员")
  123. @TableField(value = "operatorCode")
  124. private String operatorCode;
  125. @TableField(exist = false)
  126. @Excel(name = "推荐人ID")
  127. private String referrerId;
  128. @TableField(exist = false)
  129. @Excel(name = "推荐人名称")
  130. private String referrerName;
  131. @TableField(exist = false)
  132. @ApiModelProperty("机构来源")
  133. private String managementSource;
  134. @TableField(value = "position_id")
  135. @ApiModelProperty("岗位id")
  136. private String positionId;
  137. @TableField(value = "position_name")
  138. @ApiModelProperty("岗位名称")
  139. private String positionName;
  140. /**
  141. * 验证用户
  142. *
  143. * @author: lig
  144. * @date: 2023年07月03日 0003
  145. */
  146. @ApiIgnore
  147. public static void verifyUser(SysUser user) {
  148. // 账号不存在、密码错误
  149. if (user == null) {
  150. throw new SystemException("账号不存在");
  151. }
  152. // 账号锁定
  153. if (user.getStatus() == 0) {
  154. throw new SystemException("账号已被锁定,请联系管理员");
  155. }
  156. // // 新注册用户需要审核
  157. // if (user.getStatus() == 2) {
  158. // throw new SystemException("新注册用户需要审核,请联系管理员");
  159. // }
  160. // 新注册用户审核不通过
  161. if (user.getStatus() == 3) {
  162. throw new SystemException("新注册用户审核不通过,请联系管理员");
  163. }
  164. }
  165. }