Merge pull request 'feat/infer_dev_260107' (#307) from feat/infer_dev_260107 into develop

Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/307
This commit is contained in:
2026-01-22 12:16:38 +09:00
5 changed files with 101 additions and 34 deletions

View File

@@ -305,6 +305,8 @@ public class InferenceDetailDto {
Long mapSheetNum;
String mapSheetName;
String subUid;
String pnu;
String passYn;
// @JsonIgnore String gemoStr;
// @JsonIgnore String geomCenterStr;
@@ -323,7 +325,9 @@ public class InferenceDetailDto {
Double classAfterProb,
Long mapSheetNum,
String mapSheetName,
String subUid) {
String subUid,
String pnu,
String passYn) {
this.uuid = uuid;
this.uid = uid;
this.compareYyyy = compareYyyy;
@@ -338,20 +342,8 @@ public class InferenceDetailDto {
this.mapSheetNum = mapSheetNum;
this.mapSheetName = mapSheetName;
this.subUid = subUid;
// this.gemoStr = gemoStr;
// this.geomCenterStr = geomCenterStr;
//
// ObjectMapper mapper = new ObjectMapper();
// JsonNode geomJson;
// JsonNode geomCenterJson;
// try {
// geomJson = mapper.readTree(gemoStr);
// geomCenterJson = mapper.readTree(geomCenterStr);
// } catch (JsonProcessingException e) {
// throw new RuntimeException(e);
// }
// this.gemo = geomJson;
// this.geomCenter = geomCenterJson;
this.pnu = pnu;
this.passYn = passYn;
}
}

View File

@@ -178,6 +178,12 @@ public class InferenceResultDto {
@Schema(description = "uid")
private String uid;
@Schema(description = "uid 앞 8자리")
@JsonProperty("subUid")
public String subUid() {
return this.uid.substring(0, 8).toUpperCase();
}
@Schema(description = "상태명")
@JsonProperty("statusName")
public String statusName() {

View File

@@ -0,0 +1,50 @@
package com.kamco.cd.kamcoback.postgres.entity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.OffsetDateTime;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
@Getter
@Setter
@Entity
@Table(name = "tb_pnu")
public class PnuEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_pnu_id_gen")
@SequenceGenerator(name = "tb_pnu_id_gen", sequenceName = "tb_pnu_uid", allocationSize = 1)
@Column(name = "id", nullable = false)
private Long id;
@NotNull
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "geo_uid", nullable = false)
private MapSheetAnalDataInferenceGeomEntity geo;
@Size(max = 19)
@Column(name = "pnu", length = 19)
private String pnu;
@Column(name = "created_dttm")
private OffsetDateTime createdDttm;
@Column(name = "created_uid")
private Long createdUid;
@ColumnDefault("false")
@Column(name = "del_yn")
private Boolean delYn;
}

View File

@@ -1,8 +1,10 @@
package com.kamco.cd.kamcoback.postgres.repository.Inference;
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx50kEntity.mapInkx50kEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearn5kEntity.mapSheetLearn5kEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
import static com.querydsl.jpa.JPAExpressions.select;
import com.kamco.cd.kamcoback.scheduler.dto.JobStatusDto;
import com.querydsl.core.BooleanBuilder;
@@ -10,7 +12,6 @@ import com.querydsl.core.types.dsl.BooleanPath;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.NumberPath;
import com.querydsl.core.types.dsl.StringPath;
import com.querydsl.jpa.JPAExpressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.util.List;
import java.util.UUID;
@@ -55,7 +56,7 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
}
var learnIdSubQuery =
JPAExpressions.select(mapSheetLearnEntity.id)
select(mapSheetLearnEntity.id)
.from(mapSheetLearnEntity)
.where(mapSheetLearnEntity.uuid.eq(uuid));
@@ -102,7 +103,7 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
}
var learnIdSubQuery =
JPAExpressions.select(mapSheetLearnEntity.id)
select(mapSheetLearnEntity.id)
.from(mapSheetLearnEntity)
.where(mapSheetLearnEntity.uuid.eq(uuid));
@@ -201,24 +202,30 @@ public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryC
.fetch();
}
/**
* 추론 진행 도엽 목록
*
* @param uuid uuid
* @return
*/
@Override
public List<String> getInferenceRunMapId(UUID uuid) {
return queryFactory
.select(mapInkx5kEntity.mapidNm)
.select(mapInkx50kEntity.mapidNm.concat(mapInkx50kEntity.mapidcdNo))
.from(mapInkx50kEntity)
.join(mapInkx5kEntity)
.on(mapInkx5kEntity.mapInkx50k.fid.eq(mapInkx50kEntity.fid))
.where(
mapInkx5kEntity.mapidcdNo.in(
select(
Expressions.stringTemplate(
"CAST({0} AS text)", mapSheetLearn5kEntity.mapSheetNum))
.from(mapSheetLearnEntity)
.innerJoin(mapSheetLearn5kEntity)
.join(mapSheetLearn5kEntity)
.on(mapSheetLearn5kEntity.learn.id.eq(mapSheetLearnEntity.id))
.innerJoin(mapInkx5kEntity)
.on(
Expressions.booleanTemplate(
"function('regexp_match', {0}, '^[0-9]+$') is not null",
mapInkx5kEntity.mapidcdNo)
.and(
mapSheetLearn5kEntity.mapSheetNum.eq(
Expressions.numberTemplate(
Long.class, "cast({0} as long)", mapInkx5kEntity.mapidcdNo))))
.where(mapSheetLearnEntity.uuid.eq(uuid))
.groupBy(mapInkx5kEntity.mapidNm)
.where(mapSheetLearnEntity.uuid.eq(uuid))))
.groupBy(mapInkx50kEntity.mapidcdNo, mapInkx50kEntity.mapidNm)
.orderBy(mapInkx50kEntity.mapidNm.asc())
.fetch();
}
}

View File

@@ -7,6 +7,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceG
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QSystemMetricEntity.systemMetricEntity;
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
@@ -28,6 +29,8 @@ import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.CaseBuilder;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.NumberExpression;
import com.querydsl.core.types.dsl.StringExpression;
import com.querydsl.jpa.JPAExpressions;
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.time.OffsetDateTime;
import java.util.List;
@@ -411,6 +414,13 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
NumberExpression<Long> inkxNoAsLong =
Expressions.numberTemplate(Long.class, "cast({0} as long)", mapInkx5kEntity.mapidcdNo);
StringExpression pnu =
Expressions.stringTemplate(
"coalesce(({0}), '')",
JPAExpressions.select(Expressions.stringTemplate("string_agg({0}, ',')", pnuEntity.pnu))
.from(pnuEntity)
.where(pnuEntity.geo.geoUid.eq(mapSheetAnalDataInferenceGeomEntity.geoUid)));
// 4) content
List<Geom> content =
queryFactory
@@ -430,7 +440,9 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
mapInkx5kEntity.mapidNm,
Expressions.stringTemplate(
"substring({0} from 1 for 8)",
mapSheetAnalDataInferenceGeomEntity.resultUid)))
mapSheetAnalDataInferenceGeomEntity.resultUid),
pnu,
Expressions.nullExpression(String.class)))
.from(mapSheetAnalInferenceEntity)
.join(mapSheetAnalDataInferenceEntity)
.on(mapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))