|
@@ -21,6 +21,8 @@ using GxPress.Repository.Interface.RecordFolder;
|
|
using GxPress.Service.Interface.Analyze;
|
|
using GxPress.Service.Interface.Analyze;
|
|
using GxPress.Request.App.Analyze;
|
|
using GxPress.Request.App.Analyze;
|
|
using GxPress.EnumConst;
|
|
using GxPress.EnumConst;
|
|
|
|
+using System.Transactions;
|
|
|
|
+using GxPress.Request.UserMiddle;
|
|
|
|
|
|
namespace GxPress.Service.Implement.Middle
|
|
namespace GxPress.Service.Implement.Middle
|
|
{
|
|
{
|
|
@@ -422,13 +424,77 @@ namespace GxPress.Service.Implement.Middle
|
|
{
|
|
{
|
|
return await _middleRepository.RecoverDeleteAsync(request);
|
|
return await _middleRepository.RecoverDeleteAsync(request);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 移动到
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="request"></param>
|
|
|
|
+ /// <returns></returns>
|
|
public async Task<bool> SetMove(MiddleMoveRequest request)
|
|
public async Task<bool> SetMove(MiddleMoveRequest request)
|
|
{
|
|
{
|
|
if (request.ParentId == 0 && request.TypeId == -AllTypeConst.Note.GetHashCode())
|
|
if (request.ParentId == 0 && request.TypeId == -AllTypeConst.Note.GetHashCode())
|
|
request.Ids = await _middleRepository.GetMiddleIsFolderAsync(request.Ids);
|
|
request.Ids = await _middleRepository.GetMiddleIsFolderAsync(request.Ids);
|
|
- return await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.ParentId), request.ParentId).WhereIn(nameof(Entity.Middle.Middle.Id), request.Ids));
|
|
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ using (var transactionScope = new TransactionScope())
|
|
|
|
+ {
|
|
|
|
+ var middle = await _middleRepository.GetMiddleAsync(Q.Where(nameof(Entity.Middle.Middle.Id), request.ParentId));
|
|
|
|
+ if (request.ParentId > 0 && middle != null)
|
|
|
|
+ {
|
|
|
|
+ //获取父级子集集合
|
|
|
|
+ var ids = await _middleRepository.GetAllMiddleChildrenByParentIdAsync(request.Ids.ToList());
|
|
|
|
+ //修改
|
|
|
|
+ await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.ParentId), request.ParentId).Set(nameof(Entity.Middle.Middle.RoleId), middle.RoleId).WhereIn(nameof(Entity.Middle.Middle.Id), request.Ids));
|
|
|
|
+ //修改共享
|
|
|
|
+ await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.MiddleSonId), middle.MiddleSonId).WhereIn(nameof(Entity.Middle.Middle.Id), ids));
|
|
|
|
+ }
|
|
|
|
+ if (request.ParentId == 0)
|
|
|
|
+ {
|
|
|
|
+ middle = await _middleRepository.GetMiddleAsync(Q.Where(nameof(Entity.Middle.Middle.Id), request.Ids.First()));
|
|
|
|
+ if (middle.RoleId == 3)
|
|
|
|
+ {
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 获取共享人员
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ var userMiddles = await _userMiddleService.FindUserMiddlesAsync(middle.FolderType, middle.MiddleSonId);
|
|
|
|
+ foreach (var id in request.Ids)
|
|
|
|
+ {
|
|
|
|
+ var userMiddleInRequest = new List<UserMiddleInRequest>();
|
|
|
|
+ foreach (var userMiddle in userMiddles)
|
|
|
|
+ {
|
|
|
|
+ userMiddleInRequest.Add(new UserMiddleInRequest
|
|
|
|
+ {
|
|
|
|
+ MiddleType = userMiddle.MiddleType,
|
|
|
|
+ SourceType = userMiddle.SourceType,
|
|
|
|
+ SourceId = userMiddle.SourceId,
|
|
|
|
+ SourceName = userMiddle.SourceName,
|
|
|
|
+ DataSourceId = userMiddle.DataSourceId,
|
|
|
|
+ SourceTypeValue = userMiddle.SourceTypeValue
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ //添加共享人员
|
|
|
|
+ await _userMiddleService.AddUserMiddleAsync(userMiddleInRequest);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ //修改
|
|
|
|
+ await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.ParentId), request.ParentId).WhereIn(nameof(Entity.Middle.Middle.Id), request.Ids));
|
|
|
|
+ foreach (var item in request.Ids)
|
|
|
|
+ {
|
|
|
|
+ var ids = await _middleRepository.GetAllMiddleChildrenByParentIdAsync(new List<int> { item });
|
|
|
|
+ await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.MiddleSonId), item).WhereIn(nameof(Entity.Middle.Middle.Id), ids));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ transactionScope.Complete();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 恢复全部
|
|
/// 恢复全部
|
|
/// </summary>
|
|
/// </summary>
|