Commit 3a0442d6 authored by YangZhaoJun1's avatar YangZhaoJun1

导出学生作业接口待完成

parent 9706c239
...@@ -183,7 +183,7 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -183,7 +183,7 @@ public class BChapterController extends PaginationController<BChapter> {
} }
@ApiOperation(value="批量打分", notes="批量打分") @ApiOperation(value="批量打分", notes="批量打分")
@ApiImplicitParams({@ApiImplicitParam(name = "chapterId", value = "课程id", required = true, dataType = "varchar"), @ApiImplicitParams({@ApiImplicitParam(name = "chapterId", value = "章节id", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "score", value = "分数", required = true, dataType = "varchar"), @ApiImplicitParam(name = "score", value = "分数", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "studentId", value = "学生id", required = true, dataType = "varchar")}) @ApiImplicitParam(name = "studentId", value = "学生id", required = true, dataType = "varchar")})
@PreAuthorize("hasRole('ROLE_1002')") @PreAuthorize("hasRole('ROLE_1002')")
...@@ -219,10 +219,10 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -219,10 +219,10 @@ public class BChapterController extends PaginationController<BChapter> {
} }
@ApiOperation(value="完成学习", notes="完成学习") @ApiOperation(value="完成学习", notes="完成学习")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"), @ApiImplicitParams({@ApiImplicitParam(name = "score", value = "分数", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "score", value = "分数", required = false, dataType = "varchar"), @ApiImplicitParam(name = "slId", value = "开课ID", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "chapterId", value = "章节id", required = false, dataType = "varchar"), @ApiImplicitParam(name = "chapterId", value = "章节id", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "studentId", value = "学生学号", required = false, dataType = "varchar")}) @ApiImplicitParam(name = "studentId", value = "学生学号", required = true, dataType = "varchar")})
@PreAuthorize("hasRole('ROLE_1003')") @PreAuthorize("hasRole('ROLE_1003')")
@PostMapping(value = "/complete") @PostMapping(value = "/complete")
public Result complete(ScoreInfoDTO scoreInfoDTO) { public Result complete(ScoreInfoDTO scoreInfoDTO) {
...@@ -472,4 +472,14 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -472,4 +472,14 @@ public class BChapterController extends PaginationController<BChapter> {
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
businessId); businessId);
} }
@ApiOperation(value="根据章节ID查询任务书", notes="根据章节ID查询任务书")
@ApiImplicitParam(name = "businessId", value = "章节ID", required = true, dataType = "varchar")
@GetMapping(value = "/queryMdFileByChapterId")
public Result queryMdFileByChapterId(String businessId){
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bChapterService.queryMdFileByChapterId(businessId));
}
} }
...@@ -125,7 +125,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -125,7 +125,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* @param scoreInfoDTO * @param scoreInfoDTO
* @return * @return
*/ */
@Insert("</script>insert into b_r_student_chapter(business_id,chapter_id,student_id,score) values(#{businessId},#{chapterId},#{studentId},#{score})</script>") @Insert("</script>insert into b_r_student_chapter(business_id,chapter_id,student_id,score,sl_id) values(#{businessId},#{chapterId},#{studentId},#{score},#{slId})</script>")
int insertScoreInfo(ScoreInfoDTO scoreInfoDTO); int insertScoreInfo(ScoreInfoDTO scoreInfoDTO);
/** /**
...@@ -141,7 +141,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -141,7 +141,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* @param scoreInfoDTO * @param scoreInfoDTO
* @return * @return
*/ */
@Insert("<script>insert into b_r_student_chapter(business_id,student_id,chapter_id,is_complete) values (#{businessId},#{studentId},#{chapterId},#{isComplete})</script>") @Insert("<script>insert into b_r_student_chapter(business_id,student_id,chapter_id,is_complete,sl_id) values (#{businessId},#{studentId},#{chapterId},#{isComplete},#{slId})</script>")
int updateIsComplete(ScoreInfoDTO scoreInfoDTO); int updateIsComplete(ScoreInfoDTO scoreInfoDTO);
/** /**
...@@ -235,5 +235,10 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -235,5 +235,10 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
@Update("<script>update b_chapter set automatic = #{automatic} where business_id = #{businessId}</script>") @Update("<script>update b_chapter set automatic = #{automatic} where business_id = #{businessId}</script>")
int updateAutomatic(@Param("automatic") String automatic, @Param("businessId") String businessId); int updateAutomatic(@Param("automatic") String automatic, @Param("businessId") String businessId);
@Select("<script>select md_file from b_chapter " +
"where del_flag = 0 and flag = 1 " +
"and business_id = #{businessId}</script>")
String queryMdFileByChapterId(String businessId);
} }
...@@ -12,4 +12,5 @@ public class ScoreInfoDTO extends IdEntity<ScoreInfoDTO> { ...@@ -12,4 +12,5 @@ public class ScoreInfoDTO extends IdEntity<ScoreInfoDTO> {
String chapterId; String chapterId;
String studentId; String studentId;
String isComplete; String isComplete;
String slId;
} }
...@@ -103,4 +103,6 @@ public interface BChapterService{ ...@@ -103,4 +103,6 @@ public interface BChapterService{
int updateDownChapter(BChapter bChapter); int updateDownChapter(BChapter bChapter);
int updateAutomatic(String businessId); int updateAutomatic(String businessId);
String queryMdFileByChapterId(String businessId);
} }
...@@ -440,4 +440,9 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -440,4 +440,9 @@ public class BChapterServiceImpl implements BChapterService {
int result = bChapterRepository.updateAutomatic(automatic,businessId); int result = bChapterRepository.updateAutomatic(automatic,businessId);
return result; return result;
} }
@Override
public String queryMdFileByChapterId(String businessId) {
return bChapterRepository.queryMdFileByChapterId(businessId);
}
} }
...@@ -67,4 +67,17 @@ public class BCodeController extends PaginationController { ...@@ -67,4 +67,17 @@ public class BCodeController extends PaginationController {
} }
@ApiImplicitParams({@ApiImplicitParam(name = "slId", value = "开课ID", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "slCode", value = "开课编号", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "studentId", value = "学生Id", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "type", value = "是否全部导出 1是全部导出 0否", required = true, dataType = "varchar")})
@ApiOperation(value="导出学生代码文件", notes="根据学生Id导出学生代码文件")
public Result exportFiles(String slId, String studentId, String type, String slCode){
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bCodeServiceImpl.exportFiles(slId, studentId, type, slCode));
}
} }
...@@ -27,4 +27,6 @@ public interface BCodeService { ...@@ -27,4 +27,6 @@ public interface BCodeService {
* @return * @return
*/ */
BCodeFile saveOwnExamFiles(String slId, String chapId, String examType, String content, String userInfoProp); BCodeFile saveOwnExamFiles(String slId, String chapId, String examType, String content, String userInfoProp);
String exportFiles(String slId, String studentId, String type, String slCode);
} }
...@@ -2,9 +2,13 @@ package org.rcisoft.business.bcode.service.impl; ...@@ -2,9 +2,13 @@ package org.rcisoft.business.bcode.service.impl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.rcisoft.business.bchapter.dao.BChapterRepository;
import org.rcisoft.business.bchapter.entity.BChapter;
import org.rcisoft.business.bcode.model.BCodeFile; import org.rcisoft.business.bcode.model.BCodeFile;
import org.rcisoft.business.bcode.model.CodeType; import org.rcisoft.business.bcode.model.CodeType;
import org.rcisoft.business.bcode.service.BCodeService; import org.rcisoft.business.bcode.service.BCodeService;
import org.rcisoft.business.brslstudent.dao.BRSlStudentRepository;
import org.rcisoft.business.brslstudent.entity.BRSlStudent;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
import org.rcisoft.core.service.RcRedisService; import org.rcisoft.core.service.RcRedisService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -32,6 +36,12 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -32,6 +36,12 @@ public class BCodeServiceImpl implements BCodeService {
@Autowired @Autowired
private RcRedisService rcRedisServiceImpl; private RcRedisService rcRedisServiceImpl;
@Autowired
private BChapterRepository bChapterRepository;
@Autowired
private BRSlStudentRepository brSlStudentRepository;
/** /**
* 读文件 * 读文件
* @param slId * @param slId
...@@ -48,13 +58,13 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -48,13 +58,13 @@ public class BCodeServiceImpl implements BCodeService {
return this.readSimpleFile(slId,chapId,CodeType.SIM_JAVA,userInfo); return this.readSimpleFile(slId,chapId,CodeType.SIM_JAVA,userInfo);
/*java 工程*/ /*java 工程*/
if(examType.equals(global.getJavaProject())) if(examType.equals(global.getJavaProject()))
return this.readProjectFile(slId,userInfo); return this.readProjectFile(slId,chapId,userInfo);
/*html 单文件*/ /*html 单文件*/
if(examType.equals(global.getHtmlSimple())) if(examType.equals(global.getHtmlSimple()))
return this.readSimpleFile(slId,chapId,CodeType.SIM_HTML,userInfo); return this.readSimpleFile(slId,chapId,CodeType.SIM_HTML,userInfo);
/*html 工程*/ /*html 工程*/
if(examType.equals(global.getHtmlProject())) if(examType.equals(global.getHtmlProject()))
return this.readProjectFile(slId,userInfo); return this.readProjectFile(slId,chapId,userInfo);
return null; return null;
} }
...@@ -108,14 +118,15 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -108,14 +118,15 @@ public class BCodeServiceImpl implements BCodeService {
* @param userInfo * @param userInfo
* @return * @return
*/ */
private BCodeFile readProjectFile(String slId, String userInfo) { private BCodeFile readProjectFile(String slId, String chapterId, String userInfo) {
BCodeFile codeFile = null; BCodeFile codeFile = null;
String path = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator String path = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
+ global.getCOURSE_LOCATION() + File.separator + global.getCOURSE_LOCATION() + File.separator
+ global.getSL_LOCATION() + File.separator + global.getSL_LOCATION() + File.separator
+ slId + File.separator + slId + File.separator
+ global.getCOURSE_PROJECT_LOCATION() + chapterId +File.separator
+ File.separator + userInfo; + global.getCOURSE_PROJECT_LOCATION() + File.separator
+ userInfo;
try{ try{
File simplePath = new File(path); File simplePath = new File(path);
if(!simplePath.exists()) { if(!simplePath.exists()) {
...@@ -237,4 +248,59 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -237,4 +248,59 @@ public class BCodeServiceImpl implements BCodeService {
} }
return codeFile; return codeFile;
} }
@Override
public String exportFiles(String slId, String studentId, String type, String slCode) {
if(type.equals("1")){//全部导出
String SlPath = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
+ global.getCOURSE_LOCATION() + File.separator
+ global.getSL_LOCATION() +File.separator
+ slId + File.separator;
List<String> students = brSlStudentRepository.queryStudentBySlCode(slCode);
//查询该课程的所有章节
List<BChapter> chapterList = bChapterRepository.queryChapterBySlId(slId);
if(chapterList!=null){
for(BChapter bChapter : chapterList){
String codeType = global.getCOURSE_CODE_LOCATION() + File.separator;//默认是单文件
if(!bChapter.getPid().equals("-1")){//遍历所有节
if(bChapter.getExperimentType().equals("2")||bChapter.getExperimentType().equals("4")){//工程
codeType = global.getCOURSE_PROJECT_LOCATION() + File.separator;
}
//将要导出的文件放入这个文件夹中
String copyPath = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
+ global.getTEMP_LOCATION() + File.separator
+ "studentCode" + File.separator
+ slId + File.separator
+ bChapter.getBusinessId() + File.separator;
//+ studentId + File.separator;
for(String student : students){
String finalPath = copyPath + student +File.separator;
File copyFile = new File(finalPath);
if(!copyFile.exists()){
copyFile.mkdirs();
}
String codePath = SlPath + bChapter.getBusinessId() +File.separator
+ codeType + student + File.separator;
File userFile = new File(codePath);
File javaFile[] = userFile.listFiles();
for(File simpleFile : javaFile){
String fileName = simpleFile.getName();
File finalFile = new File(codePath+fileName);
}
}
}
}
}
}
return null;
}
} }
...@@ -105,7 +105,7 @@ public class BFileController extends PaginationController<BFile> { ...@@ -105,7 +105,7 @@ public class BFileController extends PaginationController<BFile> {
} }
@ApiOperation(value="上传视频", notes="上传视频") @ApiOperation(value="上传文件", notes="上传文件")
@ApiImplicitParams({@ApiImplicitParam(name = "chapterId", value = "章节ID", required = true, dataType = "varchar"), @ApiImplicitParams({@ApiImplicitParam(name = "chapterId", value = "章节ID", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "lessonId", value = "课程ID", required = false, dataType = "varchar"), @ApiImplicitParam(name = "lessonId", value = "课程ID", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "slId", value = "开课ID", required = false, dataType = "varchar"), @ApiImplicitParam(name = "slId", value = "开课ID", required = false, dataType = "varchar"),
......
...@@ -145,7 +145,7 @@ public class BFileServiceImpl implements BFileService { ...@@ -145,7 +145,7 @@ public class BFileServiceImpl implements BFileService {
pathName = global.getPDF_LOCATION();//pdf路径 pathName = global.getPDF_LOCATION();//pdf路径
} }
String oldPath = global.getBASE_UPLOAD_SERVER_LOCATION() + url; String oldPath = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator + url;
String tempPath = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator String tempPath = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
+ global.getCOURSE_LOCATION() + File.separator + global.getCOURSE_LOCATION() + File.separator
...@@ -237,7 +237,9 @@ public class BFileServiceImpl implements BFileService { ...@@ -237,7 +237,9 @@ public class BFileServiceImpl implements BFileService {
byte[] bytes = file.getBytes(); byte[] bytes = file.getBytes();
stream.write(bytes,0,bytes.length); stream.write(bytes,0,bytes.length);
String newPath = realPath.substring(realPath.indexOf(File.separator)+1); String newPath = global.getCOURSE_LOCATION() + File.separator
+ path + bFile.getChapterId() + File.separator
+ pathName + File.separator;
bFile.setVideoName(name+ "." +uploadFileSuffix);//文件名 bFile.setVideoName(name+ "." +uploadFileSuffix);//文件名
if (bFile.getType().equals("0")){ if (bFile.getType().equals("0")){
......
...@@ -75,5 +75,10 @@ public interface BRSlStudentRepository extends BaseMapper<BRSlStudent> { ...@@ -75,5 +75,10 @@ public interface BRSlStudentRepository extends BaseMapper<BRSlStudent> {
"WHERE\n" + "WHERE\n" +
"\tb2.business_id = #{stuId}</script>") "\tb2.business_id = #{stuId}</script>")
int selectSlNumByStuId(String stuId); int selectSlNumByStuId(String stuId);
@Select("<script>SELECT t2.business_id FROM b_r_sl_student t1 " +
"left join s_user t2 on t1.student_code = t2.login_name " +
"WHERE t1.sl_code = #{slCode}</script>")
List<String> queryStudentBySlCode(String slCode);
} }
...@@ -157,4 +157,17 @@ public class BStudentController extends PaginationController<BStudent> { ...@@ -157,4 +157,17 @@ public class BStudentController extends PaginationController<BStudent> {
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return gridModel; return gridModel;
} }
@ApiOperation(value="查询本课学生", notes="根据开课编号分页查询本课学生")
@ApiImplicitParams({@ApiImplicitParam(name = "slCode", value = "开课编号", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "slId", value = "开课ID", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "keyWord", value = "学号或关键字", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "classCode", value = "班级编号", required = false, dataType = "varchar")})
@GetMapping(value = "/queryStudentInSlByPagination")
public GridModel queryStudentInSlByPagination(String slCode, String classCode, String keyWord, String slId) {
List<BStudent> bStudents = bStudentService.queryStudentInSlByPagination(getPaginationUtility(),slCode,classCode,keyWord,slId);
GridModel gridModel = getGridModelResponse();
return gridModel;
}
} }
...@@ -122,5 +122,31 @@ public interface BStudentRepository extends BaseMapper<BStudent> { ...@@ -122,5 +122,31 @@ 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" +
"(CONCAT((SELECT COUNT(*) from b_r_student_chapter " +
"where student_id = t4.business_id and sl_id = #{slId} and is_complete = '1')," +
"'/'," +
"(SELECT COUNT(*) from b_chapter where is_test like '1' and sl_id = #{slId})) \n" +
") AS finishNum " +
"FROM\n" +
"b_r_sl_student t2\n" +
"LEFT JOIN b_student t3 ON t2.student_code = t3.`code`\n" +
"LEFT JOIN s_user t4 ON t3.`code` = t4.login_name\n" +
"LEFT JOIN b_r_class_student t5 on t5.student_code = t3.code " +
"LEFT JOIN b_class t6 on t6.code = t5.class_code " +
"WHERE\n" +
"t2.sl_code = #{slCode} " +
"<if test=\"classCode!=null and classCode != ''\">\n" +
" AND t6.code = #{classCode}\n" +
"</if>" +
"<if test=\"keyWord!=null and keyWord != ''\">\n" +
" AND (t3.`code` like CONCAT('%',#{keyWord},'%') or t4.`name` like CONCAT('%',#{keyWord},'%'))\n" +
"</if>" +
"order by className asc,code asc</script>")
@ResultMap(value = "BaseResultMap" )
List<BStudent> queryStudentInSl(@Param("slCode") String slCode,
@Param("classCode")String classCode,
@Param("keyWord")String keyWord,
@Param("slId")String slId);
} }
...@@ -66,5 +66,8 @@ public class BStudent extends IdEntity<BStudent> { ...@@ -66,5 +66,8 @@ public class BStudent extends IdEntity<BStudent> {
@Transient @Transient
private String className; private String className;
@Transient
private String finishNum;
} }
...@@ -77,4 +77,6 @@ public interface BStudentService{ ...@@ -77,4 +77,6 @@ public interface BStudentService{
* @return * @return
*/ */
List<BStudent> queryStudentsWithIsRecommendByPagination(PageUtil pageUtil); List<BStudent> queryStudentsWithIsRecommendByPagination(PageUtil pageUtil);
List<BStudent> queryStudentInSlByPagination(PageUtil pageUtil, String slCode, String classCode, String keyWord, String slId);
} }
...@@ -276,6 +276,19 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -276,6 +276,19 @@ public class BStudentServiceImpl implements BStudentService {
return bStudentRepository.queryStudentWithReCommend(); return bStudentRepository.queryStudentWithReCommend();
} }
/**
*
* @param pageUtil
* @param slCode
* @param classCode
* @param keyWord
* @return
*/
@Override
public List<BStudent> queryStudentInSlByPagination(PageUtil pageUtil, String slCode, String classCode, String keyWord, String slId) {
return bStudentRepository.queryStudentInSl(slCode,classCode,keyWord,slId);
}
private Map<String, Object> queryParamHandler(BStudent model) { private Map<String, Object> queryParamHandler(BStudent model) {
Map param = new HashMap<String, Object>(); Map param = new HashMap<String, Object>();
if (model.getName() != null) if (model.getName() != null)
......
...@@ -115,7 +115,7 @@ global: ...@@ -115,7 +115,7 @@ global:
min_password: 6 min_password: 6
max_password: 16 max_password: 16
path: path:
base_upload_server_location: /working/resource/eduServer/ base_upload_server_location: E:\\eduServer
course_location: course course_location: course
lesson_location: lesson lesson_location: lesson
sl_location: sl sl_location: sl
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
|sl| (开课) |sl| (开课)
|images|(开课图片) |images|(开课图片)
|slId| |slId|
|project|
|userid|
文件夹
|chapterId| |chapterId|
|video| |video|
|乱码文件| |乱码文件|
...@@ -34,7 +31,11 @@ ...@@ -34,7 +31,11 @@
|userid| |userid|
|乱码文件| |乱码文件|
|code| |code|
userid.文件 |userid|
文件
|project|
|userid|
文件夹
|mdfiles| (待确认) |mdfiles| (待确认)
|2017| |2017|
...@@ -44,6 +45,14 @@ ...@@ -44,6 +45,14 @@
|system| |system|
|images|(轮播图) |images|(轮播图)
|default| |default|
# 作业导出结构
|开课序号+开课名称.zip| 20170001+JAVA.zip
|章节序号| 1.1
|学号+姓名| 01081402+张三
文件 test.java
(或) (或)
文件夹 project
# 容器 # 容器
## 容器编排 ## 容器编排
......
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