-
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.
* feat: 새로운 멤버 생성시 멤버에 포인트 연관 시킨다 * fix: 실수로 이상하게 머지된것 정상적으로 수정 * build: 타임리프 의존성 추가 * feat: 포인트 조회 기능 * feat: 포인트 로그 조회 기능 - 페이징으로 조회 * feat: 포인트 충전 기능 구현 - 관리자 페이지 구현 - 테스트 구현 * feat: 콜백, 안부전화 완료로 인한 시니또 포인트 적립 기능 * feat: 서비스 요청시 포인트 차감 관련 기능과 요청 취소시 차감된거 원복 기능 구현 - 포인트 값 변경을 위한 조회시 비관적 락 걸음 * fix: 머지후 수정사항 * feat: 포인트 적립 완료 상태 변화와 동시에 적립이 되도록하는 기능 추가 * refactor: 포인트 충전 관리자 페이지 path 경로 추가 - css html 분리 * feat: 충전 요청 시 이름+번호4자리를 입금 메시지로 적도록 수정, 충전 실패 상태 추가 * feat: 포인트 출금 요청 - 관리자 페이지 추가 * refactor: 안부전화 삭제 서비스로직 논리적 순서로 개선, 안쓰는 클래스 제거, 예외 처리 추가 * feat: 포인트 로그 전체 조회할 때 최신것부터 소팅하고, 상태도 모두 포함하도록 변경 * refactor: 포인트 충전 관련 메서드명 개선 * test: 포인트 로그 엔티티 테스트 추가 * feat: 출금 할때 수수료 적용 * fix: 치명적 PointLogRepository 오타 수정 * feat: Point 엔티티에 deduct() 메서드내부 로직에 보유한 포인트보다 더 많은 포인트 차감 요청에 대한 예외 추가
- Loading branch information
Showing
32 changed files
with
1,285 additions
and
46 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
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
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
128 changes: 128 additions & 0 deletions
128
src/main/java/com/example/sinitto/point/controller/PointAdminController.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,128 @@ | ||
package com.example.sinitto.point.controller; | ||
|
||
import com.example.sinitto.member.entity.Member; | ||
import com.example.sinitto.member.entity.Sinitto; | ||
import com.example.sinitto.member.exception.MemberNotFoundException; | ||
import com.example.sinitto.member.repository.MemberRepository; | ||
import com.example.sinitto.point.dto.PointLogWithBankInfo; | ||
import com.example.sinitto.point.dto.PointLogWithDepositMessage; | ||
import com.example.sinitto.point.entity.PointLog; | ||
import com.example.sinitto.point.service.PointAdminService; | ||
import com.example.sinitto.sinitto.exception.SinittoNotFoundException; | ||
import com.example.sinitto.sinitto.repository.SinittoRepository; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Controller | ||
public class PointAdminController { | ||
|
||
private final PointAdminService pointAdminService; | ||
private final MemberRepository memberRepository; | ||
private final SinittoRepository sinittoRepository; | ||
|
||
public PointAdminController(PointAdminService pointAdminService, MemberRepository memberRepository, SinittoRepository sinittoRepository) { | ||
this.pointAdminService = pointAdminService; | ||
this.memberRepository = memberRepository; | ||
this.sinittoRepository = sinittoRepository; | ||
} | ||
|
||
@GetMapping("/admin/point/charge") | ||
public String showAllChargeRequest(Model model) { | ||
|
||
List<PointLog> pointLogs = pointAdminService.readAllNotCompletedPointChargeRequest(); | ||
List<PointLogWithDepositMessage> logWithDepositMessages = new ArrayList<>(); | ||
|
||
for (PointLog pointLog : pointLogs) { | ||
Member member = memberRepository.findById(pointLog.getMember().getId()) | ||
.orElseThrow(() -> new MemberNotFoundException("멤버를 찾을 수 없습니다")); | ||
|
||
PointLogWithDepositMessage pointLogWithDepositMessage = new PointLogWithDepositMessage( | ||
pointLog.getId(), | ||
pointLog.getPrice(), | ||
pointLog.getPostTime(), | ||
pointLog.getStatus(), | ||
member.getDepositMessage() | ||
); | ||
|
||
logWithDepositMessages.add(pointLogWithDepositMessage); | ||
} | ||
model.addAttribute("logWithDepositMessages", logWithDepositMessages); | ||
|
||
return "/point/charge"; | ||
} | ||
|
||
@PostMapping("/admin/point/charge/waiting/{pointLogId}") | ||
public String changeToWaiting(@PathVariable Long pointLogId) { | ||
|
||
pointAdminService.changeChargeLogToWaiting(pointLogId); | ||
return "redirect:/admin/point/charge"; | ||
} | ||
|
||
@PostMapping("/admin/point/charge/complete/{pointLogId}") | ||
public String changeToCompleteAndEarn(@PathVariable Long pointLogId) { | ||
|
||
pointAdminService.earnPointAndChangeToChargeComplete(pointLogId); | ||
return "redirect:/admin/point/charge"; | ||
} | ||
|
||
@PostMapping("/admin/point/charge/fail/{pointLogId}") | ||
public String changeToFail(@PathVariable Long pointLogId) { | ||
|
||
pointAdminService.changeChargeLogToFail(pointLogId); | ||
return "redirect:/admin/point/charge"; | ||
} | ||
|
||
@GetMapping("/admin/point/withdraw") | ||
public String showAllWithdrawRequest(Model model) { | ||
|
||
List<PointLog> pointLogs = pointAdminService.readAllPointWithdrawRequest(); | ||
List<PointLogWithBankInfo> logWithBankInfos = new ArrayList<>(); | ||
|
||
for (PointLog pointLog : pointLogs) { | ||
Sinitto sinitto = sinittoRepository.findByMemberId(pointLog.getMember().getId()) | ||
.orElseThrow(() -> new SinittoNotFoundException("시니또를 찾을 수 없습니다")); | ||
|
||
PointLogWithBankInfo pointLogWithBankInfo = new PointLogWithBankInfo( | ||
pointLog.getId(), | ||
pointLog.getPrice(), | ||
pointLog.getPostTime(), | ||
pointLog.getStatus(), | ||
sinitto.getBankName(), | ||
sinitto.getAccountNumber() | ||
); | ||
|
||
logWithBankInfos.add(pointLogWithBankInfo); | ||
} | ||
model.addAttribute("logWithBankInfos", logWithBankInfos); | ||
|
||
return "/point/withdraw"; | ||
} | ||
|
||
@PostMapping("/admin/point/withdraw/waiting/{pointLogId}") | ||
public String changeWithdrawLogToWaiting(@PathVariable Long pointLogId) { | ||
|
||
pointAdminService.changeWithdrawLogToWaiting(pointLogId); | ||
return "redirect:/admin/point/withdraw"; | ||
} | ||
|
||
@PostMapping("/admin/point/withdraw/complete/{pointLogId}") | ||
public String changeWithdrawLogToCompleteAndEarn(@PathVariable Long pointLogId) { | ||
|
||
pointAdminService.changeWithdrawLogToComplete(pointLogId); | ||
return "redirect:/admin/point/withdraw"; | ||
} | ||
|
||
@PostMapping("/admin/point/withdraw/fail/{pointLogId}") | ||
public String changeWithdrawLogToFail(@PathVariable Long pointLogId) { | ||
|
||
pointAdminService.changeWithdrawLogToFail(pointLogId); | ||
return "redirect:/admin/point/withdraw"; | ||
} | ||
|
||
} |
Oops, something went wrong.