2020.09.30个人中心

hehai
mzh820631607 4 years ago
parent e97c3a89f7
commit ef62d3d999
  1. 8
      src/main/java/com/msdw/tms/controller/UserController.java
  2. 3
      src/main/java/com/msdw/tms/dao/ProjectRecordDao.java
  3. 2
      src/main/java/com/msdw/tms/dao/UserInfoDao.java
  4. 16
      src/main/java/com/msdw/tms/entity/request/ProjectRecordImportRequest.java
  5. 91
      src/main/java/com/msdw/tms/entity/vo/ProjectRecordExportVo.java
  6. 2
      src/main/java/com/msdw/tms/service/UserInfoService.java
  7. 15
      src/main/java/com/msdw/tms/service/impl/EvaluationRecordServiceImpl.java
  8. 6
      src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java
  9. 6
      src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java
  10. BIN
      src/main/resources/excel-template/实验报告导出模板.xlsx
  11. 33
      src/main/resources/mapper/tms/ClassTeachingDao.xml
  12. 8
      src/main/resources/mapper/tms/ProjectRecordDao.xml
  13. 7
      src/main/resources/mapper/tms/UserInfoDao.xml

@ -79,7 +79,12 @@ public class UserController implements UserControllerApi {
public R update(@RequestBody UserProsonalEntityVo vo){
List<UserPersonalFileEntity> entityList = vo.getPersonalFileEntities();
UserInfoEntity userInfo = vo.getUserInfoEntity();
Integer userId = userInfo.getUserId();
String password = userInfo.getPassword();
String userPassword = userInfoService.queryPasword(userId);
if (userPassword.equals(password)==true){
return R.error(400,"false,the password is the same!!!");
}else{
userInfoService.updateUserInfoById(userInfo);
// userInfoService.updateById(userInfo);
for (int i = 0;i<entityList.size();i++){
@ -95,6 +100,7 @@ public class UserController implements UserControllerApi {
}
}
return R.ok();
}
}
// /**
// * 修改

@ -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.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.vo.ProjectRecordExportVo;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -24,7 +25,7 @@ public interface ProjectRecordDao extends BaseMapper<ProjectRecordEntity> {
IPage<ProjectRecordVo> getByUserExperimentRecord(Page page,@Param("pro") ProjectRecordEntity projectRecordEntity);
List<ProjectRecordVo> getByUserRecordImport(ProjectRecordEntity projectRecordEntity);
List<ProjectRecordExportVo> getByUserRecordImport(ProjectRecordEntity projectRecordEntity);
ProjectRecordVo getByUserScore(@Param("userid") Integer userId,@Param("isdel") Integer isdel);

@ -13,4 +13,6 @@ public interface UserInfoDao extends BaseMapper<UserInfoEntity> {
Boolean add(UserInfoEntity userEntity);
void userInfupdateUserInfoById(UserInfoEntity entity);
String queryUserPassword(Integer userid);
}

@ -14,10 +14,16 @@ public class ProjectRecordImportRequest {
/**
* 状态
*/
// @ExcelAttribute(sort = 1)
// private String userRecordstate;
//
// private Integer recordstate;
/**
* 实验班级名称
*/
@ExcelAttribute(sort = 1)
private String userRecordstate;
private String experimental_class_name;
private Integer recordstate;
/**
* 得分
*/
@ -38,4 +44,10 @@ public class ProjectRecordImportRequest {
*/
@ExcelAttribute(sort = 5)
private String endTime;
/**
* 结束时间
*/
@ExcelAttribute(sort = 6)
private String abc;
}

@ -0,0 +1,91 @@
package com.msdw.tms.entity.vo;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.ProjectRecordEntity;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
@Data
@Accessors(chain = true)
public class ProjectRecordExportVo extends ProjectRecordEntity implements Serializable {
/**
* 实验项目名称
*/
private String projectName;
/**
* 学校名称
*/
private String SchoolName;
/**
* 用户名称
*/
private String userName;
/**
* 实验次数
*/
private Integer experimentNumber;
/**
* 总耗时
*/
private Integer totalTime;
/**
* 平均分
*/
private double avgScore;
/**
* 几个月
*/
private Integer month;
/**
* 查询条件
*/
private String condition;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
/**
* 完成数量
*/
private Integer complete;
/**
* 待评分
*/
private Integer tobescored;
/** 记录状态(0 未修改,1 已修改)*/
private Integer recordState;
// =====================================记录实验项目信息
/**
* 实验状态(1待开始 2进行中 3已结束)
*/
private Integer status;
/**
* 是否启用邀请码
*/
private Integer isCode;
/**
* 绑定用户id
*/
private Integer userId;
/**
* 实验班级名
*/
private String experimentalClassName;
/**
* 封装多个项目id
*/
private List<Integer> projectIds;
/**
* 实验班级名称
*/
private String experimental_class_name;
}

@ -14,4 +14,6 @@ public interface UserInfoService extends IService<UserInfoEntity> {
R add(UserInfoEntity userInfoEntity);
void updateUserInfoById(UserInfoEntity entity);
String queryPasword(Integer userId);
}

@ -187,8 +187,10 @@ public class EvaluationRecordServiceImpl extends ServiceImpl<EvaluationRecordDao
redisTemplate.delete(key);
}, executor);
CompletableFuture<Void> submitCurrentQuestionFuture = CompletableFuture.runAsync(()
-> submitCurrentQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer), executor);
// CompletableFuture<Void> submitCurrentQuestionFuture = CompletableFuture.runAsync(()
// -> submitCurrentQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer), executor);
// 2020.09.30 清除上面异步操作,需先提交并统计最后一题的结果
submitCurrentQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer);
//修改提交时间和测评记录状态
CompletableFuture<Void> updateEvaluationFuture = CompletableFuture.runAsync(() -> {
@ -207,7 +209,9 @@ public class EvaluationRecordServiceImpl extends ServiceImpl<EvaluationRecordDao
//得分
submitVO.setTotalScore(sumScore);
//是否通过
submitVO.setIsPassed(sumScore > Constant.PASSING_SCORE ? Constant.EVALUATIONN_PASSED : Constant.EVALUATIONN_NOT_PASSED);
// submitVO.setIsPassed(sumScore > Constant.PASSING_SCORE ? Constant.EVALUATIONN_PASSED : Constant.EVALUATIONN_NOT_PASSED);
//成绩大于等于60分通过
submitVO.setIsPassed(sumScore >= Constant.PASSING_SCORE ? Constant.EVALUATIONN_PASSED : Constant.EVALUATIONN_NOT_PASSED);
}, executor);
CompletableFuture<EvaluationRecordEntity> getByIdFuture = CompletableFuture.supplyAsync(() -> {
@ -232,8 +236,9 @@ public class EvaluationRecordServiceImpl extends ServiceImpl<EvaluationRecordDao
submitVO.setCorrectRate(numberFormat.format((float) count / (float) res.getTotalQuestionNum() * 100) + "%");
}, executor);
CompletableFuture.allOf(deleteKeyFuture, submitCurrentQuestionFuture, updateEvaluationFuture,
//去除不需要的数据
// CompletableFuture.allOf(deleteKeyFuture, submitCurrentQuestionFuture, updateEvaluationFuture,
CompletableFuture.allOf(deleteKeyFuture, updateEvaluationFuture,
sumScoreFuture, getByIdFuture, countFuture).get();
return submitVO;

@ -9,6 +9,7 @@ import com.msdw.tms.common.utils.poi.ExcelExportUtil;
import com.msdw.tms.dao.ProjectRecordDao;
import com.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.request.ProjectRecordImportRequest;
import com.msdw.tms.entity.vo.ProjectRecordExportVo;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import com.msdw.tms.service.ProjectRecordService;
import org.apache.poi.ss.formula.functions.T;
@ -69,17 +70,18 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
return projectRecordVo;
}
//ProjectRecordExportVo
@Override
public void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception{
//获取数据
ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userId).setIsdel(Constant.IsDel.NOT_DEL.getType());
List<ProjectRecordVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord);
List<ProjectRecordExportVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord);
List<ProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> {
ProjectRecordImportRequest request = new ProjectRecordImportRequest();
BeanUtils.copyProperties(project, request);
request.setUserRecordstate(project.getRecordstate().equals(1) ? "已完成":"待评分");
// request.setUserRecordstate(project.getRecordstate().equals(1) ? "已完成":"待评分");
return request;
}).collect(Collectors.toList());

@ -52,4 +52,10 @@ public R add(UserInfoEntity userInfoEntity) {
public void updateUserInfoById(UserInfoEntity entity){
userInfoDao.userInfupdateUserInfoById(entity);
}
@Override
public String queryPasword(Integer userId){
String s = userInfoDao.queryUserPassword(userId);
return s;
}
}

@ -25,13 +25,42 @@
WHERE
is_del=0
AND
start_time >='2020-01-01 00:00:00'
<if test="cla.status!=null">and `status` = #{cla.status}</if>
type!=1
AND
`status`!= 1
<if test="cla.status!=null">and `status` = #{cla.status}</if>
<if test="cla.condition!=null">and ( project_name like concat('%',#{cla.condition},'%') or experimental_class_name like concat('%',#{cla.condition},'%') )</if>
<if test="cla.startTime!=null and cla.endTime!=null">and stop_time between #{cla.endTime} and #{cla.startTime}</if>
<if test="cla.month!=null">and DATE_SUB(CURDATE(), INTERVAL #{cla.month} month ) &lt;= date(creation_time)</if>
ORDER BY creation_time DESC
</select>
<!-- <select id="getByClassRecord" resultType="com.msdw.tms.entity.ExperimentalTeachingEntity">-->
<!-- SELECT-->
<!-- id,-->
<!-- experimental_class_name,-->
<!-- surplus_time,-->
<!-- experiment_duration,-->
<!-- experimental_name,-->
<!-- experimental_number,-->
<!-- start_time,-->
<!-- stop_time,-->
<!-- `status`,-->
<!-- project_id,-->
<!-- is_code,-->
<!-- creation_time-->
<!-- FROM-->
<!-- tms_experimental_teaching-->
<!-- WHERE-->
<!-- is_del=0-->
<!-- AND-->
<!-- start_time >='2020-01-01 00:00:00'-->
<!-- <if test="cla.status!=null">and `status` = #{cla.status}</if>-->
<!-- <if test="cla.condition!=null">and ( project_name like concat('%',#{cla.condition},'%') or experimental_class_name like concat('%',#{cla.condition},'%') )</if>-->
<!-- <if test="cla.startTime!=null and cla.endTime!=null">and stop_time between #{cla.endTime} and #{cla.startTime}</if>-->
<!-- <if test="cla.month!=null">and DATE_SUB(CURDATE(), INTERVAL #{cla.month} month ) &lt;= date(creation_time)</if>-->
<!-- ORDER BY creation_time DESC-->
<!-- </select>-->
<update id="updateSurplusTime" parameterType="com.msdw.tms.entity.ExperimentalTeachingEntity">
UPDATE tms_experimental_teaching

@ -56,7 +56,7 @@
tpr.isdel = #{pro.isdel}
</select>
<select id="getByUserRecordImport" resultType="com.msdw.tms.entity.vo.ProjectRecordVo">
<select id="getByUserRecordImport" resultType="com.msdw.tms.entity.vo.ProjectRecordExportVo">
SELECT
tpr.projectId,
projectName,
@ -64,14 +64,18 @@
timeSum,
startingTime as startTime,
endTime,
recordState
recordState,
tet.experimental_class_name
FROM
tms_project_record tpr
LEFT JOIN tms_project tp ON tpr.projectId = tp.projectId
LEFT JOIN tms_experimental_teaching tet ON tpr.projectId = tet.project_id
WHERE
tpr.userId = #{userid}
AND
tpr.isdel = #{isdel}
AND
tpr.projectId = tet.project_id
</select>
<!-- 个人实验预览-->

@ -48,8 +48,15 @@
<if test="schoolId != null">
schoolId = #{schoolId},
</if>
<if test="phone !=null">
phone #{phone}
</if>>
</set>
WHERE userId = #{userId};
</update>
<select id="queryUserPassword" resultType="string">
SELECT `password` FROM hr_user_info WHERE userId = #{userId}
</select>
</mapper>
Loading…
Cancel
Save