Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐:
搜索:
您的位置: Linux安全网 > Linux集群 > Architecture > » 正文

设计方法

来源: Jxdwuao 分享至:


private void fixDateList(List<SchDateParam> dateList){

SchDateParam dateParam = new SchDateParam();

List<Date> restDateList = new ArrayList<Date>();
if(rest_date1.getValue()!= null){restDateList.add(rest_date1.getValue());}
if(rest_date2.getValue()!= null){restDateList.add(rest_date2.getValue());}
if(rest_date3.getValue()!= null){restDateList.add(rest_date3.getValue());}
if(rest_date4.getValue()!= null){restDateList.add(rest_date4.getValue());}

int restIndex = 0; //当前在第几个休息日区间段内

//计算本套组的开始时间 / 结束时间列表
Date iStart = start_date.getValue();
//如果有休息日期, 而且休息日期的时间<开始日期的后3天,那么开始日期就是休息后开始(小于3天不够安排场次)
if(restDateList.size() > 0){
if(cn.sh.cares.core.utils.DateUtils.getDateIntervalDays(restDateList.get(0), start_date.getValue())<3){
iStart = DateUtils.addDays(restDateList.get(0), 1);//休息后开始
restIndex = fixRestIndex(restIndex, restDateList.size());
}
}
Date iEnd = DateUtils.addDays(iStart, 4);

if(restIndex < restDateList.size()){//如果还处于休息间断内,需要按照休息日计算该时间段内的结束日期, 否则直接按照结束日期计算
Date restEndDate = DateUtils.addDays(restDateList.get(restIndex), -2);
if(cn.sh.cares.core.utils.DateUtils.getDateIntervalDays(iEnd, restEndDate)>=0){
iEnd = end_date.getValue();
}
}else{
if(cn.sh.cares.core.utils.DateUtils.getDateIntervalDays(iEnd, end_date.getValue())>=0){
iEnd = end_date.getValue();
}
}

dateParam.setiStart(iStart);
dateParam.setiEnd(iEnd);

dateList.add(dateParam);

while(cn.sh.cares.core.utils.DateUtils.getDateIntervalDays(iEnd, end_date.getValue())<0){

SchDateParam dateParami = new SchDateParam();

iStart = DateUtils.addDays(iEnd, 2);
iEnd = DateUtils.addDays(iStart, 4);

if(restIndex < restDateList.size()){//如果还处于休息间断内,需要按照休息日计算该时间段内的结束日期, 否则直接按照结束日期计算
Date restEndDate = DateUtils.addDays(restDateList.get(restIndex), -2);
if(cn.sh.cares.core.utils.DateUtils.getDateIntervalDays(iEnd, restEndDate)>=0){
iEnd = end_date.getValue();
restIndex = fixRestIndex(restIndex, restDateList.size()); //修正索引
}
}else{
if(cn.sh.cares.core.utils.DateUtils.getDateIntervalDays(iEnd, end_date.getValue())>=0){
iEnd = end_date.getValue();
}
}
/*
if(cn.sh.cares.core.utils.DateUtils.getDateIntervalDays(iEnd, end_date.getValue())>=0){
iEnd = end_date.getValue();
}
*/
dateParami.setiStart(iStart);
dateParami.setiEnd(iEnd);

dateList.add(dateParami);
}
}

public void simSuitStart() throws Exception {

List<SchDateParam> dateList = new ArrayList<SchDateParam>();

Integer batchNo = 1;

if(cn.sh.cares.core.utils.DateUtils.getDateIntervalDays(end_date.getValue(), start_date.getValue())<=0){
alert("结束日期至少比开始日期大1天");
return;
}

if(rest_date1.getValue() != null){
if(chkRestDateInput()){
return;
}
}

//计算本套组的开始时间 / 结束时间列表
fixDateList(dateList);
/*
for(SchDateParam schDateParam : dateList){
int suitcountnum = fixSuitNum(schDateParam.getiStart(), schDateParam.getiEnd());

for(Integer i=0; i < suit_num.getValue(); i++){//循环套组数
List<SuitAdminView> suitList = genA320SuitList(suitcountnum);

//设置批次号, 日期
SuitAdminView suitAdminView0 = suitList.get(0);
suitAdminView0.setBatch_no(batchNo.toString());
suitAdminView0.getTraining_simDesViewList()[0].setS_date(schDateParam.getiStart());

if(suitcountnum > 1){//执行多套组添加
simSuitService.doManulSaveA320SimSuit(suitList, false);
continue;
}

//设置单套组日期
suitAdminView0.getTraining_simDesViewList()[1].setS_date(DateUtils.addDays(schDateParam.getiStart(), 1));
suitAdminView0.getTraining_simDesViewList()[2].setS_date(DateUtils.addDays(schDateParam.getiStart(), 2));
//设置单套组场次类型
for(int simi = 1; simi <= suitAdminView0.getTraining_simDesViewList().length; simi ++){
if(simi == 3){
suitAdminView0.getTraining_simDesViewList()[simi - 1].setS_type("E");
}else{
suitAdminView0.getTraining_simDesViewList()[simi - 1].setS_type("T");
}
}

fixBenchMonthAndCheckinDate(suitAdminView0);

simSuitService.doManulSaveSimSuit(suitAdminView0, false);

}

batchNo += suitcountnum;

}
*/
}


Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史