提交正在开发微信功能

master
星期八 5 years ago
parent 7db71716f3
commit 554c914a93
  1. 7
      src/main/java/com/lq/cms/service/WechatRuleService.java
  2. 26
      src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java

@ -32,6 +32,13 @@ public interface WechatRuleService extends BaseService<WechatRule> {
*/ */
WechatRule saveRule(WechatRuleVo wechatRuleVo); WechatRule saveRule(WechatRuleVo wechatRuleVo);
/**
* 更新规则和对应的关键字
* @param wechatRuleVo
* @return
*/
WechatRule updateRule(WechatRuleVo wechatRuleVo);
/** /**
* 通过微信公众号详情ID查找关联规则 * 通过微信公众号详情ID查找关联规则
* @param wechatInfoId * @param wechatInfoId

@ -55,7 +55,8 @@ public class WechatRuleServiceImpl implements WechatRuleService {
wechatKeywordList.forEach(wechatKeyword -> { wechatKeywordList.forEach(wechatKeyword -> {
if (WechatKeywordMatchinTypeEnum.KEYWORD_ALL.getValue().equals( wechatKeyword.getMatchinType())){ if (WechatKeywordMatchinTypeEnum.KEYWORD_ALL.getValue().equals( wechatKeyword.getMatchinType())){
if (wechatKeyword.getKeyword().equals(keyWord)){ 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.setStatus(StatusTypeEnum.STATUS_ACTIVITY_YES.getValue());
wechatRule.setCreateTime(new Date()); wechatRule.setCreateTime(new Date());
wechatRuleDao.save(wechatRule); wechatRuleDao.save(wechatRule);
List<WechatKeyword> wechatKeywordList = wechatRuleVo.getWechatKeywordList(); List<WechatKeyword> wechatKeywordList = wechatRuleVo.getWechatKeywordList();
wechatKeywordList.forEach(wechatKeyword -> { wechatKeywordList.forEach(wechatKeyword -> {
wechatKeyword.setCreateTime(new Date()); wechatKeyword.setCreateTime(new Date());
@ -139,6 +141,28 @@ public class WechatRuleServiceImpl implements WechatRuleService {
return wechatRule; 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<WechatKeyword> 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 @Override
public List<WechatRuleVo> findByWechatInfoId(Long wechatInfoId) { public List<WechatRuleVo> findByWechatInfoId(Long wechatInfoId) {

Loading…
Cancel
Save