Skip to content

Commit

Permalink
feat: 농가거래 파트로 기능 전환
Browse files Browse the repository at this point in the history
  • Loading branch information
dldmsql committed Aug 18, 2024
1 parent fc308de commit fa21e0f
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 42 deletions.
2 changes: 1 addition & 1 deletion scripts/run_new_was.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ if [ ! -z ${TARGET_PID} ]; then
sudo kill ${TARGET_PID}
fi

nohup java -jar -Dserver.port=${TARGET_PORT} /home/ec2-user/duaily-server/build/libs/* > /home/ec2-user/nohup.out 2>&1 --spring.profiles.active=prod &
nohup java -jar -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=prod /home/ec2-user/duaily-server/build/libs/* > /home/ec2-user/nohup.out 2>&1 &
echo "> Now new WAS runs at ${TARGET_PORT}."
exit 0
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ data class HouseReqDto(
var code: String?, // 게시글 내용
var imageUrls: List<String>?, // 이미지 주소
val tmpYn: Boolean, // 임시저장 false -> save , true -> tmpSave
var recommendedTag: List<String>? // 추천 태그
var recommendedTag: List<String>?, // 추천 태그
var agentDetail: String? // 공인중개사인 경우
)

/**
Expand Down Expand Up @@ -158,6 +159,7 @@ data class HouseResOneDto(
val isScraped: Boolean, // 게시글 스크랩 여부
val recommendedTag: List<RecommendedTag>, // 게시글 추천 태그
val recommendedTagName: List<String>, // 게시글 추천 태그명
val agentDetail: String? // 공인중개사 상세정보
)

/**
Expand Down Expand Up @@ -256,7 +258,8 @@ fun toDto(house: House, isScraped: Boolean): HouseResOneDto {
house.dealState == DealState.COMPLETED,
isScraped,
recommendedTag,
recommendedTagName
recommendedTagName,
house.agentDetail
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ import com.example.jhouse_server.domain.scrap.entity.Scrap
import com.example.jhouse_server.domain.user.entity.User
import com.example.jhouse_server.global.entity.BaseEntity
import javax.persistence.*
@Table(name = "house",
indexes = [Index(name = "idx__rental_type", columnList = "rentalType, useYn, tmpYn, reported, applied"),

@Table(
name = "house",
indexes = [Index(
name = "idx__rental_type",
columnList = "rentalType, useYn, tmpYn, reported, applied"
),
Index(name = "idx__title", columnList = "title, useYn, tmpYn, reported, applied")
])
]
)
@Entity
class House(

var agentDetail: String?,

@Enumerated(EnumType.STRING)
@Column(name = "house_type")
var houseType : HouseType, // 매물타입
var houseType: HouseType, // 매물타입

@Convert(converter = RentalTypeConverter::class)
@Column(length = 40)
Expand All @@ -30,18 +38,18 @@ class House(
var purpose: String?, // 용도 ( 예: 주택 )

@Column(nullable = true)
var floorNum : Int, // 층수 ( 다가구인 경우에만 )
var floorNum: Int, // 층수 ( 다가구인 경우에만 )

@Column(length = 13)
var contact : String, // 바로 연락 가능한 연락처
var contact: String, // 바로 연락 가능한 연락처

@Column(length = 5)
var createdDate : String?, // 준공연도,
var createdDate: String?, // 준공연도,

var price: Int, // 매물가격

@Column(nullable = true)
var monthlyPrice : Double, // 월세의 경우,
var monthlyPrice: Double, // 월세의 경우,

@Column(length = 20)
var agentName: String, // 공인중개사명
Expand All @@ -50,28 +58,28 @@ class House(
var title: String, // 게시글 제목

@Column(length = Int.MAX_VALUE)
var content : String, // 게시글 내용
var content: String, // 게시글 내용

@Column(length = Int.MAX_VALUE)
var code : String, // 게시글 코드
var code: String, // 게시글 코드

@Column(length = Int.MAX_VALUE)
@Convert(converter = BoardImageUrlConverter::class) // 이미지 url ","로 슬라이싱
var imageUrls : List<String>,
var imageUrls: List<String>,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
var user : User,
var user: User,

var useYn : Boolean = true, // 삭제여부 ( 미삭제 : true, 삭제 : false )
var useYn: Boolean = true, // 삭제여부 ( 미삭제 : true, 삭제 : false )

var tmpYn : Boolean = false, // 임시저장여부 ( 임시저장: true, 저장 : false )
var tmpYn: Boolean = false, // 임시저장여부 ( 임시저장: true, 저장 : false )

var reported : Boolean = false, // 신고여부 ( 신고: true, 미신고 : false )
var reported: Boolean = false, // 신고여부 ( 신고: true, 미신고 : false )

@Convert(converter = HouseReviewStatusConverter::class)
@Column(length = 10)
var applied : HouseReviewStatus? = null, // 신청여부
var applied: HouseReviewStatus? = null, // 신청여부

@Column(nullable = true, length = 200)
var rejectReason: String? = null, // 관리자가 게시글을 반려한 이유
Expand All @@ -93,24 +101,26 @@ class House(
) : BaseEntity() {

@OneToOne
lateinit var deal:Deal
lateinit var deal: Deal

fun updateEntity(
agentDetail: String?,
houseType: HouseType,
rentalType: RentalType,
size: String,
purpose: String?,
floorNum: Int,
contact: String,
createdDate: String?,
price: Int,
monthlyPrice: Double,
agentName : String,
title: String,
content : String,
code: String,
imageUrls: List<String>
) : House {
rentalType: RentalType,
size: String,
purpose: String?,
floorNum: Int,
contact: String,
createdDate: String?,
price: Int,
monthlyPrice: Double,
agentName: String,
title: String,
content: String,
code: String,
imageUrls: List<String>
): House {
this.agentDetail = agentDetail
this.houseType = houseType
this.rentalType = rentalType
this.size = size
Expand All @@ -127,6 +137,7 @@ class House(
this.imageUrls = imageUrls
return this
}

fun deleteEntity() {
this.useYn = false
}
Expand All @@ -150,7 +161,7 @@ class House(
this.rejectReason = rejectReason
}

fun addScrap(scrap: Scrap) : House {
fun addScrap(scrap: Scrap): House {
this.scrap.add(scrap)
return this
}
Expand All @@ -172,7 +183,7 @@ class House(
this.dealState = DealState.COMPLETED
}

fun addHouseTag(houseTag: HouseTag) : House {
fun addHouseTag(houseTag: HouseTag): House {
this.houseTag.add(houseTag)
return this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,23 @@ class HouseServiceImpl(
val address = Address(tmpReq.city!!, tmpReq.detail!!, tmpReq.zipCode!!)
val content = getContent(tmpReq.code!!)
val tmp = House(
tmpReq.houseType, tmpReq.rentalType!!, address, tmpReq.size!!, tmpReq.purpose!!, tmpReq.floorNum!!,
tmpReq.contact!!, tmpReq.createdDate!!, tmpReq.price!!, tmpReq.monthlyPrice!!,
tmpReq.agentName!!, tmpReq.title!!, content, tmpReq.code!!, tmpReq.imageUrls!!, user
tmpReq.agentDetail,
tmpReq.houseType,
tmpReq.rentalType!!,
address,
tmpReq.size!!,
tmpReq.purpose!!,
tmpReq.floorNum!!,
tmpReq.contact!!,
tmpReq.createdDate!!,
tmpReq.price!!,
tmpReq.monthlyPrice!!,
tmpReq.agentName!!,
tmpReq.title!!,
content,
tmpReq.code!!,
tmpReq.imageUrls!!,
user
)
// (4) 임시저장 상태로 변경
tmp.tmpSaveEntity()
Expand All @@ -86,9 +100,23 @@ class HouseServiceImpl(
val address = Address(req.city!!, req.detail!!, req.zipCode!!)
val content = getContent(req.code!!)
val house = House(
req.houseType, req.rentalType!!, address, req.size!!, req.purpose, req.floorNum!!,
req.contact!!, req.createdDate, req.price!!, req.monthlyPrice!!,
req.agentName!!, req.title!!, content, req.code!!, req.imageUrls!!, user
req.agentDetail,
req.houseType,
req.rentalType!!,
address,
req.size!!,
req.purpose,
req.floorNum!!,
req.contact!!,
req.createdDate,
req.price!!,
req.monthlyPrice!!,
req.agentName!!,
req.title!!,
content,
req.code!!,
req.imageUrls!!,
user
)
// (3) 게시글 상태 변경
if (user.userType == UserType.AGENT || user.authority == Authority.ADMIN) house.approveEntity()
Expand Down Expand Up @@ -161,6 +189,7 @@ class HouseServiceImpl(
}
// (5) 게시글 데이터 수정
house.updateEntity(
req.agentDetail,
req.houseType,
req.rentalType!!,
req.size!!,
Expand Down

0 comments on commit fa21e0f

Please sign in to comment.