Commit deb845f7 authored by YangZhaoJun1's avatar YangZhaoJun1

Merge branch 'V2.0.3' of http://103.249.252.28:90/lcy/education into V2.0.3

parents 944c288c e746c5c6
...@@ -145,7 +145,7 @@ public class BClassServiceImpl implements BClassService { ...@@ -145,7 +145,7 @@ public class BClassServiceImpl implements BClassService {
public PersistModel administrativeImportExcel(HSSFWorkbook hwb, String token) throws IOException { public PersistModel administrativeImportExcel(HSSFWorkbook hwb, String token) throws IOException {
ArrayList<BClass> bClasses = new ArrayList<BClass>(); ArrayList<BClass> bClasses = new ArrayList<BClass>();
ArrayList<String> repeatCode = new ArrayList<String>(); ArrayList<String> repeatCode = new ArrayList<String>();
String innerRepeatResult = "";
String[] headers = {"班级编号","学号","所属年级"}; String[] headers = {"班级编号","学号","所属年级"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据
//判断年级是否存在 //判断年级是否存在
...@@ -155,7 +155,8 @@ public class BClassServiceImpl implements BClassService { ...@@ -155,7 +155,8 @@ public class BClassServiceImpl implements BClassService {
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST); throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST);
} }
for(String[] value:values){ //将数据封装到entity //外循环
outLoop : for(String[] value:values){ //将数据封装到entity
BClass bClass = null; BClass bClass = null;
BClass b = new BClass(value[0]); BClass b = new BClass(value[0]);
if(value[0]==null||value[0].equals("")||value[1]==null||value[1].equals("")){ if(value[0]==null||value[0].equals("")||value[1]==null||value[1].equals("")){
...@@ -172,6 +173,13 @@ public class BClassServiceImpl implements BClassService { ...@@ -172,6 +173,13 @@ public class BClassServiceImpl implements BClassService {
valuesGrade.add(value[2]); valuesGrade.add(value[2]);
continue; continue;
} }
//表中去重
for(BClass bClass1 : bClasses){
if(b1.getCode().equals(bClass1.getCode())){
innerRepeatResult += "编号 " + b1.getCode() + " 在Excel中重复出现,除第一条以外的数据插入失败 ";
continue outLoop;
}
}
bClass= new BClass(value[0],value[1]); bClass= new BClass(value[0],value[1]);
bClass.setGradeCode(value[2]); bClass.setGradeCode(value[2]);
...@@ -197,7 +205,7 @@ public class BClassServiceImpl implements BClassService { ...@@ -197,7 +205,7 @@ public class BClassServiceImpl implements BClassService {
result+="以下班级的所属年级信息不存在:"+ JSON.toJSONString(valuesGrade)+"。"; result+="以下班级的所属年级信息不存在:"+ JSON.toJSONString(valuesGrade)+"。";
} }
return new PersistModel(line,result); return new PersistModel(line,result + innerRepeatResult);
} }
@Override @Override
...@@ -205,7 +213,7 @@ public class BClassServiceImpl implements BClassService { ...@@ -205,7 +213,7 @@ public class BClassServiceImpl implements BClassService {
ArrayList<BClass> bClasses = new ArrayList<BClass>(); ArrayList<BClass> bClasses = new ArrayList<BClass>();
ArrayList<String> repeatCode = new ArrayList<String>(); ArrayList<String> repeatCode = new ArrayList<String>();
ArrayList<String> AgencyCode = new ArrayList<String>(); ArrayList<String> AgencyCode = new ArrayList<String>();
String innerRepeatResult = "";
String[] headers = {"班级编号","班级名称","所属年级","教学单位"}; String[] headers = {"班级编号","班级名称","所属年级","教学单位"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据
//判断年级是否存在 //判断年级是否存在
...@@ -215,7 +223,7 @@ public class BClassServiceImpl implements BClassService { ...@@ -215,7 +223,7 @@ public class BClassServiceImpl implements BClassService {
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST); throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST);
} }
for(String[] value:values){ //将数据封装到entity outLoop : for(String[] value:values){ //将数据封装到entity
BClass bClass = null; BClass bClass = null;
BClass b = new BClass(value[0]); BClass b = new BClass(value[0]);
if(value[0]==null||value[0].equals("")||value[1]==null||value[1].equals("")){ if(value[0]==null||value[0].equals("")||value[1]==null||value[1].equals("")){
...@@ -246,6 +254,13 @@ public class BClassServiceImpl implements BClassService { ...@@ -246,6 +254,13 @@ public class BClassServiceImpl implements BClassService {
bClass.setType("1"); bClass.setType("1");
bClass.setCommonBusinessId(); bClass.setCommonBusinessId();
UserUtil.setCurrentPersistOperation(bClass); UserUtil.setCurrentPersistOperation(bClass);
//表中去重
for(BClass bClass1 : bClasses){
if(b1.getBusinessId().equals(bClass1.getBusinessId())){
innerRepeatResult += "班级编号 " + b1.getBusinessId() + " 在Excel中重复出现,除第一条以外的数据插入失败 ";
continue outLoop;
}
}
if(!bClasses.contains(bClass)){ if(!bClasses.contains(bClass)){
bClasses.add(bClass); bClasses.add(bClass);
...@@ -269,7 +284,7 @@ public class BClassServiceImpl implements BClassService { ...@@ -269,7 +284,7 @@ public class BClassServiceImpl implements BClassService {
result+="以下教学单位不存在:"+ JSON.toJSONString(AgencyCode)+"。"; result+="以下教学单位不存在:"+ JSON.toJSONString(AgencyCode)+"。";
} }
return new PersistModel(line,result); return new PersistModel(line,result + innerRepeatResult);
} }
@Override @Override
......
...@@ -115,7 +115,8 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -115,7 +115,8 @@ public class BLessonServiceImpl implements BLessonService {
ArrayList<String> direction = new ArrayList<String>(); ArrayList<String> direction = new ArrayList<String>();
List<String> isChinese = new ArrayList<>(); List<String> isChinese = new ArrayList<>();
List<String> isNegative = new ArrayList<>(); List<String> isNegative = new ArrayList<>();
List<String> currentlyCode = new ArrayList<>();
String innerRepeatResult = "";
String[] headers = {"课程编号","课程名称","课程方向编号","学时","学分"}; String[] headers = {"课程编号","课程名称","课程方向编号","学时","学分"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据
...@@ -159,8 +160,13 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -159,8 +160,13 @@ public class BLessonServiceImpl implements BLessonService {
bLesson= new BLesson(value[0],value[1],value[3],value[4]); bLesson= new BLesson(value[0],value[1],value[3],value[4]);
bLesson.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION()); bLesson.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
UserUtil.setCurrentPersistOperation(bLesson); UserUtil.setCurrentPersistOperation(bLesson);
//表中去重
if(currentlyCode.contains(bLesson.getCode())){
innerRepeatResult += "编号 " + value[1] + " 在Excel中重复出现,除第一条以外的数据插入失败 \n";
continue;
}
if(!lessons.contains(bLesson)){ if(!lessons.contains(bLesson)){
currentlyCode.add(bLesson.getCode());
lessons.add(bLesson); lessons.add(bLesson);
BLessonDirection bDirection = new BLessonDirection(); BLessonDirection bDirection = new BLessonDirection();
...@@ -203,7 +209,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -203,7 +209,7 @@ public class BLessonServiceImpl implements BLessonService {
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST.getCode(),result); throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST.getCode(),result);
} }
return new PersistModel(1,result); return new PersistModel(1,result + innerRepeatResult);
} }
......
...@@ -86,7 +86,8 @@ public class BRClassStudentServiceImpl implements BRClassStudentService { ...@@ -86,7 +86,8 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
ArrayList<String> classCode = new ArrayList<String>(); ArrayList<String> classCode = new ArrayList<String>();
ArrayList<String> repeatCode = new ArrayList<String>(); ArrayList<String> repeatCode = new ArrayList<String>();
List<String> valuesGrade = new ArrayList<>(); List<String> valuesGrade = new ArrayList<>();
List<String> currenty = new ArrayList<>();
String innerRepeatResult = "";
String[] headers = {"班级编号","学号"}; String[] headers = {"班级编号","学号"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据
...@@ -127,10 +128,16 @@ public class BRClassStudentServiceImpl implements BRClassStudentService { ...@@ -127,10 +128,16 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
//1.4 构造学生班级信息 //1.4 构造学生班级信息
brClassStudent= new BRClassStudent(value[0],value[1]); brClassStudent= new BRClassStudent(value[0],value[1]);
if(currenty.contains(brClassStudent.toString())){
innerRepeatResult += "班级编号,学号分别为 " + value[0] + " " + value[1] + " 的数据,在Excel中重复出现,除第一条以外的数据插入失败 \n";
continue;
}
currenty.add(brClassStudent.toString());
brClassStudent.setCommonBusinessId(); brClassStudent.setCommonBusinessId();
//UserUtils.setCurrentPersistOperation(brClassStudent); //UserUtils.setCurrentPersistOperation(brClassStudent);
if(!brClassStudents.contains(brClassStudent)){ if(!brClassStudents.contains(brClassStudent)){
brClassStudents.add(brClassStudent); brClassStudents.add(brClassStudent);
} }
} }
...@@ -174,7 +181,7 @@ public class BRClassStudentServiceImpl implements BRClassStudentService { ...@@ -174,7 +181,7 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
int l1 = MapUtils.getInteger(map,"result",-2); int l1 = MapUtils.getInteger(map,"result",-2);
if(l1<=0) if(l1<=0)
throw new ServiceException(ResultServiceEnums.UPDATE_STUDENT_NUM_ERROR); throw new ServiceException(ResultServiceEnums.UPDATE_STUDENT_NUM_ERROR);
return new PersistModel(1,result.toString()); return new PersistModel(1,result.toString() + innerRepeatResult);
} }
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
......
...@@ -87,7 +87,8 @@ public class BRSlStudentServiceImpl implements BRSlStudentService { ...@@ -87,7 +87,8 @@ public class BRSlStudentServiceImpl implements BRSlStudentService {
ArrayList<String> studentCode = new ArrayList<String>(); ArrayList<String> studentCode = new ArrayList<String>();
/*ArrayList<String> gitlabP = new ArrayList<String>(); /*ArrayList<String> gitlabP = new ArrayList<String>();
ArrayList<String> gitlabUser = new ArrayList<String>();*/ ArrayList<String> gitlabUser = new ArrayList<String>();*/
String innerRepeatResult = "";
List<String> currently = new ArrayList<>();
String[] headers = {"课序号","学号"}; String[] headers = {"课序号","学号"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据
...@@ -144,9 +145,14 @@ public class BRSlStudentServiceImpl implements BRSlStudentService { ...@@ -144,9 +145,14 @@ public class BRSlStudentServiceImpl implements BRSlStudentService {
//3.封装学生选课信息 //3.封装学生选课信息
brSlStudent= new BRSlStudent(value[1],value[0]); brSlStudent= new BRSlStudent(value[1],value[0]);
if(currently.contains(brSlStudent.toString())){
innerRepeatResult += "课序号,学号分别为 " + value[0] + " " + value[1] + " 的数据,在Excel中重复出现,除第一条以外的数据插入失败 \n";
continue;
}
currently.add(brSlStudent.toString());
brSlStudent.setBusinessId(IdGen.uuid()); brSlStudent.setBusinessId(IdGen.uuid());
if(!brSlStudents.contains(brSlStudent)){ if(!brSlStudents.contains(brSlStudent)){
brSlStudents.add(brSlStudent); brSlStudents.add(brSlStudent);
} }
} }
...@@ -180,12 +186,11 @@ public class BRSlStudentServiceImpl implements BRSlStudentService { ...@@ -180,12 +186,11 @@ public class BRSlStudentServiceImpl implements BRSlStudentService {
}*/ }*/
result+=nullResult; result+=nullResult;
if(brSlStudents.size()<1){ if(brSlStudents.size()<1){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR.getCode(),result); throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR.getCode(),result);
} }
return new PersistModel(1,result+nullResult.toString()); return new PersistModel(1,result+nullResult.toString() + innerRepeatResult);
} }
static String sub(String str) { static String sub(String str) {
......
...@@ -156,6 +156,8 @@ public class BSlServiceImpl implements BSlService { ...@@ -156,6 +156,8 @@ public class BSlServiceImpl implements BSlService {
ArrayList<String> lessonCode = new ArrayList<String>(); ArrayList<String> lessonCode = new ArrayList<String>();
ArrayList<String> teacherCode = new ArrayList<String>(); ArrayList<String> teacherCode = new ArrayList<String>();
ArrayList<String> termCode = new ArrayList<String>(); ArrayList<String> termCode = new ArrayList<String>();
List<String> currentlyCode = new ArrayList<>();
String innerRepeatResult = "";
//ArrayList<String> direction = new ArrayList<String>(); //ArrayList<String> direction = new ArrayList<String>();
//List<BSl> repeatSl = new ArrayList<>(); //List<BSl> repeatSl = new ArrayList<>();
Map map = new HashMap(); Map map = new HashMap();
...@@ -218,11 +220,18 @@ public class BSlServiceImpl implements BSlService { ...@@ -218,11 +220,18 @@ public class BSlServiceImpl implements BSlService {
bSl.setSlCoverUrl(bLesson.getDefaultUrl()); bSl.setSlCoverUrl(bLesson.getDefaultUrl());
bSl.setCredits(bLesson.getCredits()); bSl.setCredits(bLesson.getCredits());
bSl.setClassHour(bLesson.getClassHour()); bSl.setClassHour(bLesson.getClassHour());
if(currentlyCode.contains(bSl.getCode())){
innerRepeatResult += "编号 " + bSl.getCode() + " 在Excel中重复出现,除第一条以外的数据插入失败 \n";
continue;
}
currentlyCode.add(bSl.getCode());
UserUtil.setCurrentPersistOperation(bSl); UserUtil.setCurrentPersistOperation(bSl);
BLessonDirection bDirection = new BLessonDirection(); BLessonDirection bDirection = new BLessonDirection();
if (!bSls.contains(bSl)) { if (!bSls.contains(bSl)) {
bSls.add(bSl); bSls.add(bSl);
bDirection.setDirectionId(bLesson.getDirectionId()); bDirection.setDirectionId(bLesson.getDirectionId());
bDirection.setBusinessId(IdGen.uuid()); bDirection.setBusinessId(IdGen.uuid());
...@@ -269,7 +278,7 @@ public class BSlServiceImpl implements BSlService { ...@@ -269,7 +278,7 @@ public class BSlServiceImpl implements BSlService {
if(bSls.size()<1){ if(bSls.size()<1){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR.getCode(),result); throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR.getCode(),result);
} }
return new PersistModel(1,result); return new PersistModel(1,result + innerRepeatResult);
} }
@Override @Override
......
...@@ -5,6 +5,7 @@ package org.rcisoft.business.bslschedule.controller; ...@@ -5,6 +5,7 @@ package org.rcisoft.business.bslschedule.controller;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.bslschedule.entity.ScheduleResult2;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -104,4 +105,27 @@ public class BSlScheduleController extends PaginationController<BSlSchedule> { ...@@ -104,4 +105,27 @@ public class BSlScheduleController extends PaginationController<BSlSchedule> {
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bSlScheduleServiceImpl.queryMoreBSlSchedules(week,termCode,subAgencyId)); bSlScheduleServiceImpl.queryMoreBSlSchedules(week,termCode,subAgencyId));
} }
@ApiOperation(value="查周视图内部信息", notes="查周视图内部信息")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "每格的businessId", required = true, dataType = "varchar")})
@GetMapping(value = "/listDetail")
public Result listDetail(String businessId){
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bSlScheduleServiceImpl.queryDetail(businessId));
}
@ApiOperation(value="查周视图2", notes="查周视图2")
@ApiImplicitParams({@ApiImplicitParam(name = "week", value = "周次", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "termCode", value = "学期编号", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "subAgencyId", value = "subAgencyId", required = true, dataType = "varchar")})
@GetMapping(value = "/queryBSlScheduleMore2")
public Result queryBSlScheduleMore2(String week,String termCode,String subAgencyId) throws ParseException {
ScheduleResult2 scheduleResult2 = bSlScheduleServiceImpl.queryMoreBSlSchedules2(week,termCode,subAgencyId);
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
scheduleResult2);
}
} }
...@@ -2,6 +2,7 @@ package org.rcisoft.business.bslschedule.dao; ...@@ -2,6 +2,7 @@ package org.rcisoft.business.bslschedule.dao;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.rcisoft.business.bslschedule.entity.BSlSchedule; import org.rcisoft.business.bslschedule.entity.BSlSchedule;
import org.rcisoft.business.bslschedule.entity.ScheduleDetail;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -69,5 +70,55 @@ public interface BSlScheduleRepository extends BaseMapper<BSlSchedule> { ...@@ -69,5 +70,55 @@ public interface BSlScheduleRepository extends BaseMapper<BSlSchedule> {
"left join b_teacher bt on bs.teacher_code = bt.code " + "left join b_teacher bt on bs.teacher_code = bt.code " +
"where bt.business_id = #{id}") "where bt.business_id = #{id}")
int querySlScheduleDtoByTeaCode(String id); int querySlScheduleDtoByTeaCode(String id);
@Select("SELECT\n" +
"\tb_sl_schedule.room_code as roomCode,\n" +
"\tb_sl_schedule.term_code as termCode,\n" +
"\tb_sl_schedule.tea_code as teaCode,\n" +
"\tb_sl_schedule.lesson_code as lessonCode,\n" +
"\tb_sl_schedule.edu_class_code as eduClassCode,\n" +
"\tb_sl_schedule.sub_agency_id as subAgencyId,\n" +
"\t(\n" +
"\t\tSELECT\n" +
"\t\t\tsum(student_num)\n" +
"\t\tFROM\n" +
"\t\t\tb_class\n" +
"\t\tWHERE\n" +
"\t\t\tFIND_IN_SET(\n" +
"\t\t\t\tb_class. CODE,\n" +
"\t\t\t\tb_edu_class.classes_id\n" +
"\t\t\t)\n" +
"\t) AS studentNum,\n" +
"\tb_lesson.lesson_name as lessonCode,\n" +
"\tb_sl.`code` AS bslCode,\n" +
"\tb_lesson.class_hour as classHour,\n" +
"\ts_user.`name` AS userName,\n" +
"\ts_user.email,\n" +
"\ts_user.phone,\n" +
"\tb_agency.`name` AS agencyName,\n" +
"\tb_agency.`code` AS agencyCode,\n" +
"\tb_rooms.campus,\n" +
"\tb_rooms.category,\n" +
"\tb_rooms.building,\n" +
"\tb_rooms.classroom_no as classroomNo,\n" +
"\tb_rooms.classroom_name as classroomName\n" +
"FROM\n" +
"\tb_sl_schedule\n" +
"LEFT JOIN b_rooms ON b_rooms.`code` = b_sl_schedule.room_code\n" +
"LEFT JOIN b_term ON b_term.`code` = b_sl_schedule.term_code\n" +
"LEFT JOIN b_lesson ON b_lesson.`code` = b_sl_schedule.lesson_code\n" +
"LEFT JOIN b_lesson_direction ON b_lesson_direction.lession_id = b_lesson.business_id\n" +
"LEFT JOIN b_direction ON b_direction.business_id = b_lesson_direction.direction_id\n" +
"LEFT JOIN b_edu_class ON b_edu_class. CODE = b_sl_schedule.edu_class_code\n" +
"LEFT JOIN s_user ON s_user.login_name = b_sl_schedule.tea_code\n" +
"LEFT JOIN b_teacher ON b_teacher. CODE = b_sl_schedule.tea_code\n" +
"LEFT JOIN b_agency ON b_agency. CODE = b_teacher.agency_code\n" +
"LEFT JOIN b_sl ON b_sl_schedule.tea_code = b_sl.teacher_code\n" +
"AND b_sl_schedule.term_code = b_sl.term_code\n" +
"AND b_sl_schedule.lesson_code = b_sl.lesson_code\n" +
"WHERE\n" +
"\tb_sl_schedule.business_id = #{businessId}")
@ResultMap(value = "DetailResultMap")
ScheduleDetail queryDetail(String businessId);
} }
package org.rcisoft.business.bslschedule.entity;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
@Data
@JsonSerialize(include= JsonSerialize.Inclusion.NON_EMPTY)
public class BSLData {
@Data
class InnerObject{
String index;
String tag;
InnerObject(String index,String tag){
this.index = index;
this.tag = tag;
}
}
@Data
class Detail{
List<InnerObject> innerObjectList = new ArrayList<>();
}
private Detail classes = new Detail();
private Detail section = new Detail();
private Detail mon = new Detail();
private Detail tue = new Detail();
private Detail wed = new Detail();
private Detail thu = new Detail();
private Detail fri = new Detail();
private Detail sat = new Detail();
private Detail sun = new Detail();
public void addDetail(String index,String tag,String flag){
switch (flag){
case "classes":
classes.innerObjectList.add(new InnerObject(index,tag));
break;
case "section":
section.innerObjectList.add(new InnerObject(index,tag));
break;
}
}
public void addDetail(String index,String tag,int flag){
switch (flag){
case Calendar.MONDAY:
mon.innerObjectList.add(new InnerObject(index,tag));
break;
case Calendar.TUESDAY:
tue.innerObjectList.add(new InnerObject(index,tag));
break;
case Calendar.WEDNESDAY:
wed.innerObjectList.add(new InnerObject(index,tag));
break;
case Calendar.THURSDAY:
thu.innerObjectList.add(new InnerObject(index,tag));
break;
case Calendar.FRIDAY:
fri.innerObjectList.add(new InnerObject(index,tag));
break;
case Calendar.SATURDAY:
sat.innerObjectList.add(new InnerObject(index,tag));
break;
case Calendar.SUNDAY:
sun.innerObjectList.add(new InnerObject(index,tag));
break;
}
}
}
package org.rcisoft.business.bslschedule.entity;
import lombok.Data;
import org.rcisoft.business.barrange.entity.ScheduleDto;
import java.util.ArrayList;
import java.util.List;
@Data
public class ScheduleDetail {
private String roomCode;
private String termCode;
private String teaCode;
private String lessonCode;
private String eduClassCode;
private String studentNum;
private String lessonName;
private String bslCode;
private String classHour;
private String userName;
private String email;
private String phone;
private String agencyName;
private String agencyCode;
private String campus;
private String category;
private String building;
private String classroomNo;
private String classroomName;
private String weekDetail;
private String subAgencyId;
List<ScheduleDto> list = new ArrayList<>();
public String getCampus(){
if(this.campus != null && !this.campus.equals("")){
switch (this.campus) {
case "0":
this.campus = "校本部";
break;
case "1":
this.campus = "新校区";
break;
}
}
return this.campus;
}
public String getBuilding(){
if(this.building != null && !this.building.equals("")){
switch (this.building) {
case "0":
this.building = "A区";
break;
case "1":
this.building = "B区";
break;
case "2":
this.building = "C区";
break;
case "3":
this.building = "D区";
break;
}
}
return this.building;
}
public String getCategory(){
if(this.category != null && !this.category.equals("")){
switch (this.category) {
case "0":
this.category = "普通教室";
break;
case "1":
this.category = "听力教室";
break;
case "2":
this.category = "多媒体教室";
break;
case "3":
this.category = "实训机房";
break;
case "4":
this.category = "报告厅";
break;
case "5":
this.category = "多功能报告厅";
break;
case "6":
this.category = "阶梯教室";
break;
}
}
return this.category;
}
}
package org.rcisoft.business.bslschedule.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.rcisoft.business.bcoursecode.entity.BCourseCode;
import javax.persistence.Entity;
import java.util.List;
import java.util.Map;
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ScheduleResult2 {
private String weekNum;
private Map<String,BSLData> bSlSchedules;
private List<BCourseCode> bCourseCodes;
}
...@@ -2,7 +2,9 @@ package org.rcisoft.business.bslschedule.service; ...@@ -2,7 +2,9 @@ package org.rcisoft.business.bslschedule.service;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.rcisoft.business.bslschedule.entity.BSlSchedule; import org.rcisoft.business.bslschedule.entity.BSlSchedule;
import org.rcisoft.business.bslschedule.entity.ScheduleDetail;
import org.rcisoft.business.bslschedule.entity.ScheduleResult; import org.rcisoft.business.bslschedule.entity.ScheduleResult;
import org.rcisoft.business.bslschedule.entity.ScheduleResult2;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
...@@ -53,4 +55,8 @@ public interface BSlScheduleService { ...@@ -53,4 +55,8 @@ public interface BSlScheduleService {
ScheduleResult queryMoreBSlSchedules(String week,String termCode1, String subAgencyId); ScheduleResult queryMoreBSlSchedules(String week,String termCode1, String subAgencyId);
ScheduleDetail queryDetail(String businessId);
ScheduleResult2 queryMoreBSlSchedules2(String week, String termCode1, String subAgencyId);
} }
...@@ -127,7 +127,8 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -127,7 +127,8 @@ public class BStudentServiceImpl implements BStudentService {
@Override @Override
public PersistModel importExcel(HSSFWorkbook hwb,String token) throws IOException { public PersistModel importExcel(HSSFWorkbook hwb,String token) throws IOException {
ArrayList<BStudent> students = new ArrayList<BStudent>(); ArrayList<BStudent> students = new ArrayList<BStudent>();
List<String> currentlyCode = new ArrayList<>();
String innerRepeatResult = "";
ArrayList<SysUser> users = new ArrayList<SysUser>(); ArrayList<SysUser> users = new ArrayList<SysUser>();
ArrayList<UserRole> userRoles = new ArrayList<UserRole>(); ArrayList<UserRole> userRoles = new ArrayList<UserRole>();
List<String> valuesIncomplete = new ArrayList<>(); List<String> valuesIncomplete = new ArrayList<>();
...@@ -239,7 +240,12 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -239,7 +240,12 @@ public class BStudentServiceImpl implements BStudentService {
bStudent.setGradeCode(value[3]); bStudent.setGradeCode(value[3]);
bStudent.setRemarks(value[4]); bStudent.setRemarks(value[4]);
UserUtil.setCurrentPersistOperation(bStudent); UserUtil.setCurrentPersistOperation(bStudent);
if(currentlyCode.contains(bStudent.getCode())){
innerRepeatResult += "编号 " + value[0] + " 在Excel中重复出现,除第一条以外的数据插入失败 \n";
continue;
}
if (!students.contains(bStudent)) { if (!students.contains(bStudent)) {
currentlyCode.add(bStudent.getCode());
students.add(bStudent); students.add(bStudent);
users.add(user); users.add(user);
userRoles.add(userRole); userRoles.add(userRole);
...@@ -285,7 +291,7 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -285,7 +291,7 @@ public class BStudentServiceImpl implements BStudentService {
if (valuesOK.size()<1){ if (valuesOK.size()<1){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR.getCode(),result); throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR.getCode(),result);
} }
return new PersistModel(1, result); return new PersistModel(1, result + innerRepeatResult);
......
...@@ -85,8 +85,8 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -85,8 +85,8 @@ public class BTeacherServiceImpl implements BTeacherService {
public PersistModel importExcel(HSSFWorkbook hwb, String token) throws IOException, InterruptedException { public PersistModel importExcel(HSSFWorkbook hwb, String token) throws IOException, InterruptedException {
ArrayList<BTeacher> teachers = new ArrayList<BTeacher>(); ArrayList<BTeacher> teachers = new ArrayList<BTeacher>();
ArrayList<SysUser> users = new ArrayList<SysUser>(); ArrayList<SysUser> users = new ArrayList<SysUser>();
String innerRepeatResult = "";
List<String> currentlyCode = new ArrayList<>();
ArrayList<UserRole> userRoles = new ArrayList<UserRole>(); ArrayList<UserRole> userRoles = new ArrayList<UserRole>();
String[] headers = {"教师工号", "教师姓名", "性别","教学单位编号","备注"}; String[] headers = {"教师工号", "教师姓名", "性别","教学单位编号","备注"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,1); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,1); //获取excel数据
...@@ -193,7 +193,12 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -193,7 +193,12 @@ public class BTeacherServiceImpl implements BTeacherService {
BTeacher bTeacher= new BTeacher(value[0],value[3]); BTeacher bTeacher= new BTeacher(value[0],value[3]);
bTeacher.setRemarks(value[4]); bTeacher.setRemarks(value[4]);
UserUtil.setCurrentPersistOperation(bTeacher); UserUtil.setCurrentPersistOperation(bTeacher);
if(currentlyCode.contains(bTeacher.getCode())){
innerRepeatResult += "编号 " + bTeacher.getCode() + " 在Excel中重复出现,除第一条以外的数据插入失败 ";
continue;
}
if (!teachers.contains(bTeacher)) { if (!teachers.contains(bTeacher)) {
currentlyCode.add(bTeacher.getCode());
teachers.add(bTeacher); teachers.add(bTeacher);
users.add(user); users.add(user);
userRoles.add(userRole); userRoles.add(userRole);
...@@ -235,7 +240,7 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -235,7 +240,7 @@ public class BTeacherServiceImpl implements BTeacherService {
} }
return new PersistModel(1, result); return new PersistModel(1, result + innerRepeatResult);
} }
......
...@@ -106,6 +106,15 @@ public class ExcelUtil { ...@@ -106,6 +106,15 @@ public class ExcelUtil {
return values; return values;
} }
// public static boolean isRepeat(List<String[]> totalValue,String[] value){
// for(int i = 0 ; i < totalValue.size() ; i++){
// for(int j = 0 ; j < value.length ; j++){
// if(((String)value[j]).equals((String)totalValue.get(i)[j])){
// return true;
// }
// }
// }
// }
/** /**
* 重复数据检查 * 重复数据检查
......
...@@ -11,8 +11,8 @@ server: ...@@ -11,8 +11,8 @@ server:
# org.springframework.web: DEBUG # org.springframework.web: DEBUG
druid: druid:
#url: jdbc:mysql://192.168.1.125:13318/new_edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false url: jdbc:mysql://127.0.0.1:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://120.52.179.75:13318/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false #url: jdbc:mysql://120.52.179.75:13318/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: root username: root
password: 123456 password: 123456
initial-size: 1 initial-size: 1
......
...@@ -70,6 +70,11 @@ ...@@ -70,6 +70,11 @@
<result column="studentNum" jdbcType="VARCHAR" property="bEduClass.studentNum"/> <result column="studentNum" jdbcType="VARCHAR" property="bEduClass.studentNum"/>
<result column="bslCode" jdbcType="VARCHAR" property="bslCode" /> <result column="bslCode" jdbcType="VARCHAR" property="bslCode" />
</resultMap> </resultMap>
<resultMap id="DetailResultMap" type="org.rcisoft.business.bslschedule.entity.ScheduleDetail">
</resultMap>
<insert id="insertList"> <insert id="insertList">
insert into b_sl_schedule(business_id,flag,del_flag,update_by,create_by,create_date,update_date,remarks, insert into b_sl_schedule(business_id,flag,del_flag,update_by,create_by,create_date,update_date,remarks,
sl_id,room_code,term_code,tea_code,seq, sl_id,room_code,term_code,tea_code,seq,
......
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