Commit 4dd0400b by shenjunjie

2022/10/19 10:24

parent 9bba5206
...@@ -821,6 +821,7 @@ public class ChannelServiceImpl implements ChannelService { ...@@ -821,6 +821,7 @@ public class ChannelServiceImpl implements ChannelService {
@Override @Override
public PageVO<ChannelVO> getChannelList(int page, int pageSize, String keyword, List<String> platforms, List<Integer> emotions, List<String> mediaTypes, public PageVO<ChannelVO> getChannelList(int page, int pageSize, String keyword, List<String> platforms, List<Integer> emotions, List<String> mediaTypes,
Integer[] articlesCount, String sorter) { Integer[] articlesCount, String sorter) {
long s0 = System.currentTimeMillis();
String projectId = UserThreadLocal.getProjectId(); String projectId = UserThreadLocal.getProjectId();
String contendId = "0"; String contendId = "0";
String linkedGroupId = projectService.getProjectByContendId(projectId, contendId).getBrandLinkedGroupId(); String linkedGroupId = projectService.getProjectByContendId(projectId, contendId).getBrandLinkedGroupId();
...@@ -841,7 +842,11 @@ public class ChannelServiceImpl implements ChannelService { ...@@ -841,7 +842,11 @@ public class ChannelServiceImpl implements ChannelService {
long total = channelDao.count(query); long total = channelDao.count(query);
mongoUtil.start(page, pageSize, query); mongoUtil.start(page, pageSize, query);
channelDao.addSort(query, sorter); channelDao.addSort(query, sorter);
long s1 = System.currentTimeMillis();
log.info("渠道准备查询耗时:" + (s1 - s0));
List<Channel> channelList = channelDao.findList(query); List<Channel> channelList = channelDao.findList(query);
long s2 = System.currentTimeMillis();
log.info("渠道查询耗时:" + (s2 - s1));
List<CompletableFuture<JSONObject>> futureList = channelList.stream().map(channel -> CompletableFuture.supplyAsync(() -> { List<CompletableFuture<JSONObject>> futureList = channelList.stream().map(channel -> CompletableFuture.supplyAsync(() -> {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("id", channel.getId()); result.put("id", channel.getId());
...@@ -858,6 +863,8 @@ public class ChannelServiceImpl implements ChannelService { ...@@ -858,6 +863,8 @@ public class ChannelServiceImpl implements ChannelService {
// result.put("lastArticle", markDataService.getLastMarkUrl(projectId, linkedGroupId, contendId, channel.getPlatform(), channel.getRealSource(), channel.getSource())); // result.put("lastArticle", markDataService.getLastMarkUrl(projectId, linkedGroupId, contendId, channel.getPlatform(), channel.getRealSource(), channel.getSource()));
// return result; // return result;
// }).collect(Collectors.toList()); // }).collect(Collectors.toList());
long s3 = System.currentTimeMillis();
log.info("渠道发文查询耗时:" + (s3 - s2));
return PageVO.createPageVo(total, page, pageSize, return PageVO.createPageVo(total, page, pageSize,
channelList.stream().map(channel -> ChannelVO.createFromChannelInfo(idMap.get(channel.getId()), projectId)).collect(Collectors.toList())); channelList.stream().map(channel -> ChannelVO.createFromChannelInfo(idMap.get(channel.getId()), projectId)).collect(Collectors.toList()));
} }
......
...@@ -214,8 +214,8 @@ public class UserServiceImpl implements UserService { ...@@ -214,8 +214,8 @@ public class UserServiceImpl implements UserService {
if (null == userOld) { if (null == userOld) {
ExceptionCast.cast(LoginCodeEnum.LOGIN_USERNAME_OR_PASSWORD_ERROR); ExceptionCast.cast(LoginCodeEnum.LOGIN_USERNAME_OR_PASSWORD_ERROR);
} }
if (userOld.isBindUser()) { if (userOld.isBindUser() && !userOld.getNick().contains("admin")) {
ExceptionCast.cast(LoginCodeEnum.LOGIN_WX_WITH_USER_ERROR); ExceptionCast.cast(LoginCodeEnum.LOGIN_USER_WITH_WX_ERROR);
} }
User user = userDao.findOneById(UserThreadLocal.getUserId()); User user = userDao.findOneById(UserThreadLocal.getUserId());
if (null == user) { if (null == user) {
...@@ -289,7 +289,9 @@ public class UserServiceImpl implements UserService { ...@@ -289,7 +289,9 @@ public class UserServiceImpl implements UserService {
// if (null == userId || null == projectId) { // if (null == userId || null == projectId) {
// ExceptionCast.cast(LoginCodeEnum.LOGIN_EXPIRED_ERROR); // ExceptionCast.cast(LoginCodeEnum.LOGIN_EXPIRED_ERROR);
// } // }
return queryUserInfo(UserThreadLocal.getUserId(), UserThreadLocal.getProjectId()).toMap(); Map<String,Object> userInfoMap = queryUserInfo(UserThreadLocal.getUserId(), UserThreadLocal.getProjectId()).toMap();
return userInfoMap;
} }
private User createNewUser(UserDTO userDTO) { private User createNewUser(UserDTO userDTO) {
......
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