feat:充值/扣款申请自动创建钱包

This commit is contained in:
dzc committed 2025-01-23 16:02:54 +08:00
1 parent c9d8c1d52b
commit 9d2cf0f5d2
2 files changed
+12 -1

No files matched your search

@@ -21,6 +21,11 @@ public enum WalletTypeEnum {
private final String desc;
public static WalletTypeEnum valueOfByCode(String code) {
if (ObjectUtil.isEmpty(code)) return null;
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(code, v.getCode())).findFirst().get();
}
public static WalletTypeEnum descOf(String description) {
return Arrays.stream(WalletTypeEnum.values())
.filter(v -> ObjectUtil.equal(v.getDesc(), description))
@@ -28,6 +28,7 @@ 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.constant.WalletTypeEnum;
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeImportDto;
@@ -347,6 +348,11 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
if (ObjectUtil.isNotEmpty(detail.getProcessStatus()) || ObjectUtil.equals(detail.getProcessStatus(), TaskCheckStatusEnum.PADDING.getCode())) {
return;
}
WalletTypeEntity walletType = walletTypeService.getById(detail.getWalletTypeId());
WalletTypeEnum walletTypeEnum = WalletTypeEnum.valueOfByCode(walletType.getUniqueCode());
if (ObjectUtil.isEmpty(walletType) || ObjectUtil.isEmpty(walletTypeEnum)) {
return;
}
String importTimeStr = LocalDateTimeUtil.format(detail.getImportTime(), DatePattern.NORM_MONTH_PATTERN);
List<WalletRechargeImportEntity> importList = rechargeImportService.list(new LambdaQueryWrapper<WalletRechargeImportEntity>()
.eq(WalletRechargeImportEntity::getApplyId, detail.getId())
@@ -356,7 +362,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
for (WalletRechargeImportEntity v : importList) {
WalletRechargeImportEntity item = new WalletRechargeImportEntity();
item.setId(v.getId());
WalletManageEntity wallet = walletManageService.getWallet(v.getUserId(), detail.getWalletTypeId());
WalletManageEntity wallet = walletManageService.getOrCreateWallet(v.getUserId(), walletTypeEnum);
if (ObjectUtil.isEmpty(wallet)) continue;
Integer price = walletTransactionMapper.getTransactionPriceCount(importTimeStr, wallet.getId(), WalletBizEnum.BATCH.getCode());
if (ObjectUtil.isNotEmpty(price)) {