import com.alibaba.fastjson.JSON;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.QywxTagInfoDTO;
import com.gic.haoban.manage.api.dto.QywxTagItemDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.api.service.QywxTagApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.hm.HmClerkRelationService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO;
import org.apache.commons.collections.CollectionUtils;
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;

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

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class TagTest3 {
    
    @Autowired
    private QywxTagApiService qywxTagApiService  ;
    @Autowired
    private HmQrcodeService hmQrcodeService ;    
    @Autowired
    private WxEnterpriseService wxEnterpriseService ;
    @Autowired
    private Config config ;
    @Autowired
    private HmClerkRelationService  hmClerkRelationService ;
    @Autowired
    private ExternalClerkRelatedApiService externalClerkRelatedApiService ;

    @Test
    public void tt() throws InterruptedException {

        // String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items
        String wxEnterpriseId = "ca66a01b79474c40b3e7c7f93daf1a3b" ;
        String enterpriseId = "ff8080815dacd3a2015dacd3ef5c0000" ;
        QywxTagInfoDTO infoDTO = new QywxTagInfoDTO() ;
        infoDTO.setWxEnterpriseId(wxEnterpriseId);
        infoDTO.setMemberTagId("5b1db406e21748e88737a4cbe194d24f");

        List<QywxTagItemDTO> items = new ArrayList<>() ;

        QywxTagItemDTO mid = new QywxTagItemDTO();
        mid.setMemberTagItemId("0f08ddb354654638bc8f71ce39fce688");
        mid.setQywxTagName("企微1");
        items.add(mid) ;

        QywxTagItemDTO mid2 = new QywxTagItemDTO();
        mid2.setMemberTagItemId("1e3f324af76842a0a3b7697f95419414");
        mid2.setQywxTagName("企微2");
        items.add(mid2) ;


        QywxTagItemDTO mid3 = new QywxTagItemDTO();
        mid3.setMemberTagItemId("qw5");
        mid3.setQywxTagKey("qw5");
        mid3.setQywxTagName("企微5");
        items.add(mid3) ;

        this.qywxTagApiService.syncTagToQywx(wxEnterpriseId,enterpriseId,infoDTO,items) ;

    }

}
