Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage

This commit is contained in:
wangzhijiang
2022-09-30 15:56:53 +08:00
11 changed files with 169 additions and 21 deletions
@@ -21,6 +21,7 @@ import com.jero.common.system.util.JwtUtil;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.system.vo.SysDepartTreeModel;
import com.jero.common.system.vo.SysDepartUserTreeModel;
import com.jero.common.system.vo.SysUserTreeModel;
import com.jero.common.util.ImportExcelUtil;
import com.jero.common.util.PasswordUtil;
import com.jero.common.util.RedisUtil;
@@ -63,6 +64,7 @@ import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
* 用户表 前端控制器
@@ -1533,7 +1535,53 @@ public class SysUserController {
result.setSuccess(true);
return result;
}
/**
* 查询数据 查出所有部门及其用户
*
* @return
*/
@ApiOperation(value = "用户管理-查出所有部门及其用户")
@RequestMapping(value = "/queryUserTreeList", method = RequestMethod.GET)
public Result<List<DepartUserTree>> queryUserTreeList(String cut) {
Result<List<DepartUserTree>> result = new Result<>();
List<DepartUserTree> dutList = new ArrayList<>();
List<SysDepartTreeModel> departTreeModelList = sysDepartService.queryTreeList(cut);
for (SysDepartTreeModel sdtm: departTreeModelList) {
dutList.addAll(findChildNode(sdtm));
}
result.setResult(dutList);
result.setSuccess(true);
return result;
}
private List<DepartUserTree> findChildNode(SysDepartTreeModel sdtModel) {
List<DepartUserTree> resList = new ArrayList<>();
DepartUserTree dut = new DepartUserTree();
dut.setId(sdtModel.getId());
dut.setName(sdtModel.getDepartName());
dut.setParentId(sdtModel.getParentId());
dut.setType("Depart");
resList.add(dut);
List<String> departIds = new ArrayList<>();
departIds.add(sdtModel.getId());
List<SysUser> sysUserList = sysUserService.getUserListByDepIds(departIds);
for (SysUser user: sysUserList) {
DepartUserTree dut1 = new DepartUserTree();
dut1.setId(user.getId());
dut1.setName(user.getUsername());
dut1.setParentId(sdtModel.getId());
dut1.setType("User");
resList.add(dut1);
}
if (sdtModel.getChildren() != null && sdtModel.getChildren().size() > 0) {
for (SysDepartTreeModel sdtModel1 : sdtModel.getChildren()) {
resList.addAll(findChildNode(sdtModel1));
}
}
return resList;
}
@AutoLog(value = "文档库推送部门和人员的模糊搜索")
@ApiOperation(value="文档库推送部门和人员的模糊搜索", notes="文档库推送部门和人员的模糊搜索")
@@ -0,0 +1,50 @@
package com.jero.modules.system.entity;
public class DepartUserTree {
private String id;
private String parentId;
private String name;
private String type;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "DepartUserTree{" +
"id='" + id + '\'' +
", parentId='" + parentId + '\'' +
", name='" + name + '\'' +
", type='" + type + '\'' +
'}';
}
}
@@ -338,7 +338,6 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
queryMap.put(key, queryMapTemp);
map.put("match",queryMap);
}
must.add(map);
}
}
@@ -360,7 +359,8 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
map1.put("wildcard",map);
should.add(map1);
}
must.add(should);
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, should);
must.add(jsonObject);
}else{
Map<String, Object> map = new HashMap<>();
Map<String, Object> queryMap = new HashMap<>();
@@ -526,6 +526,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
}
JSONObject sort = new JSONObject();
// JSONObject sort = new JSONObject(new LinkedHashMap<>());
if(StringUtils.isEmpty(selectValue) || StringUtils.equals(selectValue,SEARCH_FLAG)){
Map<String,Object> createTime = new HashMap<>();
Map<String,Object> createTime1 = new HashMap<>();
@@ -537,7 +538,12 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
Map<String,Object> score1 = new HashMap<>();
score.put("order","desc");
score1.put("_score",score);
// Map<String,Object> score2 = new HashMap<>();
// Map<String,Object> score3 = new HashMap<>();
// score2.put("order","desc");
// score3.put("_id",score2);
sort.putAll(score1);
// sort.putAll(score3);
}
log.info("搜索中心-全部索引,排序方式为:" + sort.toJSONString());
@@ -563,13 +569,13 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
if("serial_number".equals(field)){
map31.put("boost",10);
}else if("title".equals(field)){
map31.put("boost",10);
map31.put("boost",8);
}else if("file_text".equals(field)){
map31.put("boost",0.01);
}else if("content".equals(field)){
map31.put("boost",0.01);
}else if("file_name".equals(field)){
map31.put("boost",10);
map31.put("boost",5);
}
map31.put("value", selectValue);
map21.put(field + ".keyword", map31);
@@ -583,13 +589,13 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
if("serial_number".equals(field)){
map32.put("boost",10);
}else if("title".equals(field)){
map32.put("boost",10);
map32.put("boost",8);
}else if("file_text".equals(field)){
map32.put("boost",0.01);
}else if("content".equals(field)){
map32.put("boost",0.01);
}else if("file_name".equals(field)){
map32.put("boost",10);
map32.put("boost",5);
}
map32.put("query", selectValue);
map22.put(field, map32);
@@ -604,13 +610,13 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
if("serial_number".equals(field)){
map33.put("boost",10);
}else if("title".equals(field)){
map33.put("boost",10);
map33.put("boost",8);
}else if("file_text".equals(field)){
map33.put("boost",0.01);
}else if("content".equals(field)){
map33.put("boost",0.01);
}else if("file_name".equals(field)){
map33.put("boost",10);
map33.put("boost",5);
}
map33.put("query", selectValue);
map23.put(field, map33);
@@ -621,7 +627,21 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
//情况举例:用户只记得中间那段字
Map<String, Object> map24 = new HashMap<>();
Map<String, Object> map44 = new HashMap<>();
map24.put(field, "*" + selectValue + "*");
Map<String, Object> map55 = new HashMap<>();
map55.put("value","*" + selectValue + "*");
if("serial_number".equals(field)){
map55.put("boost",10);
}else if("title".equals(field)){
map55.put("boost",8);
}else if("file_text".equals(field)){
map55.put("boost",0.01);
}else if("content".equals(field)){
map55.put("boost",0.01);
}else if("file_name".equals(field)){
map55.put("boost",5);
}
map24.put(field, map55);
map44.put("wildcard",map24);
queryMapJson.add(map44);
}