-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Repick-official/feature/clothing-sales
feature: 리픽백 신청/수거신청, 박스 수거신청 분리
- Loading branch information
Showing
16 changed files
with
304 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/example/repick/domain/clothingSales/dto/RepickBagCollectDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.example.repick.domain.clothingSales.dto; | ||
|
||
import com.example.repick.domain.clothingSales.entity.ClothingSalesType; | ||
import com.example.repick.global.entity.Address; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.io.Serializable; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public class RepickBagCollectDto implements Serializable { | ||
private ClothingSalesType clothingSalesType; | ||
private Address address; | ||
private Integer bagQuantity; | ||
private String collectionDate; | ||
private MultipartFile file; | ||
private Long repickBagApplyId; | ||
} |
55 changes: 55 additions & 0 deletions
55
src/main/java/com/example/repick/domain/clothingSales/entity/BoxCollect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.example.repick.domain.clothingSales.entity; | ||
|
||
import com.example.repick.domain.clothingSales.dto.PostRequestDto; | ||
import com.example.repick.domain.user.entity.User; | ||
import com.example.repick.global.entity.Address; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class BoxCollect { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "clothing_sales_type") | ||
private ClothingSalesType clothingSalesType; | ||
|
||
@Embedded | ||
private Address address; | ||
|
||
@Column(name = "bag_quantity") | ||
private Integer bagQuantity; | ||
|
||
@Column(name = "image_url") | ||
private String imageUrl; | ||
|
||
@Column(name = "collection_date") | ||
private String collectionDate; | ||
|
||
@OneToMany(mappedBy = "boxCollect", cascade = CascadeType.ALL) | ||
private final List<BoxState> boxStates = new ArrayList<>(); | ||
|
||
public BoxCollect(PostRequestDto postRequestDto, String url) { | ||
this.clothingSalesType = postRequestDto.getClothingSalesType(); | ||
this.address = postRequestDto.getAddress(); | ||
this.bagQuantity = postRequestDto.getBagQuantity(); | ||
this.imageUrl = url; | ||
this.collectionDate = postRequestDto.getCollectionDate(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/com/example/repick/domain/clothingSales/entity/BoxState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.example.repick.domain.clothingSales.entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
public class BoxState { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "box_state_id") | ||
private Long id; // BoxState의 id | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "sales_status") | ||
private SalesStatus salesStatus; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "box_collect_id") | ||
private BoxCollect boxCollect; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/com/example/repick/domain/clothingSales/entity/RepickBagCollect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.example.repick.domain.clothingSales.entity; | ||
|
||
import com.example.repick.domain.clothingSales.dto.PostRequestDto; | ||
import com.example.repick.domain.clothingSales.dto.RepickBagCollectDto; | ||
import com.example.repick.domain.user.entity.User; | ||
import com.example.repick.global.entity.Address; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class RepickBagCollect { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "clothing_sales_type") | ||
private ClothingSalesType clothingSalesType; | ||
|
||
@Embedded | ||
private Address address; | ||
|
||
@Column(name = "bag_quantity") | ||
private Integer bagQuantity; | ||
|
||
@Column(name = "image_url") | ||
private String imageUrl; | ||
|
||
@Column(name = "collection_date") | ||
private String collectionDate; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "repick_bag_apply_id") | ||
private RepickBagApply repickBagApply; | ||
|
||
public RepickBagCollect(RepickBagCollectDto repickBagCollectDto, RepickBagApply repickBagApply) { | ||
this.clothingSalesType = repickBagCollectDto.getClothingSalesType(); | ||
this.address = repickBagCollectDto.getAddress(); | ||
this.bagQuantity = repickBagCollectDto.getBagQuantity(); | ||
this.collectionDate = repickBagCollectDto.getCollectionDate(); | ||
this.repickBagApply = repickBagApply; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/com/example/repick/domain/clothingSales/repository/BoxRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example.repick.domain.clothingSales.repository; | ||
|
||
import com.example.repick.domain.clothingSales.entity.BoxCollect; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface BoxRepository extends JpaRepository<BoxCollect, Long> { | ||
} |
7 changes: 0 additions & 7 deletions
7
...main/java/com/example/repick/domain/clothingSales/repository/ClothingSalesRepository.java
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...n/java/com/example/repick/domain/clothingSales/repository/RepickBagCollectRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example.repick.domain.clothingSales.repository; | ||
|
||
import com.example.repick.domain.clothingSales.entity.RepickBagCollect; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface RepickBagCollectRepository extends JpaRepository<RepickBagCollect, Long> { | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/example/repick/domain/clothingSales/repository/RepickBagRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example.repick.domain.clothingSales.repository; | ||
|
||
import com.example.repick.domain.clothingSales.entity.RepickBagApply; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface RepickBagRepository extends JpaRepository<RepickBagApply, Long> { | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/example/repick/domain/clothingSales/service/BoxService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.example.repick.domain.clothingSales.service; | ||
|
||
import com.example.repick.domain.clothingSales.dto.PostRequestDto; | ||
import com.example.repick.domain.clothingSales.entity.BoxCollect; | ||
import com.example.repick.domain.clothingSales.repository.BoxRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class BoxService { | ||
|
||
private final BoxRepository boxRepository; | ||
|
||
@Autowired | ||
public BoxService(BoxRepository boxRepository) { | ||
this.boxRepository = boxRepository; | ||
} | ||
|
||
//user_id를 3번째 parameter로 save 하고 싶다 | ||
public void save(PostRequestDto postRequestDto, String url, Long userId) { | ||
BoxCollect boxCollect = new BoxCollect(postRequestDto, url); | ||
boxRepository.save(boxCollect); | ||
} | ||
} |
23 changes: 0 additions & 23 deletions
23
src/main/java/com/example/repick/domain/clothingSales/service/ClothingSalesService.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.