Commit 60066ee4 authored by curryft's avatar curryft

Merge branch 'master' of ssh://103.249.252.28:10022/lcy/education

parents d719cb1b dc33b5a0
...@@ -280,7 +280,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -280,7 +280,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"LEFT JOIN b_r_student_chapter bsc on bc.business_id = bsc.chapter_id\n" + "LEFT JOIN b_r_student_chapter bsc on bc.business_id = bsc.chapter_id\n" +
"LEFT JOIN b_student bs on bsc.student_id = bs.business_id\n" + "LEFT JOIN b_student bs on bsc.student_id = bs.business_id\n" +
"LEFT JOIN s_user su on su.login_name = bs.`code` \n" + "LEFT JOIN s_user su on su.login_name = bs.`code` \n" +
"where bc.business_id = #{chapterId} and bsc.score = '-1'</script>") "where bc.business_id = #{chapterId} and bsc.score = '-1' and bsc.is_complete = '1'</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BChapter> queryBchapterStudentById(String chapterId); List<BChapter> queryBchapterStudentById(String chapterId);
......
...@@ -86,6 +86,9 @@ public class BChapter extends IdEntity<BChapter> { ...@@ -86,6 +86,9 @@ public class BChapter extends IdEntity<BChapter> {
@Transient @Transient
private String studentNum; private String studentNum;
@Transient
private String stuScore;
@Transient @Transient
private String videoUrl; private String videoUrl;
......
...@@ -202,8 +202,9 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -202,8 +202,9 @@ 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);
} }else{
scoreInfoDTO.setScore(-1); scoreInfoDTO.setScore(-1);
}
scoreInfoDTO.setStudentId(stuid); scoreInfoDTO.setStudentId(stuid);
int result; int result;
//查询是否已有关联关系 //查询是否已有关联关系
......
...@@ -202,7 +202,7 @@ public class BCodeController extends PaginationController { ...@@ -202,7 +202,7 @@ public class BCodeController extends PaginationController {
+ UserUtil.getUserInfoProp(getToken(), UserUtil.USER_ID) + File.separator; + UserUtil.getUserInfoProp(getToken(), UserUtil.USER_ID) + File.separator;
File file = new File(serverPath+filePath); File file = new File(serverPath+filePath);
String finished = bChapterService.queryIsCompleteByUserIdAndChapId(UserUtil.getUserInfoProp(getToken(), UserUtil.USER_ID),chapId); String finished = bChapterService.queryIsCompleteByUserIdAndChapId(UserUtil.getUserInfoProp(getToken(), UserUtil.USER_ID),chapId);
if(finished!=null&&finished.equals("1")){ if(finished!=null&&finished.equals("1")&&!fileType.equals("6")){
throw new ServiceException(ResultServiceEnums.EXPERIMENT_FINISHED); throw new ServiceException(ResultServiceEnums.EXPERIMENT_FINISHED);
} }
if(fileType.equals("1")&&!file.exists()){//新增文件夹 if(fileType.equals("1")&&!file.exists()){//新增文件夹
......
...@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service; ...@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import java.util.logging.Logger;
/** /**
* Created by lcy on 18/1/9. * Created by lcy on 18/1/9.
...@@ -54,6 +55,7 @@ public class BCodeLxcServiceImpl implements BCodeLxcService { ...@@ -54,6 +55,7 @@ public class BCodeLxcServiceImpl implements BCodeLxcService {
@Override @Override
public CommandResult startBCodeLxc(BCodeLxc lxc) { public CommandResult startBCodeLxc(BCodeLxc lxc) {
Logger logger = Logger.getAnonymousLogger();
CommandResult result = null; CommandResult result = null;
List<String> ports = null; List<String> ports = null;
/*初始化port 20000 - 30000 */ /*初始化port 20000 - 30000 */
...@@ -62,13 +64,19 @@ public class BCodeLxcServiceImpl implements BCodeLxcService { ...@@ -62,13 +64,19 @@ public class BCodeLxcServiceImpl implements BCodeLxcService {
Integer portSSH = global.getLxcInitPort()+10000; Integer portSSH = global.getLxcInitPort()+10000;
Integer maxPortSSH = global.getLxcMaxPort()+10000; Integer maxPortSSH = global.getLxcMaxPort()+10000;
ports = rcRedisServiceImpl.getList("lxcPorts"); ports = rcRedisServiceImpl.getList("lxcPorts");
logger.info("------------------------------------------------------------------------------------------------");
logger.info(ports.size()+"redis 端口使用数量");
if(null == ports || 0 == ports.size()) if(null == ports || 0 == ports.size())
ports = new ArrayList<>(); ports = new ArrayList<>();
else{ else{
port = this.getIdleWithPorts(ports,port,maxPort); port = this.getIdleWithPorts(ports,port,maxPort);
logger.info("<port>:"+port);
portSSH = this.getIdleWithPorts(ports,portSSH,maxPortSSH); portSSH = this.getIdleWithPorts(ports,portSSH,maxPortSSH);
logger.info("<portSSH>:"+portSSH);
} }
/*端口满了*/ /*端口满了*/
if(0 == port||0 == portSSH) { if(0 == port||0 == portSSH) {
result = new CommandResult(ResultCode.FAIL,"端口全部占用,请稍后!",lxc); result = new CommandResult(ResultCode.FAIL,"端口全部占用,请稍后!",lxc);
...@@ -150,11 +158,15 @@ public class BCodeLxcServiceImpl implements BCodeLxcService { ...@@ -150,11 +158,15 @@ public class BCodeLxcServiceImpl implements BCodeLxcService {
* @return * @return
*/ */
private synchronized Integer getIdleWithPorts(List<String> ports, Integer port, Integer maxPort) { private synchronized Integer getIdleWithPorts(List<String> ports, Integer port, Integer maxPort) {
Logger logger = Logger.getAnonymousLogger();
logger.info("------------------------getIdleWithPorts-------------------------------------");
logger.info("[portsSize:]"+ports.size());
logger.info("[port jisuan:]"+(ports.size() -1 - (maxPort - port)) );
int choosePort = 0; int choosePort = 0;
/*端口占用满了*/ /*端口占用满了*/
if(ports.size() -1 - (maxPort - port) == 0) if(ports.size() -1 - (maxPort - port) == 0)
return choosePort; return choosePort;
for(int i = port ; i < maxPort - port ; i++){ for(int i = port ; i < maxPort ; i++){
boolean flag = false; boolean flag = false;
for (int j = 0 ; j < ports.size() ; j++){ for (int j = 0 ; j < ports.size() ; j++){
if(i - Integer.parseInt(ports.get(j)) == 0) { if(i - Integer.parseInt(ports.get(j)) == 0) {
......
...@@ -365,7 +365,12 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -365,7 +365,12 @@ public class BCodeServiceImpl implements BCodeService {
studentId=""; studentId="";
} }
//根据slId获得章节及学生 //根据slId获得章节及学生
students = brSlStudentRepository.queryStudentBySlId(slId,studentId); if(studentId.equals("")){//工程
students = brSlStudentRepository.queryStudentBySlId1(slId,studentId);
}else {
students = brSlStudentRepository.queryStudentBySlId2(slId,studentId);
}
//查询该课程的所有章节 //查询该课程的所有章节
//List<BChapter> chapterList = bChapterRepository.queryChapterBySlId(slId); //List<BChapter> chapterList = bChapterRepository.queryChapterBySlId(slId);
if(students.size()>=1){ if(students.size()>=1){
...@@ -399,31 +404,52 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -399,31 +404,52 @@ public class BCodeServiceImpl implements BCodeService {
//学生代码文件所在目录 //学生代码文件所在目录
String codePath = SlPath + student.getChapterId() +File.separator String codePath = SlPath + student.getChapterId() +File.separator
+ codeType + student.getStudentId() + File.separator; + codeType + student.getStudentId() + File.separator;
File userFile = new File(codePath); File codeFile = new File(codePath);
//得到目录下的所有文件 if(!codeFile.exists()){
File javaFile[] = userFile.listFiles(); codeFile.mkdirs();
if(javaFile!=null) { }
for (File simpleFile : javaFile) {
//将文件复制出去
try { try {
int bytesum = 0; // if(student.getExperimentType().equals("2")||student.getExperimentType().equals("4")){
int byteread = 0; FileUtils.copyDirectory(codeFile,copyFile);
InputStream inStream = new FileInputStream(simpleFile.getPath()); //读入原文件 // }else {
FileOutputStream fs = new FileOutputStream(finalPath + simpleFile.getName()); // File javaFile[] = codeFile.listFiles();
byte[] buffer = new byte[102400]; // for(File simpleFile : javaFile){
int length; // File finalFile = new File(finalPath + simpleFile.getName());
while ((byteread = inStream.read(buffer)) != -1) { // FileUtils.copyFile(javaFile[0],finalFile);
bytesum += byteread; //字节数 文件大小 // }
fs.write(buffer, 0, byteread); //
} // }
inStream.close();
fs.close();
} catch (Exception e) { } catch (Exception e) {
System.out.println("复制时出错"); System.out.println("复制逻辑出错,可能路径不对!");
e.printStackTrace(); e.printStackTrace();
} }
}
}
// File userFile = new File(codePath);
// //得到目录下的所有文件
// File javaFile[] = userFile.listFiles();
// if(javaFile!=null) {
// for (File simpleFile : javaFile) {
// //将文件复制出去
// try {
// int bytesum = 0;
// int byteread = 0;
// InputStream inStream = new FileInputStream(simpleFile.getPath()+File.separator+"42432"); //读入原文件
// FileOutputStream fs = new FileOutputStream(finalPath + simpleFile.getName());
// byte[] buffer = new byte[102400];
// int length;
// while ((byteread = inStream.read(buffer)) != -1) {
// bytesum += byteread; //字节数 文件大小
// fs.write(buffer, 0, byteread);
// }
// inStream.close();
// fs.close();
// } catch (Exception e) {
// System.out.println("复制时出错");
// e.printStackTrace();
// }
// }
// }
} }
}else{ }else{
throw new ServiceException(ResultServiceEnums.NO_STUDENT_HOMEWORK); throw new ServiceException(ResultServiceEnums.NO_STUDENT_HOMEWORK);
......
...@@ -10,8 +10,10 @@ import org.rcisoft.common.component.Global; ...@@ -10,8 +10,10 @@ import org.rcisoft.common.component.Global;
import org.rcisoft.common.controller.PaginationController; import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.common.model.GridModel; import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.constant.MessageConstant; import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result; import org.rcisoft.core.result.Result;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
...@@ -122,6 +124,30 @@ public class BFileController extends PaginationController<BFile> { ...@@ -122,6 +124,30 @@ public class BFileController extends PaginationController<BFile> {
videoUrl); videoUrl);
} }
@ApiOperation(value="上传license", notes="上传license证书文件")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "license文件", required = true, dataType = "MultipartFile")})
@PostMapping(value = "/uploadLicenseWithoutAuth")
public Result uploadLicense(HttpServletRequest request) {
List<MultipartFile> list = ((MultipartHttpServletRequest)request).getFiles("file");
try {
if(list.size()>0){
bFileService.uploadLicense(list.get(0));
}else{
throw new ServiceException(ResultServiceEnums.UPLOAD_ERROR);
}
} catch (IOException e) {
e.printStackTrace();
throw new ServiceException(ResultServiceEnums.UPLOAD_ERROR);
}
return Result.builder(new PersistModel(1),
"license上传成功",
MessageConstant.MESSAGE_ALERT_ERROR,
"");
}
/** /**
* 下载文件 * 下载文件
* @param chapterId * @param chapterId
......
...@@ -5,6 +5,7 @@ import org.rcisoft.core.aop.PageUtil; ...@@ -5,6 +5,7 @@ import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List; import java.util.List;
/** /**
...@@ -50,4 +51,10 @@ public interface BFileService { ...@@ -50,4 +51,10 @@ public interface BFileService {
public String uploadVideoToServer(List<MultipartFile> list, BFile bFile, String token); public String uploadVideoToServer(List<MultipartFile> list, BFile bFile, String token);
public BFile queryFileUrlByChapterId(String chapterId); public BFile queryFileUrlByChapterId(String chapterId);
/**
* 将license证书文件输出到指定路径下
* @param file
*/
public void uploadLicense(MultipartFile file) throws IOException;
} }
...@@ -8,6 +8,8 @@ import org.rcisoft.business.bfile.service.BFileService; ...@@ -8,6 +8,8 @@ import org.rcisoft.business.bfile.service.BFileService;
import org.rcisoft.business.bsl.task.SlTask; import org.rcisoft.business.bsl.task.SlTask;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.bean.RcLkConfigBean;
import org.rcisoft.core.component.RcVerify;
import org.rcisoft.core.constant.DelStatus; import org.rcisoft.core.constant.DelStatus;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
...@@ -42,6 +44,11 @@ public class BFileServiceImpl implements BFileService { ...@@ -42,6 +44,11 @@ public class BFileServiceImpl implements BFileService {
private SlTask slTask; private SlTask slTask;
@Autowired @Autowired
private Global global; private Global global;
@Autowired
private RcVerify rcVerify;
@Autowired
private RcLkConfigBean rcLkConfigBean;
@Override @Override
public BFile selectOne(String businessId){ public BFile selectOne(String businessId){
...@@ -169,7 +176,7 @@ public class BFileServiceImpl implements BFileService { ...@@ -169,7 +176,7 @@ public class BFileServiceImpl implements BFileService {
+ path + bFile.getChapterId(); + path + bFile.getChapterId();
File tempFilePath = new File(tempPath); File tempFilePath = new File(tempPath);
if(tempFilePath.exists()){ if(tempFilePath.exists()){
tempFilePath.delete(); FileUtils.deleteDirectory(tempFilePath);
} }
String realFilePath = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator String realFilePath = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
...@@ -177,7 +184,10 @@ public class BFileServiceImpl implements BFileService { ...@@ -177,7 +184,10 @@ public class BFileServiceImpl implements BFileService {
+ path + bFile.getChapterId() + File.separator + path + bFile.getChapterId() + File.separator
+ pathName; + pathName;
File directory = new File(realFilePath); File directory = new File(realFilePath);
if(directory.exists()){
FileUtils.moveDirectory(directory,tempFilePath); FileUtils.moveDirectory(directory,tempFilePath);
}
} }
...@@ -279,6 +289,32 @@ public class BFileServiceImpl implements BFileService { ...@@ -279,6 +289,32 @@ public class BFileServiceImpl implements BFileService {
return bFileRepository.queryFileUrlByChapterId(chapterId); return bFileRepository.queryFileUrlByChapterId(chapterId);
} }
@Override
public void uploadLicense(MultipartFile file) {
try {
BufferedOutputStream stream = null;
String path = global.getBASE_UPLOAD_SERVER_LOCATION() + rcLkConfigBean.getLicPath();
File oldFile = new File(path);
if(oldFile.exists()){
FileUtils.forceDelete(oldFile);
}
File newFile = new File(path);
stream = new BufferedOutputStream(new FileOutputStream(newFile));
byte[] bytes = file.getBytes();
stream.write(bytes,0,bytes.length);
stream.flush();
stream.close();
rcVerify.verify();
} catch (Exception e) {
e.printStackTrace();
throw new ServiceException(ResultServiceEnums.UPLOAD_ERROR);
}
return;
}
public String uploadFileToServer(MultipartFile file, BFile bFile) throws Exception{ public String uploadFileToServer(MultipartFile file, BFile bFile) throws Exception{
String fileUrl = ""; String fileUrl = "";
...@@ -301,4 +337,7 @@ public class BFileServiceImpl implements BFileService { ...@@ -301,4 +337,7 @@ public class BFileServiceImpl implements BFileService {
} }
return fileUrl; return fileUrl;
} }
} }
...@@ -59,7 +59,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -59,7 +59,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@Update("<script>update b_lesson_direction set direction_id = #{directionId} where sl_id = #{slId}</script>") @Update("<script>update b_lesson_direction set direction_id = #{directionId} where sl_id = #{slId}</script>")
int updateDirectionBySlId(BLessonDirection direction); int updateDirectionBySlId(BLessonDirection direction);
@Select("SELECT SUM(class_hour) classHour FROM b_chapter where lesson_id = #{businessId} and pid != '-1'") @Select("SELECT COALESCE(SUM(class_hour),0) classHour FROM b_chapter where lesson_id = #{businessId} and pid != '-1'")
int queryClassHourByLessonId(String businessId); int queryClassHourByLessonId(String businessId);
} }
package org.rcisoft.business.brclassstudent.dao; package org.rcisoft.business.brclassstudent.dao;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
...@@ -59,5 +60,13 @@ public interface BRClassStudentRepository extends BaseMapper<BRClassStudent> { ...@@ -59,5 +60,13 @@ public interface BRClassStudentRepository extends BaseMapper<BRClassStudent> {
"WHERE\n" + "WHERE\n" +
"\tb2.business_id = #{classId}</script>") "\tb2.business_id = #{classId}</script>")
int selectStuentNumByClassId(String classId); int selectStuentNumByClassId(String classId);
/**
* 根据学生code 删除所有记录
* @param stuCode
* @return
*/
@Delete("delete from b_r_class_student where student_code = #{stuCode}")
int deleteCSByStuId(String stuCode);
} }
...@@ -92,9 +92,25 @@ public interface BRSlStudentRepository extends BaseMapper<BRSlStudent> { ...@@ -92,9 +92,25 @@ public interface BRSlStudentRepository extends BaseMapper<BRSlStudent> {
"and bc.sl_id = #{slId} " + "and bc.sl_id = #{slId} " +
"and bc.pid != '-1' AND bc.is_test like '%1%' " + "and bc.pid != '-1' AND bc.is_test like '%1%' " +
"and brc.is_complete = 1 " + "and brc.is_complete = 1 " +
"<if test=\"studentId !=null and studentId !=''\">" + "</script>")
"and FIND_IN_SET(su.business_id,#{studentId}) " + List<BStudentDto> queryStudentBySlId1(@Param("slId") String slId, @Param("studentId")String studentId);
"</if></script>")
List<BStudentDto> queryStudentBySlId(@Param("slId") String slId, @Param("studentId")String studentId); @Select("<script>select bc.business_id AS chapterId," +
"bc.experiment_type AS experimentType," +
"bc.sort,su.business_id AS studentId," +
"bs.`code` AS studentCode," +
"su.`name` AS studentName,\n" +
"(select sort from b_chapter where business_id = bc.pid )AS pSort " +
"from b_chapter bc \n" +
"LEFT JOIN b_r_student_chapter brc ON bc.business_id = brc.chapter_id\n" +
"LEFT JOIN b_student bs on bs.business_id = brc.student_id \n" +
"LEFT JOIN s_user su on su.login_name = bs.`code`\n" +
"where bc.del_flag = 0 and bc.flag = 1 " +
"and bc.sl_id = #{slId} " +
"and bc.pid != '-1' AND bc.is_test like '%1%' " +
"and brc.is_complete = 1 " +
"and FIND_IN_SET(brc.student_id,#{studentId}) " +
"</script>")
List<BStudentDto> queryStudentBySlId2(@Param("slId") String slId, @Param("studentId")String studentId);
} }
...@@ -156,7 +156,7 @@ public interface BSlRepository extends BaseMapper<BSl> { ...@@ -156,7 +156,7 @@ public interface BSlRepository extends BaseMapper<BSl> {
"LEFT JOIN b_term t9 ON t1.term_code = t9.`code`\n" + "LEFT JOIN b_term t9 ON t1.term_code = t9.`code`\n" +
"LEFT JOIN b_lesson t6 ON t1.lesson_code = t6.`code`\n" + "LEFT JOIN b_lesson t6 ON t1.lesson_code = t6.`code`\n" +
"LEFT JOIN (SELECT count(t3.business_id) AS t_num,t4.`name`,t2.`code`,t4.head_pic FROM b_teacher t2\n" + "LEFT JOIN (SELECT count(t3.business_id) AS t_num,t4.`name`,t2.`code`,t4.head_pic FROM b_teacher t2\n" +
"LEFT JOIN b_sl t3 ON t2.`code` = t3.teacher_code\n" + "LEFT JOIN b_sl t3 ON t2.`code` = t3.teacher_code AND (t3.audit_status='2'|| t3.audit_status='4')\n" +
"LEFT JOIN s_user t4 ON t4.login_name = t2.`code`\n" + "LEFT JOIN s_user t4 ON t4.login_name = t2.`code`\n" +
"GROUP BY t3.teacher_code) t5 ON t5.`code` = t1.teacher_code\n" + "GROUP BY t3.teacher_code) t5 ON t5.`code` = t1.teacher_code\n" +
"WHERE\n" + "WHERE\n" +
......
...@@ -279,7 +279,7 @@ public class BSlServiceImpl implements BSlService { ...@@ -279,7 +279,7 @@ public class BSlServiceImpl implements BSlService {
if(bSl==null) if(bSl==null)
throw new ServiceException(ResultServiceEnums.SL_INFO_NOT_EXISTS); throw new ServiceException(ResultServiceEnums.SL_INFO_NOT_EXISTS);
//action.deleteProject(bSl.getGitLabProjectId()); //action.deleteProject(bSl.getGitLabProjectId());
//brSlStudentRepository.deleteBatch(bSl.getCode()); brSlStudentRepository.deleteBatch(bSl.getCode());
BSl bsl = new BSl(); BSl bsl = new BSl();
bsl.setBusinessId(id); bsl.setBusinessId(id);
UserUtil.setCurrentMergeOperation(bsl); UserUtil.setCurrentMergeOperation(bsl);
......
...@@ -124,9 +124,9 @@ public interface BStudentRepository extends BaseMapper<BStudent> { ...@@ -124,9 +124,9 @@ public interface BStudentRepository extends BaseMapper<BStudent> {
String queryStudentByUserId(String userId); String queryStudentByUserId(String userId);
@Select("<script>SELECT t3.code,t4.`name`,t6.class_name as className,\n" + @Select("<script>SELECT t3.business_id as businessId, t3.code,t4.`name`,t6.class_name as className,\n" +
"(CONCAT((SELECT COUNT(*) from b_r_student_chapter " + "(CONCAT((SELECT COUNT(*) from b_r_student_chapter " +
"where student_id = t4.business_id and sl_id = #{slId} and is_complete = '1')," + "where student_id = t3.business_id and sl_id = #{slId} and is_complete = '1')," +
"'/'," + "'/'," +
"(SELECT COUNT(*) from b_chapter where is_test like CONCAT('%','1','%') and sl_id = #{slId})) \n" + "(SELECT COUNT(*) from b_chapter where is_test like CONCAT('%','1','%') and sl_id = #{slId})) \n" +
") AS finishNum " + ") AS finishNum " +
......
...@@ -38,7 +38,8 @@ public class BStudent extends IdEntity<BStudent> { ...@@ -38,7 +38,8 @@ public class BStudent extends IdEntity<BStudent> {
return code != null ? code.equals(bStudent.code) : bStudent.code == null; return code != null ? code.equals(bStudent.code) : bStudent.code == null;
} }
// /*学生ID*/
// private String stuId;
/*学号*/ /*学号*/
@Length(min = 8,max = 64,message = "长度最小为8,最大为50") @Length(min = 8,max = 64,message = "长度最小为8,最大为50")
......
...@@ -3,6 +3,8 @@ package org.rcisoft.business.bstudent.service.impl; ...@@ -3,6 +3,8 @@ package org.rcisoft.business.bstudent.service.impl;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.rcisoft.business.brclassstudent.dao.BRClassStudentRepository;
import org.rcisoft.business.brclassstudent.entity.BRClassStudent;
import org.rcisoft.business.brslstudent.dao.BRSlStudentRepository; import org.rcisoft.business.brslstudent.dao.BRSlStudentRepository;
import org.rcisoft.business.bstudent.dao.BStudentRepository; import org.rcisoft.business.bstudent.dao.BStudentRepository;
import org.rcisoft.business.bstudent.entity.BStudent; import org.rcisoft.business.bstudent.entity.BStudent;
...@@ -47,6 +49,8 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -47,6 +49,8 @@ public class BStudentServiceImpl implements BStudentService {
@Autowired @Autowired
private BStudentRepository bStudentRepository; private BStudentRepository bStudentRepository;
@Autowired @Autowired
private BRClassStudentRepository brClassStudentRepository;
@Autowired
private SysUserService userService; private SysUserService userService;
@Autowired @Autowired
private SysUserMapper sysUserMapper; private SysUserMapper sysUserMapper;
...@@ -249,7 +253,10 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -249,7 +253,10 @@ public class BStudentServiceImpl implements BStudentService {
sysUserMapper.deleteByCode(student.getCode()); sysUserMapper.deleteByCode(student.getCode());
bStudent.setDeleted(); bStudent.setDeleted();
UserUtil.setCurrentMergeOperation(bStudent); UserUtil.setCurrentMergeOperation(bStudent);
int line = bStudentRepository.logicalDelete(bStudent); int line = bStudentRepository.logicalDelete(bStudent);
brClassStudentRepository.deleteCSByStuId(student.getCode());
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
} }
......
...@@ -36,6 +36,6 @@ public interface TPaperChapterRepository extends BaseMapper<TPaperChapter> { ...@@ -36,6 +36,6 @@ public interface TPaperChapterRepository extends BaseMapper<TPaperChapter> {
List<TPaperChapter> queryTPaperChapterInfo(@Param("slId") String slId, @Param("chapterId") String chapterId); List<TPaperChapter> queryTPaperChapterInfo(@Param("slId") String slId, @Param("chapterId") String chapterId);
@Select("SELECT pdesc from t_paper_chapter WHERE chap_id = #{chapterId}") @Select("SELECT pdesc from t_paper_chapter WHERE chap_id = #{chapterId}")
String queryDescByChapId(String chapterId); List<String> queryDescByChapId(String chapterId);
} }
...@@ -64,7 +64,7 @@ public interface TQuestionRepository extends BaseMapper<TQuestion> { ...@@ -64,7 +64,7 @@ public interface TQuestionRepository extends BaseMapper<TQuestion> {
@Select("<script>select q_num from t_paper_chapter_section pcs " + @Select("<script>select q_num from t_paper_chapter_section pcs " +
"LEFT JOIN t_paper_chapter tpc ON tpc.business_id = pcs.pc_id " + "LEFT JOIN t_paper_chapter tpc ON tpc.business_id = pcs.pc_id " +
"where q_type = #{qtype} and tpc.chap_id = #{chapId}</script>") "where q_type = #{qtype} and tpc.chap_id = #{chapId}</script>")
String queryNumByType(@Param("qtype") String qtype,@Param("chapId") String chapId); List<String> queryNumByType(@Param("qtype") String qtype,@Param("chapId") String chapId);
@Select("<script>SELECT tq.* from t_question tq \n" + @Select("<script>SELECT tq.* from t_question tq \n" +
......
...@@ -234,7 +234,8 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -234,7 +234,8 @@ public class TQuestionServiceImpl implements TQuestionService {
} }
String pId = ""; String pId = "";
TExamInfo tExamInfo = tExamInfoRepository.queryIdByUserId(userId,chapterId); TExamInfo tExamInfo = tExamInfoRepository.queryIdByUserId(userId,chapterId);
String explain = tPaperChapterRepository.queryDescByChapId(chapterId); List<String> explainResult = tPaperChapterRepository.queryDescByChapId(chapterId);
String explain = explainResult.size()>0?explainResult.get(0):"";
if(tExamInfo==null){ if(tExamInfo==null){
//占卷子 //占卷子
tExamInfo = new TExamInfo(); tExamInfo = new TExamInfo();
...@@ -292,9 +293,10 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -292,9 +293,10 @@ public class TQuestionServiceImpl implements TQuestionService {
questionListAndNum.setExamInfoId(tExamInfo.getBusinessId()); questionListAndNum.setExamInfoId(tExamInfo.getBusinessId());
questionListAndNum.setExplain(explain); questionListAndNum.setExplain(explain);
questionListAndNum.setIsFinish(isFinish); questionListAndNum.setIsFinish(isFinish);
questionListAndNum.setNumOfChoice(tQuestionRepository.queryNumByType("1",chapterId));
questionListAndNum.setNumOfMultiSelect(tQuestionRepository.queryNumByType("2",chapterId)); questionListAndNum.setNumOfChoice(tQuestionRepository.queryNumByType("1",chapterId).get(0));
questionListAndNum.setNumOfJudgment(tQuestionRepository.queryNumByType("3",chapterId)); questionListAndNum.setNumOfMultiSelect(tQuestionRepository.queryNumByType("2",chapterId).get(0));
questionListAndNum.setNumOfJudgment(tQuestionRepository.queryNumByType("3",chapterId).get(0));
//将数据放入缓存中 //将数据放入缓存中
rcRedisServiceImpl.setBytes(userId + "_" + chapterId, rcRedisServiceImpl.setBytes(userId + "_" + chapterId,
SerializationUtils.serializer(questionListAndNum), SerializationUtils.serializer(questionListAndNum),
......
...@@ -46,15 +46,20 @@ public class JwtAuthenTokenFilter extends OncePerRequestFilter { ...@@ -46,15 +46,20 @@ public class JwtAuthenTokenFilter extends OncePerRequestFilter {
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE,PUT"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE,PUT");
response.setHeader("Access-Control-Allow-Headers","Authorization,Origin,X-Requested-With,X-File-Name,Content-Type, Accept"); response.setHeader("Access-Control-Allow-Headers","Authorization,Origin,X-Requested-With,X-File-Name,Content-Type, Accept");
log.info("*********************************过滤器被使用**************************"); log.info("*********************************过滤器被使用**************************");
String reqUrl = request.getRequestURL().toString();
int permitRes = reqUrl.indexOf("/BVideo/uploadLicense");
/**/ /**/
String lk = rcRedisServiceImpl.get("lk"); String lk = rcRedisServiceImpl.get("lk");
if(StringUtils.isBlank(lk) || !"1".equals(lk)){ if(StringUtils.isBlank(lk) || !"1".equals(lk)){
if(permitRes==-1) {
Result result = new Result(); Result result = new Result();
result.setCode(202); result.setCode(202);
ResponseUtil.responseResult(response, result); ResponseUtil.responseResult(response, result);
return; return;
} }
}
// 取得header // 取得header
String authHeader = request.getHeader(this.tokenHeader); String authHeader = request.getHeader(this.tokenHeader);
//判断header头 //判断header头
......
...@@ -54,12 +54,13 @@ ...@@ -54,12 +54,13 @@
IFNULL(t1.pdf_finish,0) as pdfFinish, IFNULL(t1.pdf_finish,0) as pdfFinish,
IFNULL(t1.ppt_finish,0) as pptFinish, IFNULL(t1.ppt_finish,0) as pptFinish,
IFNULL(t1.video_finish,0) as videoFinish, IFNULL(t1.video_finish,0) as videoFinish,
(SELECT count(*) FROM b_r_student_chapter brs WHERE brs.chapter_id = bc.business_id AND brs.score = - 1) AS studentNum (SELECT count(*) FROM b_r_student_chapter brs WHERE brs.chapter_id = bc.business_id AND brs.score = - 1) AS studentNum,
IFNULL(t1.score ,-1) as stuScore
FROM FROM
b_chapter bc b_chapter bc
LEFT JOIN b_file bf ON bf.chapter_id = bc.business_id LEFT JOIN b_file bf ON bf.chapter_id = bc.business_id
LEFT JOIN t_paper_chapter pc on pc.chap_id = bc.business_id LEFT JOIN t_paper_chapter pc on pc.chap_id = bc.business_id
LEFT JOIN (SELECT is_complete,ppt_finish,pdf_finish,video_finish,paper_finish,chapter_id from b_r_student_chapter brs LEFT JOIN (SELECT is_complete,ppt_finish,pdf_finish,video_finish,paper_finish,chapter_id,score from b_r_student_chapter brs
LEFT JOIN b_student bs on brs.student_id = bs.business_id LEFT JOIN b_student bs on brs.student_id = bs.business_id
LEFT JOIN s_user su on bs.`code` = su.login_name LEFT JOIN s_user su on bs.`code` = su.login_name
LEFT JOIN b_chapter bc on bc.business_id = brs.chapter_id LEFT JOIN b_chapter bc on bc.business_id = brs.chapter_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