Commit 8c3a280d by xiongyuwen

no message

parent 3d04a6da
......@@ -127,6 +127,25 @@ namespace Bailun.Discuz.Application.WeiPan
}
}
/// <summary>
/// 判断当前用户是否可以访问4K,如果companyName为4K的情况下
/// </summary>
/// <param name="userId"></param>
/// <param name="companyName"></param>
/// <returns></returns>
public string GetVisitFourKUserId(string userId, string companyName)
{
if (companyName == "四千里数据科技有限公司")
{
var user = _usersRepository.Query().AsNoTracking().Where(u => u.UserId == userId).FirstOrDefault();
if (user.VisitFourK)
{
//切换高德胜的账号来访问
userId = "gaodesheng";
}
}
return userId;
}
///// <summary>
///// 获取首层文件列表
......@@ -135,17 +154,17 @@ namespace Bailun.Discuz.Application.WeiPan
///// <returns></returns>
public async Task<GetFileListResponse> GetFirstFileList(string userId,string companyName,bool isGetRedis=true,bool isDelCaching=false)
{
userId=GetVisitFourKUserId(userId, companyName);
//判断缓存中是否有值,如果有值直接读取
var redisKey = Constants.First_File_List+ companyName;
var redisKey = Constants.First_File_List+ $"_{companyName}";
GetFileListResponse cachingResponse = null;
if(isDelCaching)
{
RedisHelper.HDel(redisKey, $"{userId}_{companyName}");
RedisHelper.HDel(redisKey, $"{userId}");
}
if(isGetRedis)
{
cachingResponse = RedisHelper.HGet<GetFileListResponse>(redisKey,$"{userId}_{companyName}" );
cachingResponse = RedisHelper.HGet<GetFileListResponse>(redisKey,$"{userId}" );
}
if (cachingResponse != null)
{
......@@ -183,6 +202,8 @@ namespace Bailun.Discuz.Application.WeiPan
}
apiOutput.file_list.item.ForEach(u =>
{
if(!u.file_name.Contains("客户资料")) //剔除客户资料
{
if (u.file_name.Contains("-"))
{
u.file_name = u.file_name.Split('-')[1];
......@@ -197,6 +218,8 @@ namespace Bailun.Discuz.Application.WeiPan
u.create_user_name = u.create_userid;
}
u.ctime = ConvertToDateTime(u.ctime);
}
});
apiOutput.companyName = companyName;
}
......@@ -251,10 +274,11 @@ namespace Bailun.Discuz.Application.WeiPan
/// </summary>
public async Task<List<FileListTreeDto>> GetFileListTree(string userId,string companyName, string fildId, bool isGetRedis = true,bool isDelCaching = false)
{
userId = GetVisitFourKUserId(userId, companyName);
List<FileListTreeDto> fileListTreeDtos = new List<FileListTreeDto>();
List<FileListTreeDto> cachingResponse = null;
//判断缓存中是否有值,如果有值直接读取
var redisKey = Constants.File_List_Tree+companyName;
var redisKey = Constants.File_List_Tree + $"_{companyName}"; ;
if(isDelCaching)
{
RedisHelper.HDel(redisKey, userId + "_" + fildId);
......@@ -322,15 +346,17 @@ namespace Bailun.Discuz.Application.WeiPan
{
//获取文件信息
var fileInfo = GetFileInfo(token, fildId, userId);
if (!IsVideoFile(fileInfo.file_info.file_name))//剔除视频
{
FileListTreeDto fileListTreeDto = new FileListTreeDto();
fileListTreeDto.id = fildId;
fileListTreeDto.label = fileInfo.file_info.file_name;
fileListTreeDto.file = fileInfo.file_info.file_type ==2? true : false;
fileListTreeDto.file = fileInfo.file_info.file_type == 2 ? true : false;
fileListTreeDto.md5 = fileInfo.file_info.md5;
fileListTreeDto.key = fildId;
fileListTreeDtos.Add(fileListTreeDto);
}
}
}
else
{
......@@ -715,11 +741,11 @@ namespace Bailun.Discuz.Application.WeiPan
// string userId = "chenzekai";
List<WeiPanFileList> inserWeiPanFileList = new List<WeiPanFileList>();
//1:获取线上的所有文档数据
//var filList=await GetFileList(userId,companyName);//调试注释
var filList=await GetFileList(userId,companyName);//调试注释
//string value = "测试数据";
//RedisHelper.Set("key", filList);
List<WeiPanFileList> filList = RedisHelper.Get<List<WeiPanFileList>>("key");
//List<WeiPanFileList> filList = RedisHelper.Get<List<WeiPanFileList>>("key");
//filList.RemoveAt(1);
//2:判断当前fileid是否存在于数据库中, 如果不存在则添加
foreach (var file in filList)
......@@ -930,6 +956,8 @@ namespace Bailun.Discuz.Application.WeiPan
public async Task ProcessWeipanUserFilesByHr(string companyName, List<WeiPanFileList> weiPanFileLists)
{
if(companyName != "四千里数据科技有限公司")
{
var includUsers = "陈琦,钟晓桐,冯晓茵,李可欣,黎慧琼,熊裕文,田壮虎,赵伟铭";
var userList = _usersRepository.Query().AsNoTracking().Where(u => (includUsers.Split(',').Contains(u.UserName))).ToList();
......@@ -938,9 +966,9 @@ namespace Bailun.Discuz.Application.WeiPan
if (item.UserId != null)
{
var weipanUserFileList = new List<WeipanUserFiles>();
if(weiPanFileLists!=null)
if (weiPanFileLists != null)
{
weiPanFileLists.ForEach(u=> {
weiPanFileLists.ForEach(u => {
WeipanUserFiles weipanUserFiles = new WeipanUserFiles();
weipanUserFiles.File_Id = u.FileId;
weipanUserFiles.FatherFileId = u.FirstFileId;
......@@ -949,7 +977,7 @@ namespace Bailun.Discuz.Application.WeiPan
weipanUserFileList.Add(weipanUserFiles);
});
}
await _weipanUserFilesRepository.DeleteAsync(u => u.UserId == item.UserId&&u.Company_Name==companyName);
await _weipanUserFilesRepository.DeleteAsync(u => u.UserId == item.UserId && u.Company_Name == companyName);
await _weipanUserFilesRepository.BulkInsertAsync(weipanUserFileList.ToArray());
#region 旧逻辑
//List<string> fileIds = new List<string>();
......@@ -969,6 +997,7 @@ namespace Bailun.Discuz.Application.WeiPan
}
}
}
}
public async Task<List<string>> GetNoticeUserNames(string fileId,string fileCreateUseid)
{
......@@ -1151,7 +1180,7 @@ namespace Bailun.Discuz.Application.WeiPan
{
firstFiles.file_list.item.ForEach(u =>
{
if (!u.file_name.Contains("客户资料")&& u.file_name.Contains("商务流程"))
if (!u.file_name.Contains("客户资料"))
{
u.firstfileid = u.fileid;
u.firstFileName = u.file_name;
......
......@@ -55,5 +55,6 @@ namespace Bailun.Discuz.Domain.WeiPan
[Column("department")] public string Department { get; set; }
[Column("userid")] public string UserId { get; set; }
[Column("company_name")] public string CompanyName { get; set; }
[Column("visitfourk")] public bool VisitFourK { get; set; }
}
}
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