Innopam -> gukyuin 이름 변경
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.Basic;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastReq;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.FeaturePnuDto;
|
||||
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastEntity;
|
||||
import com.kamco.cd.kamcoback.Innopam.postgres.repository.DetectMastRepository;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DetectMastCoreService {
|
||||
|
||||
private final DetectMastRepository detectMastRepository;
|
||||
|
||||
public void saveDetectMast(DetectMastReq detectMast) {
|
||||
DetectMastEntity detectMastEntity = new DetectMastEntity();
|
||||
detectMastEntity.setCprsBfYr(detectMast.getCprsBfYr());
|
||||
detectMastEntity.setCprsAdYr(detectMast.getCprsAdYr());
|
||||
detectMastEntity.setDtctSno(detectMast.getDtctSno());
|
||||
detectMastEntity.setPathNm(detectMast.getPathNm());
|
||||
detectMastEntity.setCrtEpno(detectMast.getCrtEpno());
|
||||
detectMastEntity.setCrtIp(detectMast.getCrtIp());
|
||||
detectMastRepository.save(detectMastEntity);
|
||||
}
|
||||
|
||||
public List<Basic> selectDetectMast(DetectMastSearch detectMast) {
|
||||
return detectMastRepository.findDetectMastList(detectMast).stream()
|
||||
.map(
|
||||
e ->
|
||||
new DetectMastDto.Basic(
|
||||
e.getId(),
|
||||
e.getCprsBfYr(),
|
||||
e.getCprsAdYr(),
|
||||
e.getDtctSno(),
|
||||
e.getPathNm(),
|
||||
e.getCrtEpno(),
|
||||
e.getCrtIp()))
|
||||
.toList();
|
||||
}
|
||||
|
||||
public Basic selectDetectMast(Long id) {
|
||||
DetectMastEntity e =
|
||||
detectMastRepository.findById(id).orElseThrow(() -> new RuntimeException("등록 데이터가 없습니다."));
|
||||
return new DetectMastDto.Basic(
|
||||
e.getId(),
|
||||
e.getCprsBfYr(),
|
||||
e.getCprsAdYr(),
|
||||
e.getDtctSno(),
|
||||
e.getPathNm(),
|
||||
e.getCrtEpno(),
|
||||
e.getCrtIp());
|
||||
}
|
||||
|
||||
public String findPnuData(DetectMastSearch detectMast) {
|
||||
DetectMastEntity detectMastEntity = detectMastRepository.findPnuData(detectMast);
|
||||
return detectMastEntity.getPathNm();
|
||||
}
|
||||
|
||||
public Integer updatePnu(List<FeaturePnuDto> list) {
|
||||
return detectMastRepository.updateGeomPnu(list);
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.SequenceGenerator;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "detect_mast")
|
||||
public class DetectMastEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "detect_mast_id_gen")
|
||||
@SequenceGenerator(
|
||||
name = "detect_mast_id_gen",
|
||||
sequenceName = "seq_detect_mast_id",
|
||||
allocationSize = 1)
|
||||
@Column(name = "dtct_mst_id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("gen_random_uuid()")
|
||||
@Column(name = "dtct_mst_uuid", nullable = false)
|
||||
private UUID dtctMstUuid = UUID.randomUUID();
|
||||
|
||||
@Size(max = 4)
|
||||
@NotNull
|
||||
@Column(name = "cprs_bf_yr", nullable = false, length = 4)
|
||||
private String cprsBfYr;
|
||||
|
||||
@Size(max = 4)
|
||||
@NotNull
|
||||
@Column(name = "cprs_ad_yr", nullable = false, length = 4)
|
||||
private String cprsAdYr;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "dtct_sno", nullable = false)
|
||||
private Integer dtctSno;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "path_nm", nullable = false, length = Integer.MAX_VALUE)
|
||||
private String pathNm;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "feature_id", length = 50)
|
||||
private String featureId;
|
||||
|
||||
@Size(max = 30)
|
||||
@NotNull
|
||||
@Column(name = "crt_epno", nullable = false, length = 30)
|
||||
private String crtEpno;
|
||||
|
||||
@Size(max = 45)
|
||||
@NotNull
|
||||
@Column(name = "crt_ip", nullable = false, length = 45)
|
||||
private String crtIp;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "crt_dttm", nullable = false)
|
||||
private ZonedDateTime crtDttm = ZonedDateTime.now();
|
||||
|
||||
@Size(max = 30)
|
||||
@Column(name = "chg_epno", length = 30)
|
||||
private String chgEpno;
|
||||
|
||||
@Size(max = 45)
|
||||
@Column(name = "chg_ip", length = 45)
|
||||
private String chgIp;
|
||||
|
||||
@Column(name = "chg_dttm")
|
||||
private ZonedDateTime chgDttm;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.SequenceGenerator;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "detect_mast_pnu")
|
||||
public class DetectMastPnuEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "detect_mast_pnu_id_gen")
|
||||
@SequenceGenerator(
|
||||
name = "detect_mast_pnu_id_gen",
|
||||
sequenceName = "seq_detect_mast_pnu_id",
|
||||
allocationSize = 1)
|
||||
@Column(name = "dtct_mst_pnu_id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("gen_random_uuid()")
|
||||
@Column(name = "detect_mast_pnu_uuid", nullable = false)
|
||||
private UUID detectMastPnuUuid;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "dtct_mst_id", nullable = false)
|
||||
private Long dtctMstId;
|
||||
|
||||
@Size(max = 4)
|
||||
@NotNull
|
||||
@Column(name = "pnu", nullable = false, length = 4)
|
||||
private String pnu;
|
||||
|
||||
@Column(name = "polygon", length = Integer.MAX_VALUE)
|
||||
private String polygon;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.postgres.repository;
|
||||
|
||||
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastPnuEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface DetectMastPnuRepository
|
||||
extends JpaRepository<DetectMastPnuEntity, Long>, DetectMastPnuRepositoryCustom {}
|
||||
@@ -1,3 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.postgres.repository;
|
||||
|
||||
public interface DetectMastPnuRepositoryCustom {}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.postgres.repository;
|
||||
|
||||
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface DetectMastRepository
|
||||
extends JpaRepository<DetectMastEntity, Long>, DetectMastRepositoryCustom {}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.postgres.repository;
|
||||
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.FeaturePnuDto;
|
||||
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastEntity;
|
||||
import java.util.List;
|
||||
|
||||
public interface DetectMastRepositoryCustom {
|
||||
|
||||
public List<DetectMastEntity> findDetectMastList(DetectMastSearch detectMast);
|
||||
|
||||
public DetectMastEntity findPnuData(DetectMastSearch detectMast);
|
||||
|
||||
Integer updateGeomPnu(List<FeaturePnuDto> list);
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.postgres.repository;
|
||||
|
||||
import static com.kamco.cd.kamcoback.Innopam.postgres.entity.QDetectMastEntity.detectMastEntity;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.FeaturePnuDto;
|
||||
import com.kamco.cd.kamcoback.Innopam.postgres.entity.DetectMastEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class DetectMastRepositoryImpl implements DetectMastRepositoryCustom {
|
||||
|
||||
private final EntityManager em;
|
||||
private final JPAQueryFactory queryFactory;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
@Override
|
||||
public List<DetectMastEntity> findDetectMastList(DetectMastSearch detectMast) {
|
||||
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
|
||||
if (StringUtils.isNotBlank(detectMast.getCprsAdYr())) {
|
||||
whereBuilder.and(detectMastEntity.cprsAdYr.eq(detectMast.getCprsAdYr()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(detectMast.getCprsBfYr())) {
|
||||
whereBuilder.and(detectMastEntity.cprsBfYr.eq(detectMast.getCprsBfYr()));
|
||||
}
|
||||
|
||||
if (detectMast.getDtctSno() != null) {
|
||||
whereBuilder.and(detectMastEntity.dtctSno.eq(detectMast.getDtctSno()));
|
||||
}
|
||||
|
||||
return queryFactory.select(detectMastEntity).from(detectMastEntity).where(whereBuilder).fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetectMastEntity findPnuData(DetectMastSearch detectMast) {
|
||||
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
|
||||
whereBuilder.and(detectMastEntity.cprsAdYr.eq(detectMast.getCprsAdYr()));
|
||||
whereBuilder.and(detectMastEntity.cprsBfYr.eq(detectMast.getCprsBfYr()));
|
||||
whereBuilder.and(detectMastEntity.dtctSno.eq(detectMast.getDtctSno()));
|
||||
|
||||
if (detectMast.getFeatureId() != null) {
|
||||
whereBuilder.and(detectMastEntity.featureId.eq(detectMast.getFeatureId()));
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(detectMastEntity)
|
||||
.from(detectMastEntity)
|
||||
.where(whereBuilder)
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateGeomPnu(List<FeaturePnuDto> list) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
String sql =
|
||||
"""
|
||||
UPDATE tb_map_sheet_anal_data_inference_geom g
|
||||
SET pnu = j.pnu
|
||||
FROM (
|
||||
SELECT
|
||||
(elem->>'featureId')::uuid AS feature_uuid,
|
||||
(elem->>'pnu')::bigint AS pnu
|
||||
FROM jsonb_array_elements(CAST(:json AS jsonb)) AS elem
|
||||
) j
|
||||
WHERE g.uuid = j.feature_uuid;
|
||||
""";
|
||||
|
||||
String json = "";
|
||||
try {
|
||||
json = objectMapper.writeValueAsString(list);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("PNU 업데이트 실패", e);
|
||||
}
|
||||
|
||||
return em.createNativeQuery(sql).setParameter("json", json).executeUpdate();
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.Basic;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastReq;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastSearch;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.FeaturePnuDto;
|
||||
import com.kamco.cd.kamcoback.Innopam.postgres.core.DetectMastCoreService;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Transactional(readOnly = true)
|
||||
@RequiredArgsConstructor
|
||||
public class DetectMastService {
|
||||
|
||||
@Value("${spring.profiles.active:local}")
|
||||
private String profile;
|
||||
|
||||
private final DetectMastCoreService detectMastCoreService;
|
||||
private final JsonFactory jsonFactory = new JsonFactory();
|
||||
|
||||
@Transactional
|
||||
public void saveDetectMast(DetectMastReq detectMast) {
|
||||
detectMastCoreService.saveDetectMast(detectMast);
|
||||
//
|
||||
// String dirPath =
|
||||
// "local".equals(profile)
|
||||
// ? "/Users/bokmin/detect/result/2023_2024/4"
|
||||
// : detectMast.getPathNm();
|
||||
//
|
||||
// List<FeaturePnuDto> list = this.extractFeaturePnusRandom(dirPath);
|
||||
}
|
||||
|
||||
public List<Basic> selectDetectMast(DetectMastSearch detectMast) {
|
||||
return detectMastCoreService.selectDetectMast(detectMast);
|
||||
}
|
||||
|
||||
public Basic selectDetectMast(Long id) {
|
||||
return detectMastCoreService.selectDetectMast(id);
|
||||
}
|
||||
|
||||
/** GeoJSON → polygon_id + 랜덤 PNU */
|
||||
public List<FeaturePnuDto> findPnuData(DetectMastSearch detectMast) {
|
||||
|
||||
String dirPath =
|
||||
"local".equals(profile)
|
||||
? "/Users/bokmin/detect/result/"
|
||||
+ detectMast.getCprsBfYr()
|
||||
+ "_"
|
||||
+ detectMast.getCprsAdYr()
|
||||
+ "/"
|
||||
+ detectMast.getDtctSno()
|
||||
: detectMastCoreService.findPnuData(detectMast);
|
||||
|
||||
return extractFeaturePnusRandom(dirPath);
|
||||
}
|
||||
|
||||
public FeaturePnuDto selectPnuDetail(UUID uuid) {
|
||||
FeaturePnuDto dto = new FeaturePnuDto();
|
||||
dto.setPnu(randomPnu());
|
||||
dto.setFeatureId(uuid.toString());
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer updatePnuData(DetectMastSearch detectMast) {
|
||||
|
||||
String dirPath =
|
||||
"local".equals(profile)
|
||||
? "/Users/bokmin/detect/result/"
|
||||
+ detectMast.getCprsBfYr()
|
||||
+ "_"
|
||||
+ detectMast.getCprsAdYr()
|
||||
+ "/"
|
||||
+ detectMast.getDtctSno()
|
||||
: detectMastCoreService.findPnuData(detectMast);
|
||||
|
||||
List<FeaturePnuDto> list = extractFeaturePnusRandom(dirPath);
|
||||
return detectMastCoreService.updatePnu(list);
|
||||
}
|
||||
|
||||
/** 하위 폴더까지 .geojson 파일들에서 polygon_id만 뽑음 병렬처리(parallel) 제거: IO + parallel은 거의 항상 느려짐 */
|
||||
private List<FeaturePnuDto> extractFeaturePnusRandom(String dirPath) {
|
||||
|
||||
Path basePath = Paths.get(dirPath);
|
||||
if (!Files.isDirectory(basePath)) {
|
||||
System.err.println("유효하지 않은 디렉터리: " + dirPath);
|
||||
return List.of();
|
||||
}
|
||||
|
||||
List<FeaturePnuDto> out = new ArrayList<>(4096);
|
||||
|
||||
try (Stream<Path> stream = Files.walk(basePath)) {
|
||||
stream
|
||||
.filter(Files::isRegularFile)
|
||||
.filter(p -> p.toString().toLowerCase().endsWith(".geojson"))
|
||||
.forEach(
|
||||
p -> {
|
||||
try (InputStream in = Files.newInputStream(p);
|
||||
JsonParser parser = jsonFactory.createParser(in)) {
|
||||
|
||||
while (parser.nextToken() != null) {
|
||||
if (parser.currentToken() == JsonToken.FIELD_NAME
|
||||
&& "polygon_id".equals(parser.getCurrentName())) {
|
||||
|
||||
JsonToken next = parser.nextToken(); // 값으로 이동
|
||||
if (next == JsonToken.VALUE_STRING) {
|
||||
String polygonId = parser.getValueAsString();
|
||||
out.add(new FeaturePnuDto(polygonId, randomPnu()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 파일 단위 실패는 최소 로그
|
||||
System.err.println("GeoJSON 파싱 실패: " + p.getFileName() + " / " + e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("디렉터리 탐색 실패: " + e.getMessage());
|
||||
return List.of();
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/** 랜덤 PNU 생성 (임시) - 법정동코드(5) + 산구분(1) + 본번(4) + 부번(4) = 14자리 */
|
||||
private String randomPnu() {
|
||||
ThreadLocalRandom r = ThreadLocalRandom.current();
|
||||
|
||||
String dongCode = String.format("%05d", r.nextInt(10000, 99999));
|
||||
String san = r.nextBoolean() ? "1" : "2";
|
||||
String bon = String.format("%04d", r.nextInt(1, 10000));
|
||||
String bu = String.format("%04d", r.nextInt(0, 10000));
|
||||
|
||||
return dongCode + san + bon + bu;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.kamco.cd.kamcoback.Innopam;
|
||||
package com.kamco.cd.kamcoback.gukyuin;
|
||||
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.ChngDetectMastDto;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.ChngDetectMastDto.ChnDetectMastReqDto;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.ChngDetectMastDto.ChngDetectMastSearchDto;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.ChngDetectMastDto.ResReturn;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.Basic;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.DetectMastDto.DetectMastReq;
|
||||
import com.kamco.cd.kamcoback.Innopam.service.InnopamApiService;
|
||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
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.ChngDetectMastSearchDto;
|
||||
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.DetectMastReq;
|
||||
import com.kamco.cd.kamcoback.gukyuin.service.GukYuinApiService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -15,6 +16,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -23,13 +25,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "이노펨 연동 API", description = "이노펨 연동 API")
|
||||
@Tag(name = "국유인 연동 API", description = "국유인 연동 API")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/innopam/")
|
||||
public class InnopamApiController {
|
||||
@RequestMapping("/api/gukyuin/")
|
||||
public class GukYuinApiController {
|
||||
|
||||
private final InnopamApiService innopamApiService;
|
||||
private final GukYuinApiService gukYuinApiService;
|
||||
|
||||
/** 탐지결과 등록 */
|
||||
@Operation(summary = "탐지결과 등록", description = "탐지결과 등록")
|
||||
@@ -48,8 +50,7 @@ public class InnopamApiController {
|
||||
@PostMapping("/mast/regist")
|
||||
public ChngDetectMastDto.Basic regist(
|
||||
@RequestBody @Valid ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||
// innopamApiService.saveDetectMast(chnDetectMastReq);
|
||||
return innopamApiService.regist(chnDetectMastReq);
|
||||
return gukYuinApiService.regist(chnDetectMastReq);
|
||||
}
|
||||
|
||||
@Operation(summary = "탐지결과 삭제", description = "탐지결과 삭제")
|
||||
@@ -68,7 +69,7 @@ public class InnopamApiController {
|
||||
@PostMapping("/mast/remove")
|
||||
public ResReturn remove(
|
||||
@RequestBody @Valid ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||
return innopamApiService.remove(chnDetectMastReq);
|
||||
return gukYuinApiService.remove(chnDetectMastReq);
|
||||
}
|
||||
|
||||
@Operation(summary = "탐지결과 등록목록 조회", description = "탐지결과 등록목록 조회")
|
||||
@@ -95,6 +96,11 @@ public class InnopamApiController {
|
||||
searchDto.setCprsYr(cprsYr);
|
||||
searchDto.setCrtrYr(crtrYr);
|
||||
searchDto.setChnDtctSno(chnDtctSno);
|
||||
return innopamApiService.list(searchDto);
|
||||
return gukYuinApiService.list(searchDto);
|
||||
}
|
||||
|
||||
public ApiResponseDto<Boolean> getIsLinkGukYuin(UUID uuid) {
|
||||
gukYuinApiService.getIsLinkGukYuin(uuid);
|
||||
return ApiResponseDto.ok(false);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.dto;
|
||||
package com.kamco.cd.kamcoback.gukyuin.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.List;
|
||||
@@ -65,6 +65,7 @@ public class ChngDetectMastDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ChnDetectMastReqDto {
|
||||
|
||||
private String cprsYr; // 비교년도 2023
|
||||
private String crtrYr; // 기준년도 2024
|
||||
private String chnDtctSno; // 차수 (1 | 2 | ...)
|
||||
@@ -127,6 +128,7 @@ public class ChngDetectMastDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ChngDetectMastSearchDto {
|
||||
|
||||
private String chnDtctId;
|
||||
private String cprsYr;
|
||||
private String crtrYr;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.dto;
|
||||
package com.kamco.cd.kamcoback.gukyuin.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.service;
|
||||
package com.kamco.cd.kamcoback.gukyuin.service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.ChngDetectMastDto;
|
||||
import com.kamco.cd.kamcoback.Innopam.dto.ChngDetectMastDto.ResReturn;
|
||||
import com.kamco.cd.kamcoback.Innopam.postgres.core.DetectMastCoreService;
|
||||
import com.kamco.cd.kamcoback.common.utils.NetUtils;
|
||||
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||
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.ResReturn;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
@@ -19,31 +17,26 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Service
|
||||
@Transactional(readOnly = true)
|
||||
@RequiredArgsConstructor
|
||||
public class InnopamApiService {
|
||||
public class GukYuinApiService {
|
||||
|
||||
@Value("${spring.profiles.active:local}")
|
||||
private String profile;
|
||||
|
||||
@Value("${innopam.url}")
|
||||
private String innopamUrl;
|
||||
@Value("${gukyuin.url}")
|
||||
private String gukyuinUrl;
|
||||
|
||||
@Value("${innopam.mast}")
|
||||
private String innopamMastUrl;
|
||||
|
||||
private final DetectMastCoreService detectMastCoreService;
|
||||
@Value("${gukyuin.mast}")
|
||||
private String gukyuinMastUrl;
|
||||
|
||||
private final ExternalHttpClient externalHttpClient;
|
||||
private final UserUtil userUtil = new UserUtil();
|
||||
private final NetUtils netUtils = new NetUtils();
|
||||
|
||||
private final JsonFactory jsonFactory = new JsonFactory();
|
||||
|
||||
@Transactional
|
||||
public ChngDetectMastDto.Basic regist(ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||
|
||||
ChngDetectMastDto.Basic basic = new ChngDetectMastDto.Basic();
|
||||
|
||||
String url = innopamMastUrl + "/regist";
|
||||
String url = gukyuinMastUrl + "/regist";
|
||||
// url = "http://localhost:8080/api/kcd/cdi/detect/mast/regist";
|
||||
|
||||
String myip = netUtils.getLocalIP();
|
||||
@@ -65,7 +58,7 @@ public class InnopamApiService {
|
||||
public ResReturn remove(ChngDetectMastDto.ChnDetectMastReqDto chnDetectMastReq) {
|
||||
ChngDetectMastDto.Basic basic = new ChngDetectMastDto.Basic();
|
||||
|
||||
String url = innopamMastUrl + "/remove";
|
||||
String url = gukyuinMastUrl + "/remove";
|
||||
// url = "http://localhost:8080/api/kcd/cdi/detect/mast/remove";
|
||||
|
||||
String myip = netUtils.getLocalIP();
|
||||
@@ -88,7 +81,7 @@ public class InnopamApiService {
|
||||
List<ChngDetectMastDto.Basic> masterList = new ArrayList<>();
|
||||
|
||||
String queryString = netUtils.dtoToQueryString(searchDto, null);
|
||||
String url = innopamMastUrl + queryString;
|
||||
String url = gukyuinMastUrl + queryString;
|
||||
|
||||
ExternalCallResult<String> result =
|
||||
externalHttpClient.call(url, HttpMethod.GET, null, netUtils.jsonHeaders(), String.class);
|
||||
@@ -97,4 +90,8 @@ public class InnopamApiService {
|
||||
|
||||
return masterList;
|
||||
}
|
||||
|
||||
public Boolean getIsLinkGukYuin(UUID uuid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.utils;
|
||||
package com.kamco.cd.kamcoback.gukyuin.utils;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.locationtech.jts.geom.Coordinate;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.utils;
|
||||
package com.kamco.cd.kamcoback.gukyuin.utils;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.utils;
|
||||
package com.kamco.cd.kamcoback.gukyuin.utils;
|
||||
|
||||
public class MapIdUtils {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.utils;
|
||||
package com.kamco.cd.kamcoback.gukyuin.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kamco.cd.kamcoback.Innopam.utils;
|
||||
package com.kamco.cd.kamcoback.gukyuin.utils;
|
||||
|
||||
import java.util.List;
|
||||
import org.locationtech.jts.geom.Envelope;
|
||||
Reference in New Issue
Block a user