新增检测详情参数组装接口
This commit is contained in:
@@ -27,7 +27,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -208,5 +207,15 @@ public class PqScriptController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, checkData, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, checkData, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/getScriptDtlsDesc")
|
||||||
|
@ApiOperation("通讯脚本回显")
|
||||||
|
@ApiImplicitParam(name = "param", value = "检测脚本", required = true)
|
||||||
|
public HttpResult<String> getScriptDtlsDesc(@RequestBody @Validated ScriptParam.Desc param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getScriptDtlsDesc");
|
||||||
|
String checkData = pqScriptDtlsService.getScriptDtlsDesc(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, checkData, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -25,4 +27,23 @@ public class ScriptParam {
|
|||||||
|
|
||||||
@ApiModelProperty("是否启用脚本(状态:0-不启用 1-启用)")
|
@ApiModelProperty("是否启用脚本(状态:0-不启用 1-启用)")
|
||||||
private Integer enable;
|
private Integer enable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Desc{
|
||||||
|
|
||||||
|
@ApiModelProperty("检测脚本id")
|
||||||
|
@NotBlank(message = DetectionValidMessage.ID_FORMAT_ERROR)
|
||||||
|
private String scriptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("检测脚本序号")
|
||||||
|
@NotNull(message = "检测脚本序号错误,请检查参数是否为空")
|
||||||
|
private Integer index;
|
||||||
|
|
||||||
|
@ApiModelProperty("额定电压")
|
||||||
|
private BigDecimal devVolt;
|
||||||
|
|
||||||
|
@ApiModelProperty("额定电流")
|
||||||
|
private BigDecimal devCurr;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,4 +113,12 @@ public interface IPqScriptDtlsService extends IService<PqScriptDtls> {
|
|||||||
*/
|
*/
|
||||||
List<PqScriptCheckData> checkDataList(ScriptParam param);
|
List<PqScriptCheckData> checkDataList(ScriptParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 获取脚本详情描述
|
||||||
|
* @param param
|
||||||
|
* @return: java.lang.String
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2025/3/31 9:40
|
||||||
|
*/
|
||||||
|
String getScriptDtlsDesc(ScriptParam.Desc param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
checkDataParam.setIndex(freqDtls.getScriptIndex());
|
checkDataParam.setIndex(freqDtls.getScriptIndex());
|
||||||
checkDataParam.setIsValueTypeName(true);
|
checkDataParam.setIsValueTypeName(true);
|
||||||
issue.setDevValueTypeList(pqScriptCheckDataService.getValueType(checkDataParam));
|
issue.setDevValueTypeList(pqScriptCheckDataService.getValueType(checkDataParam));
|
||||||
issue.setDesc(ScriptDtlsDesc.getStringBuffer(value,true, isValueType).toString());
|
issue.setDesc(ScriptDtlsDesc.getStringBuffer(value, true, isValueType).toString());
|
||||||
issue.setScriptId(freqDtls.getScriptId());
|
issue.setScriptId(freqDtls.getScriptId());
|
||||||
issue.setFUn(volt);
|
issue.setFUn(volt);
|
||||||
issue.setFIn(curr);
|
issue.setFIn(curr);
|
||||||
@@ -648,6 +648,39 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getScriptDtlsDesc(ScriptParam.Desc param) {
|
||||||
|
Boolean isValueType = pqScriptMapper.selectScriptIsValueType(param.getScriptId());
|
||||||
|
MPJLambdaWrapper<PqScriptDtls> queryWrapper = new MPJLambdaWrapper<>();
|
||||||
|
queryWrapper.selectAll(PqScriptDtls.class)
|
||||||
|
.selectAs(DictTree::getCode, PqScriptDtls::getScriptCode)
|
||||||
|
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
|
||||||
|
.in(PqScriptDtls::getScriptIndex, param.getIndex())
|
||||||
|
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode())
|
||||||
|
.orderByAsc(PqScriptCheckData::getScriptIndex)
|
||||||
|
.eq(PqScriptDtls::getScriptId, param.getScriptId());
|
||||||
|
|
||||||
|
//先获取检测脚本类型是否相对值 true相对值 false绝对值(相对值要乘额定值,绝对值不需要处理)
|
||||||
|
List<PqScriptDtls> pqScriptDtls = this.getBaseMapper().selectJoinList(PqScriptDtls.class, queryWrapper);
|
||||||
|
if (isValueType) {
|
||||||
|
for (PqScriptDtls pqScriptDtl : pqScriptDtls) {
|
||||||
|
if (VOL.equals(pqScriptDtl.getValueType())) {
|
||||||
|
BigDecimal volValue = new BigDecimal(pqScriptDtl.getValue());
|
||||||
|
BigDecimal result = volValue.multiply(param.getDevVolt())
|
||||||
|
.divide(new BigDecimal(100), 4, BigDecimal.ROUND_HALF_UP);
|
||||||
|
pqScriptDtl.setValue(result.doubleValue());
|
||||||
|
}
|
||||||
|
if (CUR.equals(pqScriptDtl.getValueType())) {
|
||||||
|
BigDecimal volValue = new BigDecimal(pqScriptDtl.getValue());
|
||||||
|
BigDecimal result = volValue.multiply(param.getDevCurr())
|
||||||
|
.divide(new BigDecimal(100), 4, BigDecimal.ROUND_HALF_UP);
|
||||||
|
pqScriptDtl.setValue(result.doubleValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ScriptDtlsDesc.getStringBuffer(pqScriptDtls, true, isValueType).toString();
|
||||||
|
}
|
||||||
|
|
||||||
private void unbanCheck(List<PqScriptDtlsParam.CheckData> info,
|
private void unbanCheck(List<PqScriptDtlsParam.CheckData> info,
|
||||||
PqScriptDtlsParam.CheckData channelListDTO,
|
PqScriptDtlsParam.CheckData channelListDTO,
|
||||||
List<PqScriptDtlsParam.ChannelListDTO> list,
|
List<PqScriptDtlsParam.ChannelListDTO> list,
|
||||||
|
|||||||
@@ -86,5 +86,10 @@ public class RawResultDataVO {
|
|||||||
* 误差值
|
* 误差值
|
||||||
*/
|
*/
|
||||||
private BigDecimal errorData;
|
private BigDecimal errorData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user