zoujiajian преди 2 години
родител
ревизия
34bfa17e52

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/mapper/corp/CorpUserMapper.java

@@ -17,4 +17,7 @@ public interface CorpUserMapper extends BaseMapper<CorpUser> {
 	@Select("select u.id from (select corp_user_id from corp_user_auth where wx_corp_id = #{wxCorpId} and external_userid = #{corpUserId} limit 1) ca inner join corp_user cu on cu.id = ca.corp_user_id and cu.unionid != ''" +
 			" inner join user u on u.uionid = cu.unionid")
 	Long selectUserIdByCropUserId(@Param("wxCorpId") Long wxCorpId, @Param("corpUserId") String corpUserId);
+
+	@Select("select external_userid from (select id from corp_user where unionid = #{unionid} limit 1 ) cu inner join corp_user_auth ca on ca.corp_user_id = cu.id limit 1")
+	String selectUserExternalUserId(String unionid);
 }

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/mapper/corp/CorpUserTagMapper.java

@@ -29,5 +29,5 @@ public interface CorpUserTagMapper extends BaseMapper<CorpUserTag> {
 
 	Page<CorpUserIntentionView> getCorpUserIntentionView(@Param("page") Page<CorpUserIntentionView> page, @Param("userId") Long userId, @Param("nickname") String nickname, @Param("tagIdStr") String tagId, @Param("thisDate") String date, @Param("intention") Integer intention);
 
-	List<CorpUserTag> selectIntentionUserTag(String groupName);
+	List<CorpUserTag> selectIntentionUserTag(@Param("externalUserId") String externalUserId, @Param("groupName") String groupName);
 }

+ 1 - 1
netflix-dao/src/main/resources/mapper/CorpUserFollowRelationMapper.xml

@@ -135,6 +135,6 @@
               where unionid = #{unionId} limit 1) cu
                  inner join corp_user_auth ca on ca.corp_user_id = cu.id
                  inner join corp_user_follow_relation cufr on cufr.corp_user_id = ca.external_userid
-        where cufr.follow_id = #{followId}
+        where cufr.follow_id = #{followId} limit 1
     </select>
 </mapper>

+ 1 - 0
netflix-dao/src/main/resources/mapper/CorpUserTagMapper.xml

@@ -131,5 +131,6 @@
         from corp_user_tag ct
                  inner join corp_user_follow_relation cufr on cufr.id = ct.relation_id
         where ct.group_name = #{groupName}
+        and cufr.corp_user_id = #{externalUserId}
     </select>
 </mapper>

+ 5 - 2
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpServiceImpl.java

@@ -401,8 +401,11 @@ public class CorpServiceImpl implements CorpService {
 		CorpUserPayIntention.Intention intention = CorpUserPayIntention.Intention.values()[corpUserPayIntention.getIntention()];
 		String tagName = intention.getTagName();
 		String tagId = intention.getTagId();
-
-		List<CorpUserTag> corpUserTags = corpUserTagMapper.selectIntentionUserTag(Constant.EP_INTENTION_GROUP_NAME);
+		String externalUserId = corpUserMapper.selectUserExternalUserId(corpUserPayIntention.getUnionId());
+		if (StrUtil.isEmpty(externalUserId)) {
+			return;
+		}
+		List<CorpUserTag> corpUserTags = corpUserTagMapper.selectIntentionUserTag(externalUserId, Constant.EP_INTENTION_GROUP_NAME);
 		//是否存在对应标签
 		AtomicBoolean isExistIntentionTag = new AtomicBoolean(false);
 		if (CollUtil.isNotEmpty(corpUserTags)) {

+ 8 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -43,6 +43,7 @@ import com.cyksj.mapper.*;
 import com.cyksj.mapper.channel.ChannelPopularizeMapper;
 import com.cyksj.mapper.channel.ShopConfigMapper;
 import com.cyksj.mapper.corp.CorpInteractiveUserOrderRelationMapper;
+import com.cyksj.mapper.corp.CorpUserMapper;
 import com.cyksj.mapper.corp.CorpUserTagMapper;
 import com.cyksj.mapper.manage.coupon.CouponDistributePopularizeMapper;
 import com.cyksj.mapper.manage.coupon.CouponMapper;
@@ -290,6 +291,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 
 	private final CorpUserTagMapper corpUserTagMapper;
 
+	private final CorpUserMapper corpUserMapper;
+
 	private final WxCorpOps wxCorpOps;
 
 	private final List<String> noChekGoodsTemp = List.of("Apple One", "Youtube", "Spotify");
@@ -3102,7 +3105,11 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		if (goodsDon != null && goodsDon.getId() == 15) {
 			User user = userMapper.selectById(userId);
 			if (user != null && StrUtil.isNotBlank(user.getUnionid())) {
-				List<CorpUserTag> corpUserTags = corpUserTagMapper.selectIntentionUserTag(Constant.EP_INTENTION_GROUP_NAME);
+				String externalUserId = corpUserMapper.selectUserExternalUserId(user.getUnionid());
+				if (StrUtil.isEmpty(externalUserId)) {
+					return;
+				}
+				List<CorpUserTag> corpUserTags = corpUserTagMapper.selectIntentionUserTag(externalUserId, Constant.EP_INTENTION_GROUP_NAME);
 				if (CollUtil.isNotEmpty(corpUserTags)) {
 					//删除之前的意向标签
 					corpUserTags.forEach(userTag -> {