feat/infer_dev_260107 #1
@@ -248,6 +248,9 @@ public class MapSheetMngService {
|
|||||||
addReq.setFileSize(tifFileSize);
|
addReq.setFileSize(tifFileSize);
|
||||||
mapSheetMngCoreService.mngFileSave(addReq);
|
mapSheetMngCoreService.mngFileSave(addReq);
|
||||||
|
|
||||||
|
// 사용할 수 있는 이전 년도 도엽 테이블 저장
|
||||||
|
mapSheetMngCoreService.saveSheetMngYear();
|
||||||
|
|
||||||
return new DmlReturn("success", "파일 업로드 완료되었습니다.");
|
return new DmlReturn("success", "파일 업로드 완료되었습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,13 @@ public class MapLayerCoreService {
|
|||||||
* @param addDto
|
* @param addDto
|
||||||
*/
|
*/
|
||||||
public void save(WmtsAddDto addDto) {
|
public void save(WmtsAddDto addDto) {
|
||||||
Long order = 0L;
|
Long order = 20L;
|
||||||
MapLayerEntity entity = mapLayerRepository.findSortOrderDesc().orElse(null);
|
MapLayerEntity entity = mapLayerRepository.findSortOrderDesc().orElse(null);
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
order = entity.getOrder() == null ? order : entity.getOrder() + 10;
|
order = entity.getOrder() == null ? order : entity.getOrder() + 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String rawJson = objectMapper.writeValueAsString(addDto.getWmtsLayerInfo()); // data 없는 형태로 저장
|
String rawJson = objectMapper.writeValueAsString(addDto.getWmtsLayerInfo()); // data 없는 형태로 저장
|
||||||
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
MapLayerEntity mapLayerEntity = new MapLayerEntity();
|
||||||
@@ -43,7 +45,5 @@ public class MapLayerCoreService {
|
|||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngEntity;
|
|||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.YearEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.YearEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngRepository;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngYearRepository;
|
||||||
import jakarta.persistence.EntityNotFoundException;
|
import jakarta.persistence.EntityNotFoundException;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -44,6 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
public class MapSheetMngCoreService {
|
public class MapSheetMngCoreService {
|
||||||
|
|
||||||
private final MapSheetMngRepository mapSheetMngRepository;
|
private final MapSheetMngRepository mapSheetMngRepository;
|
||||||
|
private final MapSheetMngYearRepository mapSheetMngYearRepository;
|
||||||
|
|
||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String activeEnv;
|
private String activeEnv;
|
||||||
@@ -310,18 +312,23 @@ public class MapSheetMngCoreService {
|
|||||||
return mapSheetMngRepository.findByHstMapSheetTargetList(mngYyyy, mapIds);
|
return mapSheetMngRepository.findByHstMapSheetTargetList(mngYyyy, mapIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 변화탐지 실행 가능 비교년도 조회
|
|
||||||
*
|
|
||||||
* @param mngYyyy
|
|
||||||
* @param mapId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public List<MngListCompareDto> getByHstMapSheetCompareList(int mngYyyy, List<String> mapId) {
|
|
||||||
return mapSheetMngRepository.findByHstMapSheetCompareList(mngYyyy, mapId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateMapSheetMngHstUploadId(Long hstUid, UUID uuid, String uploadId) {
|
public void updateMapSheetMngHstUploadId(Long hstUid, UUID uuid, String uploadId) {
|
||||||
mapSheetMngRepository.updateMapSheetMngHstUploadId(hstUid, uuid, uploadId);
|
mapSheetMngRepository.updateMapSheetMngHstUploadId(hstUid, uuid, uploadId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 변화탐지 실행 가능 비교년도 저장 */
|
||||||
|
public void saveSheetMngYear() {
|
||||||
|
mapSheetMngYearRepository.saveFileInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 변화탐지 실행 가능 비교년도 조회
|
||||||
|
*
|
||||||
|
* @param mngYyyy 비교년도
|
||||||
|
* @param mapId 5k 도엽번호
|
||||||
|
* @return List<MngListCompareDto>
|
||||||
|
*/
|
||||||
|
public List<MngListCompareDto> getByHstMapSheetCompareList(int mngYyyy, List<String> mapId) {
|
||||||
|
return mapSheetMngYearRepository.findByHstMapSheetCompareList(mngYyyy, mapId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.postgres.core;
|
|||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
|
import com.kamco.cd.kamcoback.common.enums.CommonUseStatus;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngFileEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngFileEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngYearRepository;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.scheduler.MapSheetMngFileJobRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.scheduler.MapSheetMngFileJobRepository;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.MapSheetMngDto;
|
import com.kamco.cd.kamcoback.scheduler.dto.MapSheetMngDto;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.MapSheetMngDto.MngHstDto;
|
import com.kamco.cd.kamcoback.scheduler.dto.MapSheetMngDto.MngHstDto;
|
||||||
@@ -16,6 +17,7 @@ import org.springframework.stereotype.Service;
|
|||||||
public class MapSheetMngFileJobCoreService {
|
public class MapSheetMngFileJobCoreService {
|
||||||
|
|
||||||
private final MapSheetMngFileJobRepository mapSheetMngFileJobRepository;
|
private final MapSheetMngFileJobRepository mapSheetMngFileJobRepository;
|
||||||
|
private final MapSheetMngYearRepository mapSheetMngYearRepository;
|
||||||
|
|
||||||
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(
|
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(
|
||||||
MapSheetMngDto.@Valid MngSearchReq searchReq) {
|
MapSheetMngDto.@Valid MngSearchReq searchReq) {
|
||||||
@@ -73,4 +75,8 @@ public class MapSheetMngFileJobCoreService {
|
|||||||
public void updateException5kMapSheet(String mapSheetNum, CommonUseStatus commonUseStatus) {
|
public void updateException5kMapSheet(String mapSheetNum, CommonUseStatus commonUseStatus) {
|
||||||
mapSheetMngFileJobRepository.updateException5kMapSheet(mapSheetNum, commonUseStatus);
|
mapSheetMngFileJobRepository.updateException5kMapSheet(mapSheetNum, commonUseStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void saveSheetMngYear() {
|
||||||
|
mapSheetMngYearRepository.saveFileInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.EmbeddedId;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_map_sheet_mng_year_yn")
|
||||||
|
public class MapSheetMngYearYnEntity {
|
||||||
|
|
||||||
|
@EmbeddedId private MapSheetMngYearYnEntityId id;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "yn", nullable = false, length = Integer.MAX_VALUE)
|
||||||
|
private String yn;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@ColumnDefault("now()")
|
||||||
|
@Column(name = "created_dttm", nullable = false)
|
||||||
|
private ZonedDateTime createdDttm;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@ColumnDefault("now()")
|
||||||
|
@Column(name = "updated_dttm", nullable = false)
|
||||||
|
private ZonedDateTime updatedDttm;
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Embeddable;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Embeddable
|
||||||
|
public class MapSheetMngYearYnEntityId implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6282262062316057898L;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "map_sheet_num", nullable = false, length = 20)
|
||||||
|
private String mapSheetNum;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "mng_yyyy", nullable = false)
|
||||||
|
private Integer mngYyyy;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
MapSheetMngYearYnEntityId entity = (MapSheetMngYearYnEntityId) o;
|
||||||
|
return Objects.equals(this.mngYyyy, entity.mngYyyy)
|
||||||
|
&& Objects.equals(this.mapSheetNum, entity.mapSheetNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(mngYyyy, mapSheetNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
|||||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.ImageFeature;
|
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.ImageFeature;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.YearSearchReq;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.YearSearchReq;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||||
@@ -67,8 +66,6 @@ public interface MapSheetMngRepositoryCustom {
|
|||||||
|
|
||||||
List<MngListDto> findByHstMapSheetTargetList(int mngYyyy, List<String> mapIds);
|
List<MngListDto> findByHstMapSheetTargetList(int mngYyyy, List<String> mapIds);
|
||||||
|
|
||||||
List<MngListCompareDto> findByHstMapSheetCompareList(int mngYyyy, List<String> mapId);
|
|
||||||
|
|
||||||
MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid);
|
MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid);
|
||||||
|
|
||||||
void updateHstFileSizes(Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes);
|
void updateHstFileSizes(Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.ImageFeature;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.YearSearchReq;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.YearSearchReq;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||||
@@ -648,53 +647,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 변화탐지 실행 가능 비교년도 조회
|
|
||||||
*
|
|
||||||
* @param mngYyyy
|
|
||||||
* @param mapIds
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<MngListCompareDto> findByHstMapSheetCompareList(int mngYyyy, List<String> mapIds) {
|
|
||||||
|
|
||||||
String sql =
|
|
||||||
"""
|
|
||||||
SELECT
|
|
||||||
t.map_sheet_num,
|
|
||||||
t.map_years,
|
|
||||||
COALESCE(s.target_year, 0) AS before_year
|
|
||||||
FROM public.tb_map_sheet_years_map t
|
|
||||||
LEFT JOIN LATERAL (
|
|
||||||
SELECT x::int AS target_year
|
|
||||||
FROM unnest(string_to_array(t.map_years, '>')) AS x
|
|
||||||
WHERE x::int <= :mngYyyy
|
|
||||||
ORDER BY x::int DESC
|
|
||||||
LIMIT 1
|
|
||||||
) s ON true
|
|
||||||
INNER JOIN tb_map_inkx_5k tmik
|
|
||||||
ON t.map_sheet_num = tmik.mapidcd_no AND tmik.use_inference = 'USE'
|
|
||||||
WHERE t.map_sheet_num = ANY(:mapIds)
|
|
||||||
""";
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<Object[]> rows =
|
|
||||||
em.createNativeQuery(sql)
|
|
||||||
.setParameter("mngYyyy", mngYyyy)
|
|
||||||
.setParameter("mapIds", mapIds.toArray(new String[0]))
|
|
||||||
.getResultList();
|
|
||||||
|
|
||||||
return rows.stream()
|
|
||||||
.map(
|
|
||||||
r ->
|
|
||||||
new MngListCompareDto(
|
|
||||||
(String) r[1], // map_years
|
|
||||||
(String) r[0], // map_sheet_num
|
|
||||||
((Number) r[2]).intValue() // before_year
|
|
||||||
))
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid) {
|
public List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid) {
|
||||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngYearYnEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngYearYnEntityId;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface MapSheetMngYearRepository
|
||||||
|
extends JpaRepository<MapSheetMngYearYnEntity, MapSheetMngYearYnEntityId>,
|
||||||
|
MapSheetMngYearRepositoryCustom {}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface MapSheetMngYearRepositoryCustom {
|
||||||
|
void saveFileInfo();
|
||||||
|
|
||||||
|
List<MngListCompareDto> findByHstMapSheetCompareList(int mngYyyy, List<String> mapIds);
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngYearYnEntity;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
|
import com.querydsl.core.types.dsl.StringExpression;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MapSheetMngYearRepositoryImpl implements MapSheetMngYearRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory queryFactory;
|
||||||
|
private final EntityManager em;
|
||||||
|
|
||||||
|
/** 변화탐지 실행 가능 비교년도 저장 */
|
||||||
|
@Override
|
||||||
|
public void saveFileInfo() {
|
||||||
|
|
||||||
|
em.createNativeQuery("TRUNCATE TABLE tb_map_sheet_mng_year_yn").executeUpdate();
|
||||||
|
|
||||||
|
String sql =
|
||||||
|
"""
|
||||||
|
WITH bounds AS (
|
||||||
|
SELECT
|
||||||
|
map_sheet_num,
|
||||||
|
MIN(mng_yyyy::int) AS min_y,
|
||||||
|
MAX(mng_yyyy::int) AS max_y
|
||||||
|
FROM tb_map_sheet_mng_files
|
||||||
|
GROUP BY map_sheet_num
|
||||||
|
),
|
||||||
|
years AS (
|
||||||
|
SELECT
|
||||||
|
b.map_sheet_num,
|
||||||
|
gs.y AS mng_yyyy
|
||||||
|
FROM bounds b
|
||||||
|
CROSS JOIN LATERAL generate_series(b.min_y, b.max_y) AS gs(y)
|
||||||
|
),
|
||||||
|
exist AS (
|
||||||
|
SELECT DISTINCT
|
||||||
|
map_sheet_num,
|
||||||
|
mng_yyyy::int AS mng_yyyy
|
||||||
|
FROM tb_map_sheet_mng_files
|
||||||
|
),
|
||||||
|
src AS (
|
||||||
|
SELECT
|
||||||
|
y.map_sheet_num,
|
||||||
|
y.mng_yyyy,
|
||||||
|
CASE
|
||||||
|
WHEN e.map_sheet_num IS NULL THEN 'N'
|
||||||
|
ELSE 'Y'
|
||||||
|
END AS yn
|
||||||
|
FROM years y
|
||||||
|
LEFT JOIN exist e
|
||||||
|
ON e.map_sheet_num = y.map_sheet_num
|
||||||
|
AND e.mng_yyyy = y.mng_yyyy
|
||||||
|
)
|
||||||
|
INSERT INTO tb_map_sheet_mng_year_yn
|
||||||
|
(map_sheet_num, mng_yyyy, yn)
|
||||||
|
SELECT
|
||||||
|
map_sheet_num,
|
||||||
|
mng_yyyy,
|
||||||
|
yn
|
||||||
|
FROM src
|
||||||
|
ON CONFLICT (map_sheet_num, mng_yyyy)
|
||||||
|
DO UPDATE SET
|
||||||
|
yn = EXCLUDED.yn,
|
||||||
|
updated_dttm = now()
|
||||||
|
""";
|
||||||
|
|
||||||
|
em.createNativeQuery(sql).executeUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 변화탐지 실행 가능 비교년도 조회
|
||||||
|
*
|
||||||
|
* @param mngYyyy
|
||||||
|
* @param mapIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<MngListCompareDto> findByHstMapSheetCompareList(int mngYyyy, List<String> mapIds) {
|
||||||
|
QMapSheetMngYearYnEntity y = QMapSheetMngYearYnEntity.mapSheetMngYearYnEntity;
|
||||||
|
|
||||||
|
StringExpression mngYyyyStr = Expressions.stringTemplate("concat({0}, '')", mngYyyy);
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
MngListCompareDto.class, mngYyyyStr, y.id.mapSheetNum, y.id.mngYyyy.max()))
|
||||||
|
.from(y)
|
||||||
|
.where(y.id.mapSheetNum.in(mapIds), y.yn.eq("Y"), y.id.mngYyyy.loe(mngYyyy))
|
||||||
|
.groupBy(y.id.mapSheetNum)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -199,6 +199,9 @@ public class MapSheetMngFileJobService {
|
|||||||
mngHstDataSyncStateUpdate(item);
|
mngHstDataSyncStateUpdate(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 사용할 수 있는 이전 년도 도엽 테이블 저장
|
||||||
|
mapSheetMngFileJobCoreService.saveSheetMngYear();
|
||||||
|
|
||||||
Long notyetCnt = this.mngDataStateDoneUpdate(mngYyyy);
|
Long notyetCnt = this.mngDataStateDoneUpdate(mngYyyy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user