Commit 06a925ea by songyinghui

feat: 发送特殊欢迎语

parent 8d70441f
......@@ -3,22 +3,15 @@ package com.gic.haoban.manage.service.service.hm.impl;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.enterprise.api.service.LinkService;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.enums.WelcomeRelationStatusEnum;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeTemplateRelationMapper;
import com.gic.haoban.manage.service.entity.hm.TabHaobanWelcomeTemplateRelation;
import com.gic.haoban.manage.service.pojo.bo.hm.HmLinkBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeReferBO;
import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
import com.gic.haoban.manage.service.service.WelcomeService;
import com.gic.haoban.manage.service.service.hm.HmLinkService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import com.gic.redis.data.util.RedisUtil;
import com.github.pagehelper.PageHelper;
......@@ -34,7 +27,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
......@@ -53,11 +45,6 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
@Autowired
private WelcomeService welcomeService;
@Autowired
private HmLinkService linkService;
@Autowired
private HmQrcodeService qrcodeService;
private static final String WELCOME_RELATION_KEY = "HM:welcome:relation:";
private static final Long WELCOME_RELATION_CACHE_TIME = 5 * 60L;
......@@ -65,30 +52,11 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
/**
* 查询欢迎语关联关系
*
* @return
* @retur
*/
@Override
public String queryWelcomeRelation(WelcomeReferBO welcomeReferBo) {
if (welcomeReferBo == null || welcomeReferBo.getType() == null || StringUtils.isBlank(welcomeReferBo.getReferId())) {
return null;
}
try {
if (HmWelcomeReferType.LINK.getCode().equals(welcomeReferBo.getType())) {
HmLinkBO linkBo = linkService.getByLinkIdFormCache(null, null, Long.parseLong(welcomeReferBo.getReferId()));
if (linkBo == null || StringUtils.isBlank(linkBo.getWelcomeId())){
return null;
}
return linkBo.getWelcomeId();
} else if (HmWelcomeReferType.HM.getCode().equals(welcomeReferBo.getType())) {
HmQrcodeBO qrcodeBo = qrcodeService.queryById(Long.parseLong(welcomeReferBo.getReferId()));
if (qrcodeBo == null || StringUtils.isBlank(qrcodeBo.getWelcomeId())){
return null;
}
return qrcodeBo.getWelcomeId();
}
} catch (Exception ex) {
log.error("queryWelcomeRelation err", ex);
}
return null;
}
......
......@@ -25,6 +25,8 @@ import com.gic.haoban.manage.service.entity.TabHaobanWelcomeMedia;
import com.gic.haoban.manage.service.entity.TabHaobanWelcomeSuitRang;
import com.gic.haoban.manage.service.entity.TabMiniprogramSetting;
import com.gic.haoban.manage.service.entity.TabWelcome;
import com.gic.haoban.manage.service.pojo.bo.hm.HmLinkBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.FriendSettingDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.SaveFriendSettingBO;
......@@ -41,6 +43,8 @@ import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
import com.gic.haoban.manage.service.service.KeyDataService;
import com.gic.haoban.manage.service.service.WelcomeService;
import com.gic.haoban.manage.service.service.WelcomeSuitRangService;
import com.gic.haoban.manage.service.service.hm.HmLinkService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
......@@ -89,7 +93,9 @@ public class WelcomeServiceImpl implements WelcomeService {
@Autowired
private KeyDataService keyDataService;
@Autowired
private LinkService linkService;
private HmLinkService linkService;
@Autowired
private HmQrcodeService qrcodeService;
private static final int WELCOME_LIMIT = 50;
private static final int DEPARTMENT_NUM_LIMIT = 10000;
private static final int STAFF_NUM_LIMIT = 2000;
......@@ -669,7 +675,27 @@ public class WelcomeServiceImpl implements WelcomeService {
logger.info("[getMatchWelcomeWithReferId] staffId:{}, wxEnterpriseId:{}, welcomeReferBo:{}",
staffId, wxEnterpriseId, JSON.toJSONString(welcomeReferBo));
String welcomeId = welcomeRelationService.queryWelcomeRelation(welcomeReferBo);
if (welcomeReferBo == null || welcomeReferBo.getType() == null || StringUtils.isBlank(welcomeReferBo.getReferId())) {
return null;
}
String welcomeId = "";
try {
if (HmWelcomeReferType.LINK.getCode().equals(welcomeReferBo.getType())) {
HmLinkBO linkBo = linkService.getByLinkIdFormCache(null, null, Long.parseLong(welcomeReferBo.getReferId()));
if (linkBo == null || StringUtils.isBlank(linkBo.getWelcomeId())){
return null;
}
welcomeId = linkBo.getWelcomeId();
} else if (HmWelcomeReferType.HM.getCode().equals(welcomeReferBo.getType())) {
HmQrcodeBO qrcodeBo = qrcodeService.queryById(Long.parseLong(welcomeReferBo.getReferId()));
if (qrcodeBo == null || StringUtils.isBlank(qrcodeBo.getWelcomeId())){
return null;
}
welcomeId = qrcodeBo.getWelcomeId();
}
} catch (Exception ex) {
logger.error("queryWelcomeRelation err", ex);
}
logger.info("[getMatchWelcomeWithReferId] 获取欢迎语Id:{}, params:{}", welcomeId, JSON.toJSONString(welcomeReferBo));
if (StringUtils.isBlank(welcomeId)){
return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment