wangqifan 3 years ago
parent
commit
5a5804380d

+ 2 - 0
src/main/java/com/izouma/zhumj/repo/UserMoneyWithdrawApplyRepo.java

@@ -15,5 +15,7 @@ import java.util.List;
 public interface UserMoneyWithdrawApplyRepo extends JpaRepository<UserMoneyWithdrawApply, Long>, JpaSpecificationExecutor<UserMoneyWithdrawApply> {
     List<UserMoneyWithdrawApply> findAllByStatus(WithdrawApplyStatus status);
 
+    List<UserMoneyWithdrawApply> findAllByUserIdAndStatus(Long userId, WithdrawApplyStatus status);
+
     Page<UserMoneyWithdrawApply> findAllByUserIdAndCreatedAtBetweenOrderByCreatedAtDesc(Long userId, LocalDateTime start, LocalDateTime end, Pageable pageable);
 }

+ 1 - 1
src/main/java/com/izouma/zhumj/service/FinancialService.java

@@ -656,7 +656,7 @@ public class FinancialService {
 
     public List<FinanceApply> showFinanceApply() {
         List<FinanceApply> resultList = new ArrayList<>();
-        userMoneyWithdrawApplyRepo.findAllByStatus(WithdrawApplyStatus.OFFLINEAPPLY).forEach(apply -> {
+        userMoneyWithdrawApplyRepo.findAllByStatus(WithdrawApplyStatus.APPLY).forEach(apply -> {
             FinanceApply financeApply = new FinanceApply();
             CheckinInfo checkinInfo = checkinInfoRepo.findById(apply.getCheckinId())
                     .orElseThrow(new BusinessException("暂无入住信息"));

+ 5 - 0
src/main/java/com/izouma/zhumj/service/UserMoneyWithdrawApplyService.java

@@ -238,6 +238,11 @@ public class UserMoneyWithdrawApplyService {
         if (SecurityUtils.getAuthenticatedUser().isTemporal()) {
             throw new BusinessException("扫码进入无法提现");
         }
+        List<UserMoneyWithdrawApply> userMoneyWithdrawApplies = userMoneyWithdrawApplyRepo
+                .findAllByUserIdAndStatus(userId, WithdrawApplyStatus.APPLY);
+        if (userMoneyWithdrawApplies.size() > 0) {
+            throw new BusinessException("已经有提现申请,请勿重复提现");
+        }
         UserMoneyWithdrawApply apply = apply(userId, method, account, name);
         if (!apply.getMethod().equals(WithdrawMethod.OFFLINE)) {
             try {