Commit a9a001a4 by shenjunjie

Merge branch 'feature' into 'dev'

调整用户查询key

See merge request !43
parents ea440514 7e7903c4
......@@ -37,7 +37,7 @@ public class GenericAttribute {
// es platform_id
public static final String ES_PLATFORM_ID = "platform_id";
// es channel_influence
public static final String ES_CHANNEL_INDEX = "channel_influence";
public static final String ES_CHANNEL_INFLUENCE = "channel_influence";
/**
* es rootSource
**/
......
......@@ -2,6 +2,7 @@ package com.zhiwei.brandkbs2.pojo;
import com.zhiwei.brandkbs2.enmus.RoleEnum;
import com.zhiwei.brandkbs2.pojo.dto.UserDTO;
import com.zhiwei.brandkbs2.util.Tools;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
......@@ -29,6 +30,8 @@ public class UserRole {
private final static int DEFAULT_ROLE_ID = RoleEnum.CUSTOMER.getState();
private final static int MAX_EXPORT_LIMIT = 10000;
private String key;
// 仅在header存储信息时使用到
private String userId;
......@@ -58,6 +61,7 @@ public class UserRole {
this.roleId = roleId;
this.expiredTime = expiredTime;
this.exportAmount = exportAmount;
this.key = Tools.concat(projectId, roleId);
}
public static UserRole createFromUserDto(UserDTO userDTO) {
......
......@@ -1422,6 +1422,7 @@ public class ChannelServiceImpl implements ChannelService {
private Query channelListQuery(String contendId, Boolean show, String emotion, String platform, String keyword, String sorter) {
Query query = new Query();
query.addCriteria(Criteria.where("projectId").is(UserThreadLocal.getProjectId()));
query.addCriteria(Criteria.where("contendId").is(contendId));
if (null != show) {
query.addCriteria(Criteria.where("show").is(show));
......
......@@ -140,7 +140,7 @@ public class MarkFlowServiceImpl implements MarkFlowService {
if (null != brandkbsHitJson.get("channel_emotion")) {
sourceDetails.put("channelEmotion", ChannelEmotion.getNameFromState(brandkbsHitJson.getIntValue("channel_emotion")));
}
double channelValue = tJson.getDoubleValue(GenericAttribute.ES_CHANNEL_INDEX);
double channelValue = tJson.getDoubleValue(GenericAttribute.ES_CHANNEL_INFLUENCE);
if (channelValue > 0) {
sourceDetails.put("channelInfluence", new BigDecimal(channelValue).setScale(2, RoundingMode.UP));
}
......
......@@ -72,9 +72,10 @@ public class ProjectServiceImpl implements ProjectService {
@Override
public PageVO<JSONObject> findProjectList(int page, int size, String keyword) {
Query query = new Query();
projectDao.addKeywordFuzz(query,keyword,"projectName");
long count = projectDao.count(query);
mongoUtil.start(page, size, query);
List<Project> projectList = projectDao.findListByKeywordFuzz(query, keyword, new String[]{"projectName"});
List<Project> projectList = projectDao.findList(query);
List<JSONObject> resList = projectList.stream().map(project -> {
JSONObject result = new JSONObject();
result.put("id", project.getId());
......
......@@ -17,6 +17,7 @@ import com.zhiwei.brandkbs2.pojo.dto.UserDTO;
import com.zhiwei.brandkbs2.pojo.vo.PageVO;
import com.zhiwei.brandkbs2.service.UserService;
import com.zhiwei.brandkbs2.util.MongoUtil;
import com.zhiwei.brandkbs2.util.Tools;
import com.zhiwei.middleware.auth.pojo.CenterUser;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -109,9 +110,10 @@ public class UserServiceImpl implements UserService {
@Override
public PageVO<JSONObject> findUserList(int page, int size, String keyword, String pid, int role) {
Criteria criteria = Criteria.where("roles.projectId").is(pid).and("superAdmin").is(false);
Criteria criteria = Criteria.where("superAdmin").is(false);
if (-1 != role) {
criteria = criteria.andOperator(Criteria.where("roles.roleId").is(role));
criteria = criteria.andOperator(Criteria.where("roles.key").is(Tools.concat(pid, role)));
// criteria = criteria.andOperator(Criteria.where("roles.roleId").is(role));
}
return findList(page, size, keyword, pid, new Query(criteria));
}
......
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