swagger调整

This commit is contained in:
2025-11-04 10:34:08 +08:00
parent dae10378dd
commit 563eb80b65
2 changed files with 23 additions and 17 deletions

View File

@@ -2034,8 +2034,10 @@ public class ResultServiceImpl implements IResultService {
int totalDataPoints = 0; // 统计总的数据点数
int zeroFilteredPoints = 0; // 统计双零过滤的数据点数
// 遍历 2~50 次谐波
for (int harmNum = 2; harmNum <= 50; harmNum++) {
// 间谐波从1开始普通谐波从2开始
int startHarmNum = isInterHarmonic ? 1 : 2;
// 遍历谐波次数
for (int harmNum = startHarmNum; harmNum <= 50; harmNum++) {
String harmKey = String.valueOf(harmNum);
Map<String, Map<String, Map<String, String>>> checkResultHarmonic = new LinkedHashMap<>();
List<String> zeroFilteredPhases = new ArrayList<>(); // 当前次数被过滤的相别
@@ -2380,10 +2382,8 @@ public class ResultServiceImpl implements IResultService {
contrastTestResult.setHarmonic(false);
List<String> allResult = new ArrayList<>();
Map<String, Map<String, String>> checkResultNonHarmonic = new LinkedHashMap<>();
// 根据指标代码确定小数位数
Integer decimalPlaces = getDecimalPlacesByScriptCode(dictTree.getCode());
try {
// 非谐波的需要注意是否为T相还是ABC三相的
if (PowerConstant.T_PHASE.contains(dictTree.getCode())) {
@@ -2509,27 +2509,22 @@ public class ResultServiceImpl implements IResultService {
Map<String, String> dataMap = new LinkedHashMap<>();
if (CollUtil.isNotEmpty(dataList)) {
DetectionData detectionData = dataList.get(0);
// 相别
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
// 有效组数 todo... 目前是对齐组数
dataMap.put(ItemReportKeyEnum.NUM_OF_DATA.getKey(), String.valueOf(numOfData));
// 标准值 - 根据参数决定是否格式化
String standardValue = String.valueOf(detectionData.getResultData());
if (decimalPlaces != null && detectionData.getResultData() != null) {
standardValue = formatSignificantDigits(detectionData.getResultData(), decimalPlaces);
}
dataMap.put(ItemReportKeyEnum.STANDARD.getKey(), standardValue);
// 被检值 - 根据参数决定是否格式化
String testValue = String.valueOf(detectionData.getData());
if (decimalPlaces != null && detectionData.getData() != null) {
testValue = formatSignificantDigits(detectionData.getData(), decimalPlaces);
}
dataMap.put(ItemReportKeyEnum.TEST.getKey(), testValue);
// 误差 - 根据参数决定是否格式化
String errorValue = String.valueOf(detectionData.getErrorData());
if (decimalPlaces != null && detectionData.getErrorData() != null) {
@@ -2538,7 +2533,6 @@ public class ResultServiceImpl implements IResultService {
errorValue = "/";
}
dataMap.put(ItemReportKeyEnum.ERROR.getKey(), errorValue);
// 误差范围 - 根据参数决定是否格式化
String errorScope = String.valueOf(detectionData.getRadius());
if (decimalPlaces != null && detectionData.getRadius() != null) {
@@ -2547,7 +2541,6 @@ public class ResultServiceImpl implements IResultService {
errorScope = "/";
}
dataMap.put(ItemReportKeyEnum.A_ERROR_SCOPE.getKey(), errorScope);
// 结论
dataMap.put(ItemReportKeyEnum.RESULT.getKey(), getTestResult(detectionData.getIsData()));
} else {
@@ -2642,8 +2635,20 @@ public class ResultServiceImpl implements IResultService {
Map<String, String> dataMap = new LinkedHashMap<>();
if (CollUtil.isNotEmpty(dataList)) {
DetectionData detectionData = dataList.get(0);
// 次数
dataMap.put(ItemReportKeyEnum.TIME.getKey(), String.valueOf(harmNum));
// 次数 - 从数据对象中获取实际次数间谐波为1.5、2.5等)
String timeValue;
if (detectionData.getNum() != null) {
double numValue = detectionData.getNum();
// 如果是整数则只显示整数部分如2.0显示为2
if (numValue == Math.floor(numValue)) {
timeValue = String.valueOf((int) numValue);
} else {
timeValue = String.valueOf(numValue);
}
} else {
timeValue = String.valueOf(harmNum);
}
dataMap.put(ItemReportKeyEnum.TIME.getKey(), timeValue);
// 相别
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
// 有效组数 todo... 目前是对齐组数
@@ -2684,7 +2689,7 @@ public class ResultServiceImpl implements IResultService {
// 结论
dataMap.put(ItemReportKeyEnum.RESULT.getKey(), getTestResult(detectionData.getIsData()));
} else {
// 次数
// 次数 - 数据为空时用循环变量作为兜底
dataMap.put(ItemReportKeyEnum.TIME.getKey(), String.valueOf(harmNum));
// 相别
dataMap.put(ItemReportKeyEnum.PHASE.getKey(), phase);
@@ -3596,7 +3601,7 @@ public class ResultServiceImpl implements IResultService {
switch (scriptCode) {
// 保留2位小数
case "FREQ": // 频率
return 2;
return 4;
// 保留3位小数
case "I": // 电流
return 3;

View File

@@ -6,6 +6,7 @@ import com.njcn.common.pojo.constant.SecurityConstants;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.JwtUtil;
import com.njcn.web.utils.HttpResultUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
@@ -24,7 +25,7 @@ import java.util.List;
@Slf4j
@Component
public class AuthGlobalFilter implements Filter, Ordered {
private final static List<String> IGNORE_URI = Arrays.asList("/doc.html", "/admin/login", "/admin/getPublicKey", "/report/generateReport");
private final static List<String> IGNORE_URI = Arrays.asList("/doc.html","/v3/api-docs","/admin/login","/admin/getPublicKey", "/report/generateReport");
@Override
public int getOrder() {
@@ -41,7 +42,7 @@ public class AuthGlobalFilter implements Filter, Ordered {
res.setContentType("application/json; charset=utf-8");
String requestURI = req.getRequestURI();
if (IGNORE_URI.contains(requestURI)) {
if (IGNORE_URI.contains(requestURI) || requestURI.startsWith("/webjars") || requestURI.startsWith("/swagger-resources")) {
filterChain.doFilter(req, res);
} else {
String accessTokenStr = req.getHeader(SecurityConstants.AUTHORIZATION_KEY);