소유권 변경 스케줄링

This commit is contained in:
2025-03-13 14:44:58 +09:00
parent f943a94f65
commit 2a94eb8f65
3 changed files with 41 additions and 2 deletions

View File

@@ -59,6 +59,7 @@ public enum ErrorCode {
ERROR_LAND_AUCTION_IMPOSSIBLE("경매를 진행할 수 없는 랜드입니다."),
ERROR_AUCTION_STATUS_IMPOSSIBLE("수정할 수 없는 경매상태입니다."),
ERROR_AUCTION_LAND_OWNER("해당 랜드는 소유자가 존재하여 경매를 진행할 수 없습니다."),
ERROR_LAND_OWNER_CHANGES_RESERVATION("소유권 변경 예약을 취소할 수 없는 상태입니다."),
//Battle
ERROR_BATTLE_EVENT_TIME_OVER("해당 시간에 속하는 이벤트가 존재합니다."),

View File

@@ -2,7 +2,9 @@ package com.caliverse.admin.global.common.utils;
import com.caliverse.admin.global.common.constants.CommonConstants;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
@@ -23,6 +25,16 @@ public class DateUtils {
return date.atOffset(ZoneOffset.UTC).format(formatter);
}
public static LocalDateTime stringISOToLocalDateTime(String date){
Instant instant = Instant.parse(date);
return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
}
public static LocalDateTime stringToLocalDateTime(String date){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
return LocalDateTime.parse(date, formatter);
}
public static String nowDateTime(){
LocalDateTime now = LocalDateTime.now();
return stringToDateTime(now);

View File

@@ -32,6 +32,7 @@
<result property="buildingId" column="building_id"/>
<result property="buildingName" column="building_name"/>
<result property="userGuid" column="user_guid"/>
<result property="userName" column="user_name"/>
<result property="isReserve" column="is_reserve"/>
<result property="reservationDt" column="reservation_dt"/>
<result property="status" column="status"/>
@@ -240,6 +241,8 @@
, a.land_id
, a.land_name
, a.user_guid
, a.user_name
, a.is_reserve
, a.reservation_dt
, a.status
, (SELECT email FROM admin WHERE id = a.create_by ) AS create_by
@@ -250,6 +253,20 @@
WHERE a.id = #{id}
</select>
<select id="getLandOwnerChangeInfo" parameterType="java.lang.Integer" resultMap="LandOwnerChangeResultMap" >
SELECT
a.id
, a.land_id
, a.land_name
, a.user_guid
, a.user_name
, a.is_reserve
, a.reservation_dt
, a.status
FROM land_ownership_changes a
WHERE a.land_id = #{landId}
</select>
<select id="getMessage" parameterType="java.lang.Long" resultMap="MessageResultMap" >
SELECT
*
@@ -265,8 +282,8 @@
</insert>
<insert id="postLandOwnerChange" parameterType="com.caliverse.admin.domain.request.LandRequest" useGeneratedKeys="true" keyProperty="id">
INSERT INTO land_ownership_changes (land_id, land_name, building_id, building_name, user_guid, is_reserve, reservation_dt, create_by, update_by)
VALUES (#{landId}, #{landName}, #{buildingId}, #{buildingName}, #{userGuid}, #{isReserve}, #{reservationDt}, #{createBy}, #{updateBy})
INSERT INTO land_ownership_changes (land_id, land_name, building_id, building_name, user_guid, user_name, is_reserve, reservation_dt, create_by, update_by)
VALUES (#{landId}, #{landName}, #{buildingId}, #{buildingName}, #{userGuid}, #{userName}, #{isReserve}, #{reservationDt}, #{createBy}, #{updateBy})
</insert>
<insert id="insertMessage" parameterType="map">
@@ -311,6 +328,15 @@
WHERE id = #{id}
</update>
<update id="deleteLandOwnerChanges" parameterType="map">
UPDATE land_ownership_changes
SET deleted = 1
,status = 'CANCEL'
, update_by = #{updateBy}
, update_dt = NOW()
WHERE id = #{id}
</update>
<update id="updateStatusLandAuction" parameterType="map">
UPDATE land_auction
SET status = #{status}