Eos 플랫폼 자바 공공 논리

Eos 플랫폼 자바 공공 논리
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
고구마 요 2015 년 6 월 1 일 17:20:44 월요일
 
/**
	 *       
	 * 
	 * @param startDate     
	 * @param endDate     
	 * @return      , 5.20
	 */
	@Bizlet()
	public static String getOutTime(Date startDate, Date endDate) {
		long minutes = (endDate.getTime() - startDate.getTime()) / (1000 * 60);
		long hours = minutes / 60;
		//System.out.println("hours = "+hours);
		long minute = minutes % 60;
		StringBuffer str = new StringBuffer("");
		if (minute < 10) {
			str.append(hours + ".0" + minute);
		} else {
			str.append(hours + "." + minute);
		}
		// System.out.println("str = "+str);
		return str.toString();
	}

	/**
	 *        Ids
	 * 
	 * @param idsString id   
	 * @param spiltCode     
	 * @return ids
	 * @author lqy
	 */
	@Bizlet()
	public static int[] getIdsAfterSpilt(String idsString, String spiltCode) {
		List<Integer> idList = new ArrayList<Integer>();
		if (idsString == null || idsString.trim().equals("")) {
			return null;
		} else {
			if (spiltCode == null || spiltCode.trim().equals("")) {
				spiltCode = ",";
			}
			String[] idArray = idsString.split(spiltCode);
			if (idArray != null && idArray.length > 0) {
				for (String string : idArray) {
					if (string != null && !string.trim().equals("")) {
						idList.add(Integer.parseInt(string.trim()));
					}
				}
			}
		}
		if (idList != null && idList.size() > 0) {
			int[] ids = new int[idList.size()];
			for (int j = 0; j < idList.size(); j++) {
				ids[j] = idList.get(j);
			}
			return ids;
		}
		return null;
	}
	
	/**
	 *          
	 * 
	 * @param str    
	 * @param spiltCode     
	 * @return String[]
	 * @author lqy
	 */
	@Bizlet()
	public static String[] getArrayAfterSpilt(String str, String spiltCode) {
		if (str == null || str.trim().equals("")) {
			return null;
		}else{
			if (spiltCode == null || spiltCode.trim().equals("")) {
				spiltCode = ",";
			}
			return str.split(spiltCode);
		}
	}

	/**
	 *          
	 * 
	 * @param str    
	 * @return str
	 * @author lqy
	 */
	@Bizlet()
	public static String removeLastCode(String str) {
		if (str == null || str.trim().equals("")) {
			str = "";
		} else {
			str = str.trim().substring(0, (str.trim().length() - 1));
		}
		return str;
	}

	/**
	 *     
	 * 
	 * @param str    
	 * @param oldCode         
	 * @param newCode       
	 * @return str
	 * @author lqy
	 */
	@Bizlet()
	public static String replaceCode(String str, String oldCode, String newCode) {
		if (str != null && !str.trim().equals("")) {
			if (oldCode == null || oldCode.trim().equals("")) {
				oldCode = " ";
			}
			if (newCode == null) {
				newCode = "";
			}
			str = str.trim().replaceAll(oldCode, newCode);
		}
		return str;
	}

	/**
	 *      id
	 * 
	 * @param str    
	 * @return id
	 * @author lqy
	 */
	@Bizlet()
	public static String getFirstId(String str, String spiltCode) {
		if (spiltCode == null) {
			spiltCode = ",";
		}
		if (str.indexOf(spiltCode) > -1) {
			str = str.substring(0, str.indexOf(spiltCode));
		}
		return str.trim();
	}

	/**
	 *              
	 * @param originalStr     
	 * @param deleteStr         
	 * @return string
	 * @author lqy
	 */
	@Bizlet()
	public static String removeSamePart(String originalStr, String deleteStr) {
		if (originalStr != null && deleteStr != null) {
			originalStr = originalStr.replaceAll("\\(", "(");
			originalStr = originalStr.replaceAll("\\)", ")");
			originalStr = originalStr.replaceAll(" | ", "");
			deleteStr = deleteStr.replaceAll("\\(", "(");
			deleteStr = deleteStr.replaceAll("\\)", ")");
			deleteStr = deleteStr.replaceAll(" | ", "");
			if (originalStr.indexOf(deleteStr) > -1) {
				originalStr = originalStr.replaceAll(deleteStr, "");
			}
		}
		return originalStr;
	}


	/**
	 *       
	 * 
	 * @param startDate       ,Null      
	 * @param days      
	 * @return Date
	 * @author lqy
	 */
	@Bizlet()
	public static Date getDate(Date startDate, int days) {
		if (startDate == null) {
			startDate = new Date();
		}
		Calendar c = Calendar.getInstance();
		c.setTime(startDate);
		c.set(Calendar.DATE, c.get(Calendar.DATE) + days);
		return c.getTime();
	}
	
	/**
	 *                
	 * 
	 * @param startDate       ,Null      
	 * @param years      
	 * @return Date
	 * @author lqy
	 */
	@Bizlet()
	public static Date getDifferYearDate(Date startDate, int years) {
		if (startDate == null) {
			startDate = new Date();
		}
		Calendar c = Calendar.getInstance();
		c.setTime(startDate);
		c.set(Calendar.YEAR, c.get(Calendar.YEAR) + years);
		return c.getTime();
	}
	
	/**
	 *     (  myDate>compareDate  1,<  -1,    0)
	 * 
	 * @param myDate   
	 * @param compareDate       
	 * @return int
	 * @author lqy
	 */
	@Bizlet()
	public static int dateCompare(Date myDate, Date compareDate) {
		Calendar myCal = Calendar.getInstance();
		Calendar compareCal = Calendar.getInstance();
		myCal.setTime(myDate);
		compareCal.setTime(compareDate);
		return myCal.compareTo(compareCal);
	} 
	
	/**
	 *             ,   1,   0(     )
	 * @param licenceNo    
	 * @return String
	 * @author lqy
	 */
	@Bizlet()
	public static int isAssistant(String licenceNo) {
		int result = 1;
		if(licenceNo.toLowerCase().indexOf("jz") < 0){
			result = 0;
		}
		return result;
	}
		
	@Bizlet()
	public static String formatTime(Date date, String pattern) {
		if(pattern == null || pattern.trim().equals("")){
			pattern = "yyyy MM ";
			//pattern = "yyyy MM dd  HH mm ss ";
		}
		return new SimpleDateFormat(pattern).format(date);
	}

 
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
고구마 요 2015 년 6 월 1 일 17:20:44 월요일

좋은 웹페이지 즐겨찾기