import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatPlanDTO;
import com.gic.haoban.manage.api.dto.notify.qdto.NoticeMessageQDTO;
import com.gic.haoban.manage.api.dto.notify.qdto.NotifyMessageBatchQDTO;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.service.QywxTagApiService;
import com.gic.haoban.manage.api.service.notify.NoticeMessageApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.chat.GroupChatPlanService;
import com.gic.wechat.api.dto.qywx.QywxNewsArticleMessageDTO;
import com.gic.wechat.api.dto.qywx.QywxNewsSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
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.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

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

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

    @Autowired
    private GroupChatPlanService groupChatPlanService;

    @Test
    public void test() {
        String str = "{\"name\":\"测试\",\"remark\":\"测试\",\"expireDays\":\"2\",\"sendType\":1,\"sendTime\":\"\",\"chatContent\":\"[{\\\"img\\\":\\\"https://platform-1251519181.cos.ap-shanghai.myqcloud.com/image/jhdm/marketing_common-edc68cbf153846928c0ac28e2b2aa92f.jpg\\\",\\\"relation_id\\\":\\\"510923843246776342\\\",\\\"type\\\":2},{\\\"img\\\":\\\"https://platform-1251519181.cos.ap-shanghai.myqcloud.com/image/jhdm/marketing_common-3acc9bc9bbe8416e8aefe459b23eea5e.jpg\\\",\\\"relation_id\\\":\\\"510923843246776342\\\",\\\"type\\\":2},{\\\"content\\\":\\\"莎啦啦啦\\\",\\\"relation_id\\\":\\\"510923843246776342\\\",\\\"type\\\":1}]\",\"staffIdList\":\"36067cdee7ba4ff6adc7551b34cc2005\",\"requestProject\":\"haoban-manage-web\"}";
        GroupChatPlanDTO groupChatPlanDTO = JSONObject.parseObject(str, GroupChatPlanDTO.class);
        groupChatPlanDTO.setWxEnterpriseId("ca66a01b79474c40b3e7c7f93daf1a3b");
        groupChatPlanDTO.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
        groupChatPlanDTO.setCreatorId("fefd1c81641711e69d0818c58a146fd2");
        groupChatPlanDTO.setCreatorName("达摩管理员");
        groupChatPlanDTO.setMaterialFrom(2);

        groupChatPlanService.save(groupChatPlanDTO);
    }

}
