This commit is contained in:
2023-09-16 21:20:38 +08:00
parent de17b5cd90
commit b1afcae0e2
3 changed files with 108 additions and 6 deletions

View File

@@ -29,11 +29,7 @@ public class CoalBlendCoalInfoEntity extends OrgCommonEntity {
private CoalBlendEntity coal;
@ElementCollection
private List<CoalPercentVo> percentInfos;
@ManyToOne
private CoalBlendEntity result;
@Comment("比例最小值")

View File

@@ -37,7 +37,7 @@ public class CoalBlendEntity extends OrgCommonEntity {
private CoalBlendConstrainVo constrains;
@OneToMany(mappedBy = "result")
private List<CoalBlendCoalInfoEntity> results;
private List<CoalBlendResultInfoEntity> results;
@Enumerated(value = EnumType.STRING)
@NotNull()
@@ -308,7 +308,7 @@ public class CoalBlendEntity extends OrgCommonEntity {
@Override
public void onSolutionCallback() {
CoalBlendCoalInfoEntity vo = new CoalBlendCoalInfoEntity();
CoalBlendResultInfoEntity vo = new CoalBlendResultInfoEntity();
vo.setPercentInfos(Stream.ofAll(coals).zip(percentVal).zip(gcdVal).map(t -> new CoalPercentVo(t._1._1.getName(), ((double) (value(t._1._2))), (double) value(t._2))).toJavaList());

View File

@@ -0,0 +1,106 @@
package cn.lihongjie.coal.coalBlend.entity;
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
import jakarta.persistence.ManyToOne;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotEmpty;
import lombok.*;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.hibernate.annotations.Comment;
import org.hibernate.validator.constraints.Range;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@With
@Entity
public class CoalBlendResultInfoEntity extends OrgCommonEntity {
@NotEmpty(message = "煤名称不能为空")
private String name;
@ElementCollection
private List<CoalPercentVo> percentInfos;
@ManyToOne
private CoalBlendEntity result;
@Comment("参数 1 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param1;
@Comment("参数 2 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param2;
@Comment("参数 3 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param3;
@Comment("参数 4 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param4;
@Comment("参数 5 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param5;
@Comment("参数 6 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param6;
@Comment("参数 7 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param7;
@Comment("参数 8 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param8;
@Comment("参数 9 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param9;
@Comment("参数 10 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param10;
@Comment("参数 11 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param11;
@Comment("参数 12 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param12;
@Comment("参数 13 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param13;
@Comment("参数 14 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param14;
@Comment("参数 15 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param15;
@Comment("参数 16 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param16;
@Comment("参数 17 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param17;
@Comment("参数 18 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param18;
@Comment("参数 19 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param19;
@Comment("参数 20 ")
@DecimalMin(groups = CoalBlendEntity.BlendGroup.class, value = "0.1", inclusive = true, message = "参数不能小于0.1")
private Double param20;
@SneakyThrows
public Double getParam(String param) {
return (Double) FieldUtils.getField(this.getClass(), param, true).get(this);
}
}