nfdw_stand/src/com/fgkj/actions/LoginAction.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
nfdw_stand/src/com/fgkj/actions/User_infAction.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
nfdw_stand/src/com/fgkj/dao/impl/User_infImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
nfdw_stand/src/com/fgkj/dto/User_inf.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
nfdw_stand/src/com/fgkj/services/User_infService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
nfdw_stand/src/com/fgkj/actions/LoginAction.java
@@ -38,7 +38,11 @@ private User_infService service=new User_infService(); private Vip_userService vservice=new Vip_userService(); //web版登录 /** * web版登录: * 超级管理员采取密码登录,不在人脸登录的查询范围 */ public String login() { model=vservice.login(uinf); //System.out.println(model); nfdw_stand/src/com/fgkj/actions/User_infAction.java
@@ -245,11 +245,32 @@ System.out.println(uif); return SUCCESS; } /** * 设置用户登录类型:传入用户id和用户登录类型1 / 2 * */ public String updateLoginType(){ model = service.updateLoginType(uif); { String msg="修改"+uif.getUName()+"的登录类型为"+uif.getLoginType(); User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg); uservice.add(ulog);//将用户的操作记录下来 } result = ActionUtil.tojson(model); return SUCCESS; } /**根据uKey获取用户登录类型*/ public String searchLoginType(){ uif=ActionUtil.getGson("yyyy-MM-dd").fromJson(addjson, User_inf.class); model = service.searchLoginType(uif.getUKey_ID()); result = ActionUtil.tojson(model); return SUCCESS; } public void setBup(Batt_User_Permit bup) { this.bup = bup; } public String getResult() { return result; nfdw_stand/src/com/fgkj/dao/impl/User_infImpl.java
@@ -5,6 +5,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; import com.fgkj.actions.ActionUtil; @@ -209,7 +210,7 @@ //首页会根据uname查询用户信息 public List serchByCondition(Object obj) { User_inf uinf=(User_inf) obj; String sql = "select uid,uname,uSnId,upassword,unote,UKey_ID from db_user.tb_user_inf where uname=?"; String sql = "select uid,uname,uSnId,upassword,unote,UKey_ID,login_type from db_user.tb_user_inf where uname=?"; List list = DAOHelper .executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUName()}, new CallBack() { @@ -225,6 +226,7 @@ uinf.setUNote(rs.getString("uNote")); uinf.setUpassword(rs.getString("upassword")); uinf.setUKey_ID(rs.getString("uKey_ID")); uinf.setLoginType(rs.getInt("login_type")); list.add(uinf); } } catch (SQLException e) { @@ -692,6 +694,59 @@ List list=ui.searchAllAndSuper(); System.out.println("list:"+list.size()); } public Boolean updateLoginType(User_inf uif) { String sql = "update db_user.tb_user_inf set login_type=? where uId =?"; return DAOHelper.executeUpdate(DBUtil.getConn(),sql,new Object[]{uif.getLoginType(),uif.getUId()}); } public Integer getLoginType(String username) { String sql = "select login_type from db_user.tb_user_inf where uName = ? limit 1"; List<Integer> loginTypes = DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{username}, new CallBack() { @Override public List getResults(ResultSet rs) { LinkedList<Integer> loginTypesTemp = new LinkedList<>(); try { while (rs.next()) { loginTypesTemp.add(rs.getInt("login_type")); } } catch (Exception e) { e.printStackTrace(); } return loginTypesTemp; } }); if (loginTypes.size()!=0){ return loginTypes.get(0); }else{ //用户不存在,或者用户没有设置登录类型 return 0; } } public Integer searchLoginType(String uKey_id) { String sql = "select login_type from db_user.tb_user_inf where uKey_ID = ? limit 1"; List<Integer> loginTypes = DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uKey_id}, new CallBack() { @Override public List getResults(ResultSet rs) { LinkedList<Integer> loginTypesTemp = new LinkedList<>(); try { while (rs.next()) { loginTypesTemp.add(rs.getInt("login_type")); } } catch (Exception e) { e.printStackTrace(); } return loginTypesTemp; } }); if (loginTypes.size()!=0){ return loginTypes.get(0); }else{ //用户不存在,或者用户没有设置登录类型 return 0; } } } nfdw_stand/src/com/fgkj/dto/User_inf.java
@@ -33,6 +33,8 @@ //人脸识别 private Face face; //用户登录类型 private Integer loginType; public Face getFace() { return face; @@ -298,6 +300,13 @@ UKey_ID = uKey_ID; } public Integer getLoginType() { return loginType; } public void setLoginType(Integer loginType) { this.loginType = loginType; } @Override public String toString() { nfdw_stand/src/com/fgkj/services/User_infService.java
@@ -263,7 +263,12 @@ model.setMsg(this.getText("Username_error")); // System.out.println("用户名不存在"); } else { //优先判断是否用户属于密码登录类型,loginType分为密码登录-1,人脸登录-2 User_inf u = (User_inf) list.get(0); if(u.getLoginType()!=1){ model.setMsg("当前用户登录类型为人脸登录,无法使用密码进行登录"); return model; } int flag=0; if(uinf.getUName().equals("guest")){ flag=1; @@ -432,4 +437,34 @@ // System.out.println(us.searchAll(bup).getData()); //us.searchByNameOrId(bup); } public ServiceModel updateLoginType(User_inf uif) { Boolean res = new User_infImpl().updateLoginType(uif); if(res){ model.setCode(1); model.setMsg("设置成功"); }else{ model.setMsg("设置失败"); } return model; } /** * 查询用户的登录类型:根据用户名 */ public Integer getLoginType(String username){ Integer loginType = new User_infImpl().getLoginType(username); return loginType; } public ServiceModel searchLoginType(String uKey_id) { Integer loginType = new User_infImpl().searchLoginType(uKey_id); if(loginType!=0){ model.setCode(1); model.setData(loginType); }else{ model.setMsg("uKey不存在对应的用户登录类型"); } return model; } }