|
@@ -29,7 +29,6 @@ import com.citu.module.menduner.system.enums.MathOperationEnum;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeasy.rules.api.Facts;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -150,8 +149,7 @@ public class EventTrackServiceImpl implements EventTrackService {
|
|
|
|
|
|
@Override
|
|
|
@DSTransactional
|
|
|
- public List<EventTrackPointRespVO> trigger(Long userId, String url, String scene, PointBizTypeEnum bizType) {
|
|
|
- List<EventTrackPointRespVO> respVOList = new ArrayList<>();
|
|
|
+ public List<EventTrackPointRespVO> trigger(Long userId, String url, String scene, PointBizTypeEnum bizType) {List<EventTrackPointRespVO> respVOList = new ArrayList<>();
|
|
|
// 获取指定URL的积分规则配置列表,因为是查询地址的配置,所以不需要带上动态的场景
|
|
|
List<PointRuleConfigDO> configList = ruleConfigService.getByUrlList(url);
|
|
|
|
|
@@ -163,7 +161,7 @@ public class EventTrackServiceImpl implements EventTrackService {
|
|
|
// 遍历处理每个积分规则配置
|
|
|
for (PointRuleConfigDO config : configList) {
|
|
|
// 处理单个积分规则
|
|
|
- EventTrackPointRespVO respVO = processPointRule(config, userId, url, bizType);
|
|
|
+ EventTrackPointRespVO respVO = processPointRule(config, userId, url, scene, bizType);
|
|
|
// 将处理结果添加到响应列表中
|
|
|
respVOList.add(respVO);
|
|
|
}
|
|
@@ -182,10 +180,10 @@ public class EventTrackServiceImpl implements EventTrackService {
|
|
|
* @return EventTrackPointRespVO
|
|
|
**/
|
|
|
private EventTrackPointRespVO processPointRule(PointRuleConfigDO config,
|
|
|
- Long userId, String url, PointBizTypeEnum bizType) {
|
|
|
+ Long userId, String url, String scene, PointBizTypeEnum bizType) {
|
|
|
EventTrackPointRespVO respVO = new EventTrackPointRespVO();
|
|
|
// 获取触发规则的执行上下文信息
|
|
|
- Map<String, Object> triggerMap = getRuleContextMap(userId, config.getUrl(), config.getTriggerRule());
|
|
|
+ Map<String, Object> triggerMap = getRuleContextMap(userId, config.getUrl(), scene, config.getTriggerRule());
|
|
|
// 创建积分规则对象
|
|
|
PointRule pointRule = createPointRule(config, triggerMap, null);
|
|
|
|
|
@@ -263,13 +261,13 @@ public class EventTrackServiceImpl implements EventTrackService {
|
|
|
* @param url url
|
|
|
* @return Map<String, Object>
|
|
|
**/
|
|
|
- private Map<String, Object> getRuleContextMap(Long userId, String url, Condition condition) {
|
|
|
+ private Map<String, Object> getRuleContextMap(Long userId, String url, String scene, Condition condition) {
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
List<String> keyList = EasyRulesEngine.extractUniqueKeys(condition);
|
|
|
|
|
|
for (String key : keyList) {
|
|
|
if (!map.containsKey(key)) {
|
|
|
- map.put(key, eventRecordService.getEventCount(userId, url, key));
|
|
|
+ map.put(key, eventRecordService.getEventCount(userId, url, scene, key));
|
|
|
}
|
|
|
}
|
|
|
|