Browse Source

开始训练的消息

pt
zy_Java 5 years ago
parent
commit
a4f1880547
  1. 4
      mt/src/main/resources/mapper_dao/CompeteProjectDao.xml
  2. 9
      recovery/src/main/java/com/ccsens/recovery/api/PatientController.java
  3. 6
      recovery/src/main/java/com/ccsens/recovery/bean/dto/PatientDto.java
  4. 1
      recovery/src/main/java/com/ccsens/recovery/bean/message/RecoveryWithStartDrill.java
  5. 6
      recovery/src/main/java/com/ccsens/recovery/bean/vo/PatientVo.java
  6. 7
      recovery/src/main/java/com/ccsens/recovery/service/IPatientService.java
  7. 16
      recovery/src/main/java/com/ccsens/recovery/service/PatientService.java
  8. 2
      recovery/src/main/resources/mapper_dao/PatientDao.xml

4
mt/src/main/resources/mapper_dao/CompeteProjectDao.xml

@ -76,7 +76,7 @@
FROM FROM
t_compete_project_player pp t_compete_project_player pp
LEFT JOIN t_compete_player p on pp.player_id = p.id and p.rec_status = 0 LEFT JOIN t_compete_player p on pp.player_id = p.id and p.rec_status = 0
LEFT JOIN t_compete_group g on p.compete_group_id = g.id and g.rec_status = 0 and g.type = 5 LEFT JOIN t_compete_group g on p.compete_group_id = g.id and g.rec_status = 0 and g.type = 4
LEFT JOIN t_compete_company c on p.company_id = c.id and c.rec_status = 0 LEFT JOIN t_compete_company c on p.company_id = c.id and c.rec_status = 0
WHERE WHERE
pp.project_id = #{projectId} pp.project_id = #{projectId}
@ -91,7 +91,7 @@
t.id t.id
FROM FROM
t_compete_team t t_compete_team t
LEFT JOIN t_compete_group g on t.group_remark = g.group_remark and t.gender_group = g.sex and g.rec_status = 0 and g.type = 5 LEFT JOIN t_compete_group g on t.group_remark = g.group_remark and t.gender_group = g.sex and g.rec_status = 0 and g.type = 4
LEFT JOIN t_compete_company c on t.company_id = c.id and c.rec_status = 0 LEFT JOIN t_compete_company c on t.company_id = c.id and c.rec_status = 0
WHERE WHERE
t.project_id = #{projectId} t.project_id = #{projectId}

9
recovery/src/main/java/com/ccsens/recovery/api/PatientController.java

@ -111,6 +111,15 @@ public class PatientController {
return JsonResponse.newInstance().ok(recipeRecordId); return JsonResponse.newInstance().ok(recipeRecordId);
} }
@MustLogin
@ApiOperation(value = "倒计时结束", notes = "zy:")
@RequestMapping(value = "/countdown", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse countdown(@ApiParam @Validated @RequestBody QueryDto<PatientDto.PatientId> params) throws Exception {
log.info("倒计时结束:{}",params);
patientService.countdown(params.getParam(),params.getUserId());
return JsonResponse.newInstance().ok();
}
@ApiOperation(value = "结束训练", notes = "zy:") @ApiOperation(value = "结束训练", notes = "zy:")
@RequestMapping(value = "/end", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @RequestMapping(value = "/end", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse endDrill(@ApiParam @Validated @RequestBody QueryDto<PatientDto.EndDrill> params) { public JsonResponse endDrill(@ApiParam @Validated @RequestBody QueryDto<PatientDto.EndDrill> params) {

6
recovery/src/main/java/com/ccsens/recovery/bean/dto/PatientDto.java

@ -110,6 +110,12 @@ public class PatientDto {
@ApiModelProperty("训练的分数") @ApiModelProperty("训练的分数")
private int score; private int score;
} }
@Data
@ApiModel("训练记录id")
public static class RecordId{
@ApiModelProperty("训练记录id")
private Long id;
}
@Data @Data
@ApiModel("动作反馈") @ApiModel("动作反馈")

1
recovery/src/main/java/com/ccsens/recovery/bean/message/RecoveryWithStartDrill.java

@ -23,6 +23,7 @@ public class RecoveryWithStartDrill extends BaseMessageDto{
private Long projectId; private Long projectId;
//任务详情id //任务详情id
private Long taskDetailId; private Long taskDetailId;
private Long subTaskId = 1402180562474635420L;
//插件名 //插件名
private String pluginName = "start_training"; private String pluginName = "start_training";
} }

6
recovery/src/main/java/com/ccsens/recovery/bean/vo/PatientVo.java

@ -54,6 +54,12 @@ public class PatientVo {
private Long id; private Long id;
@ApiModelProperty("训练状态 0未开始 1进行中 2已结束") @ApiModelProperty("训练状态 0未开始 1进行中 2已结束")
private int status; private int status;
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("时长")
private Long duration = 60000L;
@ApiModelProperty("分数")
private int score = 11;
} }
@Data @Data

7
recovery/src/main/java/com/ccsens/recovery/service/IPatientService.java

@ -99,4 +99,11 @@ public interface IPatientService {
* @return 返回训练的状态 * @return 返回训练的状态
*/ */
PatientVo.RecordStatus getDrillStatus(PatientDto.SubTimeTaskId param, Long userId); PatientVo.RecordStatus getDrillStatus(PatientDto.SubTimeTaskId param, Long userId);
/**
* 倒计时结束通知患者
* @param param 患者id
* @param userId userId
*/
void countdown(PatientDto.PatientId param, Long userId);
} }

16
recovery/src/main/java/com/ccsens/recovery/service/PatientService.java

@ -147,12 +147,12 @@ public class PatientService implements IPatientService{
data.setRecordId(recRecord.getId()); data.setRecordId(recRecord.getId());
data.setGameId(param.getGameId()); data.setGameId(param.getGameId());
data.setProjectId(patient.getProjectId()); data.setProjectId(patient.getProjectId());
data.setTaskDetailId(projectDecompose.getTaskId()); // data.setTaskDetailId(projectDecompose.getTaskId());
recoveryWithStartDrill.setData(data); recoveryWithStartDrill.setData(data);
//查询接收者 //查询接收者
Set<String> userIdSet = new HashSet<>(); Set<String> userIdSet = new HashSet<>();
userIdSet.add(param.getPatientId().toString()); userIdSet.add(patient.getUserId().toString());
// RecoveryRobot recoveryRobot = patientDao.getRobotByPatientId(param.getPatientId()); // RecoveryRobot recoveryRobot = patientDao.getRobotByPatientId(param.getPatientId());
// if(ObjectUtil.isNotNull(recoveryRobot)){ // if(ObjectUtil.isNotNull(recoveryRobot)){
// userIdSet.add(recoveryRobot.getUserid().toString()); // userIdSet.add(recoveryRobot.getUserid().toString());
@ -287,10 +287,12 @@ public class PatientService implements IPatientService{
if(ObjectUtil.isNotNull(recipeRecord.getStartTime()) && ObjectUtil.isNotNull(recipeRecord.getEndTime())){ if(ObjectUtil.isNotNull(recipeRecord.getStartTime()) && ObjectUtil.isNotNull(recipeRecord.getEndTime())){
if(recipeRecord.getStartTime() != 0 && recipeRecord.getEndTime() == 0){ if(recipeRecord.getStartTime() != 0 && recipeRecord.getEndTime() == 0){
recordStatus.setStatus(1); recordStatus.setStatus(1);
recordStatus.setStartTime(recipeRecord.getStartTime());
return recordStatus; return recordStatus;
} }
if(recipeRecord.getEndTime() != 0){ if(recipeRecord.getEndTime() != 0){
recordStatus.setStatus(2); recordStatus.setStatus(2);
recordStatus.setStartTime(recipeRecord.getStartTime());
return recordStatus; return recordStatus;
} }
} }
@ -298,4 +300,14 @@ public class PatientService implements IPatientService{
recordStatus.setStatus(0); recordStatus.setStatus(0);
return recordStatus; return recordStatus;
} }
@Override
public void countdown(PatientDto.PatientId param, Long userId) {
//查询患者信息
Patient patient = patientDao.selectByPrimaryKey(param.getId());
if(ObjectUtil.isNotNull(patient)){
}
}
} }

2
recovery/src/main/resources/mapper_dao/PatientDao.xml

@ -156,7 +156,7 @@
and rp.rec_status = 0 and rp.rec_status = 0
and rpd.rec_status = 0 and rpd.rec_status = 0
and rd.rec_status = 0 and rd.rec_status = 0
and rpd.task_id = #{detailId} and rpd.robot_task_id = #{detailId}
</select> </select>
<select id="getRobotByPatientId" resultType="com.ccsens.recovery.bean.po.RecoveryRobot"> <select id="getRobotByPatientId" resultType="com.ccsens.recovery.bean.po.RecoveryRobot">
SELECT SELECT

Loading…
Cancel
Save