import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.AlertMessageDTO;
import com.gic.haoban.manage.api.dto.HandoverExternalDTO;
import com.gic.haoban.manage.api.enums.AlertTypeEnum;
import com.gic.haoban.manage.api.service.CheckQywxSettingApiService;
import com.gic.haoban.manage.api.service.HandoverOperationApiService;
import com.gic.haoban.manage.api.service.QywxTagApiService;
import com.gic.mq.sdk.GicMQClient;
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 java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

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

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

    @Autowired
    private QywxTagApiService qywxTagApiService;

    @Autowired
    private CheckQywxSettingApiService checkQywxSettingApiService;


    @Test
    public void test() {
        String wxEnterpriseId = "ca66a01b79474c40b3e7c7f93daf1a3b";
        qywxTagApiService.pullQywxTag(wxEnterpriseId);
    }

    @Test
    public void test2() {
        AlertMessageDTO messageDTO = new AlertMessageDTO();
        messageDTO.setTraceId("111");
        messageDTO.setEnterpriseId("");
        messageDTO.setWxEnterpriseId("ca66a01b79474c40b3e7c7f93daf1a3b");
        messageDTO.setAlertTitle("测试标题");
        messageDTO.setAlertType(AlertTypeEnum.QYWX_TAG_SYNC.getType());
        Map<String, Object> map = new HashMap<>();
        map.put("测试", "test");
        messageDTO.setContentMap(map);
        checkQywxSettingApiService.alertCallback(JSONObject.toJSONString(messageDTO));

    }

    @Test
    public void test3() {
        qywxTagApiService.checkQywxSync("-1");
    }

}
