package cn.freemud.adapter;

import cn.freemud.entities.dto.*;
import cn.freemud.entities.vo.AddDeliveryAddressVo;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.entities.vo.QueryReceiveAddressResponseVo;
import cn.freemud.entities.vo.UserLoginVo;
import cn.freemud.enums.ReceiveAddressLabelType;
import cn.freemud.enums.SexType;
import cn.freemud.manager.OpenPlatformPartnerStoreDeliveryConfigManager;
import cn.freemud.service.impl.StoreServiceImpl;
import cn.freemud.utils.UnicodeUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.stream.Collectors;

@Component
public class UserAdapter {

    public UserLoginInfoDto getUserLoginInfoDto(Map<String, Object> map) {
        UserLoginInfoDto userLoginInfoDto = new UserLoginInfoDto();
        userLoginInfoDto.setOpenId(String.valueOf(map.get("openid")));
        userLoginInfoDto.setWxAppid(String.valueOf(map.get("wxAppid")));
        userLoginInfoDto.setSessionKey(String.valueOf(map.get("session_key")));
        userLoginInfoDto.setMobile(String.valueOf(map.get("mobile")));
        userLoginInfoDto.setAppsecret(String.valueOf(map.get("appsecret")));
        userLoginInfoDto.setMemberId(String.valueOf(map.get("memberId")));
        userLoginInfoDto.setPartnerId(String.valueOf(map.get("partnerId")));
        userLoginInfoDto.setUnionId(String.valueOf(map.get("unionId")));
        userLoginInfoDto.setNewMemeber(Boolean.valueOf(map.get("newMember").toString()));
        userLoginInfoDto.setNickName(String.valueOf(map.get("nickName")));
        return userLoginInfoDto;
    }
}
