Commit 73768a8b authored by YangZhaoJun1's avatar YangZhaoJun1

Merge branch 'master' into V2.0.3

parents abfcaead 6858d9d1
...@@ -84,7 +84,7 @@ public interface BArrangeRepository extends BaseMapper<BArrange> { ...@@ -84,7 +84,7 @@ public interface BArrangeRepository extends BaseMapper<BArrange> {
"LEFT JOIN b_teacher on b_teacher.`code` = b_schedule_dto.teacher_code " + "LEFT JOIN b_teacher on b_teacher.`code` = b_schedule_dto.teacher_code " +
"LEFT JOIN s_user on s_user.login_name = b_teacher.`code` " + "LEFT JOIN s_user on s_user.login_name = b_teacher.`code` " +
"where sub_agency_id = #{subAgencyId} " + "where sub_agency_id = #{subAgencyId} " +
"ORDER BY lesson_code,class_code,teacher_code,week " + "ORDER BY seq,lesson_code,class_code,teacher_code,week " +
//"GROUP BY lesson_code,teacher_code,class_code " + //"GROUP BY lesson_code,teacher_code,class_code " +
"</script>") "</script>")
@ResultMap(value = "scheduleDtoResultMap") @ResultMap(value = "scheduleDtoResultMap")
......
...@@ -268,7 +268,7 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -268,7 +268,7 @@ public class BArrangeServiceImpl implements BArrangeService {
"周二", "周三", "周四", "周五", "周六","周日", "上课地点", "教室编号", "备注"}; "周二", "周三", "周四", "周五", "周六","周日", "上课地点", "教室编号", "备注"};
} }
//ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,2); //获取excel数据 //ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,2); //获取excel数据
ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,2); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcelv2(hwb, headers,2); //获取excel数据
if(values.get(0)[3]==null || values.get(0)[14]==null ||values.get(0)[16]==null ||values.get(0)[26]==null || if(values.get(0)[3]==null || values.get(0)[14]==null ||values.get(0)[16]==null ||values.get(0)[26]==null ||
values.get(0)[3].equals("") || values.get(0)[14].equals("") ||values.get(0)[16].equals("") ||values.get(0)[26].equals("")){ 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); throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_HAS_NULL);
...@@ -281,81 +281,41 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -281,81 +281,41 @@ public class BArrangeServiceImpl implements BArrangeService {
List<String> teacherCodes = new ArrayList<>(); List<String> teacherCodes = new ArrayList<>();
List<String> classCodes = new ArrayList<>(); List<String> classCodes = new ArrayList<>();
List<String> roomCodes = new ArrayList<>(); List<String> roomCodes = new ArrayList<>();
String[] wholeValue = new String[28];
int index = 0; int index = 0;
for (String[] value : values) { for (String[] value : values) {
ScheduleDto scheduleDto = new ScheduleDto(); ScheduleDto scheduleDto = new ScheduleDto();
//判断1:根据课程编号查询是否有此门课程; //判断1:根据课程编号查询是否有此门课程;
if(value[3].equals("")){
value[3] = wholeValue[3];
}else{
if(bLessonRepository.selectOne(new BLesson(value[3].trim()))==null){ if(bLessonRepository.selectOne(new BLesson(value[3].trim()))==null){
lessonCodes.add(value[3]); lessonCodes.add(value[3]);
continue; continue;
}else{
wholeValue[3] = value[3];
} }
}
//判断2:根据教师编号查询是否有此教师; //判断2:根据教师编号查询是否有此教师;
SysUser user1 =new SysUser(); SysUser user1 =new SysUser();
if(value[14].equals("")){
value[14] = wholeValue[14];
}else{
user1.setLoginName(value[14]); user1.setLoginName(value[14]);
user1.setDelFlag("0"); user1.setDelFlag("0");
user1.setFlag("1"); user1.setFlag("1");
if (sysUserMapper.selectOne(user1) == null) { if (sysUserMapper.selectOne(user1) == null) {
teacherCodes.add(value[14]); teacherCodes.add(value[14]);
continue; continue;
}else{
wholeValue[14] = value[14];
}
} }
//判断3:根据班级编号查询是否有此班级; //判断3:根据班级编号查询是否有此班级;
if(value[16].equals("")){
value[16] = wholeValue[16];
}else{
if (bEduClassRepository.selectOne(new BEduClass(value[16].trim())) == null) { if (bEduClassRepository.selectOne(new BEduClass(value[16].trim())) == null) {
classCodes.add(value[16]); classCodes.add(value[16]);
continue; continue;
}else{
wholeValue[16] = value[16];
} }
}
//判断4:根据教室编号查询是否有此教室; //判断4:根据教室编号查询是否有此教室;
//如果存在星期日,向后推一格 //如果存在星期日,向后推一格
if(contanSunday){ if(contanSunday){
if(value[27].equals("")){
value[27] = wholeValue[27];
}else{
if(bRoomsRepository.selectOne(new BRooms(value[27].trim()))==null){ if(bRoomsRepository.selectOne(new BRooms(value[27].trim()))==null){
roomCodes.add(value[27]); roomCodes.add(value[27]);
continue; continue;
}else{
wholeValue[27] = value[27];
}
} }
}else { }else {
if(value[26].equals("")){
value[26] = wholeValue[26];
}else{
if(bRoomsRepository.selectOne(new BRooms(value[26].trim()))==null){ if(bRoomsRepository.selectOne(new BRooms(value[26].trim()))==null){
roomCodes.add(value[26]); roomCodes.add(value[26]);
continue; continue;
}else{
wholeValue[26] = value[26];
}
} }
} }
//合法:通过了四次判断,证明可建立该排课 //合法:通过了四次判断,证明可建立该排课
scheduleDto.setLessonCode(value[3]); scheduleDto.setLessonCode(value[3]);
scheduleDto.setTeacherCode(value[14]); scheduleDto.setTeacherCode(value[14]);
...@@ -394,8 +354,6 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -394,8 +354,6 @@ public class BArrangeServiceImpl implements BArrangeService {
bSlScheduleRepository.updateStatusBySubAgencyId(subAgencyId,"1"); bSlScheduleRepository.updateStatusBySubAgencyId(subAgencyId,"1");
} }
String result = ""; String result = "";
if (scheduleDtos.size()>0){ if (scheduleDtos.size()>0){
bArrangeRepository.avoidRepeatDto(subAgencyId); bArrangeRepository.avoidRepeatDto(subAgencyId);
...@@ -444,8 +402,7 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -444,8 +402,7 @@ public class BArrangeServiceImpl implements BArrangeService {
"授课学时", "上机学时", "实验学时", "考试类型", "任课教师", "教师编号", "教学班组名", "教学班组编号", "周次", "周学时", "周一", "授课学时", "上机学时", "实验学时", "考试类型", "任课教师", "教师编号", "教学班组名", "教学班组编号", "周次", "周学时", "周一",
"周二", "周三", "周四", "周五", "周六","周日", "上课地点", "教室编号", "备注"}; "周二", "周三", "周四", "周五", "周六","周日", "上课地点", "教室编号", "备注"};
} }
//ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,2); //获取excel数据 ArrayList<String[]> values = ExcelUtil.importExcelv2(hwb, headers,2); //获取excel数据
ArrayList<String[]> values = ExcelUtil.importExcel(hwb, headers,true,2); //获取excel数据
if(values.get(0)[3]==null || values.get(0)[14]==null ||values.get(0)[16]==null ||values.get(0)[26]==null || if(values.get(0)[3]==null || values.get(0)[14]==null ||values.get(0)[16]==null ||values.get(0)[26]==null ||
values.get(0)[3].equals("") || values.get(0)[14].equals("") ||values.get(0)[16].equals("") ||values.get(0)[26].equals("")){ 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); throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_HAS_NULL);
...@@ -460,80 +417,40 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -460,80 +417,40 @@ public class BArrangeServiceImpl implements BArrangeService {
List<String> roomCodes = new ArrayList<>(); List<String> roomCodes = new ArrayList<>();
List<String> weekErrors = new ArrayList<>(); List<String> weekErrors = new ArrayList<>();
String[] wholeValue = new String[28];
for (String[] value : values) { for (String[] value : values) {
//判断1:根据课程编号查询是否有此门课程; //判断1:根据课程编号查询是否有此门课程;
if(value[3].equals("")){
value[3] = wholeValue[3];
}else{
if(bLessonRepository.selectOne(new BLesson(value[3].trim()))==null){ if(bLessonRepository.selectOne(new BLesson(value[3].trim()))==null){
lessonCodes.add(value[3]); lessonCodes.add(value[3]);
continue; continue;
}else{
wholeValue[3] = value[3];
}
} }
//判断2:根据教师编号查询是否有此教师; //判断2:根据教师编号查询是否有此教师;
SysUser user1 =new SysUser(); SysUser user1 =new SysUser();
if(value[14].equals("")){
value[14] = wholeValue[14];
}else{
user1.setLoginName(value[14]); user1.setLoginName(value[14]);
user1.setDelFlag("0"); user1.setDelFlag("0");
user1.setFlag("1"); user1.setFlag("1");
if (sysUserMapper.selectOne(user1) == null) { if (sysUserMapper.selectOne(user1) == null) {
teacherCodes.add(value[14]); teacherCodes.add(value[14]);
continue; continue;
}else{
wholeValue[14] = value[14];
} }
}
//判断3:根据班级编号查询是否有此班级; //判断3:根据班级编号查询是否有此班级;
if(value[16].equals("")){
value[16] = wholeValue[16];
}else{
if (bEduClassRepository.selectOne(new BEduClass(value[16].trim())) == null) { if (bEduClassRepository.selectOne(new BEduClass(value[16].trim())) == null) {
classCodes.add(value[16]); classCodes.add(value[16]);
continue; continue;
}else{
wholeValue[16] = value[16];
}
} }
//判断4:根据教室编号查询是否有此教室; //判断4:根据教室编号查询是否有此教室;
//如果存在星期日,向后推一格 //如果存在星期日,向后推一格
if(contanSunday){ if(contanSunday){
if(value[27].equals("")){
value[27] = wholeValue[27];
}else{
if(bRoomsRepository.selectOne(new BRooms(value[27].trim()))==null){ if(bRoomsRepository.selectOne(new BRooms(value[27].trim()))==null){
roomCodes.add(value[27]); roomCodes.add(value[27]);
continue; continue;
}else{
wholeValue[27] = value[27];
}
} }
}else { }else {
if(value[26].equals("")){
value[26] = wholeValue[26];
}else{
if(bRoomsRepository.selectOne(new BRooms(value[26].trim()))==null){ if(bRoomsRepository.selectOne(new BRooms(value[26].trim()))==null){
roomCodes.add(value[26]); roomCodes.add(value[26]);
continue; continue;
}else{
wholeValue[26] = value[26];
} }
} }
}
String week = value[17]; String week = value[17];
if(week.contains("-")){ if(week.contains("-")){
int location = week.indexOf("-"); int location = week.indexOf("-");
......
...@@ -395,4 +395,16 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -395,4 +395,16 @@ public class BChapterController extends PaginationController<BChapter> {
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
studentCode); studentCode);
} }
@ApiOperation(value="修改项目任务书", notes="修改项目任务书")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "mdFile", value = "项目任务书内容", required = true, dataType = "varchar")})
@PostMapping(value = "/updateMdFile")
public Result updateMdFile(String businessId, String mdFile){
int data = bChapterService.updateMdFile(businessId,mdFile);
return Result.builder(new PersistModel(data),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
} }
...@@ -166,7 +166,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -166,7 +166,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* @param studentId * @param studentId
* @return * @return
*/ */
@Update("<script>update b_r_student_chapter set score = '-1', is_complete = '0' where chapter_id = #{chapterId} and student_id = #{studentId}</script>") @Update("<script>update b_r_student_chapter set score = '999', is_complete = '0' where chapter_id = #{chapterId} and student_id = #{studentId}</script>")
int updateScoerInfo(@Param("chapterId") String chapterId, @Param("studentId") String studentId); int updateScoerInfo(@Param("chapterId") String chapterId, @Param("studentId") String studentId);
@Select("<script>select * from b_chapter " + @Select("<script>select * from b_chapter " +
...@@ -333,6 +333,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -333,6 +333,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"<if test=\"paperFinish !=null and paperFinish != ''\"> set paper_finish = '1' </if>" + "<if test=\"paperFinish !=null and paperFinish != ''\"> set paper_finish = '1' </if>" +
"<if test=\"score !=null and score != ''\"> set score = #{score}, </if>" + "<if test=\"score !=null and score != ''\"> set score = #{score}, </if>" +
"<if test=\"isComplete !=null and isComplete != ''\"> is_complete = #{isComplete} </if>" + "<if test=\"isComplete !=null and isComplete != ''\"> is_complete = #{isComplete} </if>" +
"<if test=\"automatic !=null and automatic != ''\"> automatic = #{automatic} </if>" +
"where student_id = #{studentId} and chapter_id = #{chapterId} </script>") "where student_id = #{studentId} and chapter_id = #{chapterId} </script>")
int updateToFinish(ScoreInfoDTO scoreInfoDTO); int updateToFinish(ScoreInfoDTO scoreInfoDTO);
......
...@@ -124,4 +124,6 @@ public interface BChapterService{ ...@@ -124,4 +124,6 @@ public interface BChapterService{
int updateToFinish(String type, String studentCode, String chapterId ,String slId); int updateToFinish(String type, String studentCode, String chapterId ,String slId);
String queryIsCompleteByUserIdAndChapId(String userInfoProp, String chapId); String queryIsCompleteByUserIdAndChapId(String userInfoProp, String chapId);
int updateMdFile(String businessId, String mdFile);
} }
...@@ -201,9 +201,11 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -201,9 +201,11 @@ public class BChapterServiceImpl implements BChapterService {
//获取智评分数 //获取智评分数
int score = IntellEvaluation.IntellEvaluation(filePath,scoreInfoDTO.getStudentCode(),bChapter.getExperimentType()); int score = IntellEvaluation.IntellEvaluation(filePath,scoreInfoDTO.getStudentCode(),bChapter.getExperimentType());
scoreInfoDTO.setScore(score); scoreInfoDTO.setScore(score);
scoreInfoDTO.setAutomatic("1");
}else{ }else{
scoreInfoDTO.setScore(-1); scoreInfoDTO.setScore(-1);
scoreInfoDTO.setAutomatic("0");
} }
scoreInfoDTO.setStudentId(stuid); scoreInfoDTO.setStudentId(stuid);
int result; int result;
...@@ -539,5 +541,13 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -539,5 +541,13 @@ public class BChapterServiceImpl implements BChapterService {
return bChapterRepository.queryIsCompleteByUserIdAndChapId(userId, chapId); return bChapterRepository.queryIsCompleteByUserIdAndChapId(userId, chapId);
} }
@Override
public int updateMdFile(String businessId, String mdFile) {
BChapter bChapter = new BChapter();
bChapter.setBusinessId(businessId);
bChapter.setMdFile(mdFile);
return bChapterRepository.updateByPrimaryKeySelective(bChapter);
}
} }
...@@ -39,7 +39,6 @@ public class BClass extends IdEntity<BClass> { ...@@ -39,7 +39,6 @@ public class BClass extends IdEntity<BClass> {
/*班级类型*/ /*班级类型*/
@Length(min = 1,max = 1,message = "长度为1") @Length(min = 1,max = 1,message = "长度为1")
@NotBlank
private String type; private String type;
/*年级*/ /*年级*/
......
...@@ -205,13 +205,14 @@ public class BCodeController extends PaginationController { ...@@ -205,13 +205,14 @@ public class BCodeController extends PaginationController {
if(finished!=null&&finished.equals("1")&&!fileType.equals("6")){ if(finished!=null&&finished.equals("1")&&!fileType.equals("6")){
throw new ServiceException(ResultServiceEnums.EXPERIMENT_FINISHED); throw new ServiceException(ResultServiceEnums.EXPERIMENT_FINISHED);
} }
File fatherFile = new File(serverPath+(filePath.substring(0,filePath.lastIndexOf("/"))));
if(fileType.equals("1")&&!file.exists()){//新增文件夹 if(fileType.equals("1")&&!file.exists()){//新增文件夹
if(file.isFile()){ if(fatherFile.isFile()){
throw new ServiceException(ResultServiceEnums.THIS_IS_FILE); throw new ServiceException(ResultServiceEnums.THIS_IS_FILE);
} }
file.mkdirs(); file.mkdirs();
}else if(fileType.equals("2")&&!file.exists()){//新增文件 }else if(fileType.equals("2")&&!file.exists()){//新增文件
if(file.isFile()){ if(fatherFile.isFile()){
throw new ServiceException(ResultServiceEnums.THIS_IS_FILE); throw new ServiceException(ResultServiceEnums.THIS_IS_FILE);
} }
file.createNewFile(); file.createNewFile();
......
...@@ -17,6 +17,7 @@ import org.rcisoft.core.model.PersistModel; ...@@ -17,6 +17,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil; import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.IdGen; import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.TestChinese;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -112,6 +113,8 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -112,6 +113,8 @@ public class BLessonServiceImpl implements BLessonService {
ArrayList<String> repeatCode = new ArrayList<String>(); ArrayList<String> repeatCode = new ArrayList<String>();
List<String> errorCode = new ArrayList<>(); List<String> errorCode = new ArrayList<>();
ArrayList<String> direction = new ArrayList<String>(); ArrayList<String> direction = new ArrayList<String>();
List<String> isChinese = new ArrayList<>();
List<String> isNegative = 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数据
...@@ -125,12 +128,24 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -125,12 +128,24 @@ public class BLessonServiceImpl implements BLessonService {
BLesson bLesson = null; BLesson bLesson = null;
String classCode = value[0]; String classCode = value[0];
//判断编号是否含有中文
if(TestChinese.isChinese(classCode)){
isChinese.add(value[0]);
continue;
};
//判断1:班级编号是否满足<15位; //判断1:班级编号是否满足<15位;
if(classCode.length()>15){ if(classCode.length()>15){
//该用户不满足要求,记入valuesShort中 //该用户不满足要求,记入valuesShort中
errorCode.add(value[0]); errorCode.add(value[0]);
continue; continue;
} }
if(Integer.parseInt(value[4])<0||Integer.parseInt(value[3])<0){
//该用户不满足要求,记入valuesShort中
isNegative.add(value[0]);
continue;
}
if((bLesson=bLessonRepository.queryBLessonByCode(value[0]))!=null) { if((bLesson=bLessonRepository.queryBLessonByCode(value[0]))!=null) {
repeatCode.add(value[0]); repeatCode.add(value[0]);
continue; continue;
...@@ -169,6 +184,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -169,6 +184,12 @@ public class BLessonServiceImpl implements BLessonService {
} }
if(isNegative.size()>0){
result+="以下课程的学时或学分不能为负数:"+ JSON.toJSONString(isNegative)+"。";
}
if(isChinese.size()>0){
result+="以下编号格式不正确:"+ JSON.toJSONString(isChinese)+"。";
}
if(repeatCode.size()>0){ if(repeatCode.size()>0){
result+="以下课程编号存在重复:"+ JSON.toJSONString(repeatCode)+"。"; result+="以下课程编号存在重复:"+ JSON.toJSONString(repeatCode)+"。";
} }
......
...@@ -306,6 +306,17 @@ public class BSlController extends PaginationController<BSl> { ...@@ -306,6 +306,17 @@ public class BSlController extends PaginationController<BSl> {
slId); slId);
} }
@ApiOperation(value="修改任课教师", notes="修改任课教师")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "teacherCode", value = "教师工号", required = true, dataType = "varchar")})
@PostMapping("/updateTeacher")
public Result updateTeacher(String businessId, String teacherCode){
int data = bSlService.updateTeacher(businessId,teacherCode);
return Result.builder(new PersistModel(data),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
teacherCode);
}
/*public GridModel querySlStudentSlId(String slId) { /*public GridModel querySlStudentSlId(String slId) {
bSlService.querySlStudentByPagination(getPaginationUtility(),slId); bSlService.querySlStudentByPagination(getPaginationUtility(),slId);
......
...@@ -261,6 +261,9 @@ public interface BSlRepository extends BaseMapper<BSl> { ...@@ -261,6 +261,9 @@ public interface BSlRepository extends BaseMapper<BSl> {
"where sl.business_id = #{slId}") "where sl.business_id = #{slId}")
int queryStudentNumById(String slId); int queryStudentNumById(String slId);
@Update("<script>update b_sl set teacher_code=#{teacherCode} where business_id=#{businessId}</script>")
int updateTeacher(@Param("businessId") String businessId, @Param("teacherCode") String teacherCode);
//List<BStudent> querySlStudentByPagination(String slId); //List<BStudent> querySlStudentByPagination(String slId);
} }
...@@ -123,5 +123,7 @@ public interface BSlService{ ...@@ -123,5 +123,7 @@ public interface BSlService{
int auditBsl(String slId, String status, String opinion); int auditBsl(String slId, String status, String opinion);
int updateTeacher(String businessId, String teacherCode);
//List<BStudent> querySlStudentByPagination(PageUtil pageUtil, String slId); //List<BStudent> querySlStudentByPagination(PageUtil pageUtil, String slId);
} }
...@@ -389,6 +389,11 @@ public class BSlServiceImpl implements BSlService { ...@@ -389,6 +389,11 @@ public class BSlServiceImpl implements BSlService {
return result; return result;
} }
@Override
public int updateTeacher(String businessId, String teacherCode) {
return bSlRepository.updateTeacher(businessId,teacherCode);
}
/*@Override /*@Override
public List<BStudent> querySlStudentByPagination(PageUtil pageUtil, String slId) { public List<BStudent> querySlStudentByPagination(PageUtil pageUtil, String slId) {
return bSlRepository.querySlStudentByPagination(slId); return bSlRepository.querySlStudentByPagination(slId);
......
...@@ -20,6 +20,7 @@ import org.rcisoft.core.model.PersistModel; ...@@ -20,6 +20,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil; import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.RegexValidateUtil; import org.rcisoft.core.util.RegexValidateUtil;
import org.rcisoft.core.util.TestChinese;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.user.dao.SysUserMapper; import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.entity.SysUser; import org.rcisoft.sys.user.entity.SysUser;
...@@ -138,6 +139,8 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -138,6 +139,8 @@ public class BStudentServiceImpl implements BStudentService {
List<String> valuesRepeat = new ArrayList<>(); List<String> valuesRepeat = new ArrayList<>();
List<String> valuesShort = new ArrayList<>(); List<String> valuesShort = new ArrayList<>();
List<String> valuesEmailExist = new ArrayList<>(); List<String> valuesEmailExist = new ArrayList<>();
List<String> isChinese = new ArrayList<>();
List<String> nameTooLong = new ArrayList<>();
List<String> valuesGrade = new ArrayList<>(); List<String> valuesGrade = new ArrayList<>();
int i = 0; int i = 0;
...@@ -145,6 +148,12 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -145,6 +148,12 @@ public class BStudentServiceImpl implements BStudentService {
i++; i++;
String stuCode = value[0]; String stuCode = value[0];
//判断学号是否含有中文
if(TestChinese.isChinese(stuCode)){
isChinese.add(value[0]);
continue;
};
//判断1:学号是否满足8~15位; //判断1:学号是否满足8~15位;
if(stuCode.length()<8||stuCode.length()>15){ if(stuCode.length()<8||stuCode.length()>15){
//该用户不满足要求,记入valuesShort中 //该用户不满足要求,记入valuesShort中
...@@ -152,6 +161,12 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -152,6 +161,12 @@ public class BStudentServiceImpl implements BStudentService {
continue; continue;
} }
if(value[1].length()<1||value[1].length()>15){
//该用户不满足要求,记入valuesShort中
nameTooLong.add(value[0]);
continue;
}
//判断2:MySQL数据库中是否存在该用户; //判断2:MySQL数据库中是否存在该用户;
SysUser user1 =new SysUser(); SysUser user1 =new SysUser();
user1.setLoginName(value[0]); user1.setLoginName(value[0]);
...@@ -240,9 +255,15 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -240,9 +255,15 @@ public class BStudentServiceImpl implements BStudentService {
} }
} }
if(isChinese.size()>0){
result+="以下学生的学号格式不正确:"+ JSON.toJSONString(isChinese)+"。";
}
if(valuesRepeat.size()>0){ if(valuesRepeat.size()>0){
result+="以下学生的学号存在重复:"+ JSON.toJSONString(valuesRepeat)+"。"; result+="以下学生的学号存在重复:"+ JSON.toJSONString(valuesRepeat)+"。";
} }
if(nameTooLong.size()>0){
result+="以下学生的姓名格式不正确:"+ JSON.toJSONString(nameTooLong)+"。";
}
if(valuesShort.size()>0){ if(valuesShort.size()>0){
result+="以下学生的学号位数不在8~15位之间:"+ JSON.toJSONString(valuesShort)+"。"; result+="以下学生的学号位数不在8~15位之间:"+ JSON.toJSONString(valuesShort)+"。";
} }
......
...@@ -20,6 +20,7 @@ import org.rcisoft.core.model.PersistModel; ...@@ -20,6 +20,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil; import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.RegexValidateUtil; import org.rcisoft.core.util.RegexValidateUtil;
import org.rcisoft.core.util.TestChinese;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.user.dao.SysUserMapper; import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.entity.SysUser; import org.rcisoft.sys.user.entity.SysUser;
...@@ -96,12 +97,21 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -96,12 +97,21 @@ public class BTeacherServiceImpl implements BTeacherService {
List<String[]> valuesOK = new ArrayList<>(); List<String[]> valuesOK = new ArrayList<>();
List<String> valuesRepeat = new ArrayList<>(); List<String> valuesRepeat = new ArrayList<>();
List<String> valuesShort = new ArrayList<>(); List<String> valuesShort = new ArrayList<>();
List<String> valuesEmailExist = new ArrayList<>();
List<String> isChinese = new ArrayList<>();
List<String> nameTooLong = new ArrayList<>();
List<String> valuesIncomplete = new ArrayList<>(); List<String> valuesIncomplete = new ArrayList<>();
List<String> valuesAgencyExist = new ArrayList<>(); List<String> valuesAgencyExist = new ArrayList<>();
int i = 0; int i = 0;
for (String[] value : values) { for (String[] value : values) {
i++; i++;
String teaCode = value[0]; String teaCode = value[0];
//判断工号是否含有中文
if(TestChinese.isChinese(teaCode)){
isChinese.add(value[0]);
continue;
};
//判断1:学号是否满足8~15位; //判断1:学号是否满足8~15位;
if(teaCode.length()<8||teaCode.length()>15){ if(teaCode.length()<8||teaCode.length()>15){
...@@ -110,6 +120,12 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -110,6 +120,12 @@ public class BTeacherServiceImpl implements BTeacherService {
continue; continue;
} }
if(value[1].length()<1||value[1].length()>15){
//该用户不满足要求,记入valuesShort中
nameTooLong.add(value[0]);
continue;
}
//判断2:MySQL数据库中是否存在该用户; //判断2:MySQL数据库中是否存在该用户;
SysUser user1 =new SysUser(); SysUser user1 =new SysUser();
user1.setLoginName(value[0]); user1.setLoginName(value[0]);
...@@ -194,9 +210,15 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -194,9 +210,15 @@ public class BTeacherServiceImpl implements BTeacherService {
} }
} }
if(isChinese.size()>0){
result+="以下教师的工号格式不正确:"+ JSON.toJSONString(isChinese)+"。";
}
if(valuesRepeat.size()>0){ if(valuesRepeat.size()>0){
result+="以下教师的工号存在重复:"+ JSON.toJSONString(valuesRepeat)+"。"; result+="以下教师的工号存在重复:"+ JSON.toJSONString(valuesRepeat)+"。";
} }
if(nameTooLong.size()>0){
result+="以下教师的姓名格式不正确:"+ JSON.toJSONString(nameTooLong)+"。";
}
if(valuesShort.size()>0){ if(valuesShort.size()>0){
result+="以下教师的工号位数不在8~15位之间:"+ JSON.toJSONString(valuesShort)+"。"; result+="以下教师的工号位数不在8~15位之间:"+ JSON.toJSONString(valuesShort)+"。";
} }
......
...@@ -72,7 +72,8 @@ public class TExamInfoServiceImpl implements TExamInfoService { ...@@ -72,7 +72,8 @@ public class TExamInfoServiceImpl implements TExamInfoService {
tExamInfo.setIp(IpUtil.getIpAddr(request)); tExamInfo.setIp(IpUtil.getIpAddr(request));
int line = tExamInfoRepository.insertSelective(tExamInfo); int line = tExamInfoRepository.insertSelective(tExamInfo);
tExamInfoRepository.updateStatus(pId); tExamInfoRepository.updateStatus(pId);
return new PersistModel(line,pId); Object pid = pId;
return new PersistModel(line,pid);
}else{ }else{
throw new ServiceException(ResultServiceEnums.NO_PAPER_EXISTS); throw new ServiceException(ResultServiceEnums.NO_PAPER_EXISTS);
} }
......
...@@ -227,7 +227,9 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -227,7 +227,9 @@ public class TQuestionServiceImpl implements TQuestionService {
byte[] results = rcRedisServiceImpl.getBytes(userId + "_" + chapterId); byte[] results = rcRedisServiceImpl.getBytes(userId + "_" + chapterId);
QuestionListAndNumDto questionListAndNum = new QuestionListAndNumDto(); QuestionListAndNumDto questionListAndNum = new QuestionListAndNumDto();
//判断缓存中是否有数据,有数据直接返回;没有数据先查询数据,再放入缓存 //判断缓存中是否有数据,有数据直接返回;没有数据先查询数据,再放入缓存
log.info("-----正在查询------");
if(results!=null){ if(results!=null){
log.info("-----redis有数据------");
questionListAndNum = SerializationUtils.deserializer(results, QuestionListAndNumDto.class); questionListAndNum = SerializationUtils.deserializer(results, QuestionListAndNumDto.class);
if(questionListAndNum!=null) if(questionListAndNum!=null)
return questionListAndNum; return questionListAndNum;
...@@ -251,6 +253,7 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -251,6 +253,7 @@ public class TQuestionServiceImpl implements TQuestionService {
List<TQuestion> multiSelectList = new ArrayList<>(); List<TQuestion> multiSelectList = new ArrayList<>();
List<TQuestion> judgmentList = new ArrayList<>(); List<TQuestion> judgmentList = new ArrayList<>();
List<TQuestion> questionList = tQuestionRepository.queryQuestionsByChap_IdAndQtype(pId); List<TQuestion> questionList = tQuestionRepository.queryQuestionsByChap_IdAndQtype(pId);
log.info("全部习题:+++++++++"+questionList.toString());
for(TQuestion question : questionList){ for(TQuestion question : questionList){
if(question==null){ if(question==null){
throw new ServiceException(ResultServiceEnums.QUESTION_ERROR); throw new ServiceException(ResultServiceEnums.QUESTION_ERROR);
...@@ -298,9 +301,12 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -298,9 +301,12 @@ public class TQuestionServiceImpl implements TQuestionService {
questionListAndNum.setNumOfMultiSelect(tQuestionRepository.queryNumByType("2",chapterId).get(0)); questionListAndNum.setNumOfMultiSelect(tQuestionRepository.queryNumByType("2",chapterId).get(0));
questionListAndNum.setNumOfJudgment(tQuestionRepository.queryNumByType("3",chapterId).get(0)); questionListAndNum.setNumOfJudgment(tQuestionRepository.queryNumByType("3",chapterId).get(0));
//将数据放入缓存中 //将数据放入缓存中
log.info("-----redis开始放数据------");
rcRedisServiceImpl.setBytes(userId + "_" + chapterId, rcRedisServiceImpl.setBytes(userId + "_" + chapterId,
SerializationUtils.serializer(questionListAndNum), SerializationUtils.serializer(questionListAndNum),
global.getREDIS_TIMEOUT()); global.getREDIS_TIMEOUT());
log.info("-----redis结束放数据------");
log.info(questionListAndNum.toString());
return questionListAndNum; return questionListAndNum;
} }
......
...@@ -189,6 +189,8 @@ public enum ResultServiceEnums { ...@@ -189,6 +189,8 @@ public enum ResultServiceEnums {
DATA_HAS_USED(100,"数据使用中,不可删除"), DATA_HAS_USED(100,"数据使用中,不可删除"),
CAN_NOT_OVERLAP(101,"时间区间不可重叠"), CAN_NOT_OVERLAP(101,"时间区间不可重叠"),
ROLE_HAS_USED(102,"当前角色被使用,不可删除")
; ;
private Integer code; private Integer code;
......
...@@ -130,7 +130,8 @@ public class ExcelUtil { ...@@ -130,7 +130,8 @@ public class ExcelUtil {
return repeatMessage.toString(); return repeatMessage.toString();
} }
public static ArrayList<String[]> importExcelv2(HSSFWorkbook hwb, String[] headers, boolean allowEmpty , int headNum){ public static ArrayList<String[]> importExcelv2(HSSFWorkbook hwb, String[] headers, int headNum){
String result = "";
ArrayList<String[]> values = new ArrayList<>(); ArrayList<String[]> values = new ArrayList<>();
for (int i = 0; i < hwb.getNumberOfSheets(); i++) { for (int i = 0; i < hwb.getNumberOfSheets(); i++) {
HSSFSheet hs = hwb.getSheetAt(i); HSSFSheet hs = hwb.getSheetAt(i);
...@@ -140,7 +141,6 @@ public class ExcelUtil { ...@@ -140,7 +141,6 @@ public class ExcelUtil {
List<CellRangeAddress> cellRangeAddressList = hs.getMergedRegions(); List<CellRangeAddress> cellRangeAddressList = hs.getMergedRegions();
int firstrownum = hs.getFirstRowNum(); //第一行 int firstrownum = hs.getFirstRowNum(); //第一行
int lastrownum = hs.getLastRowNum(); //最后一行 int lastrownum = hs.getLastRowNum(); //最后一行
List<Integer> emptyColList=new ArrayList<>();
for (int j = firstrownum + headNum; j <= lastrownum; j++) { for (int j = firstrownum + headNum; j <= lastrownum; j++) {
HSSFRow hr = hs.getRow(j); HSSFRow hr = hs.getRow(j);
if(hr==null||hr.getLastCellNum()<0){ if(hr==null||hr.getLastCellNum()<0){
...@@ -149,42 +149,8 @@ public class ExcelUtil { ...@@ -149,42 +149,8 @@ public class ExcelUtil {
int firstcolumnnum = hr.getFirstCellNum(); int firstcolumnnum = hr.getFirstCellNum();
int lastcolumnnum = hr.getLastCellNum(); int lastcolumnnum = hr.getLastCellNum();
String[] value = new String[lastcolumnnum + 2]; String[] value = new String[lastcolumnnum + 2];
boolean hasEmpty = true;
//修改过!!!!!!!!!!!!
for (int k = 0; 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(parseDB(hc).trim().equals("")) {
emptyColList.add(-1);
}else{
emptyColList.add(k);
}
}
else {
if(allowEmpty){//允许单元格为空,但不允许整行为空时
//hc != null &&
if (hc != null && !parseDB(hc).trim().equals("")&&emptyColList.get(k)!=-1&&hasEmpty) {
//只要一行中有一个值不为空,即为正确数据
hasEmpty = false;
}
}else{//不允许单元格为空,只要一行中有一个值为空,即为错误数据
hasEmpty = false;
//hc != null &&
if (hc != null && parseDB(hc) != null && parseDB(hc).trim().equals("")&&emptyColList.get(k)!=-1) {
//在第j行第k列有空数据,且该列表头不是空的,则舍弃本行数据。
hasEmpty = true;
break;
}
}
}
//如果此单元格为空则插入"" //如果此单元格为空则插入""
if(hc == null){ if(hc == null){
value[k] = ""; value[k] = "";
...@@ -195,13 +161,11 @@ public class ExcelUtil { ...@@ -195,13 +161,11 @@ public class ExcelUtil {
if(j==firstrownum + headNum){ if(j==firstrownum + headNum){
for(int h=0;h<headers.length;h++){ for(int h=0;h<headers.length;h++){
if(!value[h].trim().equals(headers[h])){ if(!value[h].trim().equals(headers[h])){
System.out.println("导入头错误"); result += "导入头出现错误";
return null; return null;
} }
} }
}else{ }else{
if (!hasEmpty) {
//判断是否是空数据并且存在空数据不是合并单元格 //判断是否是空数据并且存在空数据不是合并单元格
if(containSunday(hwb)){ if(containSunday(hwb)){
CellRangeAddress value3 = belongBigCell(cellRangeAddressList,j,3,hs); CellRangeAddress value3 = belongBigCell(cellRangeAddressList,j,3,hs);
...@@ -213,19 +177,22 @@ public class ExcelUtil { ...@@ -213,19 +177,22 @@ public class ExcelUtil {
|| (value[16] == null || value[16].equals("")) && value16 == null || (value[16] == null || value[16].equals("")) && value16 == null
|| (value[27] == null || value[27].equals("")) && value27 == null){ || (value[27] == null || value[27].equals("")) && value27 == null){
//如果存在,跳过插入 //如果存在,跳过插入
if(j != hs.getLastRowNum()){
result += "第 "+ Integer.valueOf(j + 1) +" 行存在空数据";
}
continue; continue;
} }
if((value[3] == null || value[3].equals("")) && value3 != null){ if((value[3] == null || value[3].equals("")) && value3 != null){
value[3] = parseDB(hs.getRow(value3.getFirstRow()).getCell(value3.getFirstColumn())); value[3] = parseDB(hs.getRow(value3.getFirstRow()).getCell(value3.getFirstColumn()));
} }
if((value[14] == null || value[14].equals("")) && value3 != null){ if((value[14] == null || value[14].equals("")) && value3 != null){
value[14] = parseDB(hs.getRow(value3.getFirstRow()).getCell(value3.getFirstColumn())); value[14] = parseDB(hs.getRow(value14.getFirstRow()).getCell(value14.getFirstColumn()));
} }
if((value[16] == null || value[16].equals("")) && value3 != null){ if((value[16] == null || value[16].equals("")) && value3 != null){
value[16] = parseDB(hs.getRow(value3.getFirstRow()).getCell(value3.getFirstColumn())); value[16] = parseDB(hs.getRow(value16.getFirstRow()).getCell(value16.getFirstColumn()));
} }
if((value[27] == null || value[27].equals("")) && value3 != null){ if((value[27] == null || value[27].equals("")) && value3 != null){
value[27] = parseDB(hs.getRow(value3.getFirstRow()).getCell(value3.getFirstColumn())); value[27] = parseDB(hs.getRow(value27.getFirstRow()).getCell(value27.getFirstColumn()));
} }
}else{ }else{
CellRangeAddress value3 = belongBigCell(cellRangeAddressList,j,3,hs); CellRangeAddress value3 = belongBigCell(cellRangeAddressList,j,3,hs);
...@@ -237,6 +204,9 @@ public class ExcelUtil { ...@@ -237,6 +204,9 @@ public class ExcelUtil {
|| (value[16] == null || value[16].equals("")) && value16 == null || (value[16] == null || value[16].equals("")) && value16 == null
|| (value[26] == null || value[26].equals("")) && value26 == null){ || (value[26] == null || value[26].equals("")) && value26 == null){
//如果存在,跳过插入 //如果存在,跳过插入
if(j != hs.getLastRowNum()){
result += "第 "+ Integer.valueOf(j + 1) +" 行存在空数据";
}
continue; continue;
} }
//如果属于合并单元格并且为空,则插入此合并单元格数据 //如果属于合并单元格并且为空,则插入此合并单元格数据
...@@ -244,13 +214,13 @@ public class ExcelUtil { ...@@ -244,13 +214,13 @@ public class ExcelUtil {
value[3] = parseDB(hs.getRow(value3.getFirstRow()).getCell(value3.getFirstColumn())); value[3] = parseDB(hs.getRow(value3.getFirstRow()).getCell(value3.getFirstColumn()));
} }
if((value[14] == null || value[14].equals("")) && value3 != null){ if((value[14] == null || value[14].equals("")) && value3 != null){
value[14] = parseDB(hs.getRow(value3.getFirstRow()).getCell(value3.getFirstColumn())); value[14] = parseDB(hs.getRow(value14.getFirstRow()).getCell(value14.getFirstColumn()));
} }
if((value[16] == null || value[16].equals("")) && value3 != null){ if((value[16] == null || value[16].equals("")) && value3 != null){
value[16] = parseDB(hs.getRow(value3.getFirstRow()).getCell(value3.getFirstColumn())); value[16] = parseDB(hs.getRow(value16.getFirstRow()).getCell(value16.getFirstColumn()));
} }
if((value[26] == null || value[26].equals("")) && value3 != null){ if((value[26] == null || value[26].equals("")) && value3 != null){
value[26] = parseDB(hs.getRow(value3.getFirstRow()).getCell(value3.getFirstColumn())); value[26] = parseDB(hs.getRow(value26.getFirstRow()).getCell(value26.getFirstColumn()));
} }
} }
...@@ -259,7 +229,6 @@ public class ExcelUtil { ...@@ -259,7 +229,6 @@ public class ExcelUtil {
} }
} }
} }
}
return values; return values;
} }
......
...@@ -68,7 +68,7 @@ public class SysRoleServiceImpl implements SysRoleService { ...@@ -68,7 +68,7 @@ public class SysRoleServiceImpl implements SysRoleService {
int userCount = sysUserMapper.countUserByRole(id); int userCount = sysUserMapper.countUserByRole(id);
//如果仍然有用户(如果用户被逻辑删除,则忽略此角色,但如果用于被停用,则依然被计算)是此角色,则该角色不可删除 //如果仍然有用户(如果用户被逻辑删除,则忽略此角色,但如果用于被停用,则依然被计算)是此角色,则该角色不可删除
if(userCount > 0){ if(userCount > 0){
throw new ServiceException(ResultServiceEnums.DATA_HAS_USED); throw new ServiceException(ResultServiceEnums.ROLE_HAS_USED);
}else{ }else{
//删除该角色所有的关联信息 //删除该角色所有的关联信息
sysRoleRepository.deleteRoleMenuByRoleId(id); sysRoleRepository.deleteRoleMenuByRoleId(id);
......
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