import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.qo.content.PotentialCustomerQO;
import com.gic.haoban.manage.service.service.MemberQueryService;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.service.MemberService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @Author MUSI
 * @Date 2023/3/30 10:15 PM
 * @Description
 * @Version
 **/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class PotentialCustomerServiceTest {

    @Autowired
    PotentialCustomerService potentialCustomerService;
    @Autowired
    private MemberService memberService;
    @Autowired
    MemberQueryService memberQueryService;

    String eid = "ff8080815dacd3a2015dacd3ef5c0000";
    String wxEid = "ca66a01b79474c40b3e7c7f93daf1a3b";
    String staffId = "e608b51b267e4943b87e222a343b4f25";
    String clerkId = "bcbfff6c8e2e40aaac795a99d0dde2aa";
    String memberId = "ff8080818147efc8018148d1759903c8";

    @Test
    public void queryPotentialCustomerTest(){
        PotentialCustomerQO potentialCustomerQO = new PotentialCustomerQO();
        potentialCustomerQO.setEnterpriseId(eid);
        potentialCustomerQO.setWxEnterpriseId(wxEid);
        potentialCustomerQO.setClerkId(clerkId);
        potentialCustomerQO.setHasMemberRelation(1);
        Page<PotentialCustomerBO> customerBOPage =
                potentialCustomerService.queryPotentialCustomerPage(potentialCustomerQO);
        System.out.println(JSON.toJSONString(customerBOPage));
    }

    @Test
    public void queryMemberinfo(){
        MemberDTO memberDTO = memberService.queryMember("ff8080818215878101821949a845003c");
        System.out.println(JSON.toJSONString(memberDTO));

        JSONObject jsonObject = memberQueryService.queryDataSingle(eid, "ff8080818215878101821949a845003c", null);
        System.out.println(jsonObject.toJSONString());
    }
}
