登录修改

master
shijie 4 years ago
parent 85e42f4e21
commit e9005c64ed
  1. 2
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/UserLoginDao.java
  2. 12
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java
  3. 14
      dq-financial-hrms-auth/src/main/resources/mapper/hrauth/UserLoginMapper.xml
  4. 2
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/LoginRequest.java

@ -39,4 +39,6 @@ public interface UserLoginDao extends BaseMapper<UserEntity> {
int updateManagePassword(String newMD5);
int selectUserEmpCount(@Param("md5UnionId")String md5UnionId);
UserEntity xcxLogin(LoginRequest loginRequest);
}

@ -124,7 +124,13 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginDao, UserEntity>
@Transactional
public ResponseResult login(LoginRequest loginRequest) {
//判断用户登录方式
UserEntity userEntity = baseMapper.login(loginRequest);
UserEntity userEntity = null;
if(loginRequest.getType()==3){//小程序登录
userEntity = baseMapper.xcxLogin(loginRequest);
}else{
userEntity = baseMapper.login(loginRequest);
}
String name = null;
if(userEntity != null){
//获取员工name
@ -389,11 +395,12 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginDao, UserEntity>
//根据标识判断是员工还是客户登录,如果为员工登录,则直接登录,无需保存记录,如果为客户登录,则先查询是否已注册
LoginRequest loginRequest = new LoginRequest();
loginRequest.setWechatId(md5UnionId);
loginRequest.setType(2);
loginRequest.setType(3);
loginRequest.setTenDayEffective(2);
//查询员工数据
int count2 = userLoginDao.selectUserEmpCount(md5UnionId);
if(identify==0){//员工小程序登录
if(count<=0 || count2<=0){//如果微信绑定的不是员工
return ResponseResult.FAIL(60001,"您的账号没有权限,无法登录!");
}
@ -411,6 +418,7 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginDao, UserEntity>
userEntity.setHeadPortaritUrl(userMap.get("avatarUrl").toString());//头像路径
userEntity.setCreateTime(new Date());//创建时间
userLoginDao.insert(userEntity);
loginRequest.setPhone(userMap.get("nickName").toString());//账号默认为微信名称
}
}

@ -37,6 +37,20 @@
</if>
</select>
<select id="xcxLogin" parameterType="com.daqing.framework.domain.hrms.request.LoginRequest" resultType="com.daqing.framework.domain.hrms.UserEntity">
select hu.id,hu.account,hu.phone_account,hu.password,hu.login_num,hu.head_portarit_url
from hrms_user hu
where hu.del_or_not = 0 and hu.status = 0
<if test="phone != null and phone != '' ">
and (hu.phone_account = #{phone} or hu.account = #{phone})
</if>
<if test="wechatId != null and wechatId != '' ">
and hu.wechat_id = #{wechatId}
</if>
</select>
<select id="selectByPhoneAccount" resultType="com.daqing.framework.domain.hrms.UserEntity">
SELECT id,account,password FROM hrms_user WHERE phone_account = #{phoneAccount}
</select>

@ -11,7 +11,7 @@ public class LoginRequest {
@ApiModelProperty(value = "手机号码/账号")
private String phone;
@ApiModelProperty(value = "登录类型(1:手机号 2:微信登录)")
@ApiModelProperty(value = "登录类型(1:手机号 2:微信登录 3:小程序登录)")
private int type;
@ApiModelProperty(value = "微信唯一编号(unionId)")

Loading…
Cancel
Save