Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static class StoreMapResponseDTO {
private Integer people;
private Long cost;
private String category;
private String note;
private Long discountRate;
private boolean hasPartner;
private Double latitude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ else if (content.getOptionType() == OptionType.SERVICE) {
.adminName(admin != null ? admin.getName() : null)
.adminId(adminId)
.name(s.getName())
.note(content.getNote())
.address(s.getAddress() != null ? s.getAddress() : s.getDetailAddress())
.rate(s.getRate())
.criterionType(content != null ? content.getCriterionType() : null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static List<PaperContent> toPaperContents(
}
return partnershipRequestDTO.getOptions().stream()
.map(optionDto -> PaperContent.builder()
.note(optionDto.getNote()) // 일단 노트까지 받아서 변환
.paper(paper) // 어떤 Paper에 속하는지 연결
.optionType(optionDto.getOptionType())
.criterionType(optionDto.getCriterionType())
Expand Down Expand Up @@ -102,7 +103,14 @@ public static List<PaperContentResponseDTO.storePaperContentResponse> toContentR
public static PaperContentResponseDTO.storePaperContentResponse toContentResponse(PaperContent content) {
List<String> goodsList = extractGoods(content);
Integer peopleValue = extractPeople(content);
String paperContentText = buildPaperContentText(content, goodsList, peopleValue);

String paperContentText;
if(content.getNote()!= null){
paperContentText = content.getNote();
}else{
paperContentText = buildPaperContentText(content, goodsList, peopleValue);
}


return PaperContentResponseDTO.storePaperContentResponse.builder()
.adminId(content.getPaper().getAdmin().getId())
Expand Down Expand Up @@ -204,6 +212,7 @@ public static List<PaperContent> toPaperContentsForManual(
.paper(paper)
.optionType(o.getOptionType())
.criterionType(o.getCriterionType())
.note(o.getNote())
.people(o.getPeople())
.cost(o.getCost())
.category(o.getCategory())
Expand Down Expand Up @@ -238,13 +247,19 @@ public static PartnershipResponseDTO.WritePartnershipResponseDTO writePartnershi
if (contents != null) {
for (int i = 0; i < contents.size(); i++) {
PaperContent pc = contents.get(i);

String note = null;
if(pc.getNote()!= null){
note = pc.getNote();
}
List<Goods> goods = (goodsBatches != null && goodsBatches.size() > i)
? goodsBatches.get(i) : List.of();
optionDTOS.add(
PartnershipResponseDTO.PartnershipOptionResponseDTO.builder()
.optionType(pc.getOptionType())
.criterionType(pc.getCriterionType())
.people(pc.getPeople())
.note(note)
.cost(pc.getCost())
.category(pc.getCategory())
.discountRate(pc.getDiscount())
Expand All @@ -253,6 +268,8 @@ public static PartnershipResponseDTO.WritePartnershipResponseDTO writePartnershi
);
}
}


return PartnershipResponseDTO.WritePartnershipResponseDTO.builder()
.partnershipId(paper.getId())
.partnershipPeriodStart(paper.getPartnershipPeriodStart())
Expand Down Expand Up @@ -319,6 +336,10 @@ public static PartnershipResponseDTO.GetPartnershipDetailResponseDTO getPartners
if (contents != null) {
for (int i = 0; i < contents.size(); i++) {
PaperContent pc = contents.get(i);
String note = null;
if(pc.getNote()!= null){
note = pc.getNote();
}
List<Goods> goods = (goodsBatches != null && goodsBatches.size() > i)
? goodsBatches.get(i) : List.of();
optionDTOS.add(
Expand All @@ -327,6 +348,7 @@ public static PartnershipResponseDTO.GetPartnershipDetailResponseDTO getPartners
.criterionType(pc.getCriterionType())
.people(pc.getPeople())
.cost(pc.getCost())
.note(note)
.category(pc.getCategory())
.discountRate(pc.getDiscount())
.goods(goodsResultDTO(goods))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static class PartnershipOptionRequestDTO {
private Long cost;
private String category;
private Long discountRate;
private String note;
private List<PartnershipGoodsRequestDTO> goods; // 서비스 제공 항목

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static class PartnershipOptionResponseDTO {
private CriterionType criterionType;
private Integer people;
private Long cost;
private String note;
private String category;
private Long discountRate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class PaperContent extends BaseEntity {
@Enumerated(EnumType.STRING)
private OptionType optionType;

private String note;

private Integer people;

private Long cost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ public PaperResponseDTO.partnershipContent getStorePaperContent(Long storeId, Me
student.getDepartment(),
student.getMajor());

// // 한번 더 거르기 위해서
// List<Admin> filteredAdmin = adminList.stream()
// .filter(admin -> {
// String name = admin.getName();
// Major major = admin.getMajor();
// return name.contains(student.getUniversity())
// || name.contains(student.getDepartment())
// || major.equals(student.getMajor());
// }).toList();


// 추출한 admin, store와 일치하는 paperId 를 추출합니다.
List<Paper> paperList = adminList.stream()
.flatMap(admin ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,48 +101,7 @@ public void recordPartnershipUsage(PartnershipRequestDTO.finalRequest dto, Membe

// @Transactional 환경에서는 studentsToUpdate의 변경 사항(스탬프)이 자동으로 DB에 반영됩니다.
}
// public void recordPartnershipUsage(PartnershipRequestDTO.finalRequest dto, Member member){
//
// Student requestStudent = studentRepository.findById(member.getId()).orElseThrow(
// () -> new GeneralException(ErrorStatus.NO_SUCH_STUDENT) // 혹은 적절한 예외 처리
// );
//
// List<PartnershipUsage> usages = new ArrayList<>();
//
// PaperContent content = contentRepository.findById(dto.getContentId()).orElseThrow(
// () -> new GeneralException(ErrorStatus.NO_SUCH_CONTENT)
// );
// Long paperId = content.getPaper().getId();
// // 1) 요청한 member 본인
// usages.add(PartnershipConverter.toPartnershipUsage(dto, requestStudent, paperId));
// requestStudent.setStamp();
// System.out.println("update 된 stamp : "+requestStudent.getStamp());
//
// List<Long> userIds = Optional.ofNullable(dto.getUserIds()).orElse(Collections.emptyList());
// // 2) dto의 userIds에 있는 다른 사용자들
// for (Long userId : userIds) {
// if(userId != member.getId()){
// Student student = studentRepository.getReferenceById(userId);
// usages.add(PartnershipConverter.toPartnershipUsage(dto, student, paperId));
// student.setStamp();
// }
//
// }
// partnershipUsageRepository.saveAll(usages);
//
// // Store store = storeRepository.findById(dto.getStoreId()).orElseThrow(
// // () -> new GeneralException(ErrorStatus.NO_SUCH_STORE)
// // );
// // Partner partner = store.getPartner();
// // if (partner != null) {
// // Long partnerId = partner.getId();
// // System.out.println("알림 요청이 들어갑니다.");
// // notificationService.sendOrder(partnerId, 0L, dto.getTableNumber(), dto.getPartnershipContent());
// //
// // } else {
// // throw new GeneralException(ErrorStatus.NO_SUCH_PARTNER);
// // }
// }




Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public static class UsablePartnershipDTO {
private OptionType optionType;
private Integer people;
private Long cost;
private String note;
private String category;
private Long discountRate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ public List<StudentResponseDTO.UsablePartnershipDTO> getUsablePartnership(Long m

// 카테고리 결정 로직 그대로
String finalCategory = null;
String note = null;
if (content != null) {
if(content.getNote() != null){
note = content.getNote();
}
if (content.getCategory() != null) {
finalCategory = content.getCategory();
} else if (content.getOptionType() == OptionType.SERVICE) {
Expand All @@ -159,6 +163,7 @@ public List<StudentResponseDTO.UsablePartnershipDTO> getUsablePartnership(Long m
.partnershipId(paper.getId())
.adminName(adminName)
.partnerName(partnerName)
.note(note)
.criterionType(content != null ? content.getCriterionType() : null)
.optionType(content != null ? content.getOptionType() : null)
.people(content != null ? content.getPeople() : null)
Expand Down