| | |
| | | if (!list.isEmpty() && list.get(0) != null) { |
| | | stockDzDto.setCurrentPrice(list.get(0).getClose()); |
| | | } |
| | | if (stockDzDto.getDayRate() != 0) { |
| | | double dayRate = BigDecimal.valueOf(stockDzDto.getDayRate()).multiply(BigDecimal.valueOf(100)).doubleValue(); |
| | | stockDzDto.setDayRate(dayRate); |
| | | } |
| | | }); |
| | | return Result.succeed(page); |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result addByAdmin(String stockCode, String stockNum, String password, String startTime, String endTime, String discount,Integer period,String nowPrice,Integer switchType, String stockType, double dayRate) { |
| | | public Result addByAdmin(String stockCode, String stockName, String stockNum, String password, String startTime, String endTime, String discount,Integer period,String nowPrice,Integer switchType, String stockType, double dayRate) { |
| | | if (stockCode == null || stockCode.isEmpty() || startTime == null || startTime.isEmpty() ||endTime == null || endTime.isEmpty() || nowPrice == null){ |
| | | return Result.failed("参数不能为空"); |
| | | } |
| | | if (stockType.equalsIgnoreCase(Item.indices) && dayRate == 0) { |
| | | return Result.failed("请输入日收益率"); |
| | | if (stockType.equalsIgnoreCase(Item.indices)) { |
| | | if (dayRate == 0) { |
| | | return Result.failed("请输入日收益率"); |
| | | } |
| | | if (stockName == null || stockName.isEmpty()){ |
| | | return Result.failed("请输入股票名称"); |
| | | } |
| | | } |
| | | |
| | | //该类型是否已添加 |
| | |
| | | |
| | | StockDz stockDz = new StockDz(); |
| | | if (stockType.equalsIgnoreCase(Item.indices)) { |
| | | stockDz.setStockName(stockCode); |
| | | stockDz.setStockName(stockName); |
| | | stockDz.setStockCode(stockCode); |
| | | stockDz.setStockSpell(stockCode); |
| | | } else { |
| | |
| | | model.setStockSpell(item.getSymbolData()); |
| | | } |
| | | } else { |
| | | model.setStockCode(model.getStockCode()); |
| | | model.setStockSpell(model.getStockCode()); |
| | | model.setStockName(model.getStockCode()); |
| | | } |
| | | model.setStockType(stockDz.getStockType()); |
| | | |