CardInfoHttpClient.java 1.49 KB
package com.diligrp.cashier.mall.client;

import com.diligrp.cashier.mall.util.HttpClientUtils;
import com.diligrp.cashier.shared.util.JsonUtils;
import com.fasterxml.jackson.core.type.TypeReference;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author lvqi
 */

public class CardInfoHttpClient {

    public static Object getCardPayInfo(String urlPrefix, List<Long> accountIds) {
        Map<String, Object> params = new HashMap<>();
        params.put("accountIds", accountIds);
        Map<String, Object> map = HttpClientUtils.postJson(
                urlPrefix + "/cashier/query/accountListWithOutAuth",
                params,
                null,
                new TypeReference<>() {
                },
                ""
        );
        if (map != null && map.get("code").equals("200")) {
            return map.get("data");
        }
        return null;

    }

    public static Map<String, Object> getCardCustomerInfo(String urlPrefix, Long marketId, Long id) {
        Map<String, Object> params = new HashMap<>();
        params.put("marketId", marketId);
        params.put("id", id);
        Map<String, Object> map = HttpClientUtils.postJson(urlPrefix + "/cashier/query/customerInfo", params, null, new TypeReference<>() {
        }, "");
        if (map != null && map.get("code").equals("200")) {
            return JsonUtils.fromJsonString(JsonUtils.toJsonString(map.get("data")), new TypeReference<>() {
            });
        }
        return null;
    }

}