Skip to content

Commit fa21e0f

Browse files
committed
feat: 농가거래 파트로 기능 전환
1 parent fc308de commit fa21e0f

File tree

4 files changed

+85
-42
lines changed

4 files changed

+85
-42
lines changed

scripts/run_new_was.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ if [ ! -z ${TARGET_PID} ]; then
2020
sudo kill ${TARGET_PID}
2121
fi
2222

23-
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 &
23+
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 &
2424
echo "> Now new WAS runs at ${TARGET_PORT}."
2525
exit 0

src/main/kotlin/com/example/jhouse_server/domain/house/dto/HouseReqDto.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ data class HouseReqDto(
3232
var code: String?, // 게시글 내용
3333
var imageUrls: List<String>?, // 이미지 주소
3434
val tmpYn: Boolean, // 임시저장 false -> save , true -> tmpSave
35-
var recommendedTag: List<String>? // 추천 태그
35+
var recommendedTag: List<String>?, // 추천 태그
36+
var agentDetail: String? // 공인중개사인 경우
3637
)
3738

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

163165
/**
@@ -256,7 +258,8 @@ fun toDto(house: House, isScraped: Boolean): HouseResOneDto {
256258
house.dealState == DealState.COMPLETED,
257259
isScraped,
258260
recommendedTag,
259-
recommendedTagName
261+
recommendedTagName,
262+
house.agentDetail
260263
)
261264
}
262265

src/main/kotlin/com/example/jhouse_server/domain/house/entity/House.kt

+44-33
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,24 @@ import com.example.jhouse_server.domain.scrap.entity.Scrap
55
import com.example.jhouse_server.domain.user.entity.User
66
import com.example.jhouse_server.global.entity.BaseEntity
77
import javax.persistence.*
8-
@Table(name = "house",
9-
indexes = [Index(name = "idx__rental_type", columnList = "rentalType, useYn, tmpYn, reported, applied"),
8+
9+
@Table(
10+
name = "house",
11+
indexes = [Index(
12+
name = "idx__rental_type",
13+
columnList = "rentalType, useYn, tmpYn, reported, applied"
14+
),
1015
Index(name = "idx__title", columnList = "title, useYn, tmpYn, reported, applied")
11-
])
16+
]
17+
)
1218
@Entity
1319
class House(
1420

21+
var agentDetail: String?,
22+
1523
@Enumerated(EnumType.STRING)
1624
@Column(name = "house_type")
17-
var houseType : HouseType, // 매물타입
25+
var houseType: HouseType, // 매물타입
1826

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

3240
@Column(nullable = true)
33-
var floorNum : Int, // 층수 ( 다가구인 경우에만 )
41+
var floorNum: Int, // 층수 ( 다가구인 경우에만 )
3442

3543
@Column(length = 13)
36-
var contact : String, // 바로 연락 가능한 연락처
44+
var contact: String, // 바로 연락 가능한 연락처
3745

3846
@Column(length = 5)
39-
var createdDate : String?, // 준공연도,
47+
var createdDate: String?, // 준공연도,
4048

4149
var price: Int, // 매물가격
4250

4351
@Column(nullable = true)
44-
var monthlyPrice : Double, // 월세의 경우,
52+
var monthlyPrice: Double, // 월세의 경우,
4553

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

5260
@Column(length = Int.MAX_VALUE)
53-
var content : String, // 게시글 내용
61+
var content: String, // 게시글 내용
5462

5563
@Column(length = Int.MAX_VALUE)
56-
var code : String, // 게시글 코드
64+
var code: String, // 게시글 코드
5765

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

6270
@ManyToOne(fetch = FetchType.LAZY)
6371
@JoinColumn(name = "user_id", nullable = false)
64-
var user : User,
72+
var user: User,
6573

66-
var useYn : Boolean = true, // 삭제여부 ( 미삭제 : true, 삭제 : false )
74+
var useYn: Boolean = true, // 삭제여부 ( 미삭제 : true, 삭제 : false )
6775

68-
var tmpYn : Boolean = false, // 임시저장여부 ( 임시저장: true, 저장 : false )
76+
var tmpYn: Boolean = false, // 임시저장여부 ( 임시저장: true, 저장 : false )
6977

70-
var reported : Boolean = false, // 신고여부 ( 신고: true, 미신고 : false )
78+
var reported: Boolean = false, // 신고여부 ( 신고: true, 미신고 : false )
7179

7280
@Convert(converter = HouseReviewStatusConverter::class)
7381
@Column(length = 10)
74-
var applied : HouseReviewStatus? = null, // 신청여부
82+
var applied: HouseReviewStatus? = null, // 신청여부
7583

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

95103
@OneToOne
96-
lateinit var deal:Deal
104+
lateinit var deal: Deal
97105

98106
fun updateEntity(
107+
agentDetail: String?,
99108
houseType: HouseType,
100-
rentalType: RentalType,
101-
size: String,
102-
purpose: String?,
103-
floorNum: Int,
104-
contact: String,
105-
createdDate: String?,
106-
price: Int,
107-
monthlyPrice: Double,
108-
agentName : String,
109-
title: String,
110-
content : String,
111-
code: String,
112-
imageUrls: List<String>
113-
) : House {
109+
rentalType: RentalType,
110+
size: String,
111+
purpose: String?,
112+
floorNum: Int,
113+
contact: String,
114+
createdDate: String?,
115+
price: Int,
116+
monthlyPrice: Double,
117+
agentName: String,
118+
title: String,
119+
content: String,
120+
code: String,
121+
imageUrls: List<String>
122+
): House {
123+
this.agentDetail = agentDetail
114124
this.houseType = houseType
115125
this.rentalType = rentalType
116126
this.size = size
@@ -127,6 +137,7 @@ class House(
127137
this.imageUrls = imageUrls
128138
return this
129139
}
140+
130141
fun deleteEntity() {
131142
this.useYn = false
132143
}
@@ -150,7 +161,7 @@ class House(
150161
this.rejectReason = rejectReason
151162
}
152163

153-
fun addScrap(scrap: Scrap) : House {
164+
fun addScrap(scrap: Scrap): House {
154165
this.scrap.add(scrap)
155166
return this
156167
}
@@ -172,7 +183,7 @@ class House(
172183
this.dealState = DealState.COMPLETED
173184
}
174185

175-
fun addHouseTag(houseTag: HouseTag) : House {
186+
fun addHouseTag(houseTag: HouseTag): House {
176187
this.houseTag.add(houseTag)
177188
return this
178189
}

src/main/kotlin/com/example/jhouse_server/domain/house/service/HouseServiceImpl.kt

+35-6
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,23 @@ class HouseServiceImpl(
6363
val address = Address(tmpReq.city!!, tmpReq.detail!!, tmpReq.zipCode!!)
6464
val content = getContent(tmpReq.code!!)
6565
val tmp = House(
66-
tmpReq.houseType, tmpReq.rentalType!!, address, tmpReq.size!!, tmpReq.purpose!!, tmpReq.floorNum!!,
67-
tmpReq.contact!!, tmpReq.createdDate!!, tmpReq.price!!, tmpReq.monthlyPrice!!,
68-
tmpReq.agentName!!, tmpReq.title!!, content, tmpReq.code!!, tmpReq.imageUrls!!, user
66+
tmpReq.agentDetail,
67+
tmpReq.houseType,
68+
tmpReq.rentalType!!,
69+
address,
70+
tmpReq.size!!,
71+
tmpReq.purpose!!,
72+
tmpReq.floorNum!!,
73+
tmpReq.contact!!,
74+
tmpReq.createdDate!!,
75+
tmpReq.price!!,
76+
tmpReq.monthlyPrice!!,
77+
tmpReq.agentName!!,
78+
tmpReq.title!!,
79+
content,
80+
tmpReq.code!!,
81+
tmpReq.imageUrls!!,
82+
user
6983
)
7084
// (4) 임시저장 상태로 변경
7185
tmp.tmpSaveEntity()
@@ -86,9 +100,23 @@ class HouseServiceImpl(
86100
val address = Address(req.city!!, req.detail!!, req.zipCode!!)
87101
val content = getContent(req.code!!)
88102
val house = House(
89-
req.houseType, req.rentalType!!, address, req.size!!, req.purpose, req.floorNum!!,
90-
req.contact!!, req.createdDate, req.price!!, req.monthlyPrice!!,
91-
req.agentName!!, req.title!!, content, req.code!!, req.imageUrls!!, user
103+
req.agentDetail,
104+
req.houseType,
105+
req.rentalType!!,
106+
address,
107+
req.size!!,
108+
req.purpose,
109+
req.floorNum!!,
110+
req.contact!!,
111+
req.createdDate,
112+
req.price!!,
113+
req.monthlyPrice!!,
114+
req.agentName!!,
115+
req.title!!,
116+
content,
117+
req.code!!,
118+
req.imageUrls!!,
119+
user
92120
)
93121
// (3) 게시글 상태 변경
94122
if (user.userType == UserType.AGENT || user.authority == Authority.ADMIN) house.approveEntity()
@@ -161,6 +189,7 @@ class HouseServiceImpl(
161189
}
162190
// (5) 게시글 데이터 수정
163191
house.updateEntity(
192+
req.agentDetail,
164193
req.houseType,
165194
req.rentalType!!,
166195
req.size!!,

0 commit comments

Comments
 (0)