Пример #1
0
        /// <summary>
        /// 创建变更
        /// </summary>
        /// <param name="input">实体</param>
        /// <returns></returns>

        public async Task <Guid> Create(CreateTaskManagementChangeInput input)
        {
            var model = _taskManagementRepository.Get(input.TaskManagementId);

            switch (input.Type)
            {
            case Enum.TaskManagementChangeTypeEnum.TaskRedo:
                model.TaskStatus = TaskManagementStateEnum.Redo;
                break;

            case Enum.TaskManagementChangeTypeEnum.RevokeTask:
                model.TaskStatus = TaskManagementStateEnum.Revoke;
                break;
            }
            if (input.Type != Enum.TaskManagementChangeTypeEnum.ChangeMission)
            {
                await _taskManagementRepository.UpdateAsync(model);

                var tasks = _workFlowTaskRepository.GetAll().Where(x => x.InstanceID == model.Id.ToString() && x.Status.In(0, 1)).ToList();
                foreach (var task in tasks)
                {
                    task.Status         = 2;
                    task.CompletedTime1 = DateTime.Now;
                    await _workFlowTaskRepository.UpdateAsync(task);
                }
            }

            var users     = model.UserId + "," + model.TaskCreateUserId + "," + model.Superintendent;
            var taskUsers = string.Join(',', _workFlowTaskRepository.GetAll().Where(x => x.InstanceID == model.Id.ToString()).Select(x => x.ReceiveID).ToList());

            users += "," + taskUsers;
            var noticeService = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <ProjectNoticeManager>();
            var noticeInput   = new ZCYX.FRMSCore.Application.NoticePublishInputForWorkSpaceInput();

            noticeInput.Content       = $"{input.Type.GetLocalizedDescription()} 通知 <a class='ivu-table' href='/#/task/detail?instanceID={model.Id}'>查看详细</a>";
            noticeInput.Title         = $"{model.TaskName} {input.Type.GetLocalizedDescription()} ";
            noticeInput.NoticeUserIds = users;
            noticeInput.NoticeType    = 1;
            noticeInput.SendUserId    = model.CreatorUserId.Value;
            noticeService.CreateOrUpdateNotice(noticeInput);

            var id       = Guid.NewGuid();
            var newmodel = new TaskManagementChange()
            {
                Id               = id,
                Type             = input.Type,
                TaskManagementId = input.TaskManagementId,
                Reason           = input.Reason,
                Assessment       = input.Assessment,
                Requirement      = input.Requirement,
                PerformanceScore = input.PerformanceScore,
                SpiritScore      = input.SpiritScore,
                CreatorUserId    = AbpSession.UserId.Value,
                CreationTime     = DateTime.Now
            };
            await _repository.InsertAsync(newmodel);

            return(id);
        }
Пример #2
0
        /// <summary>
        /// 更新移交申请
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task Update(UpdateeDocmentMoveInput input)
        {
            var model     = _docmentMoveRepository.Get(input.Id);
            var old_Model = model.DeepClone();

            if (model.DocmentId != input.DocmentId)//如何修改了档案id则默认更新新老档案的状态
            {
                var old  = _docmentRepository.Get(model.DocmentId);
                var newd = _docmentRepository.Get(input.DocmentId);
                old.Status  = (int)DocmentStatus.在档;
                newd.Status = (int)DocmentStatus.审批中;
                var noticeService = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <ProjectNoticeManager>();
                var noticeInput   = new ZCYX.FRMSCore.Application.NoticePublishInputForWorkSpaceInput();
                noticeInput.ProjectId     = input.Id;
                noticeInput.Content       = $"你申请移交的档案《{old.Name}》已变更为《{newd.Name}》。";
                noticeInput.Title         = $"移交《{old.Name}》变更";
                noticeInput.NoticeUserIds = model.CreatorUserId.Value.ToString();
                noticeInput.NoticeType    = 1;
                await noticeService.CreateOrUpdateNoticeAsync(noticeInput);

                await _docmentRepository.UpdateAsync(old);

                await _docmentRepository.UpdateAsync(newd);
            }
            model = input.MapTo(model);
            if (input.FileList != null)
            {
                var fileList = new List <AbpFileListInput>();
                foreach (var ite in input.FileList)
                {
                    fileList.Add(new AbpFileListInput()
                    {
                        Id = ite.Id, Sort = ite.Sort
                    });
                }
                await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput()
                {
                    BusinessId   = model.Id.ToString(),
                    BusinessType = (int)AbpFileBusinessType.移交证明文件,
                    Files        = fileList
                });
            }
            await _docmentMoveRepository.UpdateAsync(model);

            if (input.IsUpdateForChange)
            {
                var flowModel = _workFlowCacheManager.GetWorkFlowModelFromCache(input.FlowId);
                if (flowModel == null)
                {
                    throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "流程不存在");
                }
                var logs = GetChangeModel(old_Model).GetColumnAllLogs(GetChangeModel(model));
                await _projectAuditManager.InsertAsync(logs, input.Id.ToString(), flowModel.TitleField.Table);
            }
        }
Пример #3
0
        public void SendToZjlAsync(Guid flowID, string InstanceID)
        {
            var id              = Guid.Parse(InstanceID);
            var model           = _repository.Get(id);
            var organizeManager = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <WorkFlowOrganizationUnitsManager>();
            var defaultMembers  = organizeManager.GetAbpUsersByRoleCode("ZJL").Select(x => x.Id).ToList();
            var users           = string.Join(",", defaultMembers);
            var noticeService   = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <ProjectNoticeManager>();
            var noticeInput     = new ZCYX.FRMSCore.Application.NoticePublishInputForWorkSpaceInput();

            noticeInput.Content       = $"收到({String.Format("{0:N2}", model.Money)}) 时间:" + model.CreationTime.ToString("yyyy/MM/dd HH:mm:ss");
            noticeInput.Title         = $"收款:《{model.Name}》事务通知";
            noticeInput.NoticeUserIds = users;
            noticeInput.NoticeType    = 1;
            noticeService.CreateOrUpdateNotice(noticeInput);
        }
Пример #4
0
        /// <summary>
        /// 更新任务工作记录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task SaveRecore(CreateOrUpdateTaskManagementRecordInput input)
        {
            var data = await _repository.GetAsync(input.TaskManagementId);

            if (data.Type != Enum.TaskManagementTypeEnum.Offline)
            {
                throw new UserFriendlyException((int)ErrorCode.CodeValErr, "线下任务才能提交任务记录");
            }

            if ((int)input.TaskStatus > 2)
            {
                data.TaskStatus = input.TaskStatus;
                await _repository.UpdateAsync(data);

                var users     = data.UserId + "," + data.Superintendent;
                var taskUsers = string.Join(',', _workFlowTaskRepository.GetAll().Where(x => x.InstanceID == data.Id.ToString()).Select(x => x.ReceiveID).ToList());
                users += "," + taskUsers;
                var noticeService = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <ProjectNoticeManager>();
                var noticeInput   = new ZCYX.FRMSCore.Application.NoticePublishInputForWorkSpaceInput();
                noticeInput.Content       = $"{data.TaskStatus.GetLocalizedDescription()}  通知 <a class='ivu-table' href='/#/task/detail?instanceID={data.Id}'>查看详细</a>";
                noticeInput.Title         = $"{data.TaskName}  {data.TaskStatus.GetLocalizedDescription()} ";
                noticeInput.NoticeUserIds = users;
                noticeInput.NoticeType    = 1;
                noticeInput.SendUserId    = data.CreatorUserId.Value;
                noticeService.CreateOrUpdateNotice(noticeInput);
            }
            if (input.Id.HasValue)
            {
                var model = await _taskManagementRecordRepository.GetAsync(input.Id.Value);

                model.Content = input.Content;
                await _taskManagementRecordRepository.UpdateAsync(model);
            }
            else
            {
                var newModel = new TaskManagementRecord()
                {
                    Id               = Guid.NewGuid(),
                    Content          = input.Content,
                    TaskManagementId = input.TaskManagementId,
                };
                await _taskManagementRecordRepository.InsertAsync(newModel);
            }
        }
Пример #5
0
        public void HandleEvent(TaskManagementData eventData)
        {
            var model = _repository.Get(eventData.Id);

            model.TaskStatus = eventData.TaskStatus;
            _repository.Update(model);
            if (model.TaskStatus == TaskManagementStateEnum.Done)
            {
                var users     = model.UserId + "," + model.Superintendent;
                var taskUsers = string.Join(',', _workFlowTaskRepository.GetAll().Where(x => x.InstanceID == model.Id.ToString()).Select(x => x.ReceiveID).ToList());
                users += "," + taskUsers;
                var noticeService = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <ProjectNoticeManager>();
                var noticeInput   = new ZCYX.FRMSCore.Application.NoticePublishInputForWorkSpaceInput();
                noticeInput.Content       = $"任务完成 通知 <a class='ivu-table' href='/#/task/detail?instanceID={model.Id}'>查看详细</a>";
                noticeInput.Title         = $"{model.TaskName}  已完成 ";
                noticeInput.NoticeUserIds = users;
                noticeInput.NoticeType    = 1;
                noticeInput.SendUserId    = model.CreatorUserId.Value;
                noticeService.CreateOrUpdateNotice(noticeInput);
            }
        }
Пример #6
0
        /// <summary>
        /// 流程管理员作废申请
        /// </summary>
        /// <param name="id"></param>
        /// <param name="flowId"></param>
        /// <param name="reason"></param>
        /// <returns></returns>
        public async Task StopPlan(Guid id, Guid flowId, string reason)
        {
            var record = _repository.Get(id);

            if (flowId == Guid.Empty)
            {
                throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "工作流id不能为空。");
            }
            record.Status = (int)WorkFlowBusinessStatus.已终止;
            var task = _workFlowTaskRepository.GetAll().Where(ite => ite.FlowID == flowId && ite.InstanceID == id.ToString()).ToList();

            foreach (var t in task)
            {
                t.Status  = 10;//流程管理员作废申请
                t.Comment = reason;
                await _workFlowTaskRepository.UpdateAsync(t);
            }
            await _repository.UpdateAsync(record);

            //发送事务通知
            var noticeService = Abp.AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <ProjectNoticeManager>();
            var noticeInput   = new ZCYX.FRMSCore.Application.NoticePublishInputForWorkSpaceInput();

            noticeInput.ProjectId = record.Id;
            noticeInput.Content   = $"人员【{record.ApplyUser}】面试已被终止。";
            noticeInput.Title     = $"人员【{record.ApplyUser}】面试已被终止。";
            var us = new List <string>();

            if (string.IsNullOrWhiteSpace(record.AdminUserId) == false)
            {
                us.Add(record.AdminUserId.Replace("u_", ""));
            }
            if (string.IsNullOrWhiteSpace(record.EmployeeUserIds) == false)
            {
                var t = record.EmployeeUserIds.Split(",");
                if (t != null)
                {
                    foreach (var x in t)
                    {
                        us.Add(x.Replace("u_", ""));
                    }
                }
            }
            if (string.IsNullOrWhiteSpace(record.MergeUserId) == false)
            {
                us.Add(record.MergeUserId.Replace("u_", ""));
            }
            if (string.IsNullOrWhiteSpace(record.RecordUserId) == false)
            {
                us.Add(record.RecordUserId.Replace("u_", ""));
            }
            if (string.IsNullOrWhiteSpace(record.VerifyUserId) == false)
            {
                us.Add(record.VerifyUserId.Replace("u_", ""));
            }
            us.Add(record.AdminUserId);
            noticeInput.NoticeUserIds = string.Join(",", us);
            noticeInput.NoticeType    = 1;
            await noticeService.CreateOrUpdateNoticeAsync(noticeInput);

            //
        }