提交修改
This commit is contained in:
parent
739509181f
commit
1593b8bfc3
@ -8,6 +8,7 @@ import com.lz.modules.app.dto.StaffDto;
|
||||
import com.lz.modules.app.dto.StaffStatisticalDto;
|
||||
import com.lz.modules.app.entity.StaffEntity;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -71,5 +72,7 @@ public interface StaffService extends IService<StaffEntity> {
|
||||
StaffEntity selectByPhone(String userName);
|
||||
|
||||
StaffEntity selectStaffByEmployeeId(String employeeId);
|
||||
|
||||
SysUserEntity getUser(String userName);
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
|
||||
import com.lz.common.utils.DateUtils;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.Query;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.modules.app.dto.GraphicsStatisticalDto;
|
||||
import com.lz.modules.app.dto.StaffBaseInfoDto;
|
||||
import com.lz.modules.app.dto.StaffDto;
|
||||
@ -17,6 +18,7 @@ import com.lz.modules.app.dao.StaffDao;
|
||||
import com.lz.modules.app.entity.*;
|
||||
import com.lz.modules.app.service.*;
|
||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -92,6 +94,27 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
||||
return staffDao.selectStaffByEmployeeId(employeeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUserEntity getUser(String userName) {
|
||||
SysUserEntity user = null;
|
||||
StaffEntity staffEntity = staffDao.selectByPhone(userName);
|
||||
if(staffEntity != null){
|
||||
user = new SysUserEntity();
|
||||
user.setPassword(staffEntity.getPassword());
|
||||
user.setMobile(staffEntity.getMobile());
|
||||
user.setUserId(staffEntity.getId());
|
||||
user.setEmail(staffEntity.getEmail());
|
||||
user.setSalt(staffEntity.getSalt());
|
||||
user.setStatus(1);
|
||||
user.setType(1);
|
||||
user.setUsername(staffEntity.getMobile());
|
||||
user.setRealName(staffEntity.getName());
|
||||
user.setUserNo(staffEntity.getMobile());
|
||||
return user;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
|
||||
@ -101,10 +101,15 @@ public class SysLoginController extends AbstractController {
|
||||
}
|
||||
//用户信息
|
||||
SysUserEntity user = sysUserService.queryByUserName(form.getUserName());
|
||||
|
||||
if (user == null) {
|
||||
if (user == null) {
|
||||
user = staffService.getUser(form.getUserName());
|
||||
if (user == null) {
|
||||
return R.error("账号不存在!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//账号不存在、密码错误
|
||||
if (!user.getPassword().equals(new Sha256Hash(form.getPassword(), user.getSalt()).toHex())) {
|
||||
return R.error("密码不正确!");
|
||||
@ -200,14 +205,14 @@ public class SysLoginController extends AbstractController {
|
||||
if (user.getStatus() == 0) {
|
||||
return R.error("账号已被停用,请联系管理员");
|
||||
}
|
||||
//String verifyCode = form.getVerifyCode();
|
||||
// CodeRecordEntity codeRecordEntity = codeRecordService.getOne(new QueryWrapper<CodeRecordEntity>().eq("send_account", user.getMobile()).eq("verify_code", verifyCode).eq("is_check", 0).ge("gmt_create", DateUtils.addDateMinutes(new Date(), -30)));
|
||||
String verifyCode = form.getVerifyCode();
|
||||
CodeRecordEntity codeRecordEntity = codeRecordService.getOne(new QueryWrapper<CodeRecordEntity>().eq("send_account", user.getMobile()).eq("verify_code", verifyCode).eq("is_check", 0).ge("gmt_create", DateUtils.addDateMinutes(new Date(), -30)));
|
||||
|
||||
/* if (codeRecordEntity == null) {
|
||||
if (codeRecordEntity == null) {
|
||||
return R.error("短信验证码不正确!");
|
||||
}
|
||||
codeRecordEntity.setIsCheck(1);
|
||||
codeRecordService.updateById(codeRecordEntity);*/
|
||||
codeRecordService.updateById(codeRecordEntity);
|
||||
|
||||
//生成token,并保存到数据库
|
||||
R r = sysUserTokenService.createToken(user);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user