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