Commit 76f2e70b authored by tianbo's avatar tianbo

feat(validation): 优化气瓶充装数据校验逻辑并修复字段类型错误

- 添加充装前后数据一致性校验,确保三个数组长度相等 - 实现预校验方法preValidateData验证基础字段完整性 - 重构校验逻辑将原始字符串列表改为JSON对象列表返回详细错误信息 - 修复componentContents字段类型从Double改为String以支持多组分含量 - 修正枚举类中的字段名称映射错误 - 优化错误处理逻辑提供更精确的错误定位信息
parent be956de4
......@@ -45,7 +45,7 @@ public enum CylinderTypeFieldValidation {
isNoBulgingOrLeakage2(CylinderType.LIQUEFIED_GAS_LPG, "isNoBulgingOrLeakage", true, false, new String[]{CylinderField.FillStage.AFTER.getCode()}, "瓶体未出现鼓包变形或泄漏等严重缺陷"),
isTemperatureNormal2(CylinderType.LIQUEFIED_GAS_LPG, "isTemperatureNormal", true, false, new String[]{CylinderField.FillStage.AFTER.getCode()}, "瓶体温度没有异常升高的迹象"),
hasWarningAndFillingLabels(CylinderType.LIQUEFIED_GAS_LPG, "hasWarningAndFillingLabels", true, false, new String[]{CylinderField.FillStage.AFTER.getCode()}, "气瓶粘贴警示标签和充装标签)"),
reweighedWithinLimit(CylinderType.LIQUEFIED_GAS_LPG, "hasWarningAndFillingLabels", true, false, new String[]{CylinderField.FillStage.AFTER.getCode()}, "充装量复秤未超重"),
reweighedWithinLimit(CylinderType.LIQUEFIED_GAS_LPG, "reweighedWithinLimit", true, false, new String[]{CylinderField.FillStage.AFTER.getCode()}, "充装量复秤未超重"),
// 压缩气体气瓶 COMPRESSED_GAS
......@@ -106,7 +106,7 @@ public enum CylinderTypeFieldValidation {
oxidizingGasCylinderFreeOfOil(CylinderType.MIXED_GAS, "oxidizingGasCylinderFreeOfOil", true, false, new String[]{CylinderField.FillStage.BEFORE.getCode()}, "氧化性混合气体的瓶体、瓶阀未沾染油脂"),
preTreatedSuccessfully(CylinderType.MIXED_GAS, "preTreatedSuccessfully", true, false, new String[]{CylinderField.FillStage.BEFORE.getCode()}, "气瓶经预处理(抽真空、烘干、置换或组合)合格"),
fillingPressure5(CylinderType.MIXED_GAS, "fillingPressureLessThan", true, false, new String[]{CylinderField.FillStage.FILLING.getCode()}, "充装压力"),
fillingPressure5(CylinderType.MIXED_GAS, "fillingPressure", true, false, new String[]{CylinderField.FillStage.FILLING.getCode()}, "充装压力"),
fillingAmount5(CylinderType.MIXED_GAS, "fillingAmount", true, false, new String[]{CylinderField.FillStage.FILLING.getCode()}, "充装量"),
componentContents(CylinderType.MIXED_GAS, "componentContents", true, false, new String[]{CylinderField.FillStage.FILLING.getCode()}, "各组分含量"),
abnormalConditions5(CylinderType.MIXED_GAS, "abnormalConditions", true, false, new String[]{CylinderField.FillStage.FILLING.getCode()}, "异常情况"),
......
......@@ -58,7 +58,7 @@ public class TmCylinderFillingRecordModel extends CylinderAbstractBaseModel {
private Double acetyleneFillingAmount;
@ApiModelProperty(value = "各组分含量")
private Double componentContents;
private String componentContents;
@ApiModelProperty(value = "标称皮重")
private Double tareWeightNominal;
......
......@@ -64,7 +64,7 @@ public class TmCylinderFillingRecord extends CylinderAbstractBaseEntity {
private Double acetyleneFillingAmount;
@ApiModelProperty(value = "各组分含量")
private Double componentContents;
private String componentContents;
@ApiModelProperty(value = "标称皮重")
private Double tareWeightNominal;
......
......@@ -206,8 +206,9 @@ public class CylinderService {
cylinderFillingMessageEntity.setCylinderNumber(validateResult.getCylinderNumber());
List<String> logMessage = new ArrayList<>();
int errorNumber = 0;
JSONObject error = new JSONObject();
if (!ObjectUtils.isEmpty(validateResult.getBeforeErrorData())) {
JSONObject error = new JSONObject();
errorNumber += validateResult.getBeforeErrorData().size();
error.put("充装前检查错误数据:", validateResult.getBeforeErrorData());
errorData.add(error);
......@@ -216,6 +217,7 @@ public class CylinderService {
}
if (!ObjectUtils.isEmpty(validateResult.getRecordErrorData())) {
JSONObject error = new JSONObject();
errorNumber += validateResult.getRecordErrorData().size();
error.put("充装记录错误数据:", validateResult.getRecordErrorData());
errorData.add(error);
......@@ -224,6 +226,7 @@ public class CylinderService {
}
if (!ObjectUtils.isEmpty(validateResult.getAfterErrorData())) {
JSONObject error = new JSONObject();
errorNumber += validateResult.getAfterErrorData().size();
error.put("充装后复查错误数据:", validateResult.getAfterErrorData());
errorData.add(error);
......@@ -232,6 +235,7 @@ public class CylinderService {
}
if (!ObjectUtils.isEmpty(validateResult.getSeqCodeErrorData())) {
JSONObject error = new JSONObject();
errorNumber += validateResult.getSeqCodeErrorData().size();
error.put("气瓶信息不存在:", validateResult.getSeqCodeErrorData());
errorData.add(error);
......
......@@ -210,7 +210,7 @@ public class ESCylinderFillingInfoDto {
@Field(type = FieldType.Keyword)
@ApiModelProperty(value = "各组分含量")
private Double componentContents;
private String componentContents;
@Field(type = FieldType.Double)
@ApiModelProperty(value = "标称皮重")
......
......@@ -70,7 +70,7 @@ public class CylinderFillingRecord extends CylinderFillingBaseEntity {
private Double acetyleneFillingAmount;
@ApiModelProperty(value = "各组分含量")
private Double componentContents;
private String componentContents;
@ApiModelProperty(value = "标称皮重")
private Double tareWeightNominal;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment