提交 54690af0 作者: 沈振路

检测并获取获客链接的方法逻辑调整

上级 70801f0d
......@@ -69,14 +69,15 @@ public interface MaterialCommonMapper {
* @param appointReferral 指定获客链接
* @return 数量
*/
Integer getAppointAuthIdAndAppointReferralCount(@Param("appointReferral") String appointReferral);
String getAppointReferralType(@Param("appointReferral") String appointReferral);
/**
* 获取指定公众号的获客链接列表
*
* @param targetAuthId 指定公众号
* @return 获客链接列表
*/
List<String> getAcquisitionLinkList(@Param("targetAuthId") Long targetAuthId);
List<String> getAcquisitionLinkList(@Param("targetAuthId") Long targetAuthId, @Param("type") String type);
}
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
import com.yaoyaozw.customer.service.CompanyAcquisitionLinkService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -19,12 +20,12 @@ public class CompanyAcquisitionLinkServiceImpl implements CompanyAcquisitionLink
@Override
public String checkAndSearchTargetReferral(String sourceReferral, Long targetAuthId) {
// 查询 sourceReferral 这个链接是不是获客链接,如果不是,直接返回原链接
Integer count = materialCommonMapper.getAppointAuthIdAndAppointReferralCount(sourceReferral);
if (count == null || count == 0) {
String type = materialCommonMapper.getAppointReferralType(sourceReferral);
if (StringUtils.isBlank(type)) {
return sourceReferral;
}
// 原链接是获客链接,查询目标公众号的获客链接
List<String> acquisitionLinkList = materialCommonMapper.getAcquisitionLinkList(targetAuthId);
List<String> acquisitionLinkList = materialCommonMapper.getAcquisitionLinkList(targetAuthId, type);
if (CollectionUtil.isEmpty(acquisitionLinkList)) {
throw new RuntimeException("目标公众号无法获取获客链接");
}
......
......@@ -71,19 +71,21 @@
FROM company_acquisition_link a
LEFT JOIN authorizer_info ai ON ai.appid = a.auth_app_id
WHERE ai.id = #{targetAuthId}
AND a.type = #{type}
AND a.`status` = 1
AND a.is_deleted = 0
</select>
<select id="getAppointAuthIdAndAppointReferralCount" resultType="java.lang.Integer">
<select id="getAppointReferralType" resultType="java.lang.String">
SELECT count(1) FROM company_acquisition_link a
SELECT type FROM company_acquisition_link a
LEFT JOIN authorizer_info ai ON a.auth_app_id = ai.appid
WHERE a.link_url = #{appointReferral}
limit 1
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论