1
1
package com.example.jhouse_server.domain.house.dto
2
2
3
- import com.example.jhouse_server.domain.house.entity.DealState
4
- import com.example.jhouse_server.domain.house.entity.House
5
- import com.example.jhouse_server.domain.house.entity.RecommendedTag
6
- import com.example.jhouse_server.domain.house.entity.RentalType
3
+ import com.example.jhouse_server.domain.house.entity.*
7
4
import com.example.jhouse_server.domain.user.entity.UserType
8
5
import org.hibernate.validator.constraints.Length
9
6
import java.io.Serializable
@@ -18,6 +15,7 @@ import javax.validation.constraints.Pattern
18
15
* ================================================================================================
19
16
* */
20
17
data class HouseReqDto (
18
+ var houseType : HouseType ,
21
19
var rentalType : RentalType ? = null ,
22
20
var city : String? ,
23
21
var detail : String? ,
@@ -29,11 +27,11 @@ data class HouseReqDto(
29
27
var createdDate : String? ,
30
28
var price : Int ,
31
29
var monthlyPrice : Double ,
32
- var agentName : String? , // 공인중개사인 경우
30
+ var agentName : String? , // 공인중개사인 경우
33
31
var title : String? , // 게시글 제목
34
32
var code : String? , // 게시글 내용
35
33
var imageUrls : List <String >? , // 이미지 주소
36
- val tmpYn : Boolean , // 임시저장 false -> save , true -> tmpSave
34
+ val tmpYn : Boolean , // 임시저장 false -> save , true -> tmpSave
37
35
var recommendedTag : List <String >? // 추천 태그
38
36
)
39
37
@@ -43,12 +41,13 @@ data class HouseReqDto(
43
41
* ================================================================================================
44
42
* */
45
43
data class HouseListDto (
44
+ var houseType : String? , // 빈집 매물 타입
46
45
val rentalType : String? , // 빈집 매물 유형
47
46
val city : String? , // 매물 위치
48
47
val recommendedTag : List <RecommendedTag >? , // 추천 태그
49
48
val search : String? , // 검색어 ( 제목과 닉네임 )
50
49
val dealState : String? //
51
- ): Serializable
50
+ ) : Serializable
52
51
53
52
/* *
54
53
* ================================================================================================
@@ -58,15 +57,18 @@ data class HouseListDto(
58
57
data class HouseAgentListDto (
59
58
val search : String? ,
60
59
val dealState : String? ,
61
- val isCompleted : Boolean? // 거래 기능 개발 후 판매상태 조건 추가
60
+ val isCompleted : Boolean? , // 거래 기능 개발 후 판매상태 조건 추가
61
+ val houseType : String? ,
62
62
)
63
+
63
64
/* *
64
65
* ================================================================================================
65
66
* 마이페이지) 빈집 매물 게시글 목록 조회 DTO -- 일반 사용자
66
67
* ================================================================================================
67
68
* */
68
69
data class MyHouseResDto (
69
70
val houseId : Long ,
71
+ var houseType : HouseType ,
70
72
val rentalType : RentalType ,
71
73
val city : String ,
72
74
val title : String ,
@@ -82,23 +84,26 @@ data class MyHouseResDto(
82
84
* */
83
85
class HouseResDto () : Serializable {
84
86
var houseId: Long = 0 // 게시글 아이디
87
+ lateinit var houseType: HouseType // 매물 타입
85
88
lateinit var rentalType: RentalType // 매물 유형
86
- lateinit var city: String // 매물 위치
89
+ lateinit var city: String // 매물 위치
87
90
var price: Int? = 0 // 매물 가격 ( 월세의 경우, 보증금 )
88
91
var monthlyPrice: Double? = 0.0 // 매물 월세
89
92
lateinit var nickName: String // 매물 작성자 닉네임
90
93
lateinit var createdAt: Date // 게시글 작성일자 ( yyyy-MM-dd ) -> 클라이언트 측에서 파싱
91
94
var isCompleted: Boolean = false // 매물 거래 여부
92
- var imageUrl : String? = null // 썸네일
95
+ var imageUrl: String? = null // 썸네일
93
96
lateinit var title: String // 게시글 제목
94
97
lateinit var recommendedTag: List <RecommendedTag > // 추천 태그
95
98
lateinit var recommendedTagName: List <String > // 추천 태그명
99
+
96
100
constructor (
97
- houseId : Long ,
98
- rentalType : RentalType ,
101
+ houseId: Long ,
102
+ houseType: HouseType ,
103
+ rentalType: RentalType ,
99
104
city: String ,
100
105
price: Int ,
101
- monthlyPrice : Double ,
106
+ monthlyPrice: Double ,
102
107
nickName: String ,
103
108
createdAt: Date ,
104
109
isCompleted: Boolean ,
@@ -108,6 +113,7 @@ class HouseResDto() : Serializable {
108
113
recommendedTagName: List <String >
109
114
) : this () {
110
115
this .houseId = houseId
116
+ this .houseType = houseType
111
117
this .rentalType = rentalType
112
118
this .city = city
113
119
this .price = price
@@ -120,37 +126,38 @@ class HouseResDto() : Serializable {
120
126
this .recommendedTag = recommendedTag
121
127
this .recommendedTagName = recommendedTagName
122
128
}
123
- }
129
+ }
124
130
125
131
/* *
126
132
* ================================================================================================
127
133
* 빈집 매물 게시글 단일 조회 시, 응답 DTO
128
134
* ================================================================================================
129
135
* */
130
136
data class HouseResOneDto (
131
- val houseId : Long ,
132
- val rentalType : RentalType ,
133
- val city : String ,
134
- val detail : String? ,
135
- val zipCode : String ,
136
- val size : String ,
137
- val purpose : String ,
138
- val floorNum : Int ,
139
- val contact : String ,
140
- val createdDate : String , // 준공연도
141
- val price : Int ,
142
- val monthlyPrice : Double ,
143
- val agentName : String , // 공인중개사명
144
- val title : String ,
145
- val code : String ,
146
- val imageUrls : List <String >,
147
- val nickName : String , // 게시글 작성자
148
- val userType : UserType , // 게시글 작성자의 타입 ( 일반회원, 공인중개사 )
149
- val createdAt : Date ,
150
- val isCompleted : Boolean , // 거래 완료 여부
151
- val isScraped : Boolean , // 게시글 스크랩 여부
152
- val recommendedTag : List <RecommendedTag >, // 게시글 추천 태그
153
- val recommendedTagName : List <String >, // 게시글 추천 태그명
137
+ val houseId : Long ,
138
+ var houseType : HouseType ,
139
+ val rentalType : RentalType ,
140
+ val city : String ,
141
+ val detail : String? ,
142
+ val zipCode : String ,
143
+ val size : String ,
144
+ val purpose : String? ,
145
+ val floorNum : Int ,
146
+ val contact : String ,
147
+ val createdDate : String? , // 준공연도
148
+ val price : Int ,
149
+ val monthlyPrice : Double ,
150
+ val agentName : String , // 공인중개사명
151
+ val title : String ,
152
+ val code : String ,
153
+ val imageUrls : List <String >,
154
+ val nickName : String , // 게시글 작성자
155
+ val userType : UserType , // 게시글 작성자의 타입 ( 일반회원, 공인중개사 )
156
+ val createdAt : Date ,
157
+ val isCompleted : Boolean , // 거래 완료 여부
158
+ val isScraped : Boolean , // 게시글 스크랩 여부
159
+ val recommendedTag : List <RecommendedTag >, // 게시글 추천 태그
160
+ val recommendedTagName : List <String >, // 게시글 추천 태그명
154
161
)
155
162
156
163
/* *
@@ -172,14 +179,17 @@ data class ReportReqDto(
172
179
* */
173
180
data class DealReqDto (
174
181
@field:NotNull(message = "만족도 점수는 필수값입니다.")
175
- val score : Int ,
176
- val review : String? ,
182
+ val score : Int ,
183
+ val review : String? ,
177
184
val nickName : String? ,
178
- val age : String? ,
185
+ val age : String? ,
179
186
@field:NotNull(message = "구매자 연락처 정보는 필수값입니다.")
180
- val contact : String ,
181
- @field:Pattern(regexp = "\"\"\"^\\d{4}-\\d{2}-\\d{2}\$\"\"\"", message = "팔린날짜는 필수값입니다. ( yyyy-MM -dd )")
182
- val dealDate : String ,
187
+ val contact : String ,
188
+ @field:Pattern(
189
+ regexp = "\"\"\"^\\d{4}-\\d{2}-\\d{2}\$\"\"\"",
190
+ message = "팔린날짜는 필수값입니다. ( yyyy-MM -dd )"
191
+ )
192
+ val dealDate : String ,
183
193
)
184
194
185
195
/* *
@@ -188,27 +198,77 @@ data class DealReqDto(
188
198
* ================================================================================================
189
199
* */
190
200
191
- fun getTagByNameFromHouseTags (houseTag : List <RecommendedTag >) : List <RecommendedTag > {
201
+ fun getTagByNameFromHouseTags (houseTag : List <RecommendedTag >): List <RecommendedTag > {
192
202
return houseTag.stream().map { RecommendedTag .getTagByName(it.name) }.toList()
193
203
}
194
204
195
- fun toListDto (house : House ) : HouseResDto {
196
- val recommendedTag: List <RecommendedTag > = getTagByNameFromHouseTags(house.houseTag.stream().map { it.recommendedTag }.toList())
197
- val recommendedTagName: List <String > = house.houseTag.stream().map { RecommendedTag .getValueByTagName(it.recommendedTag.name) }.toList()
198
- val imageUrl = if (house.imageUrls.isEmpty()) null else house.imageUrls[0 ]
199
- return HouseResDto (house.id, house.rentalType, house.address.city, house.price, house.monthlyPrice,
200
- house.user.nickName, Timestamp .valueOf(house.createdAt), house.dealState == DealState .COMPLETED ,
201
- imageUrl, house.title, recommendedTag, recommendedTagName )
205
+ fun toListDto (house : House ): HouseResDto {
206
+ val recommendedTag: List <RecommendedTag > =
207
+ getTagByNameFromHouseTags(house.houseTag.stream().map { it.recommendedTag }.toList())
208
+ val recommendedTagName: List <String > =
209
+ house.houseTag.stream().map { RecommendedTag .getValueByTagName(it.recommendedTag.name) }
210
+ .toList()
211
+ val imageUrl = if (house.imageUrls.isEmpty()) null else house.imageUrls[0 ]
212
+ return HouseResDto (
213
+ house.id,
214
+ house.houseType,
215
+ house.rentalType,
216
+ house.address.city,
217
+ house.price,
218
+ house.monthlyPrice,
219
+ house.user.nickName,
220
+ Timestamp .valueOf(house.createdAt),
221
+ house.dealState == DealState .COMPLETED ,
222
+ imageUrl,
223
+ house.title,
224
+ recommendedTag,
225
+ recommendedTagName
226
+ )
202
227
}
203
- fun toDto (house : House , isScraped : Boolean ) : HouseResOneDto {
204
- val recommendedTag: List <RecommendedTag > = getTagByNameFromHouseTags(house.houseTag.stream().map { it.recommendedTag }.toList())
205
- val recommendedTagName: List <String > = house.houseTag.stream().map { RecommendedTag .getValueByTagName(it.recommendedTag.name) }.toList()
206
- return HouseResOneDto (house.id, house.rentalType, house.address.city, house.address.detail,
207
- house.address.zipCode, house.size, house.purpose, house.floorNum, house.contact,
208
- house.createdDate, house.price, house.monthlyPrice,
209
- house.agentName, house.title, house.code, house.imageUrls, house.user.nickName,
210
- house.user.userType, Timestamp .valueOf(house.createdAt), house.dealState == DealState .COMPLETED , isScraped, recommendedTag, recommendedTagName)
228
+
229
+ fun toDto (house : House , isScraped : Boolean ): HouseResOneDto {
230
+ val recommendedTag: List <RecommendedTag > =
231
+ getTagByNameFromHouseTags(house.houseTag.stream().map { it.recommendedTag }.toList())
232
+ val recommendedTagName: List <String > =
233
+ house.houseTag.stream().map { RecommendedTag .getValueByTagName(it.recommendedTag.name) }
234
+ .toList()
235
+ return HouseResOneDto (
236
+ house.id,
237
+ house.houseType,
238
+ house.rentalType,
239
+ house.address.city,
240
+ house.address.detail,
241
+ house.address.zipCode,
242
+ house.size,
243
+ house.purpose,
244
+ house.floorNum,
245
+ house.contact,
246
+ house.createdDate,
247
+ house.price,
248
+ house.monthlyPrice,
249
+ house.agentName,
250
+ house.title,
251
+ house.code,
252
+ house.imageUrls,
253
+ house.user.nickName,
254
+ house.user.userType,
255
+ Timestamp .valueOf(house.createdAt),
256
+ house.dealState == DealState .COMPLETED ,
257
+ isScraped,
258
+ recommendedTag,
259
+ recommendedTagName
260
+ )
211
261
}
212
- fun toMyHouseDto (house : House ) : MyHouseResDto {
213
- return MyHouseResDto (house.id, house.rentalType, house.address.city, house.title, house.imageUrls[0 ], house.dealState.name, house.dealState.value)
262
+
263
+ fun toMyHouseDto (house : House ): MyHouseResDto {
264
+ return MyHouseResDto (
265
+ house.id,
266
+ house.houseType,
267
+ house.rentalType,
268
+ house.address.city,
269
+ house.title,
270
+ house.imageUrls[0 ],
271
+ house.dealState.name,
272
+ house.dealState.value
273
+ )
214
274
}
0 commit comments