|
|
@ -8,11 +8,12 @@ import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.pointcommons.tools.annotation.RecordUserBehavior; |
|
|
|
import com.elink.esua.epdc.pointcommons.tools.dto.BehaviorResultDto; |
|
|
|
import com.elink.esua.epdc.pointcommons.tools.feign.PointsCommonFeignClient; |
|
|
|
import com.elink.esua.epdc.pointcommons.tools.rocketmq.dto.BehaviorDto; |
|
|
|
import com.elink.esua.epdc.pointcommons.tools.rocketmq.producer.PointsProducer; |
|
|
|
import com.elink.esua.epdc.pointcommons.tools.annotation.RecordUserBehavior; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
import org.apache.logging.log4j.Logger; |
|
|
@ -36,6 +37,7 @@ import java.util.Date; |
|
|
|
*/ |
|
|
|
@Aspect |
|
|
|
@Component |
|
|
|
@Slf4j |
|
|
|
public class UserBehaviorAop { |
|
|
|
|
|
|
|
|
|
|
@ -134,6 +136,7 @@ public class UserBehaviorAop { |
|
|
|
Result<BehaviorResultDto> result = pointsFeignClient.getBehaviorCodeInfo(behaviorCode); |
|
|
|
BehaviorResultDto behaviorResultDto = result.getData(); |
|
|
|
if (behaviorResultDto == null) { |
|
|
|
log.info("根据行为编码获取编码动作失败!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
behaviorRecodingTime = behaviorResultDto.getBehaviorRecordingTime(); |
|
|
@ -154,7 +157,8 @@ public class UserBehaviorAop { |
|
|
|
String referenceId = this.covertData(recordUserBehavior.referenceId(), args, argNames); |
|
|
|
String userId = this.covertData(recordUserBehavior.userId(), args, argNames); |
|
|
|
String gridId = this.covertData(recordUserBehavior.gridId(), args, argNames); |
|
|
|
if(StringUtils.isBlank(userId) || StringUtils.isBlank(referenceId)){ |
|
|
|
if(StringUtils.isBlank(userId) || StringUtils.isBlank(referenceId) || StringUtils.isBlank(gridId)){ |
|
|
|
log.info("用户ID,业务ID,网格ID转换失败!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
BehaviorDto behaviorDto = new BehaviorDto(); |
|
|
@ -163,6 +167,7 @@ public class UserBehaviorAop { |
|
|
|
behaviorDto.setUserId(userId); |
|
|
|
behaviorDto.setGridId(Long.parseLong(gridId)); |
|
|
|
behaviorDto.setOperationTime(new Date()); |
|
|
|
log.info("动作发送信息:动作编码:"+behaviorCode+" 用户ID:"+userId+",业务ID:"+referenceId+",网格ID:"+gridId+",操作时间:"+behaviorDto.getOperationTime()); |
|
|
|
//发送mq
|
|
|
|
pointsProducer.sendMessage(RocketMqConstant.MQ_TOPIC_POINTS, RocketMqConstant.MQ_TAG_POINTS, referenceId, JSONObject.toJSONString(behaviorDto)); |
|
|
|
} |
|
|
|