修复实验次数不准确

hehai
rong.liu 4 years ago
parent f2fac01915
commit c398ef0472
  1. 5
      src/main/java/com/msdw/tms/controller/ProjectRecordController.java
  2. 7
      src/main/java/com/msdw/tms/dao/ProjectRecordDao.java
  3. 7
      src/main/java/com/msdw/tms/service/ProjectRecordService.java
  4. 12
      src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java
  5. 50
      src/main/resources/mapper/tms/ProjectRecordDao.xml

@ -8,6 +8,7 @@ import com.msdw.tms.entity.ProjectEntity;
import com.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.service.ProjectRecordService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@ -57,7 +58,7 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
}
/**
* 用户端虚拟仿真实验记录
* 用户端虚拟仿真实验记录(练习列表)
*
* @param page
* @param size
@ -87,7 +88,7 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
}
/**
* 用户端教学实验记录
* 用户端教学实验记录考核列表
*
* @param page
* @param size

@ -46,4 +46,11 @@ public interface ProjectRecordDao extends BaseMapper<ProjectRecordEntity> {
ProjectRecordEntity queryReport(Integer recordId);
void updateScore(ProjectRecordEntity vo);
//练习统计
List<GetByUserRecordResp> sumByPracticeNum(Integer userId);
//考核统计
List<ProjectRecordVo> sumByAssessmentNum(Integer userId);
}

@ -16,11 +16,11 @@ import java.util.List;
* @date 2020-08-19 16:07:02
*/
public interface ProjectRecordService extends IService<ProjectRecordEntity> {
PageUtils getByKDUserRecord(Integer page,Integer size,Integer userId,Integer projectPermissions,Integer systemId);
PageUtils getByKDUserRecord(Integer page, Integer size, Integer userId, Integer projectPermissions, Integer systemId);
PageUtils queryPage(Integer page, Integer size, Integer userId, Integer projectPermissions,Integer systemId);
PageUtils queryPage(Integer page, Integer size, Integer userId, Integer projectPermissions, Integer systemId);
PageUtils queryExperimentPage(Integer page, Integer size, Integer userid,Integer systemId);
PageUtils queryExperimentPage(Integer page, Integer size, Integer userid, Integer systemId);
//学生端实验概览
ProjectRecordVo queryUserScore(Integer userId);
@ -36,5 +36,6 @@ public interface ProjectRecordService extends IService<ProjectRecordEntity> {
boolean updateUserRecord(ProjectRecordEntity projectRecord);
void updateScore(ProjectRecordEntity vo);
}

@ -88,6 +88,16 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
Integer isdel = Constant.IsDel.NOT_DEL.getType();
ProjectRecordVo projectRecordVo = this.baseMapper.getByUserScore(userId, isdel);
//练习统计
List<GetByUserRecordResp> sumByPracticeNum = this.baseMapper.sumByPracticeNum(userId);
//考核统计
List<ProjectRecordVo> sumByAssessmentNum = this.baseMapper.sumByAssessmentNum(userId);
Integer numer = sumByPracticeNum.size() + sumByAssessmentNum.size();
projectRecordVo.setExperimentNumber(numer);
Double totalTime = projectRecordVo.getTotalTime();
if (totalTime != null) {
DecimalFormat df = new DecimalFormat("0.00");
@ -183,4 +193,6 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
public void updateScore(ProjectRecordEntity vo) {
this.baseMapper.updateScore(vo);
}
}

@ -212,4 +212,54 @@
SET score = #{score}
WHERE recordId = #{recordid}
</update>
<!--练习记录-->
<select id="sumByPracticeNum" resultType="com.msdw.tms.entity.resp.GetByUserRecordResp"
parameterType="java.lang.Integer">
SELECT re.reportId,
projectName,
c.recordId,
r.score,
c.codeId,
r.startingTime,
r.submitTime,
r.timeSum,
c.userId,
t.systemId
FROM hr_experiment_code c
INNER JOIN hr_project_management t ON t.projectId = c.projectId
INNER JOIN tms_project_record r ON r.recordId = c.recordId
INNER JOIN tms_experimental_report re ON re.eventId = r.recordId
WHERE c.userId = #{userId}
AND projectPermissions = 0
GROUP BY c.recordId DESC;
</select>
<!-- 考核记录 -->
<select id="sumByAssessmentNum" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
SELECT tet.id,
ter.reportId,
tpr.recordId,
tpr.projectId,
tp.projectName,
score,
timeSum,
startingTime AS startTime,
endTime,
recordState,
tet.experimental_class_name AS experimentalClassName,
systemId
FROM tms_project_record tpr
LEFT JOIN hr_project_management tp ON tpr.projectId = tp.projectId
LEFT JOIN tms_experimental_teaching tet ON tet.project_id = tpr.projectId
LEFT JOIN tms_experimental_report ter ON ter.projectId = tet.id
WHERE tpr.userId = #{userId}
AND tpr.isdel >= 0
AND tp.projectPermissions != 0
AND ter.eventId = tpr.recordId
ORDER BY
tpr.recordId DESC;
</select>
</mapper>
Loading…
Cancel
Save