Commit ec896b32 by 墨竹

Merge remote-tracking branch 'origin/developer' into developer

parents ff06fcb9 06a925ea
package com.gic.haoban.manage.service.pojo.bo.welcome;
import java.io.Serializable;
/**
* @Author MUSI
* @Date 2022/7/14 3:26 PM
* @Description
* @Version
**/
public class WelcomeReferBO implements Serializable {
private static final long serialVersionUID = 6490051043315353967L;
/**
* @see com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType
*/
private Integer type;
private String referId;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getReferId() {
return referId;
}
public void setReferId(String referId) {
this.referId = referId;
}
}
......@@ -135,7 +135,7 @@ public interface WelcomeService {
* @param referId 活码 / 链接id
* @return
*/
WelcomeDetailBO getMatchWelcomeWithReferId(String staffId, String wxEnterpriseId, String referId);
WelcomeDetailBO getMatchWelcomeWithReferId(String staffId, String wxEnterpriseId, WelcomeReferBO welcomeReferBo);
/**
* 删除欢迎语
......
......@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.hm;
import com.gic.api.base.commons.Page;
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 java.util.List;
......@@ -16,12 +17,10 @@ import java.util.List;
public interface WelcomeRelationService {
/**
* 查询欢迎语关联关系
* @param referId
* @param status
* 查询关联的欢迎语
* @return
*/
HmWelcomeRelationBO queryWelcomeRelation(String referId, Integer status);
String queryWelcomeRelation(WelcomeReferBO welcomeReferBo);
/**
* 条件查询 欢迎语引用列表
......
......@@ -3,13 +3,13 @@ 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.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.enums.WelcomeRelationStatusEnum;
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.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.WelcomeRelationService;
......@@ -27,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;
/**
......@@ -46,7 +45,6 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
@Autowired
private WelcomeService welcomeService;
private static final String WELCOME_RELATION_KEY = "HM:welcome:relation:";
private static final Long WELCOME_RELATION_CACHE_TIME = 5 * 60L;
......@@ -54,24 +52,12 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
/**
* 查询欢迎语关联关系
*
* @param referId
* @param status
* @return
* @retur
*/
@Override
public HmWelcomeRelationBO queryWelcomeRelation(String referId, Integer status) {
String welcomeRelationCacheKey = WELCOME_RELATION_KEY + referId;
HmWelcomeRelationBO cache = RedisUtil.getCache(welcomeRelationCacheKey, HmWelcomeRelationBO.class);
if (cache != null) {
return cache;
}
List<TabHaobanWelcomeTemplateRelation> welcomeTemplateRelations = welcomeTemplateRelationMapper.queryWelTemplateRelation(null, referId, status);
if (CollectionUtils.isEmpty(welcomeTemplateRelations)) {
return null;
}
HmWelcomeRelationBO welcomeRelationBO = EntityUtil.changeEntityByOrika(HmWelcomeRelationBO.class, welcomeTemplateRelations.get(0));
RedisUtil.setCache(welcomeRelationCacheKey, welcomeRelationBO, WELCOME_RELATION_CACHE_TIME, TimeUnit.SECONDS);
return welcomeRelationBO;
public String queryWelcomeRelation(WelcomeReferBO welcomeReferBo) {
return null;
}
/**
......
package com.gic.haoban.manage.service.service.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.StringUtil;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeRemoveCheckDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.QueryWelcomeQDTO;
......@@ -23,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;
......@@ -31,6 +35,7 @@ import com.gic.haoban.manage.service.pojo.bo.welcome.SaveWelcomeMediaBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeListBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeMediaBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeReferBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeSuitDepartmentBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeSuitStaffBO;
import com.gic.haoban.manage.service.pojo.qo.WelcomeInfoQO;
......@@ -38,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;
......@@ -85,7 +92,10 @@ public class WelcomeServiceImpl implements WelcomeService {
private WelcomeRelationService welcomeRelationService;
@Autowired
private KeyDataService keyDataService;
@Autowired
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;
......@@ -661,19 +671,36 @@ public class WelcomeServiceImpl implements WelcomeService {
}
@Override
public WelcomeDetailBO getMatchWelcomeWithReferId(String staffId, String wxEnterpriseId, String referId) {
logger.info("[getMatchWelcomeWithReferId] staffId:{}, wxEnterpriseId:{}, referId:{}",
staffId, wxEnterpriseId, referId);
public WelcomeDetailBO getMatchWelcomeWithReferId(String staffId, String wxEnterpriseId, WelcomeReferBO welcomeReferBo) {
logger.info("[getMatchWelcomeWithReferId] staffId:{}, wxEnterpriseId:{}, welcomeReferBo:{}",
staffId, wxEnterpriseId, JSON.toJSONString(welcomeReferBo));
if (StringUtils.isBlank(referId)){
if (welcomeReferBo == null || welcomeReferBo.getType() == null || StringUtils.isBlank(welcomeReferBo.getReferId())) {
return null;
}
HmWelcomeRelationBO welcomeRelationBO = welcomeRelationService.queryWelcomeRelation(referId, WelcomeRelationStatusEnum.ENABLE.getCode());
if (welcomeRelationBO == 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;
}
TabWelcome tabWelcome = welcomeMapper.selectByPrimaryKey(welcomeRelationBO.getWelcomeId());
TabWelcome tabWelcome = welcomeMapper.selectByPrimaryKey(welcomeId);
return convertWelcomeToBo(tabWelcome);
}
......
......@@ -35,6 +35,7 @@ import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.qdto.hm.WxUserAddLogQDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.enums.WelcomeMediaTypeEnum;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.api.service.CheckQywxSettingApiService;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.api.service.MaterialApiService;
......@@ -52,6 +53,7 @@ import com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo;
import com.gic.haoban.manage.service.pojo.bo.hm.KeyDataLinkBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeMediaBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeReferBO;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.hm.WxUserAddLogService;
import com.gic.haoban.manage.service.util.CommonUtil;
......@@ -577,8 +579,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if (StringUtils.isNotBlank(state)) {
//"HM+id" "DT+key"
log.info("特殊欢迎语 state:{}", state);
String refId = getRefId(state);
welcomeDetailBO = welcomeService.getMatchWelcomeWithReferId(staffId, wxEnterpriseId, refId);
WelcomeReferBO welcomeReferBo = getWelcomeReferBo(state);
welcomeDetailBO = welcomeService.getMatchWelcomeWithReferId(staffId, wxEnterpriseId, welcomeReferBo);
} else {
welcomeDetailBO = welcomeService.getMatchWelcome(staffId, wxEnterpriseId);
}
......@@ -658,6 +660,23 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return refId;
}
private WelcomeReferBO getWelcomeReferBo(String state){
WelcomeReferBO welcomeReferBo = new WelcomeReferBO();
String id = state.substring(2);
if (state.contains("HM")) {
welcomeReferBo.setType(HmWelcomeReferType.HM.getCode());
welcomeReferBo.setReferId(id);
} else if (state.contains("DT")) {
KeyDataLinkBO dataForHmLink = keyDataService.getDataForHmLink(id);
if (dataForHmLink != null) {
welcomeReferBo.setType(HmWelcomeReferType.LINK.getCode());
welcomeReferBo.setReferId(Convert.toStr(dataForHmLink.getLinkId()));
}
}
return welcomeReferBo;
}
private void attachmentAddImage(List<QywxExternalMessageBaseDTO> attachments, WelcomeMediaBO media, WxEnterpriseDTO wxEnterpriseDTO) {
String mediaUrl = media.getMediaUrl();
String[] arr = mediaUrl.split("/");
......
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