랜드소유권변경 버그 수정
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.caliverse.admin.dynamodb.domain.doc;
|
||||
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.LandAttrib;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.request.LandRequest;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.BuildingAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.LandAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.BuildingDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.ECurrencyType;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
@@ -82,6 +83,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
|
||||
save(doc);
|
||||
|
||||
log.info("BuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(),
|
||||
@@ -100,12 +103,12 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
public void updateBuilding(LandRequest landRequest) {
|
||||
LocalDateTime nowDate = LocalDateTime.now();
|
||||
|
||||
int land_id = landRequest.getLandId();
|
||||
int buildingId_id = landRequest.getBuildingId();
|
||||
String guid = landRequest.getUserGuid();
|
||||
|
||||
try {
|
||||
Key key = Key.builder()
|
||||
.partitionValue(DynamoDBConstants.PK_KEY_LAND + land_id)
|
||||
.partitionValue(DynamoDBConstants.PK_KEY_BUILDING + buildingId_id)
|
||||
.sortValue(DynamoDBConstants.EMPTY)
|
||||
.build();
|
||||
|
||||
@@ -114,7 +117,7 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
if (beforeDoc != null) {
|
||||
BuildingDoc afterDoc = deepCopy(beforeDoc, BuildingDoc.class);
|
||||
|
||||
BuildingAttrib attrib = new BuildingAttrib();
|
||||
BuildingAttrib attrib = objectMapper.readValue(afterDoc.getAttribValue(), BuildingAttrib.class);
|
||||
attrib.setDescription("");
|
||||
attrib.setOwnerUserGuid(guid);
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
attrib.setDescription("");
|
||||
attrib.setOwnerUserGuid(guid);
|
||||
|
||||
|
||||
LandDoc doc = new LandDoc();
|
||||
doc.setPK(pk);
|
||||
doc.setSK(DynamoDBConstants.EMPTY);
|
||||
@@ -78,6 +77,8 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
|
||||
save(doc);
|
||||
|
||||
log.info("LandDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(),
|
||||
@@ -110,7 +111,7 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
if (beforeDoc != null) {
|
||||
LandDoc afterDoc = deepCopy(beforeDoc, LandDoc.class);
|
||||
|
||||
LandAttrib attrib = new LandAttrib();
|
||||
LandAttrib attrib = objectMapper.readValue(afterDoc.getAttribValue(), LandAttrib.class);
|
||||
attrib.setDescription("");
|
||||
attrib.setOwnerUserGuid(guid);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.OwnedBuildingAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.OwnedBuildingDoc;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.OwnedLandDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.EOwnedType;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.OwnedBuildingRepository;
|
||||
@@ -41,6 +42,12 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
|
||||
|
||||
@Override
|
||||
public void insert(String guid, Integer buildingId) {
|
||||
OwnedBuildingDoc ownedBuilding = findOwnedBuilding(guid, buildingId);
|
||||
if (ownedBuilding != null){
|
||||
log.warn("OwnedBuilding guid: {}, buildingId: {} Exist", guid, buildingId);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
LocalDateTime nowDate = LocalDateTime.now();
|
||||
|
||||
@@ -63,6 +70,8 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
|
||||
|
||||
save(doc);
|
||||
|
||||
log.info("OwnedBuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(),
|
||||
@@ -79,22 +88,29 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
|
||||
|
||||
@Override
|
||||
public void delete(String guid, Integer buildingId) {
|
||||
Key key = Key.builder()
|
||||
.partitionValue(DynamoDBConstants.PK_KEY_OWNED_BUILDING + guid)
|
||||
.sortValue(String.valueOf(buildingId))
|
||||
.build();
|
||||
try{
|
||||
Key key = Key.builder()
|
||||
.partitionValue(DynamoDBConstants.PK_KEY_OWNED_BUILDING + guid)
|
||||
.sortValue(String.valueOf(buildingId))
|
||||
.build();
|
||||
|
||||
OwnedBuildingDoc doc = findById(key);
|
||||
OwnedBuildingDoc doc = findById(key);
|
||||
|
||||
delete(key);
|
||||
delete(key);
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
doc,
|
||||
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
|
||||
);
|
||||
log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
doc,
|
||||
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
|
||||
);
|
||||
}catch (Exception e){
|
||||
log.error("delete Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,6 +41,12 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
|
||||
|
||||
@Override
|
||||
public void insert(String guid, Integer landId) {
|
||||
OwnedLandDoc ownedLand = findOwnedLand(guid, landId);
|
||||
if (ownedLand != null) {
|
||||
log.warn("OwnedLand guid: {}, landId: {} Exist", guid, landId);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
LocalDateTime nowDate = LocalDateTime.now();
|
||||
|
||||
@@ -63,6 +69,8 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
|
||||
|
||||
save(doc);
|
||||
|
||||
log.info("OwnedLandDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(),
|
||||
@@ -79,21 +87,28 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
|
||||
|
||||
@Override
|
||||
public void delete(String guid, Integer landId) {
|
||||
Key key = Key.builder()
|
||||
.partitionValue(DynamoDBConstants.PK_KEY_OWNED_LAND + guid)
|
||||
.sortValue(String.valueOf(landId))
|
||||
.build();
|
||||
try {
|
||||
Key key = Key.builder()
|
||||
.partitionValue(DynamoDBConstants.PK_KEY_OWNED_LAND + guid)
|
||||
.sortValue(String.valueOf(landId))
|
||||
.build();
|
||||
|
||||
OwnedLandDoc doc = findById(key);
|
||||
OwnedLandDoc doc = findById(key);
|
||||
|
||||
delete(key);
|
||||
delete(key);
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
doc,
|
||||
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
|
||||
);
|
||||
log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
doc,
|
||||
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
|
||||
);
|
||||
}catch (Exception e){
|
||||
log.error("delete Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ public class DynamodbLandService {
|
||||
int buildingId = landRequest.getBuildingId();
|
||||
String guid = landRequest.getUserGuid();
|
||||
|
||||
log.info("ChangesLandOwner land: {}, guid: {}", landId, guid);
|
||||
|
||||
LandAttrib landAttrib = landRepository.findLandAttrib(landId);
|
||||
if(landAttrib == null){
|
||||
landRepository.insertLand(landRequest);
|
||||
|
||||
Reference in New Issue
Block a user