import java.util.ArrayList;
import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ctrip.framework.apollo.Config;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.HandoverExternalDTO;
import com.gic.haoban.manage.api.service.HandoverOperationApiService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.wechat.api.dto.qywx.fee.AccountListResponseDTO;
import com.gic.wechat.api.service.qywx.QywxOrderApiService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class HandoverTest {

    private static Logger logger = LoggerFactory.getLogger(HandoverTest.class);

    @Autowired
    private HandoverOperationApiService handoverOperationApiService;
    @Autowired
    private QywxOrderApiService qywxOrderApiService ;
    @Autowired
    private com.gic.haoban.manage.service.config.Config config ;


    @Test
    public void test() {
        ServiceResponse<AccountListResponseDTO> resp =  this.qywxOrderApiService.listActivedAccount(config.getCorpid(), "wp59NLDQAAJL6DsM6YwOGqJlhCBykkeA", 100, null) ;
        System.out.println(JSON.toJSONString(resp));
        System.out.println("11");
    }

    @Test
    public void test1() {
        String wxEnterpriseId = "ca66a01b79474c40b3e7c7f93daf1a3b";
        handoverOperationApiService.dealQywxEnterpriseHandoverResult(wxEnterpriseId);
    }

    @Test
    public void test2() {
        String wxEnterpriseId = "ca66a01b79474c40b3e7c7f93daf1a3b";
        List<String> staffIds = new ArrayList<>();
        staffIds.add("471ef6fbeed84319944e68265855ecb4");
        Page<HandoverExternalDTO> handoverExternalDTOPage = handoverOperationApiService.pageHandoverFriend(wxEnterpriseId, null, staffIds, null, new BasePageInfo());

        System.out.println(JSONObject.toJSONString(handoverExternalDTOPage));
    }

    @Test
    public void test3() {
        String wxEnterpriseId = "ca66a01b79474c40b3e7c7f93daf1a3b";
        GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
        try {
            clientInstance.sendMessage("haobanEcmTaskDataCallback", "11111");
        } catch (Exception e) {
        }
    }
}
