|
@@ -2,6 +2,8 @@ using System.Threading.Tasks;
|
|
|
using Datory;
|
|
|
using GxPress.EnumConst;
|
|
|
using System.Transactions;
|
|
|
+using System.Linq;
|
|
|
+
|
|
|
namespace GxPress.Service.Implement
|
|
|
{
|
|
|
public partial class FlowService
|
|
@@ -22,21 +24,26 @@ namespace GxPress.Service.Implement
|
|
|
throw new Common.Exceptions.BusinessException("非本人操作!");
|
|
|
var query = Q.NewQuery();
|
|
|
query.Where(nameof(Entity.Notice.SourceId), flowId);
|
|
|
- query.Where(nameof(Entity.Notice.TypeValue), AllTypeConst.MySubmitted.GetHashCode());
|
|
|
- query.Where(nameof(Entity.Notice.UserId), userId);
|
|
|
- var notice = await _noticeRepository.GetAsync(query);
|
|
|
+ var notices = await _noticeRepository.GetAllAsync(query);
|
|
|
+ if (notices == null || notices.Count() == 0)
|
|
|
+ return false;
|
|
|
+ var notice = notices.FirstOrDefault(n => n.UserId == userId);
|
|
|
if (notice == null)
|
|
|
return false;
|
|
|
+ query = Q.NewQuery();
|
|
|
+ query.Where(nameof(Entity.Notice.Id), notice.Id);
|
|
|
+ query.Set(nameof(Entity.Notice.IsRecall), true);
|
|
|
+ await _noticeRepository.UpdateAsync(query);
|
|
|
//删除middle
|
|
|
query = Q.NewQuery();
|
|
|
query.Where(nameof(Entity.Middle.Middle.FolderType), AllTypeConst.Inbox.GetHashCode());
|
|
|
- query.Where(nameof(Entity.Middle.Middle.MiddleId), notice.Id);
|
|
|
+ query.WhereIn(nameof(Entity.Middle.Middle.MiddleId), notices.Select(n => n.Id));
|
|
|
query.WhereNot(nameof(Entity.Middle.Middle.UserId), flow.UserId);
|
|
|
await middleRepository.DeleteAsync(query);
|
|
|
//修改状态
|
|
|
query = Q.NewQuery();
|
|
|
query.Where(nameof(Entity.Middle.Middle.FolderType), AllTypeConst.Inbox.GetHashCode());
|
|
|
- query.Where(nameof(Entity.Middle.Middle.MiddleId), notice.Id);
|
|
|
+ query.Where(nameof(Entity.Middle.Middle.MiddleId), notices.Select(n => n.Id));
|
|
|
query.Where(nameof(Entity.Middle.Middle.UserId), flow.UserId);
|
|
|
query.Set(nameof(Entity.Middle.Middle.IsRecall), true);
|
|
|
await middleRepository.UpdateAsync(query);
|