Commit ea440514 by shenjunjie

Merge branch 'feature' into 'dev'

关闭旧版日志存储

See merge request !42
parents 65372643 b6e91782
package com.zhiwei.brandkbs2.service.impl; package com.zhiwei.brandkbs2.service.impl;
import com.zhiwei.brandkbs2.auth.UserThreadLocal;
import com.zhiwei.brandkbs2.dao.BehaviorDao; import com.zhiwei.brandkbs2.dao.BehaviorDao;
import com.zhiwei.brandkbs2.dao.UserDao; import com.zhiwei.brandkbs2.dao.UserDao;
import com.zhiwei.brandkbs2.easyexcel.dto.ExportBehaviorDTO; import com.zhiwei.brandkbs2.easyexcel.dto.ExportBehaviorDTO;
import com.zhiwei.brandkbs2.enmus.RoleEnum; import com.zhiwei.brandkbs2.enmus.RoleEnum;
import com.zhiwei.brandkbs2.listener.ApplicationProjectListener;
import com.zhiwei.brandkbs2.pojo.Behavior; import com.zhiwei.brandkbs2.pojo.Behavior;
import com.zhiwei.brandkbs2.pojo.User; import com.zhiwei.brandkbs2.pojo.User;
import com.zhiwei.brandkbs2.pojo.UserRole; import com.zhiwei.brandkbs2.pojo.UserRole;
...@@ -13,7 +11,6 @@ import com.zhiwei.brandkbs2.pojo.vo.BehaviorVO; ...@@ -13,7 +11,6 @@ import com.zhiwei.brandkbs2.pojo.vo.BehaviorVO;
import com.zhiwei.brandkbs2.pojo.vo.PageVO; import com.zhiwei.brandkbs2.pojo.vo.PageVO;
import com.zhiwei.brandkbs2.service.BehaviorService; import com.zhiwei.brandkbs2.service.BehaviorService;
import com.zhiwei.brandkbs2.util.MongoUtil; import com.zhiwei.brandkbs2.util.MongoUtil;
import com.zhiwei.brandkbs2.util.Tools;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
...@@ -53,24 +50,24 @@ public class BehaviorServiceImpl implements BehaviorService { ...@@ -53,24 +50,24 @@ public class BehaviorServiceImpl implements BehaviorService {
@Override @Override
public void pushBehaviorOld(Behavior.Operation operation, String module, HttpServletRequest request) { public void pushBehaviorOld(Behavior.Operation operation, String module, HttpServletRequest request) {
try { // try {
String userId = UserThreadLocal.getUserId(); // String userId = UserThreadLocal.getUserId();
String projectId = UserThreadLocal.getProjectId(); // String projectId = UserThreadLocal.getProjectId();
String collectionName = behaviorDao.generateCollectionName(); // String collectionName = behaviorDao.generateCollectionName();
ApplicationProjectListener.getThreadPool().execute(() -> { // ApplicationProjectListener.getThreadPool().execute(() -> {
Behavior behavior = new Behavior(); // Behavior behavior = new Behavior();
behavior.setUserId(userId); // behavior.setUserId(userId);
behavior.setProjectId(projectId); // behavior.setProjectId(projectId);
behavior.setIp(Tools.getIpAddress(request)); // behavior.setIp(Tools.getIpAddress(request));
behavior.setCTime(new Date().getTime()); // behavior.setCTime(new Date().getTime());
behavior.setPage(operation.getPage()); // behavior.setPage(operation.getPage());
behavior.setModule(module); // behavior.setModule(module);
behavior.setBackstage(operation.isBackstage()); // behavior.setBackstage(operation.isBackstage());
behaviorDao.insertOne(behavior, collectionName); // behaviorDao.insertOne(behavior, collectionName);
}); // });
} catch (Exception e) { // } catch (Exception e) {
log.error("用户行为保存失败,失败原因:", e); // log.error("用户行为保存失败,失败原因:", e);
} // }
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment