국유인 실태조사 적합여부 업데이트 로직 수정, 라벨링 건수 조건 수정 #55
@@ -137,4 +137,15 @@ public class ChngDetectContDto {
|
|||||||
private String reqIp;
|
private String reqIp;
|
||||||
private String reqEpno;
|
private String reqEpno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class StbltResult {
|
||||||
|
|
||||||
|
private String stbltYn;
|
||||||
|
private String incyCd;
|
||||||
|
private String incyCmnt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.StbltResult;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
@@ -24,13 +25,10 @@ public class GukYuinStbltJobCoreService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto) {
|
public void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto) {
|
||||||
String chnDtctObjtId = "";
|
|
||||||
PnuEntity entity =
|
PnuEntity entity =
|
||||||
gukYuinStbltRepository.findPnuEntityByResultUid(resultUid, stbltDto.getPnu());
|
gukYuinStbltRepository.findPnuEntityByResultUid(resultUid, stbltDto.getPnu());
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
chnDtctObjtId = resultUid;
|
|
||||||
|
|
||||||
entity.setPnuDtctId(stbltDto.getPnuDtctId());
|
entity.setPnuDtctId(stbltDto.getPnuDtctId());
|
||||||
entity.setPnu(stbltDto.getPnu());
|
entity.setPnu(stbltDto.getPnu());
|
||||||
entity.setLrmSyncYmd(stbltDto.getLrmSyncYmd());
|
entity.setLrmSyncYmd(stbltDto.getLrmSyncYmd());
|
||||||
@@ -68,8 +66,10 @@ public class GukYuinStbltJobCoreService {
|
|||||||
|
|
||||||
entity.setCreatedDttm(ZonedDateTime.now());
|
entity.setCreatedDttm(ZonedDateTime.now());
|
||||||
gukYuinStbltRepository.save(entity);
|
gukYuinStbltRepository.save(entity);
|
||||||
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateGukYuinObjectStbltYn(String resultUid, StbltResult stbResult) {
|
||||||
|
gukYuinStbltRepository.updateGukYuinObjectStbltYn(resultUid, stbResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.StbltResult;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
||||||
@@ -12,4 +13,6 @@ public interface GukYuinStbltJobRepositoryCustom {
|
|||||||
void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto);
|
void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto);
|
||||||
|
|
||||||
PnuEntity findPnuEntityByResultUid(String resultUid, String pnu);
|
PnuEntity findPnuEntityByResultUid(String resultUid, String pnu);
|
||||||
|
|
||||||
|
void updateGukYuinObjectStbltYn(String resultUid, StbltResult stbResult);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapShe
|
|||||||
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
|
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.StbltResult;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
@@ -90,4 +91,19 @@ public class GukYuinStbltJobRepositoryImpl implements GukYuinStbltJobRepositoryC
|
|||||||
.where(pnuEntity.pnu.eq(pnu), pnuEntity.chnDtctObjtId.eq(resultUid))
|
.where(pnuEntity.pnu.eq(pnu), pnuEntity.chnDtctObjtId.eq(resultUid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGukYuinObjectStbltYn(String resultUid, StbltResult stbResult) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.fitState,
|
||||||
|
stbResult.getStbltYn().equals("Y")
|
||||||
|
? ImageryFitStatus.UNFIT.getId()
|
||||||
|
: ImageryFitStatus.FIT.getId()) // 적합여부가 Y 이면 부적합인 것, N 이면 적합한 것이라고 함
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.fitStateDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.fitStateCmmnt, stbResult.getIncyCmnt())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(resultUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,20 +134,16 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
.and(mapSheetAnalDataInferenceGeomEntity.labelStateDttm.lt(end)));
|
.and(mapSheetAnalDataInferenceGeomEntity.labelStateDttm.lt(end)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// labelTotCnt: pnu가 있고 pass_yn = false (부적합)인 건수만 라벨링 대상
|
// labelTotCnt: pnu가 있고 fitState = UNFIT 인 건수만 라벨링 대상
|
||||||
NumberExpression<Long> labelTotCntExpr =
|
NumberExpression<Long> labelTotCntExpr =
|
||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(
|
.when(
|
||||||
mapSheetAnalDataInferenceGeomEntity
|
mapSheetAnalDataInferenceGeomEntity
|
||||||
.pnu
|
.pnu
|
||||||
.isNotNull()
|
.gt(0)
|
||||||
.and(
|
.and(
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu
|
mapSheetAnalDataInferenceGeomEntity.fitState.eq(
|
||||||
.isNotNull()) // TODO: 이노팸 연동 후 0 이상이라고 해야할 듯
|
ImageryFitStatus.UNFIT.getId())))
|
||||||
//
|
|
||||||
// .and(mapSheetAnalDataInferenceGeomEntity.passYn.eq(Boolean.FALSE)) //TODO: 추후
|
|
||||||
// 라벨링 대상 조건 수정하기
|
|
||||||
)
|
|
||||||
.then(1L)
|
.then(1L)
|
||||||
.otherwise(0L)
|
.otherwise(0L)
|
||||||
.sum();
|
.sum();
|
||||||
@@ -201,7 +197,7 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
new CaseBuilder()
|
new CaseBuilder()
|
||||||
.when(
|
.when(
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.eq(
|
mapSheetAnalDataInferenceGeomEntity.labelState.eq(
|
||||||
LabelState.DONE.getId())) // "LABEL_COMPLETE"?
|
LabelState.DONE.getId()))
|
||||||
.then(1L)
|
.then(1L)
|
||||||
.otherwise(0L)
|
.otherwise(0L)
|
||||||
.sum(),
|
.sum(),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.scheduler.service;
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.StbltResult;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.RlbDtctMastDto;
|
||||||
@@ -10,6 +11,8 @@ import java.time.LocalDate;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -37,7 +40,7 @@ public class GukYuinApiStbltJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 국유인 연동 후, 실태조사 적합여부 확인하여 update */
|
/** 국유인 연동 후, 실태조사 적합여부 확인하여 update */
|
||||||
@Scheduled(cron = "0 0 3 * * *") // 0 0 3 * * *
|
@Scheduled(cron = "0 0 3 * * *")
|
||||||
public void findGukYuinEligibleForSurvey() {
|
public void findGukYuinEligibleForSurvey() {
|
||||||
if (isLocalProfile()) {
|
if (isLocalProfile()) {
|
||||||
return;
|
return;
|
||||||
@@ -68,6 +71,45 @@ public class GukYuinApiStbltJobService {
|
|||||||
gukYuinStbltJobCoreService.updateGukYuinEligibleForSurvey(resultUid, stbltDto);
|
gukYuinStbltJobCoreService.updateGukYuinEligibleForSurvey(resultUid, stbltDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, StbltResult> resultMap =
|
||||||
|
result.getResult().stream()
|
||||||
|
.collect(Collectors.groupingBy(RlbDtctMastDto::getChnDtctObjtId))
|
||||||
|
.entrySet()
|
||||||
|
.stream()
|
||||||
|
.collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
Map.Entry::getKey,
|
||||||
|
e -> {
|
||||||
|
List<RlbDtctMastDto> pnuList = e.getValue();
|
||||||
|
|
||||||
|
boolean hasY = pnuList.stream().anyMatch(v -> "Y".equals(v.getStbltYn()));
|
||||||
|
|
||||||
|
String fitYn = hasY ? "Y" : "N";
|
||||||
|
|
||||||
|
RlbDtctMastDto selected =
|
||||||
|
hasY
|
||||||
|
? pnuList.stream()
|
||||||
|
.filter(v -> "Y".equals(v.getStbltYn()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null)
|
||||||
|
: pnuList.stream()
|
||||||
|
.filter(v -> "N".equals(v.getStbltYn()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
if (selected == null) {
|
||||||
|
return null; // 방어 코드
|
||||||
|
}
|
||||||
|
|
||||||
|
return new StbltResult(
|
||||||
|
fitYn, selected.getIncyCd(), selected.getIncyRsnCont());
|
||||||
|
}));
|
||||||
|
|
||||||
|
resultMap.forEach(
|
||||||
|
(resultUid, StbltResult) -> {
|
||||||
|
gukYuinStbltJobCoreService.updateGukYuinObjectStbltYn(resultUid, StbltResult);
|
||||||
|
});
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user