Commit 8c3a280d by xiongyuwen

no message

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