commonmethod.java

来自「电信的网厅的整站代码」· Java 代码 · 共 744 行 · 第 1/2 页

JAVA
744
字号
			String RestoreTime, String submittime, String prodorderrestore) {

		try {
			ProdOrderRestoreDAO prodOrderRestoreDAO = new ProdOrderRestoreDAO();
			prodOrderRestoreDAO.setProdorderid(prodorderid);
			prodOrderRestoreDAO.setRestorecontent(RestoreContent);
			prodOrderRestoreDAO.setRestoresource(resourceType);
			prodOrderRestoreDAO.setRestoreman(RestoreMan);
			prodOrderRestoreDAO.setRestoretime(RestoreTime);
			prodOrderRestoreDAO.setSubmittime(submittime);
			/** 业务受理审核单id为空的时候,插入一审核结果 */
			if (prodorderrestore == null || prodorderrestore.equals("")) {
				prodOrderRestoreDAO.insertProdOrderRestore();
			} else {
				prodOrderRestoreDAO.setProdorderrestore(prodorderrestore);
				prodOrderRestoreDAO.updateProdOrderRestore();
			}
			return true;
		} catch (Exception ex) {
			FileLogger.getLogger().warn(ex.getMessage(), ex);
		}
		return false;
	}

	/**
	 * <p>
	 * 更新一张故障,建议,投诉单的状态
	 * </p>
	 * 
	 * @param prodorderid
	 * @param processState
	 * @param outDate
	 * @param bosomprogree
	 * @return
	 */
	static public boolean updateStatuAppeal(String prodorderid,
			String processState, String outDate, String bosomprogree) {
		try {
			AppealDAO appealDAO = new AppealDAO();
			if (processState != null)
				appealDAO.setProcessState(processState, prodorderid);
			if (outDate != null && !outDate.equals(""))
				appealDAO.updateOutDate(outDate, prodorderid);
			if (bosomprogree != null)
				appealDAO.setBosomprogressstate(bosomprogree, prodorderid);

			return true;
		} catch (Exception ex) {
			FileLogger.getLogger().warn(ex.getMessage(), ex);
		}
		return false;
	}

	/**
	 * <p>
	 * 插入或者更新一个审核结果,针对故障,建议,投诉单
	 * </p>
	 * 
	 * @param prodorderid
	 * @param RestoreContent
	 * @param resourceType
	 * @param RestoreMan
	 * @param RestoreTime
	 * @param restoreid
	 * @return
	 */
	static public boolean updateActiveAppeal(String prodorderid,
			String RestoreContent, String resourceType, String RestoreMan,
			String RestoreTime, String restoreid) {
		try {
			AppealrestoreDAO appealrestoreDAO = new AppealrestoreDAO();
			appealrestoreDAO.setAppealid(prodorderid);
			appealrestoreDAO.setRestorecontent(RestoreContent);
			appealrestoreDAO.setRestoresource(resourceType);
			appealrestoreDAO.setRestoreman(RestoreMan);
			appealrestoreDAO.setRestoretime(RestoreTime);

			if (restoreid == null || restoreid.trim().equals("")) {
				appealrestoreDAO.insertAppealRestore();
			} else {
				appealrestoreDAO.setRestoreid(restoreid);
				appealrestoreDAO.updateAppealRestore();
			}
			return true;
		} catch (Exception ex) {
			System.out.println(ex.getMessage());
		}
		return false;
	}

	static public String formatString(String s) {
		if (s == null || s.equals("null"))
			s = "";
		return s;
	}

	/**
	 * <code>
	 *   获取工单前台选中程控功能列表
	 * </code>
	 * 
	 * @param prodorderid
	 * @return String[] : format: name~code
	 */
	static public String[] getRemoteList(String prodorderid) {

		String sql = "SELECT f.funname,f.funcode FROM TF_PRODORDERFUN t "
				+ "JOIN td_prodfun f on t.prodfunid=f.prodfunid "
				+ "where t.prodorderid=?";
		String[] fun = null;

		try {
			DataTable _dt = _dac
					.executeQuery(sql, new Object[] { prodorderid });
			if (_dt != null && _dt.getRows().getCount() > 0) {

				fun = new String[_dt.getRows().getCount()];
				for (int i = _dt.getRows().getCount(); --i >= 0;) {

					fun[i] = _dt.getRow(i).getString("funname") + "~"
							+ _dt.getRow(i).getString("funcode");
				}
			}

		} catch (Exception ex) {
		}

		return fun;
	}

	/**
	 * <code>
	 *   根据产口编码,获取产品名称
	 * </code>
	 * 
	 * @param prodorderid
	 * @param citycode
	 * @return
	 */
	static public String getProductName(String productid) {

		String sql = "SELECT PRODUCTNAME FROM Td_Product WHERE productid=?";

		try {
			DataTable _dt = _dac.executeQuery(sql, new Object[] { productid });
			if (_dt != null)
				return _dt.getRow(0).getString("PRODUCTNAME");

		} catch (Exception ex) {
		}
		return "";
	}

	/**
	 * <code>
	 *   解锁当前工单
	 * </code>
	 * 
	 * @param prodorderid
	 */
	static public void unLockOrder(String prodorderid) {
		try {

			ProdorderDAO prodorderDAO = new ProdorderDAO();
			String parentid = prodorderDAO.getPerentID(prodorderid);
			ProdorderDAO.setProdorderUnLock(parentid);

		} catch (Exception ex) {
		}

	}

	/**
	 * <code>判断是否所选地址是否合理</code>
	 * 
	 * @param prodorderid
	 * @return 0 表示成功,其它不成功
	 */
	static public String isTrueAddress(String addressid, String citycode) {
		try {

			DataTable _dt = BssInter8.callWebCheckIPTV(addressid, citycode);
			if (_dt == null || _dt.getRows().getCount() == 0)
				return "所选地址不合理";

			String flag = _dt.getRow(0).getString("TEMP_STS_WORDS1");
			String error = _dt.getRow(0).getString("ERROR_INFO");

			return flag != null && flag.equals("1") ? "0" : error;

		} catch (Exception ex) {
		}
		return "所选地址不合理";
	}

	/**
	 * <code>获取待处理的业务受理工单</code>
	 * 
	 * @return
	 */
	static public String getProdorderWaitSheet(String citycode) {
		try {
			Map _map = new Hashtable();
			_map.put("CITY", citycode);

			DataTable _dt = ProdorderDAO.getOrderMethod(_map, "1");
			if (_dt == null)
				return "0";
			return _dt.getRow(0).getString("count");

		} catch (Exception ex) {

		}

		return "0";
	}

	static public String getAppealWaitSheet(String citycode) {
		try {
			Map _map = new Hashtable();
			_map.put("CITY", citycode);

			DataTable _dt = ConsomerDAO.getOrderMethod(_map, "1");
			if (_dt == null)
				return "0";
			return _dt.getRow(0).getString("count");

		} catch (Exception ex) {
		}

		return "0";
	}

	static public String getFailureWaitSheet(String citycode) {
		try {
			Map _map = new Hashtable();
			_map.put("CITY", citycode);

			DataTable _dt = FailureDAO.getOrderMethod(_map, "1");
			if (_dt == null)
				return "0";
			return _dt.getRow(0).getString("count");

		} catch (Exception ex) {
		}

		return "0";
	}

	/**
	 * 
	 * @param cityCode
	 * @return
	 */
	static public String getCityName(String cityCode) {
		try {
			String sql = "select cityname from td_city c where c.citycode=?";
			DataTable _dt = _dac.executeQuery(sql, new Object[] { cityCode });
			if (_dt != null)
				return _dt.getRow(0).getString("cityname");

		} catch (Exception e) {
			// TODO: handle exception
		}
		return "";

	}
	
	/**
	 * 
	 * @param areaCode
	 * @return
	 */
	static public String getAreaName(String areaCode) {
		try {
			String sql = "select a.areaname from td_area a where a.areacode=?";
			DataTable _dt = _dac.executeQuery(sql, new Object[] { areaCode });
			if (_dt != null)
				return _dt.getRow(0).getString("areaname");

		} catch (Exception e) {
			// TODO: handle exception
		}
		return "";

	}
	
	/**
	 * 获取工单中选中的程控信息.
	 * @param pId
	 * @return
	 */
	static public String orderFunName(String pId){
		
		String sql = "select fun.funname from tf_prodorderfun funid "+
					 "join td_prodfun fun on fun.prodfunid = funid.prodfunid "+
				     "where funid.prodorderid= ? ";
		try{
			DataTable _dt = _dac.executeQuery(sql, new Object[] { pId });
			if(_dt == null || _dt.getRows().getCount() == 0){
				return "没有程控信息!";
			}
			
			String message = "";
            for (int i = 0; i < _dt.getRows().getCount(); i++) {
            	message += _dt.getRow(i).getString(0) + " ";
			}
            return message;
		}catch(Exception e){}
		return "没有程控信息!";
		
	}
	
	/**
	 * <title>跟据价格ID,获取宽带速率与套餐价格信息.</title>
	 * @param price
	 * @return
	 */
	static public String getAdslPrice(String price){
		try{
		 String sql =
             "SELECT B.ADSL_TYPE_NAME,D.ADSL_CASE_NAME,E.ADSL_CASE_TIME_NAME" +
             " FROM TF_ADSL_PRICE A, TD_ADSL_TYPE B, TD_ADSL_CASE_PREF C, td_adsl_case D,td_adsl_case_time E" +
             " WHERE A.ADSL_TYPE_ID=B.ADSL_TYPE_ID AND A.ADSL_CASE_PREF_ID=C.ADSL_CASE_PREF_ID " +
             " AND C.ADSL_CASE_TIME_ID=E.ADSL_CASE_TIME_ID AND E.ADSL_CASE_ID = D.ADSL_CASE_ID AND A.ADSL_PRICE_ID=?";
		 Object[] _object = new Object[1];
         _object[0] = price;
         DataTable _dt = _dac.executeQuery(sql, _object);
         if(_dt == null || _dt.getRows().getCount() == 0){
				return "没有宽带速率与套餐价格!";
			}
         StringBuffer message = new StringBuffer();
         for (int i = 0; i < _dt.getRows().getCount(); i++) {
        	 message.append("速率: <font color=blue>");
         	 message.append(_dt.getRow(i).getString("ADSL_TYPE_NAME"));
         	 message.append("</font> 套餐: <font color=blue>");
        	 message.append(_dt.getRow(i).getString("ADSL_CASE_NAME"));
        	 message.append("</font> 时间: <font color=blue>");
        	 message.append(_dt.getRow(i).getString("ADSL_CASE_TIME_NAME"));
        	 message.append("</font><br>");
			}
         return message.toString();
		}catch(Exception e){
			return "没有宽带速率与套餐价格!";
		}

	}
	
	/**
	 * <title>跟据定单ID获取其地区编码.</title>
	 * @param prodorderid
	 * @return
	 */
	static public String getProdOrderAreaCode(String prodorderid){
		try {
			String sql = "select c.areacode from tf_custinfoweb c " +
					"join tf_prodorder p on c.userid = p.userid where p.prodorderid=?";
			Object[] _object = new Object[1];
	         _object[0] = prodorderid;
	         DataTable _dt = _dac.executeQuery(sql, _object);
	         if(_dt == null || _dt.getRows().getCount() == 0){
	        	 return "";
	         }
	         
	         return _dt.getRow(0).getString("areacode");
		} catch (Exception ex) {
			return "";
		}
	}
	
}

⌨️ 快捷键说明

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