11package  com.example.jhouse_server.domain.house.dto 
22
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.* 
74import  com.example.jhouse_server.domain.user.entity.UserType 
85import  org.hibernate.validator.constraints.Length 
96import  java.io.Serializable 
@@ -18,6 +15,7 @@ import javax.validation.constraints.Pattern
1815 * ================================================================================================ 
1916 * */  
2017data class  HouseReqDto (
18+     var  houseType :  HouseType ,
2119    var  rentalType :  RentalType ?  = null ,
2220    var  city :  String? ,
2321    var  detail :  String? ,
@@ -29,11 +27,11 @@ data class HouseReqDto(
2927    var  createdDate :  String? ,
3028    var  price :  Int ,
3129    var  monthlyPrice :  Double ,
32-     var  agentName   :  String? , //  공인중개사인 경우
30+     var  agentName :  String? , //  공인중개사인 경우
3331    var  title :  String? , //  게시글 제목
3432    var  code :  String? , //  게시글 내용
3533    var  imageUrls :  List <String >? , //  이미지 주소
36-     val  tmpYn   :  Boolean , //  임시저장 false -> save , true -> tmpSave
34+     val  tmpYn :  Boolean , //  임시저장 false -> save , true -> tmpSave
3735    var  recommendedTag :  List <String >?  //  추천 태그
3836)
3937
@@ -43,12 +41,13 @@ data class HouseReqDto(
4341 * ================================================================================================ 
4442 * */  
4543data class  HouseListDto (
44+     var  houseType :  String? , //  빈집 매물 타입
4645    val  rentalType :  String? , //  빈집 매물 유형
4746    val  city :  String? , //  매물 위치
4847    val  recommendedTag :  List <RecommendedTag >? , //  추천 태그
4948    val  search :  String? , //  검색어 ( 제목과 닉네임 )
5049    val  dealState :  String?  // 
51- ): Serializable
50+ )  : Serializable
5251
5352/* *
5453 * ================================================================================================ 
@@ -58,15 +57,18 @@ data class HouseListDto(
5857data class  HouseAgentListDto (
5958    val  search :  String? ,
6059    val  dealState :  String? ,
61-     val  isCompleted :  Boolean?  // 거래 기능 개발 후 판매상태 조건 추가
60+     val  isCompleted :  Boolean? , // 거래 기능 개발 후 판매상태 조건 추가
61+     val  houseType :  String? ,
6262)
63+ 
6364/* *
6465 * ================================================================================================ 
6566 * 마이페이지) 빈집 매물 게시글 목록 조회 DTO -- 일반 사용자 
6667 * ================================================================================================ 
6768 * */  
6869data class  MyHouseResDto (
6970    val  houseId :  Long ,
71+     var  houseType :  HouseType ,
7072    val  rentalType :  RentalType ,
7173    val  city :  String ,
7274    val  title :  String ,
@@ -82,23 +84,26 @@ data class MyHouseResDto(
8284 * */  
8385class  HouseResDto () : Serializable {
8486    var  houseId:  Long  =  0  //  게시글 아이디
87+     lateinit  var  houseType:  HouseType  //  매물 타입
8588    lateinit  var  rentalType:  RentalType  //  매물 유형
86-     lateinit    var  city:  String  //  매물 위치
89+     lateinit  var  city:  String  //  매물 위치
8790    var  price:  Int?  =  0  //  매물 가격 ( 월세의 경우, 보증금 )
8891    var  monthlyPrice:  Double?  =  0.0  //  매물 월세
8992    lateinit  var  nickName:  String  //  매물 작성자 닉네임
9093    lateinit  var  createdAt:  Date  //  게시글 작성일자 ( yyyy-MM-dd ) -> 클라이언트 측에서 파싱
9194    var  isCompleted:  Boolean  =  false  //  매물 거래 여부
92-     var  imageUrl  :  String?  =  null  //  썸네일
95+     var  imageUrl:  String?  =  null  //  썸네일
9396    lateinit  var  title:  String  //  게시글 제목
9497    lateinit  var  recommendedTag:  List <RecommendedTag > //  추천 태그
9598    lateinit  var  recommendedTagName:  List <String > //  추천 태그명
99+ 
96100    constructor (
97-         houseId :  Long ,
98-         rentalType :  RentalType ,
101+         houseId:  Long ,
102+         houseType:  HouseType ,
103+         rentalType:  RentalType ,
99104        city:  String ,
100105        price:  Int ,
101-         monthlyPrice  :  Double ,
106+         monthlyPrice:  Double ,
102107        nickName:  String ,
103108        createdAt:  Date ,
104109        isCompleted:  Boolean ,
@@ -108,6 +113,7 @@ class HouseResDto() : Serializable {
108113        recommendedTagName:  List <String >
109114    ) :  this () {
110115        this .houseId =  houseId
116+         this .houseType =  houseType
111117        this .rentalType =  rentalType
112118        this .city =  city
113119        this .price =  price
@@ -120,37 +126,38 @@ class HouseResDto() : Serializable {
120126        this .recommendedTag =  recommendedTag
121127        this .recommendedTagName =  recommendedTagName
122128    }
123-   }
129+ }
124130
125131/* *
126132 * ================================================================================================ 
127133 * 빈집 매물 게시글 단일 조회 시, 응답 DTO 
128134 * ================================================================================================ 
129135 * */  
130136data 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 >, //  게시글 추천 태그명
154161)
155162
156163/* *
@@ -172,14 +179,17 @@ data class ReportReqDto(
172179 * */  
173180data class  DealReqDto (
174181    @field:NotNull(message = "만족도 점수는 필수값입니다.")
175-     val  score   :  Int ,
176-     val  review   :  String? ,
182+     val  score :  Int ,
183+     val  review :  String? ,
177184    val  nickName :  String? ,
178-     val  age   :  String? ,
185+     val  age :  String? ,
179186    @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 ,
183193)
184194
185195/* *
@@ -188,27 +198,77 @@ data class DealReqDto(
188198 * ================================================================================================ 
189199 * */  
190200
191- fun  getTagByNameFromHouseTags (houseTag :  List <RecommendedTag >)  : List <RecommendedTag > {
201+ fun  getTagByNameFromHouseTags (houseTag :  List <RecommendedTag >): List <RecommendedTag > {
192202    return  houseTag.stream().map { RecommendedTag .getTagByName(it.name) }.toList()
193203}
194204
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+     )
202227}
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+     )
211261}
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+     )
214274}
0 commit comments