랜드 소유권 변경시 우편 발송
This commit is contained in:
@@ -10,6 +10,8 @@ import com.caliverse.admin.domain.entity.metadata.MetaBuildingData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaLandData;
|
||||
import com.caliverse.admin.domain.request.LandRequest;
|
||||
import com.caliverse.admin.domain.response.LandResponse;
|
||||
import com.caliverse.admin.dynamodb.entity.ELandAuctionResult;
|
||||
import com.caliverse.admin.dynamodb.entity.ELandAuctionState;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbLandAuctionService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbLandService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
||||
@@ -163,47 +165,51 @@ public class LandService {
|
||||
List<LandOwnerChange> ownerChanges = new ArrayList<>();
|
||||
|
||||
if(editor.equals(CommonConstants.USER)){
|
||||
LandAttrib land = dynamodbLandService.getLandInfo(landId);
|
||||
//경매 체크
|
||||
int auctionNumber = dynamodbLandAuctionService.getLandAuctionNumber(landId);
|
||||
if(auctionNumber > 0){
|
||||
LandAuctionRegistryAttrib auctionRegistry = dynamodbLandAuctionService.getLandAuctionRegistry(landId, auctionNumber);
|
||||
String auctionState = auctionRegistry.getAuctionState();
|
||||
if (auctionState.equals(ELandAuctionState.STARTED.getName())) {
|
||||
status = LandInfo.LAND_STATUS.AUCTION_RUNNING.toString();
|
||||
} else if (auctionState.equals(ELandAuctionState.ENDED.getName())) {
|
||||
String auctionResult = auctionRegistry.getAuctionResult();
|
||||
if (auctionResult.equals(ELandAuctionResult.SUCCESSED.getName())) {
|
||||
LandAuctionHighestBidUserAttrib bidUser = dynamodbLandAuctionService.getLandAuctionHighestUser(landId, auctionNumber);
|
||||
status = LandInfo.LAND_STATUS.AUCTION_END.toString();
|
||||
if (bidUser != null) {
|
||||
ownerPrice = bidUser.getHighestBidPrice();
|
||||
} else {
|
||||
log.warn("LandAuction land: {}, auction_number: {} Ended Result Success bidUser null", landId, auctionNumber);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
status = LandInfo.LAND_STATUS.AUCTION_WAIT.toString();
|
||||
}
|
||||
}
|
||||
|
||||
//랜드 존재
|
||||
LandAttrib land = dynamodbLandService.getLandInfo(landId);
|
||||
if(land != null){
|
||||
ownerGuid = land.getOwnerUserGuid();
|
||||
//소유 체크
|
||||
if(!ownerGuid.isEmpty()){
|
||||
String parsedDate = dynamodbLandService.getLandOwnerCreateDate(ownerGuid, landId);
|
||||
ownerDate = parsedDate.isEmpty() ? "" : convertIsoByDatetime(parsedDate);
|
||||
ownerName = dynamodbUserService.getGuidByName(ownerGuid);
|
||||
int auctionNumber = dynamodbLandAuctionService.getLandAuctionNumber(landId);
|
||||
// 경매
|
||||
if(auctionNumber > 0){
|
||||
LandAuction auction = auctions.stream()
|
||||
.filter(row -> row.getLandId().equals(landId) && row.getAuctionSeq().equals(auctionNumber))
|
||||
.findFirst().orElse(null);
|
||||
if(auction == null){
|
||||
log.warn("getLandInfo.buildLandInfo auction info error landId: {}, auctionNumber: {}", landId, auctionNumber);
|
||||
LandAuctionHighestBidUserAttrib bidUser = dynamodbLandAuctionService.getLandAuctionHighestUser(landId, auctionNumber);
|
||||
LandAuctionRegistryAttrib auctionRegistry = dynamodbLandAuctionService.getLandAuctionRegistry(landId, auctionNumber);
|
||||
if(bidUser != null && auctionRegistry != null){
|
||||
status = LandInfo.LAND_STATUS.AUCTION_END.toString();
|
||||
ownerPrice = bidUser.getHighestBidPrice();
|
||||
ownerDate = convertIsoByDatetime(auctionRegistry.getAuctionEndTime());
|
||||
}
|
||||
}else{
|
||||
LandAuction.AUCTION_STATUS auctionStatus = auction.getStatus();
|
||||
if(auctionStatus.equals(LandAuction.AUCTION_STATUS.FAIL) || auctionStatus.equals(LandAuction.AUCTION_STATUS.CANCEL)){
|
||||
status = "";
|
||||
}else{
|
||||
status = auctionStatus.toString();
|
||||
if(auctionStatus.equals(LandAuction.AUCTION_STATUS.AUCTION_END)){
|
||||
ownerPrice = auction.getClosePrice();
|
||||
ownerDate = stringToDateTime(auction.getCloseEndDt());
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String parsedDate = dynamodbLandService.getLandOwnerCreateDate(ownerGuid, landId);
|
||||
ownerDate = parsedDate.isEmpty() ? "" : convertIsoByDatetime(parsedDate);
|
||||
if(status.equals(LandInfo.LAND_STATUS.NONE.toString())){
|
||||
status = LandInfo.LAND_STATUS.OWNED.toString();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
ownerChanges = landMapper.getLandOwnerChangeInfo(landId);
|
||||
}
|
||||
|
||||
//변경 이력
|
||||
ownerChanges = landMapper.getLandOwnerChangeInfo(landId);
|
||||
if(!ownerChanges.isEmpty()){
|
||||
long changesCount = ownerChanges.stream().filter(changeData -> changeData.getStatus().equals(LandOwnerChange.CHANGE_STATUS.WAIT)).count();
|
||||
if(changesCount > 0){
|
||||
status = LandInfo.LAND_STATUS.OWNED_WAIT.toString();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
ownerName = CommonConstants.CALIVERSE_NAME;
|
||||
@@ -442,6 +448,14 @@ public class LandService {
|
||||
.build();
|
||||
}
|
||||
|
||||
int chk = landMapper.getPossibleLandOwnerChanges(landRequest.getLandId());
|
||||
if(chk > 0){
|
||||
return LandResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.ERROR_LAND_OWNER_CHANGES_DUPLICATION.toString())
|
||||
.build();
|
||||
}
|
||||
|
||||
landRequest.setCreateBy(CommonUtils.getAdmin().getId());
|
||||
boolean is_reserve = landRequest.isReserve();
|
||||
if(!is_reserve){
|
||||
@@ -471,11 +485,12 @@ public class LandService {
|
||||
CommonUtils.getClientIp()
|
||||
);
|
||||
|
||||
if(!is_reserve){
|
||||
dynamodbLandService.ChangesLandOwner(landRequest);
|
||||
map.put("status", LandOwnerChange.CHANGE_STATUS.FINISH);
|
||||
updateLandOwnedChangeStatus(map);
|
||||
}
|
||||
// if(!is_reserve){
|
||||
// dynamodbLandService.ChangesLandOwner(landRequest);
|
||||
// map.put("status", LandOwnerChange.CHANGE_STATUS.FINISH);
|
||||
// updateLandOwnedChangeStatus(map);
|
||||
// dynamodbService.insertLandChangesMail(landRequest);
|
||||
// }
|
||||
|
||||
return LandResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
|
||||
Reference in New Issue
Block a user