diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/UserLoginDao.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/UserLoginDao.java index ff1478c3..f123100c 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/UserLoginDao.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/UserLoginDao.java @@ -37,4 +37,6 @@ public interface UserLoginDao extends BaseMapper { UserEntity selectByManagerId(); int updateManagePassword(String newMD5); + + int selectUserEmpCount(@Param("md5UnionId")String md5UnionId); } diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java index eb3cbfaa..3708f68c 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java @@ -393,10 +393,12 @@ public class UserLoginServiceImpl extends ServiceImpl loginRequest.setTenDayEffective(2); if(identify==0){//员工小程序登录 if(count<=0){ - return ResponseResult.FAIL(60001,"您不是员工,请使用客户小程序登录!"); + return ResponseResult.FAIL(60001,"您的账号没有权限,无法登录!"); } }else{//客户小程序登录 - if(count <=0){//新用户 + //如果员工使用客户小程序登录的情况,关联用户表和员工表查询,如果有数据则代表是员工的数据 + int count2 = userLoginDao.selectUserEmpCount(md5UnionId); + if(count2>0 || count <=0){//代表员工或者新用户 UserEntity userEntity = new UserEntity(); userEntity.setAccount(userMap.get("nickName").toString());//账号默认为微信名称 userEntity.setWechatId(md5UnionId);//加密后unionId @@ -404,6 +406,17 @@ public class UserLoginServiceImpl extends ServiceImpl userEntity.setCreateTime(new Date());//创建时间 userLoginDao.insert(userEntity); } +/* if(count2>0){//代表员工 + return ResponseResult.FAIL(60002,"您不是客户,请使用员工小程序登录!"); + }else if(count <=0){//新用户 + UserEntity userEntity = new UserEntity(); + userEntity.setAccount(userMap.get("nickName").toString());//账号默认为微信名称 + userEntity.setWechatId(md5UnionId);//加密后unionId + userEntity.setHeadPortaritUrl(userMap.get("avatarUrl").toString());//头像路径 + userEntity.setCreateTime(new Date());//创建时间 + userLoginDao.insert(userEntity); + }*/ + } ResponseResult result = login(loginRequest); diff --git a/dq-financial-hrms-auth/src/main/resources/mapper/hrauth/UserLoginMapper.xml b/dq-financial-hrms-auth/src/main/resources/mapper/hrauth/UserLoginMapper.xml index ea7640d4..cbba8d33 100644 --- a/dq-financial-hrms-auth/src/main/resources/mapper/hrauth/UserLoginMapper.xml +++ b/dq-financial-hrms-auth/src/main/resources/mapper/hrauth/UserLoginMapper.xml @@ -74,4 +74,8 @@ update hrms_user set password = #{password} where id=1 + + \ No newline at end of file