Commit 3d04a6da by xiongyuwen

no message

parent 36904722
...@@ -97,5 +97,6 @@ namespace Bailun.Discuz.Application.WeiPan.Dto.ResponseDto ...@@ -97,5 +97,6 @@ namespace Bailun.Discuz.Application.WeiPan.Dto.ResponseDto
/// ///
/// </summary> /// </summary>
public File_list file_list { get; set; } public File_list file_list { get; set; }
public string companyName { get; set; }
} }
} }
...@@ -30,7 +30,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -30,7 +30,7 @@ namespace Bailun.Discuz.Application.WeiPan
///// 获取首层文件列表 ///// 获取首层文件列表
///// </summary> ///// </summary>
///// <returns></returns> ///// <returns></returns>
Task<GetFileListResponse> GetFirstFileList(string userId,bool isGetRedis = true); Task<GetFileListResponse> GetFirstFileList(string userId, string companyName, bool isGetRedis = true, bool isDelCaching = false);
///// <summary> ///// <summary>
///// 获取下载文件链接地址 ///// 获取下载文件链接地址
...@@ -41,7 +41,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -41,7 +41,7 @@ namespace Bailun.Discuz.Application.WeiPan
/// <summary> /// <summary>
/// 递归获取所有首页下的所有文件列表数据 /// 递归获取所有首页下的所有文件列表数据
/// </summary> /// </summary>
Task<List<FileListTreeDto>> GetFileListTree(string userId, string fildId,bool isGetRedis = true); Task<List<FileListTreeDto>> GetFileListTree(string userId, string companyName, string fildId, bool isGetRedis = true, bool isDelCaching = false);
Task<AttachmentsDto> GetAttchmattachmentByFileId(string fileId); Task<AttachmentsDto> GetAttchmattachmentByFileId(string fileId);
......
...@@ -70,7 +70,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -70,7 +70,7 @@ namespace Bailun.Discuz.Application.WeiPan
var token = GetQYWeChatToken(userId); var token = GetQYWeChatToken(userId);
string apiUrl = $"https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_create?access_token={token}"; string apiUrl = $"https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_create?access_token={token}";
CreateSpaceFileRequest createSpaceFileRequest = new CreateSpaceFileRequest(); CreateSpaceFileRequest createSpaceFileRequest = new CreateSpaceFileRequest();
var weiPanSpaceId =GetWeiPanSpaceId(userId); var weiPanSpaceId =GetWeiPanSpaceId(userId, "四千里数据科技有限公司");
createSpaceFileRequest.fatherid = weiPanSpaceId; createSpaceFileRequest.fatherid = weiPanSpaceId;
createSpaceFileRequest.file_name = "4k共享文件"; createSpaceFileRequest.file_name = "4k共享文件";
createSpaceFileRequest.file_type = 1; createSpaceFileRequest.file_type = 1;
...@@ -130,17 +130,22 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -130,17 +130,22 @@ namespace Bailun.Discuz.Application.WeiPan
///// <summary> ///// <summary>
///// 获取首层文件列表 ///// 获取首层文件列表
////广州百伦供应链科技有限公司\四千里数据科技有限公司
///// </summary> ///// </summary>
///// <returns></returns> ///// <returns></returns>
public async Task<GetFileListResponse> GetFirstFileList(string userId,bool isGetRedis=true) public async Task<GetFileListResponse> GetFirstFileList(string userId,string companyName,bool isGetRedis=true,bool isDelCaching=false)
{ {
//判断缓存中是否有值,如果有值直接读取 //判断缓存中是否有值,如果有值直接读取
var redisKey = Constants.First_File_List; var redisKey = Constants.First_File_List+ companyName;
GetFileListResponse cachingResponse = null; GetFileListResponse cachingResponse = null;
if(isDelCaching)
{
RedisHelper.HDel(redisKey, $"{userId}_{companyName}");
}
if(isGetRedis) if(isGetRedis)
{ {
cachingResponse = RedisHelper.HGet<GetFileListResponse>(redisKey, userId); cachingResponse = RedisHelper.HGet<GetFileListResponse>(redisKey,$"{userId}_{companyName}" );
} }
if (cachingResponse != null) if (cachingResponse != null)
{ {
...@@ -157,13 +162,13 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -157,13 +162,13 @@ namespace Bailun.Discuz.Application.WeiPan
else else
{ {
GetFileListRequest getFileListRequest = new GetFileListRequest(); GetFileListRequest getFileListRequest = new GetFileListRequest();
getFileListRequest.fatherid = GetWeiPanSpaceFileId(userId); getFileListRequest.fatherid = GetWeiPanSpaceFileId(userId,companyName);
getFileListRequest.userid = userId; getFileListRequest.userid = userId;
getFileListRequest.spaceid = GetWeiPanSpaceId(userId); getFileListRequest.spaceid = GetWeiPanSpaceId(userId,companyName);
getFileListRequest.sort_type = 6; getFileListRequest.sort_type = 6;
getFileListRequest.start = 0; getFileListRequest.start = 0;
getFileListRequest.limit = 1000; getFileListRequest.limit = 1000;
var token = GetQYWeChatToken(userId); var token = GetQYWeChatToken(userId,companyName);
var apiUrl = $"https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_list?access_token={token}"; var apiUrl = $"https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_list?access_token={token}";
var apiOutput = HttpHelper.PostAsync<GetFileListRequest, GetFileListResponse>(apiUrl, getFileListRequest); var apiOutput = HttpHelper.PostAsync<GetFileListRequest, GetFileListResponse>(apiUrl, getFileListRequest);
//var request=getFileListRequest.ToJson(); //var request=getFileListRequest.ToJson();
...@@ -182,17 +187,18 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -182,17 +187,18 @@ namespace Bailun.Discuz.Application.WeiPan
{ {
u.file_name = u.file_name.Split('-')[1]; u.file_name = u.file_name.Split('-')[1];
} }
var user = realNames.Where(r => r.wxUserId == u.create_userid).FirstOrDefault(); var user = realNames.Where(r => r.wxUserId == u.create_userid.ToLower()).FirstOrDefault();
if (user != null) if (user != null)
{ {
u.create_user_name = user.userName; u.create_user_name = user.userName;
} }
else else
{ {
u.create_user_name = user.wxUserId; u.create_user_name = u.create_userid;
} }
u.ctime = ConvertToDateTime(u.ctime); u.ctime = ConvertToDateTime(u.ctime);
}); });
apiOutput.companyName = companyName;
} }
if(isGetRedis) if(isGetRedis)
RedisHelper.HSet(redisKey, userId, apiOutput); RedisHelper.HSet(redisKey, userId, apiOutput);
...@@ -223,12 +229,12 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -223,12 +229,12 @@ namespace Bailun.Discuz.Application.WeiPan
///// 获取首层下的对应树状内容 ///// 获取首层下的对应树状内容
///// </summary> ///// </summary>
///// <returns></returns> ///// <returns></returns>
public GetFileListResponse RequestFileList(string userId, string fatherid, int start, string token) public GetFileListResponse RequestFileList(string userId, string fatherid, int start, string token,string companyName)
{ {
GetFileListRequest getFileListRequest = new GetFileListRequest(); GetFileListRequest getFileListRequest = new GetFileListRequest();
getFileListRequest.fatherid = fatherid; ; getFileListRequest.fatherid = fatherid; ;
getFileListRequest.userid = userId; getFileListRequest.userid = userId;
getFileListRequest.spaceid = GetWeiPanSpaceId(userId);; getFileListRequest.spaceid = GetWeiPanSpaceId(userId,companyName);;
getFileListRequest.sort_type = 6; getFileListRequest.sort_type = 6;
getFileListRequest.start = start; getFileListRequest.start = start;
getFileListRequest.limit = 1000; getFileListRequest.limit = 1000;
...@@ -243,12 +249,16 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -243,12 +249,16 @@ namespace Bailun.Discuz.Application.WeiPan
/// <summary> /// <summary>
/// 递归获取所有首页下的所有文件列表数据 /// 递归获取所有首页下的所有文件列表数据
/// </summary> /// </summary>
public async Task<List<FileListTreeDto>> GetFileListTree(string userId, string fildId, bool isGetRedis = true) public async Task<List<FileListTreeDto>> GetFileListTree(string userId,string companyName, string fildId, bool isGetRedis = true,bool isDelCaching = false)
{ {
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; var redisKey = Constants.File_List_Tree+companyName;
if(isDelCaching)
{
RedisHelper.HDel(redisKey, userId + "_" + fildId);
}
if (isGetRedis) if (isGetRedis)
{ {
cachingResponse = RedisHelper.HGet<List<FileListTreeDto>>(redisKey, userId + "_" + fildId); cachingResponse = RedisHelper.HGet<List<FileListTreeDto>>(redisKey, userId + "_" + fildId);
...@@ -261,8 +271,8 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -261,8 +271,8 @@ namespace Bailun.Discuz.Application.WeiPan
else else
{ {
//await _weipanUserFilesRepository.DeleteAsync(u => u.UserId ==userId&&u.FatherFileId==fildId); //await _weipanUserFilesRepository.DeleteAsync(u => u.UserId ==userId&&u.FatherFileId==fildId);
var token = GetQYWeChatToken(userId); var token = GetQYWeChatToken(userId,companyName);
var apiOutput = RequestFileList(userId, fildId, 0, token); var apiOutput = RequestFileList(userId, fildId, 0, token,companyName);
if (apiOutput.errcode == "0")//获取成功 if (apiOutput.errcode == "0")//获取成功
{ {
if (apiOutput.file_list != null) if (apiOutput.file_list != null)
...@@ -289,6 +299,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -289,6 +299,7 @@ namespace Bailun.Discuz.Application.WeiPan
weipanUserFiles.UserId = userId; weipanUserFiles.UserId = userId;
weipanUserFiles.FatherFileId = fildId; weipanUserFiles.FatherFileId = fildId;
weipanUserFiles.File_Id = u.fileid; weipanUserFiles.File_Id = u.fileid;
weipanUserFiles.Company_Name = companyName;
if(weipanUserFileList!=null) if(weipanUserFileList!=null)
weipanUserFileList.Add(weipanUserFiles); weipanUserFileList.Add(weipanUserFiles);
...@@ -302,7 +313,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -302,7 +313,7 @@ namespace Bailun.Discuz.Application.WeiPan
{ {
foreach (var u in fileListTreeDtos) foreach (var u in fileListTreeDtos)
{ {
u.children = await GetChildrens(userId, u.id, token, 0, fildId); u.children = await GetChildrens(userId, u.id, token, 0, fildId,companyName);
} }
} }
...@@ -348,7 +359,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -348,7 +359,7 @@ namespace Bailun.Discuz.Application.WeiPan
/// <param name="token"></param> /// <param name="token"></param>
/// <param name="start"></param> /// <param name="start"></param>
/// <returns></returns> /// <returns></returns>
public async Task<List<FileListTreeDto>> GetChildrens(string userId, string fatherid, string token, int start,string parentId) public async Task<List<FileListTreeDto>> GetChildrens(string userId, string fatherid, string token, int start,string parentId,string companyName)
{ {
List<FileListTreeDto> fileListTreeDtos = new List<FileListTreeDto>(); List<FileListTreeDto> fileListTreeDtos = new List<FileListTreeDto>();
...@@ -369,7 +380,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -369,7 +380,7 @@ namespace Bailun.Discuz.Application.WeiPan
//fileListTreeDtos.Add(fileListTreeDto2); //fileListTreeDtos.Add(fileListTreeDto2);
//return fileListTreeDtos; //return fileListTreeDtos;
#endregion #endregion
var apiOutput = RequestFileList(userId, fatherid, start, token); var apiOutput = RequestFileList(userId, fatherid, start, token,companyName);
if (apiOutput.file_list != null) if (apiOutput.file_list != null)
{ {
var files = apiOutput.file_list.item; var files = apiOutput.file_list.item;
...@@ -395,6 +406,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -395,6 +406,7 @@ namespace Bailun.Discuz.Application.WeiPan
weipanUserFiles.UserId = userId; weipanUserFiles.UserId = userId;
weipanUserFiles.FatherFileId = parentId; weipanUserFiles.FatherFileId = parentId;
weipanUserFiles.File_Id = i.fileid; weipanUserFiles.File_Id = i.fileid;
weipanUserFiles.Company_Name = companyName;
if (weipanUserFileList != null) if (weipanUserFileList != null)
weipanUserFileList.Add(weipanUserFiles); weipanUserFileList.Add(weipanUserFiles);
//await _weipanUserFilesRepository.AddAsync(weipanUserFiles, true); //await _weipanUserFilesRepository.AddAsync(weipanUserFiles, true);
...@@ -409,7 +421,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -409,7 +421,7 @@ namespace Bailun.Discuz.Application.WeiPan
foreach (var item in fileListTreeDtos) foreach (var item in fileListTreeDtos)
{ {
item.children =await GetChildrens(userId, item.id, token, start,parentId); item.children =await GetChildrens(userId, item.id, token, start,parentId, companyName);
} }
return fileListTreeDtos; return fileListTreeDtos;
} }
...@@ -442,7 +454,8 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -442,7 +454,8 @@ namespace Bailun.Discuz.Application.WeiPan
//上传至七牛云中 //上传至七牛云中
if (apiOutput.errcode == 0) if (apiOutput.errcode == 0)
{ {
if(!IsVideoFile(apiOutput.download_url))
{
Dictionary<string, string> parameters = new Dictionary<string, string>(); Dictionary<string, string> parameters = new Dictionary<string, string>();
CookieContainer cookieContainer = new CookieContainer(); CookieContainer cookieContainer = new CookieContainer();
Cookie cookie = new Cookie(apiOutput.cookie_name, apiOutput.cookie_value); Cookie cookie = new Cookie(apiOutput.cookie_name, apiOutput.cookie_value);
...@@ -455,6 +468,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -455,6 +468,7 @@ namespace Bailun.Discuz.Application.WeiPan
//{ //{
// cookie.Domain ="szfront.wxwork.qq.com"; // cookie.Domain ="szfront.wxwork.qq.com";
//} //}
Uri uri = new Uri(apiOutput.download_url); Uri uri = new Uri(apiOutput.download_url);
cookie.Domain = uri.Host; cookie.Domain = uri.Host;
...@@ -487,7 +501,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -487,7 +501,7 @@ namespace Bailun.Discuz.Application.WeiPan
{ {
throw new Exception(result.RefText); throw new Exception(result.RefText);
} }
}
} }
else else
{ {
...@@ -502,7 +516,19 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -502,7 +516,19 @@ namespace Bailun.Discuz.Application.WeiPan
} }
return fileUrl; return fileUrl;
} }
public bool IsVideoFile(string url)
{
bool isVideo = false;
IList<string> formateList = new List<string> {
"avi","flv","mpg","mpeg","mpe","m1v","m2v","mpv2","mp2v","dat","ts","tp","tpr","pva","pss","mp4","m4v",
"m4p","m4b","3gp","3gpp","3g2","3gp2","ogg","mov","qt","amr","rm","ram","rmvb","rpm","mpeg4","mkv","flv"};
string extName = Path.GetExtension(url).Replace(".", "");
if (formateList.Contains(extName))
{
isVideo = true;
}
return isVideo;
}
/// <summary> /// <summary>
/// 从数据库中获取对应得文件地址 /// 从数据库中获取对应得文件地址
/// </summary> /// </summary>
...@@ -595,9 +621,12 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -595,9 +621,12 @@ namespace Bailun.Discuz.Application.WeiPan
return companyName; return companyName;
} }
public string GetWeiPanSpaceFileId(string userId) public string GetWeiPanSpaceFileId(string userId,string companyName)
{
if(string.IsNullOrEmpty(companyName))
{ {
string companyName = GetCompanyName(userId); companyName = GetCompanyName(userId);
}
if (companyName == "广州百伦供应链科技有限公司") if (companyName == "广州百伦供应链科技有限公司")
{ {
return ConfigManagerConf.GetValue("QYWeChat:WeiPanSpaceFileId"); return ConfigManagerConf.GetValue("QYWeChat:WeiPanSpaceFileId");
...@@ -607,9 +636,12 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -607,9 +636,12 @@ namespace Bailun.Discuz.Application.WeiPan
return ConfigManagerConf.GetValue("FourKQYWeChat:WeiPanSpaceFileId"); return ConfigManagerConf.GetValue("FourKQYWeChat:WeiPanSpaceFileId");
} }
} }
public string GetWeiPanSpaceId(string userId) public string GetWeiPanSpaceId(string userId, string companyName)
{
if (string.IsNullOrEmpty(companyName))
{ {
string companyName = GetCompanyName(userId); companyName = GetCompanyName(userId);
}
if (companyName == "广州百伦供应链科技有限公司") if (companyName == "广州百伦供应链科技有限公司")
{ {
return ConfigManagerConf.GetValue("QYWeChat:WeiPanSpaceId"); return ConfigManagerConf.GetValue("QYWeChat:WeiPanSpaceId");
...@@ -683,11 +715,11 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -683,11 +715,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)
...@@ -750,8 +782,8 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -750,8 +782,8 @@ namespace Bailun.Discuz.Application.WeiPan
{ {
messageSb.Append($"新增帖子数量为:{inserWeiPanFileList.Count},分别为:{string.Join(",", inserWeiPanFileList.Select(u => u.FileName).ToArray()) };"); messageSb.Append($"新增帖子数量为:{inserWeiPanFileList.Count},分别为:{string.Join(",", inserWeiPanFileList.Select(u => u.FileName).ToArray()) };");
_weiPanFileListRepository.BulkInsert(inserWeiPanFileList.ToArray()); _weiPanFileListRepository.BulkInsert(inserWeiPanFileList.ToArray());
RedisHelper.Del(Constants.File_List_Tree);//清除缓存 RedisHelper.Del(Constants.File_List_Tree+companyName);//清除缓存
RedisHelper.Del(Constants.First_File_List);//清除缓存 RedisHelper.Del(Constants.First_File_List+companyName);//清除缓存
await CreateUserFilesTreeRedis(companyName); await CreateUserFilesTreeRedis(companyName);
} }
...@@ -798,7 +830,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -798,7 +830,7 @@ namespace Bailun.Discuz.Application.WeiPan
//获取当前公司下所有部门 //获取当前公司下所有部门
var departmentItems=GetWechatDepartment(companyName,1); var departmentItems=GetWechatDepartment(companyName,1);
//对推送消息进行控制,减少调用次数 //对推送消息进行控制,减少调用次数
var noIncludUsers = "陈琦,钟晓桐,冯晓茵,李可欣,黎慧琼"; var noIncludUsers = "陈琦,钟晓桐,冯晓茵,李可欣,黎慧琼,熊裕文,田壮虎,赵伟铭";
UpdateCompanyName(); UpdateCompanyName();
var userList = await _usersRepository.Query().AsNoTracking().Where(u => (!noIncludUsers.Split(',').Contains(u.UserName)) && u.CompanyName == companyName).ToListAsync(); var userList = await _usersRepository.Query().AsNoTracking().Where(u => (!noIncludUsers.Split(',').Contains(u.UserName)) && u.CompanyName == companyName).ToListAsync();
...@@ -807,17 +839,15 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -807,17 +839,15 @@ namespace Bailun.Discuz.Application.WeiPan
List<WeipanUserFiles> weipanUserFilesList = new List<WeipanUserFiles>(); List<WeipanUserFiles> weipanUserFilesList = new List<WeipanUserFiles>();
//删除已经不存在的文件 //删除已经不存在的文件
var notExitsFilelist=await _weipanUserFilesRepository.Query().AsNoTracking().Where(u => !weiPanFileList.Select(s=>s.FileId).Contains(u.File_Id)).ToListAsync(); var notExitsFilelist=await _weipanUserFilesRepository.Query().AsNoTracking().Where(u => !weiPanFileList.Select(s=>s.FileId).Contains(u.File_Id)&&u.Company_Name==companyName).ToListAsync();
if(notExitsFilelist!=null) if(notExitsFilelist!=null)
{ {
notExitsFilelist.ForEach(u=> { notExitsFilelist.ForEach(u=> {
_weipanUserFilesRepository.Delete(u.Id); _weipanUserFilesRepository.Delete(u.Id);
}); });
} }
if(companyName!= "四千里数据科技有限公司")
{ await ProcessWeipanUserFilesByHr(companyName, weiPanFileList);//针对特殊用户的处理,不需要相关部门读取
await ProcessWeipanUserFilesByHr();
}
foreach (var weiPanFile in weiPanFileList) foreach (var weiPanFile in weiPanFileList)
{ {
...@@ -873,6 +903,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -873,6 +903,7 @@ namespace Bailun.Discuz.Application.WeiPan
weipanUserFiles.UserId = u.UserId; weipanUserFiles.UserId = u.UserId;
weipanUserFiles.FatherFileId = weiPanFile.FileId; weipanUserFiles.FatherFileId = weiPanFile.FileId;
weipanUserFiles.File_Id = weiPanFile.FileId; weipanUserFiles.File_Id = weiPanFile.FileId;
weipanUserFiles.Company_Name = companyName;
weipanUserFilesList.Add(weipanUserFiles); weipanUserFilesList.Add(weipanUserFiles);
} }
} }
...@@ -897,30 +928,44 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -897,30 +928,44 @@ namespace Bailun.Discuz.Application.WeiPan
return null; return null;
} }
public async Task ProcessWeipanUserFilesByHr() public async Task ProcessWeipanUserFilesByHr(string companyName, List<WeiPanFileList> weiPanFileLists)
{ {
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();
foreach (var item in userList) foreach (var item in userList)
{ {
if (item.UserId != null) if (item.UserId != null)
{ {
RedisHelper.HDel(Constants.File_List_Tree, item.UserId); var weipanUserFileList = new List<WeipanUserFiles>();
RedisHelper.HDel(Constants.First_File_List, item.UserId); if(weiPanFileLists!=null)
List<string> fileIds = new List<string>();
//获取用户对于的首层文件列表
var firstFiles = await GetFirstFileList(item.UserId);
if (firstFiles.file_list != null)
{
weipanUserFileList = new List<WeipanUserFiles>();
await _weipanUserFilesRepository.DeleteAsync(u => u.UserId == item.UserId);
foreach (var file in firstFiles.file_list.item)
{ {
await GetFileListTree(item.UserId, file.fileid, false); weiPanFileLists.ForEach(u=> {
WeipanUserFiles weipanUserFiles = new WeipanUserFiles();
weipanUserFiles.File_Id = u.FileId;
weipanUserFiles.FatherFileId = u.FirstFileId;
weipanUserFiles.Company_Name = companyName;
weipanUserFiles.UserId = item.UserId;
weipanUserFileList.Add(weipanUserFiles);
});
} }
await _weipanUserFilesRepository.DeleteAsync(u => u.UserId == item.UserId&&u.Company_Name==companyName);
await _weipanUserFilesRepository.BulkInsertAsync(weipanUserFileList.ToArray()); await _weipanUserFilesRepository.BulkInsertAsync(weipanUserFileList.ToArray());
} #region 旧逻辑
//List<string> fileIds = new List<string>();
////获取用户对于的首层文件列表
//var firstFiles = await GetFirstFileList(item.UserId, companyName,true,true);
//if (firstFiles.file_list != null)
//{
// weipanUserFileList = new List<WeipanUserFiles>();
// await _weipanUserFilesRepository.DeleteAsync(u => u.UserId == item.UserId);
// foreach (var file in firstFiles.file_list.item)
// {
// await GetFileListTree(item.UserId,companyName, file.fileid,false,true);
// }
// await _weipanUserFilesRepository.BulkInsertAsync(weipanUserFileList.ToArray());
//}
#endregion
} }
} }
} }
...@@ -1059,10 +1104,10 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -1059,10 +1104,10 @@ namespace Bailun.Discuz.Application.WeiPan
/// <param name="token"></param> /// <param name="token"></param>
/// <param name="start"></param> /// <param name="start"></param>
/// <returns></returns> /// <returns></returns>
public List<ItemItem> GetChildrensItem(string userId, string fatherid, string token, int start,string firstFileId,string firstFileName) public List<ItemItem> GetChildrensItem(string userId, string fatherid, string token, int start,string firstFileId,string firstFileName,string companyName)
{ {
var apiOutput = RequestFileList(userId, fatherid, start, token); var apiOutput = RequestFileList(userId, fatherid, start, token, companyName);
if (apiOutput.file_list != null) if (apiOutput.file_list != null)
{ {
var files = apiOutput.file_list.item; var files = apiOutput.file_list.item;
...@@ -1089,7 +1134,7 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -1089,7 +1134,7 @@ namespace Bailun.Discuz.Application.WeiPan
foreach (var item in nextItems) foreach (var item in nextItems)
{ {
GetChildrensItem(userId, item.fileid, token, start, firstFileId, firstFileName); GetChildrensItem(userId, item.fileid, token, start, firstFileId, firstFileName, companyName);
} }
return fileItems; return fileItems;
} }
...@@ -1101,11 +1146,13 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -1101,11 +1146,13 @@ namespace Bailun.Discuz.Application.WeiPan
List<WeiPanFileList> weiPanFileLists = new List<WeiPanFileList>(); List<WeiPanFileList> weiPanFileLists = new List<WeiPanFileList>();
List<ItemItem> itemItems = new List<ItemItem>(); List<ItemItem> itemItems = new List<ItemItem>();
var token = GetQYWeChatToken(userId); var token = GetQYWeChatToken(userId);
var firstFiles = await GetFirstFileList(userId, false); var firstFiles = await GetFirstFileList(userId, companyName,false);
if (firstFiles.file_list != null) if (firstFiles.file_list != null)
{ {
firstFiles.file_list.item.ForEach(u => firstFiles.file_list.item.ForEach(u =>
{ {
if (!u.file_name.Contains("客户资料")&& u.file_name.Contains("商务流程"))
{
u.firstfileid = u.fileid; u.firstfileid = u.fileid;
u.firstFileName = u.file_name; u.firstFileName = u.file_name;
if (u.file_type == 2 && u.file_status == "1")//说明是文件 if (u.file_type == 2 && u.file_status == "1")//说明是文件
...@@ -1114,16 +1161,17 @@ namespace Bailun.Discuz.Application.WeiPan ...@@ -1114,16 +1161,17 @@ namespace Bailun.Discuz.Application.WeiPan
} }
else else
{ {
if(companyName== "广州百伦供应链科技有限公司") if (companyName == "广州百伦供应链科技有限公司")
{ {
if (u.create_userid != "gaodesheng") if (u.create_userid != "gaodesheng")
{ {
GetChildrensItem(userId, u.fileid, token, 0, u.firstfileid, u.firstFileName); GetChildrensItem(userId, u.fileid, token, 0, u.firstfileid, u.firstFileName,companyName);
} }
} }
else else
{ {
GetChildrensItem(userId, u.fileid, token, 0, u.firstfileid, u.firstFileName); GetChildrensItem(userId, u.fileid, token, 0, u.firstfileid, u.firstFileName,companyName);
}
} }
} }
}); });
......
...@@ -15,5 +15,6 @@ namespace Bailun.Discuz.Domain.WeiPan ...@@ -15,5 +15,6 @@ namespace Bailun.Discuz.Domain.WeiPan
[Column("father_file_id")] public string FatherFileId { get; set; } [Column("father_file_id")] public string FatherFileId { get; set; }
[Column("file_id")] public string File_Id { get; set; } [Column("file_id")] public string File_Id { get; set; }
[Column("company_name")] public string Company_Name { get; set; }
} }
} }
...@@ -45,9 +45,9 @@ namespace Bailun.Discuz.Service.Controllers ...@@ -45,9 +45,9 @@ namespace Bailun.Discuz.Service.Controllers
///// </summary> ///// </summary>
///// <returns></returns> ///// <returns></returns>
[HttpGet("GetFirstFileList")] [HttpGet("GetFirstFileList")]
public async Task<GetFileListResponse> GetFirstFileList(string userId) public async Task<GetFileListResponse> GetFirstFileList(string userId,string companyName)
{ {
return await _iweiPanService.GetFirstFileList(userId); return await _iweiPanService.GetFirstFileList(userId, companyName,true);
} }
///// <summary> ///// <summary>
...@@ -63,9 +63,9 @@ namespace Bailun.Discuz.Service.Controllers ...@@ -63,9 +63,9 @@ namespace Bailun.Discuz.Service.Controllers
/// 递归获取所有首页下的所有文件列表数据 /// 递归获取所有首页下的所有文件列表数据
/// </summary> /// </summary>
[HttpGet("GetFileListTree")] [HttpGet("GetFileListTree")]
public async Task<List<FileListTreeDto>> GetFileListTree(string userId, string fildId) public async Task<List<FileListTreeDto>> GetFileListTree(string userId, string fildId, string companyName)
{ {
return await _iweiPanService.GetFileListTree(userId, fildId); return await _iweiPanService.GetFileListTree(userId, companyName,fildId);
} }
/// <summary> /// <summary>
......
...@@ -17,6 +17,12 @@ ...@@ -17,6 +17,12 @@
"WeiPanSpaceId": "s.ww833808f6b8dc0745.610693393XlV", "WeiPanSpaceId": "s.ww833808f6b8dc0745.610693393XlV",
"WeiPanSpaceFileId": "s.ww833808f6b8dc0745.610693393XlV_d.6106935069y7b" "WeiPanSpaceFileId": "s.ww833808f6b8dc0745.610693393XlV_d.6106935069y7b"
}, },
"FourKQYWeChat": {
"AppId": "ww4e7dd5ae312eb101",
"Secret": "tbiUloEtNcsbSnKRBpVjeWjlDTOR7pPAdOtmn3kfQMM ",
"WeiPanSpaceId": "s.ww4e7dd5ae312eb101.614679173dzT",
"WeiPanSpaceFileId": "s.ww4e7dd5ae312eb101.614679173dzT_d.614679239rBH4"
},
"ApiServerUrl": { "ApiServerUrl": {
"ProductUrl": "http://pro.bailuntec.com", "ProductUrl": "http://pro.bailuntec.com",
"ProfitApiAddress": "http://profit.bailuntec.com", "ProfitApiAddress": "http://profit.bailuntec.com",
...@@ -43,5 +49,27 @@ ...@@ -43,5 +49,27 @@
"Host": "10.0.0.2", "Host": "10.0.0.2",
"UserName": "bailun", "UserName": "bailun",
"Password": "bailun2019" "Password": "bailun2019"
},
"QiNiu": {
"AccessKey": "QSvtvN4Ons1CiNzaMGqx8XmDaiM1L0ZqSwJ2YoTn",
"SecretKey": "yagRd-cBOVhkRGGT-o_reMqNVjI8_k7YwoTXkhrm",
"CdnUrl": "http://img.blsct.com",
"ProxyUrl": "http://172.106.221.14:8513",
"ProductsCdnUrl": "https://img.blsct.com",
"Bucket": "bailun-publish-img",
"ImgCDNs": [
"http://img.blsct.com",
"http://oyd60abh0.bkt.clouddn.com",
"http://elite99.blsct.com",
"http://bailun.blsct.com",
"http://gelnailpolish.blsct.com",
"http://nails.blsct.com",
"http://huilin.blsct.com",
"http://beauty.blsct.com",
"http://gelnails.blsct.com",
"http://digi.blsct.com",
"http://kiunobeauty.blsct.com",
"http://eumengman.blsct.com"
]
} }
} }
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
"ConnectionStrings": { "ConnectionStrings": {
"Discuz": "Server=106.55.44.113;port=3306;database=discuz;uid=admin;password=e066d4d1;Convert Zero Datetime=True;Allow User Variables=True;pooling=true" "Discuz": "Server=106.55.44.113;port=3306;database=discuz;uid=admin;password=e066d4d1;Convert Zero Datetime=True;Allow User Variables=True;pooling=true"
}, },
//"redis": {
// "HostName": "127.0.0.1",
// "Port": "6379",
// "Password": "",
// "Defaultdatabase": 1
//},
"redis": { "redis": {
"HostName": "10.0.8.8", "HostName": "10.0.8.8",
"Port": "6379", "Port": "6379",
...@@ -20,8 +26,8 @@ ...@@ -20,8 +26,8 @@
"FourKQYWeChat": { "FourKQYWeChat": {
"AppId": "ww4e7dd5ae312eb101", "AppId": "ww4e7dd5ae312eb101",
"Secret": "tbiUloEtNcsbSnKRBpVjeWjlDTOR7pPAdOtmn3kfQMM ", "Secret": "tbiUloEtNcsbSnKRBpVjeWjlDTOR7pPAdOtmn3kfQMM ",
"WeiPanSpaceId": "s.ww4e7dd5ae312eb101.614410738dfa", "WeiPanSpaceId": "s.ww4e7dd5ae312eb101.614679173dzT",
"WeiPanSpaceFileId": "s.ww4e7dd5ae312eb101.614410738dfa_d.614411110Jd02" "WeiPanSpaceFileId": "s.ww4e7dd5ae312eb101.614679173dzT_d.614679239rBH4"
}, },
"ApiServerUrl": { "ApiServerUrl": {
"ProductUrl": "http://pro.bailuntec.com", "ProductUrl": "http://pro.bailuntec.com",
......
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