课程管理更改

学生端教学中心更改
学生端实验记录更改
接入理论
master
rong.liu 1 month ago
parent 75394f6a8d
commit 1993aad438
  1. 28
      common/src/main/java/com/huoran/common/entity/ProjectManage.java
  2. 14
      exam/src/main/java/com/huoran/exam/controller/ExamPaperController.java
  3. 4
      exam/src/main/java/com/huoran/exam/entity/req/ExamSubmitReq.java
  4. 2
      exam/src/main/java/com/huoran/exam/service/ExamPaperService.java
  5. 94
      exam/src/main/java/com/huoran/exam/service/impl/ExamPaperServiceImpl.java
  6. 4
      nakadai/src/main/java/com/huoran/nakadai/controller/CurriculumController.java
  7. 8
      nakadai/src/main/java/com/huoran/nakadai/entity/Curriculum.java
  8. 3
      nakadai/src/main/java/com/huoran/nakadai/entity/CurriculumConfigure.java
  9. 5
      nakadai/src/main/java/com/huoran/nakadai/entity/req/ConfigurationReq.java
  10. 12
      nakadai/src/main/java/com/huoran/nakadai/entity/res/CurriculumDetailRes.java
  11. 44
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/CurriculumConfigureMapper.xml
  12. 28
      nakadai/src/main/java/com/huoran/nakadai/service/impl/CurriculumServiceImpl.java
  13. 10
      occupationlab/src/main/java/com/huoran/occupationlab/controller/AchievementController.java
  14. 23
      occupationlab/src/main/java/com/huoran/occupationlab/controller/ProjectManageController.java
  15. 4
      occupationlab/src/main/java/com/huoran/occupationlab/entity/req/PageAssessmentForProjectReq.java
  16. 49
      occupationlab/src/main/java/com/huoran/occupationlab/entity/resp/AchievementResp.java
  17. 3
      occupationlab/src/main/java/com/huoran/occupationlab/mapper/ExperimentalReportMapper.java
  18. 9
      occupationlab/src/main/java/com/huoran/occupationlab/mapper/ProjectManageMapper.java
  19. 207
      occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ExperimentalReportMapper.xml
  20. 96
      occupationlab/src/main/java/com/huoran/occupationlab/mapper/xml/ProjectManageMapper.xml
  21. 3
      occupationlab/src/main/java/com/huoran/occupationlab/service/ExperimentalReportService.java
  22. 5
      occupationlab/src/main/java/com/huoran/occupationlab/service/ProjectManageService.java
  23. 66
      occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ExperimentalReportServiceImpl.java
  24. 148
      occupationlab/src/main/java/com/huoran/occupationlab/service/impl/ProjectManageServiceImpl.java

@ -70,7 +70,7 @@ public class ProjectManage implements Serializable {
@NotNull(message = "状态不能为空!")
private Integer state;
@ApiModelProperty(value = "系统类型(0编程类 1流程类 2.AI类)")
@ApiModelProperty(value = "系统类型(0编程类 1流程类 2.AI类 3.理论类)")
@TableField(exist = false)
private Integer type;
@ -157,5 +157,31 @@ public class ProjectManage implements Serializable {
@ApiModelProperty(value = "商品id")
private Integer mallId;
//试卷id
@ApiModelProperty(value = "试卷id")
@TableField(exist = false)
private Integer paperId;
//试卷名称
@ApiModelProperty(value = "试卷名称")
@TableField(exist = false)
private String paperName;
@ApiModelProperty(value = "建议用途(练习、考核、竞赛)")
@TableField(exist = false)
private Integer paperType;
@ApiModelProperty(value = "题型")
@TableField(exist = false)
private String questionType;
@ApiModelProperty(value = "年份")
@TableField(exist = false)
private Integer particularYear;
@ApiModelProperty(value = "试卷总分")
@TableField(exist = false)
private Double score;
}

@ -334,6 +334,20 @@ public class ExamPaperController {
}
@NoRepeatSubmit
@ApiOperation(value = "提交试卷(练习)")
@PostMapping("/submitTheExamPaperForPractice")
public R submitTheExamPaperForPractice(@RequestBody @Valid ExamSubmitReq examSubmitReq) throws JsonProcessingException {
String accountId = TokenUtils.getAccountId();
Integer schoolId = TokenUtils.getSchoolId();
examSubmitReq.setAccountId(Integer.valueOf(accountId));
examSubmitReq.setSchoolId(schoolId);
return examPaperService.submitTheExamPaperForPractice(examSubmitReq);
}
@NoRepeatSubmit
@ApiOperation(value = "模拟交卷")
@PostMapping("/simulatedHandover")

@ -71,5 +71,9 @@ public class ExamSubmitReq implements Serializable {
@ApiModelProperty(value = "商品id")
private Integer mallId;
//课程id
@ApiModelProperty(value = "课程id")
private Integer cid;
}

@ -30,6 +30,8 @@ public interface ExamPaperService extends IService<ExamPaper> {
R submitTheExamPaper(ExamSubmitReq examSubmitReq) throws JsonProcessingException;
R submitTheExamPaperForPractice(ExamSubmitReq examSubmitReq) throws JsonProcessingException;
void editTheTestPaperAsADraft(List<Integer> paperIds);
ResponseEntity<Resource> word(R detailedExamScores, HttpServletResponse response) throws IOException;

@ -30,6 +30,8 @@ import com.huoran.exam.service.ExamPaperService;
import com.huoran.exam.service.QuestionsService;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ByteArrayResource;
@ -59,7 +61,7 @@ import java.util.regex.Pattern;
*/
@Service
public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper> implements ExamPaperService {
private static Logger logger = LoggerFactory.getLogger(ExamPaperServiceImpl.class);
@Autowired
public ExamClassificationMapper examClassificationMapper;
@ -234,6 +236,96 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
return R.ok();
}
private boolean isValidExamSubmitReq(ExamSubmitReq req) {
// 实现输入验证逻辑
return req.getPaperId() != null && req.getExamSubmitJudgeList() != null && !req.getExamSubmitJudgeList().isEmpty();
}
private boolean isValidSubmitJudgeReq(SubmitJudgeReq req) {
// 实现输入验证逻辑
return req.getAnswer() != null && req.getAnswerContent() != null && req.getQuestionVersionId() != null;
}
@Override
public R submitTheExamPaperForPractice(ExamSubmitReq examSubmitReq) throws JsonProcessingException {
try {
if (examSubmitReq == null || !isValidExamSubmitReq(examSubmitReq)) {
throw new IllegalArgumentException("Invalid exam submit request");
}
ExperimentalReport report = new ExperimentalReport();
report.setPaperId(examSubmitReq.getPaperId());
report.setType(3);
report.setCurriculumId(examSubmitReq.getCid());
BeanUtils.copyProperties(examSubmitReq, report);
report.setEndTime(new Date());
report.setScore(0.0);
report.setClassName(null);
int reportId = occupationlabClient.addExperimentalReport(report);
double totalScoreOfTheExamPaper = 0.0;
List<ExamPaperQuestionUserAnswer> examPaperQuestionUserAnswerList = new ArrayList<>();
for (SubmitJudgeReq submitJudgeReq : examSubmitReq.getExamSubmitJudgeList()) {
if (submitJudgeReq == null || !isValidSubmitJudgeReq(submitJudgeReq)) {
throw new IllegalArgumentException("提交参数请求无效");
}
ExamPaperQuestionUserAnswer examPaperQuestionUserAnswer = new ExamPaperQuestionUserAnswer();
if (submitJudgeReq.getAnswer().isEmpty()) {
if (submitJudgeReq.getAnswerContent().isEmpty()) {
examPaperQuestionUserAnswer.setAnsweringStatus("未作答");
}
} else {
GradingResultResp gradingResultResp = questionsService.gradeAnswer(submitJudgeReq);
examPaperQuestionUserAnswer.setDoRight(gradingResultResp.isCorrect());
examPaperQuestionUserAnswer.setAnsweringStatus("已作答");
totalScoreOfTheExamPaper += gradingResultResp.getTotalScore();
examPaperQuestionUserAnswer.setUserScore(gradingResultResp.getTotalScore());
examPaperQuestionUserAnswer.setBackupScore(gradingResultResp.getTotalScore());
if (gradingResultResp.getBlankGradingInfos() != null && gradingResultResp.getBlankGradingInfos().size() > 0) {
String jsonText = JSON.toJSONString(gradingResultResp.getBlankGradingInfos());
examPaperQuestionUserAnswer.setJsonText(jsonText);
}
}
examPaperQuestionUserAnswer.setReportId(reportId);
examPaperQuestionUserAnswer.setCreateUser(TokenUtils.getUserName());
examPaperQuestionUserAnswer.setPaperId(examSubmitReq.getPaperId());
examPaperQuestionUserAnswer.setQuestionVersionId(submitJudgeReq.getQuestionVersionId());
examPaperQuestionUserAnswer.setSchoolId(examSubmitReq.getSchoolId());
examPaperQuestionUserAnswer.setAccountId(examSubmitReq.getAccountId());
examPaperQuestionUserAnswer.setQuestionType(submitJudgeReq.getQuestionType());
examPaperQuestionUserAnswer.setSerialNumber(submitJudgeReq.getSerialNumber());
examPaperQuestionUserAnswer.setUserAnswer(submitJudgeReq.getAnswer().toString());
examPaperQuestionUserAnswer.setQuestionScore(submitJudgeReq.getSetScore());
examPaperQuestionUserAnswer.setAttachmentUrl(submitJudgeReq.getAttachmentUrl());
examPaperQuestionUserAnswer.setAttachmentName(submitJudgeReq.getAttachmentName());
examPaperQuestionUserAnswer.setAnswerContent(submitJudgeReq.getAnswerContent());
examPaperQuestionUserAnswer.setOutlineId(submitJudgeReq.getOutlineId());
if (examSubmitReq.getSystemId() != null) {
examPaperQuestionUserAnswer.setSystemId(examSubmitReq.getSystemId());
}
examPaperQuestionUserAnswerList.add(examPaperQuestionUserAnswer);
}
examPaperQuestionUserAnswerService.saveBatch(examPaperQuestionUserAnswerList);
report.setScore(totalScoreOfTheExamPaper);
report.setReportId(reportId);
occupationlabClient.updateExperimentalReport(report);
return R.ok();
} catch (Exception e) {
// 记录异常日志
logger.error("提交练习试卷错误", e);
return R.error("提交失败,请重试");
}
}
@Override
public void editTheTestPaperAsADraft(List<Integer> paperIds) {
//批量把试卷状态更改为草稿

@ -64,6 +64,10 @@ public class CurriculumController {
return service.createCurriculum(curriculum);
}
/**
* @Description: 编辑课程
* @auther: Rong

@ -140,4 +140,12 @@ public class Curriculum implements Serializable {
@ApiModelProperty(value = "小程序图片地址")
private String miniProgramPictureAddress;
//练习是否包含理论试卷
@ApiModelProperty(value = "练习是否包含理论试卷(0否,1是)")
private Integer practiceTheoreticalPaper;
//练习是否包含实操项目
@ApiModelProperty(value = "练习是否包含实操项目(0否,1是)")
private Integer practicePracticeProject;
}

@ -52,5 +52,8 @@ public class CurriculumConfigure implements Serializable {
@ApiModelProperty(value = "是否删除(默认0未删 1为已删除)")
private Integer isDel;
@ApiModelProperty(value = "试卷id")
private Integer paperId;
}

@ -32,4 +32,9 @@ public class ConfigurationReq {
@ApiModelProperty(value = "是否展示")
private Integer isShow;
//试卷id
@ApiModelProperty(value = "试卷id")
private Integer paperId;
}

@ -19,15 +19,19 @@ public class CurriculumDetailRes {
@ApiModelProperty(value = "课程id")
private Integer cid;
@ApiModelProperty(value = "项目名称")
@ApiModelProperty(value = "项目名称/试卷名称")
private String projectName;
@ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)")
private Integer permissions;
@ApiModelProperty(value = "应用名称")
@ApiModelProperty(value = "系统名称")
private String applicationName;
//systemName
@ApiModelProperty(value = "系统名称")
private String systemName;
@ApiModelProperty(value = "排序(对项目展示进行排序)")
private Integer sort;
@ -48,4 +52,8 @@ public class CurriculumDetailRes {
@ApiModelProperty(value = "备注")
private String remark;
//试卷id
@ApiModelProperty(value = "试卷id")
private Integer paperId;
}

@ -29,27 +29,47 @@
</if>
</select>
<select id="getCurriculumConfigure" resultType="com.huoran.nakadai.entity.res.CurriculumDetailRes">
SELECT c.cid,
SELECT
c.cid,
c.config_id,
c.project_id,
c.paper_id,
c.permissions,
c.is_show,
m.project_name,
CASE
WHEN c.project_id IS NOT NULL THEN
m.project_name
WHEN c.paper_id IS NOT NULL THEN
p.NAME
END AS projectName,
c.sort,
(SELECT s.system_name
FROM nakadai.service_configuration s
WHERE s.system_id = m.system_id) AS applicationName,
s.system_name AS applicationName,
s.system_name AS system_name,
c.system_id,
s.type,
IFNULL(
CASE
WHEN c.project_id IS NOT NULL THEN
m.remark
FROM curriculum_configure c
INNER JOIN occupationlab.ol_project_manage m ON m.project_id = c.project_id
join service_configuration s on s.system_id = c.system_id
WHERE c.is_del = 0
WHEN c.paper_id IS NOT NULL THEN
p.NAME
END,
m.project_name
) remark
FROM
curriculum_configure c
LEFT JOIN occupationlab.ol_project_manage m ON m.project_id = c.project_id
AND m.zt_del = 0
LEFT JOIN service_configuration s ON s.system_id = c.system_id
LEFT JOIN exam.exam_paper p ON p.paper_id = c.paper_id
WHERE
c.is_del = 0
AND c.permissions = #{permissions}
and c.cid = #{cid}
and m.zt_del = 0
ORDER BY sort
AND c.cid = #{cid}
ORDER BY
c.sort;
</select>
<select id="checkConfig" resultType="java.lang.String">
SELECT GROUP_CONCAT(c.curriculum_name) as curriculumName

@ -83,6 +83,7 @@ public class CurriculumServiceImpl extends ServiceImpl<CurriculumMapper, Curricu
configureMapper.insert(new CurriculumConfigure()
.setSort(practice.getSort())
.setProjectId(practice.getProjectId())
.setPaperId(practice.getPaperId())
.setSystemId(practice.getSystemId())
.setCid(curriculum.getCid())
.setPermissions(0)
@ -96,6 +97,7 @@ public class CurriculumServiceImpl extends ServiceImpl<CurriculumMapper, Curricu
configureMapper.insert(new CurriculumConfigure()
.setSort(assessment.getSort())
.setProjectId(assessment.getProjectId())
.setPaperId(assessment.getPaperId())
.setSystemId(assessment.getSystemId())
.setCid(curriculum.getCid())
.setPermissions(1)
@ -108,6 +110,7 @@ public class CurriculumServiceImpl extends ServiceImpl<CurriculumMapper, Curricu
configureMapper.insert(new CurriculumConfigure()
.setSort(assessment.getSort())
.setProjectId(assessment.getProjectId())
.setPaperId(assessment.getPaperId())
.setSystemId(assessment.getSystemId())
.setCid(curriculum.getCid())
.setPermissions(2)
@ -152,11 +155,12 @@ public class CurriculumServiceImpl extends ServiceImpl<CurriculumMapper, Curricu
configureMapper.update(new CurriculumConfigure(), updateWrapper);
//考核系统id 因为选择应用配置时可以选择多个系统下的考核项目
if (req.getSystemIdByAssessment().size() > 0) {
if (!req.getSystemIdByAssessment().isEmpty()) {
req.getSystemIdByAssessment().stream().forEach(assessment -> {
configureMapper.insert(new CurriculumConfigure()
.setSort(assessment.getSort())
.setProjectId(assessment.getProjectId())
.setPaperId(assessment.getPaperId())
.setSystemId(assessment.getSystemId())
.setCid(curriculum.getCid())
.setPermissions(1)
@ -176,11 +180,12 @@ public class CurriculumServiceImpl extends ServiceImpl<CurriculumMapper, Curricu
updateWrapper.eq("permissions", 0);
configureMapper.update(new CurriculumConfigure(), updateWrapper);
//练习系统id 因为选择应用配置时可以选择多个系统的练习项目
if (req.getSystemIdByPractice().size() > 0) {
if (!req.getSystemIdByPractice().isEmpty()) {
req.getSystemIdByPractice().stream().forEach(practice -> {
configureMapper.insert(new CurriculumConfigure()
.setSort(practice.getSort())
.setProjectId(practice.getProjectId())
.setPaperId(practice.getPaperId())
.setSystemId(practice.getSystemId())
.setCid(curriculum.getCid())
.setPermissions(0)
@ -200,11 +205,12 @@ public class CurriculumServiceImpl extends ServiceImpl<CurriculumMapper, Curricu
updateWrapper.eq("permissions", 2);
configureMapper.update(new CurriculumConfigure(), updateWrapper);
//练习系统id 因为选择应用配置时可以选择多个系统的练习项目
if (req.getSystemIdByCompetition().size() > 0) {
if (!req.getSystemIdByCompetition().isEmpty()) {
req.getSystemIdByCompetition().stream().forEach(practice -> {
configureMapper.insert(new CurriculumConfigure()
.setSort(practice.getSort())
.setProjectId(practice.getProjectId())
.setPaperId(practice.getPaperId())
.setSystemId(practice.getSystemId())
.setCid(curriculum.getCid())
.setPermissions(2)
@ -453,6 +459,22 @@ public class CurriculumServiceImpl extends ServiceImpl<CurriculumMapper, Curricu
curriculum.setPracticeConfig(practice);
curriculum.setAssessmentConfig(assessment);
curriculum.setCompetitionConfig(competition);
//判断练习是否包含理论试卷,如果practice中存在type为3说明有理论的,
if (practice.stream().anyMatch(p -> p.getType() == 3)) {
curriculum.setPracticeTheoreticalPaper(1);
} else {
curriculum.setPracticeTheoreticalPaper(0);
}
//判断练习是否包含实操项目,如果practice中存在type为0说明有实操的
if (practice.stream().anyMatch(p -> p.getType() == 0)) {
curriculum.setPracticePracticeProject(1);
} else {
curriculum.setPracticePracticeProject(0);
}
return R.ok().put("data", curriculum);
}

@ -235,10 +235,14 @@ public class AchievementController {
*/
@PostMapping("/practiceByStudentDetail")
@ApiOperation(value = " 学生端练习实验情况", response = AchievementResp.class)
public R practiceByStudentDetail(@RequestParam("curriculumId") @ApiParam(value = "课程id", required = true) @NotNull(message = "课程id不能为空") Integer curriculumId, @RequestParam("projectId") @ApiParam(value = "项目id", required = true) @NotNull(message = "项目id不能为空") Integer projectId, @ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum, @ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize, HttpServletRequest request) {
public R practiceByStudentDetail(@RequestParam("curriculumId") @ApiParam(value = "课程id", required = true) @NotNull(message = "课程id不能为空") Integer curriculumId,
@RequestParam("projectId") @ApiParam(value = "项目id", required = false) @NotNull(message = "项目id不能为空") Integer projectId,
@RequestParam("paperId") @ApiParam(value = "试卷id", required = false) @NotNull(message = "试卷id不能为空") Integer paperId,
@ApiParam(value = "当前页数", required = true) @RequestParam("pageNum") Integer pageNum,
@ApiParam(value = "当前页需要显示的数量", required = true) @RequestParam("pageSize") Integer pageSize,
HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
//Integer curriculumId, Integer projectId, Integer accountId, Integer pageNum, Integer pageSize
return experimentalReportService.practiceByStudentDetail(curriculumId, projectId, Integer.valueOf(accountId), pageNum, pageSize);
return experimentalReportService.practiceByStudentDetail(curriculumId, projectId, Integer.valueOf(accountId), pageNum, pageSize,paperId);
}
/**

@ -202,8 +202,9 @@ public class ProjectManageController {
@ApiOperation(value = "根据系统id、项目权限获取系统内置项目")
@GetMapping("/getInternalProjectBySystemId")
public List<ProjectManage> getInternalProjectBySystemId(@RequestParam List<Integer> systemId,
@RequestParam @ApiParam(value = "项目权限(0、练习 1、考核 2、竞赛)", name = "permissions") Integer permissions) {
return projectManageService.getInternalProjectBySystemId(systemId, permissions);
@RequestParam @ApiParam(value = "项目权限(0、练习 1、考核 2、竞赛)", name = "permissions") Integer permissions,
@RequestParam @ApiParam(value = "关键词", name = "keyword") String keyword) {
return projectManageService.getInternalProjectBySystemId(systemId, permissions,keyword);
}
@ApiOperation("获取学校下拥有的系统")
@ -233,6 +234,23 @@ public class ProjectManageController {
}
//获取考核项目或者试卷
@ApiOperation(value = "获取考核项目或者试卷", response = ProjectManage.class)
@PostMapping("/getProjectOrExamPaperByAssessment")
public R getProjectOrExamPaperByAssessment(@RequestBody PageAssessmentForProjectReq projectManageReq) {
//token查询学校id
Integer schoolId = TokenUtils.getSchoolId();
if (schoolId == -1) {
return R.error("学校查询失败");
}
projectManageReq.setSchoolId(schoolId);
return projectManageService.getProjectOrExamPaperByAssessment(projectManageReq);
}
@ApiOperation(value = "赛事根据课程id获取考核项目列表(分页、筛选)", response = ProjectManage.class)
@PostMapping("/getProjectAssessmentByCompetition")
public R getProjectAssessmentByCompetition(@RequestBody PageAssessmentForProjectReq projectManageReq, HttpServletRequest request) {
@ -277,3 +295,4 @@ public class ProjectManageController {
}
}

@ -44,4 +44,8 @@ public class PageAssessmentForProjectReq extends PageReq {
@ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)")
private Integer permissions;
//关键词
@ApiModelProperty(value = "关键词")
private String keyword;
}

@ -33,15 +33,19 @@ public class AchievementResp {
@ApiModelProperty(value = "项目id")
private Integer projectId;
//试卷id
@ApiModelProperty(value = "试卷id")
private Integer paperId;
@ApiModelProperty(value = "考试状态主键")
private Integer testStatusId;
@ApiModelProperty(value = "项目名称")
/*@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "课程名称")
private String curriculumName;
private String curriculumName;*/
@ApiModelProperty(value = "项目权限(0、练习 1、考核 2、竞赛)")
private Integer permissions;
@ -93,17 +97,17 @@ public class AchievementResp {
@ApiModelProperty(value = "提交时间")
private String submitTime;
@ApiModelProperty(value = "最高分")
private Double hightScore;
/* @ApiModelProperty(value = "最高分")
private Double hightScore;*/
@ApiModelProperty(value = "最近实验时间")
private String lastTime;
/*@ApiModelProperty(value = "最近实验时间")
private String lastTime;*/
@ApiModelProperty(value = "练习次数")
private Integer practiceNum;
/* @ApiModelProperty(value = "练习次数")
private Integer practiceNum;*/
@ApiModelProperty(value = "累计时长")
private String duration;
/* @ApiModelProperty(value = "累计时长")
private String duration;*/
@ApiModelProperty(value = "进入时间")
private String startTime;
@ -121,4 +125,29 @@ public class AchievementResp {
@ApiModelProperty(value = "课程id")
private Integer curriculumId;
@Excel(name = "项目名称", orderNum = "1", isImportField = "projectName", width = 30)
@ApiModelProperty(value = "项目名称")
private String projectName;
@Excel(name = "课程名称", orderNum = "2", isImportField = "curriculumName", width = 30)
@ApiModelProperty(value = "课程名称")
private String curriculumName;
@Excel(name = "最高分", orderNum = "3", isImportField = "hightScore", width = 30)
@ApiModelProperty(value = "最高分")
private double hightScore;
@Excel(name = "练习次数", orderNum = "4", isImportField = "practiceNum", width = 30)
@ApiModelProperty(value = "练习次数")
private Integer practiceNum;
@Excel(name = "累计实验时长(小时)", orderNum = "5", isImportField = "duration", width = 30)
@ApiModelProperty(value = "累计实验时长(小时)")
private String duration;
@Excel(name = "最近实验时间", orderNum = "6", isImportField = "lastTime", width = 30)
@ApiModelProperty(value = "最近实验时间")
private String lastTime;
}

@ -69,7 +69,8 @@ public interface ExperimentalReportMapper extends BaseMapper<ExperimentalReport>
List<ExportByStudentResp> exportPracticeByStudent(@Param("curriculumId") Integer curriculumId, @Param("accountId") Integer accountId);
IPage<AchievementResp> practiceByStudentDetail(Page<AchievementResp> page, @Param("curriculumId") Integer curriculumId, @Param("projectId") Integer projectId, @Param("accountId") Integer accountId);
IPage<AchievementResp> practiceByStudentDetail(Page<AchievementResp> page, @Param("curriculumId") Integer curriculumId, @Param("projectId") Integer projectId,
@Param("accountId") Integer accountId,@Param("paperId") Integer paperId);
List<StuExportAchievementResp> exportPracticeByStudentDetail(@Param("reportIds") String reportIds, @Param("projectId") Integer projectId, @Param("accountId") Integer accountId);

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.common.entity.ProjectManage;
import com.huoran.occupationlab.entity.req.PageAssessmentForProjectReq;
import com.huoran.occupationlab.entity.req.ProjectManageReq;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -112,7 +113,7 @@ public interface ProjectManageMapper extends BaseMapper<ProjectManage> {
Integer selectSystemType(@Param("systemId") Integer systemId);
List<ProjectManage> selectProjectList(@Param("systemIds") String systemIds,@Param("permissions") Integer permissions);
List<ProjectManage> selectProjectList(@Param("systemIds") String systemIds, @Param("permissions") Integer permissions, @Param("keyword") String keyword);
IPage<ProjectManage> selectProjectAssessmentByCompetition(Page<ProjectManage> page, @Param("req") ProjectManageReq projectManageReq);
@ -133,4 +134,10 @@ public interface ProjectManageMapper extends BaseMapper<ProjectManage> {
IPage<ProjectManage> selectCompetitionProjectByMiddleGround(Page<ProjectManage> page, @Param("req") ProjectManageReq projectManageReq);
List<ProjectManage> selectSystemProject(@Param("schoolId") Integer schoolId, @Param("systemId") String systemId, @Param("permissions") Integer permissions, @Param("cid") Integer cId);
List<ProjectManage> getAllExamPaper(@Param("schoolId")Integer schoolId, @Param("keyword")String keyword);
List<ProjectManage> getTestPaperByCourse(@Param("permissions") Integer permissions,@Param("cid") Integer cid);
IPage<ProjectManage> getProjectOrExamPaperByAssessment( Page<ProjectManage> page,@Param("req") PageAssessmentForProjectReq req);
}

@ -5,62 +5,33 @@
<select id="queryPracticeByStudent" resultType="com.huoran.occupationlab.entity.resp.AchievementResp"
parameterType="com.huoran.occupationlab.entity.req.PageAchievementByStuReq">
SELECT
( SELECT project_name FROM occupationlab.ol_project_manage pm WHERE pm.project_id = r.project_id ) AS
projectName,
( SELECT cu.curriculum_name FROM nakadai.curriculum cu WHERE cu.cid = r.curriculum_id ) AS curriculumName,
(
SELECT
submit_time
FROM
occupationlab.ol_experimental_report e
WHERE
e.project_id = r.project_id
AND account_id = r.account_id
AND assessment_id IS NULL
ORDER BY
report_id DESC
LIMIT 0,
1
) AS lastTime,
c.cid as curriculumId,
c.curriculum_name,
r.project_id,
FORMAT(
(
( SELECT IFNULL( sum( time_sum ), 0 ) FROM occupationlab.ol_experimental_report WHERE project_id = r.project_id
AND assessment_id IS NULL AND account_id = r.account_id ) / 60
r.paper_id,
CASE
),
2
) AS duration,
(
SELECT
score
FROM
occupationlab.ol_experimental_report e
WHERE
project_id = r.project_id
AND e.account_id = #{pageReq.accountId}
AND assessment_id IS NULL
ORDER BY
score DESC
LIMIT 0,
1
) AS hightScore,
(
SELECT
IFNULL( count( 1 ), 0 )
FROM
occupationlab.ol_experimental_report er
WHERE
er.project_id = r.project_id
AND account_id = #{pageReq.accountId}
AND er.assessment_id IS NULL
) AS practiceNum,
r.curriculum_id
WHEN r.project_id IS NOT NULL
AND r.paper_id IS NOT NULL THEN
CONCAT( m.project_name, ' - ', p.NAME )
WHEN r.project_id IS NOT NULL THEN
m.project_name
WHEN r.paper_id IS NOT NULL THEN
p.NAME ELSE NULL
END AS projectName,
MAX( r.score ) AS hightScore,
COUNT( * ) AS practiceNum,
FORMAT( SUM( r.time_sum ) / 60.0, 2 ) AS duration,
MAX( r.submit_time ) AS lastTime
FROM
occupationlab.ol_experimental_report r
LEFT JOIN exam.exam_paper p ON p.paper_id = r.paper_id
LEFT JOIN occupationlab.ol_project_manage m ON m.project_id = r.project_id
LEFT JOIN nakadai.curriculum c ON c.cid = r.curriculum_id
WHERE
r.account_id = #{pageReq.accountId}
AND r.assessment_id IS NULL
<if test="pageReq.curriculumId!=null">
and r.curriculum_id = #{pageReq.curriculumId}
</if>
@ -74,22 +45,10 @@
</if>
GROUP BY
r.project_id
ORDER BY
(
SELECT
submit_time
FROM
occupationlab.ol_experimental_report e
WHERE
e.project_id = r.project_id
AND account_id = r.account_id
AND assessment_id IS NULL
r.project_id,
r.paper_id
ORDER BY
report_id DESC
LIMIT 0,
1
) DESC
lastTime DESC
</select>
<select id="getExperimentOverview"
resultType="com.huoran.occupationlab.entity.resp.ExperimentOverviewResp">
@ -763,62 +722,38 @@
</select>
<select id="exportPracticeByStudent" resultType="com.huoran.occupationlab.entity.resp.ExportByStudentResp">
SELECT
( SELECT project_name FROM occupationlab.ol_project_manage pm WHERE pm.project_id = r.project_id AND
pm.permissions = 0 ) AS projectName,
( SELECT cu.curriculum_name FROM nakadai.curriculum cu WHERE cu.cid = r.curriculum_id ) AS curriculumName,
(
SELECT
submit_time
FROM
occupationlab.ol_experimental_report e
WHERE
e.project_id = r.project_id
AND account_id = r.account_id
ORDER BY
report_id DESC
LIMIT 0,
1
) AS lastTime,
FORMAT(
( ( SELECT IFNULL( sum( time_sum ), 0 ) FROM occupationlab.ol_experimental_report WHERE project_id =
r.project_id ) / 60 ),
2
) AS duration,
(
SELECT
score
FROM
occupationlab.ol_experimental_report e
WHERE
project_id = r.project_id
AND e.account_id = #{accountId}
ORDER BY
score DESC
LIMIT 0,
1
) AS hightScore,
(
SELECT
IFNULL( count( 1 ), 0 )
FROM
occupationlab.ol_experimental_report er
WHERE
er.project_id = r.project_id
AND account_id = #{accountId}
) AS practiceNum
FROM
occupationlab.ol_experimental_report r
WHERE
r.account_id = #{accountId}
<if test="curriculumId!=null">
and r.curriculum_id = #{curriculumId}
</if>
SELECT c.cid as curriculumId,
c.curriculum_name,
r.project_id,
r.paper_id,
CASE
WHEN r.project_id IS NOT NULL
AND r.paper_id IS NOT NULL THEN
CONCAT(m.project_name, ' - ', p.NAME)
WHEN r.project_id IS NOT NULL THEN
m.project_name
WHEN r.paper_id IS NOT NULL THEN
p.NAME
ELSE NULL
END AS projectName,
MAX(r.score) AS hightScore,
COUNT(*) AS practiceNum,
FORMAT(SUM(r.time_sum) / 60.0, 2) AS duration,
MAX(r.submit_time) AS lastTime
FROM occupationlab.ol_experimental_report r
LEFT JOIN exam.exam_paper p ON p.paper_id = r.paper_id
LEFT JOIN occupationlab.ol_project_manage m ON m.project_id = r.project_id
LEFT JOIN nakadai.curriculum c ON c.cid = r.curriculum_id
WHERE r.account_id = #{accountId}
AND r.assessment_id IS NULL
GROUP BY
r.project_id
ORDER BY
r.report_id DESC
and r.curriculum_id = #{curriculumId}
GROUP BY r.project_id,
r.paper_id
ORDER BY lastTime DESC
</select>
@ -854,19 +789,41 @@
</select>
<select id="practiceByStudentDetail"
resultType="com.huoran.occupationlab.entity.resp.AchievementResp">
SELECT r.report_id,
m.project_name,
SELECT
r.report_id,
CASE
WHEN r.project_id IS NOT NULL
AND r.paper_id IS NOT NULL THEN
CONCAT( m.project_name, ' - ', p.NAME )
WHEN r.project_id IS NOT NULL THEN
m.project_name
WHEN r.paper_id IS NOT NULL THEN
p.NAME ELSE NULL
END AS projectName,
r.score,
r.time_sum,
r.start_time,
r.submit_time
FROM occupationlab.ol_experimental_report r
INNER JOIN occupationlab.ol_project_manage m ON m.project_id = r.project_id
r.submit_time,
r.paper_id,
r.project_id,
r.account_id
FROM
occupationlab.ol_experimental_report r
LEFT JOIN occupationlab.ol_project_manage m ON m.project_id = r.project_id
AND r.project_id = m.project_id
LEFT JOIN exam.exam_paper p ON p.paper_id = r.paper_id
WHERE r.is_del = 0
and r.curriculum_id = #{curriculumId}
and r.project_id = #{projectId}
and r.account_id = #{accountId}
<if test="projectId!=null">
and r.project_id = #{projectId}
</if>
<if test="paperId!=null">
and r.paper_id = #{paperId}
</if>
and r.assessment_id is null
GROUP BY r.report_id
ORDER BY r.report_id DESC

@ -407,11 +407,15 @@
select type from nakadai.service_configuration where system_id = #{systemId}
</select>
<select id="selectProjectList" resultType="com.huoran.common.entity.ProjectManage">
select p.*,s.type from ol_project_manage p
select p.*,s.type,
s.system_name from ol_project_manage p
join nakadai.service_configuration s on p.system_id = s.system_id
where p.permissions = #{permissions} and
p.founder = 0 and p.zt_del = 0 and p.state = 1 and p.zt_open = 0 AND p.is_del = 0
and p.system_id IN (${systemIds})
<if test="keyword!=null and keyword!=''">
and p.project_name like CONCAT('%',#{keyword},'%')
</if>
</select>
<select id="selectProjectAssessmentByCompetition"
resultType="com.huoran.common.entity.ProjectManage">
@ -687,4 +691,94 @@
AND FIND_IN_SET( cc.system_id, #{systemId} )
</select>
<select id="getAllExamPaper" resultType="com.huoran.common.entity.ProjectManage">
SELECT
p.paper_id,
p.paper_type,
p.NAME AS paperName,
p.particular_year,
p.score,
p.template_identification,
p.create_time,
p.update_time ,
(SELECT c.system_name from nakadai.service_configuration c WHERE c.type = 3) as systemName,
(SELECT c.system_id from nakadai.service_configuration c WHERE c.type = 3) as systemId,
3 as type
FROM
exam.exam_paper p
WHERE
p.is_del = 0
AND p.STATUS = 1
AND p.is_disable = 0
AND p.school_id = 0
AND p.template_identification = 0
<if test="keyword !=null and keyword != ''">
AND p.NAME LIKE CONCAT('%',#{keyword},'%')
</if>
</select>
<select id="getTestPaperByCourse" resultType="com.huoran.common.entity.ProjectManage">
SELECT
cc.*,
p.NAME AS paperName
FROM
nakadai.curriculum c
INNER JOIN nakadai.curriculum_configure cc ON cc.cid = c.cid
LEFT JOIN exam.exam_paper p ON p.paper_id = cc.paper_id
WHERE
cc.is_del = 0
AND cc.cid = #{cid}
AND cc.permissions = #{permissions}
AND cc.project_id IS NULL
AND cc.is_show = 0
ORDER BY sort asc
</select>
<select id="getProjectOrExamPaperByAssessment" resultType="com.huoran.common.entity.ProjectManage">
SELECT
cc.project_id,
cc.paper_id,
CASE
WHEN cc.project_id IS NOT NULL
AND cc.paper_id IS NOT NULL THEN
CONCAT( m.project_name, ' - ', p.NAME )
WHEN cc.project_id IS NOT NULL THEN
m.project_name
WHEN cc.paper_id IS NOT NULL THEN
p.NAME ELSE NULL
END AS projectName,
IFNULL( create_user, '系统内置' ) AS createUser,
IFNULL( m.create_time, p.create_time ) AS createTime,
1 AS permissions
FROM
nakadai.curriculum_configure cc
INNER JOIN nakadai.curriculum c ON c.cid = cc.cid
LEFT JOIN ol_project_manage m ON m.project_id = cc.project_id
LEFT JOIN exam.exam_paper p ON p.paper_id = cc.paper_id
WHERE
cc.is_show = 0
AND cc.is_del = 0
AND c.cid = #{req.cid}
AND cc.permissions = #{req.permissions}
AND ( m.is_del = 0 OR p.is_del = 0 ) UNION
SELECT
m.project_id,
NULL AS paper_id,
m.project_name AS projectName,
u.user_name AS createUser,
m.create_time AS createTime,
m.permissions
FROM
ol_project_manage m
LEFT JOIN nakadai.hr_user_account a ON a.id = m.account_id
LEFT JOIN nakadai.hr_user_info u ON u.user_id = a.user_id
WHERE
m.founder = 1
AND m.zt_del = 0
AND m.is_del = 0
AND m.zt_open = 0
AND m.school_id = #{req.schoolId}
AND m.mall_id = #{req.mallId}
AND m.permissions = #{req.permissions}
</select>
</mapper>

@ -12,6 +12,7 @@ import com.huoran.occupationlab.entity.vo.ProductClassInformationVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.List;
@ -106,7 +107,7 @@ public interface ExperimentalReportService extends IService<ExperimentalReport>
* @auther: Rong
* @date: 2021/9/30 15:35
*/
R practiceByStudentDetail(Integer curriculumId, Integer projectId, Integer accountId, Integer pageNum, Integer pageSize);
R practiceByStudentDetail(Integer curriculumId, Integer projectId, Integer accountId, Integer pageNum, Integer pageSize, Integer paperId);
/**
* @Description: 学生端-练习-导出实验情况

@ -95,9 +95,10 @@ public interface ProjectManageService extends IService<ProjectManage> {
* 根据系统id获取系统内置项目
*
* @param systemId
* @param keyword
* @return
*/
List<ProjectManage> getInternalProjectBySystemId(List<Integer> systemId, Integer permissions);
List<ProjectManage> getInternalProjectBySystemId(List<Integer> systemId, Integer permissions, String keyword);
/**
* 获取学校下所有系统id
@ -150,4 +151,6 @@ public interface ProjectManageService extends IService<ProjectManage> {
Integer projectCreatedUnderProduct( Integer mallId, Integer permissions, Integer schoolId);
R getCompetitionProjectByMiddleGround(PageAssessmentForProjectReq projectManageReq);
R getProjectOrExamPaperByAssessment(PageAssessmentForProjectReq projectManage);
}

@ -59,6 +59,7 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
@ -175,7 +176,7 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
@Override
public R getAchievementInfo(PageAchievementByTeacherReq req) {
if (req.getCurriculumId().equals("")) {
String ids = nakadaiClient.getSchoolCourse(req.getSchoolId(),null);
String ids = nakadaiClient.getSchoolCourse(req.getSchoolId(), null);
req.setCurriculumIds(ids);
}
@ -199,7 +200,7 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
req.setPageNum((req.getPageNum() - 1) * req.getPageSize());
req.setPageSize(req.getPageSize());
if (req.getCurriculumId().equals("")) {
String getCourse = nakadaiClient.getSchoolCourse(req.getSchoolId(),null);
String getCourse = nakadaiClient.getSchoolCourse(req.getSchoolId(), null);
req.setCurriculumId(getCourse);
}
return R.ok().put("page", baseMapper.getPracticeForTeacher(req)).put("total",
@ -567,13 +568,20 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
@Override
public void exportPracticeByStudent(Integer curriculumId, Integer accountId, HttpServletResponse response) throws Exception {
List<ExportByStudentResp> retList = baseMapper.exportPracticeByStudent(curriculumId, accountId);
// 告诉浏览器用什么软件可以打开此文件
response.setHeader("content-Type", "application/vnd.ms-excel");
// 下载文件的默认名称
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("学生练习实验成绩", "UTF-8") +
".xls");
//编码
response.setCharacterEncoding("UTF-8");
if (retList.size() == 0) {
//抛出
return;
}
String curriculumName = retList.get(0).getCurriculumName() + "_练习实验成绩";
String userName = TokenUtils.getUserName();
String fileName = userName + "_" + curriculumName + ".xls";
String encodedFileName =
URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString()).replace("+", "%20").replace("%2B", "");
response.setHeader("Content-Disposition", encodedFileName);
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ExportByStudentResp.class, retList);
ExportParams exportParams = new ExportParams(null, "delivery", ExcelType.XSSF);
exportParams.setStyle(ExcelStyleUtil.class);
@ -582,9 +590,10 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
@Override
public R practiceByStudentDetail(Integer curriculumId, Integer projectId, Integer accountId, Integer pageNum,
Integer pageSize) {
Integer pageSize, Integer paperId) {
Page<AchievementResp> page = new Page<AchievementResp>(pageNum, pageSize);
return R.ok().put("data", baseMapper.practiceByStudentDetail(page, curriculumId, projectId, accountId));
return R.ok().put("data", baseMapper.practiceByStudentDetail(page, curriculumId, projectId, accountId,
paperId));
}
@Override
@ -723,11 +732,11 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
}
}
int paperId = 0;
if (report.getPaperId()!= null){
if (report.getPaperId() != null) {
paperId = report.getPaperId();
}
//保存备份数据
if (report.getData()==null){
if (report.getData() == null) {
String json = JSONObject.toJSONString(userScores);
report.setData(json);
experimentalReportMapper.updateById(report);
@ -1312,9 +1321,10 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
List<Integer> reportIds = new ArrayList<>();
if (req.getStageId()!= null){
if (req.getStageId() != null) {
//赛事单独处理,实验报告表没有stage_id字段,只有ol_user_score才存有
List<Integer> userScoreReportIds = userScoreMapper.userScoreReportIds(req.getStageId(),req.getCompetitionId());
List<Integer> userScoreReportIds = userScoreMapper.userScoreReportIds(req.getStageId(),
req.getCompetitionId());
reportIds.addAll(userScoreReportIds);
return reportIds;
}
@ -1598,10 +1608,10 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
if (status != null && status == 200) {
Map<String, Object> map = result;
reportData = (com.huoran.common.entity.ExperimentalReport) map.get("report");
if (map.get("userScores")== null){
if (map.get("userScores") == null) {
String json = reportData.getData();
userScores = JSONArray.parseArray(json, UserScore.class);
}else {
} else {
userScores = (List<UserScore>) map.get("userScores");
}
@ -1775,7 +1785,8 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
// 同时从Redis中获取reportData
String serializedReportData = (String) redisTemplate.opsForValue().get(reportDataKey);
reportData = JSON.parseObject(serializedReportData, com.huoran.common.entity.ExperimentalReport.class);
reportData = JSON.parseObject(serializedReportData,
com.huoran.common.entity.ExperimentalReport.class);
if (reportData != null) {
// 调用创建报告文件的方法
@ -1792,15 +1803,14 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
if (status != null && status == 200) {
Map<String, Object> map = result;
reportData = (com.huoran.common.entity.ExperimentalReport) map.get("report");
if (map.get("userScores")== null){
if (map.get("userScores") == null) {
String json = reportData.getData();
userScores = JSONArray.parseArray(json, UserScore.class);
}else {
} else {
userScores = (List<UserScore>) map.get("userScores");
}
if (reportData != null && userScores != null) {
int userScoresSize = userScores.size();
if (userScoresSize >= 30) {
@ -1810,7 +1820,7 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
redisTemplate.opsForValue().set(reportDataKey, JSON.toJSONString(reportData));
// 调用创建报告文件的方法
return createReportFileFromDb(reportData, userScores, systemId, tempDir);
}else {
} else {
return createReportFileFromDb(reportData, userScores, systemId, tempDir);
}
}
@ -1822,7 +1832,6 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
}
// 新增方法用于使用缓存数据创建报告文件
private Path createReportFileFromCache(List<UserScore> userScores, Integer systemId, Path tempDir) throws IOException, TemplateException {
// 获取报告详情
@ -2020,7 +2029,7 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
dataMap.put("report", report);
Integer cycleNumber = 0;
//打印userScores
for (UserScore us: userScores) {
for (UserScore us : userScores) {
cycleNumber++;
/*System.err.println("第"+cycleNumber+"条数据:"+us);*/
/*us.setAssessmentPoint("AAA");*/
@ -2041,11 +2050,11 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
// us.setReferenceAnswer("参考答案");
if (!StringUtils.isEmpty(us.getReferenceAnswer())){
if (!StringUtils.isEmpty(us.getReferenceAnswer())) {
us.setReferenceAnswer(DelTagsUtil.sanitizeReferenceAnswer(us.getReferenceAnswer()));
}
if (!StringUtils.isEmpty(us.getAnswer())){
if (!StringUtils.isEmpty(us.getAnswer())) {
us.setAnswer(DelTagsUtil.sanitizeReferenceAnswer(us.getAnswer()));
}
@ -2101,9 +2110,10 @@ public class ExperimentalReportServiceImpl extends ServiceImpl<ExperimentalRepor
/**
* 流程类实验报告导出ZIP处理
* <p>
* // * @param reportId
* // * @param tempDir
*
// * @param reportId
// * @param tempDir
* @return
* @throws IOException
* @throws TemplateException

@ -10,16 +10,12 @@ import com.huoran.api.NakadaiClient;
import com.huoran.api.UserClient;
import com.huoran.common.constant.DelConstant;
import com.huoran.common.constant.PlatformConstant;
import com.huoran.common.entity.BcJudgmentPoint;
import com.huoran.common.entity.LcJudgmentPoint;
import com.huoran.common.entity.ProjectJudgmentVo;
import com.huoran.common.entity.ProjectManage;
import com.huoran.common.entity.*;
import com.huoran.common.entity.to.JudgmentPointDataTo;
import com.huoran.common.entity.to.ProjectDataTo;
import com.huoran.common.exception.CustomException;
import com.huoran.common.exception.ExceptionEnum;
import com.huoran.common.response.R;
import com.huoran.common.entity.ProjectJudgment;
import com.huoran.occupationlab.entity.ProjectManageDisable;
import com.huoran.occupationlab.entity.SchoolProjectHintOpen;
import com.huoran.occupationlab.entity.req.PageAssessmentForProjectReq;
@ -118,7 +114,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
return R.ok();
}
private Integer bindProjectJudgment(Integer systemId, Integer projectId, List<ProjectJudgment> projectJudgmentList) {
private Integer bindProjectJudgment(Integer systemId, Integer projectId,
List<ProjectJudgment> projectJudgmentList) {
int result = 1;
// 根据系统查询判分点类型
Integer type = baseMapper.selectSystemType(systemId);
@ -212,12 +209,12 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
List<ProjectJudgmentVo> projectJudgmentVos = new ArrayList<>();
Map<Integer, BcJudgmentPoint> bcJudgmentPointMap = new HashMap<>();
Map<Integer, LcJudgmentPoint> lcJudgmentPointMap = new HashMap<>();
if (type == 1){
if (type == 1) {
List<LcJudgmentPoint> lcJudgmentPoints;
if (stuAssessent != null){
if (stuAssessent != null) {
lcJudgmentPoints = judgmentPointClient.queryLcJudgmentByLcIds(judgmentIds, null);
}else {
} else {
lcJudgmentPoints = judgmentPointClient.queryLcJudgmentByLcIds(judgmentIds, DelConstant.IS_OPEN);
}
@ -228,11 +225,11 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
(existing, replacement) -> existing // 解决并发冲突
));
}else {
} else {
List<BcJudgmentPoint> bcJudgmentPoints;
if (stuAssessent != null){
if (stuAssessent != null) {
bcJudgmentPoints = judgmentPointClient.queryBcJudgmentByBcIds(judgmentIds, null);
}else {
} else {
bcJudgmentPoints = judgmentPointClient.queryBcJudgmentByBcIds(judgmentIds, DelConstant.IS_OPEN);
}
@ -311,8 +308,6 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
}
// for (ProjectJudgment projectJudgment : projectJudgmentList) {
// BcJudgmentPoint judgmentPoint = null;
// //根据系统id获取判分点名称、要求
@ -335,7 +330,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
// projectJudgmentVo.setName(judgmentPoint.getName());
// projectJudgmentVo.setExperimentalRequirements(judgmentPoint.getExperimentalRequirements());
// projectJudgmentVo.setExperimentCodeType(judgmentPoint.getExperimentCodeType());
// projectJudgmentVo.setExperimentalRequirementsType(judgmentPoint.getExperimentalRequirementsType());
// projectJudgmentVo.setExperimentalRequirementsType(judgmentPoint
// .getExperimentalRequirementsType());
// projectJudgmentVos.add(projectJudgmentVo);
// } else {
// if (judgmentPoint.getIsOpen() == 0) {
@ -345,9 +341,11 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
// projectJudgmentVo.setProjectId(projectJudgment.getProjectId().toString());
// projectJudgmentVo.setJudgmentId(projectJudgment.getJudgmentId());
// projectJudgmentVo.setName(judgmentPoint.getName());
// projectJudgmentVo.setExperimentalRequirements(judgmentPoint.getExperimentalRequirements());
// projectJudgmentVo.setExperimentalRequirements(judgmentPoint.getExperimentalRequirements
// ());
// projectJudgmentVo.setExperimentCodeType(judgmentPoint.getExperimentCodeType());
// projectJudgmentVo.setExperimentalRequirementsType(judgmentPoint.getExperimentalRequirementsType());
// projectJudgmentVo.setExperimentalRequirementsType(judgmentPoint
// .getExperimentalRequirementsType());
// projectJudgmentVos.add(projectJudgmentVo);
//
// }
@ -382,7 +380,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
// projectJudgmentVo.setProjectId(projectJudgment.getProjectId().toString());
// projectJudgmentVo.setJudgmentId(projectJudgment.getJudgmentId());
// projectJudgmentVo.setName(lcJudgmentPoint.getName());
// projectJudgmentVo.setExperimentalRequirements(lcJudgmentPoint.getExperimentalRequirements());
// projectJudgmentVo.setExperimentalRequirements(lcJudgmentPoint
// .getExperimentalRequirements());
// projectJudgmentVos.add(projectJudgmentVo);
// }
// }
@ -404,7 +403,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
return 0;
}
QueryWrapper<ProjectManage> wrapper = new QueryWrapper<ProjectManage>().eq("project_name", projectManage.getProjectName());
QueryWrapper<ProjectManage> wrapper = new QueryWrapper<ProjectManage>().eq("project_name",
projectManage.getProjectName());
wrapper.eq("is_del", DelConstant.NOT_DEL);
wrapper.eq("zt_del", DelConstant.NOT_DEL);
/*switch (projectManage.getFounder()) {
@ -420,13 +420,14 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
return 1;
}
@Override
public R avgValues(Integer number) {
final int totalPoints = 100;
if (number > 100){
if (number > 100) {
// 使用方式
List<BigDecimal> scores = allocateScores(totalPoints, number);
return R.ok().put("data", scores).put("sum",scores.stream().mapToDouble(BigDecimal::doubleValue).sum());
return R.ok().put("data", scores).put("sum", scores.stream().mapToDouble(BigDecimal::doubleValue).sum());
}
List<Integer> list = new ArrayList<>();
Integer score = totalPoints / number;
@ -442,13 +443,14 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
list.set(i, score + 1);
}
}
return R.ok().put("data", list).put("sum",list.stream().mapToDouble(Integer::intValue).sum());
return R.ok().put("data", list).put("sum", list.stream().mapToDouble(Integer::intValue).sum());
}
// public static List<BigDecimal> allocateScores(int totalPoints, int numberOfShares) {
// public static List<BigDecimal> allocateScores(int totalPoints, int numberOfShares) {
// if (totalPoints <= 0 || numberOfShares <= 0 || numberOfShares > 1000) {
// throw new IllegalArgumentException("Invalid input. Total points must be positive, number of shares must be between 1 and 1000.");
// throw new IllegalArgumentException("Invalid input. Total points must be positive, number of shares must
// be between 1 and 1000.");
// }
//
// BigDecimal totalScore = BigDecimal.valueOf(totalPoints);
@ -468,9 +470,11 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
// // 调整最后一个份额以确保总和等于100
// BigDecimal sum = scoresList.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
// if (sum.compareTo(totalScore) < 0) {
// scoresList.set(scoresList.size() - 1, scoresList.get(scoresList.size() - 1).add(totalScore.subtract(sum)));
// scoresList.set(scoresList.size() - 1, scoresList.get(scoresList.size() - 1).add(totalScore.subtract
// (sum)));
// } else if (sum.compareTo(totalScore) > 0) {
// scoresList.set(scoresList.size() - 1, scoresList.get(scoresList.size() - 1).subtract(sum.subtract(totalScore)));
// scoresList.set(scoresList.size() - 1, scoresList.get(scoresList.size() - 1).subtract(sum.subtract
// (totalScore)));
// }
//
// // 四舍五入并保留一位小数
@ -482,7 +486,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
// }
public static List<BigDecimal> allocateScores(int totalPoints, int numberOfShares) {
if (totalPoints <= 0 || numberOfShares <= 0 || numberOfShares > 1000) {
throw new IllegalArgumentException("Invalid input. Total points must be positive, number of shares must be between 1 and 1000.");
throw new IllegalArgumentException("Invalid input. Total points must be positive, number of shares must " +
"be between 1 and 1000.");
}
BigDecimal totalScore = BigDecimal.valueOf(totalPoints);
@ -541,16 +546,24 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
// projectManageList.add(manage);
// }
//查询课程系统下绑定的项目
List<ProjectManage> projectManageList = projectManageMapper.selectSystemProject(schoolId, systemId, permissions, cId);
List<ProjectManage> projectManageList = projectManageMapper.selectSystemProject(schoolId, systemId,
permissions, cId);
projectManageList.addAll(projectManages);
return R.ok().put("projects", projectManageList).put("projectSize", projectManageList.size());
//查询当前课程绑定的练习试卷
List<ProjectManage> practiceExamPaperList = projectManageMapper.getTestPaperByCourse(
permissions, cId);
return R.ok().put("projects", projectManageList).put("projectSize", projectManageList.size()).put(
"exercisePaperList", practiceExamPaperList);
}
@Override
public List<ProjectManage> getProjectBySystemIdRemoteCall(String systemId,Integer schoolId, Integer permissions, Integer cId, Integer mallId) {
public List<ProjectManage> getProjectBySystemIdRemoteCall(String systemId, Integer schoolId, Integer permissions,
Integer cId, Integer mallId) {
List<ProjectManage> projectManages = projectManageMapper
.selectList(new QueryWrapper<ProjectManage>()
@ -613,13 +626,37 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
}
@Override
public List<ProjectManage> getInternalProjectBySystemId(List<Integer> systemId, Integer permissions) {
public List<ProjectManage> getInternalProjectBySystemId(List<Integer> systemId, Integer permissions,
String keyword) {
String id = "";
List<Integer> systemTypes = new ArrayList<>();
for (Integer sysId : systemId) {
id += sysId + ",";
int type = baseMapper.selectSystemType(sysId);
systemTypes.add(type);
}
String systemIds = id.substring(0, id.length() - 1);
return baseMapper.selectProjectList(systemIds, permissions);
List<ProjectManage> projectManageList = baseMapper.selectProjectList(systemIds, permissions, keyword);
//如果systemTypes包含了3,那么查询查询对应的理论试卷
if (systemTypes.contains(3)) {
projectManageList.addAll(getAllExamPaper(keyword));
}
return projectManageList;
}
/**
* 获取中台发布的全部全部试卷
*
* @return
*/
public List<ProjectManage> getAllExamPaper(String keyword) {
return baseMapper.getAllExamPaper(0, keyword);
}
@Override
@ -697,7 +734,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
* 教师筛选条件:默认展示全部学校发布的项目信息
* 全部筛选条件默认展示内置项目信息 以及展示全部学校发布的项目
*/
Page<ProjectManage> page = new Page<ProjectManage>(projectManageReq.getPageNum(), projectManageReq.getPageSize());
Page<ProjectManage> page = new Page<ProjectManage>(projectManageReq.getPageNum(),
projectManageReq.getPageSize());
IPage<ProjectManage> iPage = null;
/*
@ -719,7 +757,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
switch (projectManageReq.getFounder()) {
case 0://0:系统
// queryWrapper.eq("zt_del", DelConstant.NOT_DEL).eq("founder", projectManageReq.getFounder()).orderByDesc("update_time");
// queryWrapper.eq("zt_del", DelConstant.NOT_DEL).eq("founder", projectManageReq.getFounder())
// .orderByDesc("update_time");
//中台——>系统筛选
// iPage = baseMapper.selectPage(page, queryWrapper);
@ -749,7 +788,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
* 教师筛选条件:默认展示本校发布的项目信息(同时依据本校角色展示超管管理员可查看该校全部其它角色只可看本人发布的)
* 全部筛选条件默认展示由该校购买的订单下包含的课程下的项目以及默认展示本校发布的项目信息(同时依据本校角色展示超管管理员可查看该校全部其它角色只可看本人发布的)
*/
Page<ProjectManage> page = new Page<ProjectManage>(projectManageReq.getPageNum(), projectManageReq.getPageSize());
Page<ProjectManage> page = new Page<ProjectManage>(projectManageReq.getPageNum(),
projectManageReq.getPageSize());
IPage<ProjectManage> iPage = null;
QueryWrapper<ProjectManageDisable> queryWrapper = new QueryWrapper<>();
@ -763,7 +803,7 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
case 0:
if (projectManageReq.getPlatformId() == PlatformConstant.POST_STATION) {
//当平台为职站时候查询根据课程绑定的项目(只查询购买订单下课程所绑定启用且未删除的项目)
String cid = nakadaiClient.getSchoolCourse(projectManageReq.getSchoolId(),null);
String cid = nakadaiClient.getSchoolCourse(projectManageReq.getSchoolId(), null);
// projectManageReq.setCid(cid);
projectManageReq.setCid(projectManageReq.getCid());
iPage = baseMapper.queryProjectManage(page, projectManageReq);
@ -771,7 +811,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
QueryWrapper<SchoolProjectHintOpen> openQueryWrapper = new QueryWrapper<>();
openQueryWrapper.eq("school_id", projectManageReq.getSchoolId());
openQueryWrapper.eq("project_id", record.getProjectId());
SchoolProjectHintOpen schoolProjectHintOpen = schoolProjectHintOpenMapper.selectOne(openQueryWrapper);
SchoolProjectHintOpen schoolProjectHintOpen =
schoolProjectHintOpenMapper.selectOne(openQueryWrapper);
if (ObjectUtil.isNotNull(schoolProjectHintOpen)) {
record.setHintOpenBySchool(schoolProjectHintOpen.getHintOpen());
} else {
@ -790,7 +831,9 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
if (roleName.contains("超级管理员") || roleName.contains("管理员")) {
projectManageReq.setIsAdmin(1);
} else {
List<Integer> accountIdList = userClient.getAccountIdsBySchoolId(projectManageReq.getSchoolId(), PlatformConstant.POST_STATION);
List<Integer> accountIdList =
userClient.getAccountIdsBySchoolId(projectManageReq.getSchoolId(),
PlatformConstant.POST_STATION);
//为满足非超管、管理员的角色情况下能看到本人及超管、管理员角色发布的项目 由此将当前用户的账号id赋值进去List
accountIdList.add(projectManageReq.getAccountId());
projectManageReq.setAccountIdList(accountIdList);
@ -801,7 +844,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
QueryWrapper<SchoolProjectHintOpen> openQueryWrapper = new QueryWrapper<>();
openQueryWrapper.eq("school_id", projectManageReq.getSchoolId());
openQueryWrapper.eq("project_id", record.getProjectId());
SchoolProjectHintOpen schoolProjectHintOpen = schoolProjectHintOpenMapper.selectOne(openQueryWrapper);
SchoolProjectHintOpen schoolProjectHintOpen =
schoolProjectHintOpenMapper.selectOne(openQueryWrapper);
if (ObjectUtil.isNotNull(schoolProjectHintOpen)) {
record.setHintOpenBySchool(schoolProjectHintOpen.getHintOpen());
} else {
@ -813,7 +857,7 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
}
case 2: {//全部
//查询购买的课程下的项目以及根据角色查询本校内的项目
String cid = nakadaiClient.getSchoolCourse(projectManageReq.getSchoolId(),null);
String cid = nakadaiClient.getSchoolCourse(projectManageReq.getSchoolId(), null);
// projectManageReq.setCid(cid);
projectManageReq.setCid(projectManageReq.getCid());
//依据角色查询本校内的项目(超管管理员角色能看到本校内发布的全部项目、其它角色只能看到自己发布的以及超管管理员发布的项目)
@ -823,7 +867,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
if (roleName.contains("超级管理员") || roleName.contains("管理员")) {
projectManageReq.setIsAdmin(1);
} else {
List<Integer> accountIdList = userClient.getAccountIdsBySchoolId(projectManageReq.getSchoolId(), PlatformConstant.POST_STATION);
List<Integer> accountIdList = userClient.getAccountIdsBySchoolId(projectManageReq.getSchoolId(),
PlatformConstant.POST_STATION);
//为满足非超管、管理员的角色情况下能看到本人及超管、管理员角色发布的项目 由此将当前用户的账号id赋值进去List
accountIdList.add(projectManageReq.getAccountId());
projectManageReq.setAccountIdList(accountIdList);
@ -834,7 +879,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
QueryWrapper<SchoolProjectHintOpen> openQueryWrapper = new QueryWrapper<>();
openQueryWrapper.eq("school_id", projectManageReq.getSchoolId());
openQueryWrapper.eq("project_id", record.getProjectId());
SchoolProjectHintOpen schoolProjectHintOpen = schoolProjectHintOpenMapper.selectOne(openQueryWrapper);
SchoolProjectHintOpen schoolProjectHintOpen =
schoolProjectHintOpenMapper.selectOne(openQueryWrapper);
if (ObjectUtil.isNotNull(schoolProjectHintOpen)) {
record.setHintOpenBySchool(schoolProjectHintOpen.getHintOpen());
} else {
@ -865,7 +911,8 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
if (roleName.contains("超级管理员") || roleName.contains("管理员")) {
projectManageReq.setIsAdmin(1);
} else {
List<Integer> accountIdList = userClient.getAccountIdsBySchoolId(projectManageReq.getSchoolId(), PlatformConstant.POST_STATION);
List<Integer> accountIdList = userClient.getAccountIdsBySchoolId(projectManageReq.getSchoolId(),
PlatformConstant.POST_STATION);
//为满足非超管、管理员的角色情况下能看到本人及超管、管理员角色发布的项目 由此将当前用户的账号id赋值进去List
accountIdList.add(projectManageReq.getAccountId());
projectManageReq.setAccountIdList(accountIdList);
@ -889,6 +936,13 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
return R.ok().put("data", iPage);
}
@Override
public R getProjectOrExamPaperByAssessment(PageAssessmentForProjectReq req) {
Page<ProjectManage> page = new Page<ProjectManage>(req.getPageNum(), req.getPageSize());
IPage<ProjectManage> iPage = baseMapper.getProjectOrExamPaperByAssessment(page, req);
return R.ok().put("data", iPage);
}
@Override
public R getProjectAssessmentByCompetition(PageAssessmentForProjectReq req) {
Page<ProjectManage> page = new Page<ProjectManage>(req.getPageNum(), req.getPageSize());
@ -923,7 +977,7 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
}
@Override
public Integer getCurriculumCountByType(Integer cid,Integer permissions) {
public Integer getCurriculumCountByType(Integer cid, Integer permissions) {
return baseMapper.getCurriculumCountByType(cid, permissions);
}
@ -937,13 +991,15 @@ public class ProjectManageServiceImpl extends ServiceImpl<ProjectManageMapper, P
if (projectManageMapper.selectSystemType(projectDataTo.getSystemId()) == 0) {
//查询编程判分点
ArrayList<Integer> judgmentIds = projectJudgmentMapper.selectBcJudgmentIdList(projectDataTo.getSet(), projectDataTo.getName());
ArrayList<Integer> judgmentIds = projectJudgmentMapper.selectBcJudgmentIdList(projectDataTo.getSet(),
projectDataTo.getName());
JudgmentPointDataTo judgmentPointDataTo = new JudgmentPointDataTo();
judgmentPointDataTo.setJudgmentIds(judgmentIds);
return judgmentPointDataTo;
} else {
//查询流程判分点
ArrayList<Integer> judgmentIds = projectJudgmentMapper.selectLcJudgmentIdList(projectDataTo.getSet(), projectDataTo.getName());
ArrayList<Integer> judgmentIds = projectJudgmentMapper.selectLcJudgmentIdList(projectDataTo.getSet(),
projectDataTo.getName());
JudgmentPointDataTo judgmentPointDataTo = new JudgmentPointDataTo();
judgmentPointDataTo.setJudgmentIds(judgmentIds);
return judgmentPointDataTo;

Loading…
Cancel
Save