import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.JSONResponse;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.qdto.combined.CombinedQDTO;
import com.gic.haoban.manage.service.context.combined.ImageCombined;
import com.gic.haoban.manage.service.service.MaterialService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.wechat.api.enums.QywxMediaTypeEnum;
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;

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

    private static Logger logger = LoggerFactory.getLogger(QWmediaTest.class);
    @Autowired
    private QywxSuiteApiService qywxSuiteApiService ;
    @Autowired
    private WxEnterpriseService wxEnterpriseService;
    @Autowired
    private MaterialService materialService;

    private static final String LARGE_IMAGE_URL = "https://jhdm-1251519181.cos.ap-shanghai.myqcloud.com/image/material_content-4582434f589b494aa4f27df6e3aa3770.png?imageView2/2/w/1080/h/10800/format/jpg";
    private static final String QR_CODE_URL = "https://gicinner-1251519181.cos.ap-shanghai.myqcloud.com/image/material_content-4ffc77073ca1476fb264bf1be9f11383.png";
    private static final String STORE_NAME = "门店CCA";
    private static final String GUIDE_NAME = "宇智222";

    @Test
    public void test() throws Exception{
        CombinedQDTO combinedQDTO = new CombinedQDTO();
        combinedQDTO.setImageUrl(LARGE_IMAGE_URL);
        combinedQDTO.setQrCodeUrl(QR_CODE_URL);
        combinedQDTO.setShowStyle(1);
        combinedQDTO.setLineOne(STORE_NAME);
        combinedQDTO.setLineTwo(GUIDE_NAME);
        JSONResponse json = materialService.getMaterialIdByCombined("b18ffdc9d0644912865a248859914d80", combinedQDTO);
        System.out.println(JSON.toJSONString(json));

    }

}
