dynamodb 랜드소유정보
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.dynamodb.domain.doc.OwnedLandDoc;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.OwnedLandRepository;
|
||||
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc> implements OwnedLandRepository {
|
||||
public OwnedLandRepositoryImpl(DynamoDBOperations operations, DynamodbHistoryLogService dynamodbHistoryLogService, ObjectMapper objectMapper) {
|
||||
super(operations, OwnedLandDoc.class, dynamodbHistoryLogService, objectMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OwnedLandDoc findOwnedLand(String guid, Integer landId) {
|
||||
Key key = Key.builder()
|
||||
.partitionValue(DynamoDBConstants.PK_KEY_OWNED_LAND + guid)
|
||||
.sortValue(String.valueOf(landId))
|
||||
.build();
|
||||
|
||||
return findById(key);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.caliverse.admin.dynamodb.repository;
|
||||
|
||||
import com.caliverse.admin.dynamodb.domain.doc.OwnedLandDoc;
|
||||
|
||||
public interface OwnedLandRepository extends DynamoDBRepository<OwnedLandDoc> {
|
||||
OwnedLandDoc findOwnedLand(String guid, Integer landId);
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.caliverse.admin.dynamodb.service;
|
||||
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.LandAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.OwnedLandDoc;
|
||||
import com.caliverse.admin.dynamodb.repository.LandRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.OwnedLandRepository;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -12,6 +14,7 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
public class DynamodbLandService {
|
||||
private final LandRepository landRepository;
|
||||
private final OwnedLandRepository ownedLandRepository;
|
||||
|
||||
public boolean isLandOwner(Integer landId){
|
||||
LandAttrib attrib = landRepository.findLandAttrib(landId);
|
||||
@@ -19,4 +22,13 @@ public class DynamodbLandService {
|
||||
|
||||
return !attrib.getOwnerUserGuid().isEmpty() && !attrib.getOwnerUserGuid().equals(DynamoDBConstants.EMPTY);
|
||||
}
|
||||
|
||||
public LandAttrib getLandInfo(Integer landId){
|
||||
return landRepository.findLandAttrib(landId);
|
||||
}
|
||||
|
||||
public String getLandOwnerCreateDate(String guid, Integer landId){
|
||||
OwnedLandDoc ownedLand = ownedLandRepository.findOwnedLand(guid, landId);
|
||||
return ownedLand == null ? "" : ownedLand.getCreatedDateTime();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user