|
|
package com.test;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.message.dal.MessageFilterInfoMapper;
|
|
|
import com.yoho.service.model.msgcenter.wechat.WechatCustomMsgBO;
|
|
|
import com.yoho.yhmessage.wechat.service.IWechatService;
|
|
|
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;
|
|
|
|
|
|
/**
|
|
|
* Created by min.ling on 2018/10/8.
|
|
|
*/
|
|
|
@RunWith(SpringJUnit4ClassRunner.class)
|
|
|
@ContextConfiguration(locations = {"classpath*:META-INF/spring/spring*.xml","classpath*:META-INF/spring/mybatis-datasource.xml",})
|
|
|
public class WechatSendTest {
|
|
|
|
|
|
@Autowired
|
|
|
MessageFilterInfoMapper filterInfoMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private IWechatService wechatService;
|
|
|
|
|
|
@Test
|
|
|
public void sendCustomTest(){
|
|
|
List<String> openIdList = new ArrayList<>();
|
|
|
openIdList.add("oemqmjl0M38zwP-7wnmhNcQqVMEA");
|
|
|
JSONObject content = new JSONObject();
|
|
|
content.put("content","hi LingMin");
|
|
|
WechatCustomMsgBO customMsgBO = new WechatCustomMsgBO();
|
|
|
customMsgBO.setPublicNumCode(2);
|
|
|
customMsgBO.setOpenIdList(openIdList);
|
|
|
customMsgBO.setSendKey("123");
|
|
|
customMsgBO.setFilterDays(0);
|
|
|
customMsgBO.setMsgType("text");
|
|
|
customMsgBO.setSendContent(content.toJSONString());
|
|
|
wechatService.sendWechatCustomMsg(customMsgBO);
|
|
|
}
|
|
|
} |
...
|
...
|
|