diff --git a/src/main/java/com/lq/cms/service/SysRoleService.java b/src/main/java/com/lq/cms/service/SysRoleService.java index 2f7850c..8809433 100755 --- a/src/main/java/com/lq/cms/service/SysRoleService.java +++ b/src/main/java/com/lq/cms/service/SysRoleService.java @@ -12,14 +12,37 @@ import java.util.List; * 角色事务类 */ public interface SysRoleService extends BaseService { - + /** + * 参数统计 + * @param vo + * @return + */ Integer count(SysRoleVo vo); + /** + * 参数分页查询 + * @param vo + * @return + */ List findListPage(SysRoleVo vo); + /** + * + * @param userId + * @return + */ List findAllRoleVo(Long userId); + /** + * 通过用户ID查询角色 + * @param userId + * @return + */ List findByUserId(Long userId); + /** + * 通过角色ID删除角色 + * @param roleId + */ void deleteRole(Long roleId); } diff --git a/src/main/java/com/lq/code/annotation/Length.java b/src/main/java/com/lq/code/annotation/Length.java index 017ce4f..c8be883 100755 --- a/src/main/java/com/lq/code/annotation/Length.java +++ b/src/main/java/com/lq/code/annotation/Length.java @@ -4,6 +4,7 @@ import java.lang.annotation.*; /** * Created by qi_liang on 2018/4/26. + * @author qi */ @Documented @Target(ElementType.FIELD) diff --git a/src/main/java/com/lq/code/entity/AjaxResult.java b/src/main/java/com/lq/code/entity/AjaxResult.java index ad14119..5bcf88a 100755 --- a/src/main/java/com/lq/code/entity/AjaxResult.java +++ b/src/main/java/com/lq/code/entity/AjaxResult.java @@ -2,13 +2,20 @@ package com.lq.code.entity; /** * Created by qi on 2018-1-9. + * @author qi */ public class AjaxResult { - //操作结果 - private Boolean success; - //提示信息 + /** + * 操作结果 + */ + private boolean success; + /** + * 提示信息 + */ private String msg; - //返回数据 + /** + * 返回数据 + */ private Object data; public AjaxResult() { @@ -46,4 +53,20 @@ public class AjaxResult { public void setData(Object data) { this.data = data; } + + public static AjaxResult getInstance(){ + + return new AjaxResult(); + } + + public static AjaxResult getSuccessInstance(){ + + return new AjaxResult(); + } + + public static AjaxResult getSuccessInstance(Object data){ + AjaxResult ajaxResult = new AjaxResult(); + ajaxResult.setData(data); + return ajaxResult; + } } diff --git a/src/main/java/com/lq/jms/service/impl/ProductServiceImpl.java b/src/main/java/com/lq/jms/service/impl/ProductServiceImpl.java index a66e1f6..3fc009a 100644 --- a/src/main/java/com/lq/jms/service/impl/ProductServiceImpl.java +++ b/src/main/java/com/lq/jms/service/impl/ProductServiceImpl.java @@ -11,7 +11,7 @@ import org.springframework.stereotype.Service; @Service public class ProductServiceImpl implements ProductService { - @Autowired + @Autowired(required = false) private JmsTemplate jmsTemplate; diff --git a/src/main/java/com/lq/wechat/web/WechatController.java b/src/main/java/com/lq/wechat/web/WechatController.java index 59d9c6b..86ccb02 100755 --- a/src/main/java/com/lq/wechat/web/WechatController.java +++ b/src/main/java/com/lq/wechat/web/WechatController.java @@ -9,8 +9,6 @@ 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; import com.lq.wechat.util.CheckUtil; import com.lq.wechat.util.ConstantSet; @@ -26,8 +24,6 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; import java.util.Map; /** @@ -92,99 +88,79 @@ public class WechatController extends BaseController { //微信公众号详情 WechatInfo wechatInfo = wechatInfoService.getByOpenId(wechatOpenId); - TextMessage text = new TextMessage(); - text.setFromUserName(wechatOpenId); - text.setToUserName(openId); - text.setMsgType(ConstantSet.MESSAGE_TYPE_TEXT); - - text.setCreateTime(System.currentTimeMillis()); - - switch (msgType) { - case ConstantSet.MESSAGE_TYPE_TEXT: - String content = map.get(WECHAT_CONTENT_KEY); - 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: - - text.setContent("您发送的消息是:" + "图片"); - message = MessageUtil.MessageToXml(text); - break; - case ConstantSet.MESSAGE_TYPE_VIDEO: - text.setContent("您发送的消息是:" + "视频"); - message = MessageUtil.MessageToXml(text); - break; - case ConstantSet.MESSAGE_TYPE_SHORTVIDEO: - text.setContent("您发送的消息是:" + "小视频"); - message = MessageUtil.MessageToXml(text); - break; - case ConstantSet.MESSAGE_TYPE_VOICE: - text.setContent("您发送的消息是:" + "语音"); - message = MessageUtil.MessageToXml(text); - break; - case ConstantSet.MESSAGE_TYPE_LINK: - text.setContent("您发送的消息是:" + "链接"); - message = MessageUtil.MessageToXml(text); - break; - case ConstantSet.MESSAGE_TYPE_LOCATION: - text.setContent("您发送的消息是:" + "位置"); - message = MessageUtil.MessageToXml(text); - break; - case ConstantSet.MESSAGE_TYPE_EVENT: - String event = map.get("Event"); - switch (event) { - case ConstantSet.EVENT_TYPE_SUBSCRIBE: - LOGGER.info("微信公众号关注事件:"+wechatInfo.getWechatName()); - //公众号在认证的情况下才可以获取用户信息 - if (WechatInfoCertificationTypeEnum.CERTIFICATION_YES.getValue().equals(wechatInfo.getCertification())) { - WechatUser wechatUser = wechatUserService.saveWechatUser(openId, wechatInfo); - } - - break; - case ConstantSet.EVENT_TYPE_UNSUBSCRIBE: - ; - break; - case ConstantSet.EVENT_TYPE_CLICK: - //自定义菜单点击事件KEY值 - String eventKey = map.get(ConstantSet.EVENT_CLICK_KEY); - - ; - break; - default: - break; - } - - break; - - default: - text.setContent("您发送的消息是:" + "无法理解"); - message = MessageUtil.MessageToXml(text); - break; + if (wechatInfo!=null) { + TextMessage text = new TextMessage(); + text.setFromUserName(wechatOpenId); + text.setToUserName(openId); + text.setMsgType(ConstantSet.MESSAGE_TYPE_TEXT); + + text.setCreateTime(System.currentTimeMillis()); + + switch (msgType) { + case ConstantSet.MESSAGE_TYPE_TEXT: + String content = map.get(WECHAT_CONTENT_KEY); + BaseMessage baseMessage = wechatRuleService.getByKeyworkdAndWechatInfoId(content, wechatInfo); + baseMessage.setCreateTime(System.currentTimeMillis()); + baseMessage.setFromUserName(wechatOpenId); + baseMessage.setToUserName(openId); + message = MessageUtil.MessageToXml(baseMessage); + break; + case ConstantSet.MESSAGE_TYPE_IMAGE: + + text.setContent("您发送的消息是:" + "图片"); + message = MessageUtil.MessageToXml(text); + break; + case ConstantSet.MESSAGE_TYPE_VIDEO: + text.setContent("您发送的消息是:" + "视频"); + message = MessageUtil.MessageToXml(text); + break; + case ConstantSet.MESSAGE_TYPE_SHORTVIDEO: + text.setContent("您发送的消息是:" + "小视频"); + message = MessageUtil.MessageToXml(text); + break; + case ConstantSet.MESSAGE_TYPE_VOICE: + text.setContent("您发送的消息是:" + "语音"); + message = MessageUtil.MessageToXml(text); + break; + case ConstantSet.MESSAGE_TYPE_LINK: + text.setContent("您发送的消息是:" + "链接"); + message = MessageUtil.MessageToXml(text); + break; + case ConstantSet.MESSAGE_TYPE_LOCATION: + text.setContent("您发送的消息是:" + "位置"); + message = MessageUtil.MessageToXml(text); + break; + case ConstantSet.MESSAGE_TYPE_EVENT: + String event = map.get("Event"); + switch (event) { + case ConstantSet.EVENT_TYPE_SUBSCRIBE: + LOGGER.info("微信公众号关注事件:" + wechatInfo.getWechatName()); + //公众号在认证的情况下才可以获取用户信息 + if (WechatInfoCertificationTypeEnum.CERTIFICATION_YES.getValue().equals(wechatInfo.getCertification())) { + WechatUser wechatUser = wechatUserService.saveWechatUser(openId, wechatInfo); + } + + break; + case ConstantSet.EVENT_TYPE_UNSUBSCRIBE: + ; + break; + case ConstantSet.EVENT_TYPE_CLICK: + //自定义菜单点击事件KEY值 + String eventKey = map.get(ConstantSet.EVENT_CLICK_KEY); + + ; + break; + default: + break; + } + + break; + + default: + text.setContent("您发送的消息是:" + "无法理解"); + message = MessageUtil.MessageToXml(text); + break; + } } } catch (Exception e) {