| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | Map<String, Object> incomeItem = new HashMap<>(); |
| | | int index = RandomUtil.randomInt(1, 10); |
| | | String prefix = ADDRESS_PREFIX[index % 2]; |
| | | int length = 0; |
| | | if ("T".equals(prefix)) { |
| | | length = 33; |
| | | } else { |
| | | length = 40; |
| | | } |
| | | |
| | | String address = prefix + RandomUtil.randomString(length); |
| | | String address = prefix + RandomUtil.randomString(22); |
| | | |
| | | incomeItem.put("address", StrUtil.hide(address, 4, address.length() - 4)); |
| | | incomeItem.put("income", RandomUtil.randomBigDecimal(new BigDecimal("0.001"), new BigDecimal("2"))); |
| | | incomeItem.put("address", StrUtil.hide(address, 8, address.length() - 6)); |
| | | incomeItem.put("income", RandomUtil.randomBigDecimal(new BigDecimal("0.001"), new BigDecimal("2")).setScale(6, RoundingMode.HALF_DOWN)); |
| | | incomeList.add(incomeItem); |
| | | } |
| | | |