From 8b2191df2f7d94aa299bd43dcbe97c94e5a61bbd Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 20 十一月 2019 14:53:34 +0800
Subject: [PATCH] RocketMQ的消息整改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java
index fbd8b64..e522410 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java
@@ -9,12 +9,16 @@
 import com.yeshi.fanli.dao.mybatis.user.UserActiveLogMapper;
 import com.yeshi.fanli.entity.bus.user.UserActiveLog;
 import com.yeshi.fanli.service.inter.user.UserActiveLogService;
+import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
 
 @Service
 public class UserActiveLogServiceImpl implements UserActiveLogService {
 
 	@Resource
 	private UserActiveLogMapper userActiveLogMapper;
+	
+	@Resource
+	private UserInfoExtraService userInfoExtraService;
 
 	@Override
 	public void addUserActiveLog(UserActiveLog userActiveLog) {
@@ -28,13 +32,33 @@
 			userActiveLog.setCreateTime(new Date());
 			userActiveLog.setUpdateTime(new Date());
 			userActiveLogMapper.insertSelective(userActiveLog);
+			// 鏇存柊鏈�鏂版椿璺冩椂闂�
+			userInfoExtraService.updateActiveTime(userActiveLog.getUid() , new Date());
+		} else if (latestLog != null) {
+			// 濡傛灉璁惧 锛岀増鏈紝娓犻亾鏈夊彉鍖栧垯闇�瑕佹洿鏀�
+			String oldIdentify = latestLog.getDevice() + "#" + latestLog.getVersionCode() + "#"
+					+ latestLog.getChannel();
+			String newIdentify = userActiveLog.getDevice() + "#" + userActiveLog.getVersionCode() + "#"
+					+ userActiveLog.getChannel();
+			if (!oldIdentify.equalsIgnoreCase(newIdentify)) {// 璁惧淇℃伅鍙樺寲瑕佽褰曚俊鎭�
+				userActiveLog.setCreateTime(new Date());
+				userActiveLog.setUpdateTime(new Date());
+				userActiveLogMapper.insertSelective(userActiveLog);
+				// 鏇存柊鏈�鏂版椿璺冩椂闂�
+				userInfoExtraService.updateActiveTime(userActiveLog.getUid() , new Date());
+			}
 		}
 	}
 
 	@Override
 	public UserActiveLog getUserLatestActiveInfo(Long uid) {
-
 		return userActiveLogMapper.selectLatestByUid(uid);
 	}
 
+	@Override
+	public UserActiveLog getFirstActiveInfo(Long uid) {
+
+		return userActiveLogMapper.selectFirstActiveInfo(uid);
+	}
+
 }

--
Gitblit v1.8.0