学生成绩提交、批量更新到yyyf,成绩同步

pull/1/head
unclekh 5 years ago
parent d286a3b57c
commit d80ddc1d4b
  1. 1
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/LoginController.java
  2. 60
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/StudentAnswerController.java
  3. 26
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/TeachingGradeController.java
  4. 7
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/controller/api/StudentAnswerApi.java
  5. 25
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/AssessUserDto.java
  6. 31
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/dto/YyyfStudentAnswerDto.java
  7. 7
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/entity/AssessUser.java
  8. 1
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/enums/UserEnums.java
  9. 11
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserMapper.java
  10. 10
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/mapper/AssessUserTargetMapper.java
  11. 36
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/AssessUserService.java
  12. 148
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/service/impl/AssessUserServiceImpl.java
  13. 56
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/task/ScheduleTask.java
  14. 259
      blockchain-server/blockchain-server-yyyf/src/main/java/com/blockchain/server/yyyf/utils/HttpClientUtil.java
  15. 29
      blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserMapper.xml
  16. 106
      blockchain-server/blockchain-server-yyyf/src/main/resources/mapper/AssessUserTargetMapper.xml

@ -100,6 +100,7 @@ public class LoginController {
assessUser.setStartTime(new Date()); assessUser.setStartTime(new Date());
assessUser.setUserId(userId); assessUser.setUserId(userId);
assessUser.setUserName(userName); assessUser.setUserName(userName);
assessUser.setUserType(yyyfLoginRequestVo.getUserType());
//获取案例信息 //获取案例信息
HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash(); HashOperations<String, String, ExamPaperDto> examPaperOpsForHash = redisTemplate.opsForHash();

@ -5,6 +5,7 @@ import com.blockchain.common.base.dto.ResultDTO;
import com.blockchain.common.base.dto.YyyfUserDto; import com.blockchain.common.base.dto.YyyfUserDto;
import com.blockchain.common.base.util.YyyfUserDtoUtils; import com.blockchain.common.base.util.YyyfUserDtoUtils;
import com.blockchain.server.yyyf.controller.api.StudentAnswerApi; import com.blockchain.server.yyyf.controller.api.StudentAnswerApi;
import com.blockchain.server.yyyf.dto.AssessUserDto;
import com.blockchain.server.yyyf.entity.AssessUser; import com.blockchain.server.yyyf.entity.AssessUser;
import com.blockchain.server.yyyf.entity.AssessUserTarget; import com.blockchain.server.yyyf.entity.AssessUserTarget;
import com.blockchain.server.yyyf.enums.UserEnums; import com.blockchain.server.yyyf.enums.UserEnums;
@ -17,15 +18,14 @@ import io.swagger.annotations.ApiParam;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -41,6 +41,8 @@ import java.util.concurrent.TimeUnit;
@RequestMapping("/studentAnswer") @RequestMapping("/studentAnswer")
public class StudentAnswerController { public class StudentAnswerController {
private static Logger LOG = LoggerFactory.getLogger(StudentAnswerController.class);
@Autowired @Autowired
private AssessUserTargetService assessUserTargetService; private AssessUserTargetService assessUserTargetService;
@Autowired @Autowired
@ -56,10 +58,11 @@ public class StudentAnswerController {
@ApiParam(StudentAnswerApi.SaveAnswer.METHOD_ASSESS_USER_ID) @RequestParam(name = "assessUserId") String assessUserId, @ApiParam(StudentAnswerApi.SaveAnswer.METHOD_ASSESS_USER_ID) @RequestParam(name = "assessUserId") String assessUserId,
@ApiParam(StudentAnswerApi.SaveAnswer.METHOD_STUDENT_TASK_RATE) @RequestParam(name = "taskRate") Double taskRate, @ApiParam(StudentAnswerApi.SaveAnswer.METHOD_STUDENT_TASK_RATE) @RequestParam(name = "taskRate") Double taskRate,
@ApiParam(StudentAnswerApi.SaveAnswer.METHOD_STARGE_ID) @RequestParam(name = "code") String code) { @ApiParam(StudentAnswerApi.SaveAnswer.METHOD_STARGE_ID) @RequestParam(name = "code") String code) {
String caseKey = YyyfConstant.CASE_KEY + yyyfUserId;
Integer answer = -1;
if (redisTemplate.hasKey(caseKey)) {
AssessUserTarget assessUserTarget = this.assessUserTargetService.selectByAssessUserAndCode(assessUserId, code); AssessUserTarget assessUserTarget = this.assessUserTargetService.selectByAssessUserAndCode(assessUserId, code);
Integer answer = -1;
if (assessUserTarget != null) {
assessUserTarget.setStudentRate(taskRate); assessUserTarget.setStudentRate(taskRate);
int compareAnswer = taskRate.compareTo(assessUserTarget.getTaskRate()); int compareAnswer = taskRate.compareTo(assessUserTarget.getTaskRate());
//最终指标结果一致 //最终指标结果一致
@ -70,46 +73,31 @@ public class StudentAnswerController {
} }
assessUserTarget.setAnswer(answer); assessUserTarget.setAnswer(answer);
this.assessUserTargetService.update(assessUserTarget); this.assessUserTargetService.update(assessUserTarget);
String caseKey = YyyfConstant.CASE_KEY + yyyfUserId;
if (redisTemplate.hasKey(caseKey))
redisTemplate.expire(caseKey, 2, TimeUnit.HOURS); redisTemplate.expire(caseKey, 2, TimeUnit.HOURS);
} else { } else {
throw new UserException(UserEnums.USER_NOT_BIND_YYYF); throw new UserException(UserEnums.NO_INDICATORS_FOUND);
} }
return ResultDTO.requstSuccess(answer); return ResultDTO.requstSuccess(answer);
} }
@SneakyThrows @SneakyThrows
@PostMapping("/submit") @GetMapping("/submit")
@ApiOperation(value = StudentAnswerApi.SaveAnswer.METHOD_NAME, @ApiOperation(value = StudentAnswerApi.Submit.METHOD_NAME,
notes = StudentAnswerApi.SaveAnswer.METHOD_NOTE) notes = StudentAnswerApi.Submit.METHOD_NOTE)
public ResultDTO<Integer> submit(HttpServletRequest request) { public ResultDTO<AssessUserDto> submit(HttpServletRequest request) {
YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDto(request, redisTemplate);
YyyfUserDto yyyfUserDto = YyyfUserDtoUtils.getYyyfUserDto(request, redisTemplate);
String assessUserId = yyyfUserDto.getAssessUserId(); String assessUserId = yyyfUserDto.getAssessUserId();
AssessUser assessUser = this.assessUserService.selectAssessUserById(assessUserId); AssessUserDto assessUserDto = this.assessUserService.submit(assessUserId);
if (assessUser.getEndTime() != null) { if(assessUserDto.getAchieveMentType()==1){
throw new UserException(UserEnums.PROHIBIT_DUPLICATE_SUBMISSION); redisTemplate.delete(YyyfConstant.CASE_KEY + assessUserDto.getUserId());
}
Double totalScore = 0d;
List<AssessUserTarget> assessUserTargetList = this.assessUserTargetService.selectAssessUserTargetByAssessUserId(assessUserId);
for (AssessUserTarget assessUserTarget : assessUserTargetList) {
Integer answer = assessUserTarget.getAnswer();
Double taskScore = assessUserTarget.getTaskScore();
if (assessUserTarget.getAnswer() == 0) {
totalScore += taskScore;
} }
} return ResultDTO.requstSuccess(assessUserDto);
Date startTime = assessUser.getStartTime();
Date now = new Date();
assessUser.setTotalScore(totalScore);
assessUser.setEndTime(now);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//考试时长
//考试时长
long duration1 = sdf.parse(sdf.format(now)).getTime() - sdf.parse(sdf.format(startTime)).getTime();
long duration = now.getTime() - startTime.getTime();
return ResultDTO.requstSuccess();
} }
} }

@ -9,6 +9,7 @@ import com.blockchain.server.yyyf.service.AssessUserTaskService;
import com.blockchain.server.yyyf.utils.MSExcelUtil; import com.blockchain.server.yyyf.utils.MSExcelUtil;
import com.blockchain.server.yyyf.utils.ResponseUtils; import com.blockchain.server.yyyf.utils.ResponseUtils;
import io.swagger.annotations.ApiParam;
import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
@ -18,8 +19,11 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;
import sun.misc.BASE64Decoder; import sun.misc.BASE64Decoder;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
@ -63,7 +67,7 @@ public class TeachingGradeController {
* @author huan.xu * @author huan.xu
* @date 2019-11-08 18:03:39 * @date 2019-11-08 18:03:39
**/ **/
@RequestMapping(value = "/getGradeData"/*,produces = {"application/text;charset=UTF-8"}*/) @GetMapping(value = "/getGradeData"/*,produces = {"application/text;charset=UTF-8"}*/)
@ResponseBody @ResponseBody
@SuppressWarnings("all") @SuppressWarnings("all")
public void getGradeData(HttpServletRequest request, HttpServletResponse response) { public void getGradeData(HttpServletRequest request, HttpServletResponse response) {
@ -164,7 +168,7 @@ public class TeachingGradeController {
* @author huan.xu * @author huan.xu
* @date 2019-11-08 18:27:22 * @date 2019-11-08 18:27:22
**/ **/
public Map<String, Object> getWrongStatistics(String issueId, Integer notExamNum) { private Map<String, Object> getWrongStatistics(String issueId, Integer notExamNum) {
Map<String, Object> wrongStatistics = new HashMap<String, Object>(); Map<String, Object> wrongStatistics = new HashMap<String, Object>();
//根据考核发布id,获取考核点信息 //根据考核发布id,获取考核点信息
List<Map<String, Object>> taskListDb = assessUserTaskService.selectYHTaskInfoByIssueId(issueId); List<Map<String, Object>> taskListDb = assessUserTaskService.selectYHTaskInfoByIssueId(issueId);
@ -273,6 +277,7 @@ public class TeachingGradeController {
**/ **/
@RequestMapping("/studyGrade/mygrade") @RequestMapping("/studyGrade/mygrade")
@ApiIgnore
public String selectPractiseProList(String reqType, String issueId, String examName, Integer userId, String stuNo, String userName, String className, String caseId, Model model) { public String selectPractiseProList(String reqType, String issueId, String examName, Integer userId, String stuNo, String userName, String className, String caseId, Model model) {
try {/* try {/*
AssessUser assessUser = null; AssessUser assessUser = null;
@ -347,6 +352,7 @@ public class TeachingGradeController {
* @date 2019-11-08 18:46:05 * @date 2019-11-08 18:46:05
**/ **/
@RequestMapping("/studyGrade/examMesaageDetails") @RequestMapping("/studyGrade/examMesaageDetails")
@ApiIgnore
public String examMesaageDetails(String assessUserId, Model model) { public String examMesaageDetails(String assessUserId, Model model) {
AssessUser assessUser = this.assessUserService.selectAssessUserById(assessUserId.trim()); AssessUser assessUser = this.assessUserService.selectAssessUserById(assessUserId.trim());
cratePractiseProDtosForNotNull(assessUser, model); cratePractiseProDtosForNotNull(assessUser, model);
@ -382,30 +388,32 @@ public class TeachingGradeController {
* @author huan.xu * @author huan.xu
* @date 2019-11-08 18:39:55 * @date 2019-11-08 18:39:55
**/ **/
@RequestMapping("/studyGrade/reSynchroze") @GetMapping("/studyGrade/reSynchroze")
@ResponseBody @ResponseBody
@SuppressWarnings("all") @SuppressWarnings("all")
public Map<String, Object> reSynchroze(String issueId, String authorization) { public Map<String, Object> reSynchroze(@ApiParam("考试id") @RequestParam("issueId") String issueId,
@ApiParam("验证码") @RequestParam("authorization") String authorization) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
/* result.put("status", 0); result.put("status", 0);
result.put("msg", "系统错误"); result.put("msg", "系统错误");
try { try {
if ("87DIVy348Oxzj3ha".equals(authorization)) { if ("87DIVy348Oxzj3ha".equals(authorization)) {
result = this.scoreSynchroService.synchrozeScoreList(issueId); this.assessUserService.synchronousScore(issueId);
result.put("status", 1);
result.put("msg", "同步成功");
} else { } else {
result.put("msg", "验证错误"); result.put("msg", "验证错误");
} }
} catch (Exception e) { } catch (Exception e) {
result.put("msg", "同步失败,请进行后台检查"); result.put("msg", "同步失败,请进行后台检查");
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
}*/ }
return result; return result;
} }
@RequestMapping("/export") @GetMapping("/export")
@ResponseBody @ResponseBody
public void yhExport(HttpServletRequest request, HttpServletResponse response) {/* public void yhExport(HttpServletRequest request, HttpServletResponse response) {/*
String examName = request.getParameter("examName"); String examName = request.getParameter("examName");

@ -9,11 +9,16 @@ public class StudentAnswerApi {
public static class SaveAnswer { public static class SaveAnswer {
public static final String METHOD_NAME = "学生答题"; public static final String METHOD_NAME = "学生答题";
public static final String METHOD_NOTE = "学生答题统一调用,调用成功,返回结果:0答案正确,1答案错误,-1系统错误"; public static final String METHOD_NOTE = "学生答题统一调用,调用成功,返回结果:0答案正确,1答案错误,-1系统错误。状态码(code)1096:查不到指标";
public static final String METHOD_YYYF_USER_ID= "以渔有方用户ID"; public static final String METHOD_YYYF_USER_ID= "以渔有方用户ID";
public static final String METHOD_ASSESS_USER_ID= "assessUser的主键ID"; public static final String METHOD_ASSESS_USER_ID= "assessUser的主键ID";
public static final String METHOD_STUDENT_TASK_RATE="学生任务目标比率"; public static final String METHOD_STUDENT_TASK_RATE="学生任务目标比率";
public static final String METHOD_STARGE_ID="指标id"; public static final String METHOD_STARGE_ID="指标id";
} }
public static class Submit {
public static final String METHOD_NAME = "学生提交成绩";
public static final String METHOD_NOTE = "学生提交成绩,状态码(code)1097:禁止重复提交 ";
}
} }

@ -0,0 +1,25 @@
package com.blockchain.server.yyyf.dto;
import com.blockchain.server.yyyf.entity.AssessUser;
import com.blockchain.server.yyyf.entity.AssessUserTarget;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author Mr.Xu
* @version 1.0
* @className AssessUserDto
* @description
* @date 2020-05-14 22:07
*/
@Data
public class AssessUserDto extends AssessUser implements Serializable {
private static final long serialVersionUID = -4573665667880888958L;
/**
* 指标完成情况
**/
private List<AssessUserTarget> assessUserTargetList;
}

@ -0,0 +1,31 @@
package com.blockchain.server.yyyf.dto;
import com.blockchain.server.yyyf.entity.AssessUser;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author Mr.Xu
* @version 1.0
* @className YyyfStudentAnswerDto
* @description
* @date 2020-05-14 22:52
*/
@Data
public class YyyfStudentAnswerDto implements Serializable {
private static final long serialVersionUID = 505667820932379758L;
private String authorization="87DIVy348Oxzj3ha";
private String sysType="130";
private Integer userId;
private Double totalScore;
private Date startTime;
private Date endTime;
private int achievementType;
private String assessmentId;
private String caseId;
private String classId;
private String courseId;
}

@ -98,4 +98,11 @@ public class AssessUser implements Serializable {
@Column(name = "user_name") @Column(name = "user_name")
private String userName; private String userName;
/**
* 用户类型:0学生1老师2管理员
*/
@Column(name = "user_Type")
private Integer userType;
} }

@ -5,6 +5,7 @@ package com.blockchain.server.yyyf.enums;
* @data 2019/2/21 20:53 * @data 2019/2/21 20:53
*/ */
public enum UserEnums { public enum UserEnums {
NO_INDICATORS_FOUND(1096,"查不到指标","No indicators found","查不到指標"),
PROHIBIT_DUPLICATE_SUBMISSION(1097,"禁止重复提交","Prohibit duplicate submission","禁止重複提交"), PROHIBIT_DUPLICATE_SUBMISSION(1097,"禁止重复提交","Prohibit duplicate submission","禁止重複提交"),
USER_NOT_FORBID_OTHER_USER(1098, "禁止登录他人账号", "The user does not allow login other user's accout", "禁止登錄他人賬號"), USER_NOT_FORBID_OTHER_USER(1098, "禁止登录他人账号", "The user does not allow login other user's accout", "禁止登錄他人賬號"),
USER_NOT_BIND_YYYF(1099, "该用户未绑定以渔有方或者以渔有方登录已失效", "The user does not bind yyyf", "該用戶未綁定以漁有方或者以漁有方登錄已失效"), USER_NOT_BIND_YYYF(1099, "该用户未绑定以渔有方或者以渔有方登录已失效", "The user does not bind yyyf", "該用戶未綁定以漁有方或者以漁有方登錄已失效"),

@ -1,6 +1,7 @@
package com.blockchain.server.yyyf.mapper; package com.blockchain.server.yyyf.mapper;
import com.blockchain.server.yyyf.dto.AssessUserDto;
import com.blockchain.server.yyyf.dto.PractiseProDto; import com.blockchain.server.yyyf.dto.PractiseProDto;
import com.blockchain.server.yyyf.entity.AssessUser; import com.blockchain.server.yyyf.entity.AssessUser;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -14,7 +15,7 @@ import java.util.Map;
@Repository @Repository
public interface AssessUserMapper extends Mapper<AssessUser> { public interface AssessUserMapper extends Mapper<AssessUser> {
int insert(AssessUser assessUser); // int insert(AssessUser assessUser);
void batchInsert(List<AssessUser> assessUserList); void batchInsert(List<AssessUser> assessUserList);
@ -41,4 +42,12 @@ public interface AssessUserMapper extends Mapper<AssessUser> {
void delAssessUserByIssueId(@Param("issueId") String issueId); void delAssessUserByIssueId(@Param("issueId") String issueId);
/**
* @description 通过AssessUserDtoLis批量更新AssessUser
* @author Mr.Xu
* @date 2020-05-15 00:08:17
* @param [assessUserDtoList]
* @return void
**/
void batchUpdateTotalScoreByAssessUserDtoList(@Param("assessUserDtoList") List<AssessUserDto> assessUserDtoList);
} }

@ -1,5 +1,6 @@
package com.blockchain.server.yyyf.mapper; package com.blockchain.server.yyyf.mapper;
import com.blockchain.server.yyyf.dto.AssessUserDto;
import com.blockchain.server.yyyf.entity.AssessUserTarget; import com.blockchain.server.yyyf.entity.AssessUserTarget;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -12,5 +13,14 @@ public interface AssessUserTargetMapper extends Mapper<AssessUserTarget> {
/**
* @description 批量插入指标
* @author Mr.Xu
* @date 2020-05-14 23:24:21
* @param [list]
* @return void
**/
void batchInsert(@Param("list")List<AssessUserTarget> list); void batchInsert(@Param("list")List<AssessUserTarget> list);
List<AssessUserDto> selectAssessUserDtoByIssueId(@Param("issueId") String issueId);
} }

@ -3,9 +3,11 @@ package com.blockchain.server.yyyf.service;
import com.blockchain.server.train.dto.TrainCaseTargetDto; import com.blockchain.server.train.dto.TrainCaseTargetDto;
import com.blockchain.server.yyyf.dto.AssessUserDto;
import com.blockchain.server.yyyf.dto.PractiseProDto; import com.blockchain.server.yyyf.dto.PractiseProDto;
import com.blockchain.server.yyyf.entity.AssessUser; import com.blockchain.server.yyyf.entity.AssessUser;
import java.text.ParseException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -92,5 +94,39 @@ public interface AssessUserService {
**/ **/
void insert(AssessUser assessUser); void insert(AssessUser assessUser);
/**
* @description 初始化考核数据
* @author Mr.Xu
* @date 2020-05-14 22:03:38
* @param [assessUser, trainCaseTargeList]
* @return void
**/
void initAssessUser(AssessUser assessUser, List<TrainCaseTargetDto> trainCaseTargeList ); void initAssessUser(AssessUser assessUser, List<TrainCaseTargetDto> trainCaseTargeList );
/**
* @description 更新数据
* @author Mr.Xu
* @date 2020-05-14 22:03:02
* @param [assessUser]
* @return void
**/
void update(AssessUser assessUser);
/**
* @description 提交事务
* @author Mr.Xu
* @date 2020-05-14 22:24:29
* @param [assessUserId]
* @return void
**/
AssessUserDto submit(String assessUserId);
/**
* @description 批量同步成绩
* @author Mr.Xu
* @date 2020-05-14 23:21:20
* @param [issueId]
* @return void
**/
void synchronousScore(String issueId);
} }

@ -3,24 +3,36 @@ package com.blockchain.server.yyyf.service.impl;
import com.blockchain.common.base.constant.YyyfConstant; import com.blockchain.common.base.constant.YyyfConstant;
import com.blockchain.server.train.dto.ExamPaperDto; import com.blockchain.server.train.dto.ExamPaperDto;
import com.blockchain.server.train.dto.TrainCaseTargetDto; import com.blockchain.server.train.dto.TrainCaseTargetDto;
import com.blockchain.server.yyyf.dto.AssessUserDto;
import com.blockchain.server.yyyf.dto.ExamDto;
import com.blockchain.server.yyyf.dto.PractiseProDto; import com.blockchain.server.yyyf.dto.PractiseProDto;
import com.blockchain.server.yyyf.dto.YyyfStudentAnswerDto;
import com.blockchain.server.yyyf.entity.AssessUser; import com.blockchain.server.yyyf.entity.AssessUser;
import com.blockchain.server.yyyf.entity.AssessUserTarget; import com.blockchain.server.yyyf.entity.AssessUserTarget;
import com.blockchain.server.yyyf.enums.UserEnums;
import com.blockchain.server.yyyf.exceprion.UserException;
import com.blockchain.server.yyyf.mapper.AssessUserMapper; import com.blockchain.server.yyyf.mapper.AssessUserMapper;
import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper; import com.blockchain.server.yyyf.mapper.AssessUserTargetMapper;
import com.blockchain.server.yyyf.mapper.AssessUserTaskMapper; import com.blockchain.server.yyyf.mapper.AssessUserTaskMapper;
import com.blockchain.server.yyyf.service.AssessUserService; import com.blockchain.server.yyyf.service.AssessUserService;
import com.blockchain.server.yyyf.utils.HttpClientUtil;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import lombok.SneakyThrows;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -35,6 +47,8 @@ import java.util.List;
public class AssessUserServiceImpl implements AssessUserService { public class AssessUserServiceImpl implements AssessUserService {
private static Logger LOG = LoggerFactory.getLogger(AssessUserServiceImpl.class); private static Logger LOG = LoggerFactory.getLogger(AssessUserServiceImpl.class);
@Autowired
private RedisTemplate redisTemplate;
@Autowired @Autowired
private AssessUserMapper assessUserMapper; private AssessUserMapper assessUserMapper;
@ -43,25 +57,31 @@ public class AssessUserServiceImpl implements AssessUserService {
@Autowired @Autowired
private AssessUserTaskMapper assessUserTaskMapper; private AssessUserTaskMapper assessUserTaskMapper;
private static final String durationUnit = "m";//时长单位
@Value("${yyyf.url}")
private String yyyfUrl;
@Value("${yyyf.assessment}")
private String assessment;
@Value("${yyyf.assessmentList}")
private String assessmentList;
@Override @Override
public List<PractiseProDto> selectPractiseProList (String assessUserId){ public List<PractiseProDto> selectPractiseProList(String assessUserId) {
return this.assessUserMapper.selectPractiseProList(assessUserId); return this.assessUserMapper.selectPractiseProList(assessUserId);
} }
@Override @Override
public AssessUser selectScore(String issueId, Integer userId) { public AssessUser selectScore(String issueId, Integer userId) {
return this.assessUserMapper.selectScore(issueId,userId); return this.assessUserMapper.selectScore(issueId, userId);
} }
@Override @Override
public List<AssessUser> selectAssessUserListByIssuerIdAndUserId(String issueId, Integer userId) { public List<AssessUser> selectAssessUserListByIssuerIdAndUserId(String issueId, Integer userId) {
return this.assessUserMapper.selectAssessUserListByIssuerIdAndUserId(issueId,userId); return this.assessUserMapper.selectAssessUserListByIssuerIdAndUserId(issueId, userId);
} }
@Override @Override
@ -83,10 +103,10 @@ public class AssessUserServiceImpl implements AssessUserService {
@Override @Override
public AssessUser selectAssessUserByUserIdAndissueIdForNotEnd(Integer userId, String issueId) { public AssessUser selectAssessUserByUserIdAndissueIdForNotEnd(Integer userId, String issueId) {
Example example=new Example(AssessUser.class); Example example = new Example(AssessUser.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andCondition(" user_id =",userId) criteria.andCondition(" user_id =", userId)
.andCondition(" issue_id = ",issueId) .andCondition(" issue_id = ", issueId)
.andCondition(" end_time is null "); .andCondition(" end_time is null ");
return this.assessUserMapper.selectOneByExample(example); return this.assessUserMapper.selectOneByExample(example);
} }
@ -98,13 +118,13 @@ public class AssessUserServiceImpl implements AssessUserService {
} }
@Override @Override
public void initAssessUser(AssessUser assessUser, List<TrainCaseTargetDto> trainCaseTargeList ) { public void initAssessUser(AssessUser assessUser, List<TrainCaseTargetDto> trainCaseTargeList) {
List<AssessUserTarget> list=new ArrayList<>(trainCaseTargeList.size()); List<AssessUserTarget> list = new ArrayList<>(trainCaseTargeList.size());
int j=1; int j = 1;
for(TrainCaseTargetDto trainCaseTargetDto :trainCaseTargeList){ for (TrainCaseTargetDto trainCaseTargetDto : trainCaseTargeList) {
AssessUserTarget assessUserTarget=new AssessUserTarget(); AssessUserTarget assessUserTarget = new AssessUserTarget();
BeanUtils.copyProperties(trainCaseTargetDto,assessUserTarget); BeanUtils.copyProperties(trainCaseTargetDto, assessUserTarget);
assessUserTarget.setAssessUserId(assessUser.getId()); assessUserTarget.setAssessUserId(assessUser.getId());
assessUserTarget.setTargetId(trainCaseTargetDto.getId()); assessUserTarget.setTargetId(trainCaseTargetDto.getId());
assessUserTarget.setTargetName(trainCaseTargetDto.getName()); assessUserTarget.setTargetName(trainCaseTargetDto.getName());
@ -115,5 +135,107 @@ public class AssessUserServiceImpl implements AssessUserService {
this.assessUserTargetMapper.batchInsert(list); this.assessUserTargetMapper.batchInsert(list);
} }
@Override
public void update(AssessUser assessUser) {
this.assessUserMapper.updateByPrimaryKey(assessUser);
}
@SneakyThrows
@Override
public AssessUserDto submit(String assessUserId) {
AssessUser assessUser = this.selectAssessUserById(assessUserId);
if (assessUser.getEndTime() != null) {
throw new UserException(UserEnums.PROHIBIT_DUPLICATE_SUBMISSION);
}
Double totalScore = 0d;
//获取指标信息
Example example = new Example(AssessUserTarget.class);
Example.Criteria criteria = example.createCriteria();
criteria.andCondition(" assess_user_id = ", assessUserId);
List<AssessUserTarget> assessUserTargetList = this.assessUserTargetMapper.selectByExample(example);
for (AssessUserTarget assessUserTarget : assessUserTargetList) {
Double taskScore = assessUserTarget.getTaskScore();
if (assessUserTarget.getAnswer() == 0) {
totalScore += taskScore;
}
}
Date startTime = assessUser.getStartTime();
Date now = new Date();
assessUser.setTotalScore(totalScore);
assessUser.setEndTime(now);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//考试时长
long duration = sdf.parse(sdf.format(now)).getTime() - sdf.parse(sdf.format(startTime)).getTime();
assessUser.setDuration(Math.toIntExact(duration));
if (assessUser.getUserType() == 0 && assessUser.getAchieveMentType() == 0) {
YyyfStudentAnswerDto yyyfStudentAnswerDto = new YyyfStudentAnswerDto();
BeanUtils.copyProperties(assessUser, yyyfStudentAnswerDto);
yyyfStudentAnswerDto.setAssessmentId(assessUser.getIssueId());
HttpClientUtil.doPostWithJSON(new StringBuilder().append(yyyfUrl).append(assessment).toString(), yyyfStudentAnswerDto);
}
this.update(assessUser);
AssessUserDto assessUserDto = new AssessUserDto();
BeanUtils.copyProperties(assessUser, assessUserDto);
assessUserDto.setAssessUserTargetList(assessUserTargetList);
return assessUserDto;
}
@SneakyThrows
@Override
public void synchronousScore(String issueId) {
List<AssessUserDto> assessUserDtoList = this.assessUserTargetMapper.selectAssessUserDtoByIssueId(issueId);
List<AssessUserDto> updateAssessUserDtoList = new ArrayList<>();
List<YyyfStudentAnswerDto> yyyfStudentAnswerDtoList = new ArrayList<>(assessUserDtoList.size());
Date now = new Date();
for (AssessUserDto assessUserDto : assessUserDtoList) {
List<AssessUserTarget> assessUserTargetList = assessUserDto.getAssessUserTargetList();
if (assessUserDto.getEndTime() == null) {
Double totalScore = 0d;
for (AssessUserTarget assessUserTarget : assessUserTargetList) {
Double taskScore = assessUserTarget.getTaskScore();
if (assessUserTarget.getAnswer() == 0) {
totalScore += taskScore;
}
}
Date startTime = assessUserDto.getStartTime();
assessUserDto.setTotalScore(totalScore);
assessUserDto.setEndTime(now);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//考试时长
long duration = sdf.parse(sdf.format(now)).getTime() - sdf.parse(sdf.format(startTime)).getTime();
assessUserDto.setDuration(Math.toIntExact(duration));
updateAssessUserDtoList.add(assessUserDto);
}
YyyfStudentAnswerDto yyyfStudentAnswerDto = new YyyfStudentAnswerDto();
BeanUtils.copyProperties(assessUserDto, yyyfStudentAnswerDto);
yyyfStudentAnswerDto.setAssessmentId(issueId);
yyyfStudentAnswerDtoList.add(yyyfStudentAnswerDto);
redisTemplate.delete(YyyfConstant.CASE_KEY + assessUserDto.getUserId());
}
//获取考核信息
HashOperations<String, String, ExamDto> examDtoOpsForHash = redisTemplate.opsForHash();
// 获取所有参加考核学生信息
HashOperations<String, String, List<String>> studentOpsForHash = redisTemplate.opsForHash();
studentOpsForHash.delete(YyyfConstant.JOIN_EXAM_STU_IDS_KEY, issueId);
examDtoOpsForHash.delete(YyyfConstant.EXAM_KEY, issueId);
if (updateAssessUserDtoList.size() > 0)
this.assessUserMapper.batchUpdateTotalScoreByAssessUserDtoList(assessUserDtoList);
HttpClientUtil.doPostWithJSON(new StringBuilder().append(yyyfUrl).append(assessmentList).toString(), yyyfStudentAnswerDtoList);
}
} }

@ -0,0 +1,56 @@
package com.blockchain.server.yyyf.task;
import com.blockchain.common.base.constant.YyyfConstant;
import com.blockchain.server.yyyf.dto.ExamDto;
import com.blockchain.server.yyyf.service.AssessUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
* @author Mr.Xu
* @version 1.0
* @className ScheduleTask
* @description
* @date 2020-05-14 23:16
*/
@Configuration
@EnableScheduling
public class ScheduleTask {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private AssessUserService assessUserService;
@Autowired
private RedisTemplate redisTemplate;
@Scheduled(initialDelay = 5000,fixedRate=60000)
private void OneMinuteTask() {
logger.info("开始扫描考试"+ new Date());
HashOperations<String, String, ExamDto> examDtoOpsForHash = redisTemplate.opsForHash();
Map<String, ExamDto> examDtoMap = examDtoOpsForHash.entries(YyyfConstant.EXAM_KEY);
Set<Map.Entry<String, ExamDto>> entries = examDtoMap.entrySet();
Iterator<Map.Entry<String, ExamDto>> iterator = entries.iterator();
Date now =new Date();
logger.info("size is " + entries.size() );
while(iterator.hasNext()){
Map.Entry<String, ExamDto> next = iterator.next();
ExamDto examDto = next.getValue();
Date endTime = examDto.getEndTime();
if(now.after(endTime)){
this.assessUserService.synchronousScore(examDto.getExamId());
}
}
logger.info("完成扫描考试"+ new Date());
}
}

@ -0,0 +1,259 @@
package com.blockchain.server.yyyf.utils;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.*;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author huan.xu
* @version 1.0
* @className HttpClientUtil
* @description
* @date 2019-11-12 17:33
*/
public class HttpClientUtil {
private static final CloseableHttpClient httpClient;
private static final Logger LOGGER = LoggerFactory.getLogger(HttpClientUtil.class);
public static final String CHARSET = "UTF-8";
static {
RequestConfig config = RequestConfig.custom().setConnectTimeout(60000).setSocketTimeout(15000).build();
httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
}
public static String doGet(String url, Map<String, String> params) {
return doGet(url, params, CHARSET);
}
public static String doPost(String url, Map<String, String> params) {
return doPost(url, params, CHARSET);
}
public static String doPostWithJSON(String url, Object params) throws Exception {
return doPostWithJSON(url, params, CHARSET);
}
public static String doPutWithJSON(String url, Object params) throws Exception {
return doPutWithJSON(url, params, CHARSET);
}
public static String doDeleteWithJSON(String url, Object params) throws Exception {
return doDeleteWithJSON(url, params, CHARSET);
}
/**
* HTTP Get 获取内容
*
* @param url 请求的url地址 ?之前的地址
* @param params 请求的参数
* @param charset 编码格式
* @return 页面内容
*/
public static String doGet(String url, Map<String, String> params, String charset) {
if (StringUtils.isBlank(url)) {
return null;
}
try {
if (params != null && !params.isEmpty()) {
List<NameValuePair> pairs = new ArrayList<NameValuePair>(params.size());
for (Map.Entry<String, String> entry : params.entrySet()) {
String value = entry.getValue();
if (value != null) {
pairs.add(new BasicNameValuePair(entry.getKey(), value));
}
}
url += "?" + EntityUtils.toString(new UrlEncodedFormEntity(pairs, charset));
}
HttpGet httpGet = new HttpGet(url);
CloseableHttpResponse response = httpClient.execute(httpGet);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
httpGet.abort();
throw new RuntimeException("HttpClient,error status code :" + statusCode);
}
HttpEntity entity = response.getEntity();
String result = null;
if (entity != null) {
result = EntityUtils.toString(entity, "utf-8");
}
EntityUtils.consume(entity);
response.close();
return result;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* HTTP Post 获取内容
*
* @param url 请求的url地址 ?之前的地址
* @param params 请求的参数
* @param charset 编码格式
* @return 页面内容
*/
public static String doPost(String url, Map<String, String> params, String charset) {
if (StringUtils.isBlank(url)) {
return null;
}
try {
List<NameValuePair> pairs = null;
if (params != null && !params.isEmpty()) {
pairs = new ArrayList<>(params.size());
for (Map.Entry<String, String> entry : params.entrySet()) {
String value = entry.getValue();
if (value != null) {
pairs.add(new BasicNameValuePair(entry.getKey(), value));
}
}
}
HttpPost httpPost = new HttpPost(url);
if (pairs != null && pairs.size() > 0) {
httpPost.setEntity(new UrlEncodedFormEntity(pairs, CHARSET));
}
CloseableHttpResponse response = httpClient.execute(httpPost);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
httpPost.abort();
throw new RuntimeException("HttpClient,error status code :" + statusCode);
}
HttpEntity entity = response.getEntity();
String result = null;
if (entity != null) {
result = EntityUtils.toString(entity, "utf-8");
}
EntityUtils.consume(entity);
response.close();
return result;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* json post
*
* @author: fengyu.wang
* @date: 2017-10-27 16:14:47
*/
public static String doPostWithJSON(String url, Object params, String charset) throws Exception {
LOGGER.info("doPostWithJSON -- URL:" + url);
HttpPost httpPost = new HttpPost(url);
StringEntity entity = new StringEntity(JSON.toJSONString(params), charset);
LOGGER.info("doPostWithJSON -- params:" + JSON.toJSONString(params));
entity.setContentEncoding(charset);
entity.setContentType("application/json");
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
httpPost.abort();
throw new RuntimeException("HttpClient,error status code :" + statusCode);
}
HttpEntity responseEntity = response.getEntity();
String respContent = EntityUtils.toString(responseEntity, charset);
LOGGER.info("doPostWithJSON -- respContent:" + respContent);
return respContent;
}
/**
* 方法 doPostWithJSON 功能 json put
*
* @author ningning.jiang 2017年10月30日 17:11:28
*/
public static String doPutWithJSON(String url, Object params, String charset) throws Exception {
LOGGER.info("doPutWithJSON -- URL:" + url);
HttpPut httpPut = new HttpPut(url);
StringEntity entity = new StringEntity(JSON.toJSONString(params), charset);
LOGGER.info("doPutWithJSON -- params:" + JSON.toJSONString(params));
entity.setContentEncoding(charset);
entity.setContentType("application/json");
httpPut.setEntity(entity);
HttpResponse response = httpClient.execute(httpPut);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
httpPut.abort();
throw new RuntimeException("HttpClient,error status code :" + statusCode);
}
HttpEntity responseEntity = response.getEntity();
String respContent = EntityUtils.toString(responseEntity, charset);
LOGGER.info("doPutWithJSON -- respContent:" + respContent);
return respContent;
}
/**
* 方法 doPutWithJSON 功能delete json
*
* @author ningning.jiang 2017年10月31日 08:46:44
*/
public static String doDeleteWithJSON(String url, Object params, String charset) throws Exception {
LOGGER.info("doDeleteWithJSON -- URL:" + url);
HttpDeleteWithBody httpDelete = new HttpDeleteWithBody(url);
StringEntity entity = new StringEntity(JSON.toJSONString(params), charset);
LOGGER.info("doDeleteWithJSON -- params:" + JSON.toJSONString(params));
entity.setContentEncoding(charset);
entity.setContentType("application/json");
httpDelete.setEntity(entity);
HttpResponse response = httpClient.execute(httpDelete);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
httpDelete.abort();
throw new RuntimeException("HttpClient,error status code :" + statusCode);
}
HttpEntity responseEntity = response.getEntity();
String respContent = EntityUtils.toString(responseEntity, charset);
LOGGER.info("doDeleteWithJSON -- respContent:" + respContent);
return respContent;
}
}
class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase {
private static final String METHOD_NAME = "DELETE";
public String getMethod() {
return METHOD_NAME;
}
public HttpDeleteWithBody(final String uri) {
super();
setURI(URI.create(uri));
}
public HttpDeleteWithBody(final URI uri) {
super();
setURI(uri);
}
public HttpDeleteWithBody() {
super();
}
}

@ -104,26 +104,7 @@
t.course_id, t.course_id,
</sql> </sql>
<insert id="insert" parameterType="com.blockchain.server.yyyf.entity.AssessUser">
insert into yyyf_server_assess_user ( id, train_id, issue_id, ss_practise_id, user_id,user_name, total_score, duration, duration_unit, start_time, end_time, case_id, achieve_ment_type, class_id, course_id)
values(
#{id},
#{trainId},
#{issueId},
#{ssPractiseId},
#{userId},
#{userName},
#{totalScore},
#{duration},
#{durationUnit},
#{startTime},
#{endTime},
#{caseId},
#{achieveMentType},
#{classId},
#{courseId}
)
</insert>
<insert id="batchInsert" parameterType="java.util.List"> <insert id="batchInsert" parameterType="java.util.List">
insert into yyyf_server_assess_user insert into yyyf_server_assess_user
@ -149,6 +130,14 @@
</foreach > </foreach >
</insert> </insert>
<update id="batchUpdateTotalScoreByAssessUserDtoList" parameterType="list">
<foreach collection="assessUserDtoList" item="item" separator=";" close=";">
update yyyf_server_assess_user
set total_score = #{item.totalScore,jdbcType=DECIMAL}, duration = #{item.duration,jdbcType=INTEGER},end_time = #{item.endTime,jdbcType=TIMESTAMP}
where id = #{item.id,jdbcType=VARCHAR}
</foreach>
</update>
<delete id="delAssessUserByIssueId"> <delete id="delAssessUserByIssueId">
delete from yyyf_server_assess_user where issue_id=#{issueId} delete from yyyf_server_assess_user where issue_id=#{issueId}
</delete> </delete>

@ -10,43 +10,41 @@
<result column="project_case_desc" jdbcType="VARCHAR" property="projectCaseDesc"/>--> <result column="project_case_desc" jdbcType="VARCHAR" property="projectCaseDesc"/>-->
</resultMap> </resultMap>
<sql id="YfServerAssessUserProject_Where_Clause"> <resultMap id="AssessUserDtoMap" type="com.blockchain.server.yyyf.dto.AssessUserDto">
<if test="id != null "> <id column="id" jdbcType="VARCHAR" property="id" />
and t.id=#{id,jdbcType=VARCHAR} <result column="train_id" jdbcType="VARCHAR" property="trainId" />
</if> <result column="issue_id" jdbcType="VARCHAR" property="issueId" />
<if test="assessUserId != null and assessUserId != ''"> <result column="ss_practise_id" jdbcType="VARCHAR" property="ssPractiseId" />
and t.assess_user_id=#{assessUserId,jdbcType=VARCHAR} <result column="user_id" jdbcType="INTEGER" property="userId" />
</if> <result column="user_name" jdbcType="VARCHAR" property="userName" />
<if test="projectName != null and projectName != ''"> <result column="user_type" jdbcType="INTEGER" property="userType" />
and t.project_name=#{projectName,jdbcType=VARCHAR} <result column="total_score" jdbcType="DECIMAL" property="totalScore" />
</if> <result column="duration" jdbcType="INTEGER" property="duration" />
<if test="projectId != null and projectId != ''"> <result column="duration_unit" jdbcType="VARCHAR" property="durationUnit" />
and t.project_id=#{projectId,jdbcType=VARCHAR} <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
</if> <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<if test="projectScore != null and projectScore != ''"> <result column="case_id" jdbcType="VARCHAR" property="caseId" />
and t.project_score=#{projectScore,jdbcType=NUMERIC} <result column="achieve_ment_type" jdbcType="INTEGER" property="achieveMentType" />
</if> <result column="class_id" jdbcType="VARCHAR" property="classId" />
<if test="duration != null and duration != ''"> <result column="course_id" jdbcType="VARCHAR" property="courseId" />
and t.duration=#{duration,jdbcType=INTEGER}
</if> <collection property="assessUserTargetList" column="assess_user_id" ofType="com.blockchain.server.yyyf.entity.AssessUserTarget" javaType="ArrayList">
<if test="durationUnit != null and durationUnit != ''"> <result column="assessUser_target_id" jdbcType="VARCHAR" property="id" />
and t.duration_unit=#{durationUnit,jdbcType=VARCHAR} <result column="assess_user_id" jdbcType="VARCHAR" property="assessUserId" />
</if> <result column="target_name" jdbcType="VARCHAR" property="targetName" />
<if test="projectCaseDesc != null and projectCaseDesc != ''"> <result column="target_id" jdbcType="VARCHAR" property="targetId" />
and t.project_case_desc=#{projectCaseDesc,jdbcType=VARCHAR} <result column="code" jdbcType="VARCHAR" property="code" />
</if> <result column="task_operate" jdbcType="TINYINT" property="taskOperate" />
</sql> <result column="task_rate" jdbcType="DECIMAL" property="taskRate" />
<result column="task_score" jdbcType="DECIMAL" property="taskScore" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="student_rate" jdbcType="DECIMAL" property="studentRate" />
<result column="answer" jdbcType="INTEGER" property="answer" />
</collection>
</resultMap>
<sql id="YfServerAssessUserProject_Column_List">
t.id,
t.assess_user_id,
t.project_name,
t.project_id,
t.project_score,
t.duration,
t.duration_unit,
t.project_case_desc,
</sql>
<insert id="batchInsert" parameterType="java.util.List"> <insert id="batchInsert" parameterType="java.util.List">
insert into yyyf_server_assess_user_target insert into yyyf_server_assess_user_target
@ -63,4 +61,40 @@
</insert> </insert>
<select id="selectAssessUserDtoByIssueId" resultMap="AssessUserDtoMap">
SELECT
u.id,
u.train_id,
u.issue_id,
u.ss_practise_id,
u.user_id,
u.user_name,
u.user_type,
u.total_score,
u.duration,
u.duration_unit,
u.start_time,
u.end_time,
u.case_id,
u.achieve_ment_type,
u.class_id,
u.course_id,
t.id as assessUser_target_id,
t.assess_user_id,
t.target_name,
t.target_id,
t. code,
t.task_operate,
t.task_rate,
t.task_score,
t.sort,
t.student_rate,
t.answer
FROM
yyyf_server_assess_user u,
yyyf_server_assess_user_target t
WHERE
u.id = t.assess_user_id and u.issue_id=#{issueId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save