- 浏览: 34295 次
- 性别:
- 来自: 成都
TimeIntervalBean
ClickToCallBean
Test
package com.test; import java.util.ArrayList; import java.util.Calendar; import java.util.List; public class TimeIntervalBean{ private Calendar currentCalendar; private Calendar initialTimeCalendar; private Calendar terminalTimeCalendar; private Boolean isWeekendToday = Boolean.FALSE; private Boolean isWeekendNextday = Boolean.FALSE; private Calendar initialTimeCalendarNextday; private Calendar terminalTimeCalendarNextday; private Calendar endTimeCalendar; private int field; private int roundInterval; private int firstTimeInterval; private int subTimeInterval; private List startTimeList = new ArrayList(); private List endTimeList = new ArrayList(); public int getSubTimeInterval() { return subTimeInterval; } public void setSubTimeInterval(int subTimeInterval) { this.subTimeInterval = subTimeInterval; } public Calendar getCurrentCalendar() { return currentCalendar; } public void setCurrentCalendar(Calendar currentCalendar) { this.currentCalendar = currentCalendar; } public Calendar getInitialTimeCalendar() { return initialTimeCalendar; } public void setInitialTimeCalendar(Calendar initialTimeCalendar) { this.initialTimeCalendar = initialTimeCalendar; } public Calendar getTerminalTimeCalendar() { return terminalTimeCalendar; } public void setTerminalTimeCalendar(Calendar terminalTimeCalendar) { this.terminalTimeCalendar = terminalTimeCalendar; } public Calendar getEndTimeCalendar() { return endTimeCalendar; } public void setEndTimeCalendar(Calendar endTimeCalendar) { this.endTimeCalendar = endTimeCalendar; } public int getField() { return field; } public void setField(int field) { this.field = field; } public int getRoundInterval() { return roundInterval; } public void setRoundInterval(int roundInterval) { this.roundInterval = roundInterval; } public int getFirstTimeInterval() { return firstTimeInterval; } public void setFirstTimeInterval(int firstTimeInterval) { this.firstTimeInterval = firstTimeInterval; } public List getStartTimeList() { return startTimeList; } public void setStartTimeList(List startTimeList) { this.startTimeList = startTimeList; } public List getEndTimeList() { return endTimeList; } public void setEndTimeList(List endTimeList) { this.endTimeList = endTimeList; } public Boolean getIsWeekendToday() { return isWeekendToday; } public void setIsWeekendToday(Boolean isWeekendToday) { this.isWeekendToday = isWeekendToday; } public Boolean getIsWeekendNextday() { return isWeekendNextday; } public void setIsWeekendNextday(Boolean isWeekendNextday) { this.isWeekendNextday = isWeekendNextday; } public Calendar getInitialTimeCalendarNextday() { return initialTimeCalendarNextday; } public void setInitialTimeCalendarNextday(Calendar initialTimeCalendarNextday) { this.initialTimeCalendarNextday = initialTimeCalendarNextday; } public Calendar getTerminalTimeCalendarNextday() { return terminalTimeCalendarNextday; } public void setTerminalTimeCalendarNextday(Calendar terminalTimeCalendarNextday) { this.terminalTimeCalendarNextday = terminalTimeCalendarNextday; } }
ClickToCallBean
package com.test; import java.util.List; public class ClickToCallBean { private String subBusiness; private String timeZone; private String customerNumber; private String preferLanguage; private List preferLanguageList; private String countryCode; private String areaCode; private String phoneNumber; private String extensionNumber; private Boolean isCusomterMobile; private String enquirySubject; private List enquirySubjectList; private String enquiryDetails; private String callBackTime; private List callBackTimeList; private String callBackStartTime; private String callBackEndTime; private List startTimeList; private List endTimeList; private String confirmNumber; private Boolean hasErrorFlag = Boolean.FALSE; public String getTimeZone() { return timeZone; } public void setTimeZone(String timeZone) { if (timeZone != null) { this.timeZone = timeZone ; } } public String getCustomerNumber() { return customerNumber; } public void setCustomerNumber(String customerNumber) { this.customerNumber = customerNumber ; } public String getPreferLanguage() { return preferLanguage; } public void setPreferLanguage(String preferLanguage) { this.preferLanguage = preferLanguage ; } public List getPreferLanguageList() { return preferLanguageList; } public void setPreferLanguageList(List preferLanguageList) { this.preferLanguageList = preferLanguageList; } public String getCountryCode() { return countryCode; } public void setCountryCode(String countryCode) { this.countryCode = countryCode ; } public String getAreaCode() { return areaCode; } public void setAreaCode(String areaCode) { this.areaCode = areaCode ; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber ; } public String getExtensionNumber() { return extensionNumber; } public void setExtensionNumber(String extensionNumber) { this.extensionNumber = extensionNumber ; } public Boolean getIsCusomterMobile() { return isCusomterMobile; } public void setIsCusomterMobile(Boolean isCusomterMobile) { this.isCusomterMobile = isCusomterMobile; } public String getEnquirySubject() { return enquirySubject; } public void setEnquirySubject(String enquirySubject) { this.enquirySubject = enquirySubject ; } public List getEnquirySubjectList() { return enquirySubjectList; } public void setEnquirySubjectList(List enquirySubjectList) { this.enquirySubjectList = enquirySubjectList; } public String getEnquiryDetails() { return enquiryDetails; } public void setEnquiryDetails(String enquiryDetails) { this.enquiryDetails = enquiryDetails ; } public String getCallBackTime() { return callBackTime; } public void setCallBackTime(String callBackTime) { this.callBackTime = callBackTime ; } public List getCallBackTimeList() { return callBackTimeList; } public void setCallBackTimeList(List callBackTimeList) { this.callBackTimeList = callBackTimeList; } public String getCallBackStartTime() { return callBackStartTime; } public void setCallBackStartTime(String callBackStartTime) { this.callBackStartTime = callBackStartTime ; } public String getCallBackEndTime() { return callBackEndTime; } public void setCallBackEndTime(String callBackEndTime) { this.callBackEndTime = callBackEndTime ; } public String getConfirmNumber() { return confirmNumber; } public void setConfirmNumber(String confirmNumber) { this.confirmNumber = confirmNumber ; } public Boolean getHasErrorFlag() { return hasErrorFlag; } public void setHasErrorFlag(Boolean hasErrorFlag) { this.hasErrorFlag = hasErrorFlag; } public List getStartTimeList() { return startTimeList; } public void setStartTimeList(List startTimeList) { this.startTimeList = startTimeList; } public List getEndTimeList() { return endTimeList; } public void setEndTimeList(List endTimeList) { this.endTimeList = endTimeList; } public String getSubBusiness() { return subBusiness; } public void setSubBusiness(String subBusiness) { this.subBusiness = subBusiness ; } }
Test
package com.test.change; import java.text.ParseException; import java.util.Arrays; import java.util.Calendar; import java.util.List; import java.util.TimeZone; public class Test { public static void generateCallBackTimeList() throws ParseException{ Calendar cal =Calendar.getInstance(); TimeIntervalBean timeIntervalBean = new TimeIntervalBean(); ClickToCallBean ctcBean = new ClickToCallBean(); timeIntervalBean.setField(Calendar.MINUTE); timeIntervalBean.setRoundInterval(30); timeIntervalBean.setFirstTimeInterval(30); timeIntervalBean.setSubTimeInterval(30); String saturdayInitialTime = "00:00"; String saturdayTerminalTime = "24:00"; String saturdayInitialTimeArray[] = saturdayInitialTime.split(":"); String saturdayTerminalTimeArray[] = saturdayTerminalTime.split(":"); String sundayInitialTime = "06:00"; String sundayTerminalTime = "24:00"; String sundayInitialTimeArray[] = sundayInitialTime.split(":"); String sundayTerminalTimeArray[] = sundayTerminalTime.split(":"); String initialTime = "00:00"; String terminalTime = "24:00"; String initialTimeArray[] = initialTime.split(":"); String terminalTimeArray[] = terminalTime.split(":"); TimeZone timeZone=cal.getTimeZone(); TimeZone.setDefault(timeZone); ctcBean.setTimeZone(timeZone.getID()); Calendar currentCalendar = Calendar.getInstance(timeZone); // String noServiceDate="7,1"; // // // String []noServiceDateArray=null; // if( noServiceDate!=null || !"".equals(noServiceDate)){ // noServiceDateArray =noServiceDate.split(",");//1 7 // } // // TimeZone timeZone = businessUnit.getToolkit().getDateTimeFormatter().getCurrentCalendar((Locale)baseProfile.getProperty(BaseProfile.LOCALE), true).getTimeZone(); // TimeZone.setDefault(timeZone); int initialTimeHour = Integer.valueOf(initialTimeArray[0]).intValue(); int initialTimeMinutes = Integer.valueOf(initialTimeArray[1]).intValue(); int terminalTimeHour = Integer.valueOf(terminalTimeArray[0]).intValue(); int terminalTimeMinutes = Integer.valueOf(terminalTimeArray[1]).intValue(); // Arrays.binarySearch(noServiceDateArray, dayOfWeek)>=0 if(String.valueOf(currentCalendar.get(Calendar.DAY_OF_WEEK)).equals("6")){ System.out.println("11111111"); initialTimeHour = Integer.valueOf(saturdayInitialTimeArray[0]).intValue(); initialTimeMinutes = Integer.valueOf(saturdayInitialTimeArray[1]).intValue(); terminalTimeHour = Integer.valueOf(saturdayTerminalTimeArray[0]).intValue(); terminalTimeMinutes = Integer.valueOf(saturdayTerminalTimeArray[1]).intValue(); } if(String.valueOf(currentCalendar.get(Calendar.DAY_OF_WEEK)).equals("7")){ System.out.println("222222222"); initialTimeHour = Integer.valueOf(sundayInitialTimeArray[0]).intValue(); initialTimeMinutes = Integer.valueOf(sundayInitialTimeArray[1]).intValue(); terminalTimeHour = Integer.valueOf(sundayTerminalTimeArray[0]).intValue(); terminalTimeMinutes = Integer.valueOf(sundayTerminalTimeArray[1]).intValue(); } //Initial CITI Operating Time based on values getting from Rule Calendar initialTimeCalendar = Calendar.getInstance(timeZone); initialTimeCalendar.set(Calendar.HOUR_OF_DAY, initialTimeHour); initialTimeCalendar.set(Calendar.MINUTE, initialTimeMinutes); Calendar terminalTimeCalendar = Calendar.getInstance(timeZone); terminalTimeCalendar.set(Calendar.HOUR_OF_DAY, terminalTimeHour); terminalTimeCalendar.set(Calendar.MINUTE, terminalTimeMinutes); timeIntervalBean.setCurrentCalendar(currentCalendar); timeIntervalBean.setInitialTimeCalendar(initialTimeCalendar); timeIntervalBean.setTerminalTimeCalendar(terminalTimeCalendar); Calendar initialNextDay = Calendar.getInstance(timeZone); initialNextDay.add(Calendar.DAY_OF_WEEK, 1); Calendar terminalNextDay = Calendar.getInstance(timeZone); terminalNextDay.add(Calendar.DAY_OF_WEEK, 1); int initialTimeHourWeekEnd = Integer.valueOf(initialTimeArray[0]).intValue(); int initialTimeMinutesWeekEnd = Integer.valueOf(initialTimeArray[1]).intValue(); int terminalTimeHourNextday = Integer.valueOf(terminalTimeArray[0]).intValue(); int terminalTimeMinutesNextday = Integer.valueOf(terminalTimeArray[1]).intValue(); if(String.valueOf(initialNextDay.get(Calendar.DAY_OF_WEEK)).equals("6")){ // if(initialNextDay.get(Calendar.DAY_OF_WEEK) ==Integer.parseInt(noServiceDateArray[0]) || initialNextDay.get(Calendar.DAY_OF_WEEK) == Integer.parseInt(noServiceDateArray[1])){ //timeIntervalBean.setIsWeekendNextday(Boolean.TRUE); initialTimeHourWeekEnd = Integer.valueOf(saturdayInitialTimeArray[0]).intValue(); initialTimeMinutesWeekEnd = Integer.valueOf(saturdayInitialTimeArray[1]).intValue(); terminalTimeHourNextday = Integer.valueOf(saturdayTerminalTimeArray[0]).intValue(); terminalTimeMinutesNextday = Integer.valueOf(saturdayTerminalTimeArray[1]).intValue(); } if(String.valueOf(initialNextDay.get(Calendar.DAY_OF_WEEK)).equals("7")){ // if(initialNextDay.get(Calendar.DAY_OF_WEEK) ==Integer.parseInt(noServiceDateArray[0]) || initialNextDay.get(Calendar.DAY_OF_WEEK) == Integer.parseInt(noServiceDateArray[1])){ //timeIntervalBean.setIsWeekendNextday(Boolean.TRUE); initialTimeHourWeekEnd = Integer.valueOf(sundayInitialTimeArray[0]).intValue(); initialTimeMinutesWeekEnd = Integer.valueOf(sundayInitialTimeArray[1]).intValue(); terminalTimeHourNextday = Integer.valueOf(sundayTerminalTimeArray[0]).intValue(); terminalTimeMinutesNextday = Integer.valueOf(sundayTerminalTimeArray[1]).intValue(); } initialNextDay.set(Calendar.HOUR_OF_DAY, initialTimeHourWeekEnd); initialNextDay.set(Calendar.MINUTE, initialTimeMinutesWeekEnd); terminalNextDay.set(Calendar.HOUR_OF_DAY, terminalTimeHourNextday); terminalNextDay.set(Calendar.MINUTE, terminalTimeMinutesNextday); timeIntervalBean.setInitialTimeCalendarNextday(initialNextDay); timeIntervalBean.setTerminalTimeCalendarNextday(terminalNextDay); //Initial the last EndTime round 24 hours based on current Time. Calendar endTimeCalendar = Calendar.getInstance(timeZone); // endTimeCalendar.setTime(date); endTimeCalendar.add(Calendar.DAY_OF_MONTH, 1); System.out.println(endTimeCalendar.getTime()+"endTimeCalendar"); if(endTimeCalendar.after(terminalNextDay)){ endTimeCalendar = terminalNextDay; } else if(endTimeCalendar.before(initialNextDay)){ endTimeCalendar = initialNextDay; } timeIntervalBean.setEndTimeCalendar(endTimeCalendar); generateCallBackTimeList(timeIntervalBean); List startTimeList =timeIntervalBean.getStartTimeList(); List endTimeList =timeIntervalBean.getEndTimeList(); for(int i=0;i<startTimeList.size();i++){ System.out.println(startTimeList.get(i)+"-----------"+endTimeList.get(i)); } ctcBean.setStartTimeList(timeIntervalBean.getStartTimeList()); ctcBean.setEndTimeList(timeIntervalBean.getEndTimeList()); } private static void generateCallBackTimeList(TimeIntervalBean timeIntervalBean){ int roundInterval = timeIntervalBean.getRoundInterval(); int firstTimeInterval = timeIntervalBean.getFirstTimeInterval(); int subTimeInterval = timeIntervalBean.getSubTimeInterval(); //Non-operating TimeMillis is used for calculating SubTimeInterval options recurring times int invalidTimeMillis = (int)(timeIntervalBean.getInitialTimeCalendarNextday().getTimeInMillis() - timeIntervalBean.getTerminalTimeCalendar().getTimeInMillis()); Calendar currentCalendar = timeIntervalBean.getCurrentCalendar(); if(currentCalendar.before(timeIntervalBean.getInitialTimeCalendar())){ currentCalendar = timeIntervalBean.getInitialTimeCalendar(); } //Generate StartTime of CallBackTimeList based on RoundInterval value from Rule if(roundInterval != 0){ int tempInterval = currentCalendar.get(timeIntervalBean.getField()) + roundInterval; currentCalendar.set(Calendar.MINUTE, roundInterval*((int)(tempInterval/roundInterval) ) ); } //Generate First TimeInterval option timeIntervalBean.setCurrentCalendar(currentCalendar); generateList(timeIntervalBean, firstTimeInterval, 1); //Generate Sub TimeInterval options //the recurringTime is calculated via LastEndTimeRound24Hours - currentRecurringTime - Non-operatingTime Calendar endTimeCalendar = timeIntervalBean.getEndTimeCalendar(); long totalTimeInMillis = endTimeCalendar.getTimeInMillis() - currentCalendar.getTimeInMillis() - invalidTimeMillis; int subTimeIntervalRecuringTimes = (int)totalTimeInMillis / (subTimeInterval*60*1000) ; generateList(timeIntervalBean, subTimeInterval, subTimeIntervalRecuringTimes); } /** * * @param timeIntervalBean * @param interval * @param recurringTimes */ private static void generateList(TimeIntervalBean timeIntervalBean, int interval, int recurringTimes){ List startTimeList = timeIntervalBean.getStartTimeList(); List endTimeList = timeIntervalBean.getEndTimeList(); //Calendar initialTimeCalendar = timeIntervalBean.getInitialTimeCalendar(); Calendar currentCalendar = timeIntervalBean.getCurrentCalendar(); Calendar endTimeCalendar = timeIntervalBean.getEndTimeCalendar(); Calendar tempEndTimeCalendar = Calendar.getInstance(currentCalendar.getTimeZone()); Calendar terminalTimeCalendar = timeIntervalBean.getTerminalTimeCalendar(); for(int i=0; i<recurringTimes; i++){ /* * If TemporaryCalendar after increasing interval based on currentCalendar is after CITI Operating EndTime, * step to CITI Operating StartTime of second day */ tempEndTimeCalendar.setTimeInMillis(currentCalendar.getTimeInMillis() + interval*60*1000); if(tempEndTimeCalendar.after(timeIntervalBean.getTerminalTimeCalendar())){ currentCalendar = timeIntervalBean.getInitialTimeCalendarNextday(); terminalTimeCalendar = timeIntervalBean.getTerminalTimeCalendarNextday(); } /* * If TemporaryCalendar after increasing interval based on currentCalendar is after the last EndTime round 24Hours based on currentTime, * break recurring */ if(tempEndTimeCalendar.after(endTimeCalendar)){ System.err.println("tempEndTimeCalendar "+tempEndTimeCalendar.getTime()); System.err.println("111111111"); break; } //Generate StartTime & EndTime and add into List startTimeList.add(currentCalendar.getTime()); currentCalendar.add(Calendar.MINUTE, interval); endTimeList.add(currentCalendar.getTime()); } timeIntervalBean.setStartTimeList(startTimeList); timeIntervalBean.setEndTimeList(endTimeList); timeIntervalBean.setTerminalTimeCalendar(terminalTimeCalendar); timeIntervalBean.setCurrentCalendar(currentCalendar); } public static void main(String[] args) throws ParseException { // Map map =new HashMap(); // map.put("1", "1V"); // map.put("2", "2V"); // map.put("3", "3V"); // StringBuffer test=new StringBuffer(); // String key=""; // String value=""; // Set set = map.keySet();set.size(); // Iterator it =set.iterator(); // while(it.hasNext()){ // key = (String)it.next(); // value = (String)map.get(key); // test.append(key).append("=").append(value).append("="); // } // // String rs = test.substring(0, test.lastIndexOf("=")); // System.out.println(test); // test(); generateCallBackTimeList(); // Calendar cal=Calendar.getInstance(); // cal.setTime(new Date()); // System.out.println("hh:"+cal.get(Calendar.HOUR_OF_DAY)+" mm:"+cal.get(Calendar.MINUTE)); } }
发表评论
-
sss
2013-10-10 12:16 914package com.zhuyang.test; impo ... -
遍历文件
2013-06-05 16:14 516package test.io; import ... -
java 生产消费者
2013-05-06 21:17 770package com.zhuyang.test.cons ... -
单例模式是否线程安全
2013-05-06 20:26 973今天领导问了个问题说单例模式中,对象的变量是否是线程安全的。起 ... -
JKS生成数字签名+JBOSS配置SSL
2013-02-20 15:33 1572第一步: 生成JKS文件 配置环境 JAVA_HOME ... -
X509TrustManager 接口
2012-01-08 23:12 2182public class MyTrustManager i ... -
sso 加密
2011-09-27 14:34 1421package com.citi.test; impo ... -
java post请求跳过证书验证
2011-09-27 14:32 3177import java.io.BufferedR ... -
StringUtils用法
2011-03-28 21:27 808StringUtils 方法的操作对象是 java.lan ...
相关推荐
### SystemVerilog时间槽(Time Slot)与事件区域(Event Regions) #### 引言 SystemVerilog作为一种扩展自Verilog的高级硬件描述语言,在验证领域提供了丰富的特性来提高设计的可验证性和验证效率。其中,事件...
C语言头文件 TIMESLOTC语言头文件 TIMESLOTC语言头文件 TIMESLOTC语言头文件 TIMESLOTC语言头文件 TIMESLOTC语言头文件 TIMESLOTC语言头文件 TIMESLOTC语言头文件 TIMESLOTC语言头文件 TIMESLOTC语言头文件 ...
介紹nordic timeslot api的中文講義, 內容寫得很清楚, 可以更清楚的明白架構與timeslot api的使用方法
资源分类:Python库 所属语言:Python 资源全名:uwosh.timeslot-1.4.8.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
时隙cal2 本自述文件概述了与此Ember应用程序进行协作的细节。 此应用程序的简短介绍可以轻松地转到此处。 先决条件 您需要在计算机上正确安装以下物品。 (带有NPM) 安装 git clone 此存储库 ...
matlAB时隙互同步主函数 ,可以参考参考,挺有用
To ensure the extremely high reliability and real-time operation performance of Automated Guided Vehicle (AGV), an.error correction method with adaptive time slot along with operation speed was ...
A novel multiple-channels scheduling algorithm based on timeslot optimization in the advanced orbiting systems
public static boolean overlapped(TimeSlot slot1, TimeSlot slot2) { TimeSlot previous, next; previous = slot1.startTime.isBefore(slot2.startTime) ? slot1 : slot2; next = slot2.startTime.isAfter...
时隙配置是TD-SCDMA无线网络的时隙参数,包括TIME SLOT CONFIGURATION、Time Slot LCR、Time Slot Status、Time Slot Direction等。这些参数决定了小区的时隙分配和使用方式。 * TIME SLOT CONFIGURATION:时隙配置...
体操运动员一个新的Flutter项目。入门该项目是Flutter应用程序的起点。 如果这是您的第一个Flutter项目,那么有一些资源可以帮助您入门:要获得Flutter入门方面的帮助,请查看我们的,其中提供了教程,示例,有关...
e128channel-set0timeslot-list1-31 e143channel-set0timeslot-list1-31 e146channel-set0timeslot-list1-31 e149channel-set0timeslot-list1-31 ``` 这部分配置了控制器Cpos3/2/0,并设置了多个E1通道集,每个通道...
exec-timeout 0 0 ! line vty 0 4 end 六、配置静态路由 通过配置静态路由,用户可以人为地指定对某一网络访问时所要经过的路径,在网络结构比较简单,且一般到达某一网络所经过的路径唯一的情况下采用静态...
例如,我们可以创建一个名为`TeachingAssistantSchedule`的表,包含`TAName`, `DayOfWeek`, `TimeSlot`, `StartWeek`, `EndWeek`, 和 ` Classroom`等字段。 ```sql CREATE TABLE TeachingAssistantSchedule ( ID ...
面向复用的设计:Timeslot 是指在 PlanningEntry<R> 中设计一个 Timeslot 类,以便实现面向复用的设计。 面向复用的设计:EntryState 及 State 设计模式 面向复用的设计:EntryState 及 State 设计模式是指在 ...