[KC-108] ai api batch 작업중
This commit is contained in:
@@ -29,22 +29,20 @@ public class InferenceDetailDto {
|
||||
private String dataName;
|
||||
private Long mapSheepNum;
|
||||
private Long detectingCnt;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime analStrtDttm;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime analEndDttm;
|
||||
@JsonFormatDttm private ZonedDateTime analStrtDttm;
|
||||
@JsonFormatDttm private ZonedDateTime analEndDttm;
|
||||
private Long analSec;
|
||||
private String analState;
|
||||
|
||||
public Basic(
|
||||
Long id,
|
||||
String dataName,
|
||||
Long mapSheepNum,
|
||||
Long detectingCnt,
|
||||
ZonedDateTime analStrtDttm,
|
||||
ZonedDateTime analEndDttm,
|
||||
Long analSec,
|
||||
String analState) {
|
||||
Long id,
|
||||
String dataName,
|
||||
Long mapSheepNum,
|
||||
Long detectingCnt,
|
||||
ZonedDateTime analStrtDttm,
|
||||
ZonedDateTime analEndDttm,
|
||||
Long analSec,
|
||||
String analState) {
|
||||
this.id = id;
|
||||
this.dataName = dataName;
|
||||
this.mapSheepNum = mapSheepNum;
|
||||
@@ -63,10 +61,8 @@ public class InferenceDetailDto {
|
||||
private Long id;
|
||||
private String analTitle;
|
||||
private Long detectingCnt;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime analStrtDttm;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime analEndDttm;
|
||||
@JsonFormatDttm private ZonedDateTime analStrtDttm;
|
||||
@JsonFormatDttm private ZonedDateTime analEndDttm;
|
||||
private Long analSec;
|
||||
private Long analPredSec;
|
||||
private String analState;
|
||||
@@ -74,16 +70,16 @@ public class InferenceDetailDto {
|
||||
private String gukyuinUsed;
|
||||
|
||||
public AnalResList(
|
||||
Long id,
|
||||
String analTitle,
|
||||
Long detectingCnt,
|
||||
ZonedDateTime analStrtDttm,
|
||||
ZonedDateTime analEndDttm,
|
||||
Long analSec,
|
||||
Long analPredSec,
|
||||
String analState,
|
||||
String analStateNm,
|
||||
String gukyuinUsed) {
|
||||
Long id,
|
||||
String analTitle,
|
||||
Long detectingCnt,
|
||||
ZonedDateTime analStrtDttm,
|
||||
ZonedDateTime analEndDttm,
|
||||
Long analSec,
|
||||
Long analPredSec,
|
||||
String analState,
|
||||
String analStateNm,
|
||||
String gukyuinUsed) {
|
||||
this.id = id;
|
||||
this.analTitle = analTitle;
|
||||
this.detectingCnt = detectingCnt;
|
||||
@@ -106,10 +102,8 @@ public class InferenceDetailDto {
|
||||
private String modelInfo;
|
||||
private Integer targetYyyy;
|
||||
private Integer compareYyyy;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime analStrtDttm;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime analEndDttm;
|
||||
@JsonFormatDttm private ZonedDateTime analStrtDttm;
|
||||
@JsonFormatDttm private ZonedDateTime analEndDttm;
|
||||
private Long analSec;
|
||||
private Long analPredSec;
|
||||
private String resultUrl;
|
||||
@@ -119,20 +113,20 @@ public class InferenceDetailDto {
|
||||
private String analStateNm;
|
||||
|
||||
public AnalResSummary(
|
||||
Long id,
|
||||
String analTitle,
|
||||
String modelInfo,
|
||||
Integer targetYyyy,
|
||||
Integer compareYyyy,
|
||||
ZonedDateTime analStrtDttm,
|
||||
ZonedDateTime analEndDttm,
|
||||
Long analSec,
|
||||
Long analPredSec,
|
||||
String resultUrl,
|
||||
Long detectingCnt,
|
||||
Double accuracy,
|
||||
String analState,
|
||||
String analStateNm) {
|
||||
Long id,
|
||||
String analTitle,
|
||||
String modelInfo,
|
||||
Integer targetYyyy,
|
||||
Integer compareYyyy,
|
||||
ZonedDateTime analStrtDttm,
|
||||
ZonedDateTime analEndDttm,
|
||||
Long analSec,
|
||||
Long analPredSec,
|
||||
String resultUrl,
|
||||
Long detectingCnt,
|
||||
Double accuracy,
|
||||
String analState,
|
||||
String analStateNm) {
|
||||
this.id = id;
|
||||
this.analTitle = analTitle;
|
||||
this.modelInfo = modelInfo;
|
||||
@@ -189,17 +183,16 @@ public class InferenceDetailDto {
|
||||
private Clazzes target;
|
||||
private MapSheet mapSheet;
|
||||
private Coordinate center;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime updatedDttm;
|
||||
@JsonFormatDttm private ZonedDateTime updatedDttm;
|
||||
|
||||
public DetailListEntity(
|
||||
UUID uuid,
|
||||
Double detectionScore,
|
||||
Clazzes compare,
|
||||
Clazzes target,
|
||||
MapSheet mapSheet,
|
||||
Coordinate center,
|
||||
ZonedDateTime updatedDttm) {
|
||||
UUID uuid,
|
||||
Double detectionScore,
|
||||
Clazzes compare,
|
||||
Clazzes target,
|
||||
MapSheet mapSheet,
|
||||
Coordinate center,
|
||||
ZonedDateTime updatedDttm) {
|
||||
this.code = new Uid(uuid);
|
||||
this.detectionScore = detectionScore;
|
||||
this.compare = compare;
|
||||
@@ -240,8 +233,7 @@ public class InferenceDetailDto {
|
||||
|
||||
private String code;
|
||||
private String name;
|
||||
@JsonIgnore
|
||||
private Double score;
|
||||
@JsonIgnore private Double score;
|
||||
|
||||
public Clazz(String code, Double score) {
|
||||
this.code = code;
|
||||
@@ -308,23 +300,21 @@ public class InferenceDetailDto {
|
||||
String classAfterName;
|
||||
Double classAfterProb;
|
||||
Long mapSheetNum;
|
||||
@JsonIgnore
|
||||
String gemoStr;
|
||||
@JsonIgnore
|
||||
String geomCenterStr;
|
||||
@JsonIgnore String gemoStr;
|
||||
@JsonIgnore String geomCenterStr;
|
||||
JsonNode gemo;
|
||||
JsonNode geomCenter;
|
||||
|
||||
public Geom(
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy,
|
||||
String classBeforeCd,
|
||||
Double classBeforeProb,
|
||||
String classAfterCd,
|
||||
Double classAfterProb,
|
||||
Long mapSheetNum,
|
||||
String gemoStr,
|
||||
String geomCenterStr) {
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy,
|
||||
String classBeforeCd,
|
||||
Double classBeforeProb,
|
||||
String classAfterCd,
|
||||
Double classAfterProb,
|
||||
Long mapSheetNum,
|
||||
String gemoStr,
|
||||
String geomCenterStr) {
|
||||
this.compareYyyy = compareYyyy;
|
||||
this.targetYyyy = targetYyyy;
|
||||
this.classBeforeCd = classBeforeCd;
|
||||
@@ -395,7 +385,7 @@ public class InferenceDetailDto {
|
||||
String[] sortParams = sort.split(",");
|
||||
String property = sortParams[0];
|
||||
Sort.Direction direction =
|
||||
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
|
||||
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
|
||||
return PageRequest.of(page, size, Sort.by(direction, property));
|
||||
}
|
||||
return PageRequest.of(page, size);
|
||||
|
||||
@@ -22,16 +22,16 @@ public class InferenceProgressDto {
|
||||
private Integer priority;
|
||||
|
||||
public InferenceProgressDto(
|
||||
InferenceProgressDto.pred_requests_areas pred_requests_areas,
|
||||
String modelVersion,
|
||||
String cdModelPath,
|
||||
String cdModelFileName,
|
||||
String cdModelConfigPath,
|
||||
String cdModelConfigFileName,
|
||||
String cdModelClsPath,
|
||||
String cdModelClsFileName,
|
||||
String clsModelVersion,
|
||||
Integer priority) {
|
||||
InferenceProgressDto.pred_requests_areas pred_requests_areas,
|
||||
String modelVersion,
|
||||
String cdModelPath,
|
||||
String cdModelFileName,
|
||||
String cdModelConfigPath,
|
||||
String cdModelConfigFileName,
|
||||
String cdModelClsPath,
|
||||
String cdModelClsFileName,
|
||||
String clsModelVersion,
|
||||
Integer priority) {
|
||||
this.pred_requests_areas = pred_requests_areas;
|
||||
this.modelVersion = modelVersion;
|
||||
this.cdModelPath = cdModelPath;
|
||||
|
||||
@@ -23,9 +23,7 @@ import org.springframework.data.domain.Pageable;
|
||||
|
||||
public class InferenceResultDto {
|
||||
|
||||
/**
|
||||
* 목록조회 dto
|
||||
*/
|
||||
/** 목록조회 dto */
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@@ -37,15 +35,11 @@ public class InferenceResultDto {
|
||||
private String status;
|
||||
private String mapSheetCnt;
|
||||
private Long detectingCnt;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime startTime;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime endTime;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime elapsedTime;
|
||||
@JsonFormatDttm private ZonedDateTime startTime;
|
||||
@JsonFormatDttm private ZonedDateTime endTime;
|
||||
@JsonFormatDttm private ZonedDateTime elapsedTime;
|
||||
private Boolean applyYn;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime applyDttm;
|
||||
@JsonFormatDttm private ZonedDateTime applyDttm;
|
||||
|
||||
@JsonProperty("statusName")
|
||||
public String statusName() {
|
||||
@@ -53,9 +47,7 @@ public class InferenceResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록조회 검색 조건 dto
|
||||
*/
|
||||
/** 목록조회 검색 조건 dto */
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@@ -269,8 +261,7 @@ public class InferenceResultDto {
|
||||
this.model2Ver = model2Ver;
|
||||
this.model3Ver = model3Ver;
|
||||
|
||||
if( this.detectingEndCnt == null )this.detectingEndCnt = 0L;
|
||||
|
||||
if (this.detectingEndCnt == null) this.detectingEndCnt = 0L;
|
||||
}
|
||||
|
||||
private String usedServerName;
|
||||
@@ -296,7 +287,7 @@ public class InferenceResultDto {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if( this.detectingEndCnt == null )this.detectingEndCnt = 0L;
|
||||
if (this.detectingEndCnt == null) this.detectingEndCnt = 0L;
|
||||
|
||||
return (double) (this.detectingEndCnt / this.detectingCnt) * 100.0;
|
||||
}
|
||||
@@ -336,7 +327,6 @@ public class InferenceResultDto {
|
||||
|
||||
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -346,12 +336,9 @@ public class InferenceResultDto {
|
||||
public static class InferenceServerStatusDto {
|
||||
|
||||
private String serverName;
|
||||
@JsonIgnore
|
||||
private float cpu_user;
|
||||
@JsonIgnore
|
||||
private float cpu_system;
|
||||
@JsonIgnore
|
||||
private float memused;
|
||||
@JsonIgnore private float cpu_user;
|
||||
@JsonIgnore private float cpu_system;
|
||||
@JsonIgnore private float memused;
|
||||
private Long kbmemused;
|
||||
private float gpuUtil;
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class InferenceResultService {
|
||||
|
||||
// 기준년도 조회
|
||||
List<MngListDto> targetList =
|
||||
mapSheetMngCoreService.getHstMapSheetList(req.getTargetYyyy(), mapTargetIds);
|
||||
mapSheetMngCoreService.getHstMapSheetList(req.getTargetYyyy(), mapTargetIds);
|
||||
req.setMapSheetNum(this.createdMngDto(req, targetList));
|
||||
}
|
||||
|
||||
@@ -109,19 +109,19 @@ public class InferenceResultService {
|
||||
|
||||
// 비교년도 탐지 제이터 옵션 별로 조회하여 req에 적용
|
||||
private List<MapSheetNumDto> createdMngDto(
|
||||
InferenceResultDto.RegReq req, List<MngListDto> targetList) {
|
||||
InferenceResultDto.RegReq req, List<MngListDto> targetList) {
|
||||
List<String> mapTargetIds = new ArrayList<>();
|
||||
|
||||
targetList.forEach(
|
||||
hstMapSheet -> {
|
||||
// 비교년도는 target 년도 기준으로 가져옴 파라미터 만들기
|
||||
mapTargetIds.add(hstMapSheet.getMapSheetNum());
|
||||
});
|
||||
hstMapSheet -> {
|
||||
// 비교년도는 target 년도 기준으로 가져옴 파라미터 만들기
|
||||
mapTargetIds.add(hstMapSheet.getMapSheetNum());
|
||||
});
|
||||
|
||||
// 비교년도 조회
|
||||
List<String> mapCompareIds = new ArrayList<>();
|
||||
List<MngListCompareDto> compareList =
|
||||
mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds);
|
||||
mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds);
|
||||
|
||||
for (MngListCompareDto dto : compareList) {
|
||||
// 추론 제외일때 이전년도 파일이 없으면 제외
|
||||
@@ -136,35 +136,35 @@ public class InferenceResultService {
|
||||
}
|
||||
|
||||
Set<String> compareSet =
|
||||
mapCompareIds.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim) // 공백/개행 방지
|
||||
.collect(Collectors.toSet());
|
||||
mapCompareIds.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim) // 공백/개행 방지
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// target 기준 compare 비교하여 서로 있는것만 저장
|
||||
List<String> commonIds =
|
||||
mapTargetIds.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim)
|
||||
.filter(compareSet::contains)
|
||||
.toList();
|
||||
mapTargetIds.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim)
|
||||
.filter(compareSet::contains)
|
||||
.toList();
|
||||
|
||||
Set<String> commonIdSet =
|
||||
commonIds.stream().filter(Objects::nonNull).map(String::trim).collect(Collectors.toSet());
|
||||
commonIds.stream().filter(Objects::nonNull).map(String::trim).collect(Collectors.toSet());
|
||||
|
||||
// 저장하기위해 파라미터 다시 구성
|
||||
List<MapSheetNumDto> mapSheetNum =
|
||||
targetList.stream()
|
||||
.filter(dto -> dto.getMapSheetNum() != null)
|
||||
.filter(dto -> commonIdSet.contains(dto.getMapSheetNum().trim()))
|
||||
.map(
|
||||
dto -> {
|
||||
MapSheetNumDto mapSheetNumDto = new MapSheetNumDto();
|
||||
mapSheetNumDto.setMapSheetNum(dto.getMapSheetNum());
|
||||
mapSheetNumDto.setMapSheetName(dto.getMapSheetName());
|
||||
return mapSheetNumDto;
|
||||
})
|
||||
.toList();
|
||||
targetList.stream()
|
||||
.filter(dto -> dto.getMapSheetNum() != null)
|
||||
.filter(dto -> commonIdSet.contains(dto.getMapSheetNum().trim()))
|
||||
.map(
|
||||
dto -> {
|
||||
MapSheetNumDto mapSheetNumDto = new MapSheetNumDto();
|
||||
mapSheetNumDto.setMapSheetNum(dto.getMapSheetNum());
|
||||
mapSheetNumDto.setMapSheetName(dto.getMapSheetName());
|
||||
return mapSheetNumDto;
|
||||
})
|
||||
.toList();
|
||||
|
||||
return mapSheetNum;
|
||||
}
|
||||
@@ -184,9 +184,9 @@ public class InferenceResultService {
|
||||
}
|
||||
|
||||
String modelComparePath =
|
||||
this.getSceneInference(String.valueOf(req.getCompareYyyy()), mapSheetNumList);
|
||||
this.getSceneInference(String.valueOf(req.getCompareYyyy()), mapSheetNumList);
|
||||
String modelTargetPath =
|
||||
this.getSceneInference(String.valueOf(req.getTargetYyyy()), mapSheetNumList);
|
||||
this.getSceneInference(String.valueOf(req.getTargetYyyy()), mapSheetNumList);
|
||||
|
||||
pred_requests_areas predRequestsAreas = new pred_requests_areas();
|
||||
predRequestsAreas.setInput1_year(req.getCompareYyyy());
|
||||
@@ -241,7 +241,7 @@ public class InferenceResultService {
|
||||
}
|
||||
|
||||
ExternalCallResult<String> result =
|
||||
externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers, String.class);
|
||||
externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers, String.class);
|
||||
|
||||
int status = result.statusCode();
|
||||
String body = result.body();
|
||||
@@ -254,8 +254,7 @@ public class InferenceResultService {
|
||||
|
||||
try {
|
||||
List<Map<String, Object>> list =
|
||||
om.readValue(body, new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
om.readValue(body, new TypeReference<List<Map<String, Object>>>() {});
|
||||
|
||||
Integer batchIdInt = (Integer) list.get(0).get("batch_id");
|
||||
batchId = batchIdInt.longValue();
|
||||
@@ -354,7 +353,7 @@ public class InferenceResultService {
|
||||
* @return
|
||||
*/
|
||||
public Page<InferenceDetailDto.Geom> getInferenceResultGeomList(
|
||||
Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) {
|
||||
Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) {
|
||||
return inferenceResultCoreService.getInferenceResultGeomList(id, searchGeoReq);
|
||||
}
|
||||
|
||||
@@ -365,7 +364,7 @@ public class InferenceResultService {
|
||||
* @return
|
||||
*/
|
||||
public Page<InferenceDetailDto.DetailListEntity> listInferenceResultWithGeom(
|
||||
@NotNull Long id, InferenceDetailDto.SearchGeoReq searchReq) {
|
||||
@NotNull Long id, InferenceDetailDto.SearchGeoReq searchReq) {
|
||||
|
||||
return inferenceResultCoreService.listInferenceResultWithGeom(id, searchReq);
|
||||
}
|
||||
@@ -410,7 +409,7 @@ public class InferenceResultService {
|
||||
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
|
||||
|
||||
List<InferenceServerStatusDto> servers =
|
||||
inferenceResultCoreService.getInferenceServerStatusList();
|
||||
inferenceResultCoreService.getInferenceServerStatusList();
|
||||
|
||||
String serverNames = "";
|
||||
for (InferenceServerStatusDto server : servers) {
|
||||
|
||||
Reference in New Issue
Block a user