Commit 40d74606 authored by 李博今's avatar 李博今

修改导入排课,返回学期名

parent 7a9daab3
...@@ -89,3 +89,8 @@ ALTER TABLE `b_term` ...@@ -89,3 +89,8 @@ ALTER TABLE `b_term`
ALTER TABLE `s_user` ALTER TABLE `s_user`
DROP COLUMN `agency_code`, DROP COLUMN `agency_code`,
DROP COLUMN `is_created`; DROP COLUMN `is_created`;
/*新增周日*/
ALTER TABLE `b_schedule_dto`
ADD COLUMN `sunday` varchar(64) NULL AFTER `sub_agency_id`;
...@@ -19,14 +19,14 @@ public interface BArrangeRepository extends BaseMapper<BArrange> { ...@@ -19,14 +19,14 @@ public interface BArrangeRepository extends BaseMapper<BArrange> {
//企业人员查看自身公司的排课信息------------------------------------------------------------------------------------- //企业人员查看自身公司的排课信息-------------------------------------------------------------------------------------
@Select("<script>select b_arrange.business_id,term_code,description,agency_code,b_arrange.status from b_arrange " @Select("<script>select b_arrange.business_id,term_code,b_term.name as term_name,description,agency_code,b_arrange.status from b_arrange "
+ "LEFT JOIN b_subtask ON b_arrange.business_id = b_subtask.arrange_id " + "LEFT JOIN b_subtask ON b_arrange.business_id = b_subtask.arrange_id "
+ "LEFT JOIN b_sub_agency ON b_subtask.business_id = b_sub_agency.subtask_id " + "LEFT JOIN b_sub_agency ON b_subtask.business_id = b_sub_agency.subtask_id "
+ "LEFT JOIN b_term ON b_term.code = b_arrange.term_code "
+ "where 1=1 and agency_code = #{agencyCode} " + "where 1=1 and agency_code = #{agencyCode} "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> " + "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> " + "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "<if test=\"status !=null and status != '' \">and FIND_IN_SET(b_arrange.`status`,#{status}) </if> " + "<if test=\"status !=null and status != '' \">and FIND_IN_SET(b_arrange.`status`,#{status}) </if> "
+ "GROUP BY b_arrange.business_id "
+ "order by b_arrange.status,b_arrange.create_date desc" + "order by b_arrange.status,b_arrange.create_date desc"
+ "</script>") + "</script>")
@ResultMap(value = "BaseResultMapByAgencyCode") @ResultMap(value = "BaseResultMapByAgencyCode")
......
...@@ -77,6 +77,10 @@ public class ScheduleDto extends IdEntity<ScheduleDto>{ ...@@ -77,6 +77,10 @@ public class ScheduleDto extends IdEntity<ScheduleDto>{
@NotBlank @NotBlank
private String saturday; private String saturday;
@Length(min = 1,max = 64,message = "长度最小为1,最大为64")
@NotBlank
private String sunday;
/*教室编号*/ /*教室编号*/
@Length(min = 1,max = 64,message = "长度最小为1,最大为64") @Length(min = 1,max = 64,message = "长度最小为1,最大为64")
@NotBlank @NotBlank
......
...@@ -228,10 +228,15 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -228,10 +228,15 @@ public class BArrangeServiceImpl implements BArrangeService {
//先将原来的excel数据删除 //先将原来的excel数据删除
ArrayList<ScheduleDto> scheduleDtos = new ArrayList<ScheduleDto>(); ArrayList<ScheduleDto> scheduleDtos = new ArrayList<ScheduleDto>();
Boolean contanSunday = ExcelUtil.containSunday(hwb);
String[] headers = {"方案计划名","方案人数","方案课组","课程号","课程名","开课院系","课程属性","总学分","总学时", String[] headers = {"方案计划名","方案人数","方案课组","课程号","课程名","开课院系","课程属性","总学分","总学时",
"授课学时","上机学时","实验学时","考试类型","任课教师", "教师编号","教学班组名","教学班组编号","周次","周学时","周一", "授课学时","上机学时","实验学时","考试类型","任课教师", "教师编号","教学班组名","教学班组编号","周次","周学时","周一",
"周二","周三","周四","周五","周六","上课地点","教室编号","备注"}; "周二","周三","周四","周五","周六","上课地点","教室编号","备注"};
if(contanSunday){
headers = new String[]{"方案计划名", "方案人数", "方案课组", "课程号", "课程名", "开课院系", "课程属性", "总学分", "总学时",
"授课学时", "上机学时", "实验学时", "考试类型", "任课教师", "教师编号", "教学班组名", "教学班组编号", "周次", "周学时", "周一",
"周二", "周三", "周四", "周五", "周六","周日", "上课地点", "教室编号", "备注"};
}
ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,2); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,2); //获取excel数据
if (values.size()<=0){ if (values.size()<=0){
...@@ -284,19 +289,35 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -284,19 +289,35 @@ public class BArrangeServiceImpl implements BArrangeService {
} }
//判断4:根据教室编号查询是否有此教室; //判断4:根据教室编号查询是否有此教室;
if(value[26].equals("")){ //如果存在星期日,向后推一格
value[26] = wholeValue[26]; if(contanSunday){
} if(value[27].equals("")){
if(bRoomsRepository.selectOne(new BRooms(value[26]))==null){ value[27] = wholeValue[27];
roomCodes.add(value[26]); }
continue; if(bRoomsRepository.selectOne(new BRooms(value[27]))==null){
roomCodes.add(value[27]);
continue;
}
}else {
if(value[26].equals("")){
value[26] = wholeValue[26];
}
if(bRoomsRepository.selectOne(new BRooms(value[26]))==null){
roomCodes.add(value[26]);
continue;
}
} }
//合法:通过了四次判断,证明可建立该排课 //合法:通过了四次判断,证明可建立该排课
scheduleDto.setLessonCode(value[3]); scheduleDto.setLessonCode(value[3]);
scheduleDto.setTeacherCode(value[14]); scheduleDto.setTeacherCode(value[14]);
scheduleDto.setClassCode(value[16]); scheduleDto.setClassCode(value[16]);
scheduleDto.setRoomCode(value[26]); if(contanSunday){
scheduleDto.setRoomCode(value[27]);
}else{
scheduleDto.setRoomCode(value[26]);
}
scheduleDto.setWeek(value[17]); scheduleDto.setWeek(value[17]);
scheduleDto.setClassHour(value[18]); scheduleDto.setClassHour(value[18]);
scheduleDto.setMonday(value[19]); scheduleDto.setMonday(value[19]);
...@@ -305,6 +326,8 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -305,6 +326,8 @@ public class BArrangeServiceImpl implements BArrangeService {
scheduleDto.setThursday(value[22]); scheduleDto.setThursday(value[22]);
scheduleDto.setFriday(value[23]); scheduleDto.setFriday(value[23]);
scheduleDto.setSaturday(value[24]); scheduleDto.setSaturday(value[24]);
if(contanSunday)
scheduleDto.setSunday(value[25]);
scheduleDto.setSubAgencyId(subAgencyId); scheduleDto.setSubAgencyId(subAgencyId);
scheduleDto.setCommonBusinessId(); scheduleDto.setCommonBusinessId();
UserUtil.setCurrentPersistOperation(scheduleDto); UserUtil.setCurrentPersistOperation(scheduleDto);
...@@ -353,10 +376,19 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -353,10 +376,19 @@ public class BArrangeServiceImpl implements BArrangeService {
BTerm bTerm = bTermRepository.queryBtermByCode(termCode).get(0); BTerm bTerm = bTermRepository.queryBtermByCode(termCode).get(0);
//获取时间集合 //获取时间集合
Map<String,Date> timeMap = FindTime.findTime(bTerm.getStartDate(),bTerm.getEndDate()); Map<String,Date> timeMap = FindTime.findTime(bTerm.getStartDate(),bTerm.getEndDate());
Boolean contanSunday = ExcelUtil.containSunday(hwb);
String[] headers = {"方案计划名","方案人数","方案课组","课程号","课程名","开课院系","课程属性","总学分","总学时", String[] headers = {"方案计划名","方案人数","方案课组","课程号","课程名","开课院系","课程属性","总学分","总学时",
"授课学时","上机学时","实验学时","考试类型","任课教师", "教师编号","教学班组名","教学班组编号","周次","周学时","周一", "授课学时","上机学时","实验学时","考试类型","任课教师", "教师编号","教学班组名","教学班组编号","周次","周学时","周一",
"周二","周三","周四","周五","周六","上课地点","教室编号","备注"}; "周二","周三","周四","周五","周六","上课地点","教室编号","备注"};
if(contanSunday){
headers = new String[]{"方案计划名", "方案人数", "方案课组", "课程号", "课程名", "开课院系", "课程属性", "总学分", "总学时",
"授课学时", "上机学时", "实验学时", "考试类型", "任课教师", "教师编号", "教学班组名", "教学班组编号", "周次", "周学时", "周一",
"周二", "周三", "周四", "周五", "周六","周日", "上课地点", "教室编号", "备注"};
}
ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,2); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,2); //获取excel数据
if(values.get(0)[3].equals("") || values.get(0)[14].equals("") ||values.get(0)[16].equals("") ||values.get(0)[26].equals("")){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_HAS_NULL);
}
List<BSlSchedule> list = new ArrayList<>(); List<BSlSchedule> list = new ArrayList<>();
if (values.size()<=0){ if (values.size()<=0){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST); throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST);
...@@ -412,12 +444,23 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -412,12 +444,23 @@ public class BArrangeServiceImpl implements BArrangeService {
} }
//判断4:根据教室编号查询是否有此教室; //判断4:根据教室编号查询是否有此教室;
if(value[26].equals("")){ //如果存在星期日,向后推一格
value[26] = wholeValue[26]; if(contanSunday){
} if(value[27].equals("")){
if(bRoomsRepository.selectOne(new BRooms(value[26]))==null){ value[27] = wholeValue[27];
roomCodes.add(value[26]); }
continue; if(bRoomsRepository.selectOne(new BRooms(value[27]))==null){
roomCodes.add(value[27]);
continue;
}
}else {
if(value[26].equals("")){
value[26] = wholeValue[26];
}
if(bRoomsRepository.selectOne(new BRooms(value[26]))==null){
roomCodes.add(value[26]);
continue;
}
} }
String week = value[17]; String week = value[17];
...@@ -434,54 +477,62 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -434,54 +477,62 @@ public class BArrangeServiceImpl implements BArrangeService {
if(value[19].contains("-")){ if(value[19].contains("-")){
//找到这节课所对应的时间 //找到这节课所对应的时间
Date date = timeMap.get(i + ",1"); Date date = timeMap.get(i + ",1");
list.addAll(setDetail(19,value,subAgencyId,date,termCode)); list.addAll(setDetail(19,value,subAgencyId,date,termCode,contanSunday));
} }
if(value[20].contains("-")){ if(value[20].contains("-")){
Date date = timeMap.get(i + ",2"); Date date = timeMap.get(i + ",2");
list.addAll(setDetail(20,value,subAgencyId,date,termCode)); list.addAll(setDetail(20,value,subAgencyId,date,termCode,contanSunday));
} }
if(value[21].contains("-")){ if(value[21].contains("-")){
Date date = timeMap.get(i + ",3"); Date date = timeMap.get(i + ",3");
list.addAll(setDetail(21,value,subAgencyId,date,termCode)); list.addAll(setDetail(21,value,subAgencyId,date,termCode,contanSunday));
} }
if(value[22].contains("-")){ if(value[22].contains("-")){
Date date = timeMap.get(i + ",4"); Date date = timeMap.get(i + ",4");
list.addAll(setDetail(22,value,subAgencyId,date,termCode)); list.addAll(setDetail(22,value,subAgencyId,date,termCode,contanSunday));
} }
if(value[23].contains("-")){ if(value[23].contains("-")){
Date date = timeMap.get(i + ",5"); Date date = timeMap.get(i + ",5");
list.addAll(setDetail(23,value,subAgencyId,date,termCode)); list.addAll(setDetail(23,value,subAgencyId,date,termCode,contanSunday));
} }
if(value[24].contains("-")){ if(value[24].contains("-")){
Date date = timeMap.get(i + ",6"); Date date = timeMap.get(i + ",6");
list.addAll(setDetail(24,value,subAgencyId,date,termCode)); list.addAll(setDetail(24,value,subAgencyId,date,termCode,contanSunday));
}
if(contanSunday && value[25].contains("-")){
Date date = timeMap.get(i + ",7");
list.addAll(setDetail(25,value,subAgencyId,date,termCode,contanSunday));
} }
} }
}else { }else {
if(value[19].contains("-")){ if(value[19].contains("-")){
//找到这节课所对应的时间 //找到这节课所对应的时间
Date date = timeMap.get(week + ",1"); Date date = timeMap.get(week + ",1");
list.addAll(setDetail(19,value,subAgencyId,date,termCode)); list.addAll(setDetail(19,value,subAgencyId,date,termCode,contanSunday));
} }
if(value[20].contains("-")){ if(value[20].contains("-")){
Date date = timeMap.get(week + ",2"); Date date = timeMap.get(week + ",2");
list.addAll(setDetail(20,value,subAgencyId,date,termCode)); list.addAll(setDetail(20,value,subAgencyId,date,termCode,contanSunday));
} }
if(value[21].contains("-")){ if(value[21].contains("-")){
Date date = timeMap.get(week + ",3"); Date date = timeMap.get(week + ",3");
list.addAll(setDetail(21,value,subAgencyId,date,termCode)); list.addAll(setDetail(21,value,subAgencyId,date,termCode,contanSunday));
} }
if(value[22].contains("-")){ if(value[22].contains("-")){
Date date = timeMap.get(week + ",4"); Date date = timeMap.get(week + ",4");
list.addAll(setDetail(22,value,subAgencyId,date,termCode)); list.addAll(setDetail(22,value,subAgencyId,date,termCode,contanSunday));
} }
if(value[23].contains("-")){ if(value[23].contains("-")){
Date date = timeMap.get(week + ",5"); Date date = timeMap.get(week + ",5");
list.addAll(setDetail(23,value,subAgencyId,date,termCode)); list.addAll(setDetail(23,value,subAgencyId,date,termCode,contanSunday));
} }
if(value[24].contains("-")){ if(value[24].contains("-")){
Date date = timeMap.get(week + ",6"); Date date = timeMap.get(week + ",6");
list.addAll(setDetail(24,value,subAgencyId,date,termCode)); list.addAll(setDetail(24,value,subAgencyId,date,termCode,contanSunday));
}
if(contanSunday && value[25].contains("-")){
Date date = timeMap.get(week + ",7");
list.addAll(setDetail(25,value,subAgencyId,date,termCode,contanSunday));
} }
} }
//合法:通过了四次判断,证明可建立该排课 //合法:通过了四次判断,证明可建立该排课
...@@ -595,6 +646,7 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -595,6 +646,7 @@ public class BArrangeServiceImpl implements BArrangeService {
//查询此排课下是否还存在没有开课的子任务 //查询此排课下是否还存在没有开课的子任务
int count = bSubtaskRepository.judgeSubtask(arrangeId); int count = bSubtaskRepository.judgeSubtask(arrangeId);
//如果没有状态不为5的子任务,则设定此排课任务完成
if(count == 0){ if(count == 0){
BArrange bArrange = new BArrange(); BArrange bArrange = new BArrange();
bArrange.setBusinessId(arrangeId); bArrange.setBusinessId(arrangeId);
...@@ -632,7 +684,7 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -632,7 +684,7 @@ public class BArrangeServiceImpl implements BArrangeService {
} }
//设置具体信息 //设置具体信息
public List<BSlSchedule> setDetail(int i,String[] value,String subAgencyId,Date date,String termCode){ public List<BSlSchedule> setDetail(int i,String[] value,String subAgencyId,Date date,String termCode,Boolean contanSunday){
List<BSlSchedule> list = new ArrayList<>(); List<BSlSchedule> list = new ArrayList<>();
int location1 = value[i].indexOf("-"); int location1 = value[i].indexOf("-");
String start1 = value[i].substring(0,location1); String start1 = value[i].substring(0,location1);
...@@ -644,7 +696,11 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -644,7 +696,11 @@ public class BArrangeServiceImpl implements BArrangeService {
BSlSchedule bSlSchedule = new BSlSchedule(); BSlSchedule bSlSchedule = new BSlSchedule();
bSlSchedule.setTeaCode(value[14]); bSlSchedule.setTeaCode(value[14]);
bSlSchedule.setSeq(String.valueOf(j)); bSlSchedule.setSeq(String.valueOf(j));
bSlSchedule.setRoomCode(value[26]); if(contanSunday){
bSlSchedule.setRoomCode(value[27]);
}else{
bSlSchedule.setRoomCode(value[26]);
}
bSlSchedule.setSubAgencyId(subAgencyId); bSlSchedule.setSubAgencyId(subAgencyId);
bSlSchedule.setStatus("0"); bSlSchedule.setStatus("0");
bSlSchedule.setSlState("0"); bSlSchedule.setSlState("0");
......
package org.rcisoft.business.bterm.service.impl; package org.rcisoft.business.bterm.service.impl;
import org.rcisoft.business.bclass.entity.BClass;
import org.rcisoft.business.bsl.dao.BSlRepository; import org.rcisoft.business.bsl.dao.BSlRepository;
import org.rcisoft.business.bterm.dao.BTermRepository; import org.rcisoft.business.bterm.dao.BTermRepository;
import org.rcisoft.business.bterm.entity.BTerm; import org.rcisoft.business.bterm.entity.BTerm;
import org.rcisoft.business.bterm.enums.BTermEnum; import org.rcisoft.business.bterm.enums.BTermEnum;
import org.rcisoft.business.bterm.service.BTermService; import org.rcisoft.business.bterm.service.BTermService;
import org.rcisoft.business.bterm.utils.Week;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant; import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
...@@ -13,12 +13,11 @@ import org.rcisoft.core.model.PersistModel; ...@@ -13,12 +13,11 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.model.SelectModel; import org.rcisoft.core.model.SelectModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -63,6 +62,8 @@ public class BTermServiceImpl implements BTermService { ...@@ -63,6 +62,8 @@ public class BTermServiceImpl implements BTermService {
}else { }else {
if(bTermRepository.selectOne(new BTerm(model.getCode()))!=null) if(bTermRepository.selectOne(new BTerm(model.getCode()))!=null)
throw new ServiceException(ResultServiceEnums.TERM_EXISTS); throw new ServiceException(ResultServiceEnums.TERM_EXISTS);
Map<String,Object> map = Week.buildWeek(model.getStartDate(),model.getEndDate());
model.setWeek(String.valueOf(((List<Week>) map.get("weeks")).size()));
UserUtil.setCurrentPersistOperation(model); UserUtil.setCurrentPersistOperation(model);
line = bTermRepository.insertSelective(model); line = bTermRepository.insertSelective(model);
} }
......
package org.rcisoft.business.bterm.utils;
import java.util.*;
public class Week {
private int weekNumber;
private Date startDate;
private Date endDate;
public Week() {
}
public Week(int weekNumber, Date startDate, Date endDate) {
this.weekNumber = weekNumber;
this.startDate = startDate;
this.endDate = endDate;
}
public int getWeekNumber() {
return weekNumber;
}
public void setWeekNumber(int weekNumber) {
this.weekNumber = weekNumber;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
//通过开始时间与计算时间计算周数与具体信息
public static Map<String,Object> buildWeek(Date startDate1,Date endDate1){
Map<String,Object> map = new HashMap<>();
int currentlyWeek = 0;
//声明数组
List<Week> weeks = new ArrayList<>();
Integer weekNumber = 1;
//保存学期结束时间,方便以后进行比较
Calendar termEndDate = Calendar.getInstance();
termEndDate.setTime(endDate1);
//结束时间 +1 方便计算
//termEndDate.add(Calendar.DATE,1);
//周开始时间
Calendar startDate = Calendar.getInstance();
startDate.setTime(startDate1);
//判断第一天为星期几, 1为星期日,2为星期一,………………
int dayOfWeek = startDate.get(Calendar.DAY_OF_WEEK);
//周结束时间
Calendar endDate = Calendar.getInstance();
endDate.setTime(startDate1);
//周结束时间为周开始时间直到周日
endDate.add(Calendar.DATE,8-dayOfWeek);
//当前时间
Calendar currenlyTime = Calendar.getInstance();
//如果第一周并不是完整的一周,则预先存入数组
if(dayOfWeek != 2){
Week week = new Week();
week.setWeekNumber(weekNumber);
week.setStartDate(startDate.getTime());
week.setEndDate(endDate.getTime());
//判断是否为当前周
if((startDate.getTime().before(currenlyTime.getTime()) || startDate.getTime().equals(currenlyTime.getTime()))
&&
(endDate.getTime().after(currenlyTime.getTime()) || endDate.getTime().equals(currenlyTime.getTime()))){
currentlyWeek = week.getWeekNumber();
}
weeks.add(week);
//为下次循环做准备,周数加一,开始时间与结束时间 +7
weekNumber += 1;
//将时间调整为正常数据
startDate.setTime(endDate.getTime());
startDate.add(Calendar.DATE,1);
endDate.add(Calendar.DATE,7);
}
//判断是否超出时间范围
while(startDate.before(termEndDate) || startDate.equals(termEndDate)){
//创建周实例
Week week = new Week();
//将该周的周数,开始时间,结束时间填入
//if-else 判断最后一周是否为完整的一周
if(endDate.equals(termEndDate) || endDate.before(termEndDate)){
week.setWeekNumber(weekNumber);
week.setStartDate(startDate.getTime());
week.setEndDate(endDate.getTime());
//判断是否为当前周
if((startDate.getTime().before(currenlyTime.getTime()) || startDate.getTime().equals(currenlyTime.getTime()))
&&
(endDate.getTime().after(currenlyTime.getTime()) || endDate.getTime().equals(currenlyTime.getTime()))){
currentlyWeek = week.getWeekNumber();
}
weeks.add(week);
}else{
week.setWeekNumber(weekNumber);
week.setStartDate(startDate.getTime());
week.setEndDate(termEndDate.getTime());
//判断是否为当前周
if((startDate.getTime().before(currenlyTime.getTime()) || startDate.getTime().equals(currenlyTime.getTime()))
&&
(endDate.getTime().after(currenlyTime.getTime()) || endDate.getTime().equals(currenlyTime.getTime()))){
currentlyWeek = week.getWeekNumber();
}
weeks.add(week);
}
//为下次循环做准备,周数加一,开始时间与结束时间 +7
weekNumber += 1;
startDate.add(Calendar.DATE,7);
endDate.add(Calendar.DATE,7);
}
map.put("weeks",weeks);
map.put("currentlyWeek",currentlyWeek);
return map;
}
}
...@@ -8,6 +8,8 @@ public enum ResultServiceEnums { ...@@ -8,6 +8,8 @@ public enum ResultServiceEnums {
EXCEL_IMPORT_DATA_NOT_EXIST(11,"Excel中没有找到任何完整有效的数据"), EXCEL_IMPORT_DATA_NOT_EXIST(11,"Excel中没有找到任何完整有效的数据"),
EXCEL_IMPORT_DATA_HAS_NULL(92,"第一行存在空数据"),
EXCEL_IMPORT_HEADER_ERROR(12,"excel表头信息错误,导入失败"), EXCEL_IMPORT_HEADER_ERROR(12,"excel表头信息错误,导入失败"),
EXCEL_IMPORT_DB_INSERT_ERROR(13,"数据库插入失败"), EXCEL_IMPORT_DB_INSERT_ERROR(13,"数据库插入失败"),
......
...@@ -41,13 +41,17 @@ public class ExcelUtil { ...@@ -41,13 +41,17 @@ public class ExcelUtil {
if(hr==null||hr.getLastCellNum()<0){ if(hr==null||hr.getLastCellNum()<0){
continue; continue;
} }
int firstcolumnnum = hr.getFirstCellNum(); int firstcolumnnum = hr.getFirstCellNum();
int lastcolumnnum = hr.getLastCellNum(); int lastcolumnnum = hr.getLastCellNum();
String[] value = new String[lastcolumnnum]; String[] value = new String[lastcolumnnum];
boolean hasEmpty = true; boolean hasEmpty = true;
for (int k = firstcolumnnum; k < lastcolumnnum; k++) { //修改过!!!!!!!!!!!!
for (int k = 0; k < lastcolumnnum; k++) {
HSSFCell hc = hr.getCell(k); HSSFCell hc = hr.getCell(k);
if(hc == null){
value[k] = "";
continue;
}
if (j==firstrownum + headNum) { if (j==firstrownum + headNum) {
//判断表头那一列为空数据并记录。 //判断表头那一列为空数据并记录。
if(parseDB(hc).trim().equals("")) { if(parseDB(hc).trim().equals("")) {
...@@ -58,14 +62,16 @@ public class ExcelUtil { ...@@ -58,14 +62,16 @@ public class ExcelUtil {
} }
else { else {
if(allowEmpty){//允许单元格为空,但不允许整行为空时 if(allowEmpty){//允许单元格为空,但不允许整行为空时
if (!parseDB(hc).trim().equals("")&&emptyColList.get(k)!=-1&&hasEmpty) { //hc != null &&
if (hc != null && !parseDB(hc).trim().equals("")&&emptyColList.get(k)!=-1&&hasEmpty) {
//只要一行中有一个值不为空,即为正确数据 //只要一行中有一个值不为空,即为正确数据
hasEmpty = false; hasEmpty = false;
} }
}else{//不允许单元格为空,只要一行中有一个值为空,即为错误数据 }else{//不允许单元格为空,只要一行中有一个值为空,即为错误数据
hasEmpty = false; hasEmpty = false;
if (parseDB(hc).trim().equals("")&&emptyColList.get(k)!=-1) { //hc != null &&
if (hc != null && parseDB(hc) != null && parseDB(hc).trim().equals("")&&emptyColList.get(k)!=-1) {
//在第j行第k列有空数据,且该列表头不是空的,则舍弃本行数据。 //在第j行第k列有空数据,且该列表头不是空的,则舍弃本行数据。
hasEmpty = true; hasEmpty = true;
...@@ -73,9 +79,14 @@ public class ExcelUtil { ...@@ -73,9 +79,14 @@ public class ExcelUtil {
} }
} }
}
//如果此单元格为空则插入""
if(hc == null){
value[k] = "";
}else {
value[k] = parseDB(hc);
} }
value[k] = parseDB(hc);
//parseDB(hc.getCellType(), hc); //parseDB(hc.getCellType(), hc);
} }
if(j==firstrownum + headNum){ if(j==firstrownum + headNum){
...@@ -140,4 +151,10 @@ public class ExcelUtil { ...@@ -140,4 +151,10 @@ public class ExcelUtil {
return cellValue; return cellValue;
} }
public static Boolean containSunday(HSSFWorkbook hwb){
HSSFRow hssfRow = hwb.getSheetAt(0).getRow(2);
int i = hssfRow.getLastCellNum() - hssfRow.getFirstCellNum();
return i == 29;
}
} }
server:
port: 8081
context-path: /edu #ContextPath must start with '/' and not end with '/'
tomcat:
max-threads: 300
#uri-encoding: UTF-8
#logging:
# path:/working/resource/eduServer/SpringBootLog
# level:
# root: INFO
# org.springframework.web: info
druid:
url: jdbc:mysql://edu2_mysql:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: root
password: 123456
initial-size: 1
min-idle: 1
max-active: 20
test-on-borrow: true
mybatis:
mapper-locations: classpath:mapper/**/**/*.xml
mapper:
mappers:
- org.rcisoft.core.base.BaseMapper
not-empty: false
identity: MYSQL
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
spring:
jackson:
default-property-inclusion: non_null
http:
# encoding:
# force: true
# charset: UTF-8
# enabled: true
multipart:
enabled: true
max-file-size: 500Mb
max-request-size: 1000Mb
mvc:
throw-exception-if-no-handler-found: true
resources:
add-mappings: false
redis:
host: edu2_redis
port: 6379
pool:
max-idle: 50
max-active: 1000
min-idle: 5
max-wait: -1
database: 0
password: ''
timeout: 3600
freemarker:
charset: UTF-8
suffix: .ftl
template-loader-path: classpath:/templates/
lxc:
lxc_prefix: lessonLxc
lxc_ports: lxcPorts
lxc_dockerfilePath: /eduLxc
lxc_initPort: 20001
lxc_maxPort: 30000
lxc_minu: 30
lxc_isRemote: 1
lxc_endlineTime: 10
lxc_delayTime: 30
springfox:
documentation:
swagger:
v2:
path: /api-docs
jwt:
header: Authorization
secret: mySecret
expiration: 604800
tokenHead: "Bearer "
login_secert_key: "base64EncodedSecretKey"
route:
authentication:
path: "/login"
refresh: "/refresh"
register: "/register"
global:
default_location:
course: /default/course.jpg
student: /default/student.png
teacher: /default/teacher.png
carousel: /default/carousel.jpg
lk:
publicalias: publiccert
storePwd: rcrtcyedu2
subject: edu2
licPath: /lk/license.lic
pubPath: /lk/publicCerts.store
password:
default: 123456
min_password: 6
max_password: 16
path:
base_upload_server_location: /working/resource/eduServer/
physical_upload_server_location: /working/dockervolume/edu2_data_ubuntu/eduServer
course_location: course
lesson_location: lesson
sl_location: sl
freemarker_location: /freemarker
image_location: /upload
video_location: video
temp_location: temp
file_location: file
ppt_location: ppt
pdf_location: pdf
cut_pdf_location: cutPdf
excel_template_location: excel-template/
cource_logo_location: /course/logo
images_location: /images
lanch_logo_location: /lanch/logo
md_file_location: mdFiles
che_def_template_location: /WEB-INF/classes/che-def-jsonfile/java-mysql.json
che_project_init_location: /working/dockervolume/chedir/project
cource_code_location: code
cource_project_location: project
student_code_location: studentCode
xml_location: /xmlTemp
other:
server_url: http://192.168.1.125:10180/eduServer
is_server_linux: 1
max_code_length: 15
open_office_home: D:/oppenOffice/openOffice
cut_pdf_num: 30
code:
admin: ROLE_1001
teacher: ROLE_1002
student: ROLE_1003
java: '001'
html: '002'
java_simple: '0001'
java_project: '0002'
html_simple: '1001'
html_project: '1002'
serverLxc:
ip: 192.168.1.125
username: root
password: 123456
libreoffice:
ip: 192.168.1.125
port: 10188
#ip:edu2_libre
#port:8997
\ No newline at end of file
...@@ -74,5 +74,4 @@ ...@@ -74,5 +74,4 @@
</root> </root>
</springProfile> </springProfile>
</configuration> </configuration>
\ No newline at end of file
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
<result column="description" jdbcType="VARCHAR" property="description"/> <result column="description" jdbcType="VARCHAR" property="description"/>
<result column="status" jdbcType="VARCHAR" property="status"/> <result column="status" jdbcType="VARCHAR" property="status"/>
<result column="agency_code" jdbcType="VARCHAR" property="agencyCode" /> <result column="agency_code" jdbcType="VARCHAR" property="agencyCode" />
<result column="term_name" jdbcType="VARCHAR" property="termName" />
<collection property="childList" javaType="ArrayList" column="{agencyCode=agency_code,arrangeId=business_id}" ofType="org.rcisoft.business.barrange.entity.BSubtask" <collection property="childList" javaType="ArrayList" column="{agencyCode=agency_code,arrangeId=business_id}" ofType="org.rcisoft.business.barrange.entity.BSubtask"
select="org.rcisoft.business.barrange.dao.BArrangeRepository.queryByAgencyCode2" select="org.rcisoft.business.barrange.dao.BArrangeRepository.queryByAgencyCode2"
/> />
...@@ -79,6 +80,7 @@ ...@@ -79,6 +80,7 @@
<result column="thursday" jdbcType="VARCHAR" property="thursday"/> <result column="thursday" jdbcType="VARCHAR" property="thursday"/>
<result column="friday" jdbcType="VARCHAR" property="friday"/> <result column="friday" jdbcType="VARCHAR" property="friday"/>
<result column="saturday" jdbcType="VARCHAR" property="saturday"/> <result column="saturday" jdbcType="VARCHAR" property="saturday"/>
<result column="sunday" jdbcType="VARCHAR" property="saturday"/>
<result column="room_code" jdbcType="VARCHAR" property="roomCode"/> <result column="room_code" jdbcType="VARCHAR" property="roomCode"/>
<result column="classroom_name" jdbcType="VARCHAR" property="roomName"/> <result column="classroom_name" jdbcType="VARCHAR" property="roomName"/>
<result column="sub_agency_id" jdbcType="VARCHAR" property="subAgencyId"/> <result column="sub_agency_id" jdbcType="VARCHAR" property="subAgencyId"/>
...@@ -100,14 +102,15 @@ ...@@ -100,14 +102,15 @@
<insert id="insertList"> <insert id="insertList">
insert into b_schedule_dto(business_id,flag,del_flag,update_by,create_by,create_date,update_date,remarks, insert into b_schedule_dto(business_id,flag,del_flag,update_by,create_by,create_date,update_date,remarks,
lesson_code,teacher_code,class_code,week,class_hour, lesson_code,teacher_code,class_code,week,class_hour,
monday,tuesday,wednesday,thursday,friday,saturday,room_code,sub_agency_id) monday,tuesday,wednesday,thursday,friday,saturday,sunday,room_code,sub_agency_id)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.businessId},#{item.flag},#{item.delFlag},#{item.updateBy},#{item.createBy}, (#{item.businessId},#{item.flag},#{item.delFlag},#{item.updateBy},#{item.createBy},
#{item.createDate},#{item.updateDate},#{item.remarks}, #{item.createDate},#{item.updateDate},#{item.remarks},
#{item.lessonCode},#{item.teacherCode},#{item.classCode}, #{item.lessonCode},#{item.teacherCode},#{item.classCode},
#{item.week},#{item.classHour}, #{item.week},#{item.classHour},
#{item.monday},#{item.tuesday},#{item.wednesday},#{item.thursday},#{item.friday},#{item.saturday},#{item.roomCode},#{item.subAgencyId}) #{item.monday},#{item.tuesday},#{item.wednesday},#{item.thursday},#{item.friday},#{item.saturday},
#{item.sunday},#{item.roomCode},#{item.subAgencyId})
</foreach> </foreach>
</insert> </insert>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment