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

📄 phoneutil.java

📁 本文论述了一个前台笔记本销售系统的开发过程
💻 JAVA
字号:
package com.set.utils;

import java.util.*;
import com.set.appframe.data.*;
import com.set.db.*;

public class PhoneUtil {
	public PhoneUtil() {
	}

	/**
	 * @author lizhl
	 * @version 1.0 通过手机号码查询手机归属地信息
	 */

	public static GenericValueObject getMobileAddr(String mobile)
			throws DBAccessException {
		List list = null;
		Vector params = new Vector();
		params.addElement(mobile);
		list = DBAccessHelper.QueryCmd(params, "SMS_Q_MOBILE_ADDR");
		if (list != null) {
			Iterator it = list.iterator();
			while (it.hasNext()) {
				return (GenericValueObject) it.next();
			}
		}

		return null;
	}

	public static String getMobileCardType(String mobile)
			throws DBAccessException {
		GenericValueObject gvo = getMobileAddr(mobile);
		if (gvo != null) {
			return gvo.getItemString("CARDTYPE");
		}
		return "";
	}

	/**
	 * getProvinceList
	 * 
	 * @return List
	 */
	public static List getProvinceList() throws DBAccessException {
		Vector param = new Vector();
		param.add("1");
		List list = DBAccessHelper.QueryCmdSQL(param,
				"select * from area where level=?");
		if (list != null) {
			return list;
		}
		return null;
	}

	/**
	 * getCityList
	 * 
	 * @return List
	 */
	public static List getCityList() throws DBAccessException {
		List list = DBAccessHelper.QueryCmdSQL(new Vector(),
				"select * from area order by level, province");
		if (list != null) {
			return list;
		}
		return null;

	}

	/**
	 * 
	 * @param mobile
	 *            手机号
	 * @param Operators
	 *            运营商名称
	 * @param type
	 *            运营商提供的卡类型
	 * @return
	 */
	public static boolean checkMobileType(String mobile, String Operators,
			String type) {
		if (mobile.length() < 7 || Operators.equals("")) {
			return false;
		}
		try {
			String cardType = getMobileCardType(mobile);
			if (type.endsWith("")) {
				if (cardType.indexOf(Operators) != -1) {
					return true;
				}

			} else {
				if (cardType.indexOf(Operators) != -1
						&& cardType.indexOf(type) != -1) {
					return true;
				}
			}
		} catch (DBAccessException e) {
			// TODO 自动生成 catch 块
			e.printStackTrace();
		}

		return false;
	}

	/**
	 * 判断手机是否可以上网,当前所有移动/联通CDMA手机可以上网
	 * 
	 * @param mobile
	 * @return
	 */
	public static boolean isWapMobile(String mobile) {
		if (mobile.equals("") || mobile.length() != 11) {
			return false;
		}
		String temp = mobile.substring(0, 3);
		if (temp.equals("130") || temp.equals("131") || temp.equals("132")) {
			return false;
		}

		return true;
	}

}

⌨️ 快捷键说明

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