UserDto.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. using FluentValidation;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. using System.Threading.Tasks;
  8. namespace OASystem.Domain.Dtos.System
  9. {
  10. /// <summary>
  11. /// 员工表查询dto
  12. /// </summary>
  13. public class UserDto : DtoBase
  14. {
  15. /// <summary>
  16. /// 公司Id
  17. /// </summary>
  18. public int CompanyId { get; set; }
  19. /// <summary>
  20. /// 部门Id
  21. /// </summary>
  22. public int DepId { get;set; }
  23. /// <summary>
  24. /// 岗位Id
  25. /// </summary>
  26. public int JobPostId { get; set; }
  27. }
  28. /// <summary>
  29. /// 修改用户信息
  30. /// </summary>
  31. public class EditUserDto
  32. {
  33. /// <summary>
  34. /// 当前用户ID
  35. /// </summary>
  36. public int CurrUserId { get; set; }
  37. /// <summary>
  38. /// 用户Id
  39. /// </summary>
  40. public int Id { get; set; }
  41. /// <summary>
  42. /// 工号
  43. /// </summary>
  44. public string Number { get; set; }
  45. /// <summary>
  46. /// 公司Id
  47. /// </summary>
  48. public int CompanyId { get; set; }
  49. /// <summary>
  50. /// 部门Id
  51. /// </summary>
  52. public int DepId { get; set; }
  53. /// <summary>
  54. /// 岗位Id
  55. /// </summary>
  56. public int JobPostId { get; set; }
  57. /// <summary>
  58. /// 分机号
  59. /// </summary>
  60. public string Ext { get; set; }
  61. /// <summary>
  62. /// 试用期
  63. /// </summary>
  64. public string UsePeriod { get; set; }
  65. /// <summary>
  66. /// 人事审核 0未审核(初始状态) 1 已通过(可用)2已拒绝
  67. /// </summary>
  68. //public int HrAudit { get; set; }
  69. }
  70. /// <summary>
  71. /// 修改个人信息
  72. /// </summary>
  73. public class EditMyUserDto
  74. {
  75. /// <summary>
  76. /// 用户Id
  77. /// </summary>
  78. public int Id { get; set; }
  79. /// <summary>
  80. /// 中文姓名
  81. /// </summary>
  82. public string CnName { get; set; }
  83. /// <summary>
  84. /// 英文姓名
  85. /// </summary>
  86. public string EnName { get; set; }
  87. /// <summary>
  88. /// 性别0 男1 女 2 未设置
  89. /// </summary>
  90. public int Sex { get; set; }
  91. private string phone;
  92. /// <summary>
  93. /// 手机号
  94. /// </summary>
  95. public string Phone
  96. {
  97. get
  98. {
  99. return phone;
  100. }
  101. set
  102. {
  103. if (Regex.IsMatch(value, @"^[1]+[2,3,4,5,6,7,8,9]+\d{9}"))
  104. {
  105. phone = value;
  106. }
  107. else
  108. {
  109. phone = "";
  110. }
  111. }
  112. }
  113. private string urgentPhone;
  114. /// <summary>
  115. /// 紧急联系人 手机号
  116. /// </summary>
  117. public string UrgentPhone
  118. {
  119. get { return urgentPhone; }
  120. set
  121. {
  122. if (Regex.IsMatch(value, @"^[1]+[2,3,4,5,6,7,8,9]+\d{9}"))
  123. {
  124. urgentPhone = value;
  125. }
  126. else
  127. {
  128. urgentPhone = "";
  129. }
  130. }
  131. }
  132. private string email;
  133. /// <summary>
  134. /// 邮箱
  135. /// </summary>
  136. public string Email
  137. {
  138. get { return email; }
  139. set
  140. {
  141. if (Regex.IsMatch(value, @"^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(com|cn|net)$"))
  142. {
  143. email = value;
  144. }
  145. else
  146. {
  147. email = "";
  148. }
  149. }
  150. }
  151. /// <summary>
  152. /// 住址
  153. /// </summary>
  154. public string Address { get; set; }
  155. /// <summary>
  156. /// 入职时间
  157. /// </summary>
  158. public DateTime Edate { get; set; }
  159. /// <summary>
  160. /// 生日
  161. /// </summary>
  162. public DateTime Birthday { get; set; }
  163. /// <summary>
  164. /// 身份证号码
  165. /// </summary>
  166. public string IDCard { get; set; }
  167. /// <summary>
  168. /// 毕业学校
  169. /// </summary>
  170. public string GraduateInstitutions { get; set; }
  171. /// <summary>
  172. /// 专业
  173. /// </summary>
  174. public string Professional { get; set; }
  175. /// <summary>
  176. /// 学历
  177. /// </summary>
  178. public int Education { get; set; }
  179. /// <summary>
  180. /// 学历类型
  181. /// </summary>
  182. public int TheOrAdultEducation { get; set; }
  183. /// <summary>
  184. /// 婚姻状态
  185. /// </summary>
  186. public string MaritalStatus { get; set; }
  187. /// <summary>
  188. /// 家庭地址
  189. /// </summary>
  190. public string HomeAddress { get; set; }
  191. /// <summary>
  192. /// 工作经历
  193. /// </summary>
  194. public string WorkExperience { get; set; }
  195. /// <summary>
  196. /// 证书上传
  197. /// </summary>
  198. public string Certificate { get; set; }
  199. }
  200. /// <summary>
  201. /// 删除用户信息
  202. /// 即为离职
  203. /// </summary>
  204. public class UserDelDto : PortDtoBase
  205. {
  206. /// <summary>
  207. /// 数据Id
  208. /// </summary>
  209. public int Id { get; set; }
  210. /// <summary>
  211. /// 操作人Id
  212. /// </summary>
  213. public int OperateUserId { get; set; }
  214. }
  215. public class PersonnelAuditDto
  216. {
  217. public int UserId { get; set; }
  218. /// <summary>
  219. /// 数据Id
  220. /// </summary>
  221. public int Id { get; set; }
  222. /// <summary>
  223. /// 审核是否通过 1:通过 2拒绝
  224. /// </summary>
  225. public int IsAudit { get; set; }
  226. }
  227. public class QueryUserByDepartDto
  228. {
  229. public int DepartId { get; set; }
  230. }
  231. public class UserInfoDto : PortDtoBase
  232. {
  233. public int Id { get; set; }
  234. }
  235. public class EditUserInfoDto
  236. {
  237. public int CurrUserId { get; set; }
  238. public int Id { get; set; }
  239. /// <summary>
  240. /// 中文姓名
  241. /// </summary>
  242. public string CnName { get; set; }
  243. /// <summary>
  244. /// 英文姓名
  245. /// </summary>
  246. public string EnName { get; set; }
  247. /// <summary>
  248. /// 工号
  249. /// </summary>
  250. public string Number { get; set; }
  251. /// <summary>
  252. /// 公司Id
  253. /// </summary>
  254. public int CompanyId { get; set; }
  255. /// <summary>
  256. /// 部门Id
  257. /// </summary>
  258. public int DepId { get; set; }
  259. /// <summary>
  260. /// 岗位Id
  261. /// </summary>
  262. public int JobPostId { get; set; }
  263. /// <summary>
  264. /// 密码
  265. /// </summary>
  266. public string Password { get; set; }
  267. /// <summary>
  268. /// 确认密码
  269. /// </summary>
  270. public string ComfirmPassword { get; set; }
  271. /// <summary>
  272. /// 性别0 男 1 女 2 未设置
  273. /// </summary>
  274. public int Sex { get; set; }
  275. /// <summary>
  276. /// 分机号
  277. /// </summary>
  278. public string Ext { get; set; }
  279. /// <summary>
  280. /// 手机号
  281. /// </summary>
  282. public string Phone { get; set; }
  283. /// <summary>
  284. /// 紧急联系人 手机号
  285. /// </summary>
  286. public string UrgentPhone { get; set; }
  287. /// <summary>
  288. /// 邮箱
  289. /// </summary>
  290. public string Email { get; set; }
  291. /// <summary>
  292. /// 住址
  293. /// </summary>
  294. public string Address { get; set; }
  295. /// <summary>
  296. /// 入职时间
  297. /// </summary>
  298. public string? Edate { get; set; } = null;
  299. ///// <summary>
  300. ///// 离职时间
  301. ///// </summary>
  302. //public DateTime Rdate { get; set; }
  303. ///// <summary>
  304. ///// 工龄
  305. ///// </summary>
  306. //public int Seniority { get; set; }
  307. ///// <summary>
  308. ///// 生日
  309. ///// </summary>
  310. //public string? Birthday { get; set; } = null;
  311. /// <summary>
  312. /// 身份证号码
  313. /// </summary>
  314. public string IDCard { get; set; }
  315. ///// <summary>
  316. ///// 开始工作时
  317. ///// </summary>
  318. //public string? StartWorkDate { get; set; }= null;
  319. /// <summary>
  320. /// 毕业学校
  321. /// </summary>
  322. public string GraduateInstitutions { get; set; }
  323. /// <summary>
  324. /// 专业
  325. /// </summary>
  326. public string Professional { get; set; }
  327. /// <summary>
  328. /// 学历
  329. /// 0 未设置 1 小学、2 初中、3 高中、4 专科、5 本科、6 研究生
  330. /// </summary>
  331. public int Education { get; set; }
  332. /// <summary>
  333. /// 学历类型
  334. ///0 未设置 1 成教 2 统招 3 留学
  335. /// </summary>
  336. public int TheOrAdultEducation { get; set; }
  337. /// <summary>
  338. /// 婚姻状态
  339. /// </summary>
  340. public string MaritalStatus { get; set; }
  341. /// <summary>
  342. /// 家庭地址
  343. /// </summary>
  344. public string HomeAddress { get; set; }
  345. /// <summary>
  346. /// 试用期
  347. /// </summary>
  348. public string UsePeriod { get; set; }
  349. /// <summary>
  350. /// 工作经历
  351. /// </summary>
  352. public string WorkExperience { get; set; }
  353. /// <summary>
  354. /// 证书上传
  355. /// </summary>
  356. public string Certificate { get; set; }
  357. ///// <summary>
  358. ///// 企微Id
  359. ///// </summary>
  360. //public string QiyeChatUserId { get; set; }
  361. /// <summary>
  362. /// 备注
  363. /// </summary>
  364. public string Remark { get; set; }
  365. }
  366. public class EditUserInfoDtoValidator : AbstractValidator<EditUserInfoDto>
  367. {
  368. public EditUserInfoDtoValidator()
  369. {
  370. //RuleFor(x => x.CurrUserId).LessThan(1).WithMessage("暂无修改权限!");
  371. RuleFor(x => x.CnName).NotEmpty().WithMessage("姓名不能为空!");
  372. RuleFor(x => x.EnName).NotEmpty().WithMessage("英文名不能为空!");
  373. RuleFor(x => x.Number).NotEmpty().WithMessage("工号不能为空!");
  374. RuleFor(x => x.Password).NotEmpty().WithMessage("密码不能为空!")
  375. .Length(6, 20).WithMessage("密码长度必须在6到20个字符之间!");
  376. RuleFor(x => x.ComfirmPassword).NotEmpty().WithMessage("确认密码不能为空!")
  377. .Equal(x => x.Password).WithMessage("两次密码输入不一致!");
  378. RuleFor(x => x.Sex).InclusiveBetween(0,2).WithMessage("性别:0 男;1 女;2 未设置;");
  379. RuleFor(x => x.Phone).NotEmpty().WithMessage("手机号不能为空!");
  380. RuleFor(x => x.UrgentPhone).NotEmpty().WithMessage("手机号不能为空!");
  381. RuleFor(x => x.Email).NotEmpty().WithMessage("邮箱不能为空!");
  382. RuleFor(x => x.Address).NotEmpty().WithMessage("住址不能为空!");
  383. //RuleFor(x => x.Edate).NotEmpty().WithMessage("入职时间不能为空!");
  384. //RuleFor(x => x.Birthday).NotEmpty().WithMessage("生日不能为空!");
  385. RuleFor(x => x.IDCard).NotEmpty().WithMessage("身份证号码不能为空!");
  386. RuleFor(x => x.TheOrAdultEducation).InclusiveBetween(0, 3).WithMessage("学历类型 0 未设置 1 成教 2 统招 3 留学");
  387. RuleFor(x => x.Education).InclusiveBetween(0, 6).WithMessage("学历 0 未设置 1 小学、2 初中、3 高中、4 专科、5 本科、6 研究生");
  388. }
  389. }
  390. }