Commit 6db1821a authored by YangZhaoJun1's avatar YangZhaoJun1

组卷相关

parent 3eedb71f
...@@ -7,13 +7,11 @@ import io.swagger.annotations.ApiImplicitParams; ...@@ -7,13 +7,11 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections.map.HashedMap;
import org.rcisoft.business.bchapter.dao.BChapterRepository;
import org.rcisoft.business.bchapter.dto.QueryScoreListDTO; import org.rcisoft.business.bchapter.dto.QueryScoreListDTO;
import org.rcisoft.business.bchapter.dto.ScoreInfoDTO; import org.rcisoft.business.bchapter.dto.ScoreInfoDTO;
import org.rcisoft.business.bchapter.entity.BChapter; import org.rcisoft.business.bchapter.entity.BChapter;
import org.rcisoft.business.bchapter.enums.IsCompleteEnum; import org.rcisoft.business.bchapter.enums.IsCompleteEnum;
import org.rcisoft.business.bchapter.service.BChapterService; import org.rcisoft.business.bchapter.service.BChapterService;
import org.rcisoft.business.bsl.dao.BSlRepository;
import org.rcisoft.business.bsl.service.BSlService; import org.rcisoft.business.bsl.service.BSlService;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
import org.rcisoft.common.controller.PaginationController; import org.rcisoft.common.controller.PaginationController;
...@@ -33,7 +31,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -33,7 +31,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.async.WebAsyncTask;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
...@@ -227,7 +224,7 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -227,7 +224,7 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiImplicitParam(name = "studentCode", value = "学生学号", required = true, dataType = "varchar")}) @ApiImplicitParam(name = "studentCode", 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) throws Exception{
scoreInfoDTO.setIsComplete(IsCompleteEnum.COMPLETE.getCode()); scoreInfoDTO.setIsComplete(IsCompleteEnum.COMPLETE.getCode());
scoreInfoDTO.setStudentId(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID)); scoreInfoDTO.setStudentId(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
bChapterService.updateIsComplete(scoreInfoDTO,getToken()); bChapterService.updateIsComplete(scoreInfoDTO,getToken());
...@@ -374,14 +371,13 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -374,14 +371,13 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiImplicitParams({@ApiImplicitParam(name = "type", value = "完成的类型 ppt是1 pdf是2 video是3", required = true, dataType = "varchar"), @ApiImplicitParams({@ApiImplicitParam(name = "type", value = "完成的类型 ppt是1 pdf是2 video是3", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "chapterId", value = "章节id", required = true, dataType = "varchar"), @ApiImplicitParam(name = "chapterId", value = "章节id", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "studentCode", value = "学号", required = true, dataType = "varchar")}) @ApiImplicitParam(name = "studentCode", value = "学号", required = true, dataType = "varchar")})
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1003')")
@PostMapping(value = "/updateToFinish") @PostMapping(value = "/updateToFinish")
public Result u(String type,String chapterId,String code) { public Result u(String type,String chapterId,String studentCode) {
String stuId = bChapterService.queryStuIdByCode(code); int data = bChapterService.updateToFinish(type,studentCode,chapterId);
int data = bChapterService.updateToFinish(type,stuId,chapterId);
return Result.builder(new PersistModel(data), return Result.builder(new PersistModel(data),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
code); studentCode);
} }
} }
...@@ -48,11 +48,12 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -48,11 +48,12 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
" bf.file_url AS fileUrl,\n" + " bf.file_url AS fileUrl,\n" +
" bf.ppt_url AS pptUrl,\n" + " bf.ppt_url AS pptUrl,\n" +
" bf.pdf_url AS pdfUrl,\n" + " bf.pdf_url AS pdfUrl,\n" +
" pc.business_id AS paperUrl," +
" (SELECT count(*) FROM b_r_student_chapter brs WHERE brs.chapter_id = bc.business_id AND brs.score = - 1) AS studentNum \n" + " (SELECT count(*) FROM b_r_student_chapter brs WHERE brs.chapter_id = bc.business_id AND brs.score = - 1) AS studentNum \n" +
" FROM\n" + " FROM\n" +
" b_chapter bc\n" + " b_chapter bc\n" +
" LEFT JOIN b_file bf ON bf.chapter_id = bc.business_id " + " LEFT JOIN b_file bf ON bf.chapter_id = bc.business_id " +
" \n" + " LEFT JOIN t_paper_chapter pc on pc.chap_id = bc.business_id " +
" WHERE\n" + " WHERE\n" +
" bc.del_flag = 0\n" + " bc.del_flag = 0\n" +
" AND bc.pid = #{pid}\n" + " AND bc.pid = #{pid}\n" +
...@@ -309,10 +310,10 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -309,10 +310,10 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
@Update("<script>update b_r_student_chapter\n" + @Update("<script>update b_r_student_chapter\n" +
"<if test=\"type !=null and type != '' and type == 1 \"> set ppt_finish = 1 </if>" + "<if test=\"type !=null and type != '' and type.equals('1') \"> set ppt_finish = '1' </if>" +
"<if test=\"type !=null and type != '' and type == 2 \"> set pdf_finish = 1 </if>" + "<if test=\"type !=null and type != '' and type.equals('2') \"> set pdf_finish = '1' </if>" +
"<if test=\"type !=null and type != '' and type == 3 \"> set video_finish = 1 </if>" + "<if test=\"type !=null and type != '' and type.equals('3') \"> set video_finish = '1' </if>" +
"where student_id = #{stuId} and chapter_id = #{chapterId} </script>") "where student_id = #{stuId} and chapter_id = #{chapterId} </script>")
int updateToFinish( @Param("stuId") String stuId, @Param("type") String type,@Param("chapterId") String chapterId); int updateToFinish( @Param("stuId") String stuId, @Param("type") String type,@Param("chapterId") String chapterId);
} }
...@@ -31,7 +31,6 @@ public class BChapter extends IdEntity<BChapter> { ...@@ -31,7 +31,6 @@ public class BChapter extends IdEntity<BChapter> {
//@NotEmpty(message = "开课id必填") //@NotEmpty(message = "开课id必填")
private String slId; private String slId;
/*章节名称*/ /*章节名称*/
@NotEmpty(message = "章节名称必填")
@Length(min = 1,max = 50,message = "长度最小为1,最大为50") @Length(min = 1,max = 50,message = "长度最小为1,最大为50")
private String chapterName; private String chapterName;
/*等级*/ /*等级*/
...@@ -111,6 +110,21 @@ public class BChapter extends IdEntity<BChapter> { ...@@ -111,6 +110,21 @@ public class BChapter extends IdEntity<BChapter> {
@Transient @Transient
private String type; private String type;
@Transient
private String pptFinish;
@Transient
private String pdfFinish;
@Transient
private String videoFinish;
@Transient
private String paperFinish;
@Transient
private String paperUrl;
public BChapter(String businessId) { public BChapter(String businessId) {
this.businessId = businessId; this.businessId = businessId;
......
...@@ -90,7 +90,7 @@ public interface BChapterService{ ...@@ -90,7 +90,7 @@ public interface BChapterService{
* 更新已经完成状态 * 更新已经完成状态
* @param scoreInfoDTO * @param scoreInfoDTO
*/ */
void updateIsComplete(ScoreInfoDTO scoreInfoDTO,String token); void updateIsComplete(ScoreInfoDTO scoreInfoDTO,String token) throws Exception;
int addBslFormLesson(String bLseeonId, String lessonCode, String businessId); int addBslFormLesson(String bLseeonId, String lessonCode, String businessId);
...@@ -116,5 +116,5 @@ public interface BChapterService{ ...@@ -116,5 +116,5 @@ public interface BChapterService{
String queryStuIdByCode(String code); String queryStuIdByCode(String code);
int updateToFinish(String type, String stuId, String chapterId); int updateToFinish(String type, String studentCode, String chapterId);
} }
...@@ -193,11 +193,9 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -193,11 +193,9 @@ public class BChapterServiceImpl implements BChapterService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override @Override
public void updateIsComplete(ScoreInfoDTO scoreInfoDTO,String token) { public void updateIsComplete(ScoreInfoDTO scoreInfoDTO,String token) throws Exception{
try {
String stuid = bStudentRepository.queryStudentByUserId(scoreInfoDTO.getStudentId()); String stuid = bStudentRepository.queryStudentByUserId(scoreInfoDTO.getStudentId());
scoreInfoDTO.setStudentId(stuid); if(bChapterRepository.selectIdByStudentIdAndChapterId(scoreInfoDTO.getChapterId(),stuid)!=null)
if(bChapterRepository.selectIdByStudentIdAndChapterId(scoreInfoDTO.getChapterId(),scoreInfoDTO.getStudentId())!=null)
return; return;
scoreInfoDTO.setCommonBusinessId(); scoreInfoDTO.setCommonBusinessId();
UserUtil.setCurrentMergeOperation(scoreInfoDTO); UserUtil.setCurrentMergeOperation(scoreInfoDTO);
...@@ -220,16 +218,13 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -220,16 +218,13 @@ public class BChapterServiceImpl implements BChapterService {
scoreInfoDTO.setScore(score); scoreInfoDTO.setScore(score);
} }
scoreInfoDTO.setStudentId(stuid);
int result = bChapterRepository.updateIsComplete(scoreInfoDTO); int result = bChapterRepository.updateIsComplete(scoreInfoDTO);
if(bChapter.getExperimentType().equals("2")||bChapter.getExperimentType().equals("4")){ if(bChapter.getExperimentType().equals("2")||bChapter.getExperimentType().equals("4")){
} }
if(result<1) if(result<1)
throw new ServiceException(ResultServiceEnums.UPDATE_ERROR); throw new ServiceException(ResultServiceEnums.UPDATE_ERROR);
} catch (Exception e) {
e.printStackTrace();
}
} }
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
...@@ -512,7 +507,8 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -512,7 +507,8 @@ public class BChapterServiceImpl implements BChapterService {
} }
@Override @Override
public int updateToFinish(String type, String stuId, String chapterId) { public int updateToFinish(String type, String studentCode, String chapterId) {
String stuId = bChapterRepository.queryStuIdByCode(studentCode);
return bChapterRepository.updateToFinish(stuId,type,chapterId); return bChapterRepository.updateToFinish(stuId,type,chapterId);
} }
......
...@@ -33,7 +33,7 @@ public class IntellEvaluation { ...@@ -33,7 +33,7 @@ public class IntellEvaluation {
//java单文件 //java单文件
File file = new File(filePath+studentCode+".java"); File file = new File(filePath+studentCode+".java");
if(!file.exists()){ if(!file.exists()){
throw new ServiceException(ResultServiceEnums.PASSWORD_ERROR); throw new ServiceException(ResultServiceEnums.STUDENT_CODE_NOT_EXISTS);
} }
content = FileUtils.readFileToString(file); content = FileUtils.readFileToString(file);
score = getJavaSingleScore(content); score = getJavaSingleScore(content);
......
...@@ -30,11 +30,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -30,11 +30,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"left join b_lesson_direction bld on bld.lession_id = b.business_id " + "left join b_lesson_direction bld on bld.lession_id = b.business_id " +
"left join b_direction bd on bd.business_id = bld.direction_id "+ "left join b_direction bd on bd.business_id = bld.direction_id "+
"where b.del_flag != 1 and b.flag = 1 " + "where b.del_flag != 1 and b.flag = 1 " +
"<if test=\"name!=null and name != ''\">and b.`lesson_name` like #{name}</if>"+ "<if test=\"lessonName!=null and lessonName != ''\">and b.`lesson_name` like LIKE CONCAT('%',#{lessonName},'%')</if>"+
"<if test=\"directionId!=null and directionId != ''\">and bld.directionId = #{directionId}</if>"+ "<if test=\"directionId!=null and directionId != ''\">and bld.direction_id = #{directionId}</if>"+
"<if test=\"code!=null and code != ''\">and b.`code` like #{code}</if></script>") "<if test=\"code!=null and code != ''\">and b.`code` like LIKE CONCAT('%',#{code},'%')</if></script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryBLessons(Map<String, Object> param); List<BLesson> queryBLessons(BLesson param);
@Select("<script>select bl.*,bld.direction_id as directionId from b_lesson bl " + @Select("<script>select bl.*,bld.direction_id as directionId from b_lesson bl " +
"left join b_lesson_direction bld on bl.business_id = bld.lession_id " + "left join b_lesson_direction bld on bl.business_id = bld.lession_id " +
......
...@@ -64,12 +64,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -64,12 +64,12 @@ public class BLessonServiceImpl implements BLessonService {
@Override @Override
public List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, BLesson model) { public List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, BLesson model) {
return bLessonRepository.queryBLessons(queryParamHandler(model)); return bLessonRepository.queryBLessons(model);
} }
@Override @Override
public List<BLesson> queryBLessons(BLesson model) { public List<BLesson> queryBLessons(BLesson model) {
return bLessonRepository.queryBLessons(queryParamHandler(model)); return bLessonRepository.queryBLessons(model);
} }
......
...@@ -252,6 +252,13 @@ public interface BSlRepository extends BaseMapper<BSl> { ...@@ -252,6 +252,13 @@ public interface BSlRepository extends BaseMapper<BSl> {
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
BSl queryBSlById(String slId); BSl queryBSlById(String slId);
@Select("select count(brs.student_code) AS studentNum " +
"from b_sl sl " +
"LEFT JOIN b_r_sl_student brs on sl.`code` = brs.sl_code " +
"where sl.business_id = #{slId}")
int queryStudentNumById(String slId);
//List<BStudent> querySlStudentByPagination(String slId); //List<BStudent> querySlStudentByPagination(String slId);
} }
...@@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository; ...@@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created with yangzhaojun on 2018-1-15 19:49:07. * Created with yangzhaojun on 2018-1-15 19:49:07.
...@@ -25,5 +26,7 @@ public interface TPaperChapterRepository extends BaseMapper<TPaperChapter> { ...@@ -25,5 +26,7 @@ public interface TPaperChapterRepository extends BaseMapper<TPaperChapter> {
+ "</script>") + "</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<TPaperChapter> queryTPaperChapters(TPaperChapter tPaperChapter); List<TPaperChapter> queryTPaperChapters(TPaperChapter tPaperChapter);
void logicPaperProcedure(Map<String, Object> map);
} }
package org.rcisoft.business.tpaperchapter.service.impl; package org.rcisoft.business.tpaperchapter.service.impl;
import com.google.gson.Gson; import com.google.gson.Gson;
import org.apache.commons.collections.map.HashedMap;
import org.rcisoft.business.bsl.dao.BSlRepository;
import org.rcisoft.business.tpaper.dao.TPaperDetailRepository; import org.rcisoft.business.tpaper.dao.TPaperDetailRepository;
import org.rcisoft.business.tpaper.dao.TPaperRepository; import org.rcisoft.business.tpaper.dao.TPaperRepository;
import org.rcisoft.business.tpaper.dao.TPaperSectionRepository; import org.rcisoft.business.tpaper.dao.TPaperSectionRepository;
...@@ -55,6 +57,9 @@ public class TPaperChapterServiceImpl implements TPaperChapterService { ...@@ -55,6 +57,9 @@ public class TPaperChapterServiceImpl implements TPaperChapterService {
@Autowired @Autowired
private TPaperDetailRepository tPaperDetailRepository; private TPaperDetailRepository tPaperDetailRepository;
@Autowired
private BSlRepository bSlRepository;
/** /**
* 保存 tPaperChapter * 保存 tPaperChapter
...@@ -67,42 +72,47 @@ public class TPaperChapterServiceImpl implements TPaperChapterService { ...@@ -67,42 +72,47 @@ public class TPaperChapterServiceImpl implements TPaperChapterService {
//增加操作 //增加操作
UserUtil.setCurrentPersistOperation(tPaperChapter); UserUtil.setCurrentPersistOperation(tPaperChapter);
int line = tPaperChapterRepository.insertSelective(tPaperChapter); int line = tPaperChapterRepository.insertSelective(tPaperChapter);
List<TPaperChapterSection> tPaperChapterSections = new ArrayList<>();
Gson gson = new Gson();
Map<String, Object> pcompose = new HashMap<String, Object>();
pcompose = gson.fromJson(tPaperChapter.getPcompose(), pcompose.getClass());
for(int i=0; i<pcompose.size();i++){
String key = String.valueOf(i+1);
//记录题型及数量
TPaperChapterSection tPaperChapterSection = new TPaperChapterSection();
tPaperChapterSection.setPcId(tPaperChapter.getBusinessId());
tPaperChapterSection.setQType(key);
tPaperChapterSection.setQNum(Double.valueOf(String.valueOf(pcompose.get(key))).intValue());
tPaperChapterSections.add(tPaperChapterSection);
}
tPaperChapterSectionRepository.insertList(tPaperChapterSections);
if(tPaperChapter.getPoption().equals("2")){ if(tPaperChapter.getPoption().equals("2")){
//自主选题 //自主选题
//1.添加试卷表信息 //1.添加试卷表信息
TPaper tPaper = new TPaper(); TPaper tPaper = new TPaper();
tPaper.setChapId(tPaperChapter.getChapId()); tPaper.setChapId(tPaperChapter.getChapId());
tPaper.setPcId(tPaperChapter.getBusinessId()); tPaper.setPcId(tPaperChapter.getBusinessId());
tPaper.setStatus("1"); //tPaper.setStatus("1");
tPaperRepository.insertSelective(tPaper); tPaperRepository.insertSelective(tPaper);
//2.添加大题表信息 记录题型及数量 //2.添加大题表信息 记录题型及数量
List<TPaperSection> tPaperSections = new ArrayList<>(); List<TPaperSection> tPaperSections = new ArrayList<>();
List<TPaperChapterSection> tPaperChapterSections = new ArrayList<>();
//得到试卷ID //得到试卷ID
TPaper pid = tPaperRepository.selectOne(tPaper); TPaper pid = tPaperRepository.selectOne(tPaper);
//数据转为map //数据转为map
Gson gson = new Gson(); for(int i=0; i<pcompose.size();i++){
Map<String, Object> map = new HashMap<String, Object>();
map = gson.fromJson(tPaperChapter.getPcompose(), map.getClass());
for(int i=0; i<map.size();i++){
String key = String.valueOf(i+1); String key = String.valueOf(i+1);
TPaperSection tPaperSection = new TPaperSection(); TPaperSection tPaperSection = new TPaperSection();
tPaperSection.setPId(String.valueOf(pid.getBusinessId())); tPaperSection.setPId(String.valueOf(pid.getBusinessId()));
tPaperSection.setQType(key); tPaperSection.setQType(key);
tPaperSection.setSorder(i+1); tPaperSection.setSorder(i+1);
tPaperSections.add(tPaperSection); tPaperSections.add(tPaperSection);
//记录题型及数量
TPaperChapterSection tPaperChapterSection = new TPaperChapterSection();
tPaperChapterSection.setPcId(tPaperChapter.getBusinessId());
tPaperChapterSection.setQType(key);
tPaperChapterSection.setQNum(Double.valueOf(String.valueOf(map.get(key))).intValue());
tPaperChapterSections.add(tPaperChapterSection);
} }
//插入数据库 //插入数据库
tPaperSectionRepository.insertList(tPaperSections); tPaperSectionRepository.insertList(tPaperSections);
tPaperChapterSectionRepository.insertList(tPaperChapterSections);
//3.添加小题表信息 //3.添加小题表信息
List<TPaperDetail> tPaperDetails = new ArrayList<>(); List<TPaperDetail> tPaperDetails = new ArrayList<>();
...@@ -142,6 +152,14 @@ public class TPaperChapterServiceImpl implements TPaperChapterService { ...@@ -142,6 +152,14 @@ public class TPaperChapterServiceImpl implements TPaperChapterService {
}else{ }else{
//随机生成 //随机生成
int plan_count = bSlRepository.queryStudentNumById(tPaperChapter.getSlId());
Map<String,Object> map = new HashedMap();
map.put("planId",tPaperChapter.getBusinessId());
map.put("plan_type",Integer.parseInt(tPaperChapter.getPscope()));
map.put("slId",tPaperChapter.getSlId());
map.put("chid",tPaperChapter.getChapId());
map.put("plan_count",plan_count);
tPaperChapterRepository.logicPaperProcedure(map);
} }
return new PersistModel(line); return new PersistModel(line);
} }
......
...@@ -156,11 +156,10 @@ public class TQuestionController extends PaginationController<TQuestion> { ...@@ -156,11 +156,10 @@ public class TQuestionController extends PaginationController<TQuestion> {
@GetMapping(value = "/queryQuestionsByChap_IdAndQtype") @GetMapping(value = "/queryQuestionsByChap_IdAndQtype")
public Result queryBChapters(String chapterId) { public Result queryBChapters(String chapterId) {
Map<String, Object> map = new HashedMap(); Map<String, Object> map = new HashedMap();
String num = "";
map.put("ChoiceList",tQuestionServiceImpl.queryQuestionsByChap_IdAndQtype(chapterId, "1")); map.put("ChoiceList",tQuestionServiceImpl.queryQuestionsByChap_IdAndQtype(chapterId, "1"));
map.put("MultiSelectList",tQuestionServiceImpl.queryQuestionsByChap_IdAndQtype(chapterId, "2")); map.put("MultiSelectList",tQuestionServiceImpl.queryQuestionsByChap_IdAndQtype(chapterId, "2"));
map.put("JudgmentList",tQuestionServiceImpl.queryQuestionsByChap_IdAndQtype(chapterId, "3")); map.put("JudgmentList",tQuestionServiceImpl.queryQuestionsByChap_IdAndQtype(chapterId, "3"));
num = "NumOfChoice : "+tQuestionServiceImpl.queryNumByType("1")+ String num = "NumOfChoice : "+tQuestionServiceImpl.queryNumByType("1")+
"NumOfMultiSelect : "+tQuestionServiceImpl.queryNumByType("2")+ "NumOfMultiSelect : "+tQuestionServiceImpl.queryNumByType("2")+
"NumOfJudgment : "+tQuestionServiceImpl.queryNumByType("3"); "NumOfJudgment : "+tQuestionServiceImpl.queryNumByType("3");
map.put("Num",num); map.put("Num",num);
......
package org.rcisoft.business.tquestion.dao; package org.rcisoft.business.tquestion.dao;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.tquestion.entity.TQuestionOptions; import org.rcisoft.business.tquestion.entity.TQuestionOptions;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
...@@ -26,5 +27,8 @@ public interface TQuestionOptionsRepository extends BaseMapper<TQuestionOptions> ...@@ -26,5 +27,8 @@ public interface TQuestionOptionsRepository extends BaseMapper<TQuestionOptions>
+ "</script>") + "</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<TQuestionOptions> queryTQuestionOptions(@Param("qid") String qid); List<TQuestionOptions> queryTQuestionOptions(@Param("qid") String qid);
@Delete("delete from t_question_options where qid = #{qid}")
int deleteByQId(String qid);
} }
...@@ -99,8 +99,22 @@ public class TQuestionServiceImpl implements TQuestionService { ...@@ -99,8 +99,22 @@ public class TQuestionServiceImpl implements TQuestionService {
public PersistModel merge(TQuestion tQuestion){ public PersistModel merge(TQuestion tQuestion){
UserUtil.setCurrentMergeOperation(tQuestion); UserUtil.setCurrentMergeOperation(tQuestion);
int line = tQuestionRepository.updateByPrimaryKeySelective(tQuestion); int line = tQuestionRepository.updateByPrimaryKeySelective(tQuestion);
/*log.info(UserUtil.getUserInfoProp(tQuestion.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+ //修改选项信息
tQuestion.getBusinessId()+"的信息");*/ List<TQuestionOptions> options = new ArrayList<>();
if(!tQuestion.getQtype().equals("3")){
tQuestionOptionsRepository.deleteByQId(tQuestion.getBusinessId());
int i = 0;
for (String option : tQuestion.getQuestionOptions().split(",")){
TQuestionOptions TOptions = new TQuestionOptions();
TOptions.setCommonBusinessId();
TOptions.setQid(tQuestion.getBusinessId());
TOptions.setAlias(String.valueOf(i));
TOptions.setRepresent(option);
options.add(TOptions);
i++;
}
tQuestionRepository.insertOptionsList(options);
}
return new PersistModel(line); return new PersistModel(line);
} }
......
...@@ -49,14 +49,32 @@ ...@@ -49,14 +49,32 @@
bf.file_url AS fileUrl, bf.file_url AS fileUrl,
bf.ppt_url AS pptUrl, bf.ppt_url AS pptUrl,
bf.pdf_url AS pdfUrl, bf.pdf_url AS pdfUrl,
pc.business_id AS paperUrl,
IFNULL((select is_complete from b_r_student_chapter brs IFNULL((select is_complete 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
WHERE brs.chapter_id = bc.business_id AND su.business_id = #{studentId}),0) as isComplete, WHERE brs.chapter_id = bc.business_id AND su.business_id = #{studentId}),0) as isComplete,
IFNULL((select ppt_finish from b_r_student_chapter brs
LEFT JOIN b_student bs on brs.student_id = bs.business_id
LEFT JOIN s_user su on bs.`code` = su.login_name
WHERE brs.chapter_id = bc.business_id AND su.business_id = #{studentId}),0) as pptFinish,
IFNULL((select pdf_finish from b_r_student_chapter brs
LEFT JOIN b_student bs on brs.student_id = bs.business_id
LEFT JOIN s_user su on bs.`code` = su.login_name
WHERE brs.chapter_id = bc.business_id AND su.business_id = #{studentId}),0) as pdfFinish,
IFNULL((select video_finish from b_r_student_chapter brs
LEFT JOIN b_student bs on brs.student_id = bs.business_id
LEFT JOIN s_user su on bs.`code` = su.login_name
WHERE brs.chapter_id = bc.business_id AND su.business_id = #{studentId}),0) as videoFinish,
IFNULL((select paper_finish from b_r_student_chapter brs
LEFT JOIN b_student bs on brs.student_id = bs.business_id
LEFT JOIN s_user su on bs.`code` = su.login_name
WHERE brs.chapter_id = bc.business_id AND su.business_id = #{studentId}),0) as paperFinish,
(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
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
WHERE WHERE
bc.del_flag = 0 bc.del_flag = 0
AND bc.pid = #{paId} AND bc.pid = #{paId}
......
...@@ -19,5 +19,15 @@ ...@@ -19,5 +19,15 @@
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
</resultMap> </resultMap>
<select id="logicPaperProcedure" statementType="CALLABLE">
call logic_paper_procedure(#{planId,jdbcType=VARCHAR,mode=IN},
#{plan_count,jdbcType=INTEGER,mode=IN},
#{plan_type,jdbcType=INTEGER,mode=IN},
#{slId,jdbcType=VARCHAR,mode=IN},
#{chid,jdbcType=VARCHAR,mode=IN}
);
</select>
<!--<cache type="${corePackag!}.util.RedisCache"/>--> <!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper> </mapper>
\ No newline at end of file
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