| | |
| | | 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) {
|
| | |
| | | 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);
|
| | | }
|
| | |
|
| | | }
|