| | |
| | | public Result<String> setShowStatus(String symbol, String showStatus) throws Exception { |
| | | Item bySymbol = itemService.findBySymbol(symbol); |
| | | if(bySymbol == null){ |
| | | throw new YamiShopBindException( symbol + "不存在"); |
| | | throw new YamiShopBindException(symbol + " does not exist"); |
| | | } |
| | | Item update = new Item(); |
| | | update.setUuid(bySymbol.getUuid()); |
| | |
| | | public Result<String> setTradeStatus(String symbol, String tradeStatus) throws Exception { |
| | | Item bySymbol = itemService.findBySymbol(symbol); |
| | | if(bySymbol == null){ |
| | | throw new YamiShopBindException( symbol + "不存在"); |
| | | throw new YamiShopBindException(symbol + " does not exist"); |
| | | } |
| | | Item update = new Item(); |
| | | update.setUuid(bySymbol.getUuid()); |
| | |
| | | public Result <String> addConfig(@Valid @RequestBody ItemConfig itemConfig) { |
| | | //userService.checkLoginSafeword(SecurityUtils.getSysUser().getUserId().toString(), itemConfig.getLoginSafeword()); |
| | | if(StrUtil.isNotBlank(itemConfig.getUuid())){ |
| | | throw new YamiShopBindException("新增配置不要传入uuid"); |
| | | throw new YamiShopBindException("Do not pass uuid when creating new config"); |
| | | } |
| | | Item bySymbol = itemService.findBySymbol(itemConfig.getSymbol()); |
| | | if(bySymbol != null){ |
| | | throw new YamiShopBindException("代码已经存在"); |
| | | throw new YamiShopBindException("Code already exists"); |
| | | } |
| | | Item item = itemWrapper.toEntity(itemConfig); |
| | | //新增或编辑表单保存 |
| | |
| | | public Result <String> addConfig(@Valid @RequestBody ItemDTO itemDTO) { |
| | | //userService.checkLoginSafeword(SecurityUtils.getSysUser().getUserId().toString(), itemDTO.getLoginSafeword()); |
| | | if(StrUtil.isNotBlank(itemDTO.getUuid())){ |
| | | throw new YamiShopBindException("新增配置不要传入uuid"); |
| | | throw new YamiShopBindException("Do not pass uuid when creating new config"); |
| | | } |
| | | Item bySymbol = itemService.findBySymbol(itemDTO.getSymbol()); |
| | | if(bySymbol != null){ |
| | | throw new YamiShopBindException("代码已经存在"); |
| | | throw new YamiShopBindException("Code already exists"); |
| | | } |
| | | Item item = itemWrapper.toEntity(itemDTO); |
| | | //新增或编辑表单保存 |
| | |
| | | public Result <String> updateConfig(@Valid @RequestBody ItemDTO itemDTO) { |
| | | // userService.checkLoginSafeword(SecurityUtils.getSysUser().getUserId().toString(), itemDTO.getLoginSafeword()); |
| | | if(StrUtil.isBlank(itemDTO.getUuid())){ |
| | | throw new YamiShopBindException("更新数据时候uuid不能为空"); |
| | | throw new YamiShopBindException("UUID cannot be empty when updating data"); |
| | | } |
| | | Item byId = itemService.getById(itemDTO.getUuid()); |
| | | if(byId == null){ |
| | | throw new YamiShopBindException("更新永续合约不存在"); |
| | | throw new YamiShopBindException("Perpetual contract to update does not exist"); |
| | | } |
| | | // 新老代码不等 |
| | | if (!byId.getSymbol().equalsIgnoreCase(itemDTO.getSymbol())) { |
| | | // 且老的名称已经存在 |
| | | Item bySymbol = itemService.findBySymbol(itemDTO.getSymbol()); |
| | | if(bySymbol != null ){ |
| | | throw new YamiShopBindException("被更新的永续合约已经存在"); |
| | | throw new YamiShopBindException("Perpetual contract to update already exists"); |
| | | } |
| | | } |
| | | Item item = itemWrapper.toEntity(itemDTO); |
| | |
| | | public Result <String> updateConfig(@Valid @RequestBody ItemConfig itemConfig) { |
| | | //userService.checkLoginSafeword(SecurityUtils.getSysUser().getUserId().toString(), itemConfig.getLoginSafeword()); |
| | | if(StrUtil.isBlank(itemConfig.getUuid())){ |
| | | throw new YamiShopBindException("更新数据时候uuid不能为空"); |
| | | throw new YamiShopBindException("UUID cannot be empty when updating data"); |
| | | } |
| | | Item byId = itemService.getById(itemConfig.getUuid()); |
| | | if(byId == null){ |
| | | throw new YamiShopBindException("更新品种不存在"); |
| | | throw new YamiShopBindException("Product variety to update does not exist"); |
| | | } |
| | | // 新老代码不等 |
| | | if (!byId.getSymbol().equalsIgnoreCase(itemConfig.getSymbol())) { |
| | | // 且老的名称已经存在 |
| | | Item bySymbol = itemService.findBySymbol(itemConfig.getSymbol()); |
| | | if(bySymbol != null ){ |
| | | throw new YamiShopBindException("被更新的品种已经存在"); |
| | | throw new YamiShopBindException("Product variety to update already exists"); |
| | | } |
| | | } |
| | | Item item = itemWrapper.toEntity(itemConfig); |