|
@@ -2,6 +2,7 @@ package com.rf.psychological.user.rest;
|
|
|
|
|
|
import cn.hutool.core.date.DateUnit;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.lang.Validator;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.rf.psychological.base.rest.BaseController;
|
|
|
import com.rf.psychological.enums.UserRole;
|
|
@@ -354,13 +355,17 @@ public class UserController extends BaseController {
|
|
|
UserEntity userInfo = this.userService.findPhoneAndInstitutionNoAndRoleType(userEntity.getPhone(), userEntity.getInstitutionNo(),userEntity.getRoleType());
|
|
|
if (userInfo == null) {
|
|
|
String idCardStr = userEntity.getPhone();
|
|
|
+ if (!Validator.isCitizenId(idCardStr)){
|
|
|
+
|
|
|
+ return fail("账号不符合身份证规则");
|
|
|
+
|
|
|
+ }
|
|
|
userEntity.setPassword(DigestUtils.md5DigestAsHex(idCardStr.substring(12).getBytes()));
|
|
|
userEntity.setUserStatus(Constant.USER_STATUS_NORMAL);
|
|
|
userEntity.setRoleType(UserRole.COMMON.getType());
|
|
|
userEntity.setBirthday(idCardStr.substring(6,10)+"-"+idCardStr.substring(10,12)+"-"+idCardStr.substring(12,14));
|
|
|
userEntity.setIdCard(idCardStr);
|
|
|
userEntity.setCreateTime(DateUtil.now());
|
|
|
- userEntity.setPassword(DigestUtils.md5DigestAsHex(userEntity.getPassword().getBytes()));
|
|
|
this.userService.save(userEntity);
|
|
|
return success();
|
|
|
} else {
|