| | |
| | | import com.yami.trading.bean.model.User; |
| | | import com.yami.trading.bean.model.Withdraw; |
| | | import com.yami.trading.common.domain.Result; |
| | | import com.yami.trading.common.util.ApplicationContextUtils; |
| | | import com.yami.trading.common.util.IPHelper; |
| | | import com.yami.trading.common.util.StringUtils; |
| | | import com.yami.trading.common.util.*; |
| | | import com.yami.trading.huobi.data.internal.KlineInitService; |
| | | import com.yami.trading.security.common.enums.CryptoCurrencyEnum; |
| | | import com.yami.trading.security.common.enums.SysTypeEnum; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.RoundingMode; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @Autowired |
| | | PasswordCheckManager passwordCheckManager; |
| | | |
| | | //@Scheduled(cron = "*/5 * * * * ?") |
| | | private double getRandomValue(int value) { |
| | | double addValue; |
| | | if (value > 0) { |
| | | int count = 0; |
| | | while (value > 0) { |
| | | value = value / 10; |
| | | count++; |
| | | } |
| | | // 个 |
| | | if (count == 1) { |
| | | addValue = RandomUtil.randomFloat(0.01, 0.1999, 4); |
| | | return addValue; |
| | | } |
| | | // 十 |
| | | if (count == 2) { |
| | | addValue = RandomUtil.randomFloat(0.1, 0.5999, 4); |
| | | return addValue; |
| | | } |
| | | // 百 |
| | | if (count == 3) { |
| | | addValue = RandomUtil.randomFloat(0.1, 2.9999, 4); |
| | | return addValue; |
| | | } |
| | | // 千 |
| | | if (count == 4) { |
| | | addValue = RandomUtil.randomFloat(1, 3.9999, 4); |
| | | return addValue; |
| | | } |
| | | // 万 |
| | | if (count == 5) { |
| | | addValue = RandomUtil.randomFloat(1, 5.9999, 4); |
| | | return addValue; |
| | | } |
| | | // 十万 |
| | | else { |
| | | addValue = RandomUtil.randomFloat(1, 5.9999, 4); |
| | | return addValue; |
| | | } |
| | | } else { |
| | | addValue = RandomUtil.randomFloat(0.01, 0.2999, 4); |
| | | return addValue; |
| | | } |
| | | } |
| | | |
| | | // @Scheduled(cron = "*/5 * * * * ?") |
| | | public void test() throws Exception { |
| | | User user= userService.findByUserName("zyyyyyyy"); |
| | | passwordCheckManager.checkPassword(SysTypeEnum.ORDINARY, user.getUserName(), "123456", user.getLoginPassword()); |
| | | double amt = 0.005215; |
| | | double addPriceValue = getRandomValue((int)amt); |
| | | double price = Arith.add(amt, addPriceValue); |
| | | |
| | | String format = ""; |
| | | format = "#."; |
| | | for (int j = 0; j < 6; j++) { |
| | | format = format + "#"; |
| | | } |
| | | |
| | | DecimalFormat df = new DecimalFormat(format); |
| | | df.setRoundingMode(RoundingMode.FLOOR);// 向下取整 |
| | | |
| | | System.out.println(df.format(price)); |
| | | System.out.println("dd"); |
| | | } |
| | | /** |
| | | * ico转入产品 |
| | |
| | | /** |
| | | * K线数据修正 |
| | | */ |
| | | @Scheduled(cron = "0 */1 * * * ?") |
| | | //@Scheduled(cron = "0 */5 * * * ?") |
| | | public void klineInit() { |
| | | List<Item> items = ApplicationContextUtils.getApplicationContext().getBean(ItemService.class).list(); |
| | | if (CollectionUtil.isNotEmpty(items)) { |