|
@@ -12,9 +12,11 @@ import com.wtkj.entity.FileAndFolder;
|
|
import com.wtkj.entity.FileAndFolderHistory;
|
|
import com.wtkj.entity.FileAndFolderHistory;
|
|
import com.wtkj.entity.InnerFileAndFolder;
|
|
import com.wtkj.entity.InnerFileAndFolder;
|
|
import com.wtkj.entity.ProjectAuth;
|
|
import com.wtkj.entity.ProjectAuth;
|
|
-import com.wtkj.handler.es.Document;
|
|
|
|
|
|
+import com.wtkj.handler.es.Doc;
|
|
import com.wtkj.service.*;
|
|
import com.wtkj.service.*;
|
|
import com.wtkj.vo.AuthUserInfo;
|
|
import com.wtkj.vo.AuthUserInfo;
|
|
|
|
+import com.wutong.base.entity.BladeWxUser;
|
|
|
|
+import com.wutong.base.feign.IBladeWxUserClient;
|
|
import com.wutong.file.feign.IFileClient;
|
|
import com.wutong.file.feign.IFileClient;
|
|
import com.wutong.file.vo.FileVO;
|
|
import com.wutong.file.vo.FileVO;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -34,7 +36,6 @@ import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
-import org.springblade.core.tool.utils.WebUtil;
|
|
|
|
import org.springblade.system.entity.Dept;
|
|
import org.springblade.system.entity.Dept;
|
|
import org.springblade.system.feign.ISysClient;
|
|
import org.springblade.system.feign.ISysClient;
|
|
import org.springblade.system.user.entity.User;
|
|
import org.springblade.system.user.entity.User;
|
|
@@ -65,6 +66,7 @@ public class CommonServiceImpl implements ICommonService {
|
|
private final RestHighLevelClient client;
|
|
private final RestHighLevelClient client;
|
|
private final ISysClient sysClient;
|
|
private final ISysClient sysClient;
|
|
private final IUserClient userClient;
|
|
private final IUserClient userClient;
|
|
|
|
+ private final IBladeWxUserClient wxUserClient;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -124,7 +126,6 @@ public class CommonServiceImpl implements ICommonService {
|
|
FileAndFolder old = fileAndFolderService.getOne(lqw);
|
|
FileAndFolder old = fileAndFolderService.getOne(lqw);
|
|
if (old != null) {
|
|
if (old != null) {
|
|
//存在同名文件
|
|
//存在同名文件
|
|
- //此处不删除旧的同名文件,直接修改值 ---> 再保存历史记录信息 修改已存在的的数据 更新url 文件大小等信息
|
|
|
|
//先根据旧的fileId判断是否存在历史记录
|
|
//先根据旧的fileId判断是否存在历史记录
|
|
List<FileAndFolderHistory> hisList = historyService.getByLatestId(old.getBladeFileId());
|
|
List<FileAndFolderHistory> hisList = historyService.getByLatestId(old.getBladeFileId());
|
|
if (!CollectionUtils.isEmpty(hisList)) {
|
|
if (!CollectionUtils.isEmpty(hisList)) {
|
|
@@ -140,6 +141,7 @@ public class CommonServiceImpl implements ICommonService {
|
|
his.setHistoryId(String.valueOf(old.getBladeFileId()));
|
|
his.setHistoryId(String.valueOf(old.getBladeFileId()));
|
|
histories.add(his);
|
|
histories.add(his);
|
|
}
|
|
}
|
|
|
|
+ //此处不删除旧的同名文件,直接修改值 ---> 再保存历史记录信息 修改已存在的的数据 更新url 文件大小等信息
|
|
old.setBladeFileId(fileId);
|
|
old.setBladeFileId(fileId);
|
|
fileList.add(old);
|
|
fileList.add(old);
|
|
} else {
|
|
} else {
|
|
@@ -272,14 +274,6 @@ public class CommonServiceImpl implements ICommonService {
|
|
projectIds.add(projectId);
|
|
projectIds.add(projectId);
|
|
proIds.add(String.valueOf(projectId));
|
|
proIds.add(String.valueOf(projectId));
|
|
} else {
|
|
} else {
|
|
- //如果projectId为空 则查询机构下所有项目
|
|
|
|
- //此机构下的项目
|
|
|
|
- /*List<ProjectAuth> auths = projectAuthService.getByDeptAndUser(topDept, Func.firstLong(AuthUtil.getDeptId()), null);
|
|
|
|
- if (!CollectionUtils.isEmpty(auths)) {
|
|
|
|
- Set<Long> ids = auths.stream().map(ProjectAuth::getProjectId).filter(Objects::nonNull).collect(Collectors.toSet());
|
|
|
|
- projectIds.addAll(ids);
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
String role = AuthUtil.getUserRole();
|
|
String role = AuthUtil.getUserRole();
|
|
Long deptId = Func.firstLong(AuthUtil.getDeptId());
|
|
Long deptId = Func.firstLong(AuthUtil.getDeptId());
|
|
Long userId = AuthUtil.getUserId();
|
|
Long userId = AuthUtil.getUserId();
|
|
@@ -357,27 +351,22 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
|
|
|
//执行查询
|
|
//执行查询
|
|
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
|
|
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
|
|
- Set<Document> set = new HashSet<>();
|
|
|
|
|
|
+ Set<Doc> set = new HashSet<>();
|
|
if (response != null) {
|
|
if (response != null) {
|
|
SearchHits hits = response.getHits();
|
|
SearchHits hits = response.getHits();
|
|
int size = hits.getHits().length;
|
|
int size = hits.getHits().length;
|
|
for (int i = 0; i < size; i++) {
|
|
for (int i = 0; i < size; i++) {
|
|
String str = hits.getHits()[i].getSourceAsString();
|
|
String str = hits.getHits()[i].getSourceAsString();
|
|
- Document document = JSON.parseObject(str, Document.class);
|
|
|
|
|
|
+ Doc document = JSON.parseObject(str, Doc.class);
|
|
set.add(document);
|
|
set.add(document);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!CollectionUtils.isEmpty(set)) {
|
|
if (!CollectionUtils.isEmpty(set)) {
|
|
LambdaQueryWrapper<FileAndFolder> lqw = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<FileAndFolder> lqw = new LambdaQueryWrapper<>();
|
|
lqw.eq(FileAndFolder::getType, 1);
|
|
lqw.eq(FileAndFolder::getType, 1);
|
|
- Set<Long> fileIds = set.stream().map(Document::getFileId).collect(Collectors.toSet());
|
|
|
|
|
|
+ Set<Long> fileIds = set.stream().map(Doc::getFileId).map(Long::valueOf).collect(Collectors.toSet());
|
|
lqw.in(FileAndFolder::getBladeFileId, fileIds);
|
|
lqw.in(FileAndFolder::getBladeFileId, fileIds);
|
|
res = fileAndFolderService.page(page, lqw);
|
|
res = fileAndFolderService.page(page, lqw);
|
|
- } else if (!CollectionUtils.isEmpty(projectIds)) {
|
|
|
|
- LambdaQueryWrapper<FileAndFolder> lqw = new LambdaQueryWrapper<>();
|
|
|
|
- lqw.eq(FileAndFolder::getType, 1);
|
|
|
|
- lqw.in(FileAndFolder::getProjectId, projectIds);
|
|
|
|
- res = fileAndFolderService.page(page, lqw);
|
|
|
|
}
|
|
}
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
@@ -425,8 +414,8 @@ public class CommonServiceImpl implements ICommonService {
|
|
int size = hits.getHits().length;
|
|
int size = hits.getHits().length;
|
|
for (int i = 0; i < size; i++) {
|
|
for (int i = 0; i < size; i++) {
|
|
String str = hits.getHits()[i].getSourceAsString();
|
|
String str = hits.getHits()[i].getSourceAsString();
|
|
- Document document = JSON.parseObject(str, Document.class);
|
|
|
|
- set.add(document.getCurrentPage());
|
|
|
|
|
|
+ Doc doc = JSON.parseObject(str, Doc.class);
|
|
|
|
+ set.add(doc.getCurrentPage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return set;
|
|
return set;
|
|
@@ -469,11 +458,11 @@ public class CommonServiceImpl implements ICommonService {
|
|
userInfo.setUser(userR.getData());
|
|
userInfo.setUser(userR.getData());
|
|
}
|
|
}
|
|
|
|
|
|
- //登录成功通知 仅pc端
|
|
|
|
- String platform = WebUtil.getHeader("platform");
|
|
|
|
- if (StringUtil.isNotBlank(platform) && platform.equals("pc")) {
|
|
|
|
-
|
|
|
|
|
|
+ R<BladeWxUser> rpc = wxUserClient.findUserByBladeUserIdAndTenantId(String.valueOf(userId), "cHJvamVjdF93eDpwcm9qZWN0X3d4X2tleQ==");
|
|
|
|
+ if (rpc.isSuccess()) {
|
|
|
|
+ userInfo.setOpenId(rpc.getData().getOpenId());
|
|
}
|
|
}
|
|
|
|
+
|
|
return userInfo;
|
|
return userInfo;
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|