Commit 7e3274e6 by 唐功亮

【修改】 密码字段改为pass

parent 0e874f33
......@@ -21,6 +21,9 @@ public interface MemberDao extends BaseMapper<MemberEntity> {
@Select("select * from member where username=#{userName}")
MemberEntity selectByName(@Param("userName") String userName);
@Update("UPDATE member SET password = #{passWord} WHERE id = #{id}")
@Update("UPDATE member SET pass = #{passWord} WHERE id = #{id}")
void updateByIdPassWord(@Param("id") Integer id,@Param("passWord") String passWord);
/*@Select("select * from member where username=#{userName} or firmcode=#{userName}")
MemberEntity selectByNameAndSn(@Param("userName") String userName);*/
}
......@@ -10,6 +10,8 @@ import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map;
import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -29,8 +31,10 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
@Autowired
private LogLoginDao logLoginDao;
@Autowired
private MemberDao memberDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<LogLoginEntity> page = this.page(
......@@ -41,6 +45,8 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
return new PageUtils(page);
}
@Override
public void login(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
String userName = String.valueOf(params.get("userName")==null?"":params.get("userName"));
......@@ -48,10 +54,25 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
String verification = String.valueOf(params.get("verification")==null?"":params.get("verification"));//验证码
//session中获取验证码
//判断 验证码是否正确
//判断用户是否是手机号 是手机号调用 第三方接口登录 不是继续
int userType; //1.业务大厅 2.网站用户
if (matchPhoneNumber(userName)){
//TODO tgl 调用第三方登录接口
userType=1;
}else {
userType=2;
//查询Member表
MemberEntity memberEntity = memberDao.selectByName(userName);
//用户类型 www:为官网用户 条码卡:为条码卡用户
String source = memberEntity.getSource();
if (!"条码卡".equals(source)){//官网用户
}
}
MemberEntity user=memberDao.selectByName(userName);
String phone = user.getPhone();
String password = user.getPassword();
String password = user.getPass();
String passwordMD5 = MD5Util.md5Encrypt32Upper(passWord);
//判断密码是否正确
if (!passwordMD5.equals(password)){
......@@ -60,4 +81,17 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
//TODO tgl 参数不正确添加登录日志 log_login
logLoginDao.insert(new LogLoginEntity(1,userName,"用户来源","条码卡号",phone,new Date(), IPUtils.getIpAddr(request),request.getRequestURL().toString()));
}
/**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等
* @param phoneNumber 手机号码
* @return
*/
private static boolean matchPhoneNumber(String phoneNumber) {
String regex = "1[358][0-9]{9}";
if(phoneNumber==null||phoneNumber.length()<=0){
return false;
}
return Pattern.matches(regex, phoneNumber);
}
}
\ No newline at end of file
......@@ -77,8 +77,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
String subjoinReq = request.getSession().getAttribute("subjoin")==null?"":String.valueOf(request.getSession().getAttribute("subjoin"));
String telReq = request.getSession().getAttribute("tel")==null?"":String.valueOf(request.getSession().getAttribute("tel"));
Long dateReq = request.getSession().getAttribute("date")==null?0:Long.valueOf(String.valueOf(request.getSession().getAttribute("date")));//毫秒值
subjoinReq="344942";
telReq="13159872863";
long l = System.currentTimeMillis();
dateReq=(l-dateReq)/1000;
//dateReq=(l-dateReq)/1000;
dateReq=30L;
//获取验证码验证次数
TimescodeRegiEntity timescodeRegiEntity = timescodeRegiDao.selectById(phone);
if (timescodeRegiEntity==null){
......@@ -92,7 +95,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
MemberEntity memberEntity = new MemberEntity();
memberEntity.setUsername(userName);
//MD5加密密码
memberEntity.setPassword(MD5Util.md5Encrypt32Upper(passWord));
memberEntity.setPass(MD5Util.md5Encrypt32Upper(passWord));
memberEntity.setEmail(emiail);
memberEntity.setPhone(phone);
memberEntity.setOicq("");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment