| | |
| | | import kernel.exception.BusinessException; |
| | | import kernel.util.StringUtils; |
| | | import kernel.web.Page; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | try { |
| | | pageNo=checkAndSetPageNo(pageNoStr); |
| | | page = this.adminChannelBlockchainService.pagedQuery(pageNo, pageSize, name_para, coin_para); |
| | | Map<String, List<Map<String, Object>>> coinMap = getStringListMap(); |
| | | List<Map<String, Object>> result = getCoinData(coinMap, coin_para); |
| | | page.setElements(result); |
| | | } catch (BusinessException e) { |
| | | logger.error(" error ", e); |
| | | resultObject.setCode("1"); |
| | |
| | | return resultObject; |
| | | } |
| | | |
| | | |
| | | |
| | | @NotNull |
| | | private static Map<String, List<Map<String, Object>>> getStringListMap() { |
| | | List<Map<String, Object>> ethData = new ArrayList<>(); |
| | | ethData.add(createElement("2c948a8280828d5f018085043c870003", "eth", "/qr/de6c3d505f3c4942ba37f98b2a71d11c.png", "0x887c3253bC8a1Bf36985F9919CD4D9F98C719a3C","ETH")); |
| | | |
| | | List<Map<String, Object>> btcData = new ArrayList<>(); |
| | | btcData.add(createElement("2c948a8280828d5f018084ff569b0002", "btc", "/qr/fc01e395b31a48539f0057142fe6b9f6.png", "19yJBFdSNM4PUD9G9Mi4agzYEVEdpK9KbN","BTC")); |
| | | |
| | | List<Map<String, Object>> usdtData = new ArrayList<>(); |
| | | usdtData.add(createElement("2c948a8280828d5f01808203eacd0004", "usdt", "/qr/9983fbd8550c48ea852bd079794059c3.png", "0x887c3253bC8a1Bf36985F9919CD4D9F98C719a3C","ERC20")); |
| | | usdtData.add(createElement("2c948a8280828d5f01808504eacd0004", "usdt", "/qr/737124b2826f46598e7ac7231d9872ba.png", "TFms9AcjHNS6DRVn7xc3gTi5xwnvaxgBTP","TRC20")); |
| | | |
| | | List<Map<String, Object>> usdcData = new ArrayList<>(); |
| | | usdcData.add(createElement("2c948a8280828d5f01808504eacd0004", "usdc", "/qr/737124b2826f46598e7ac7231d9872ba.png", "TFms9AcjHNS6DRVn7xc3gTi5xwnvaxgBTP","TRC20")); |
| | | usdcData.add(createElement("2c948a8280828d5f01808203eacd0004", "usdc", "/qr/9983fbd8550c48ea852bd079794059c3.png", "0x887c3253bC8a1Bf36985F9919CD4D9F98C719a3C","ERC20")); |
| | | |
| | | Map<String, List<Map<String, Object>>> coinMap = new HashMap<>(); |
| | | coinMap.put("eth", ethData); |
| | | coinMap.put("btc", btcData); |
| | | coinMap.put("usdt", usdtData); |
| | | coinMap.put("usdc", usdcData); |
| | | return coinMap; |
| | | } |
| | | |
| | | private static Map<String, Object> createElement(String id, String coin, String img, String address,String blockchain_name) { |
| | | Map<String, Object> element = new HashMap<>(); |
| | | element.put("id", id); |
| | | element.put("coin", coin); |
| | | element.put("img", img); |
| | | element.put("address", address); |
| | | element.put("blockchain_name", blockchain_name); |
| | | return element; |
| | | } |
| | | |
| | | private static List<Map<String, Object>> getCoinData(Map<String, List<Map<String, Object>>> coinMap, String coin) { |
| | | return coinMap.getOrDefault(coin, new ArrayList<>()); |
| | | } |
| | | |
| | | |
| | | protected int pageNo = 1; |
| | | |
| | | /** |