feat:审批判断

This commit is contained in:
dzc committed 2025-01-12 21:03:34 +08:00
1 parent 01b0623913
commit d9e8663468
2 files changed
+24

No files matched your search

@@ -16,6 +16,7 @@ import com.bsd.pjcloud.admin.api.utils.DataUtil;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.flow.task.constant.NodeStatusEnum;
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
import com.bsd.pjcloud.wallet.api.dto.WalletFreezeDto;
@@ -86,6 +87,8 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
// 查询发起人
UserInfo userData = userService.getByUserId(dto.getUserId()).getData();
if (ObjectUtil.isEmpty(userData)) throw new RuntimeException("发起人不存在");
// 判断之前有没有在审核的
if (isCheckData(dto.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
// 查询钱包
WalletManageEntity wallet = walletManageService.getWallet(dto.getUserId(), dto.getWalletTypeId());
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("用户钱包不存在");
@@ -133,4 +136,13 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
log.error("|{}|审批回调意外的错误,dto:|{}|error:|{}|", TAG, JSON.toJSONString(dto), e.getMessage());
}
}
private boolean isCheckData(Long walletId) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletFreezeEntity>()
.eq(WalletFreezeEntity::getUserId, walletId)
.eq(WalletFreezeEntity::getProcessStatus, NodeStatusEnum.JXZ.getCode())
);
return count > 0;
}
}
@@ -22,12 +22,14 @@ import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.excel.vo.ErrorMessage;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import com.bsd.pjcloud.flow.task.constant.NodeStatusEnum;
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
import com.bsd.pjcloud.wallet.api.constant.WalletBizRechargeEnum;
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
import com.bsd.pjcloud.wallet.api.dto.excel.WalletRechargeExcelDto;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
@@ -108,6 +110,8 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
// 查询详情
WalletRechargeApplyEntity detail = baseMapper.selectById(id);
if (ObjectUtil.isEmpty(detail)) throw new CheckedException("充值申请不存在");
// 判断之前有没有在审核的
if (isCheckData(detail.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
// 查询用户
UserInfo user = userService.getByUserId(detail.getUserId()).getData();
if (ObjectUtil.isEmpty(user)) throw new CheckedException("发起人不存在");
@@ -240,4 +244,12 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
log.error("|{}|审批回调意外的错误,dto:|{}|error:|{}|", TAG, JSON.toJSONString(dto), e.getMessage());
}
}
private boolean isCheckData(Long walletId) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletRechargeApplyEntity>()
.eq(WalletRechargeApplyEntity::getUserId, walletId)
.eq(WalletRechargeApplyEntity::getProcessStatus, NodeStatusEnum.JXZ.getCode())
);
return count > 0;
}
}