Jelajahi Sumber

购买过设备的用户不打上标签

zoujiajian 2 tahun lalu
induk
melakukan
034cb0747b

+ 21 - 1
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpServiceImpl.java

@@ -16,6 +16,7 @@ import com.cyksj.common.util.corp.WxCryptUtil;
 import com.cyksj.config.corp.WeChatCorpFactory;
 import com.cyksj.config.corp.YHLXWxCorpConfig;
 import com.cyksj.dto.CorpOauth2UserInfo;
+import com.cyksj.mapper.OrderDonMapper;
 import com.cyksj.mapper.corp.*;
 import com.cyksj.model.dto.WxCorpEncryptDto;
 import com.cyksj.model.entity.*;
@@ -90,6 +91,9 @@ public class CorpServiceImpl implements CorpService {
 	@Autowired
 	private CorpUserTagMapper corpUserTagMapper;
 
+	@Autowired
+	private OrderDonMapper orderDonMapper;
+
 	@Autowired
 	private CorpUserFollowRelationMapper corpUserFollowRelationMapper;
 
@@ -425,7 +429,23 @@ public class CorpServiceImpl implements CorpService {
 			});
 		}
 		if (!isExistIntentionTag.get()) {
-			insertUserIntentionTag(corpUserPayIntention, tagId, tagName);
+			CorpUser corpUser = corpUserMapper.selectOne(Wrappers.lambdaQuery(CorpUser.class)
+					.eq(CorpUser::getUnionid, corpUserPayIntention.getUnionId())
+					.last("limit 1"));
+			Boolean isPayEp = false;
+			if (corpUser != null && corpUser.getUserId() != 0) {
+				//是否买过设备
+				Integer selectCount = orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
+						.eq(OrderDon::getGoodsId, 15)
+						.eq(OrderDon::getUserId, corpUser.getUserId())
+						.notIn(OrderDon::getStatus, Constant.noOrderAllStatus));
+				if (selectCount > 0) {
+					isPayEp = true;
+				}
+			}
+			if (!isPayEp) {
+				insertUserIntentionTag(corpUserPayIntention, tagId, tagName);
+			}
 		}
 	}