Compare commits
43 Commits
feat/infer
...
643ea5cf9a
| Author | SHA1 | Date | |
|---|---|---|---|
| 643ea5cf9a | |||
| bc4b2dbac1 | |||
| 694b2fc31e | |||
| fbdda6477c | |||
| a572089dff | |||
| c6abf7a935 | |||
| a9348d9a66 | |||
| b877d2a8c9 | |||
| 151012ea28 | |||
| 68c68082cf | |||
| 4ce96b72aa | |||
| 0a5c5dfd7d | |||
| 7442e4ee09 | |||
| d278baed96 | |||
| 6b0074316f | |||
| f921ef5d0d | |||
| 7667620395 | |||
| 527acc9839 | |||
| 407f14d230 | |||
| 4a91d61b7d | |||
| 9d7bbc1b63 | |||
| f46ea62761 | |||
| 1abc0b93c0 | |||
| 4204e48d88 | |||
| fa41d41739 | |||
| ee28edd9d0 | |||
| 8555897b77 | |||
| fe7b1ed0bd | |||
| 064c02e21b | |||
| fd3499a5ec | |||
| 686cf03524 | |||
| ee9914a5f3 | |||
| b3e90c9f2b | |||
| 156b7a312d | |||
| cfed31656a | |||
| 14e8a6476f | |||
| ae6de0c030 | |||
| 4036f88296 | |||
| 28718c4218 | |||
| 54c92842d4 | |||
| c83c540dfb | |||
| dd1284f5c0 | |||
| 385ada3291 |
24
Dockerfile-prod
Normal file
24
Dockerfile-prod
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# 1단계에서 만든 로컬 베이스 이미지를 사용
|
||||||
|
FROM 192.168.2.73:18082/kamco-cd/base-java21-gdal:1.0
|
||||||
|
FROM 192.168.2.73:18082/kamco-cd/base-java21-gdal:1.0
|
||||||
|
|
||||||
|
# 사용자 설정 (앱 별로 다를 수 있으므로 여기에 유지)
|
||||||
|
ARG UID=1000
|
||||||
|
ARG GID=1000
|
||||||
|
|
||||||
|
RUN groupadd -g ${GID} kcomu \
|
||||||
|
&& useradd -u ${UID} -g ${GID} -m kcomu
|
||||||
|
|
||||||
|
USER kcomu
|
||||||
|
|
||||||
|
# 작업 디렉토리 설정
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# JAR 파일 복사 (Jenkins에서 빌드된 ROOT.jar)
|
||||||
|
COPY build/libs/ROOT.jar app.jar
|
||||||
|
|
||||||
|
# 포트 노출
|
||||||
|
EXPOSE 8080
|
||||||
|
# 애플리케이션 실행
|
||||||
|
# dev 프로파일로 실행
|
||||||
|
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod", "app.jar"]
|
||||||
35
docker-compose-prod.yml
Normal file
35
docker-compose-prod.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
services:
|
||||||
|
kamco-changedetection-api:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile-prod
|
||||||
|
args:
|
||||||
|
UID: 1000 # manager01 UID
|
||||||
|
GID: 1000 # manager01 GID
|
||||||
|
image: kamco-changedetection-api:${IMAGE_TAG:-latest}
|
||||||
|
container_name: kamco-changedetection-api
|
||||||
|
user: "1000:1000"
|
||||||
|
ports:
|
||||||
|
- "7100:8080"
|
||||||
|
environment:
|
||||||
|
- SPRING_PROFILES_ACTIVE=dev
|
||||||
|
- TZ=Asia/Seoul
|
||||||
|
volumes:
|
||||||
|
- /mnt/nfs_share/images:/app/original-images
|
||||||
|
- /mnt/nfs_share/model_output:/app/model-outputs
|
||||||
|
- /mnt/nfs_share/train_dataset:/app/train-dataset
|
||||||
|
- /mnt/nfs_share/tmp:/app/tmp
|
||||||
|
- /kamco-nfs:/kamco-nfs
|
||||||
|
networks:
|
||||||
|
- kamco-cds
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "curl", "-f", "http://localhost:8080/monitor/health" ]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 40s
|
||||||
|
|
||||||
|
networks:
|
||||||
|
kamco-cds:
|
||||||
|
external: true
|
||||||
@@ -7,15 +7,11 @@ import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
|||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChngDetectMastSearchDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChngDetectMastSearchDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResReturn;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.Basic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.Basic;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.DetectMastReq;
|
import com.kamco.cd.kamcoback.gukyuin.dto.DetectMastDto.DetectMastReq;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkableRes;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiLabelJobService;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiPnuJobService;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiStatusJobService;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiStbltJobService;
|
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
@@ -43,10 +39,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class GukYuinApiController {
|
public class GukYuinApiController {
|
||||||
|
|
||||||
private final GukYuinApiService gukYuinApiService;
|
private final GukYuinApiService gukYuinApiService;
|
||||||
private final GukYuinApiPnuJobService gukYuinApiPnuJobService;
|
|
||||||
private final GukYuinApiStatusJobService gukYuinApiStatusJobService;
|
|
||||||
private final GukYuinApiLabelJobService gukYuinApiLabelJobService;
|
|
||||||
private final GukYuinApiStbltJobService gukYuinApiStbltJobService;
|
|
||||||
|
|
||||||
/** 탐지결과 등록 */
|
/** 탐지결과 등록 */
|
||||||
@Operation(summary = "탐지결과 등록", description = "탐지결과 등록")
|
@Operation(summary = "탐지결과 등록", description = "탐지결과 등록")
|
||||||
@@ -82,7 +74,7 @@ public class GukYuinApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/chn/mast/remove")
|
@PostMapping("/chn/mast/remove")
|
||||||
public ApiResponseDto<ChngDetectMastDto.RemoveResDto> remove(
|
public ApiResponseDto<ResReturn> remove(
|
||||||
@RequestBody @Valid ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
@RequestBody @Valid ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.remove(chnDetectMastReq));
|
return ApiResponseDto.ok(gukYuinApiService.remove(chnDetectMastReq));
|
||||||
}
|
}
|
||||||
@@ -270,7 +262,7 @@ public class GukYuinApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/rlb/objt/{chnDtctObjtId}/lbl/{lblYn}")
|
@PostMapping("/rlb/objt/{chnDtctObjtId}/lbl/{lblYn}")
|
||||||
public ApiResponseDto<ChngDetectContDto.ResultLabelDto> updateChnDtctObjtLabelingYn(
|
public ApiResponseDto<ResReturn> updateChnDtctObjtLabelingYn(
|
||||||
@PathVariable String chnDtctObjtId, @PathVariable String lblYn) {
|
@PathVariable String chnDtctObjtId, @PathVariable String lblYn) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.updateChnDtctObjtLabelingYn(chnDtctObjtId, lblYn));
|
return ApiResponseDto.ok(gukYuinApiService.updateChnDtctObjtLabelingYn(chnDtctObjtId, lblYn));
|
||||||
}
|
}
|
||||||
@@ -306,13 +298,11 @@ public class GukYuinApiController {
|
|||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
public ApiResponseDto<ChngDetectMastDto.RlbDtctDto> findRlbDtctList(
|
public ApiResponseDto<ChngDetectMastDto.RlbDtctDto> findRlbDtctList(
|
||||||
@PathVariable String chnDtctId,
|
@PathVariable String chnDtctId) {
|
||||||
@Parameter(description = "날짜(기본은 어제 날짜)") @RequestParam(defaultValue = "20260205")
|
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctList(chnDtctId));
|
||||||
String yyyymmdd) {
|
|
||||||
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctList(chnDtctId, yyyymmdd));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "탐지객체 적합여부 조회 (객체별 조회)", description = "탐지객체 적합여부 조회 (객체별 조회)")
|
@Operation(summary = "탐지객체 적합여부 조회 (리스트조회)", description = "탐지객체 적합여부 조회 (리스트조회)")
|
||||||
@GetMapping("/rlb/objt/{chnDtctObjtId}")
|
@GetMapping("/rlb/objt/{chnDtctObjtId}")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@@ -330,36 +320,4 @@ public class GukYuinApiController {
|
|||||||
@PathVariable String chnDtctObjtId) {
|
@PathVariable String chnDtctObjtId) {
|
||||||
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctObject(chnDtctObjtId));
|
return ApiResponseDto.ok(gukYuinApiService.findRlbDtctObject(chnDtctObjtId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Hidden
|
|
||||||
@Operation(summary = "job test pnu", description = "job test pnu")
|
|
||||||
@GetMapping("/job-test/pnu")
|
|
||||||
public ApiResponseDto<Void> findGukYuinContListPnuUpdate() {
|
|
||||||
gukYuinApiPnuJobService.findGukYuinContListPnuUpdate();
|
|
||||||
return ApiResponseDto.ok(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Hidden
|
|
||||||
@Operation(summary = "job test status", description = "job test status")
|
|
||||||
@GetMapping("/job-test/status")
|
|
||||||
public ApiResponseDto<Void> findGukYuinMastCompleteYn() {
|
|
||||||
gukYuinApiStatusJobService.findGukYuinMastCompleteYn();
|
|
||||||
return ApiResponseDto.ok(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Hidden
|
|
||||||
@Operation(summary = "job test label", description = "job test label")
|
|
||||||
@GetMapping("/job-test/label")
|
|
||||||
public ApiResponseDto<Void> findLabelingCompleteSend() {
|
|
||||||
gukYuinApiLabelJobService.findLabelingCompleteSend();
|
|
||||||
return ApiResponseDto.ok(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Hidden
|
|
||||||
@Operation(summary = "job test stblt", description = "job test stblt")
|
|
||||||
@GetMapping("/job-test/stblt")
|
|
||||||
public ApiResponseDto<Void> findGukYuinEligibleForSurvey() {
|
|
||||||
gukYuinApiStbltJobService.findGukYuinEligibleForSurvey();
|
|
||||||
return ApiResponseDto.ok(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,27 +114,4 @@ public class ChngDetectContDto {
|
|||||||
private List<DtoPnuDetectMpng> result;
|
private List<DtoPnuDetectMpng> result;
|
||||||
private Boolean success;
|
private Boolean success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(name = "ResultLabelDto", description = "ResultLabelDto list 리턴 형태")
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public static class ResultLabelDto {
|
|
||||||
|
|
||||||
private Integer code;
|
|
||||||
private String message;
|
|
||||||
private DtoPnuDetectMpng result;
|
|
||||||
private Boolean success;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public static class ReqInfo {
|
|
||||||
|
|
||||||
private String reqIp;
|
|
||||||
private String reqEpno;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,17 +288,4 @@ public class ChngDetectMastDto {
|
|||||||
private String chgIp;
|
private String chgIp;
|
||||||
private String delYn; // 삭제여부
|
private String delYn; // 삭제여부
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(name = "RemoveResDto", description = "remove 후 리턴 형태")
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public static class RemoveResDto {
|
|
||||||
|
|
||||||
private Integer code;
|
|
||||||
private String message;
|
|
||||||
private Boolean result;
|
|
||||||
private Boolean success;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ public enum GukYuinStatus implements EnumType {
|
|||||||
GUK_COMPLETED("국유인 매핑 완료"),
|
GUK_COMPLETED("국유인 매핑 완료"),
|
||||||
PNU_COMPLETED("PNU 싱크 완료"),
|
PNU_COMPLETED("PNU 싱크 완료"),
|
||||||
PNU_FAILED("PNU 싱크 중 에러"),
|
PNU_FAILED("PNU 싱크 중 에러"),
|
||||||
END("종료"),
|
|
||||||
CANCELED("취소");
|
CANCELED("취소");
|
||||||
|
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
|||||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ContBasic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ContBasic;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ReqInfo;
|
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultPnuDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultPnuDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ErrorResDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ErrorResDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResReturn;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
||||||
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.GukYuinDto.GukYuinLinkFacts;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GukYuinLinkFacts;
|
||||||
@@ -55,7 +55,6 @@ public class GukYuinApiService {
|
|||||||
private final UserUtil userUtil;
|
private final UserUtil userUtil;
|
||||||
private final AuditLogRepository auditLogRepository;
|
private final AuditLogRepository auditLogRepository;
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
private final String myip = netUtils.getLocalIP();
|
|
||||||
|
|
||||||
@Value("${spring.profiles.active:local}")
|
@Value("${spring.profiles.active:local}")
|
||||||
private String profile;
|
private String profile;
|
||||||
@@ -66,15 +65,13 @@ public class GukYuinApiService {
|
|||||||
@Value("${gukyuin.cdi}")
|
@Value("${gukyuin.cdi}")
|
||||||
private String gukyuinCdiUrl;
|
private String gukyuinCdiUrl;
|
||||||
|
|
||||||
@Value("${file.dataset-dir}")
|
|
||||||
private String datasetDir;
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ChngDetectMastDto.RegistResDto regist(
|
public ChngDetectMastDto.RegistResDto regist(
|
||||||
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
|
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/regist";
|
String url = gukyuinCdiUrl + "/chn/mast/regist";
|
||||||
|
|
||||||
|
String myip = netUtils.getLocalIP();
|
||||||
chnDetectMastReq.setReqIp(myip);
|
chnDetectMastReq.setReqIp(myip);
|
||||||
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
||||||
|
|
||||||
@@ -92,12 +89,6 @@ public class GukYuinApiService {
|
|||||||
ChngDetectMastDto.Basic registRes = resultBody.getResult();
|
ChngDetectMastDto.Basic registRes = resultBody.getResult();
|
||||||
|
|
||||||
success = resultBody.getSuccess();
|
success = resultBody.getSuccess();
|
||||||
|
|
||||||
// 이미 등록한 경우에는 result가 없음
|
|
||||||
if (resultBody.getResult() == null) {
|
|
||||||
return resultBody;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 추론 회차에 applyStatus, applyStatusDttm 업데이트
|
// 추론 회차에 applyStatus, applyStatusDttm 업데이트
|
||||||
gukyuinCoreService.updateGukYuinMastRegResult(registRes);
|
gukyuinCoreService.updateGukYuinMastRegResult(registRes);
|
||||||
|
|
||||||
@@ -131,30 +122,23 @@ public class GukYuinApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ChngDetectMastDto.RemoveResDto remove(
|
public ResReturn remove(ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||||
ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
|
||||||
String url = gukyuinCdiUrl + "/chn/mast/remove";
|
String url = gukyuinCdiUrl + "/chn/mast/remove";
|
||||||
|
|
||||||
|
String myip = netUtils.getLocalIP();
|
||||||
chnDetectMastReq.setReqIp(myip);
|
chnDetectMastReq.setReqIp(myip);
|
||||||
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
chnDetectMastReq.setReqEpno(userUtil.getEmployeeNo());
|
||||||
|
|
||||||
boolean success = false;
|
ExternalCallResult<ChngDetectMastDto.Basic> result =
|
||||||
ExternalCallResult<ChngDetectMastDto.RemoveResDto> result =
|
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url,
|
url,
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
chnDetectMastReq,
|
chnDetectMastReq,
|
||||||
netUtils.jsonHeaders(),
|
netUtils.jsonHeaders(),
|
||||||
ChngDetectMastDto.RemoveResDto.class);
|
ChngDetectMastDto.Basic.class);
|
||||||
|
|
||||||
ChngDetectMastDto.RemoveResDto resultBody = result.body();
|
ChngDetectMastDto.Basic resultBody = result.body();
|
||||||
if (resultBody != null && resultBody.getSuccess() != null) {
|
gukyuinCoreService.updateGukYuinMastRegRemove(resultBody);
|
||||||
|
|
||||||
success = resultBody.getSuccess();
|
|
||||||
if (resultBody.getSuccess()) {
|
|
||||||
gukyuinCoreService.updateGukYuinMastRegRemove(chnDetectMastReq.getChnDtctId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
EventType.REMOVE.getId(),
|
EventType.REMOVE.getId(),
|
||||||
@@ -162,22 +146,14 @@ public class GukYuinApiService {
|
|||||||
userUtil.getId(),
|
userUtil.getId(),
|
||||||
url.replace(gukyuinUrl, ""),
|
url.replace(gukyuinUrl, ""),
|
||||||
chnDetectMastReq,
|
chnDetectMastReq,
|
||||||
success);
|
true); // TODO : successFail 여부
|
||||||
|
return new ResReturn("success", "탐지결과 삭제 되었습니다.");
|
||||||
return resultBody;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 등록목록 1개 확인
|
// 등록목록 1개 확인
|
||||||
public ChngDetectMastDto.ResultDto detail(String chnDtctMstId) {
|
public ChngDetectMastDto.ResultDto detail(String chnDtctMstId) {
|
||||||
|
|
||||||
String url =
|
String url = gukyuinCdiUrl + "/chn/mast/list/" + chnDtctMstId;
|
||||||
gukyuinCdiUrl
|
|
||||||
+ "/chn/mast/list/"
|
|
||||||
+ chnDtctMstId
|
|
||||||
+ "?reqIp="
|
|
||||||
+ myip
|
|
||||||
+ "&reqEpno="
|
|
||||||
+ userUtil.getEmployeeNo();
|
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -196,15 +172,9 @@ public class GukYuinApiService {
|
|||||||
// 등록목록 비교년도,기준년도,차수 조합해서 n개 확인
|
// 등록목록 비교년도,기준년도,차수 조합해서 n개 확인
|
||||||
public ChngDetectMastDto.ResultDto listYearStage(
|
public ChngDetectMastDto.ResultDto listYearStage(
|
||||||
ChngDetectMastDto.ChngDetectMastSearchDto searchDto) {
|
ChngDetectMastDto.ChngDetectMastSearchDto searchDto) {
|
||||||
|
|
||||||
String queryString = netUtils.dtoToQueryString(searchDto, null);
|
String queryString = netUtils.dtoToQueryString(searchDto, null);
|
||||||
String url =
|
String url = gukyuinCdiUrl + "/chn/mast" + queryString;
|
||||||
gukyuinCdiUrl
|
|
||||||
+ "/chn/mast"
|
|
||||||
+ queryString
|
|
||||||
+ "&reqIp="
|
|
||||||
+ myip
|
|
||||||
+ "&reqEpno="
|
|
||||||
+ userUtil.getEmployeeNo();
|
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -268,11 +238,7 @@ public class GukYuinApiService {
|
|||||||
+ "?pageIndex="
|
+ "?pageIndex="
|
||||||
+ pageIndex
|
+ pageIndex
|
||||||
+ "&pageSize="
|
+ "&pageSize="
|
||||||
+ pageSize
|
+ pageSize;
|
||||||
+ "&reqIp="
|
|
||||||
+ myip
|
|
||||||
+ "&reqEpno="
|
|
||||||
+ userUtil.getEmployeeNo();
|
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -291,6 +257,20 @@ public class GukYuinApiService {
|
|||||||
result.body().getSuccess());
|
result.body().getSuccess());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (ContBasic cont : contList) {
|
||||||
|
String[] pnuList = cont.getPnuList();
|
||||||
|
long pnuCnt = pnuList == null ? 0 : pnuList.length;
|
||||||
|
if (cont.getChnDtctObjtId() != null) {
|
||||||
|
gukyuinCoreService.updateInferenceGeomDataPnuCnt(cont.getChnDtctObjtId(), pnuCnt);
|
||||||
|
|
||||||
|
if (pnuCnt > 0) {
|
||||||
|
Long geoUid =
|
||||||
|
gukyuinCoreService.findMapSheetAnalDataInferenceGeomUid(cont.getChnDtctObjtId());
|
||||||
|
gukyuinCoreService.insertGeoUidPnuData(geoUid, pnuList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
EventType.LIST.getId(),
|
EventType.LIST.getId(),
|
||||||
netUtils.getLocalIP(),
|
netUtils.getLocalIP(),
|
||||||
@@ -303,16 +283,7 @@ public class GukYuinApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResultPnuDto findPnuObjMgmtList(String chnDtctId, String chnDtctObjtId) {
|
public ResultPnuDto findPnuObjMgmtList(String chnDtctId, String chnDtctObjtId) {
|
||||||
String url =
|
String url = gukyuinCdiUrl + "/chn/pnu/" + chnDtctId + "/objt/" + chnDtctObjtId;
|
||||||
gukyuinCdiUrl
|
|
||||||
+ "/chn/pnu/"
|
|
||||||
+ chnDtctId
|
|
||||||
+ "/objt/"
|
|
||||||
+ chnDtctObjtId
|
|
||||||
+ "?reqIp="
|
|
||||||
+ myip
|
|
||||||
+ "&reqEpno="
|
|
||||||
+ userUtil.getEmployeeNo();
|
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -333,21 +304,18 @@ public class GukYuinApiService {
|
|||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChngDetectContDto.ResultLabelDto updateChnDtctObjtLabelingYn(
|
public ResReturn updateChnDtctObjtLabelingYn(String chnDtctObjtId, String lblYn) {
|
||||||
String chnDtctObjtId, String lblYn) {
|
|
||||||
String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId + "/lbl/" + lblYn;
|
String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId + "/lbl/" + lblYn;
|
||||||
|
|
||||||
ReqInfo info = new ReqInfo();
|
ExternalCallResult<ChngDetectContDto.ResultPnuDto> result =
|
||||||
info.setReqIp(myip);
|
|
||||||
info.setReqEpno(userUtil.getEmployeeNo());
|
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultLabelDto> result =
|
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
url,
|
url,
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
info,
|
null,
|
||||||
netUtils.jsonHeaders(),
|
netUtils.jsonHeaders(),
|
||||||
ChngDetectContDto.ResultLabelDto.class);
|
ChngDetectContDto.ResultPnuDto.class);
|
||||||
|
|
||||||
|
ChngDetectContDto.ResultPnuDto dto = result.body();
|
||||||
|
|
||||||
this.insertGukyuinAuditLog(
|
this.insertGukyuinAuditLog(
|
||||||
EventType.MODIFIED.getId(),
|
EventType.MODIFIED.getId(),
|
||||||
@@ -357,21 +325,11 @@ public class GukYuinApiService {
|
|||||||
null,
|
null,
|
||||||
result.body().getSuccess());
|
result.body().getSuccess());
|
||||||
|
|
||||||
return result.body();
|
return new ResReturn(dto.getCode() > 200000 ? "fail" : "success", dto.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultContDto findChnPnuToContList(String chnDtctId, String pnu) {
|
public ResultContDto findChnPnuToContList(String chnDtctId, String pnu) {
|
||||||
|
String url = gukyuinCdiUrl + "/chn/cont/" + chnDtctId + "/pnu/" + pnu;
|
||||||
String url =
|
|
||||||
gukyuinCdiUrl
|
|
||||||
+ "/chn/cont/"
|
|
||||||
+ chnDtctId
|
|
||||||
+ "/pnu/"
|
|
||||||
+ pnu
|
|
||||||
+ "?reqIp="
|
|
||||||
+ myip
|
|
||||||
+ "&reqEpno="
|
|
||||||
+ userUtil.getEmployeeNo();
|
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -392,14 +350,7 @@ public class GukYuinApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ResultDto listChnDtctId(String chnDtctId) {
|
public ResultDto listChnDtctId(String chnDtctId) {
|
||||||
String url =
|
String url = gukyuinCdiUrl + "/chn/mast/" + chnDtctId;
|
||||||
gukyuinCdiUrl
|
|
||||||
+ "/chn/mast/"
|
|
||||||
+ chnDtctId
|
|
||||||
+ "?reqIp="
|
|
||||||
+ myip
|
|
||||||
+ "&reqEpno="
|
|
||||||
+ userUtil.getEmployeeNo();
|
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
ExternalCallResult<ChngDetectMastDto.ResultDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -456,16 +407,6 @@ public class GukYuinApiService {
|
|||||||
Integer maxStage =
|
Integer maxStage =
|
||||||
gukyuinCoreService.findMapSheetLearnYearStage(info.getCompareYyyy(), info.getTargetYyyy());
|
gukyuinCoreService.findMapSheetLearnYearStage(info.getCompareYyyy(), info.getTargetYyyy());
|
||||||
|
|
||||||
// 1회차를 종료 상태로 처리하고 2회차를 보내야 함
|
|
||||||
// 추론(learn), 학습데이터(inference) 둘 다 종료 처리
|
|
||||||
if (maxStage > 0) {
|
|
||||||
Long learnId =
|
|
||||||
gukyuinCoreService.findMapSheetLearnInfoByYyyy(
|
|
||||||
info.getCompareYyyy(), info.getTargetYyyy(), maxStage);
|
|
||||||
gukyuinCoreService.updateMapSheetLearnGukyuinEndStatus(learnId);
|
|
||||||
gukyuinCoreService.updateMapSheetInferenceLabelEndStatus(learnId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// reqDto 셋팅
|
// reqDto 셋팅
|
||||||
ChnDetectMastReqDto reqDto = new ChnDetectMastReqDto();
|
ChnDetectMastReqDto reqDto = new ChnDetectMastReqDto();
|
||||||
reqDto.setCprsYr(String.valueOf(info.getCompareYyyy()));
|
reqDto.setCprsYr(String.valueOf(info.getCompareYyyy()));
|
||||||
@@ -474,7 +415,7 @@ public class GukYuinApiService {
|
|||||||
reqDto.setChnDtctId(info.getUid());
|
reqDto.setChnDtctId(info.getUid());
|
||||||
reqDto.setPathNm("/kamco-nfs/dataset/export/" + info.getUid());
|
reqDto.setPathNm("/kamco-nfs/dataset/export/" + info.getUid());
|
||||||
|
|
||||||
if (!Files.isDirectory(Path.of("/kamco-nfs/dataset/export/" + info.getUid()))) {
|
if (Files.isDirectory(Path.of("/kamco-nfs/dataset/export/" + info.getUid()))) {
|
||||||
return new ResponseObj(
|
return new ResponseObj(
|
||||||
ApiResponseCode.NOT_FOUND_DATA, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다.");
|
ApiResponseCode.NOT_FOUND_DATA, "파일 경로에 회차 실행 파일이 생성되지 않았습니다. 확인 부탁드립니다.");
|
||||||
}
|
}
|
||||||
@@ -504,11 +445,7 @@ public class GukYuinApiService {
|
|||||||
+ "?pageIndex="
|
+ "?pageIndex="
|
||||||
+ pageIndex
|
+ pageIndex
|
||||||
+ "&pageSize="
|
+ "&pageSize="
|
||||||
+ pageSize
|
+ pageSize;
|
||||||
+ "&reqIp="
|
|
||||||
+ myip
|
|
||||||
+ "&reqEpno="
|
|
||||||
+ userUtil.getEmployeeNo();
|
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
ExternalCallResult<ChngDetectContDto.ResultContDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -528,18 +465,9 @@ public class GukYuinApiService {
|
|||||||
return result.body();
|
return result.body();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChngDetectMastDto.RlbDtctDto findRlbDtctList(String chnDtctId, String yyyymmdd) {
|
public ChngDetectMastDto.RlbDtctDto findRlbDtctList(String chnDtctId) {
|
||||||
|
|
||||||
String url =
|
String url = gukyuinCdiUrl + "/rlb/dtct/" + chnDtctId;
|
||||||
gukyuinCdiUrl
|
|
||||||
+ "/rlb/dtct/"
|
|
||||||
+ chnDtctId
|
|
||||||
+ "?reqIp="
|
|
||||||
+ myip
|
|
||||||
+ "&reqEpno="
|
|
||||||
+ userUtil.getEmployeeNo()
|
|
||||||
+ "&yyyymmdd="
|
|
||||||
+ yyyymmdd;
|
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
@@ -556,14 +484,8 @@ public class GukYuinApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RlbDtctDto findRlbDtctObject(String chnDtctObjtId) {
|
public RlbDtctDto findRlbDtctObject(String chnDtctObjtId) {
|
||||||
String url =
|
|
||||||
gukyuinCdiUrl
|
String url = gukyuinCdiUrl + "/rlb/objt/" + chnDtctObjtId;
|
||||||
+ "/rlb/objt/"
|
|
||||||
+ chnDtctObjtId
|
|
||||||
+ "?reqIp="
|
|
||||||
+ myip
|
|
||||||
+ "&reqEpno="
|
|
||||||
+ userUtil.getEmployeeNo();
|
|
||||||
|
|
||||||
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
ExternalCallResult<ChngDetectMastDto.RlbDtctDto> result =
|
||||||
externalHttpClient.call(
|
externalHttpClient.call(
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public class GukYuinCoreService {
|
|||||||
gukYuinRepository.updateGukYuinMastRegResult(resultBody);
|
gukYuinRepository.updateGukYuinMastRegResult(resultBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateGukYuinMastRegRemove(String chnDtctId) {
|
public void updateGukYuinMastRegRemove(Basic resultBody) {
|
||||||
gukYuinRepository.updateGukYuinMastRegRemove(chnDtctId);
|
gukYuinRepository.updateGukYuinMastRegRemove(resultBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
@@ -45,8 +45,8 @@ public class GukYuinCoreService {
|
|||||||
return gukYuinRepository.findMapSheetAnalDataInferenceGeomUid(chnDtctObjtId);
|
return gukYuinRepository.findMapSheetAnalDataInferenceGeomUid(chnDtctObjtId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
||||||
gukYuinRepository.insertGeoUidPnuData(geoUid, pnuList, chnDtctObjtId);
|
gukYuinRepository.insertGeoUidPnuData(geoUid, pnuList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
||||||
@@ -64,17 +64,4 @@ public class GukYuinCoreService {
|
|||||||
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
||||||
return gukYuinRepository.findLabelingCompleteSendList(yesterday);
|
return gukYuinRepository.findLabelingCompleteSendList(yesterday);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long findMapSheetLearnInfoByYyyy(
|
|
||||||
Integer compareYyyy, Integer targetYyyy, Integer maxStage) {
|
|
||||||
return gukYuinRepository.findMapSheetLearnInfoByYyyy(compareYyyy, targetYyyy, maxStage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateMapSheetLearnGukyuinEndStatus(Long learnId) {
|
|
||||||
gukYuinRepository.updateMapSheetLearnGukyuinEndStatus(learnId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateMapSheetInferenceLabelEndStatus(Long learnId) {
|
|
||||||
gukYuinRepository.updateMapSheetInferenceLabelEndStatus(learnId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
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.GukYuinDto.GeomUidDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class GukYuinJobCoreService {
|
public class GukYuinJobCoreService {
|
||||||
@@ -16,7 +16,6 @@ public class GukYuinJobCoreService {
|
|||||||
this.gukYuinRepository = gukYuinRepository;
|
this.gukYuinRepository = gukYuinRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
gukYuinRepository.updateGukYuinApplyStateComplete(id, status);
|
gukYuinRepository.updateGukYuinApplyStateComplete(id, status);
|
||||||
}
|
}
|
||||||
@@ -24,4 +23,16 @@ public class GukYuinJobCoreService {
|
|||||||
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus) {
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus) {
|
||||||
return gukYuinRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
return gukYuinRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
return gukYuinRepository.upsertMapSheetDataAnalGeomPnu(chnDtctObjtId, pnuList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
|
return gukYuinRepository.findYesterdayLabelingCompleteList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
|
gukYuinRepository.updateAnalDataInferenceGeomSendDttm(geoUid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinLabelJobRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinLabelJobRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class GukYuinLabelJobCoreService {
|
public class GukYuinLabelJobCoreService {
|
||||||
@@ -15,11 +16,22 @@ public class GukYuinLabelJobCoreService {
|
|||||||
this.gukYuinLabelRepository = gukYuinLabelRepository;
|
this.gukYuinLabelRepository = gukYuinLabelRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
gukYuinLabelRepository.updateGukYuinApplyStateComplete(id, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus) {
|
||||||
|
return gukYuinLabelRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
return gukYuinLabelRepository.upsertMapSheetDataAnalGeomPnu(chnDtctObjtId, pnuList);
|
||||||
|
}
|
||||||
|
|
||||||
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
return gukYuinLabelRepository.findYesterdayLabelingCompleteList();
|
return gukYuinLabelRepository.findYesterdayLabelingCompleteList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
gukYuinLabelRepository.updateAnalDataInferenceGeomSendDttm(geoUid);
|
gukYuinLabelRepository.updateAnalDataInferenceGeomSendDttm(geoUid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
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.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinPnuJobRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinPnuJobRepository;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class GukYuinPnuJobCoreService {
|
public class GukYuinPnuJobCoreService {
|
||||||
@@ -28,7 +33,22 @@ public class GukYuinPnuJobCoreService {
|
|||||||
return gukYuinPnuRepository.upsertMapSheetDataAnalGeomPnu(chnDtctObjtId, pnuList);
|
return gukYuinPnuRepository.upsertMapSheetDataAnalGeomPnu(chnDtctObjtId, pnuList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
|
return gukYuinPnuRepository.findYesterdayLabelingCompleteList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
|
gukYuinPnuRepository.updateAnalDataInferenceGeomSendDttm(geoUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateGukYuinMastRegResult(Basic resultBody) {
|
||||||
|
gukYuinPnuRepository.updateGukYuinMastRegResult(resultBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateGukYuinMastRegRemove(Basic resultBody) {
|
||||||
|
gukYuinPnuRepository.updateGukYuinMastRegRemove(resultBody);
|
||||||
|
}
|
||||||
|
|
||||||
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
gukYuinPnuRepository.updateInferenceGeomDataPnuCnt(chnDtctObjtId, pnuCnt);
|
gukYuinPnuRepository.updateInferenceGeomDataPnuCnt(chnDtctObjtId, pnuCnt);
|
||||||
}
|
}
|
||||||
@@ -37,8 +57,23 @@ public class GukYuinPnuJobCoreService {
|
|||||||
return gukYuinPnuRepository.findMapSheetAnalDataInferenceGeomUid(chnDtctObjtId);
|
return gukYuinPnuRepository.findMapSheetAnalDataInferenceGeomUid(chnDtctObjtId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
||||||
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
gukYuinPnuRepository.insertGeoUidPnuData(geoUid, pnuList);
|
||||||
gukYuinPnuRepository.insertGeoUidPnuData(geoUid, pnuList, chnDtctObjtId);
|
}
|
||||||
|
|
||||||
|
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
||||||
|
return gukYuinPnuRepository.findMapSheetLearnInfo(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy) {
|
||||||
|
return gukYuinPnuRepository.findMapSheetLearnYearStage(compareYyyy, targetYyyy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAnalInferenceApplyDttm(Basic registRes) {
|
||||||
|
gukYuinPnuRepository.updateAnalInferenceApplyDttm(registRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
||||||
|
return gukYuinPnuRepository.findLabelingCompleteSendList(yesterday);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
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.GukYuinDto.GeomUidDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinStbltJobRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.gukyuin.GukYuinStbltJobRepository;
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class GukYuinStbltJobCoreService {
|
public class GukYuinStbltJobCoreService {
|
||||||
@@ -18,58 +16,23 @@ public class GukYuinStbltJobCoreService {
|
|||||||
this.gukYuinStbltRepository = gukYuinStbltRepository;
|
this.gukYuinStbltRepository = gukYuinStbltRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LearnKeyDto> findGukYuinEligibleForSurveyList(String status) {
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
return gukYuinStbltRepository.findGukYuinEligibleForSurveyList(status);
|
gukYuinStbltRepository.updateGukYuinApplyStateComplete(id, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus) {
|
||||||
public void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto) {
|
return gukYuinStbltRepository.findGukyuinApplyStatusUidList(gukYuinStatus);
|
||||||
String chnDtctObjtId = "";
|
|
||||||
PnuEntity entity =
|
|
||||||
gukYuinStbltRepository.findPnuEntityByResultUid(resultUid, stbltDto.getPnu());
|
|
||||||
|
|
||||||
if (entity != null) {
|
|
||||||
chnDtctObjtId = resultUid;
|
|
||||||
|
|
||||||
entity.setPnuDtctId(stbltDto.getPnuDtctId());
|
|
||||||
entity.setPnu(stbltDto.getPnu());
|
|
||||||
entity.setLrmSyncYmd(stbltDto.getLrmSyncYmd());
|
|
||||||
entity.setPnuSyncYmd(stbltDto.getPnuSyncYmd());
|
|
||||||
entity.setMpqdNo(stbltDto.getMpqdNo());
|
|
||||||
entity.setCprsYr(stbltDto.getCprsYr());
|
|
||||||
entity.setCrtrYr(stbltDto.getCrtrYr());
|
|
||||||
entity.setChnDtctSno(stbltDto.getChnDtctSno());
|
|
||||||
entity.setChnDtctId(stbltDto.getChnDtctId());
|
|
||||||
entity.setChnDtctMstId(stbltDto.getChnDtctMstId());
|
|
||||||
entity.setChnDtctObjtId(stbltDto.getChnDtctObjtId());
|
|
||||||
entity.setChnDtctContId(stbltDto.getChnDtctContId());
|
|
||||||
entity.setChnCd(stbltDto.getChnCd());
|
|
||||||
entity.setBfClsCd(stbltDto.getBfClsCd());
|
|
||||||
entity.setBfClsProb(stbltDto.getBfClsProb());
|
|
||||||
entity.setAfClsCd(stbltDto.getAfClsCd());
|
|
||||||
entity.setAfClsProb(stbltDto.getAfClsProb());
|
|
||||||
entity.setPnuSqms(stbltDto.getPnuSqms());
|
|
||||||
entity.setPnuDtctSqms(stbltDto.getPnuDtctSqms());
|
|
||||||
entity.setChnDtctSqms(stbltDto.getChnDtctSqms());
|
|
||||||
entity.setStbltYn(stbltDto.getStbltYn());
|
|
||||||
entity.setIncyCd(stbltDto.getIncyCd());
|
|
||||||
entity.setIncyRsnCont(stbltDto.getIncyRsnCont());
|
|
||||||
entity.setLockYn(stbltDto.getLockYn());
|
|
||||||
entity.setLblYn(stbltDto.getLblYn());
|
|
||||||
entity.setChgYn(stbltDto.getChgYn());
|
|
||||||
entity.setRsatctNo(stbltDto.getRsatctNo());
|
|
||||||
entity.setRmk(stbltDto.getRmk());
|
|
||||||
entity.setCrtDt(stbltDto.getCrtDt());
|
|
||||||
entity.setCrtEpno(stbltDto.getCrtEpno());
|
|
||||||
entity.setCrtIp(stbltDto.getCrtIp());
|
|
||||||
entity.setChgDt(stbltDto.getChgDt());
|
|
||||||
entity.setChgIp(stbltDto.getChgIp());
|
|
||||||
entity.setDelYn(stbltDto.getDelYn().equals("Y"));
|
|
||||||
|
|
||||||
entity.setCreatedDttm(ZonedDateTime.now());
|
|
||||||
gukYuinStbltRepository.save(entity);
|
|
||||||
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
return gukYuinStbltRepository.upsertMapSheetDataAnalGeomPnu(chnDtctObjtId, pnuList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
|
return gukYuinStbltRepository.findYesterdayLabelingCompleteList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
|
gukYuinStbltRepository.updateAnalDataInferenceGeomSendDttm(geoUid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.scheduler.TrainingDataLabelJobRepository;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class TrainingDataLabelJobCoreService {
|
|
||||||
|
|
||||||
private final TrainingDataLabelJobRepository trainingDataLabelJobRepository;
|
|
||||||
|
|
||||||
public List<Tasks> findCompletedYesterdayUnassigned() {
|
|
||||||
return trainingDataLabelJobRepository.findCompletedYesterdayUnassigned();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId) {
|
|
||||||
trainingDataLabelJobRepository.assignReviewerBatch(assignmentUids, reviewerId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InspectorPendingDto> findInspectorPendingByRound(Long analUid) {
|
|
||||||
return trainingDataLabelJobRepository.findInspectorPendingByRound(analUid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void lockInspectors(Long analUid, List<String> reviewerIds) {
|
|
||||||
trainingDataLabelJobRepository.lockInspectors(analUid, reviewerIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateGeomUidTestState(List<Long> geomUids) {
|
|
||||||
trainingDataLabelJobRepository.updateGeomUidTestState(geomUids);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,10 @@ import com.kamco.cd.kamcoback.postgres.repository.scheduler.TrainingDataReviewJo
|
|||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -14,6 +17,34 @@ public class TrainingDataReviewJobCoreService {
|
|||||||
|
|
||||||
private final TrainingDataReviewJobRepository trainingDataReviewJobRepository;
|
private final TrainingDataReviewJobRepository trainingDataReviewJobRepository;
|
||||||
|
|
||||||
|
public List<Tasks> findCompletedYesterdayUnassigned() {
|
||||||
|
return trainingDataReviewJobRepository.findCompletedYesterdayUnassigned();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assignReviewer(UUID assignmentUid, String reviewerId) {
|
||||||
|
trainingDataReviewJobRepository.assignReviewer(assignmentUid, reviewerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId) {
|
||||||
|
trainingDataReviewJobRepository.assignReviewerBatch(assignmentUids, reviewerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tasks findAssignmentTask(String assignmentUid) {
|
||||||
|
return trainingDataReviewJobRepository.findAssignmentTask(assignmentUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<InspectorPendingDto> findInspectorPendingByRound(Long analUid) {
|
||||||
|
return trainingDataReviewJobRepository.findInspectorPendingByRound(analUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void lockInspectors(Long analUid, List<String> reviewerIds) {
|
||||||
|
trainingDataReviewJobRepository.lockInspectors(analUid, reviewerIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateGeomUidTestState(List<Long> geomUids) {
|
||||||
|
trainingDataReviewJobRepository.updateGeomUidTestState(geomUids);
|
||||||
|
}
|
||||||
|
|
||||||
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
||||||
Long analUid, String mapSheetNum) {
|
Long analUid, String mapSheetNum) {
|
||||||
return trainingDataReviewJobRepository.findCompletedYesterdayLabelingList(analUid, mapSheetNum);
|
return trainingDataReviewJobRepository.findCompletedYesterdayLabelingList(analUid, mapSheetNum);
|
||||||
|
|||||||
@@ -159,9 +159,6 @@ public class MapSheetAnalDataInferenceGeomEntity {
|
|||||||
@Column(name = "label_send_dttm")
|
@Column(name = "label_send_dttm")
|
||||||
private ZonedDateTime labelSendDttm;
|
private ZonedDateTime labelSendDttm;
|
||||||
|
|
||||||
@Column(name = "lock_yn")
|
|
||||||
private String lockYn;
|
|
||||||
|
|
||||||
public InferenceDetailDto.DetailListEntity toEntity() {
|
public InferenceDetailDto.DetailListEntity toEntity() {
|
||||||
DetectionClassification classification = DetectionClassification.fromString(classBeforeCd);
|
DetectionClassification classification = DetectionClassification.fromString(classBeforeCd);
|
||||||
Clazzes comparedClazz = new Clazzes(classification, classBeforeProb);
|
Clazzes comparedClazz = new Clazzes(classification, classBeforeProb);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import jakarta.persistence.SequenceGenerator;
|
|||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
@@ -39,7 +39,7 @@ public class PnuEntity {
|
|||||||
private String pnu;
|
private String pnu;
|
||||||
|
|
||||||
@Column(name = "created_dttm")
|
@Column(name = "created_dttm")
|
||||||
private ZonedDateTime createdDttm;
|
private OffsetDateTime createdDttm;
|
||||||
|
|
||||||
@Column(name = "created_uid")
|
@Column(name = "created_uid")
|
||||||
private Long createdUid;
|
private Long createdUid;
|
||||||
@@ -47,140 +47,4 @@ public class PnuEntity {
|
|||||||
@ColumnDefault("false")
|
@ColumnDefault("false")
|
||||||
@Column(name = "del_yn")
|
@Column(name = "del_yn")
|
||||||
private Boolean delYn;
|
private Boolean delYn;
|
||||||
|
|
||||||
@Size(max = 40)
|
|
||||||
@Column(name = "pnu_dtct_id", length = 40)
|
|
||||||
private String pnuDtctId;
|
|
||||||
|
|
||||||
@Size(max = 10)
|
|
||||||
@Column(name = "lrm_sync_ymd", length = 10)
|
|
||||||
private String lrmSyncYmd;
|
|
||||||
|
|
||||||
@Size(max = 10)
|
|
||||||
@Column(name = "pnu_sync_ymd", length = 10)
|
|
||||||
private String pnuSyncYmd;
|
|
||||||
|
|
||||||
@Size(max = 20)
|
|
||||||
@Column(name = "mpqd_no", length = 20)
|
|
||||||
private String mpqdNo;
|
|
||||||
|
|
||||||
@Size(max = 10)
|
|
||||||
@Column(name = "cprs_yr", length = 10)
|
|
||||||
private String cprsYr;
|
|
||||||
|
|
||||||
@Size(max = 10)
|
|
||||||
@Column(name = "crtr_yr", length = 10)
|
|
||||||
private String crtrYr;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@Column(name = "chn_dtct_id")
|
|
||||||
private String chnDtctId;
|
|
||||||
|
|
||||||
@Size(max = 10)
|
|
||||||
@Column(name = "chn_dtct_mst_id", length = 10)
|
|
||||||
private String chnDtctMstId;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@Column(name = "chn_dtct_objt_id")
|
|
||||||
private String chnDtctObjtId;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@Column(name = "chn_dtct_cont_id")
|
|
||||||
private String chnDtctContId;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "chn_cd", length = 50)
|
|
||||||
private String chnCd;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "chn_dtct_prob", length = 50)
|
|
||||||
private String chnDtctProb;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "bf_cls_cd", length = 50)
|
|
||||||
private String bfClsCd;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "bf_cls_prob", length = 50)
|
|
||||||
private String bfClsProb;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "af_cls_cd", length = 50)
|
|
||||||
private String afClsCd;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "af_cls_prob", length = 50)
|
|
||||||
private String afClsProb;
|
|
||||||
|
|
||||||
@Size(max = 100)
|
|
||||||
@Column(name = "pnu_sqms", length = 100)
|
|
||||||
private String pnuSqms;
|
|
||||||
|
|
||||||
@Size(max = 100)
|
|
||||||
@Column(name = "pnu_dtct_sqms", length = 100)
|
|
||||||
private String pnuDtctSqms;
|
|
||||||
|
|
||||||
@Size(max = 100)
|
|
||||||
@Column(name = "chn_dtct_sqms", length = 100)
|
|
||||||
private String chnDtctSqms;
|
|
||||||
|
|
||||||
@Size(max = 1)
|
|
||||||
@Column(name = "stblt_yn", length = 1)
|
|
||||||
private String stbltYn;
|
|
||||||
|
|
||||||
@Size(max = 30)
|
|
||||||
@Column(name = "incy_cd", length = 30)
|
|
||||||
private String incyCd;
|
|
||||||
|
|
||||||
@Size(max = 255)
|
|
||||||
@Column(name = "incy_rsn_cont")
|
|
||||||
private String incyRsnCont;
|
|
||||||
|
|
||||||
@Size(max = 1)
|
|
||||||
@Column(name = "lock_yn", length = 1)
|
|
||||||
private String lockYn;
|
|
||||||
|
|
||||||
@Size(max = 1)
|
|
||||||
@Column(name = "lbl_yn", length = 1)
|
|
||||||
private String lblYn;
|
|
||||||
|
|
||||||
@Size(max = 1)
|
|
||||||
@Column(name = "chg_yn", length = 1)
|
|
||||||
private String chgYn;
|
|
||||||
|
|
||||||
@Size(max = 50)
|
|
||||||
@Column(name = "rsatct_no", length = 50)
|
|
||||||
private String rsatctNo;
|
|
||||||
|
|
||||||
@Size(max = 100)
|
|
||||||
@Column(name = "rmk", length = 100)
|
|
||||||
private String rmk;
|
|
||||||
|
|
||||||
@Size(max = 20)
|
|
||||||
@Column(name = "crt_dt", length = 20)
|
|
||||||
private String crtDt;
|
|
||||||
|
|
||||||
@Size(max = 20)
|
|
||||||
@Column(name = "crt_epno", length = 20)
|
|
||||||
private String crtEpno;
|
|
||||||
|
|
||||||
@Size(max = 20)
|
|
||||||
@Column(name = "crt_ip", length = 20)
|
|
||||||
private String crtIp;
|
|
||||||
|
|
||||||
@Size(max = 20)
|
|
||||||
@Column(name = "chg_dt", length = 20)
|
|
||||||
private String chgDt;
|
|
||||||
|
|
||||||
@Size(max = 20)
|
|
||||||
@Column(name = "chg_epno", length = 20)
|
|
||||||
private String chgEpno;
|
|
||||||
|
|
||||||
@Size(max = 20)
|
|
||||||
@Column(name = "chg_ip", length = 20)
|
|
||||||
private String chgIp;
|
|
||||||
|
|
||||||
@Size(max = 10)
|
|
||||||
@Column(name = "chn_dtct_sno", length = 10)
|
|
||||||
private String chnDtctSno;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,42 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface GukYuinLabelJobRepositoryCustom {
|
public interface GukYuinLabelJobRepositoryCustom {
|
||||||
|
|
||||||
|
void updateGukYuinMastRegResult(Basic resultBody);
|
||||||
|
|
||||||
|
void updateGukYuinMastRegRemove(Basic resultBody);
|
||||||
|
|
||||||
|
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
||||||
|
|
||||||
|
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
||||||
|
|
||||||
|
void insertGeoUidPnuData(Long geoUid, String[] pnuList);
|
||||||
|
|
||||||
|
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
||||||
|
|
||||||
|
List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus);
|
||||||
|
|
||||||
|
long upsertMapSheetDataAnalGeomPnu(String uid, String[] pnuList);
|
||||||
|
|
||||||
|
LearnInfo findMapSheetLearnInfo(UUID uuid);
|
||||||
|
|
||||||
|
Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy);
|
||||||
|
|
||||||
|
void updateAnalInferenceApplyDttm(Basic registRes);
|
||||||
|
|
||||||
List<GeomUidDto> findYesterdayLabelingCompleteList();
|
List<GeomUidDto> findYesterdayLabelingCompleteList();
|
||||||
|
|
||||||
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
||||||
|
|
||||||
|
List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,18 +4,28 @@ import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.l
|
|||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QPnuEntity.pnuEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
|
import com.querydsl.core.types.dsl.NumberExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import jakarta.persistence.PersistenceContext;
|
import jakarta.persistence.PersistenceContext;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -26,23 +36,172 @@ public class GukYuinLabelJobRepositoryImpl implements GukYuinLabelJobRepositoryC
|
|||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
@PersistenceContext private EntityManager em;
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGukYuinMastRegResult(Basic resultBody) {
|
||||||
|
|
||||||
|
int excnPgrt = Integer.parseInt(resultBody.getExcnPgrt());
|
||||||
|
int stage = Integer.parseInt(resultBody.getChnDtctSno());
|
||||||
|
GukYuinStatus status = GukYuinStatus.IN_PROGRESS;
|
||||||
|
if (excnPgrt == 100) {
|
||||||
|
status = GukYuinStatus.GUK_COMPLETED;
|
||||||
|
}
|
||||||
|
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.stage, stage)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetLearnEntity.chnDtctMstId, resultBody.getChnDtctMstId())
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGukYuinMastRegRemove(Basic resultBody) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.CANCELED.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.pnu, pnuCnt)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId) {
|
||||||
|
return queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
||||||
|
for (String pnu : pnuList) {
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now())
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> status) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LearnKeyDto.class,
|
||||||
|
mapSheetLearnEntity.id,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetLearnEntity.chnDtctMstId))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.applyStatus.in(status))
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
long length = pnuList.length;
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.pnu, length)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
Long geoUid =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
long succCnt = 0;
|
||||||
|
for (String pnu : pnuList) {
|
||||||
|
long result =
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now())
|
||||||
|
.execute();
|
||||||
|
if (result > 0) {
|
||||||
|
succCnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return succCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LearnInfo.class,
|
||||||
|
mapSheetLearnEntity.id,
|
||||||
|
mapSheetLearnEntity.uuid,
|
||||||
|
mapSheetLearnEntity.compareYyyy,
|
||||||
|
mapSheetLearnEntity.targetYyyy,
|
||||||
|
mapSheetLearnEntity.stage,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetLearnEntity.applyStatus))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy) {
|
||||||
|
NumberExpression<Integer> stageExpr =
|
||||||
|
Expressions.numberTemplate(Integer.class, "coalesce({0}, 0)", mapSheetLearnEntity.stage);
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(stageExpr.max().coalesce(0))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(
|
||||||
|
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
||||||
|
mapSheetLearnEntity.targetYyyy.eq(targetYyyy),
|
||||||
|
mapSheetLearnEntity.applyStatus.isNotNull(),
|
||||||
|
mapSheetLearnEntity.applyStatus.ne(GukYuinStatus.PENDING.getId()))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalInferenceApplyDttm(Basic registRes) {
|
||||||
|
Long learnId =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetLearnEntity.id)
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(registRes.getChnDtctId()))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalInferenceEntity)
|
||||||
|
.set(mapSheetAnalInferenceEntity.gukyuinUsed, "Y")
|
||||||
|
.set(mapSheetAnalInferenceEntity.gukyuinApplyDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
ZoneId zone = ZoneId.of("Asia/Seoul");
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
||||||
ZonedDateTime tomorrowStart = todayStart.plusDays(1);
|
|
||||||
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
||||||
|
|
||||||
// BooleanExpression isYesterday =
|
|
||||||
// labelingAssignmentEntity
|
|
||||||
// .inspectStatDttm
|
|
||||||
// .goe(yesterdayStart)
|
|
||||||
// .and(labelingAssignmentEntity.inspectStatDttm.lt(todayStart));
|
|
||||||
BooleanExpression isYesterday =
|
BooleanExpression isYesterday =
|
||||||
labelingAssignmentEntity
|
labelingAssignmentEntity
|
||||||
.inspectStatDttm
|
.inspectStatDttm
|
||||||
.goe(todayStart)
|
.goe(yesterdayStart)
|
||||||
.and(labelingAssignmentEntity.inspectStatDttm.lt(tomorrowStart));
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(todayStart));
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
@@ -74,4 +233,47 @@ public class GukYuinLabelJobRepositoryImpl implements GukYuinLabelJobRepositoryC
|
|||||||
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.eq(geoUid))
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.eq(geoUid))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
||||||
|
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
ZonedDateTime from = yesterday.atStartOfDay(zone);
|
||||||
|
ZonedDateTime to = from.plusDays(1);
|
||||||
|
|
||||||
|
BooleanExpression isYesterday =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.inspectStatDttm
|
||||||
|
.goe(from)
|
||||||
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(to));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LabelSendDto.class,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid,
|
||||||
|
labelingAssignmentEntity.workerUid,
|
||||||
|
labelingAssignmentEntity.workStatDttm,
|
||||||
|
labelingAssignmentEntity.inspectorUid,
|
||||||
|
labelingAssignmentEntity.inspectStatDttm,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.labelSendDttm))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.eq(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||||
|
.where(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()), isYesterday)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetLearnEntity.id.eq(id))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,42 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
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.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface GukYuinPnuJobRepositoryCustom {
|
public interface GukYuinPnuJobRepositoryCustom {
|
||||||
|
|
||||||
|
void updateGukYuinMastRegResult(Basic resultBody);
|
||||||
|
|
||||||
|
void updateGukYuinMastRegRemove(Basic resultBody);
|
||||||
|
|
||||||
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
||||||
|
|
||||||
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
||||||
|
|
||||||
void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId);
|
void insertGeoUidPnuData(Long geoUid, String[] pnuList);
|
||||||
|
|
||||||
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
||||||
|
|
||||||
List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus);
|
List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus);
|
||||||
|
|
||||||
long upsertMapSheetDataAnalGeomPnu(String uid, String[] pnuList);
|
long upsertMapSheetDataAnalGeomPnu(String uid, String[] pnuList);
|
||||||
|
|
||||||
|
LearnInfo findMapSheetLearnInfo(UUID uuid);
|
||||||
|
|
||||||
|
Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy);
|
||||||
|
|
||||||
|
void updateAnalInferenceApplyDttm(Basic registRes);
|
||||||
|
|
||||||
|
List<GeomUidDto> findYesterdayLabelingCompleteList();
|
||||||
|
|
||||||
|
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
||||||
|
|
||||||
|
List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,31 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
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.QPnuEntity.pnuEntity;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
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.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
|
import com.querydsl.core.types.dsl.NumberExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import jakarta.persistence.PersistenceContext;
|
import jakarta.persistence.PersistenceContext;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -24,6 +36,36 @@ public class GukYuinPnuJobRepositoryImpl implements GukYuinPnuJobRepositoryCusto
|
|||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
@PersistenceContext private EntityManager em;
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGukYuinMastRegResult(Basic resultBody) {
|
||||||
|
|
||||||
|
int excnPgrt = Integer.parseInt(resultBody.getExcnPgrt());
|
||||||
|
int stage = Integer.parseInt(resultBody.getChnDtctSno());
|
||||||
|
GukYuinStatus status = GukYuinStatus.IN_PROGRESS;
|
||||||
|
if (excnPgrt == 100) {
|
||||||
|
status = GukYuinStatus.GUK_COMPLETED;
|
||||||
|
}
|
||||||
|
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.stage, stage)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetLearnEntity.chnDtctMstId, resultBody.getChnDtctMstId())
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGukYuinMastRegRemove(Basic resultBody) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.CANCELED.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
queryFactory
|
queryFactory
|
||||||
@@ -43,23 +85,15 @@ public class GukYuinPnuJobRepositoryImpl implements GukYuinPnuJobRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
||||||
for (String pnu : pnuList) {
|
for (String pnu : pnuList) {
|
||||||
PnuEntity entity =
|
|
||||||
queryFactory
|
|
||||||
.selectFrom(pnuEntity)
|
|
||||||
.where(pnuEntity.pnu.eq(pnu), pnuEntity.chnDtctObjtId.eq(chnDtctObjtId))
|
|
||||||
.fetchOne();
|
|
||||||
if (entity == null) {
|
|
||||||
queryFactory
|
queryFactory
|
||||||
.insert(pnuEntity)
|
.insert(pnuEntity)
|
||||||
.columns(
|
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
||||||
pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm, pnuEntity.chnDtctObjtId)
|
.values(geoUid, pnu, ZonedDateTime.now())
|
||||||
.values(geoUid, pnu, ZonedDateTime.now(), chnDtctObjtId)
|
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> status) {
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> status) {
|
||||||
@@ -96,12 +130,8 @@ public class GukYuinPnuJobRepositoryImpl implements GukYuinPnuJobRepositoryCusto
|
|||||||
long result =
|
long result =
|
||||||
queryFactory
|
queryFactory
|
||||||
.insert(pnuEntity)
|
.insert(pnuEntity)
|
||||||
.columns(
|
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
||||||
pnuEntity.geo.geoUid,
|
.values(geoUid, pnu, ZonedDateTime.now())
|
||||||
pnuEntity.pnu,
|
|
||||||
pnuEntity.createdDttm,
|
|
||||||
pnuEntity.chnDtctObjtId)
|
|
||||||
.values(geoUid, pnu, ZonedDateTime.now(), chnDtctObjtId)
|
|
||||||
.execute();
|
.execute();
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
succCnt++;
|
succCnt++;
|
||||||
@@ -110,6 +140,132 @@ public class GukYuinPnuJobRepositoryImpl implements GukYuinPnuJobRepositoryCusto
|
|||||||
return succCnt;
|
return succCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LearnInfo.class,
|
||||||
|
mapSheetLearnEntity.id,
|
||||||
|
mapSheetLearnEntity.uuid,
|
||||||
|
mapSheetLearnEntity.compareYyyy,
|
||||||
|
mapSheetLearnEntity.targetYyyy,
|
||||||
|
mapSheetLearnEntity.stage,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetLearnEntity.applyStatus))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy) {
|
||||||
|
NumberExpression<Integer> stageExpr =
|
||||||
|
Expressions.numberTemplate(Integer.class, "coalesce({0}, 0)", mapSheetLearnEntity.stage);
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(stageExpr.max().coalesce(0))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(
|
||||||
|
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
||||||
|
mapSheetLearnEntity.targetYyyy.eq(targetYyyy),
|
||||||
|
mapSheetLearnEntity.applyStatus.isNotNull(),
|
||||||
|
mapSheetLearnEntity.applyStatus.ne(GukYuinStatus.PENDING.getId()))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalInferenceApplyDttm(Basic registRes) {
|
||||||
|
Long learnId =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetLearnEntity.id)
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(registRes.getChnDtctId()))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalInferenceEntity)
|
||||||
|
.set(mapSheetAnalInferenceEntity.gukyuinUsed, "Y")
|
||||||
|
.set(mapSheetAnalInferenceEntity.gukyuinApplyDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
||||||
|
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
||||||
|
|
||||||
|
BooleanExpression isYesterday =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.inspectStatDttm
|
||||||
|
.goe(yesterdayStart)
|
||||||
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(todayStart));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
GeomUidDto.class,
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.eq(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
|
.innerJoin(mapSheetLearnEntity)
|
||||||
|
.on(
|
||||||
|
mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id),
|
||||||
|
mapSheetLearnEntity.applyStatus.in(
|
||||||
|
GukYuinStatus.GUK_COMPLETED.getId(), GukYuinStatus.PNU_COMPLETED.getId()))
|
||||||
|
.where(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()), isYesterday)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.labelSendDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.eq(geoUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
||||||
|
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
ZonedDateTime from = yesterday.atStartOfDay(zone);
|
||||||
|
ZonedDateTime to = from.plusDays(1);
|
||||||
|
|
||||||
|
BooleanExpression isYesterday =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.inspectStatDttm
|
||||||
|
.goe(from)
|
||||||
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(to));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LabelSendDto.class,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid,
|
||||||
|
labelingAssignmentEntity.workerUid,
|
||||||
|
labelingAssignmentEntity.workStatDttm,
|
||||||
|
labelingAssignmentEntity.inspectorUid,
|
||||||
|
labelingAssignmentEntity.inspectStatDttm,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.labelSendDttm))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.eq(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||||
|
.where(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()), isYesterday)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ public interface GukYuinRepositoryCustom {
|
|||||||
|
|
||||||
void updateGukYuinMastRegResult(Basic resultBody);
|
void updateGukYuinMastRegResult(Basic resultBody);
|
||||||
|
|
||||||
void updateGukYuinMastRegRemove(String chnDtctId);
|
void updateGukYuinMastRegRemove(Basic resultBody);
|
||||||
|
|
||||||
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
||||||
|
|
||||||
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
||||||
|
|
||||||
void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId);
|
void insertGeoUidPnuData(Long geoUid, String[] pnuList);
|
||||||
|
|
||||||
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
||||||
|
|
||||||
@@ -39,10 +39,4 @@ public interface GukYuinRepositoryCustom {
|
|||||||
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
||||||
|
|
||||||
List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday);
|
List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday);
|
||||||
|
|
||||||
Long findMapSheetLearnInfoByYyyy(Integer compareYyyy, Integer targetYyyy, Integer maxStage);
|
|
||||||
|
|
||||||
void updateMapSheetLearnGukyuinEndStatus(Long learnId);
|
|
||||||
|
|
||||||
void updateMapSheetInferenceLabelEndStatus(Long learnId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
|||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
import com.querydsl.core.types.dsl.Expressions;
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
@@ -61,13 +59,12 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateGukYuinMastRegRemove(String chnDtctId) {
|
public void updateGukYuinMastRegRemove(Basic resultBody) {
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetLearnEntity)
|
.update(mapSheetLearnEntity)
|
||||||
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.CANCELED.getId())
|
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.CANCELED.getId())
|
||||||
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
.set(mapSheetLearnEntity.applyYn, false)
|
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
||||||
.where(mapSheetLearnEntity.uid.eq(chnDtctId))
|
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,27 +87,15 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertGeoUidPnuData(Long geoUid, String[] pnuList, String chnDtctObjtId) {
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
||||||
for (String pnu : pnuList) {
|
for (String pnu : pnuList) {
|
||||||
PnuEntity entity =
|
|
||||||
queryFactory
|
|
||||||
.selectFrom(pnuEntity)
|
|
||||||
.where(
|
|
||||||
pnuEntity.geo.geoUid.eq(geoUid),
|
|
||||||
pnuEntity.pnu.eq(pnu),
|
|
||||||
pnuEntity.chnDtctObjtId.eq(chnDtctObjtId))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
if (entity == null) {
|
|
||||||
queryFactory
|
queryFactory
|
||||||
.insert(pnuEntity)
|
.insert(pnuEntity)
|
||||||
.columns(
|
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
||||||
pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm, pnuEntity.chnDtctObjtId)
|
.values(geoUid, pnu, ZonedDateTime.now())
|
||||||
.values(geoUid, pnu, ZonedDateTime.now(), chnDtctObjtId)
|
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> status) {
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> status) {
|
||||||
@@ -205,7 +190,6 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
.update(mapSheetAnalInferenceEntity)
|
.update(mapSheetAnalInferenceEntity)
|
||||||
.set(mapSheetAnalInferenceEntity.gukyuinUsed, "Y")
|
.set(mapSheetAnalInferenceEntity.gukyuinUsed, "Y")
|
||||||
.set(mapSheetAnalInferenceEntity.gukyuinApplyDttm, ZonedDateTime.now())
|
.set(mapSheetAnalInferenceEntity.gukyuinApplyDttm, ZonedDateTime.now())
|
||||||
.set(mapSheetAnalInferenceEntity.stage, Integer.parseInt(registRes.getChnDtctSno()))
|
|
||||||
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -285,39 +269,6 @@ public class GukYuinRepositoryImpl implements GukYuinRepositoryCustom {
|
|||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long findMapSheetLearnInfoByYyyy(
|
|
||||||
Integer compareYyyy, Integer targetYyyy, Integer maxStage) {
|
|
||||||
return queryFactory
|
|
||||||
.select(mapSheetLearnEntity.id)
|
|
||||||
.from(mapSheetLearnEntity)
|
|
||||||
.where(
|
|
||||||
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
|
||||||
mapSheetLearnEntity.targetYyyy.eq(targetYyyy),
|
|
||||||
mapSheetLearnEntity.stage.eq(maxStage))
|
|
||||||
.fetchOne();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateMapSheetLearnGukyuinEndStatus(Long learnId) {
|
|
||||||
queryFactory
|
|
||||||
.update(mapSheetLearnEntity)
|
|
||||||
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.END.getId())
|
|
||||||
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
|
||||||
.where(mapSheetLearnEntity.id.eq(learnId))
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateMapSheetInferenceLabelEndStatus(Long learnId) {
|
|
||||||
queryFactory
|
|
||||||
.update(mapSheetAnalInferenceEntity)
|
|
||||||
.set(mapSheetAnalInferenceEntity.analState, LabelMngState.FINISH.getId())
|
|
||||||
.set(mapSheetAnalInferenceEntity.updatedDttm, ZonedDateTime.now())
|
|
||||||
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface GukYuinStbltJobRepository
|
public interface GukYuinStbltJobRepository
|
||||||
extends JpaRepository<PnuEntity, Long>, GukYuinStbltJobRepositoryCustom {}
|
extends JpaRepository<MapSheetLearnEntity, Long>, GukYuinStbltJobRepositoryCustom {}
|
||||||
|
|||||||
@@ -1,15 +1,42 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
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.GukYuinDto.GeomUidDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface GukYuinStbltJobRepositoryCustom {
|
public interface GukYuinStbltJobRepositoryCustom {
|
||||||
|
|
||||||
List<LearnKeyDto> findGukYuinEligibleForSurveyList(String status);
|
void updateGukYuinMastRegResult(Basic resultBody);
|
||||||
|
|
||||||
void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto);
|
void updateGukYuinMastRegRemove(Basic resultBody);
|
||||||
|
|
||||||
PnuEntity findPnuEntityByResultUid(String resultUid, String pnu);
|
void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt);
|
||||||
|
|
||||||
|
Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId);
|
||||||
|
|
||||||
|
void insertGeoUidPnuData(Long geoUid, String[] pnuList);
|
||||||
|
|
||||||
|
void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status);
|
||||||
|
|
||||||
|
List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> gukYuinStatus);
|
||||||
|
|
||||||
|
long upsertMapSheetDataAnalGeomPnu(String uid, String[] pnuList);
|
||||||
|
|
||||||
|
LearnInfo findMapSheetLearnInfo(UUID uuid);
|
||||||
|
|
||||||
|
Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy);
|
||||||
|
|
||||||
|
void updateAnalInferenceApplyDttm(Basic registRes);
|
||||||
|
|
||||||
|
List<GeomUidDto> findYesterdayLabelingCompleteList();
|
||||||
|
|
||||||
|
void updateAnalDataInferenceGeomSendDttm(Long geoUid);
|
||||||
|
|
||||||
|
List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,31 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
package com.kamco.cd.kamcoback.postgres.repository.gukyuin;
|
||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
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.QPnuEntity.pnuEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LabelSendDto;
|
||||||
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.GukYuinDto.GeomUidDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.LearnInfo;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.PnuEntity;
|
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
|
import com.querydsl.core.types.dsl.NumberExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
import jakarta.persistence.EntityManager;
|
import jakarta.persistence.EntityManager;
|
||||||
import jakarta.persistence.PersistenceContext;
|
import jakarta.persistence.PersistenceContext;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@@ -29,7 +37,66 @@ public class GukYuinStbltJobRepositoryImpl implements GukYuinStbltJobRepositoryC
|
|||||||
@PersistenceContext private EntityManager em;
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LearnKeyDto> findGukYuinEligibleForSurveyList(String status) {
|
public void updateGukYuinMastRegResult(Basic resultBody) {
|
||||||
|
|
||||||
|
int excnPgrt = Integer.parseInt(resultBody.getExcnPgrt());
|
||||||
|
int stage = Integer.parseInt(resultBody.getChnDtctSno());
|
||||||
|
GukYuinStatus status = GukYuinStatus.IN_PROGRESS;
|
||||||
|
if (excnPgrt == 100) {
|
||||||
|
status = GukYuinStatus.GUK_COMPLETED;
|
||||||
|
}
|
||||||
|
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.stage, stage)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.set(mapSheetLearnEntity.chnDtctMstId, resultBody.getChnDtctMstId())
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGukYuinMastRegRemove(Basic resultBody) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, GukYuinStatus.CANCELED.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(resultBody.getChnDtctId()))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateInferenceGeomDataPnuCnt(String chnDtctObjtId, long pnuCnt) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.pnu, pnuCnt)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long findMapSheetAnalDataInferenceGeomUid(String chnDtctObjtId) {
|
||||||
|
return queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertGeoUidPnuData(Long geoUid, String[] pnuList) {
|
||||||
|
for (String pnu : pnuList) {
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now())
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LearnKeyDto> findGukyuinApplyStatusUidList(List<String> status) {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
@@ -38,56 +105,175 @@ public class GukYuinStbltJobRepositoryImpl implements GukYuinStbltJobRepositoryC
|
|||||||
mapSheetLearnEntity.uid,
|
mapSheetLearnEntity.uid,
|
||||||
mapSheetLearnEntity.chnDtctMstId))
|
mapSheetLearnEntity.chnDtctMstId))
|
||||||
.from(mapSheetLearnEntity)
|
.from(mapSheetLearnEntity)
|
||||||
.innerJoin(mapSheetAnalInferenceEntity)
|
.where(mapSheetLearnEntity.applyStatus.in(status))
|
||||||
.on(mapSheetLearnEntity.id.eq(mapSheetAnalInferenceEntity.learnId))
|
|
||||||
.innerJoin(mapSheetAnalDataInferenceEntity)
|
|
||||||
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
|
||||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
|
||||||
.on(mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid))
|
|
||||||
.where(
|
|
||||||
mapSheetLearnEntity.applyStatus.eq(GukYuinStatus.PNU_COMPLETED.getId()),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.fitState.isNull())
|
|
||||||
.groupBy(mapSheetLearnEntity.id, mapSheetLearnEntity.uid, mapSheetLearnEntity.chnDtctMstId)
|
|
||||||
.having(mapSheetAnalDataInferenceGeomEntity.geoUid.count().gt(1L))
|
|
||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateGukYuinEligibleForSurvey(String resultUid, RlbDtctMastDto stbltDto) {
|
public long upsertMapSheetDataAnalGeomPnu(String chnDtctObjtId, String[] pnuList) {
|
||||||
|
long length = pnuList.length;
|
||||||
MapSheetAnalDataInferenceGeomEntity geomEntity =
|
|
||||||
queryFactory
|
|
||||||
.selectFrom(mapSheetAnalDataInferenceGeomEntity)
|
|
||||||
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(resultUid))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
if (geomEntity != null) {
|
|
||||||
PnuEntity pnuEt =
|
|
||||||
queryFactory
|
|
||||||
.selectFrom(pnuEntity)
|
|
||||||
.where(pnuEntity.chnDtctObjtId.eq(resultUid))
|
|
||||||
.fetchFirst();
|
|
||||||
|
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetAnalDataInferenceGeomEntity)
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.set(
|
.set(mapSheetAnalDataInferenceGeomEntity.pnu, length)
|
||||||
mapSheetAnalDataInferenceGeomEntity.fitState,
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
pnuEt.getStbltYn().equals("Y")
|
|
||||||
? ImageryFitStatus.UNFIT.getId()
|
|
||||||
: ImageryFitStatus.FIT.getId()) // 적합여부가 Y 이면 부적합인 것, N 이면 적합한 것이라고 함
|
|
||||||
.set(mapSheetAnalDataInferenceGeomEntity.fitStateDttm, ZonedDateTime.now())
|
|
||||||
.set(mapSheetAnalDataInferenceGeomEntity.lockYn, stbltDto.getLockYn())
|
|
||||||
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(resultUid))
|
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
|
Long geoUid =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||||
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.resultUid.eq(chnDtctObjtId))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
long succCnt = 0;
|
||||||
|
for (String pnu : pnuList) {
|
||||||
|
long result =
|
||||||
|
queryFactory
|
||||||
|
.insert(pnuEntity)
|
||||||
|
.columns(pnuEntity.geo.geoUid, pnuEntity.pnu, pnuEntity.createdDttm)
|
||||||
|
.values(geoUid, pnu, ZonedDateTime.now())
|
||||||
|
.execute();
|
||||||
|
if (result > 0) {
|
||||||
|
succCnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return succCnt;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PnuEntity findPnuEntityByResultUid(String resultUid, String pnu) {
|
public LearnInfo findMapSheetLearnInfo(UUID uuid) {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(pnuEntity)
|
.select(
|
||||||
.where(pnuEntity.pnu.eq(pnu), pnuEntity.chnDtctObjtId.eq(resultUid))
|
Projections.constructor(
|
||||||
|
LearnInfo.class,
|
||||||
|
mapSheetLearnEntity.id,
|
||||||
|
mapSheetLearnEntity.uuid,
|
||||||
|
mapSheetLearnEntity.compareYyyy,
|
||||||
|
mapSheetLearnEntity.targetYyyy,
|
||||||
|
mapSheetLearnEntity.stage,
|
||||||
|
mapSheetLearnEntity.uid,
|
||||||
|
mapSheetLearnEntity.applyStatus))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer findMapSheetLearnYearStage(Integer compareYyyy, Integer targetYyyy) {
|
||||||
|
NumberExpression<Integer> stageExpr =
|
||||||
|
Expressions.numberTemplate(Integer.class, "coalesce({0}, 0)", mapSheetLearnEntity.stage);
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(stageExpr.max().coalesce(0))
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(
|
||||||
|
mapSheetLearnEntity.compareYyyy.eq(compareYyyy),
|
||||||
|
mapSheetLearnEntity.targetYyyy.eq(targetYyyy),
|
||||||
|
mapSheetLearnEntity.applyStatus.isNotNull(),
|
||||||
|
mapSheetLearnEntity.applyStatus.ne(GukYuinStatus.PENDING.getId()))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalInferenceApplyDttm(Basic registRes) {
|
||||||
|
Long learnId =
|
||||||
|
queryFactory
|
||||||
|
.select(mapSheetLearnEntity.id)
|
||||||
|
.from(mapSheetLearnEntity)
|
||||||
|
.where(mapSheetLearnEntity.uid.eq(registRes.getChnDtctId()))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalInferenceEntity)
|
||||||
|
.set(mapSheetAnalInferenceEntity.gukyuinUsed, "Y")
|
||||||
|
.set(mapSheetAnalInferenceEntity.gukyuinApplyDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalInferenceEntity.learnId.eq(learnId))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GeomUidDto> findYesterdayLabelingCompleteList() {
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
||||||
|
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
||||||
|
|
||||||
|
BooleanExpression isYesterday =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.inspectStatDttm
|
||||||
|
.goe(yesterdayStart)
|
||||||
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(todayStart));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
GeomUidDto.class,
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.eq(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||||
|
.innerJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
|
||||||
|
.innerJoin(mapSheetLearnEntity)
|
||||||
|
.on(
|
||||||
|
mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id),
|
||||||
|
mapSheetLearnEntity.applyStatus.in(
|
||||||
|
GukYuinStatus.GUK_COMPLETED.getId(), GukYuinStatus.PNU_COMPLETED.getId()))
|
||||||
|
.where(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()), isYesterday)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAnalDataInferenceGeomSendDttm(Long geoUid) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.labelSendDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.eq(geoUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LabelSendDto> findLabelingCompleteSendList(LocalDate yesterday) {
|
||||||
|
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
ZonedDateTime from = yesterday.atStartOfDay(zone);
|
||||||
|
ZonedDateTime to = from.plusDays(1);
|
||||||
|
|
||||||
|
BooleanExpression isYesterday =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.inspectStatDttm
|
||||||
|
.goe(from)
|
||||||
|
.and(labelingAssignmentEntity.inspectStatDttm.lt(to));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LabelSendDto.class,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.resultUid,
|
||||||
|
labelingAssignmentEntity.workerUid,
|
||||||
|
labelingAssignmentEntity.workStatDttm,
|
||||||
|
labelingAssignmentEntity.inspectorUid,
|
||||||
|
labelingAssignmentEntity.inspectStatDttm,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.labelSendDttm))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.on(
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.eq(
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid))
|
||||||
|
.where(labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.getId()), isYesterday)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void updateGukYuinApplyStateComplete(Long id, GukYuinStatus status) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetLearnEntity)
|
||||||
|
.set(mapSheetLearnEntity.applyStatus, status.getId())
|
||||||
|
.set(mapSheetLearnEntity.applyStatusDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetLearnEntity.id.eq(id))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ 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.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
|
|
||||||
import com.kamco.cd.kamcoback.common.enums.StatusType;
|
import com.kamco.cd.kamcoback.common.enums.StatusType;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
@@ -83,9 +82,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.on(
|
.on(
|
||||||
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
.where(
|
.where(
|
||||||
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
||||||
@@ -129,8 +126,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
"""
|
"""
|
||||||
insert into tb_labeling_assignment
|
insert into tb_labeling_assignment
|
||||||
(assignment_uid, inference_geom_uid, worker_uid,
|
(assignment_uid, inference_geom_uid, worker_uid,
|
||||||
work_state, assign_group_id, anal_uid)
|
work_state, assign_group_id, anal_uid, pnu)
|
||||||
values (?, ?, ?, ?, ?, ?)
|
values (?, ?, ?, ?, ?, ?, ?)
|
||||||
""";
|
""";
|
||||||
|
|
||||||
try (PreparedStatement ps = connection.prepareStatement(sql)) {
|
try (PreparedStatement ps = connection.prepareStatement(sql)) {
|
||||||
@@ -143,6 +140,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
ps.setString(4, LabelState.ASSIGNED.getId());
|
ps.setString(4, LabelState.ASSIGNED.getId());
|
||||||
ps.setString(5, String.valueOf(info.getMapSheetNum()));
|
ps.setString(5, String.valueOf(info.getMapSheetNum()));
|
||||||
ps.setLong(6, analEntity.getId());
|
ps.setLong(6, analEntity.getId());
|
||||||
|
ps.setLong(7, info.getPnu());
|
||||||
|
|
||||||
ps.addBatch();
|
ps.addBatch();
|
||||||
batchSize++;
|
batchSize++;
|
||||||
@@ -192,9 +190,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.on(
|
.on(
|
||||||
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()),
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -385,10 +381,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(analEntity.getCompareYyyy()),
|
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(analEntity.getCompareYyyy()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(analEntity.getTargetYyyy()),
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(analEntity.getTargetYyyy()),
|
||||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(analEntity.getStage()),
|
mapSheetAnalDataInferenceGeomEntity.stage.eq(analEntity.getStage()),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
// mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L)
|
||||||
mapSheetAnalDataInferenceGeomEntity.fitState.eq(
|
// mapSheetAnalDataInferenceGeomEntity.passYn.isFalse() //TODO:
|
||||||
ImageryFitStatus.UNFIT.getId()) // TODO:
|
|
||||||
// 추후 라벨링 대상 조건 수정하기
|
// 추후 라벨링 대상 조건 수정하기
|
||||||
)
|
)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
@@ -560,9 +555,11 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
mapSheetAnalDataInferenceGeomEntity.dataUid))
|
mapSheetAnalDataInferenceGeomEntity.dataUid))
|
||||||
.where(
|
.where(
|
||||||
mapSheetAnalInferenceEntity.uuid.eq(targetUuid),
|
mapSheetAnalInferenceEntity.uuid.eq(targetUuid),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
// mapSheetAnalDataInferenceGeomEntity.pnu.gt(0L),
|
||||||
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()))
|
// mapSheetAnalDataInferenceGeomEntity.passYn.isFalse() //TODO: 추후 라벨링
|
||||||
|
// 대상 조건 수정하기
|
||||||
|
)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,7 +576,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.count())
|
.select(labelingAssignmentEntity.count())
|
||||||
.from(labelingAssignmentEntity)
|
.from(labelingAssignmentEntity)
|
||||||
.where(analUidCondition, labelingAssignmentEntity.workState.in("SKIP", "DONE"))
|
.where(
|
||||||
|
analUidCondition, labelingAssignmentEntity.workState.in("ASSIGNED", "SKIP", "DONE"))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
Long skipCount =
|
Long skipCount =
|
||||||
@@ -604,13 +602,6 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.where(analUidCondition, labelingAssignmentEntity.inspectState.eq("COMPLETE"))
|
.where(analUidCondition, labelingAssignmentEntity.inspectState.eq("COMPLETE"))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
Long inspectionExcept =
|
|
||||||
queryFactory
|
|
||||||
.select(labelingAssignmentEntity.count())
|
|
||||||
.from(labelingAssignmentEntity)
|
|
||||||
.where(analUidCondition, labelingAssignmentEntity.inspectState.eq("EXCEPT"))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
Long inspectorCount =
|
Long inspectorCount =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
.select(labelingAssignmentEntity.inspectorUid.countDistinct())
|
||||||
@@ -623,7 +614,6 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
long labelCompleted = labelingCompleted != null ? labelingCompleted : 0L;
|
long labelCompleted = labelingCompleted != null ? labelingCompleted : 0L;
|
||||||
long inspectCompleted = inspectionCompleted != null ? inspectionCompleted : 0L;
|
long inspectCompleted = inspectionCompleted != null ? inspectionCompleted : 0L;
|
||||||
long skipped = skipCount != null ? skipCount : 0L;
|
long skipped = skipCount != null ? skipCount : 0L;
|
||||||
long inspectExcepted = inspectionExcept != null ? inspectionExcept : 0L;
|
|
||||||
|
|
||||||
long labelingRemaining = labelingTotal - labelCompleted - skipped;
|
long labelingRemaining = labelingTotal - labelCompleted - skipped;
|
||||||
if (labelingRemaining < 0) {
|
if (labelingRemaining < 0) {
|
||||||
@@ -631,7 +621,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
long inspectionTotal = labelingTotal;
|
long inspectionTotal = labelingTotal;
|
||||||
long inspectionRemaining = inspectionTotal - inspectCompleted - inspectExcepted;
|
long inspectionRemaining = inspectionTotal - inspectCompleted - skipped;
|
||||||
if (inspectionRemaining < 0) {
|
if (inspectionRemaining < 0) {
|
||||||
inspectionRemaining = 0;
|
inspectionRemaining = 0;
|
||||||
}
|
}
|
||||||
@@ -668,7 +658,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
.inspectionStatus(inspectionStatus)
|
.inspectionStatus(inspectionStatus)
|
||||||
.inspectionTotalCount(inspectionTotal)
|
.inspectionTotalCount(inspectionTotal)
|
||||||
.inspectionCompletedCount(inspectCompleted)
|
.inspectionCompletedCount(inspectCompleted)
|
||||||
.inspectionSkipCount(inspectExcepted)
|
.inspectionSkipCount(skipped) // TODO
|
||||||
.inspectionRemainingCount(inspectionRemaining)
|
.inspectionRemainingCount(inspectionRemaining)
|
||||||
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
.inspectorCount(inspectorCount != null ? inspectorCount : 0L)
|
||||||
.progressRate(labelingRate)
|
.progressRate(labelingRate)
|
||||||
@@ -750,9 +740,11 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
mapSheetAnalInferenceEntity.targetYyyy.eq(
|
mapSheetAnalInferenceEntity.targetYyyy.eq(
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy),
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy),
|
||||||
mapSheetAnalInferenceEntity.stage.eq(mapSheetAnalDataInferenceGeomEntity.stage),
|
mapSheetAnalInferenceEntity.stage.eq(mapSheetAnalDataInferenceGeomEntity.stage),
|
||||||
// mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull()
|
||||||
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
// mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
|
||||||
mapSheetAnalDataInferenceGeomEntity.fitState.eq(ImageryFitStatus.UNFIT.getId()))
|
// mapSheetAnalDataInferenceGeomEntity.passYn.isFalse() //TODO: 추후 라벨링 대상 조건
|
||||||
|
// 수정하기
|
||||||
|
)
|
||||||
.where(mapSheetAnalInferenceEntity.id.eq(analEntity.getId()))
|
.where(mapSheetAnalInferenceEntity.id.eq(analEntity.getId()))
|
||||||
.groupBy(
|
.groupBy(
|
||||||
mapSheetAnalInferenceEntity.analTitle,
|
mapSheetAnalInferenceEntity.analTitle,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.kamco.cd.kamcoback.postgres.repository.label;
|
|||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.enums.ImageryFitStatus;
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||||
@@ -295,14 +294,14 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
|
|
||||||
if (searchReq.getSearchVal() != null && !searchReq.getSearchVal().isEmpty()) {
|
if (searchReq.getSearchVal() != null && !searchReq.getSearchVal().isEmpty()) {
|
||||||
whereSubBuilder.and(
|
whereSubBuilder.and(
|
||||||
Expressions.stringTemplate("{0}", memberEntity.employeeNo)
|
Expressions.stringTemplate("{0}", memberEntity.userId)
|
||||||
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")
|
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")
|
||||||
.or(
|
.or(
|
||||||
Expressions.stringTemplate("{0}", memberEntity.name)
|
Expressions.stringTemplate("{0}", memberEntity.name)
|
||||||
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")));
|
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")));
|
||||||
}
|
}
|
||||||
|
|
||||||
whereSubBuilder.and(labelingAssignmentEntity.workerUid.eq(memberEntity.employeeNo));
|
whereSubBuilder.and(labelingAssignmentEntity.workerUid.eq(memberEntity.userId));
|
||||||
|
|
||||||
// 공통 조건 추출
|
// 공통 조건 추출
|
||||||
BooleanExpression doneStateCondition =
|
BooleanExpression doneStateCondition =
|
||||||
@@ -345,7 +344,7 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
WorkerState.class,
|
WorkerState.class,
|
||||||
memberEntity.userRole,
|
memberEntity.userRole,
|
||||||
memberEntity.name,
|
memberEntity.name,
|
||||||
memberEntity.employeeNo,
|
memberEntity.userId,
|
||||||
assignedCnt.as("assignedCnt"),
|
assignedCnt.as("assignedCnt"),
|
||||||
doneCnt.as("doneCnt"),
|
doneCnt.as("doneCnt"),
|
||||||
skipCnt.as("skipCnt"),
|
skipCnt.as("skipCnt"),
|
||||||
@@ -364,10 +363,7 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
.on(whereSubBuilder)
|
.on(whereSubBuilder)
|
||||||
.where(whereBuilder)
|
.where(whereBuilder)
|
||||||
.groupBy(
|
.groupBy(
|
||||||
memberEntity.userRole,
|
memberEntity.userRole, memberEntity.name, memberEntity.userId, memberEntity.status)
|
||||||
memberEntity.name,
|
|
||||||
memberEntity.employeeNo,
|
|
||||||
memberEntity.status)
|
|
||||||
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
|
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
@@ -445,14 +441,14 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
|
|
||||||
if (searchReq.getSearchVal() != null && !searchReq.getSearchVal().isEmpty()) {
|
if (searchReq.getSearchVal() != null && !searchReq.getSearchVal().isEmpty()) {
|
||||||
whereSubBuilder.and(
|
whereSubBuilder.and(
|
||||||
Expressions.stringTemplate("{0}", memberEntity.employeeNo)
|
Expressions.stringTemplate("{0}", memberEntity.userId)
|
||||||
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")
|
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")
|
||||||
.or(
|
.or(
|
||||||
Expressions.stringTemplate("{0}", memberEntity.name)
|
Expressions.stringTemplate("{0}", memberEntity.name)
|
||||||
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")));
|
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")));
|
||||||
}
|
}
|
||||||
|
|
||||||
whereSubBuilder.and(labelingAssignmentEntity.inspectorUid.eq(memberEntity.employeeNo));
|
whereSubBuilder.and(labelingAssignmentEntity.inspectorUid.eq(memberEntity.userId));
|
||||||
|
|
||||||
// 공통 조건 추출
|
// 공통 조건 추출
|
||||||
BooleanExpression doneStateCondition =
|
BooleanExpression doneStateCondition =
|
||||||
@@ -496,7 +492,7 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
WorkerState.class,
|
WorkerState.class,
|
||||||
memberEntity.userRole,
|
memberEntity.userRole,
|
||||||
memberEntity.name,
|
memberEntity.name,
|
||||||
memberEntity.employeeNo,
|
memberEntity.userId,
|
||||||
assignedCnt.as("assignedCnt"),
|
assignedCnt.as("assignedCnt"),
|
||||||
doneCnt.as("doneCnt"),
|
doneCnt.as("doneCnt"),
|
||||||
skipCnt.as("skipCnt"),
|
skipCnt.as("skipCnt"),
|
||||||
@@ -515,10 +511,7 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
.on(whereSubBuilder)
|
.on(whereSubBuilder)
|
||||||
.where(whereBuilder)
|
.where(whereBuilder)
|
||||||
.groupBy(
|
.groupBy(
|
||||||
memberEntity.userRole,
|
memberEntity.userRole, memberEntity.name, memberEntity.userId, memberEntity.status)
|
||||||
memberEntity.name,
|
|
||||||
memberEntity.employeeNo,
|
|
||||||
memberEntity.status)
|
|
||||||
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
|
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
|
||||||
.offset(pageable.getOffset())
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
@@ -556,19 +549,7 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
|||||||
@Override
|
@Override
|
||||||
public LabelWorkMngDetail findLabelWorkMngDetail(UUID uuid) {
|
public LabelWorkMngDetail findLabelWorkMngDetail(UUID uuid) {
|
||||||
|
|
||||||
NumberExpression<Long> labelTotCnt =
|
NumberExpression<Long> labelTotCnt = mapSheetAnalDataInferenceGeomEntity.geoUid.count();
|
||||||
new CaseBuilder()
|
|
||||||
// .when(mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull())
|
|
||||||
.when(
|
|
||||||
mapSheetAnalDataInferenceGeomEntity
|
|
||||||
.pnu
|
|
||||||
.gt(0)
|
|
||||||
.and(
|
|
||||||
mapSheetAnalDataInferenceGeomEntity.fitState.eq(
|
|
||||||
ImageryFitStatus.UNFIT.getId())))
|
|
||||||
.then(1L)
|
|
||||||
.otherwise(0L)
|
|
||||||
.sum();
|
|
||||||
NumberExpression<Long> labelerCnt = labelingAssignmentEntity.workerUid.count();
|
NumberExpression<Long> labelerCnt = labelingAssignmentEntity.workerUid.count();
|
||||||
NumberExpression<Long> reviewerCnt = labelingAssignmentEntity.inspectorUid.count();
|
NumberExpression<Long> reviewerCnt = labelingAssignmentEntity.inspectorUid.count();
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingInspectorEntity;
|
|
||||||
import jakarta.persistence.LockModeType;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Lock;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
|
|
||||||
public interface TrainingDataLabelJobRepository
|
|
||||||
extends JpaRepository<LabelingInspectorEntity, UUID>, TrainingDataLabelJobRepositoryCustom {
|
|
||||||
|
|
||||||
@Lock(LockModeType.PESSIMISTIC_WRITE)
|
|
||||||
@Query(
|
|
||||||
"""
|
|
||||||
select r
|
|
||||||
from LabelingInspectorEntity r
|
|
||||||
where r.analUid = :analUid
|
|
||||||
and r.inspectorUid in :inspectorUids
|
|
||||||
""")
|
|
||||||
List<LabelingInspectorEntity> lockInspectors(Long analUid, List<String> inspectorUids);
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public interface TrainingDataLabelJobRepositoryCustom {
|
|
||||||
|
|
||||||
List<Tasks> findCompletedYesterdayUnassigned();
|
|
||||||
|
|
||||||
List<InspectorPendingDto> findInspectorPendingByRound(Long analUid);
|
|
||||||
|
|
||||||
void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId);
|
|
||||||
|
|
||||||
void updateGeomUidTestState(List<Long> geomUids);
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
|
||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingInspectorEntity.labelingInspectorEntity;
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
|
||||||
import com.querydsl.core.types.Projections;
|
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
|
||||||
import com.querydsl.core.types.dsl.Expressions;
|
|
||||||
import com.querydsl.core.types.dsl.StringExpression;
|
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class TrainingDataLabelJobRepositoryImpl extends QuerydslRepositorySupport
|
|
||||||
implements TrainingDataLabelJobRepositoryCustom {
|
|
||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
|
||||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
|
||||||
|
|
||||||
public TrainingDataLabelJobRepositoryImpl(JPAQueryFactory queryFactory) {
|
|
||||||
super(LabelingAssignmentEntity.class);
|
|
||||||
this.queryFactory = queryFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Tasks> findCompletedYesterdayUnassigned() {
|
|
||||||
ZoneId zone = ZoneId.of("Asia/Seoul");
|
|
||||||
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
|
||||||
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
|
||||||
|
|
||||||
BooleanExpression isYesterday =
|
|
||||||
labelingAssignmentEntity
|
|
||||||
.workStatDttm
|
|
||||||
.goe(yesterdayStart)
|
|
||||||
.and(labelingAssignmentEntity.workStatDttm.lt(todayStart));
|
|
||||||
|
|
||||||
return queryFactory
|
|
||||||
.select(
|
|
||||||
Projections.constructor(
|
|
||||||
Tasks.class,
|
|
||||||
labelingAssignmentEntity.assignmentUid,
|
|
||||||
labelingAssignmentEntity.inferenceGeomUid,
|
|
||||||
labelingAssignmentEntity.analUid))
|
|
||||||
.from(labelingAssignmentEntity)
|
|
||||||
.where(
|
|
||||||
labelingAssignmentEntity.workState.in(LabelState.SKIP.getId(), LabelState.DONE.getId()),
|
|
||||||
labelingAssignmentEntity.inspectorUid.isNull(),
|
|
||||||
isYesterday)
|
|
||||||
.orderBy(
|
|
||||||
labelingAssignmentEntity.analUid.asc(),
|
|
||||||
labelingAssignmentEntity.assignGroupId.asc(),
|
|
||||||
labelingAssignmentEntity.inferenceGeomUid.asc())
|
|
||||||
.fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 해당 회차에 라벨링 할당받은 검수자별 완료 건수 count(), 완료한 게 적은 순으로 해야 일이 한 사람에게 몰리지 않음
|
|
||||||
*
|
|
||||||
* @param analUid
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<InspectorPendingDto> findInspectorPendingByRound(Long analUid) {
|
|
||||||
return queryFactory
|
|
||||||
.select(
|
|
||||||
Projections.constructor(
|
|
||||||
InspectorPendingDto.class,
|
|
||||||
labelingInspectorEntity.inspectorUid,
|
|
||||||
labelingAssignmentEntity.assignmentUid.count()))
|
|
||||||
.from(labelingInspectorEntity)
|
|
||||||
.leftJoin(labelingAssignmentEntity)
|
|
||||||
.on(
|
|
||||||
labelingInspectorEntity.inspectorUid.eq(labelingAssignmentEntity.inspectorUid),
|
|
||||||
labelingAssignmentEntity.inspectState.in(
|
|
||||||
InspectState.EXCEPT.getId(), InspectState.COMPLETE.getId()))
|
|
||||||
.where(labelingInspectorEntity.analUid.eq(analUid))
|
|
||||||
.groupBy(labelingInspectorEntity.inspectorUid)
|
|
||||||
.orderBy(labelingAssignmentEntity.assignmentUid.count().asc())
|
|
||||||
.fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 배치용 여러 건 update
|
|
||||||
*
|
|
||||||
* @param assignmentUids
|
|
||||||
* @param reviewerId
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId) {
|
|
||||||
queryFactory
|
|
||||||
.update(labelingAssignmentEntity)
|
|
||||||
.set(labelingAssignmentEntity.inspectorUid, reviewerId)
|
|
||||||
.set(labelingAssignmentEntity.inspectState, InspectState.UNCONFIRM.getId())
|
|
||||||
.set(labelingAssignmentEntity.modifiedDate, ZonedDateTime.now())
|
|
||||||
.where(labelingAssignmentEntity.assignmentUid.in(assignmentUids))
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateGeomUidTestState(List<Long> geomUids) {
|
|
||||||
queryFactory
|
|
||||||
.update(mapSheetAnalDataInferenceGeomEntity)
|
|
||||||
.set(mapSheetAnalDataInferenceGeomEntity.testState, InspectState.UNCONFIRM.getId())
|
|
||||||
.set(mapSheetAnalDataInferenceGeomEntity.updatedDttm, ZonedDateTime.now())
|
|
||||||
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.in(geomUids))
|
|
||||||
.execute();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,10 +3,25 @@ package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
|||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface TrainingDataReviewJobRepositoryCustom {
|
public interface TrainingDataReviewJobRepositoryCustom {
|
||||||
|
|
||||||
|
List<Tasks> findCompletedYesterdayUnassigned();
|
||||||
|
|
||||||
|
List<InspectorPendingDto> findInspectorPendingByRound(Long analUid);
|
||||||
|
|
||||||
|
void assignReviewer(UUID assignmentUid, String reviewerId);
|
||||||
|
|
||||||
|
void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId);
|
||||||
|
|
||||||
|
Tasks findAssignmentTask(String assignmentUid);
|
||||||
|
|
||||||
|
void updateGeomUidTestState(List<Long> geomUids);
|
||||||
|
|
||||||
List<CompleteLabelData> findCompletedYesterdayLabelingList(Long analUid, String mapSheetNum);
|
List<CompleteLabelData> findCompletedYesterdayLabelingList(Long analUid, String mapSheetNum);
|
||||||
|
|
||||||
List<AnalMapSheetList> findCompletedAnalMapSheetList(Long analUid);
|
List<AnalMapSheetList> findCompletedAnalMapSheetList(Long analUid);
|
||||||
|
|||||||
@@ -1,18 +1,24 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
package com.kamco.cd.kamcoback.postgres.repository.scheduler;
|
||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingInspectorEntity.labelingInspectorEntity;
|
||||||
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnDataGeomEntity.mapSheetLearnDataGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnDataGeomEntity.mapSheetLearnDataGeomEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalCntInfo;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapSheetList;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData.Properties;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData.Properties;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||||
import com.querydsl.core.types.dsl.Expressions;
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
import com.querydsl.core.types.dsl.NumberExpression;
|
import com.querydsl.core.types.dsl.NumberExpression;
|
||||||
@@ -23,10 +29,9 @@ import java.time.LocalDate;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySupport
|
public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySupport
|
||||||
implements TrainingDataReviewJobRepositoryCustom {
|
implements TrainingDataReviewJobRepositoryCustom {
|
||||||
|
|
||||||
@@ -38,6 +43,121 @@ public class TrainingDataReviewJobRepositoryImpl extends QuerydslRepositorySuppo
|
|||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Tasks> findCompletedYesterdayUnassigned() {
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Seoul");
|
||||||
|
ZonedDateTime todayStart = ZonedDateTime.now(zone).toLocalDate().atStartOfDay(zone);
|
||||||
|
ZonedDateTime yesterdayStart = todayStart.minusDays(1);
|
||||||
|
|
||||||
|
BooleanExpression isYesterday =
|
||||||
|
labelingAssignmentEntity
|
||||||
|
.workStatDttm
|
||||||
|
.goe(yesterdayStart)
|
||||||
|
.and(labelingAssignmentEntity.workStatDttm.lt(todayStart));
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
Tasks.class,
|
||||||
|
labelingAssignmentEntity.assignmentUid,
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
|
labelingAssignmentEntity.analUid))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(
|
||||||
|
labelingAssignmentEntity.workState.in(LabelState.SKIP.getId(), LabelState.DONE.getId()),
|
||||||
|
labelingAssignmentEntity.inspectorUid.isNull(),
|
||||||
|
isYesterday)
|
||||||
|
.orderBy(
|
||||||
|
labelingAssignmentEntity.analUid.asc(),
|
||||||
|
labelingAssignmentEntity.assignGroupId.asc(),
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid.asc())
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 해당 회차에 라벨링 할당받은 검수자별 완료 건수 count(), 완료한 게 적은 순으로 해야 일이 한 사람에게 몰리지 않음
|
||||||
|
*
|
||||||
|
* @param analUid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<InspectorPendingDto> findInspectorPendingByRound(Long analUid) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
InspectorPendingDto.class,
|
||||||
|
labelingInspectorEntity.inspectorUid,
|
||||||
|
labelingAssignmentEntity.assignmentUid.count()))
|
||||||
|
.from(labelingInspectorEntity)
|
||||||
|
.leftJoin(labelingAssignmentEntity)
|
||||||
|
.on(
|
||||||
|
labelingInspectorEntity.inspectorUid.eq(labelingAssignmentEntity.inspectorUid),
|
||||||
|
labelingAssignmentEntity.inspectState.in(
|
||||||
|
InspectState.EXCEPT.getId(), InspectState.COMPLETE.getId()))
|
||||||
|
.where(labelingInspectorEntity.analUid.eq(analUid))
|
||||||
|
.groupBy(labelingInspectorEntity.inspectorUid)
|
||||||
|
.orderBy(labelingAssignmentEntity.assignmentUid.count().asc())
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 실시간 분배용 1건 update
|
||||||
|
*
|
||||||
|
* @param assignmentUid
|
||||||
|
* @param reviewerId
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void assignReviewer(UUID assignmentUid, String reviewerId) {
|
||||||
|
queryFactory
|
||||||
|
.update(labelingAssignmentEntity)
|
||||||
|
.set(labelingAssignmentEntity.inspectorUid, reviewerId)
|
||||||
|
.set(labelingAssignmentEntity.inspectState, InspectState.UNCONFIRM.getId())
|
||||||
|
.set(labelingAssignmentEntity.modifiedDate, ZonedDateTime.now())
|
||||||
|
.where(labelingAssignmentEntity.assignmentUid.eq(assignmentUid))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 배치용 여러 건 update
|
||||||
|
*
|
||||||
|
* @param assignmentUids
|
||||||
|
* @param reviewerId
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void assignReviewerBatch(List<UUID> assignmentUids, String reviewerId) {
|
||||||
|
queryFactory
|
||||||
|
.update(labelingAssignmentEntity)
|
||||||
|
.set(labelingAssignmentEntity.inspectorUid, reviewerId)
|
||||||
|
.set(labelingAssignmentEntity.inspectState, InspectState.UNCONFIRM.getId())
|
||||||
|
.set(labelingAssignmentEntity.modifiedDate, ZonedDateTime.now())
|
||||||
|
.where(labelingAssignmentEntity.assignmentUid.in(assignmentUids))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Tasks findAssignmentTask(String assignmentUid) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
Tasks.class,
|
||||||
|
labelingAssignmentEntity.assignmentUid,
|
||||||
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
|
labelingAssignmentEntity.analUid))
|
||||||
|
.from(labelingAssignmentEntity)
|
||||||
|
.where(labelingAssignmentEntity.assignmentUid.eq(UUID.fromString(assignmentUid)))
|
||||||
|
.fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGeomUidTestState(List<Long> geomUids) {
|
||||||
|
queryFactory
|
||||||
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.testState, InspectState.UNCONFIRM.getId())
|
||||||
|
.set(mapSheetAnalDataInferenceGeomEntity.updatedDttm, ZonedDateTime.now())
|
||||||
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.in(geomUids))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
public List<CompleteLabelData> findCompletedYesterdayLabelingList(
|
||||||
Long analUid, String mapSheetNum) {
|
Long analUid, String mapSheetNum) {
|
||||||
|
|||||||
@@ -1,15 +1,27 @@
|
|||||||
package com.kamco.cd.kamcoback.scheduler.service;
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiLogFunction;
|
||||||
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
||||||
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultPnuDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinDto.GeomUidDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
import com.kamco.cd.kamcoback.log.dto.EventStatus;
|
||||||
|
import com.kamco.cd.kamcoback.log.dto.EventType;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinLabelJobCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinLabelJobCoreService;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
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;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
@@ -17,11 +29,22 @@ import org.springframework.stereotype.Service;
|
|||||||
public class GukYuinApiLabelJobService {
|
public class GukYuinApiLabelJobService {
|
||||||
|
|
||||||
private final GukYuinLabelJobCoreService gukYuinLabelJobCoreService;
|
private final GukYuinLabelJobCoreService gukYuinLabelJobCoreService;
|
||||||
private final GukYuinApiService gukYuinApiService;
|
|
||||||
|
private final ExternalHttpClient externalHttpClient;
|
||||||
|
private final NetUtils netUtils = new NetUtils();
|
||||||
|
private final AuditLogRepository auditLogRepository;
|
||||||
|
|
||||||
|
private final UserUtil userUtil;
|
||||||
|
|
||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String profile;
|
private String profile;
|
||||||
|
|
||||||
|
@Value("${gukyuin.url}")
|
||||||
|
private String gukyuinUrl;
|
||||||
|
|
||||||
|
@Value("${gukyuin.cdi}")
|
||||||
|
private String gukyuinCdiUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 실행중인 profile
|
* 실행중인 profile
|
||||||
*
|
*
|
||||||
@@ -32,7 +55,7 @@ public class GukYuinApiLabelJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 어제 라벨링 검수 완료된 것 -> 국유인에 전송 */
|
/** 어제 라벨링 검수 완료된 것 -> 국유인에 전송 */
|
||||||
@Scheduled(cron = "0 0 2 * * *")
|
@Scheduled(cron = "0 0 1 * * *")
|
||||||
public void findLabelingCompleteSend() {
|
public void findLabelingCompleteSend() {
|
||||||
if (isLocalProfile()) {
|
if (isLocalProfile()) {
|
||||||
return;
|
return;
|
||||||
@@ -44,12 +67,57 @@ public class GukYuinApiLabelJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (GeomUidDto gto : list) {
|
for (GeomUidDto gto : list) {
|
||||||
ChngDetectContDto.ResultLabelDto dto =
|
String url = gukyuinCdiUrl + "/rlb/objt/" + gto.getResultUid() + "/lbl/" + "Y";
|
||||||
gukYuinApiService.updateChnDtctObjtLabelingYn(gto.getResultUid(), "Y");
|
|
||||||
if (dto.getSuccess()) {
|
ExternalCallResult<ResultPnuDto> result =
|
||||||
|
externalHttpClient.call(
|
||||||
|
url,
|
||||||
|
HttpMethod.POST,
|
||||||
|
null,
|
||||||
|
netUtils.jsonHeaders(),
|
||||||
|
ChngDetectContDto.ResultPnuDto.class);
|
||||||
|
|
||||||
|
ChngDetectContDto.ResultPnuDto dto = result.body();
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.MODIFIED.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
result.body().getSuccess());
|
||||||
|
|
||||||
// inference_geom 에 label_send_dttm 업데이트 하기
|
// inference_geom 에 label_send_dttm 업데이트 하기
|
||||||
gukYuinLabelJobCoreService.updateAnalDataInferenceGeomSendDttm(gto.getGeoUid());
|
gukYuinLabelJobCoreService.updateAnalDataInferenceGeomSendDttm(gto.getGeoUid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
|
||||||
|
public void insertGukyuinAuditLog(
|
||||||
|
String actionType,
|
||||||
|
String myIp,
|
||||||
|
Long userUid,
|
||||||
|
String requestUri,
|
||||||
|
Object requestBody,
|
||||||
|
boolean successFail) {
|
||||||
|
try {
|
||||||
|
AuditLogEntity log =
|
||||||
|
new AuditLogEntity(
|
||||||
|
userUid,
|
||||||
|
EventType.fromName(actionType),
|
||||||
|
successFail ? EventStatus.SUCCESS : EventStatus.FAILED,
|
||||||
|
"GUKYUIN", // 메뉴도 국유인으로 하나 따기
|
||||||
|
myIp,
|
||||||
|
requestUri,
|
||||||
|
requestBody == null ? null : ApiLogFunction.cutRequestBody(requestBody.toString()),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
auditLogRepository.save(log);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
package com.kamco.cd.kamcoback.scheduler.service;
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiLogFunction;
|
||||||
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
||||||
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ContBasic;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ContBasic;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectContDto.ResultContDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
@@ -7,25 +14,44 @@ import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.LearnKeyDto;
|
|||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto.ResultDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
||||||
|
import com.kamco.cd.kamcoback.log.dto.EventStatus;
|
||||||
|
import com.kamco.cd.kamcoback.log.dto.EventType;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinPnuJobCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinPnuJobCoreService;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
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;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class GukYuinApiPnuJobService {
|
public class GukYuinApiPnuJobService {
|
||||||
|
|
||||||
private final GukYuinPnuJobCoreService gukYuinPnuJobCoreService;
|
|
||||||
private final GukYuinApiService gukYuinApiService;
|
private final GukYuinApiService gukYuinApiService;
|
||||||
|
private final GukYuinPnuJobCoreService gukYuinPnuJobCoreService;
|
||||||
|
private final ExternalHttpClient externalHttpClient;
|
||||||
|
private final NetUtils netUtils = new NetUtils();
|
||||||
|
private final AuditLogRepository auditLogRepository;
|
||||||
|
|
||||||
|
private final UserUtil userUtil;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String profile;
|
private String profile;
|
||||||
|
|
||||||
|
@Value("${gukyuin.url}")
|
||||||
|
private String gukyuinUrl;
|
||||||
|
|
||||||
|
@Value("${gukyuin.cdi}")
|
||||||
|
private String gukyuinCdiUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 실행중인 profile
|
* 실행중인 profile
|
||||||
*
|
*
|
||||||
@@ -51,9 +77,14 @@ public class GukYuinApiPnuJobService {
|
|||||||
|
|
||||||
for (LearnKeyDto dto : list) {
|
for (LearnKeyDto dto : list) {
|
||||||
try {
|
try {
|
||||||
processUid(dto.getUid(), dto.getUid());
|
long succCnt = processUid(dto.getChnDtctMstId(), dto.getUid());
|
||||||
|
if (succCnt > 0) {
|
||||||
gukYuinPnuJobCoreService.updateGukYuinApplyStateComplete(
|
gukYuinPnuJobCoreService.updateGukYuinApplyStateComplete(
|
||||||
dto.getId(), GukYuinStatus.PNU_COMPLETED);
|
dto.getId(), GukYuinStatus.PNU_COMPLETED);
|
||||||
|
} else {
|
||||||
|
gukYuinPnuJobCoreService.updateGukYuinApplyStateComplete(
|
||||||
|
dto.getId(), GukYuinStatus.PNU_FAILED);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[GUKYUIN] failed uid={}", dto.getUid(), e);
|
log.error("[GUKYUIN] failed uid={}", dto.getUid(), e);
|
||||||
gukYuinPnuJobCoreService.updateGukYuinApplyStateComplete(
|
gukYuinPnuJobCoreService.updateGukYuinApplyStateComplete(
|
||||||
@@ -62,16 +93,31 @@ public class GukYuinApiPnuJobService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processUid(String chnDtctId, String uid) {
|
private long processUid(String chnDtctMstId, String uid) {
|
||||||
ResultDto result = gukYuinApiService.listChnDtctId(chnDtctId);
|
long succCnt = 0;
|
||||||
|
String url = gukyuinCdiUrl + "/chn/mast/list/" + chnDtctMstId;
|
||||||
|
|
||||||
|
ExternalCallResult<ResultDto> response =
|
||||||
|
externalHttpClient.call(
|
||||||
|
url, HttpMethod.GET, null, netUtils.jsonHeaders(), ChngDetectMastDto.ResultDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.DETAIL.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
response.body().getSuccess());
|
||||||
|
|
||||||
|
ResultDto result = response.body();
|
||||||
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
return;
|
return succCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChngDetectMastDto.Basic basic = result.getResult().get(0);
|
ChngDetectMastDto.Basic basic = result.getResult().get(0);
|
||||||
String chnDtctCnt = basic.getChnDtctCnt();
|
String chnDtctCnt = basic.getChnDtctCnt();
|
||||||
if (chnDtctCnt == null || chnDtctCnt.isEmpty()) {
|
if (chnDtctCnt == null || chnDtctCnt.isEmpty()) {
|
||||||
return;
|
return succCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// page 계산
|
// page 계산
|
||||||
@@ -80,18 +126,30 @@ public class GukYuinApiPnuJobService {
|
|||||||
int totalPages = (totalCount + pageSize - 1) / pageSize;
|
int totalPages = (totalCount + pageSize - 1) / pageSize;
|
||||||
|
|
||||||
for (int page = 0; page < totalPages; page++) {
|
for (int page = 0; page < totalPages; page++) {
|
||||||
processPage(uid, page, pageSize);
|
succCnt += processPage(uid, page, pageSize);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processPage(String uid, int page, int pageSize) {
|
return succCnt;
|
||||||
ResultContDto resContList = gukYuinApiService.findChnContList(uid, page, pageSize);
|
}
|
||||||
|
|
||||||
if (resContList.getResult() == null || resContList.getResult().isEmpty()) {
|
private long processPage(String uid, int page, int pageSize) {
|
||||||
return; // 외부 API 이상 방어
|
long result = 0;
|
||||||
|
String url =
|
||||||
|
gukyuinCdiUrl + "/chn/cont/" + uid + "?pageIndex=" + page + "&pageSize=" + pageSize;
|
||||||
|
|
||||||
|
ExternalCallResult<ChngDetectContDto.ResultContDto> response =
|
||||||
|
externalHttpClient.call(
|
||||||
|
url,
|
||||||
|
HttpMethod.GET,
|
||||||
|
null,
|
||||||
|
netUtils.jsonHeaders(),
|
||||||
|
ChngDetectContDto.ResultContDto.class);
|
||||||
|
|
||||||
|
List<ContBasic> contList = response.body().getResult();
|
||||||
|
if (contList == null || contList.isEmpty()) {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ContBasic> contList = resContList.getResult();
|
|
||||||
for (ContBasic cont : contList) {
|
for (ContBasic cont : contList) {
|
||||||
String[] pnuList = cont.getPnuList();
|
String[] pnuList = cont.getPnuList();
|
||||||
long pnuCnt = pnuList == null ? 0 : pnuList.length;
|
long pnuCnt = pnuList == null ? 0 : pnuList.length;
|
||||||
@@ -102,9 +160,66 @@ public class GukYuinApiPnuJobService {
|
|||||||
Long geoUid =
|
Long geoUid =
|
||||||
gukYuinPnuJobCoreService.findMapSheetAnalDataInferenceGeomUid(
|
gukYuinPnuJobCoreService.findMapSheetAnalDataInferenceGeomUid(
|
||||||
cont.getChnDtctObjtId());
|
cont.getChnDtctObjtId());
|
||||||
gukYuinPnuJobCoreService.insertGeoUidPnuData(geoUid, pnuList, cont.getChnDtctObjtId());
|
gukYuinPnuJobCoreService.insertGeoUidPnuData(geoUid, pnuList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.LIST.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
response.body().getSuccess());
|
||||||
|
|
||||||
|
ResultContDto cont = response.body();
|
||||||
|
if (cont == null || cont.getResult().isEmpty()) {
|
||||||
|
return result; // 외부 API 이상 방어
|
||||||
|
}
|
||||||
|
|
||||||
|
// pnuList 업데이트
|
||||||
|
|
||||||
|
for (ChngDetectContDto.ContBasic contBasic : cont.getResult()) {
|
||||||
|
if (contBasic.getPnuList() == null || contBasic.getChnDtctObjtId() == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
long upsertCnt =
|
||||||
|
gukYuinPnuJobCoreService.upsertMapSheetDataAnalGeomPnu(
|
||||||
|
contBasic.getChnDtctObjtId(), contBasic.getPnuList());
|
||||||
|
result += upsertCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
|
||||||
|
public void insertGukyuinAuditLog(
|
||||||
|
String actionType,
|
||||||
|
String myIp,
|
||||||
|
Long userUid,
|
||||||
|
String requestUri,
|
||||||
|
Object requestBody,
|
||||||
|
boolean successFail) {
|
||||||
|
try {
|
||||||
|
AuditLogEntity log =
|
||||||
|
new AuditLogEntity(
|
||||||
|
userUid,
|
||||||
|
EventType.fromName(actionType),
|
||||||
|
successFail ? EventStatus.SUCCESS : EventStatus.FAILED,
|
||||||
|
"GUKYUIN", // 메뉴도 국유인으로 하나 따기
|
||||||
|
myIp,
|
||||||
|
requestUri,
|
||||||
|
requestBody == null ? null : ApiLogFunction.cutRequestBody(requestBody.toString()),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
auditLogRepository.save(log);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,52 @@
|
|||||||
package com.kamco.cd.kamcoback.scheduler.service;
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiLogFunction;
|
||||||
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
||||||
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
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.ResultDto;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
import com.kamco.cd.kamcoback.gukyuin.dto.GukYuinStatus;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
import com.kamco.cd.kamcoback.log.dto.EventStatus;
|
||||||
|
import com.kamco.cd.kamcoback.log.dto.EventType;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinJobCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinJobCoreService;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
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;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class GukYuinApiStatusJobService {
|
public class GukYuinApiStatusJobService {
|
||||||
|
|
||||||
|
private final ExternalHttpClient externalHttpClient;
|
||||||
|
private final NetUtils netUtils = new NetUtils();
|
||||||
private final GukYuinJobCoreService gukYuinJobCoreService;
|
private final GukYuinJobCoreService gukYuinJobCoreService;
|
||||||
private final GukYuinApiService gukYuinApiService;
|
private final AuditLogRepository auditLogRepository;
|
||||||
|
|
||||||
|
private final UserUtil userUtil;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String profile;
|
private String profile;
|
||||||
|
|
||||||
|
@Value("${gukyuin.url}")
|
||||||
|
private String gukyuinUrl;
|
||||||
|
|
||||||
|
@Value("${gukyuin.cdi}")
|
||||||
|
private String gukyuinCdiUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 실행중인 profile
|
* 실행중인 profile
|
||||||
*
|
*
|
||||||
@@ -48,14 +72,32 @@ public class GukYuinApiStatusJobService {
|
|||||||
|
|
||||||
for (LearnKeyDto dto : list) {
|
for (LearnKeyDto dto : list) {
|
||||||
try {
|
try {
|
||||||
ChngDetectMastDto.ResultDto result = gukYuinApiService.listChnDtctId(dto.getUid());
|
String url = gukyuinCdiUrl + "/chn/mast/list/" + dto.getChnDtctMstId();
|
||||||
|
|
||||||
|
ExternalCallResult<ResultDto> response =
|
||||||
|
externalHttpClient.call(
|
||||||
|
url,
|
||||||
|
HttpMethod.GET,
|
||||||
|
null,
|
||||||
|
netUtils.jsonHeaders(),
|
||||||
|
ChngDetectMastDto.ResultDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.DETAIL.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
response.body().getSuccess());
|
||||||
|
|
||||||
|
ResultDto result = response.body();
|
||||||
|
|
||||||
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChngDetectMastDto.Basic basic = result.getResult().getFirst();
|
ChngDetectMastDto.Basic basic = result.getResult().get(0);
|
||||||
|
|
||||||
Integer progress =
|
Integer progress =
|
||||||
basic.getExcnPgrt() == null ? null : Integer.parseInt(basic.getExcnPgrt().trim());
|
basic.getExcnPgrt() == null ? null : Integer.parseInt(basic.getExcnPgrt().trim());
|
||||||
@@ -68,4 +110,33 @@ public class GukYuinApiStatusJobService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
|
||||||
|
public void insertGukyuinAuditLog(
|
||||||
|
String actionType,
|
||||||
|
String myIp,
|
||||||
|
Long userUid,
|
||||||
|
String requestUri,
|
||||||
|
Object requestBody,
|
||||||
|
boolean successFail) {
|
||||||
|
try {
|
||||||
|
AuditLogEntity log =
|
||||||
|
new AuditLogEntity(
|
||||||
|
userUid,
|
||||||
|
EventType.fromName(actionType),
|
||||||
|
successFail ? EventStatus.SUCCESS : EventStatus.FAILED,
|
||||||
|
"GUKYUIN", // 메뉴도 국유인으로 하나 따기
|
||||||
|
myIp,
|
||||||
|
requestUri,
|
||||||
|
requestBody == null ? null : ApiLogFunction.cutRequestBody(requestBody.toString()),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
auditLogRepository.save(log);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,52 @@
|
|||||||
package com.kamco.cd.kamcoback.scheduler.service;
|
package com.kamco.cd.kamcoback.scheduler.service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||||
|
import com.kamco.cd.kamcoback.config.api.ApiLogFunction;
|
||||||
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
||||||
|
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||||
|
import com.kamco.cd.kamcoback.gukyuin.dto.ChngDetectMastDto;
|
||||||
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.ResultDto;
|
||||||
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;
|
||||||
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
import com.kamco.cd.kamcoback.log.dto.EventStatus;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.GukYuinStbltJobCoreService;
|
import com.kamco.cd.kamcoback.log.dto.EventType;
|
||||||
import java.time.LocalDate;
|
import com.kamco.cd.kamcoback.postgres.core.GukYuinJobCoreService;
|
||||||
import java.time.ZoneId;
|
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
||||||
import java.time.format.DateTimeFormatter;
|
import com.kamco.cd.kamcoback.postgres.repository.log.AuditLogRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
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;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class GukYuinApiStbltJobService {
|
public class GukYuinApiStbltJobService {
|
||||||
|
|
||||||
private final GukYuinStbltJobCoreService gukYuinStbltJobCoreService;
|
private final ExternalHttpClient externalHttpClient;
|
||||||
private final GukYuinApiService gukYuinApiService;
|
private final NetUtils netUtils = new NetUtils();
|
||||||
|
private final GukYuinJobCoreService gukYuinStbltJobCoreService;
|
||||||
|
private final AuditLogRepository auditLogRepository;
|
||||||
|
|
||||||
|
private final UserUtil userUtil;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String profile;
|
private String profile;
|
||||||
|
|
||||||
|
@Value("${gukyuin.url}")
|
||||||
|
private String gukyuinUrl;
|
||||||
|
|
||||||
|
@Value("${gukyuin.cdi}")
|
||||||
|
private String gukyuinCdiUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 실행중인 profile
|
* 실행중인 profile
|
||||||
*
|
*
|
||||||
@@ -36,41 +56,87 @@ public class GukYuinApiStbltJobService {
|
|||||||
return "local".equalsIgnoreCase(profile);
|
return "local".equalsIgnoreCase(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 국유인 연동 후, 실태조사 적합여부 확인하여 update */
|
/** 국유인 연동 후, 100% 되었는지 확인하는 스케줄링 매 10분마다 호출 */
|
||||||
@Scheduled(cron = "0 0 3 * * *") // 0 0 3 * * *
|
@Scheduled(cron = "0 0/10 * * * *")
|
||||||
public void findGukYuinEligibleForSurvey() {
|
public void findGukYuinMastCompleteYn() {
|
||||||
if (isLocalProfile()) {
|
if (isLocalProfile()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<LearnKeyDto> list =
|
List<LearnKeyDto> list =
|
||||||
gukYuinStbltJobCoreService.findGukYuinEligibleForSurveyList(
|
gukYuinStbltJobCoreService.findGukyuinApplyStatusUidList(
|
||||||
GukYuinStatus.PNU_COMPLETED.getId());
|
List.of(GukYuinStatus.IN_PROGRESS.getId()));
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (LearnKeyDto dto : list) {
|
for (LearnKeyDto dto : list) {
|
||||||
try {
|
try {
|
||||||
String yesterday =
|
String url = gukyuinCdiUrl + "/chn/mast/list/" + dto.getChnDtctMstId();
|
||||||
LocalDate.now(ZoneId.of("Asia/Seoul"))
|
|
||||||
.minusDays(1)
|
ExternalCallResult<ResultDto> response =
|
||||||
.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
externalHttpClient.call(
|
||||||
RlbDtctDto result = gukYuinApiService.findRlbDtctList(dto.getUid(), yesterday);
|
url,
|
||||||
|
HttpMethod.GET,
|
||||||
|
null,
|
||||||
|
netUtils.jsonHeaders(),
|
||||||
|
ChngDetectMastDto.ResultDto.class);
|
||||||
|
|
||||||
|
this.insertGukyuinAuditLog(
|
||||||
|
EventType.DETAIL.getId(),
|
||||||
|
netUtils.getLocalIP(),
|
||||||
|
userUtil.getId(),
|
||||||
|
url.replace(gukyuinUrl, ""),
|
||||||
|
null,
|
||||||
|
response.body().getSuccess());
|
||||||
|
|
||||||
|
ResultDto result = response.body();
|
||||||
|
|
||||||
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
|
||||||
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
log.warn("[GUKYUIN] empty result chnDtctMstId={}", dto.getChnDtctMstId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RlbDtctMastDto stbltDto : result.getResult()) {
|
ChngDetectMastDto.Basic basic = result.getResult().get(0);
|
||||||
String resultUid = stbltDto.getChnDtctObjtId();
|
|
||||||
gukYuinStbltJobCoreService.updateGukYuinEligibleForSurvey(resultUid, stbltDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Integer progress =
|
||||||
|
basic.getExcnPgrt() == null ? null : Integer.parseInt(basic.getExcnPgrt().trim());
|
||||||
|
if (progress != null && progress == 100) {
|
||||||
|
gukYuinStbltJobCoreService.updateGukYuinApplyStateComplete(
|
||||||
|
dto.getId(), GukYuinStatus.GUK_COMPLETED);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
log.error("[GUKYUIN] failed uid={}", dto.getChnDtctMstId(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
|
||||||
|
public void insertGukyuinAuditLog(
|
||||||
|
String actionType,
|
||||||
|
String myIp,
|
||||||
|
Long userUid,
|
||||||
|
String requestUri,
|
||||||
|
Object requestBody,
|
||||||
|
boolean successFail) {
|
||||||
|
try {
|
||||||
|
AuditLogEntity log =
|
||||||
|
new AuditLogEntity(
|
||||||
|
userUid,
|
||||||
|
EventType.fromName(actionType),
|
||||||
|
successFail ? EventStatus.SUCCESS : EventStatus.FAILED,
|
||||||
|
"GUKYUIN", // 메뉴도 국유인으로 하나 따기
|
||||||
|
myIp,
|
||||||
|
requestUri,
|
||||||
|
requestBody == null ? null : ApiLogFunction.cutRequestBody(requestBody.toString()),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
auditLogRepository.save(log);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,112 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.scheduler.service;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.core.TrainingDataLabelJobCoreService;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Log4j2
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class TrainingDataLabelJobService {
|
|
||||||
|
|
||||||
private final TrainingDataLabelJobCoreService trainingDataLabelJobCoreService;
|
|
||||||
|
|
||||||
@Value("${spring.profiles.active}")
|
|
||||||
private String profile;
|
|
||||||
|
|
||||||
private boolean isLocalProfile() {
|
|
||||||
return "local".equalsIgnoreCase(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Scheduled(cron = "0 0 0 * * *")
|
|
||||||
public void assignReviewerYesterdayLabelComplete() {
|
|
||||||
|
|
||||||
if (isLocalProfile()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
List<Tasks> tasks = trainingDataLabelJobCoreService.findCompletedYesterdayUnassigned();
|
|
||||||
|
|
||||||
if (tasks.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 회차별로 그룹핑
|
|
||||||
Map<Long, List<Tasks>> taskByRound =
|
|
||||||
tasks.stream().collect(Collectors.groupingBy(Tasks::getAnalUid));
|
|
||||||
|
|
||||||
// 회차별 분배
|
|
||||||
for (Map.Entry<Long, List<Tasks>> entry : taskByRound.entrySet()) {
|
|
||||||
Long analUid = entry.getKey();
|
|
||||||
List<Tasks> analTasks = entry.getValue();
|
|
||||||
|
|
||||||
// pending 계산
|
|
||||||
List<InspectorPendingDto> pendings =
|
|
||||||
trainingDataLabelJobCoreService.findInspectorPendingByRound(analUid);
|
|
||||||
|
|
||||||
if (pendings.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> reviewerIds =
|
|
||||||
pendings.stream().map(InspectorPendingDto::getInspectorUid).toList();
|
|
||||||
|
|
||||||
// Lock 걸릴 수 있기 때문에 엔티티 조회하는 Repository 에서 구현
|
|
||||||
trainingDataLabelJobCoreService.lockInspectors(analUid, reviewerIds);
|
|
||||||
|
|
||||||
// 균등 분배
|
|
||||||
Map<String, List<Tasks>> assignMap = distributeByLeastPending(analTasks, reviewerIds);
|
|
||||||
|
|
||||||
// reviewer별 batch update
|
|
||||||
assignMap.forEach(
|
|
||||||
(reviewerId, assignedTasks) -> {
|
|
||||||
if (assignedTasks.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<UUID> assignmentUids =
|
|
||||||
assignedTasks.stream().map(Tasks::getAssignmentUid).toList();
|
|
||||||
trainingDataLabelJobCoreService.assignReviewerBatch(assignmentUids, reviewerId);
|
|
||||||
|
|
||||||
List<Long> geomUids = assignedTasks.stream().map(Tasks::getInferenceUid).toList();
|
|
||||||
trainingDataLabelJobCoreService.updateGeomUidTestState(geomUids);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("배치 처리 중 예외", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, List<Tasks>> distributeByLeastPending(
|
|
||||||
List<Tasks> tasks, List<String> reviewerIds) {
|
|
||||||
Map<String, List<Tasks>> result = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
// 순서 유지 중요 (ASC 정렬된 상태)
|
|
||||||
for (String reviewerId : reviewerIds) {
|
|
||||||
result.put(reviewerId, new ArrayList<>());
|
|
||||||
}
|
|
||||||
|
|
||||||
int reviewerCount = reviewerIds.size();
|
|
||||||
|
|
||||||
for (int i = 0; i < tasks.size(); i++) {
|
|
||||||
String reviewerId = reviewerIds.get(i % reviewerCount);
|
|
||||||
result.get(reviewerId).add(tasks.get(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,13 +8,20 @@ import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.AnalMapShee
|
|||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData.GeoJsonFeature;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.CompleteLabelData.GeoJsonFeature;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.FeatureCollection;
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.FeatureCollection;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.InspectorPendingDto;
|
||||||
|
import com.kamco.cd.kamcoback.scheduler.dto.TrainingDataReviewJobDto.Tasks;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
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;
|
||||||
@@ -39,13 +46,89 @@ public class TrainingDataReviewJobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Scheduled(cron = "0 0 2 * * *")
|
@Scheduled(cron = "0 0 0 * * *")
|
||||||
public void exportGeojsonLabelingGeom() {
|
public void assignReviewerYesterdayLabelComplete() {
|
||||||
|
|
||||||
if (isLocalProfile()) {
|
if (isLocalProfile()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<Tasks> tasks = trainingDataReviewJobCoreService.findCompletedYesterdayUnassigned();
|
||||||
|
|
||||||
|
if (tasks.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 회차별로 그룹핑
|
||||||
|
Map<Long, List<Tasks>> taskByRound =
|
||||||
|
tasks.stream().collect(Collectors.groupingBy(Tasks::getAnalUid));
|
||||||
|
|
||||||
|
// 회차별 분배
|
||||||
|
for (Map.Entry<Long, List<Tasks>> entry : taskByRound.entrySet()) {
|
||||||
|
Long analUid = entry.getKey();
|
||||||
|
List<Tasks> analTasks = entry.getValue();
|
||||||
|
|
||||||
|
// pending 계산
|
||||||
|
List<InspectorPendingDto> pendings =
|
||||||
|
trainingDataReviewJobCoreService.findInspectorPendingByRound(analUid);
|
||||||
|
|
||||||
|
if (pendings.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> reviewerIds =
|
||||||
|
pendings.stream().map(InspectorPendingDto::getInspectorUid).toList();
|
||||||
|
|
||||||
|
// Lock 걸릴 수 있기 때문에 엔티티 조회하는 Repository 에서 구현
|
||||||
|
trainingDataReviewJobCoreService.lockInspectors(analUid, reviewerIds);
|
||||||
|
|
||||||
|
// 균등 분배
|
||||||
|
Map<String, List<Tasks>> assignMap = distributeByLeastPending(analTasks, reviewerIds);
|
||||||
|
|
||||||
|
// reviewer별 batch update
|
||||||
|
assignMap.forEach(
|
||||||
|
(reviewerId, assignedTasks) -> {
|
||||||
|
if (assignedTasks.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UUID> assignmentUids =
|
||||||
|
assignedTasks.stream().map(Tasks::getAssignmentUid).toList();
|
||||||
|
trainingDataReviewJobCoreService.assignReviewerBatch(assignmentUids, reviewerId);
|
||||||
|
|
||||||
|
List<Long> geomUids = assignedTasks.stream().map(Tasks::getInferenceUid).toList();
|
||||||
|
trainingDataReviewJobCoreService.updateGeomUidTestState(geomUids);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("배치 처리 중 예외", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, List<Tasks>> distributeByLeastPending(
|
||||||
|
List<Tasks> tasks, List<String> reviewerIds) {
|
||||||
|
Map<String, List<Tasks>> result = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
// 순서 유지 중요 (ASC 정렬된 상태)
|
||||||
|
for (String reviewerId : reviewerIds) {
|
||||||
|
result.put(reviewerId, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
int reviewerCount = reviewerIds.size();
|
||||||
|
|
||||||
|
for (int i = 0; i < tasks.size(); i++) {
|
||||||
|
String reviewerId = reviewerIds.get(i % reviewerCount);
|
||||||
|
result.get(reviewerId).add(tasks.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Scheduled(cron = "0 0 2 * * *")
|
||||||
|
public void exportGeojsonLabelingGeom() {
|
||||||
|
|
||||||
// 1) 경로/파일명 결정
|
// 1) 경로/파일명 결정
|
||||||
String targetDir =
|
String targetDir =
|
||||||
"local".equals(profile) ? System.getProperty("user.home") + "/geojson" : trainingDataDir;
|
"local".equals(profile) ? System.getProperty("user.home") + "/geojson" : trainingDataDir;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.kamco.cd.kamcoback.trainingdata;
|
|||||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ResponseObj;
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.TrainingDataLabelJobService;
|
|
||||||
import com.kamco.cd.kamcoback.scheduler.service.TrainingDataReviewJobService;
|
import com.kamco.cd.kamcoback.scheduler.service.TrainingDataReviewJobService;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto;
|
||||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.ReviewGeometryInfo;
|
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataReviewDto.ReviewGeometryInfo;
|
||||||
@@ -33,7 +32,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class TrainingDataReviewApiController {
|
public class TrainingDataReviewApiController {
|
||||||
|
|
||||||
private final TrainingDataReviewService trainingDataReviewService;
|
private final TrainingDataReviewService trainingDataReviewService;
|
||||||
private final TrainingDataLabelJobService trainingDataLabelJobService;
|
|
||||||
private final TrainingDataReviewJobService trainingDataReviewJobService;
|
private final TrainingDataReviewJobService trainingDataReviewJobService;
|
||||||
|
|
||||||
@Operation(summary = "목록 조회", description = "검수 할당 목록 조회")
|
@Operation(summary = "목록 조회", description = "검수 할당 목록 조회")
|
||||||
@@ -564,7 +562,7 @@ public class TrainingDataReviewApiController {
|
|||||||
description = "스케줄링이 실패한 경우 수동 호출하는 API, 어제 라벨링 완료된 것을 해당 검수자들에게 할당함")
|
description = "스케줄링이 실패한 경우 수동 호출하는 API, 어제 라벨링 완료된 것을 해당 검수자들에게 할당함")
|
||||||
@GetMapping("/run-schedule")
|
@GetMapping("/run-schedule")
|
||||||
public ApiResponseDto<Void> runTrainingReviewSchedule() {
|
public ApiResponseDto<Void> runTrainingReviewSchedule() {
|
||||||
trainingDataLabelJobService.assignReviewerYesterdayLabelComplete();
|
trainingDataReviewJobService.assignReviewerYesterdayLabelComplete();
|
||||||
return ApiResponseDto.ok(null);
|
return ApiResponseDto.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user