⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userinfo.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		return itemsList;
	}

	public Map getUserByCustId(String cust_id) throws SaasApplicationException {

		log.LOG_INFO("cust_id=====" + cust_id);
		HashMap map = new HashMap();
		UserExt userExt = new UserExt();
		userExt.setParam(":VCUST_ID", cust_id);
		userExt.setParam(":VUSER_STATE", "0");
		ArrayList list = userExt.selByList("SEL_CUST_BY_IDX");
		if (list != null && list.size() > 0) {
			for (int i = 0; i < list.size(); i++) {
				HashMap maps = (HashMap) list.get(i);
				String user_id = maps.get("user_id").toString();
				String user_name = maps.get("user_name").toString();
				map.put(user_id, user_name);
			}
		}
		log.LOG_INFO("======" + map);
		return map;
	}

	// 分页查询(用户的状态)(0 正常 1 冻结 2 注销)
	public ArrayList getUserListByCust(int iStart, String strCustId, String state) throws SaasApplicationException {

		if (iStart == 0) {
			iStart = 0;
		} else {
			iStart = (iStart - 1) * 30;
		}
		ArrayList userList = new ArrayList();
		UserExt userExt = new UserExt();
		userExt.setParam(":VCUST_ID", strCustId);
		userExt.setParam(":VUSER_STATE", state);
		userList = userExt.selByList("SEL_BY_CUST_ID", iStart, 30);
		return userList;
	}

	// 统计总数(用户状态)(0 正常 1 冻结 2 注销)
	public int getUserNumber(String cust_id, String state) throws SaasApplicationException {

		ArrayList userList = new ArrayList();
		UserExt userExt = new UserExt();
		userExt.setParam(":VCUST_ID", cust_id);
		userExt.setParam(":VUSER_STATE", state);
		userList = userExt.selByList("SEL_BY_CUST_ID");
		if (userList != null) {
			return userList.size();
		} else {
			return 0;
		}
	}

	// 查找会员信息(user / detail)
	public ArrayList getUserInfoByUserId(String user_id) throws SaasApplicationException {

		ArrayList userList = new ArrayList();
		UserExt userExt = new UserExt();
		userExt.setParam(":VUSER_ID", user_id);
		userList = userExt.selByList("SEL_DETAL_BY_ID");
		return userList;
	}

	public String getUserNameById(String user_id) throws SaasApplicationException {
		HashMap map = new HashMap();
		ArrayList userList = new ArrayList();
		UserExt userExt = new UserExt();
		userExt.setParam(":VUSER_ID", user_id);
		userList = userExt.selByList("SEL_DETAL_BY_ID");
		String user_name = "";
		if (userList != null && userList.size() > 0) {
			map = (HashMap) userList.get(0);
			user_name = map.get("user_name").toString();
		}
		return user_name;

	}

	// 检查用户名的重复与否
	public void getUserNameCount(Buffers inbuffer) {

		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		log.LOG_INFO("进入getUserNameCount方法...");
		int iResult = -1;
		try {
			String user_name = inbuffer.getString("USER_NAME");
			iResult = getUserNameExist(user_name);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "用户名已存在!");
		} else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出getUserNameCount方法...");
	}

	public int getUserNameExist(String user_name) throws SaasApplicationException {

		ArrayList usercountList = new ArrayList();
		UserExt userExt = new UserExt();
		log.LOG_INFO("======"+user_name+"========");
		userExt.setParam(":VUSER_NAME", user_name.trim());
		usercountList = userExt.selByList("SEL_BY_USERNAMEDOUBLE");
		log.LOG_INFO("======"+usercountList+"========");
		if (usercountList != null && usercountList.size() > 0) {
			return 1;
		} else {
			return 0;
		}
	}

	// 会员状态设置(0 正常 1 冻结 2 注销)
	public void userStaeMgr(Buffers inbuffer) {

		log.LOG_INFO("进入userStaeMgr方法...");
		this.outBuffer = inbuffer;
		int iResult = -1;
		try {
			String cust_id = inbuffer.getString("CUST_ID");
			String user_state = inbuffer.getString("CUST_STATE");
			String user_id = inbuffer.getString("SESSION_USER_ID");
			iResult = userStaeMgr(cust_id, user_id, user_state);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		} else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
	}

	public int userStaeMgr(String cust_id, String user_id, String user_state) throws SaasApplicationException {

		UserExt UserExt = new UserExt();
		UserExt.setParam(":VCUST_ID", cust_id);
		UserExt.setParam(":VSTAFF_ID", user_id);
		UserExt.setParam(":VUSER_STATE", user_state);
		tradeQuery.executeBy(UserExt.insBy("USER_STATE_CHANGE"));
		return 0;
	}

	// 会员帐号激活
	public void updateUserActiveation(Buffers inbuffer) {

		log.LOG_INFO("进入updateUserActiveation方法...");
		this.outBuffer = inbuffer;
		int iResult = -1;
		try {
			String user_id = inbuffer.getString("user_id");
			iResult = updateUserActiveation(user_id);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		} else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出updateUserActiveation方法...");
	}

	public int updateUserActiveation(String user_id) throws SaasApplicationException {

		UserExt UserExt = new UserExt();
		UserExt.setParam(":VUSER_ID", user_id);
		tradeQuery.executeBy(UserExt.insBy("UPDATE_ACTIVE"));
		return 0;
	}

	// 判断用户名是否存在,并返回cust_id;
	public String getCustIdByUserName(String name) throws SaasApplicationException {

		String cust_id = "";
		ArrayList list = new ArrayList();
		UserExt userExt = new UserExt();
		userExt.setParam(":VUSER_NAME", name);
		list = userExt.selByList("SEL_BY_NAME");
		if (list != null && list.size() > 0) {
			HashMap map = (HashMap) list.get(0);
			cust_id = map.get("cust_id").toString();
		}
		return cust_id;
	}

	// 取出用户信息

	public HashMap getUserInfByName(String name) throws SaasApplicationException {

		HashMap map = new HashMap();
		ArrayList list = new ArrayList();
		UserExt userExt = new UserExt();
		userExt.setParam(":VUSER_NAME", name);
		list = userExt.selByList("SEL_BY_NAME");
		if (list != null && list.size() > 0) {
			map = (HashMap) list.get(0);
		}
		return map;
	}
	
	
	public Map getPasswordByName(String userName) throws SaasApplicationException 
	{
		ArrayList list = new ArrayList();
		UserExt userExt = new UserExt();
		userExt.setParam(":VUSER_NAME",userName.trim());
		log.LOG_INFO("========="+userName.trim()+"=========");
		list = userExt.selByList("SEL_BY_NAME");
		log.LOG_INFO("========="+list+"=========");
		String user_name="",passwd="";
		Map childMap=new HashMap();
		HashMap map = new HashMap();
		if(list!=null&&list.size()>0){
			for (int i = 0; i < list.size(); i++) {
				map = (HashMap)list.get(i);
				if( map.get("user_name")!=null){
					user_name= map.get("user_name").toString();
				}
				if( map.get("passwd")!=null){
					passwd= map.get("passwd").toString();
				}
				childMap.put("user_name",user_name);
				childMap.put("passwd",passwd);
			}
			
		}
		return childMap;
	}

	// 判断用帐号是否激活
	public String getUserWeb_Log(String user_id) throws SaasApplicationException {

		String web_log = "";
		ArrayList list = new ArrayList();
		UserExt userExt = new UserExt();
		userExt.setParam(":VUSER_ID", user_id);
		list = userExt.selByList("SEL_BY_ONE");
		if (list != null && list.size() > 0) {
			HashMap map = (HashMap) list.get(0);
			if (map.get("web_login_tag") != null) {
				web_log = map.get("web_login_tag").toString();
			}
			log.LOG_INFO("..." + list);
		}
		log.LOG_INFO("..." + web_log);
		return web_log;
	}

	// 判断用户邮箱地址是否重复
	public int getEmailAddrExist(String email) throws SaasApplicationException {

		int exist = 0;
		UserdetailExt userdetailExt = new UserdetailExt();
		userdetailExt.setParam(":VEMAIL", email);
		ArrayList list = userdetailExt.selByList("SEL_BY_EMAIL");
		if (list != null && list.size() > 0) {
			HashMap map = (HashMap) list.get(0);
			exist = Integer.parseInt(map.get("ct").toString());
		}
		return exist;
	}

	public String getUserJsonData(int iStart, String strCustId, String state) throws SaasApplicationException {

		String json = "";
		ArrayList userList = new ArrayList();
		UserExt userExt = new UserExt();
		userExt.setParam(":VCUST_ID", strCustId);
		userExt.setParam(":VUSER_STATE", state);
		userList = userExt.selByList("SEL_BY_CUST_ID", iStart, 10);
		JSONArray array = new JSONArray();
		JSONObject root = new JSONObject();
		if (userList != null && userList.size() > 0) {
			for (int i = 0; i < userList.size(); i++) {
				HashMap map = (HashMap) userList.get(i);
				String name = "";
				String phone = "";
				String addr = "";
				String date = "";
				String email = "";
				String id = map.get("user_id").toString();
				if (map.get("user_name") != null) {
					name = map.get("user_name").toString();
				}
				if (map.get("phone") != null) {
					phone = map.get("phone").toString();
				}
				if (map.get("home_addr") != null) {
					addr = map.get("home_addr").toString();
					addr = addr.replaceAll("<[^<>]+>", "");
					if (addr.length() > 20) {
						addr = addr.substring(0, 20) + "...";
					}
				}
				if (map.get("birthday") != null) {
					date = map.get("birthday").toString();
					if (date.length() > 10) {
						date = date.substring(0, 10);
					}
				}
				if (map.get("email") != null) {
					email = map.get("email").toString();
				}
				JSONObject jsonObj = new JSONObject();
				jsonObj.put("id", id);
				jsonObj.put("name", name);
				jsonObj.put("phone", phone);
				jsonObj.put("addr", addr);
				jsonObj.put("email", email);
				array.add(jsonObj);
			}
		}
		int size = getUserNumber(strCustId, "0");
		root.put("root", array);
		root.put("totalCount", size);
		json = root.toString();
		return json;
	}

	public String searchRoleCode(String cust_id) throws SaasApplicationException {

		String role_code = "";
		ArrayList roleList = getUserinfoByCust_id(cust_id);
		if (roleList != null && roleList.size() > 0) {
			HashMap map = (HashMap) roleList.get(0);
			if (map.get("rsrv_str3") != null)
				role_code = map.get("rsrv_str3").toString();
			else
				role_code = "";
		}
		return role_code;
	}

	/**
	 * 修改用户角色
	 * 
	 * @author Liuy
	 * @param inbuffer
	 */
	public void updateUsrRole(Buffers inbuffer) {

		log.LOG_INFO("进入updateUsrRole方法...");
		this.outBuffer = inbuffer;
		int iResult = -1;
		String user_id = inbuffer.getString("USER_ID");
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String role_code = inbuffer.getString("CODE");
		try {
			iResult = updateUsrRole(user_id, cust_id, role_code);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		} else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出updateUsrRole方法...");
	}

	public int updateUsrRole(String user_id, String cust_id, String role_code) throws SaasApplicationException {

		UserExt uExt = new UserExt();
		uExt.setParam(":VUSER_ID", user_id);
		uExt.setParam(":VCUST_ID", cust_id);
		uExt.setParam(":VROLE_CODE", role_code);
		log.LOG_INFO("=="+uExt.insBy("EIDT_TY_ROLE"));
		tradeQuery.executeBy(uExt.insBy("EIDT_TY_ROLE"));
		return 0;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -