diff --git a/src/main/java/com/lq/cms/service/WechatRuleService.java b/src/main/java/com/lq/cms/service/WechatRuleService.java index b335fdf..2a99896 100644 --- a/src/main/java/com/lq/cms/service/WechatRuleService.java +++ b/src/main/java/com/lq/cms/service/WechatRuleService.java @@ -32,6 +32,13 @@ public interface WechatRuleService extends BaseService { */ WechatRule saveRule(WechatRuleVo wechatRuleVo); + /** + * 更新规则和对应的关键字 + * @param wechatRuleVo + * @return + */ + WechatRule updateRule(WechatRuleVo wechatRuleVo); + /** * 通过微信公众号详情ID查找关联规则 * @param wechatInfoId diff --git a/src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java b/src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java index 6f595c5..151b447 100644 --- a/src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java @@ -55,7 +55,8 @@ public class WechatRuleServiceImpl implements WechatRuleService { wechatKeywordList.forEach(wechatKeyword -> { if (WechatKeywordMatchinTypeEnum.KEYWORD_ALL.getValue().equals( wechatKeyword.getMatchinType())){ if (wechatKeyword.getKeyword().equals(keyWord)){ - + WechatMessage wechatMessage = wechatMessageDao.findByRuleId(wechatRule.getId()); + wechatMessageAtomicReference.set(wechatMessage); } } }); @@ -115,6 +116,7 @@ public class WechatRuleServiceImpl implements WechatRuleService { wechatRule.setStatus(StatusTypeEnum.STATUS_ACTIVITY_YES.getValue()); wechatRule.setCreateTime(new Date()); wechatRuleDao.save(wechatRule); + List wechatKeywordList = wechatRuleVo.getWechatKeywordList(); wechatKeywordList.forEach(wechatKeyword -> { wechatKeyword.setCreateTime(new Date()); @@ -139,6 +141,28 @@ public class WechatRuleServiceImpl implements WechatRuleService { return wechatRule; } + @Override + public WechatRule updateRule(WechatRuleVo wechatRuleVo) { + Subject subject= SecurityUtils.getSubject(); + SysUser loginUser=(SysUser) subject.getPrincipal(); + WechatRule wechatRule = wechatRuleDao.findOne(wechatRuleVo.getId()); + BeanUtil.copyNotNull(wechatRule,wechatRuleVo); + wechatRule.setCreateUserId(loginUser.getId()); + wechatRule.setStatus(StatusTypeEnum.STATUS_ACTIVITY_YES.getValue()); + wechatRule.setCreateTime(new Date()); + wechatRuleDao.update(wechatRule); + wechatKeywordDao.deleteByWechatRuleId(wechatRule.getId()); + List wechatKeywordList = wechatRuleVo.getWechatKeywordList(); + wechatKeywordList.forEach(wechatKeyword -> { + wechatKeyword.setWechatRuleId(wechatRule.getId()); + wechatKeyword.setStatus(StatusTypeEnum.STATUS_ACTIVITY_YES.getValue()); + wechatKeyword.setCreateTime(new Date()); + wechatKeywordDao.save(wechatKeyword); + }); + + return null; + } + @Override public List findByWechatInfoId(Long wechatInfoId) {