新增提现银行管理
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.accompany.admin.vo.withdraw;
|
||||
|
||||
import com.accompany.business.constant.withdraw.WithdrawAccountConstant;
|
||||
import com.accompany.business.constant.withdraw.WithdrawAccountTypeConstant;
|
||||
import com.accompany.business.model.withdraw.WithdrawUser;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
@@ -67,7 +67,7 @@ public class WithdrawUserAdminVo extends WithdrawUser {
|
||||
if (accountFlag == null) {
|
||||
accountFlag = 0;
|
||||
}
|
||||
if ((accountFlag & WithdrawAccountConstant.CHINA_UNION_PAY) != 0) {
|
||||
if ((accountFlag & WithdrawAccountTypeConstant.CHINA_UNION_PAY) != 0) {
|
||||
isChinaUnionPay = Constant.Yes1No0.YES;
|
||||
} else {
|
||||
isChinaUnionPay = Constant.Yes1No0.NO;
|
||||
@@ -80,7 +80,7 @@ public class WithdrawUserAdminVo extends WithdrawUser {
|
||||
if (accountFlag == null) {
|
||||
accountFlag = 0;
|
||||
}
|
||||
if ((accountFlag & WithdrawAccountConstant.MAY_BANK) != 0) {
|
||||
if ((accountFlag & WithdrawAccountTypeConstant.MAY_BANK) != 0) {
|
||||
isMayBank = Constant.Yes1No0.YES;
|
||||
} else {
|
||||
isMayBank = Constant.Yes1No0.NO;
|
||||
@@ -93,7 +93,7 @@ public class WithdrawUserAdminVo extends WithdrawUser {
|
||||
if (accountFlag == null) {
|
||||
accountFlag = 0;
|
||||
}
|
||||
if ((accountFlag & WithdrawAccountConstant.BANK_OF_SINGAPORE) != 0) {
|
||||
if ((accountFlag & WithdrawAccountTypeConstant.BANK_OF_SINGAPORE) != 0) {
|
||||
isBankOfSingapore = Constant.Yes1No0.YES;
|
||||
} else {
|
||||
isBankOfSingapore = Constant.Yes1No0.NO;
|
||||
@@ -106,7 +106,7 @@ public class WithdrawUserAdminVo extends WithdrawUser {
|
||||
if (accountFlag == null) {
|
||||
accountFlag = 0;
|
||||
}
|
||||
if ((accountFlag & WithdrawAccountConstant.ORDER_ACCOUNT) != 0) {
|
||||
if ((accountFlag & WithdrawAccountTypeConstant.ORDER_ACCOUNT) != 0) {
|
||||
isOrderAccount = Constant.Yes1No0.YES;
|
||||
} else {
|
||||
isOrderAccount = Constant.Yes1No0.NO;
|
||||
|
@@ -5,7 +5,7 @@ package com.accompany.business.constant.withdraw;
|
||||
* @date: 2023/7/7 15:38
|
||||
* @description:
|
||||
*/
|
||||
public interface WithdrawAccountConstant {
|
||||
public interface WithdrawAccountTypeConstant {
|
||||
|
||||
int ORDER_ACCOUNT = 0b1;
|
||||
|
@@ -0,0 +1,36 @@
|
||||
package com.accompany.business.enums.withdraw;
|
||||
|
||||
import com.accompany.business.constant.withdraw.WithdrawAccountTypeConstant;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2023/7/11 12:08
|
||||
* @description:
|
||||
*/
|
||||
public enum WithdrawAccountEnum {
|
||||
|
||||
CHINA_UNION_PAY("中国大陆银联", WithdrawAccountTypeConstant.CHINA_UNION_PAY),
|
||||
|
||||
MAY_BANK("马来西亚银行", WithdrawAccountTypeConstant.MAY_BANK),
|
||||
|
||||
BANK_OF_SINGAPORE("新加坡银行", WithdrawAccountTypeConstant.BANK_OF_SINGAPORE),
|
||||
|
||||
OTHER("其它账户", WithdrawAccountTypeConstant.ORDER_ACCOUNT);
|
||||
|
||||
private final String name;
|
||||
|
||||
private final Integer value;
|
||||
|
||||
WithdrawAccountEnum(String name, Integer value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
@@ -1,12 +1,23 @@
|
||||
package com.accompany.business.service.withdraw;
|
||||
|
||||
import com.accompany.business.model.withdraw.WithdrawAccountDtl;
|
||||
import com.accompany.business.vo.withdraw.WithdrawAccountDtlVo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2023/7/7 11:17
|
||||
* @description:
|
||||
*/
|
||||
public interface WithdrawAccountDtlService extends IService<WithdrawAccountDtl> {
|
||||
|
||||
/**
|
||||
* 账户列表
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
List<WithdrawAccountDtlVo> getAccounts(Long uid);
|
||||
}
|
||||
|
@@ -9,4 +9,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* @description:
|
||||
*/
|
||||
public interface WithdrawUserAccountService extends IService<WithdrawUserAccount> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param account
|
||||
*/
|
||||
void saveAccount(WithdrawUserAccount account);
|
||||
}
|
||||
|
@@ -1,12 +1,27 @@
|
||||
package com.accompany.business.service.withdraw.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.accompany.business.enums.withdraw.WithdrawAccountEnum;
|
||||
import com.accompany.business.model.withdraw.WithdrawAccountDtl;
|
||||
import com.accompany.business.model.withdraw.WithdrawUserAccount;
|
||||
import com.accompany.business.mybatismapper.withdraw.WithdrawAccountDtlMapper;
|
||||
import com.accompany.business.service.withdraw.WithdrawAccountDtlService;
|
||||
import com.accompany.business.service.withdraw.WithdrawUserAccountService;
|
||||
import com.accompany.business.vo.withdraw.WithdrawAccountDtlVo;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2023/7/7 11:20
|
||||
@@ -15,4 +30,28 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WithdrawAccountDtlServiceImpl extends ServiceImpl<WithdrawAccountDtlMapper, WithdrawAccountDtl> implements WithdrawAccountDtlService {
|
||||
|
||||
@Autowired
|
||||
private WithdrawUserAccountService withdrawUserAccountService;
|
||||
|
||||
@Override
|
||||
public List<WithdrawAccountDtlVo> getAccounts(Long uid) {
|
||||
List<WithdrawUserAccount> userAccounts = withdrawUserAccountService.list(Wrappers.<WithdrawUserAccount>lambdaQuery()
|
||||
.eq(WithdrawUserAccount::getUid, uid)
|
||||
.in(WithdrawUserAccount::getAccountType, Arrays.stream(WithdrawAccountEnum.values()).map(WithdrawAccountEnum::getValue).collect(Collectors.toList())));
|
||||
Map<Integer, WithdrawUserAccount> accountMap = null;
|
||||
if (CollectionUtil.isNotEmpty(userAccounts)) {
|
||||
accountMap = userAccounts.stream().collect(Collectors.toMap(WithdrawUserAccount::getAccountType, Function.identity(), (v1, v2) -> v1));
|
||||
}
|
||||
List<WithdrawAccountDtlVo> accounts = new ArrayList<>();
|
||||
for (WithdrawAccountEnum withdrawAccount : WithdrawAccountEnum.values()) {
|
||||
Integer accountType = withdrawAccount.getValue();
|
||||
WithdrawAccountDtlVo account = new WithdrawAccountDtlVo();
|
||||
account.setAccountName(withdrawAccount.getName());
|
||||
account.setAccountType(withdrawAccount.getValue());
|
||||
account.setIsBind(accountMap != null && accountMap.containsKey(accountType) ? Constant.Yes1No0.YES : Constant.Yes1No0.NO);
|
||||
accounts.add(account);
|
||||
}
|
||||
return accounts;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.accompany.business.service.withdraw.impl;
|
||||
|
||||
import com.accompany.business.constant.withdraw.WithdrawAccountTypeConstant;
|
||||
import com.accompany.business.model.withdraw.WithdrawUserAccount;
|
||||
import com.accompany.business.mybatismapper.withdraw.WithdrawUserAccountMapper;
|
||||
import com.accompany.business.service.withdraw.WithdrawUserAccountService;
|
||||
@@ -7,6 +8,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2023/7/7 14:55
|
||||
@@ -15,4 +18,14 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WithdrawUserAccountServiceImpl extends ServiceImpl<WithdrawUserAccountMapper, WithdrawUserAccount> implements WithdrawUserAccountService {
|
||||
|
||||
@Override
|
||||
public void saveAccount(WithdrawUserAccount account) {
|
||||
Date now = new Date();
|
||||
Long id = account.getId();
|
||||
if (id != null) {
|
||||
account.setUpdateTime(now);
|
||||
}
|
||||
saveOrUpdate(account);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,34 @@
|
||||
package com.accompany.business.vo.withdraw;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2023/7/11 12:01
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class WithdrawAccountDtlVo {
|
||||
|
||||
/**
|
||||
* 账户名称
|
||||
*/
|
||||
@ApiModelProperty("账户名称")
|
||||
private String accountName;
|
||||
|
||||
/**
|
||||
* 账户类型 1 其它账户 2 中国大陆银联 4 马来西亚银行 8 新加坡银行
|
||||
*/
|
||||
@ApiModelProperty("账户类型 1 其它账户 2 中国大陆银联 4 马来西亚银行 8 新加坡银行")
|
||||
private Integer accountType;
|
||||
|
||||
/**
|
||||
* 是否绑定 0 否 1 是
|
||||
*/
|
||||
@ApiModelProperty("是否绑定 0 否 1 是")
|
||||
private Integer isBind = 0;
|
||||
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
package com.accompany.business.controller.withdraw;
|
||||
|
||||
import com.accompany.business.service.withdraw.WithdrawAccountDtlService;
|
||||
import com.accompany.business.vo.withdraw.WithdrawAccountDtlVo;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2023/7/11 11:57
|
||||
* @description:
|
||||
*/
|
||||
@Api(tags = "提现账户管理")
|
||||
@RestController
|
||||
@RequestMapping(value = "/withdrawAccountDtl")
|
||||
public class WithdrawAccountDtlController {
|
||||
|
||||
@Autowired
|
||||
private WithdrawAccountDtlService withdrawAccountDtlService;
|
||||
|
||||
/**
|
||||
* 账户列表
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("账户列表")
|
||||
@ApiImplicitParam(name = "uid", value = "用户ID")
|
||||
@GetMapping("getAccounts")
|
||||
public BusiResult<List<WithdrawAccountDtlVo>> getAccounts(@RequestParam(value = "uid", required = false) Long uid) {
|
||||
return BusiResult.success(withdrawAccountDtlService.getAccounts(uid));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package com.accompany.business.controller.withdraw;
|
||||
|
||||
import com.accompany.business.model.withdraw.WithdrawUserAccount;
|
||||
import com.accompany.business.service.withdraw.WithdrawUserAccountService;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author: liaozetao
|
||||
* @date: 2023/7/11 14:07
|
||||
* @description:
|
||||
*/
|
||||
@Api(tags = "提现银行管理")
|
||||
@RestController
|
||||
@RequestMapping(value = "/withdrawUserAccount")
|
||||
public class WithdrawUserAccountController {
|
||||
|
||||
@Autowired
|
||||
private WithdrawUserAccountService withdrawUserAccountService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param account
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("保存")
|
||||
@PostMapping("save")
|
||||
public BusiResult<Void> save(@RequestBody WithdrawUserAccount account) {
|
||||
|
||||
return BusiResult.success();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user