| | |
| | | public Result<String> save(@Valid @RequestBody ItemLeverageDTO itemLeverageDTO) { |
| | | String leverRate = itemLeverageDTO.getLeverRate(); |
| | | if (StrUtil.isEmpty(leverRate)) { |
| | | throw new YamiShopBindException("杠杆倍数不能为空"); |
| | | throw new YamiShopBindException("Leverage multiplier cannot be empty"); |
| | | } |
| | | BigDecimal bigDecimal; |
| | | try { |
| | | bigDecimal = new BigDecimal(leverRate); |
| | | } catch (Exception e) { |
| | | throw new YamiShopBindException("杠杆倍数必须是数字"); |
| | | throw new YamiShopBindException("Leverage multiplier must be a number"); |
| | | } |
| | | if (bigDecimal.compareTo(BigDecimal.ONE) <= 0) { |
| | | throw new YamiShopBindException("杠杆倍数必须大于1"); |
| | | throw new YamiShopBindException("Leverage multiplier must be greater than 1"); |
| | | } |
| | | //新增或编辑表单保存 |
| | | itemLeverageService.saveOrUpdate(tItemLeverageWrapper.toEntity(itemLeverageDTO)); |