| | |
| | | } |
| | | |
| | | @PostMapping("startExperimentPoint") |
| | | @ApiOperation(value = "启动测试点",notes = "传入experimentId,duration") |
| | | @ApiOperation(value = "启动测试点",notes = "传入id,duration") |
| | | public Response StartExperimentPoint(@RequestBody ExperimentPoint point){ |
| | | return service.startExperimentPoint(point); |
| | | } |
| | |
| | | import java.util.Date; |
| | | |
| | | public interface ExperimentPointMapper extends CustomMapper<ExperimentPoint>{ |
| | | @Update("update `db_3.5mw_web`.tb_experiment_point set end_time = #{date},status=2 where experiment_id = #{experimentId}") |
| | | Integer updateEndTime(String experimentId, Date date); |
| | | @Update("update `db_3.5mw_web`.tb_experiment_point set end_time = #{date},status=2 where id = #{id}") |
| | | Integer updateEndTime(int id, Date date); |
| | | } |
| | |
| | | package com.whyc.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @TableName(schema = "`db_3.5mw_web`" , value = "`tb_experiment_point`") |
| | | public class ExperimentPoint { |
| | | |
| | | @TableId |
| | | private Integer id; |
| | | @ApiModelProperty("对应试验") |
| | | private String experimentId; |
| | |
| | | //更新测试时间和测试点状态 |
| | | point.setStartTime(new Date()); |
| | | point.setStatus(1); |
| | | UpdateWrapper<ExperimentPoint> wrapper = Wrappers.update(); |
| | | wrapper.eq("experiment_id",point.getExperimentId()); |
| | | pointMapper.update(point,wrapper); |
| | | pointMapper.updateById(point); |
| | | //等待duration时间 |
| | | Integer duration = point.getDuration(); |
| | | Integer durationSecond = duration*60; |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | pointMapper.updateEndTime(point.getExperimentId(),new Date()); |
| | | pointMapper.updateEndTime(point.getId(),new Date()); |
| | | //返回这段时间的测试结果 |
| | | Map<String,String> resMap = new HashMap<>(); |
| | | int value = (int) (100 + Math.random() * 10); |