@ -13,6 +13,8 @@ import cn.jlw.util.excel.listener.MyValidateExcelCellDataListener;
import cn.jlw.validate.ValidateConfig ;
import com.alibaba.fastjson.JSON ;
import com.alibaba.fastjson.JSONObject ;
import com.fasterxml.jackson.core.JsonProcessingException ;
import com.fasterxml.jackson.databind.ObjectMapper ;
import com.ibeetl.admin.core.annotation.Function ;
import com.ibeetl.admin.core.entity.CoreUser ;
import com.ibeetl.admin.core.file.FileService ;
@ -23,6 +25,7 @@ import com.ibeetl.admin.core.util.HttpRequestLocal;
import com.ibeetl.admin.core.util.DateUtil ;
import com.ibeetl.admin.core.util.PlatformException ;
import com.ibeetl.admin.core.util.TimeTool ;
import com.ibeetl.admin.core.util.user.ZYUserInfo ;
import com.ibeetl.admin.core.web.JsonResult ;
import com.ibeetl.jlw.conf.KeyExpiredListener ;
import com.ibeetl.jlw.dao.SchoolClassDao ;
@ -32,7 +35,11 @@ import com.ibeetl.jlw.entity.dto.StudentBatchImportUniAdminDTO;
import com.ibeetl.jlw.entity.vo.StudentLogAnalysisVO ;
import com.ibeetl.jlw.entity.vo.StudentLoginLogVO ;
import com.ibeetl.jlw.entity.vo.StudentUseLogVO ;
import com.ibeetl.jlw.enums.AccountTypeEnum ;
import com.ibeetl.jlw.enums.SubsystemName ;
import com.ibeetl.jlw.service.* ;
import com.ibeetl.jlw.util.HttpUtil ;
import com.ibeetl.jlw.util.SubsystemUserUtil ;
import com.ibeetl.jlw.web.query.* ;
import io.swagger.annotations.Api ;
import io.swagger.annotations.ApiOperation ;
@ -46,6 +53,7 @@ import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.usermodel.* ;
import org.beetl.sql.core.engine.PageQuery ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.stereotype.Controller ;
import org.springframework.validation.BindingResult ;
import org.springframework.validation.annotation.Validated ;
@ -93,53 +101,86 @@ public class StudentController extends BaseController{
private static final String MODEL = "/jlw/student" ;
private static final String API = "/api/student" ;
@Autowired private ResourcesApplicationService resourcesApplicationService ;
@Autowired private StudentService studentService ;
@Autowired
private ResourcesApplicationService resourcesApplicationService ;
@Autowired private TeacherService teacherService ;
@Autowired
private StudentService studentService ;
@Autowired private UniversitiesCollegesService universitiesCollegesService ;
@Autowired
private TeacherService teacherService ;
@Autowired private UniversitySystemService universitySystemService ;
@Autowired
private UniversitiesCollegesService universitiesCollegesService ;
@Autowired private SchoolClassService schoolClassService ;
@Autowired
private UniversitySystemService universitySystemService ;
@Autowired private StudentDirectMessagesService studentDirectMessagesService ;
@Autowired
private SchoolClassService schoolClassService ;
@Autowired private TokenService tokenService ;
@Autowired
private StudentDirectMessagesService studentDirectMessagesService ;
@Autowired private CourseInfoService courseInfoService ;
@Autowired
private TokenService tokenService ;
@Autowired
private UniversitiesCollegesJurisdictionExperimentalSystemService universitiesCollegesJurisdictionExperimentalSystemService ;
@Autowired
private CourseInfoService courseInfoService ;
@Autowired private WrongQuestionService wrongQuestionService ;
@Autowired
private WrongQuestionService wrongQuestionService ;
@Autowired private CompetitionService competitionService ;
@Autowired private CompetitionStudentsService competitionStudentsService ;
@Autowired private CompetitionTaskOneQuestionService competitionTaskOneQuestionService ;
@Autowired private CompetitionTaskSecondQuestionService competitionTaskSecondQuestionService ;
@Autowired private CompetitionTaskSecondQuestionStepService competitionTaskSecondQuestionStepService ;
@Autowired
private CompetitionService competitionService ;
@Autowired
private CompetitionStudentsService competitionStudentsService ;
@Autowired
private CompetitionTaskOneQuestionService competitionTaskOneQuestionService ;
@Autowired
private CompetitionTaskSecondQuestionService competitionTaskSecondQuestionService ;
@Autowired
private CompetitionTaskSecondQuestionStepService competitionTaskSecondQuestionStepService ;
@Autowired private ExamService examService ;
@Autowired private ExamStudentsService examStudentsService ;
@Autowired private ExamTaskOneQuestionService examTaskOneQuestionService ;
@Autowired private ExamTaskSecondQuestionService examTaskSecondQuestionService ;
@Autowired private ExamTaskSecondQuestionStepService examTaskSecondQuestionStepService ;
@Autowired private ExamTaskThreeQuestionService examTaskThreeQuestionService ;
@Autowired private ExamTaskThreeQuestionStepService examTaskThreeQuestionStepService ;
@Autowired
private ExamService examService ;
@Autowired
private ExamStudentsService examStudentsService ;
@Autowired
private ExamTaskOneQuestionService examTaskOneQuestionService ;
@Autowired
private ExamTaskSecondQuestionService examTaskSecondQuestionService ;
@Autowired
private ExamTaskSecondQuestionStepService examTaskSecondQuestionStepService ;
@Autowired
private ExamTaskThreeQuestionService examTaskThreeQuestionService ;
@Autowired
private ExamTaskThreeQuestionStepService examTaskThreeQuestionStepService ;
@Autowired private ResourcesQuestionService resourcesQuestionService ;
@Autowired private ResourcesCompetitionService resourcesCompetitionService ;
@Autowired private ResourcesCompetitionStepService resourcesCompetitionStepService ;
@Autowired private ResourcesTrainingService resourcesTrainingService ;
@Autowired private ResourcesTrainingStepService resourcesTrainingStepService ;
@Autowired
private ResourcesQuestionService resourcesQuestionService ;
@Autowired
private ResourcesCompetitionService resourcesCompetitionService ;
@Autowired
private ResourcesCompetitionStepService resourcesCompetitionStepService ;
@Autowired
private ResourcesTrainingService resourcesTrainingService ;
@Autowired
private ResourcesTrainingStepService resourcesTrainingStepService ;
@Autowired private ResourcesInfoService resourcesInfoService ;
@Autowired
private ResourcesInfoService resourcesInfoService ;
@Autowired private CorePlatformService platformService ;
@Autowired
private CorePlatformService platformService ;
@Autowired private CoreUserService coreUserService ;
@Autowired private SysLogService sysLogService ;
@Autowired private SchoolClassDao schoolClassDao ;
@Autowired
private CoreUserService coreUserService ;
@Autowired
private SysLogService sysLogService ;
@Autowired
private SchoolClassDao schoolClassDao ;
@Autowired
FileService fileService ;
@ -154,7 +195,7 @@ public class StudentController extends BaseController{
/ * *
* 学 生 登 录
* 账 号 密 码
*
* < p >
* 登 陆
* /
@PostMapping ( API + "/login.do" )
@ -608,7 +649,8 @@ public class StudentController extends BaseController{
Map < Integer , List < CompetitionTaskOneQuestion > > groupByQuestionType = null ;
try {
groupByQuestionType = cT1QuestionList . stream ( ) . collect ( Collectors . groupingBy ( e - > e . getQuestionType ( ) ) ) ;
} catch ( Exception e ) { }
} catch ( Exception e ) {
}
if ( null ! = groupByQuestionType ) {
if ( null = = groupByQuestionType . get ( Integer . valueOf ( "1" ) ) ) {
groupByQuestionType . put ( 1 , new ArrayList < CompetitionTaskOneQuestion > ( ) ) ;
@ -691,7 +733,8 @@ public class StudentController extends BaseController{
Map < Integer , List < CompetitionTaskOneQuestion > > groupByQuestionType = null ;
try {
groupByQuestionType = cT1QuestionList . stream ( ) . collect ( Collectors . groupingBy ( e - > e . getQuestionType ( ) ) ) ;
} catch ( Exception e ) { }
} catch ( Exception e ) {
}
map . put ( "data" , groupByQuestionType ) ;
map . put ( "nowTime" , System . currentTimeMillis ( ) ) ;
@ -1066,7 +1109,8 @@ public class StudentController extends BaseController{
Map < Integer , List < ExamTaskOneQuestion > > groupByQuestionType = null ;
try {
groupByQuestionType = eT1QuestionList . stream ( ) . collect ( Collectors . groupingBy ( e - > e . getQuestionType ( ) ) ) ;
} catch ( Exception e ) { }
} catch ( Exception e ) {
}
if ( null ! = groupByQuestionType ) {
if ( null = = groupByQuestionType . get ( Integer . valueOf ( "1" ) ) ) {
groupByQuestionType . put ( 1 , new ArrayList < ExamTaskOneQuestion > ( ) ) ;
@ -1130,7 +1174,8 @@ public class StudentController extends BaseController{
Map < Integer , List < ExamTaskOneQuestion > > groupByQuestionType = null ;
try {
groupByQuestionType = eT1QuestionList . stream ( ) . collect ( Collectors . groupingBy ( e - > e . getQuestionType ( ) ) ) ;
} catch ( Exception e ) { }
} catch ( Exception e ) {
}
map . put ( "data" , groupByQuestionType ) ;
map . put ( "nowTime" , System . currentTimeMillis ( ) ) ;
@ -1475,7 +1520,8 @@ public class StudentController extends BaseController{
Map < Integer , List < ResourcesQuestion > > groupByQuestionType = null ;
try {
groupByQuestionType = resourcesQuestionList . stream ( ) . collect ( Collectors . groupingBy ( e - > e . getQuestionType ( ) ) ) ;
} catch ( Exception e ) { }
} catch ( Exception e ) {
}
map . put ( "data" , groupByQuestionType ) ;
map . put ( "nowTime" , System . currentTimeMillis ( ) ) ;
@ -1905,7 +1951,8 @@ public class StudentController extends BaseController{
Map < Integer , List < ResourcesQuestion > > groupByQuestionType = null ;
try {
groupByQuestionType = resourcesQuestionList . stream ( ) . collect ( Collectors . groupingBy ( e - > e . getQuestionType ( ) ) ) ;
} catch ( Exception e ) { }
} catch ( Exception e ) {
}
map . put ( "data" , groupByQuestionType ) ;
map . put ( "nowTime" , System . currentTimeMillis ( ) ) ;
@ -2039,6 +2086,7 @@ public class StudentController extends BaseController{
/ * *
* 2022 - 0 9 - 20 许 良 彤
*
* @param studentId
* @param coreUser
* @return
@ -2085,8 +2133,7 @@ public class StudentController extends BaseController{
ModelAndView view = new ModelAndView ( "/jlw/student/importPage.html" ) ;
if ( coreUser . isUniAdmin ( ) ) {
view . addObject ( "uploadFileUrl" , "/jlw/student/uniAdminImportBatchTemplate.json" ) ;
}
else if ( coreUser . isAdmin ( ) ) {
} else if ( coreUser . isAdmin ( ) ) {
view . addObject ( "uploadFileUrl" , "/jlw/student/adminImportBatchTemplate.json" ) ;
}
@ -2118,7 +2165,8 @@ public class StudentController extends BaseController{
} catch ( Exception e ) {
try {
ctList . add ( JSONObject . parseObject ( condition . getStudentTempJson ( ) , StudentQuery . StudentTemp . class ) ) ;
} catch ( Exception e1 ) { }
} catch ( Exception e1 ) {
}
}
ToolUtils . deleteNullList ( ctList ) ;
for ( int i = 0 ; null ! = ctList & & i < ctList . size ( ) ; i + + ) {
@ -2144,7 +2192,8 @@ public class StudentController extends BaseController{
competitionStudentsQuery . setCompetitionId ( condition . getCompetitionId ( ) ) ;
if ( ( ( Integer ) 1 ) . equals ( competition . getCompetitionType ( ) ) ) {
Map < Long , StudentQuery . StudentTemp > map = new HashMap < > ( ) ;
if ( null ! = ctList & & ctList . size ( ) > 0 ) { } else {
if ( null ! = ctList & & ctList . size ( ) > 0 ) {
} else {
List < CompetitionStudents > competitionStudentsList = competitionStudentsService . getCompetitionPersonalInfo ( competitionStudentsQuery ) ;
for ( int i = 0 ; null ! = competitionStudentsList & & i < competitionStudentsList . size ( ) ; i + + ) {
StudentQuery . StudentTemp studentTemp = new StudentQuery . StudentTemp ( ) ;
@ -2160,7 +2209,8 @@ public class StudentController extends BaseController{
jsonResultMap . put ( "studentTempMap" , map ) ;
} else if ( ( ( Integer ) 2 ) . equals ( competition . getCompetitionType ( ) ) ) {
Map < Long , StudentQuery . StudentTemp > map = new HashMap < > ( ) ;
if ( null ! = ctList & & ctList . size ( ) > 0 ) { } else {
if ( null ! = ctList & & ctList . size ( ) > 0 ) {
} else {
List < CompetitionStudents > competitionStudentsList = competitionStudentsService . getCompetitionTeamInfo ( competitionStudentsQuery ) ;
for ( int i = 0 ; null ! = competitionStudentsList & & i < competitionStudentsList . size ( ) ; i + + ) {
StudentQuery . StudentTemp studentTemp = new StudentQuery . StudentTemp ( ) ;
@ -2183,7 +2233,8 @@ public class StudentController extends BaseController{
if ( null ! = condition . getExamId ( ) & & ( ( Integer ) 1 ) . equals ( condition . getBeExamStudent ( ) ) ) {
Map < Long , StudentQuery . StudentTemp > map = new HashMap < > ( ) ;
if ( null ! = ctList & & ctList . size ( ) > 0 ) { } else {
if ( null ! = ctList & & ctList . size ( ) > 0 ) {
} else {
ExamStudentsQuery examStudentsQuery = new ExamStudentsQuery ( ) ;
examStudentsQuery . setExamId ( condition . getExamId ( ) ) ;
List < ExamStudents > examStudentsList = examStudentsService . getExamInfo ( examStudentsQuery ) ;
@ -2225,7 +2276,8 @@ public class StudentController extends BaseController{
}
PageQuery page = condition . getPageQuery ( ) ;
page . setPageNumber ( 1 ) ; page . setPageSize ( Integer . MAX_VALUE ) ;
page . setPageNumber ( 1 ) ;
page . setPageSize ( Integer . MAX_VALUE ) ;
PageQuery < Student > pageQuery = studentService . queryByCondition ( page ) ;
List < Student > list = pageQuery . getList ( ) ;
@ -2254,11 +2306,17 @@ public class StudentController extends BaseController{
@Function ( "student.add" )
@ResponseBody
@ApiOperation ( "添加" )
public JsonResult add ( @Validated ( ValidateConfig . ADD . class ) Student student , BindingResult result ) {
public JsonResult add ( @Validated ( ValidateConfig . ADD . class ) Student student , BindingResult result ) throws JsonProcessingException {
if ( result . hasErrors ( ) ) {
return JsonResult . failMessage ( result ) ;
} else {
student . setCodeFrom ( "后台新增" ) ;
Long schoolId = student . getSchoolClass ( ) . getUniversitiesCollegesId ( ) ;
ZYUserInfo info = new
ZYUserInfo (
coreUserService . getUserInfoByUsername ( student . getStudentSn ( ) ) ) ;
List < String > applications = universitiesCollegesJurisdictionExperimentalSystemService . getAllApplicationIdBySchoolId ( schoolId ) ;
SubsystemUserUtil . subsystemUserCreate ( Arrays . asList ( info ) , applications ) ;
return studentService . add ( student ) ;
}
}
@ -2455,7 +2513,8 @@ public class StudentController extends BaseController{
if ( ! Objects . isNull ( condition . getLoginEndTime ( ) ) ) {
condition . setLoginEndTime ( DateUtil . endOfDay ( condition . getLoginEndTime ( ) ) ) ;
}
condition . setPage ( 1 ) ; condition . setLimit ( Integer . MAX_VALUE + 0 L ) ;
condition . setPage ( 1 ) ;
condition . setLimit ( Integer . MAX_VALUE + 0 L ) ;
// PageQuery<StudentLoginLogVO> page = studentService.queryStudentLoginLogByCondition(condition.getPageQuery());
PageQuery < StudentLoginLogVO > page = studentService . queryUserLoginLogByCondition ( condition . getPageQuery ( ) ) ;
@ -2498,7 +2557,8 @@ public class StudentController extends BaseController{
public String studentUseLogListExport ( StudentUseLogQuery condition , @SCoreUser CoreUser coreUser ) throws IOException {
Assert . isFalse ( coreUser . isStudent ( ) , "暂无权限访问!" ) ;
condition . setPage ( 1 ) ; condition . setLimit ( Integer . MAX_VALUE + 0 L ) ;
condition . setPage ( 1 ) ;
condition . setLimit ( Integer . MAX_VALUE + 0 L ) ;
PageQuery < StudentUseLogVO > page = studentService . queryStudentUseLogByCondition ( condition . getPageQuery ( ) ) ;
String filename = StrUtil . format ( "学生使用日志导出{}.xlsx" , System . currentTimeMillis ( ) ) ;
@ -2558,7 +2618,8 @@ public class StudentController extends BaseController{
if ( ! Objects . isNull ( condition . getLoginEndTime ( ) ) ) {
condition . setLoginEndTime ( DateUtil . endOfDay ( condition . getLoginEndTime ( ) ) ) ;
}
condition . setPage ( 1 ) ; condition . setLimit ( Integer . MAX_VALUE + 0 L ) ;
condition . setPage ( 1 ) ;
condition . setLimit ( Integer . MAX_VALUE + 0 L ) ;
// PageQuery<StudentLogAnalysisVO> page = studentService.queryStudentLogAnalysisByCondition(condition.getPageQuery());
PageQuery < StudentLogAnalysisVO > page = studentService . queryStatisticalStatementNumberPeopleByCondition ( condition . getPageQuery ( ) ) ;
@ -2695,12 +2756,14 @@ public class StudentController extends BaseController{
if ( null ! = response & & null ! = response . getOutputStream ( ) ) {
response . getOutputStream ( ) . close ( ) ;
}
} catch ( Exception e ) { }
} catch ( Exception e ) {
}
}
}
/ * *
* 设 置 有 效 性
*
* @param offset 主 影 响 单 元 格 所 在 列 , 即 此 单 元 格 由 哪 个 单 元 格 影 响 联 动
* @param sheet
* @param rowNum 行 数
@ -2733,6 +2796,7 @@ public class StudentController extends BaseController{
/ * *
* 添 加 数 据 有 效 性 检 查 .
*
* @param sheet 要 添 加 此 检 查 的 Sheet
* @param firstRow 开 始 行
* @param lastRow 结 束 行
@ -2767,11 +2831,11 @@ public class StudentController extends BaseController{
/ * *
* 计 算 formula
*
* @param offset 偏 移 量 , 如 果 给 0 , 表 示 从 A 列 开 始 , 1 , 就 是 从 B 列
* @param rowId 第 几 行
* @param colCount 一 共 多 少 列
* @return 如 果 给 入 参 1 , 1 , 10. 表 示 从 B1 - K1 。 最 终 返 回 $B$1 : $K$1
*
* /
public static String getRange ( int offset , int rowId , int colCount ) {
char start = ( char ) ( 'A' + offset ) ;
@ -2927,12 +2991,14 @@ public class StudentController extends BaseController{
if ( null ! = response & & null ! = response . getOutputStream ( ) ) {
response . getOutputStream ( ) . close ( ) ;
}
} catch ( Exception e ) { }
} catch ( Exception e ) {
}
}
}
/ * *
* 导 出 批 量 模 板
*
* @return
* /
@SneakyThrows
@ -2948,8 +3014,7 @@ public class StudentController extends BaseController{
if ( coreUser . isAdmin ( ) ) {
// 输出 Excel
createExcel ( Arrays . asList ( new StudentBatchImportAdminDTO ( ) ) , response . getOutputStream ( ) ) ;
}
else if ( coreUser . isUniAdmin ( ) ) {
} else if ( coreUser . isUniAdmin ( ) ) {
// 输出 Excel
createExcel ( Arrays . asList ( new StudentBatchImportUniAdminDTO ( ) ) , response . getOutputStream ( ) ) ;
}
@ -2960,6 +3025,7 @@ public class StudentController extends BaseController{
/ * *
* 功 能 描 述 : < br >
* 〈 导 入 批 量 模 板 数 据 〉
*
* @param file
* @param coreUser 一 般 这 个 接 口 都 是 学 校 管 理 员 操 作 的 , 所 以 直 接 取 这 个 里 面 的 机 构 ID 就 代 表 这 个 学 校 的 机 构 ID
* @return { @link JsonResult }
@ -3052,20 +3118,30 @@ public class StudentController extends BaseController{
// 再次判断错误的结果集
Assert . isTrue ( CollectionUtil . isEmpty ( listener . getFailMessage ( ) ) , JSONUtil . toJsonStr ( listener . getFailMessage ( ) ) ) ;
// 导入并添加身份信息
list . forEach ( studentService : : add ) ;
List < ZYUserInfo > zyUserInfos = new ArrayList < > ( ) ;
Long schoolId = list . get ( 0 ) . getSchoolClass ( ) . getUniversitiesCollegesId ( ) ;
for ( Student student : list ) {
studentService . add ( student ) ;
zyUserInfos . add ( new
ZYUserInfo (
coreUserService . getUserInfoByUsername ( student . getStudentSn ( ) )
) ) ;
}
List < String > applications = universitiesCollegesJurisdictionExperimentalSystemService . getAllApplicationIdBySchoolId ( schoolId ) ;
SubsystemUserUtil . subsystemUserCreate ( zyUserInfos , applications ) ;
platformService . clearDictCache ( ) ;
}
catch ( IllegalArgumentException exception ) {
} catch ( IllegalArgumentException exception ) {
return JsonResult . failMessage ( exception . getMessage ( ) ) . setCode ( DIY_ERROR . getCode ( ) ) ;
}
return JsonResult . successMessage ( "导入成功!" ) ;
}
/ * *
* 功 能 描 述 : < br >
* 〈 导 入 批 量 模 板 数 据 〉
* 批 量 导 入 题 目 excel 版 本 , 只 支 持 单 选 多 选 , 对 错 吧
*
* @param file
* @param coreUser 超 管 的 身 份 , 不 能 直 接 用
* @return { @link JsonResult }
@ -3134,8 +3210,7 @@ public class StudentController extends BaseController{
// 导入并添加身份信息
list . forEach ( studentService : : add ) ;
platformService . clearDictCache ( ) ;
}
catch ( IllegalArgumentException exception ) {
} catch ( IllegalArgumentException exception ) {
return JsonResult . failMessage ( exception . getMessage ( ) ) . setCode ( DIY_ERROR . getCode ( ) ) ;
}
@ -3144,6 +3219,7 @@ public class StudentController extends BaseController{
/ * *
* 消 费 并 记 录 错 误 信 息
*
* @param t
* @param tConsumer
* @param listener