Commit 27065684 authored by YangZhaoJun1's avatar YangZhaoJun1

Excel导入开课 同时将课程的章节列表复制到开课的章节列表

parent 67e2c9e8
...@@ -177,6 +177,10 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -177,6 +177,10 @@ public class BChapterServiceImpl implements BChapterService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override @Override
public int addBslFormLesson(String bLseeonId, String lessonCode, String slId) { public int addBslFormLesson(String bLseeonId, String lessonCode, String slId) {
if(bLseeonId==null){
BLesson bLseeon = bLessonRepository.queryBLessonByCode(lessonCode);
bLseeonId = bLseeon.getBusinessId();
}
//获取课程的章节列表 //获取课程的章节列表
List<BChapter> lessonList = bChapterRepository.queryChapterByLessonId(bLseeonId); List<BChapter> lessonList = bChapterRepository.queryChapterByLessonId(bLseeonId);
List<BChapter> chapterList = new ArrayList<>(); List<BChapter> chapterList = new ArrayList<>();
...@@ -199,7 +203,6 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -199,7 +203,6 @@ public class BChapterServiceImpl implements BChapterService {
chapterList.add(sl_chapter); chapterList.add(sl_chapter);
} }
for (int i=0;i<chapterList.size();i++){ for (int i=0;i<chapterList.size();i++){
BChapter sl_chapter = new BChapter();
if(!chapterList.get(i).getPid().equals("-1")){ if(!chapterList.get(i).getPid().equals("-1")){
//根据父ID获取父节点章节名称 //根据父ID获取父节点章节名称
String chapterName = bChapterRepository.selectChapterNameByPid(lessonList.get(i).getPid()); String chapterName = bChapterRepository.selectChapterNameByPid(lessonList.get(i).getPid());
......
...@@ -138,6 +138,7 @@ public class BSlServiceImpl implements BSlService { ...@@ -138,6 +138,7 @@ public class BSlServiceImpl implements BSlService {
ArrayList<String> gitlab = new ArrayList<String>(); ArrayList<String> gitlab = new ArrayList<String>();
ArrayList<String> termCode = new ArrayList<String>(); ArrayList<String> termCode = new ArrayList<String>();
List<BSl> repeatSl = new ArrayList<>(); List<BSl> repeatSl = new ArrayList<>();
Map map = new HashMap();
String[] headers = {"课序号","课程编号","教师工号","学期编号"}; String[] headers = {"课序号","课程编号","教师工号","学期编号"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers); //获取excel数据
...@@ -197,18 +198,22 @@ public class BSlServiceImpl implements BSlService { ...@@ -197,18 +198,22 @@ public class BSlServiceImpl implements BSlService {
continue; continue;
} }
Project project = action.createProject(pName,dto); Project project = action.createProject(pName,dto);
bSl.setGitLabProjectId(project.getId());*/ bSl.setGitLabProjectId(project.getId());
String pName = global.getGIT_LAB_PROJECT_PREFIX()+value[0]; String pName = global.getGIT_LAB_PROJECT_PREFIX()+value[0];
bSl.setGitLabProjectName(pName); bSl.setGitLabProjectName(pName);*/
if (!bSls.contains(bSl)) { if (!bSls.contains(bSl)) {
bSls.add(bSl); bSls.add(bSl);
} }
map.put(bSl.getLessonCode(), bSl.getBusinessId());
} }
} }
String result =""; String result ="";
if(bSls.size()>0){ if(bSls.size()>0){
int line = bSlRepository.insertList(bSls); int line = bSlRepository.insertList(bSls);
if (line>0){ if (line>0){
for (int i=0;i<bSls.size();i++){
bChapterService.addBslFormLesson(null,bSls.get(i).getLessonCode(), String.valueOf(map.get(bSls.get(i).getLessonCode())));
}
result = "成功导入"+bSls.size()+"条数据。"; result = "成功导入"+bSls.size()+"条数据。";
}else{ }else{
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR); throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR);
......
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