| | |
| | | long iCount = itemService.count(new LambdaQueryWrapper<Item>() |
| | | .eq(Item::getSymbol, ico.getSymbol()).or().eq(Item::getSymbolData, ico.getSymbolData())); |
| | | if(iCount > 0){ |
| | | throw new YamiShopBindException("产品表已存在数据"); |
| | | throw new YamiShopBindException("Product data already exists"); |
| | | } |
| | | if(count > 0){ |
| | | throw new YamiShopBindException("代币符号或数据源编码已存在"); |
| | | throw new YamiShopBindException("Token symbol or data source code already exists"); |
| | | } |
| | | } else { |
| | | Ico model = icoService.getById(ico.getId()); |
| | | if (model == null) { |
| | | throw new YamiShopBindException("数据不存在"); |
| | | throw new YamiShopBindException("Data does not exist"); |
| | | } |
| | | Date now = Date.from(Instant.now()); |
| | | if (model.getMarketDate() != null && model.getMarketDate().before(now)){ |
| | | if (!model.getSymbol().equalsIgnoreCase(ico.getSymbol()) || |
| | | !model.getSymbolData().equalsIgnoreCase(ico.getSymbolData())) { |
| | | throw new YamiShopBindException("已上市,禁止修改代币符号,数据源编码"); |
| | | throw new YamiShopBindException("Already listed, token symbol and data source code cannot be modified"); |
| | | } |
| | | } |
| | | |
| | |
| | | .or() |
| | | .eq(Ico::getSymbolData, ico.getSymbolData()))); |
| | | if(count > 0){ |
| | | throw new YamiShopBindException("代币符号或数据源编码已存在"); |
| | | throw new YamiShopBindException("Token symbol or data source code already exists"); |
| | | } |
| | | |
| | | //更新ico实时价格 |
| | | if (model.getUnitAmount().compareTo(BigDecimal.ZERO) >0 && |
| | | /*if (model.getUnitAmount().compareTo(BigDecimal.ZERO) >0 && |
| | | model.getUnitAmount().compareTo(ico.getUnitAmount()) != 0){ |
| | | String symbol = ico.getSymbol(); |
| | | RequestDataHelper.set("symbol", symbol); |
| | |
| | | realtimeService.updateById(realtime); |
| | | RequestDataHelper.clear(); |
| | | DataCache.putRealtime(symbol, realtime); |
| | | } |
| | | }*/ |
| | | } |
| | | //新增或编辑表单保存 |
| | | icoService.saveOrUpdate(ico); |
| | |
| | | queryWrapper.eq("ico_project_id", id); |
| | | long count = userSubscriptionService.count(queryWrapper); |
| | | if (count > 0) { |
| | | throw new YamiShopBindException("已有申购记录,删除失败"); |
| | | throw new YamiShopBindException("Subscription records exist, deletion failed"); |
| | | } |
| | | if (icoService.removeById(id)) { |
| | | return Result.ok("删除成功"); |