| | |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.yami.trading.api.util.ServletUtil; |
| | | import com.yami.trading.bean.item.domain.Item; |
| | | import com.yami.trading.bean.model.User; |
| | | import com.yami.trading.bean.model.Withdraw; |
| | | import com.yami.trading.common.constants.Constants; |
| | |
| | | */ |
| | | @GetMapping("fee") |
| | | @ApiOperation("提现手续费") |
| | | public Result fee(String channel, String amount) { |
| | | public Result fee(String channel, String amount, String type) { |
| | | String error = this.verif(amount); |
| | | if (!StringUtils.isNullOrEmpty(error)) { |
| | | throw new YamiShopBindException(error); |
| | |
| | | // 手续费(USDT) |
| | | // 提现手续费类型,fixed是单笔固定金额,rate是百分比,part是分段 |
| | | String withdraw_fee_type = this.sysparaService.find("withdraw_fee_type").getSvalue(); |
| | | // fixed单笔固定金额 和 rate百分比 的手续费数值 |
| | | double withdraw_fee = Double.valueOf(this.sysparaService.find("withdraw_fee").getSvalue()); |
| | | if ("fixed".equals(withdraw_fee_type)) { |
| | | fee = withdraw_fee; |
| | | } |
| | | if ("rate".equals(withdraw_fee_type)) { |
| | | withdraw_fee = Arith.div(withdraw_fee, 100); |
| | | fee = Arith.mul(amount_double, withdraw_fee); |
| | | } |
| | | if ("part".equals(withdraw_fee_type)) { |
| | | // 提现手续费part分段的值 |
| | | String withdraw_fee_part = this.sysparaService.find("withdraw_fee_part").getSvalue(); |
| | | String[] withdraw_fee_parts = withdraw_fee_part.split(","); |
| | | for (int i = 0; i < withdraw_fee_parts.length; i++) { |
| | | double part_amount = Double.valueOf(withdraw_fee_parts[i]); |
| | | double part_fee = Double.valueOf(withdraw_fee_parts[i + 1]); |
| | | if (amount_double <= part_amount) { |
| | | fee = part_fee; |
| | | break; |
| | | map.put("withdraw_fee_type", withdraw_fee_type); |
| | | if (type!=null && type.equalsIgnoreCase(Item.cryptos)) { |
| | | fee = 0; |
| | | } else { |
| | | // fixed单笔固定金额 和 rate百分比 的手续费数值 |
| | | double withdraw_fee = Double.valueOf(this.sysparaService.find("withdraw_fee").getSvalue()); |
| | | if ("fixed".equals(withdraw_fee_type)) { |
| | | fee = withdraw_fee; |
| | | } |
| | | if ("rate".equals(withdraw_fee_type)) { |
| | | withdraw_fee = Arith.div(withdraw_fee, 100); |
| | | fee = Arith.mul(amount_double, withdraw_fee); |
| | | } |
| | | if ("part".equals(withdraw_fee_type)) { |
| | | // 提现手续费part分段的值 |
| | | String withdraw_fee_part = this.sysparaService.find("withdraw_fee_part").getSvalue(); |
| | | String[] withdraw_fee_parts = withdraw_fee_part.split(","); |
| | | for (int i = 0; i < withdraw_fee_parts.length; i++) { |
| | | double part_amount = Double.valueOf(withdraw_fee_parts[i]); |
| | | double part_fee = Double.valueOf(withdraw_fee_parts[i + 1]); |
| | | if (amount_double <= part_amount) { |
| | | fee = part_fee; |
| | | break; |
| | | } |
| | | i++; |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | map.put("withdraw_fee_type", withdraw_fee_type); |
| | | } |
| | | |
| | | double volume_last = Arith.sub(amount_double, fee); |