whycxzp
2021-05-20 d91b5f062a5648ba7e00cb0fe51f1b7c1d3115a6
更新试验接口
2个文件已修改
2个文件已添加
162 ■■■■■ 已修改文件
src/main/java/com/whyc/constant/ExperimentType.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/ExperimentController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/ExperimentPrecondition.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ExperimentService.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/constant/ExperimentType.java
New file
@@ -0,0 +1,40 @@
package com.whyc.constant;
/**
 * 试验类型枚举
 */
public enum ExperimentType {
    RZ("rz", "绕组试验"),
    KZ("kz", "空载试验"),
    FZ("fz", "负载试验"),
    SW("sw", "升温试验"),
    CS("cs", "超速试验"),
    KZFDDS("kzfdds", "空载反电动势试验"),
    ZD("zd", "振动试验"),
    NY("ny", "耐压试验"),
    ZDGL("zdgl", "转动惯量试验");
    ExperimentType(String value, String name) {
        this.value = value;
        this.name = name;
    }
    private String value;
    private String name;
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
src/main/java/com/whyc/controller/ExperimentController.java
@@ -36,12 +36,27 @@
        return service.getExperimentId(type);
    }
    @PostMapping
    @PostMapping("kz")
    @ApiOperation(value = "新增试验-空载")
    public Response addKZ(@RequestBody Experiment<ExperimentBaseDataKZ, ExperimentPoint> experiment){
        return service.addKZ(experiment);
    }
    @GetMapping("checkPrecondition")
    @ApiOperation(value = "检查前置条件",notes = "传入的type选择其一:" +
            "绕组:rz,\n" +
            "空载:kz,\n" +
            "负载:fz,\n" +
            "升温:sw,\n" +
            "超速:cs,\n" +
            "空载反电动势:kzfdds,\n" +
            "振动:zd,\n" +
            "耐压:ny,\n" +
            "转动惯量:zdgl,\n")
    public Response checkPrecondition(String type){
        return service.checkPrecondition(type);
    }
    /*======History======*/
src/main/java/com/whyc/pojo/ExperimentPrecondition.java
New file
@@ -0,0 +1,74 @@
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;
import org.apache.ibatis.type.Alias;
@Alias("ExperimentPrecondition")
@ApiModel
@TableName(schema = "`db_3.5mw_web`" , value = "`tb_experiment_precondition`")
public class ExperimentPrecondition {
    @TableId
    private Integer    id;
    @ApiModelProperty("试验类型")
    private String type;
    @ApiModelProperty("名称")
    private String    name;
    @ApiModelProperty("表名")
    private String    table;
    @ApiModelProperty("字段")
    private String    field;
    @ApiModelProperty("合格值")
    private String    value;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getTable() {
        return table;
    }
    public void setTable(String table) {
        this.table = table;
    }
    public String getField() {
        return field;
    }
    public void setField(String field) {
        this.field = field;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
}
src/main/java/com/whyc/service/ExperimentService.java
@@ -1,10 +1,10 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.ExperimentType;
import com.whyc.dto.ExperimentConditionDTO;
import com.whyc.dto.Response;
import com.whyc.mapper.ExperimentBaseDataKZMapper;
@@ -18,7 +18,6 @@
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -112,4 +111,32 @@
        PageInfo<Experiment> pageInfo = new PageInfo<>(experimentList);
        return new Response<PageInfo<Experiment>>().set(1,pageInfo);
    }
    /**
     * 检查前置条件
     * @param type
     * @return
     */
    public Response checkPrecondition(String type) {
        boolean status = false;
        //空载试验
        if (type.equals(ExperimentType.KZ.getValue())){
            //进线屏开关状态
            //出线屏开关状态
            //大功率整流电源电压
            //直流配电板A排电压
            //直流配电板B排电压
            //油站
            //水站
            //被试电机通讯
        }
        //负载试验
        else if (type.equals(ExperimentType.FZ.getValue())){
        }else{
        }
        return new Response().set(1,status);
    }
}