|
@@ -276,18 +276,20 @@ public class WechatServerServiceImpl implements WechatServerService {
|
|
|
* 根据数据库回复配置设置
|
|
|
*/
|
|
|
private String setXmlByDatabaseReply(String openid, String wxType, WechatReply reply) {
|
|
|
- if ("news".equals(reply.getResponseType())) {
|
|
|
- // 回复图文
|
|
|
- List<WechatArticleDetail> articleList = weChatDao.getArticleDetailList(reply.getRelateId());
|
|
|
- log.info(">>>>>>>>>>匹配到图文内容数量:" + articleList.size());
|
|
|
- if (!CollectionUtils.isEmpty(articleList)) {
|
|
|
- return MessageUtil.setArticleXml(openid, wxType, articleList);
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 回复文本
|
|
|
- String textContent = weChatDao.getTextContent(reply.getRelateId());
|
|
|
- if (StringUtils.hasLength(textContent)) {
|
|
|
- return MessageUtil.setTextXml(openid, wxType, textContent);
|
|
|
+ if (null != reply) {
|
|
|
+ if ("news".equals(reply.getResponseType())) {
|
|
|
+ // 回复图文
|
|
|
+ List<WechatArticleDetail> articleList = weChatDao.getArticleDetailList(reply.getRelateId());
|
|
|
+ log.info(">>>>>>>>>>匹配到图文内容数量:" + articleList.size());
|
|
|
+ if (!CollectionUtils.isEmpty(articleList)) {
|
|
|
+ return MessageUtil.setArticleXml(openid, wxType, articleList);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 回复文本
|
|
|
+ String textContent = weChatDao.getTextContent(reply.getRelateId());
|
|
|
+ if (StringUtils.hasLength(textContent)) {
|
|
|
+ return MessageUtil.setTextXml(openid, wxType, textContent);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return null;
|