自动登录实现

pull/1/head
unclekh 5 years ago
parent 8d91d12dd6
commit fac6ec1336
  1. 2
      blockchain-common/blockchain-common-base/src/main/java/com/blockchain/common/base/dto/ResultDTO.java
  2. 2
      blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/controller/LoginController.java
  3. 2
      blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/YyyfUserService.java
  4. 3
      blockchain-server/blockchain-server-user/src/main/java/com/blockchain/server/user/service/impl/YyyfUserServiceImpl.java
  5. 7
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java
  6. 2
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/AssessUser.java

@ -19,7 +19,7 @@ import javax.servlet.http.HttpServletRequest;
@AllArgsConstructor
public class ResultDTO<T> extends BaseDTO {
private int code;//返回码
private String msg;//返回码描述
private String msg="系统错误";//返回码描述
private T data;//返回数据
public static ResultDTO requstSuccess() {

@ -330,7 +330,7 @@ public class LoginController {
yyyfUserId = yyyfUserDto.getUserId();
YyyfUser yyyfUser = this.yyyfUserService.selectByYyyfUserIdAndTel(yyyfUserId, tel);
if (yyyfUser == null) {
this.yyyfUserService.saveUser(yyyfUserId, userId, yyyfUserDto.getUserName());
this.yyyfUserService.saveUser(yyyfUserId, userId,tel, yyyfUserDto.getUserName());
// this.redisTemplate.delete(yyyfTtoken);
} else {
if (!yyyfUser.getUserId().equals(userId)) {

@ -14,7 +14,7 @@ public interface YyyfUserService {
* @param email
* @param hasRelation 是否有关系链信息
*/
void saveUser(Integer yyyfUserId,String userId, String yyyfName);
void saveUser(Integer yyyfUserId,String userId,String tel,String yyyfName);
/**
* @description

@ -41,10 +41,11 @@ public class YyyfUserServiceImpl implements YyyfUserService {
@Transactional
@Override
public void saveUser(Integer yyyfUserId, String userId, String yyyfName) {
public void saveUser(Integer yyyfUserId, String userId,String tel, String yyyfName) {
YyyfUser yyyfUser=new YyyfUser();
yyyfUser.setYyyfUserId(yyyfUserId);
yyyfUser.setUserId(userId);
yyyfUser.setMobilePhone(tel);
yyyfUser.setYyyfUserName(yyyfName);
yyyfUser.setCreateTime(new Date());
this.yyyfUserMapper.insert(yyyfUser);

@ -44,7 +44,7 @@ public class LoginController {
private static final Logger LOG = LoggerFactory.getLogger(LoginController.class);
private static final String SMS_TYPE_LOGIN = "LOGIN";
private static final String REGISTER_KEY = "user:sms:register:";
private static final int TIME_OUT=10;
@ -108,10 +108,10 @@ public class LoginController {
//第一次进入进行注册
String code=String.format("%06d",new Random().nextInt(1000000));
redisTemplate.opsForValue().set(SMS_TYPE_LOGIN.concat(tel),code,TIME_OUT, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(REGISTER_KEY.concat(tel),code,TIME_OUT, TimeUnit.MINUTES);
yyyfLoginDto.setCode(code);
String password=IdGenerator.uuid();
String password=String.format("%08d",new Random().nextInt(10000000));
String assessUserId = IdGenerator.uuid();
assessUser = new AssessUser();
assessUser.setId(assessUserId);
@ -209,6 +209,7 @@ public class LoginController {
redisTemplate.opsForValue().set(caseKey, map);
redisTemplate.expire(caseKey, 2, TimeUnit.HOURS);
yyyfLoginDto.setStatus(1);
}

@ -133,6 +133,6 @@ public class AssessUser implements Serializable {
/**
* 密码
*/
@Column(name = "tel")
@Column(name = "password")
private String password;
}

Loading…
Cancel
Save