Commit 56b5ba0b authored by YangZhaoJun1's avatar YangZhaoJun1

试题

parent ca45fd15
......@@ -355,4 +355,15 @@ public class BChapterController extends PaginationController<BChapter> {
MessageConstant.MESSAGE_ALERT_ERROR,
bChapterService.scoreReport(slId));
}
@ApiOperation(value="创建题目时从属下拉框查询", notes="只查询该课程的节")
@ApiImplicitParam(name = "slId", value = "开课id", required = false, dataType = "varchar")
@GetMapping(value = "/chapterListBySlId")
public Result chapterListBySlId(String slId) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bChapterService.chapterListBySlId(slId));
}
}
......@@ -298,5 +298,13 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"order by sort asc</script>")
@ResultMap(value = "ScoreReportResultMap" )
List<ScoreReportDto> queryBChaptersBySlId(String slId);
@Select("<script>select bc.*,su.business_id as userId,su.`name` as studentName,su.login_name as stuId from b_chapter bc \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 s_user su on su.login_name = bs.`code` \n" +
"where bc.business_id = #{chapterId} and bsc.score = '-1'</script>")
@ResultMap(value = "BaseResultMap" )
List<BChapter> chapterListBySlId(String slId);
}
......@@ -114,4 +114,6 @@ public interface BChapterService{
int Mark(String chapterId, String slId, String studentCode, String score);
List<ScoreReportDto> scoreReport(String slId);
List<BChapter> chapterListBySlId(String slId);
}
......@@ -505,5 +505,10 @@ public class BChapterServiceImpl implements BChapterService {
return bChapterRepository.queryBChaptersBySlId(slId);
}
@Override
public List<BChapter> chapterListBySlId(String slId) {
return bChapterRepository.chapterListBySlId(slId);
}
}
......@@ -7,7 +7,9 @@ import org.rcisoft.business.bfile.service.BFileService;
import org.rcisoft.common.component.Global;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.DelStatus;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.FileUtil;
import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.OfficeToPdf;
......@@ -33,6 +35,8 @@ public class BFileServiceImpl implements BFileService {
@Autowired
private BFileRepository bFileRepository;
@Autowired
private OfficeToPdf officeToPdf;
@Autowired
private Global global;
@Override
......@@ -115,7 +119,7 @@ public class BFileServiceImpl implements BFileService {
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
throw new ServiceException(ResultServiceEnums.UPLOAD_ERROR);
}
}
}
......@@ -254,13 +258,12 @@ public class BFileServiceImpl implements BFileService {
+ path + bFile.getChapterId() + File.separator
+ pathName + File.separator;
if(uploadFileSuffix.equals("ppt")||uploadFileSuffix.equals("pptx")){//ppt转pdf
if(uploadFileSuffix.equals("ppt")&&bFile.getType().equals("2")){//ppt转pdf
String inputFile = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
+ newPath+ filename;
String outputFile = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
+ newPath + uploadFileName + ".pdf";
OfficeToPdf pptToPdf = new OfficeToPdf();
//pptToPdf.pptToPdf(inputFile,outputFile);
officeToPdf.office2PDF(inputFile,outputFile);
}
bFile.setVideoName(name+ "." +uploadFileSuffix);//文件名
......
......@@ -87,17 +87,6 @@ public class BStudentServiceImpl implements BStudentService {
throw new ServiceException(ResultServiceEnums.EMAIL_EXISTS);
//1. 添加用户
//1.1 创建git lab账户
/*GitUser gitUser = new GitUser();
gitUser.setUsername(global.getGIT_LAB_STU_PREFIX()+model.getCode());
gitUser.setName(user.getName());
gitUser.setPassword(model.getCode());
gitUser.setEmail(user.getEmail());
AccountDTO accountDTO = action.createGitLabAccount(gitUser);
//1.2 将git lab账户信息保存进user里
user.setGitLabId(accountDTO.getId());
user.setGitLabUsername(accountDTO.getUsername());
user.setGitLabImpressionToken(accountDTO.getImpersonationToken());*/
UserUtil.setCurrentPersistOperation(user);
user.setHeadPic(global.getDEFAULT_STUDENT_LOCATION());
userService.persistUser(user);
......
......@@ -232,17 +232,7 @@ public class BTeacherServiceImpl implements BTeacherService {
throw new ServiceException(ResultServiceEnums.EMAIL_EXISTS);
//1添加用户
user.setHeadPic(global.getDEFAULT_TEACHER_LOCATION());
//1.1 创建git lab账户
/*GitUser gitUser = new GitUser();
gitUser.setName(user.getName());
gitUser.setUsername(global.getGIT_LAB_TEA_PREFIX()+user.getLoginName());
gitUser.setPassword(user.getLoginName());
gitUser.setEmail(user.getEmail());
AccountDTO accountDTO = action.createGitLabAccount(gitUser);
//1.2 将git lab账户信息保存进user里
user.setGitLabId(accountDTO.getId());
user.setGitLabUsername(accountDTO.getUsername());
user.setGitLabImpressionToken(accountDTO.getImpersonationToken());*/
UserUtil.setCurrentPersistOperation(user);
userService.persistUser(user);
//2添加用户权限
......
......@@ -29,7 +29,7 @@ import java.util.List;
* Created by yangzhaojun on 2018-1-15 19:49:07.
*/
@RestController
@RequestMapping("/t/paper/chapter")
@RequestMapping("/tPaperChapter")
public class TPaperChapterController extends PaginationController<TPaperChapter> {
@Autowired
......@@ -39,7 +39,7 @@ public class TPaperChapterController extends PaginationController<TPaperChapter>
@ApiOperation(value="添加", notes="添加")
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping
public Result add(@Valid TPaperChapter tPaperChapter, BindingResult bindingResult) {
public Result add(TPaperChapter tPaperChapter) {
tPaperChapter.setToken(getToken());
PersistModel data = tPaperChapterServiceImpl.save(tPaperChapter);
return Result.builder(data,
......
......@@ -128,9 +128,9 @@ public class TQuestionController extends PaginationController<TQuestion> {
@ApiOperation(value="根据条件查询(不分页)", notes="根据URL中的参数查询全部")
@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")
@GetMapping(value = "/queryTQestions")
@GetMapping(value = "/queryTQuestions")
@PreAuthorize("hasRole('ROLE_1002')")
public Result queryTQestion(TQuestion tQuestion) {
public Result queryTQuestion(TQuestion tQuestion) {
//tQuestion.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
......
......@@ -20,10 +20,9 @@ public interface TQuestionOptionsRepository extends BaseMapper<TQuestionOptions>
*
*/
@Select("<script>select * from t_question_options where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if>' "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if>' "
+ "<if test=\"qid !=null and qid != '' \">and qid = #{qid} </if>' "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<TQuestionOptions> queryTQuestionOptionss(TQuestionOptions tQuestionOptions);
List<TQuestionOptions> queryTQuestionOptions(String qid);
}
......@@ -23,6 +23,7 @@ public class TQuestion extends IdEntity<TQuestion> {
private static final long serialVersionUID = 4926963786636914161L;
private String slId;
private String chapId;
......@@ -41,9 +42,6 @@ public class TQuestion extends IdEntity<TQuestion> {
private String desc;*/
@Transient
List<Map<String,Object>> questionOptions;
@Transient
List<TQuestionOptions> options;
......
......@@ -125,7 +125,13 @@ public class TQuestionServiceImpl implements TQuestionService {
@Override
public TQuestion queryTQestionById(String businessId) {
return tQuestionRepository.selectOne(new TQuestion(businessId));
TQuestion tQuestion = tQuestionRepository.selectOne(new TQuestion(businessId));
if(!tQuestion.getQtype().equals("2")){
//选择题 获取选项
List<TQuestionOptions> options = tQuestionOptionsRepository.queryTQuestionOptions(tQuestion.getBusinessId());
tQuestion.setOptions(options);
}
return tQuestion;
}
......
......@@ -134,7 +134,9 @@ public enum ResultServiceEnums {
COMPILING_CODE (74,"运行失败,请重试"),
STUDENT_CODE_NOT_EXISTS (74,"未查询到该学生的代码文件")
STUDENT_CODE_NOT_EXISTS (74,"未查询到该学生的代码文件"),
UPLOAD_ERROR (75,"上传失败")
;
private Integer code;
......
......@@ -24,7 +24,7 @@ public class FileUtil {
}else if(fileSuffix.equals("xlsx")){
return "xls";
}else {
return "";
return fileSuffix;
}
}
......
......@@ -9,6 +9,8 @@ import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConne
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.common.component.Global;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.ResultServiceEnums;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -115,7 +117,11 @@ public class OfficeToPdf {
e.printStackTrace();
return 0;
}finally {
connection.disconnect();
if(connection!=null) {
connection.disconnect();
}else{
throw new ServiceException(ResultServiceEnums.UPLOAD_ERROR);
}
}
return 1;
}
......
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