From 4206b6ca3eaea3bd01a89e912292f5654e1b3fcf Mon Sep 17 00:00:00 2001 From: qi Date: Wed, 24 Jul 2019 16:42:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 1 - .../java/com/lq/dao/WechatRuleMessageDao.java | 2 + src/main/java/com/lq/entity/SysUser.java | 1 - .../java/com/lq/entity/WechatInfoSetting.java | 37 +++++++++++++- .../com/lq/wechat/web/WechatController.java | 51 ++++++++++--------- 5 files changed, 66 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index bfb8986..e6d29b1 100644 --- a/pom.xml +++ b/pom.xml @@ -520,7 +520,6 @@ 2.6.2 - diff --git a/src/main/java/com/lq/dao/WechatRuleMessageDao.java b/src/main/java/com/lq/dao/WechatRuleMessageDao.java index 48b85e4..8e1eb43 100644 --- a/src/main/java/com/lq/dao/WechatRuleMessageDao.java +++ b/src/main/java/com/lq/dao/WechatRuleMessageDao.java @@ -13,4 +13,6 @@ public interface WechatRuleMessageDao extends BaseDao { List findByWechatRuleId(@Param("wechatRuleId")Long wechatRuleId); + List findByWechatRuleIds(@Param("wechatRuleIds")List wechatRuleIds); + } diff --git a/src/main/java/com/lq/entity/SysUser.java b/src/main/java/com/lq/entity/SysUser.java index 4ae6700..88f97f0 100755 --- a/src/main/java/com/lq/entity/SysUser.java +++ b/src/main/java/com/lq/entity/SysUser.java @@ -12,7 +12,6 @@ public class SysUser extends IdEntity { /** * 登陆名称 */ - private String loginName; /** * 密码 diff --git a/src/main/java/com/lq/entity/WechatInfoSetting.java b/src/main/java/com/lq/entity/WechatInfoSetting.java index fc0a68e..f0bca6d 100644 --- a/src/main/java/com/lq/entity/WechatInfoSetting.java +++ b/src/main/java/com/lq/entity/WechatInfoSetting.java @@ -11,7 +11,18 @@ public class WechatInfoSetting extends IdEntity { * 微信公众号ID */ private Long wechatInfoId; - + /** + * 是否回复 + */ + private Integer openReply; + /** + * 默认回复类型 + */ + private Integer defaultMessageType; + /** + * 关注回复类型 + */ + private Integer followMessageType; public Long getWechatInfoId() { return wechatInfoId; @@ -20,4 +31,28 @@ public class WechatInfoSetting extends IdEntity { public void setWechatInfoId(Long wechatInfoId) { this.wechatInfoId = wechatInfoId; } + + public Integer getOpenReply() { + return openReply; + } + + public void setOpenReply(Integer openReply) { + this.openReply = openReply; + } + + public Integer getDefaultMessageType() { + return defaultMessageType; + } + + public void setDefaultMessageType(Integer defaultMessageType) { + this.defaultMessageType = defaultMessageType; + } + + public Integer getFollowMessageType() { + return followMessageType; + } + + public void setFollowMessageType(Integer followMessageType) { + this.followMessageType = followMessageType; + } } diff --git a/src/main/java/com/lq/wechat/web/WechatController.java b/src/main/java/com/lq/wechat/web/WechatController.java index a08dbc6..59d9c6b 100755 --- a/src/main/java/com/lq/wechat/web/WechatController.java +++ b/src/main/java/com/lq/wechat/web/WechatController.java @@ -8,6 +8,7 @@ import com.lq.code.util.StringUtil; import com.lq.code.web.BaseController; import com.lq.entity.WechatInfo; import com.lq.entity.WechatUser; +import com.lq.wechat.mode.message.BaseMessage; import com.lq.wechat.mode.message.ItemMessage; import com.lq.wechat.mode.message.NewsMessage; import com.lq.wechat.mode.message.TextMessage; @@ -101,29 +102,33 @@ public class WechatController extends BaseController { switch (msgType) { case ConstantSet.MESSAGE_TYPE_TEXT: String content = map.get(WECHAT_CONTENT_KEY); - message = MessageUtil.MessageToXml(wechatRuleService.getByKeyworkdAndWechatInfoId(content,wechatInfo)); - if("1".equals(content)){ - NewsMessage newsMessage=new NewsMessage(); - List items=new ArrayList<>(); - ItemMessage item=new ItemMessage(); - item.setTitle("六弄咖啡馆"); - item.setDescription("两个人在爱在距离面前是否禁受考验?"); - String path = req.getContextPath(); - String basePath = req.getScheme()+"://"+req.getServerName()+":"+req.getServerPort()+path+"/"; - item.setPicUrl("https://img3.doubanio.com/view/photo/l/public/p2367455902.webp"); - item.setUrl("http://www.iqiyi.com/v_19rr95j3vc.html?vfm=2008_aldbd"); - items.add(item); - newsMessage.setArticles(items); - newsMessage.setArticleCount(1); - newsMessage.setCreateTime(System.currentTimeMillis()); - newsMessage.setFromUserName(wechatOpenId); - newsMessage.setMsgType(ConstantSet.MESSAGE_TYPE_NEW); - newsMessage.setToUserName(openId); - message = MessageUtil.MessageToXml(newsMessage); - } else{ - text.setContent("您发送的消息是:" + content); - message = MessageUtil.MessageToXml(text); - } + BaseMessage baseMessage = wechatRuleService.getByKeyworkdAndWechatInfoId(content,wechatInfo); + baseMessage.setCreateTime(System.currentTimeMillis()); + baseMessage.setFromUserName(wechatOpenId); + baseMessage.setToUserName(openId); + message = MessageUtil.MessageToXml(baseMessage); +// if("1".equals(content)){ +// NewsMessage newsMessage=new NewsMessage(); +// List items=new ArrayList<>(); +// ItemMessage item=new ItemMessage(); +// item.setTitle("六弄咖啡馆"); +// item.setDescription("两个人在爱在距离面前是否禁受考验?"); +// String path = req.getContextPath(); +// String basePath = req.getScheme()+"://"+req.getServerName()+":"+req.getServerPort()+path+"/"; +// item.setPicUrl("https://img3.doubanio.com/view/photo/l/public/p2367455902.webp"); +// item.setUrl("http://www.iqiyi.com/v_19rr95j3vc.html?vfm=2008_aldbd"); +// items.add(item); +// newsMessage.setArticles(items); +// newsMessage.setArticleCount(1); +// newsMessage.setCreateTime(System.currentTimeMillis()); +// newsMessage.setFromUserName(wechatOpenId); +// newsMessage.setMsgType(ConstantSet.MESSAGE_TYPE_NEW); +// newsMessage.setToUserName(openId); +// message = MessageUtil.MessageToXml(newsMessage); +// } else{ +// text.setContent("您发送的消息是:" + content); +// message = MessageUtil.MessageToXml(text); +// } break; case ConstantSet.MESSAGE_TYPE_IMAGE: