//注意isfine isgood是不是被添加字段修改了
        public object Handle(APIContext context)
        {
            var data = JsonHelper.DeserializeJsonToObject <law_punishmentInfoFinishReq>(context.Data);

            if (data.LawPunishmentInfo == null)
            {
                throw new Exception("没有主体数据");
            }
            QueryDb.BeginTransaction();
            data.LawPunishmentInfo.EventInfoId = data.EventInfoId;
            data.LawPunishmentInfo.TaskId      = data.SourceTaskId;
            try
            {
                CreateInfo(data.LawPunishmentInfo, data.LawParties, data.Attachments);
                _sHBaseService.CreatTasksAndCreatWorkrecor(data.NextTasks, data.SourceTaskId);
                _sHBaseService.UpdateWorkTaskState(data.SourceTaskId, WorkTaskStatus.Close);//关闭任务
            }
            catch (Exception e)
            {
                QueryDb.AbortTransaction();
                throw new Exception(e.Message);
            }
            QueryDb.CompleteTransaction();
            //打印预生成
            var PDFSerivce = ServiceHelper.GetService("form_printPDFService") as form_printPDFService;

            PDFSerivce.AsposeToPdf(new APIContext()
            {
                Data = @"{""formId"":""" + data.LawPunishmentInfo.ID + @""",""formType"":""law_punishmentInfo""}"
            });
            return(true);
        }
        public object Handle(APIContext context)
        {
            var data = JsonHelper.DeserializeJsonToObject <form_confiscatedFinishReq>(context.Data);

            if (data.formConfiscatedItems == null)
            {
                return(null);
            }
            QueryDb.BeginTransaction();
            try
            {
                CreateInfo(data.formConfiscatedItems, data.SourceTaskId, data.EventInfoId);

                EndEvent(data.SourceTaskId, data.EventInfoId);

                _sHBaseService.CreatTasksAndCreatWorkrecor(data.NextTasks, data.SourceTaskId);
            }
            catch (Exception)
            {
                QueryDb.AbortTransaction();
                throw new Exception();
            }
            QueryDb.CompleteTransaction();
            return(true);
        }
        public object Handle(APIContext context)
        {
            var data = JsonHelper.DeserializeJsonToObject <case_InfoFinishReq>(context.Data);

            if (data.CaseInfo == null)
            {
                throw new Exception("没有主体数据");
            }
            data.CaseInfo.TaskId      = data.SourceTaskId;
            data.CaseInfo.EventInfoId = data.EventInfoId;
            QueryDb.BeginTransaction();
            try
            {
                string caseid = CreateInfo(data.CaseInfo, data.LawParties);
                if (data.NextTasks != null || data.NextTasks.Length > 0)
                {
                    foreach (var t in data.NextTasks)
                    {
                        t.CaseID = caseid;
                    }
                }
                _sHBaseService.CreatTasksAndCreatWorkrecor(data.NextTasks, data.SourceTaskId);
                _sHBaseService.UpdateWorkTaskState(data.SourceTaskId, WorkTaskStatus.Close);//关闭任务
            }
            catch (Exception e)
            {
                QueryDb.AbortTransaction();
                throw e;
            }
            QueryDb.CompleteTransaction();
            return(true);
        }
Beispiel #4
0
        public object Handle(APIContext context)
        {
            var data = JsonHelper.DeserializeJsonToObject <task_surveyFinishReq>(context.Data);

            if (data.TaskSurvey == null)
            {
                throw new Exception("没有主体数据");
            }
            ;
            QueryDb.BeginTransaction();
            data.TaskSurvey.TaskId      = data.SourceTaskId;
            data.TaskSurvey.EventInfoId = data.EventInfoId;
            try
            {
                CreateInfo(data.TaskSurvey, data.LawParties, data.Attachments);
                switch (data.TaskSurvey.ProcessingDecisions)
                {
                case 0:
                    EndEvent(data.SourceTaskId, data.EventInfoId);
                    break;

                default:
                    _sHBaseService.CreatTasksAndCreatWorkrecor(data.NextTasks, data.SourceTaskId);
                    break;
                }
            }
            catch (Exception e)
            {
                QueryDb.AbortTransaction();
                throw e;
            }
            QueryDb.CompleteTransaction();
            return(true);
        }
        public object Handle(APIContext context)
        {
            var data = JsonHelper.DeserializeJsonToObject <form_confiscatedFinishReq>(context.Data);

            if (data.formConfiscated == null)
            {
                return(null);
            }
            if (!string.IsNullOrEmpty(data.EventInfoId))
            {
                data.formConfiscated.EventInfoId = data.EventInfoId;
            }
            if (!string.IsNullOrEmpty(data.SourceTaskId))
            {
                data.formConfiscated.TaskId = data.SourceTaskId;
            }
            QueryDb.BeginTransaction();
            try
            {
                CreateInfo(data.formConfiscated, data.formConfiscatedItems);
                _sHBaseService.CreatTasksAndCreatWorkrecor(data.NextTasks, data.SourceTaskId); //创建下一步任务
                _sHBaseService.UpdateWorkTaskState(data.SourceTaskId, WorkTaskStatus.Close);   //关闭任务
            }
            catch (Exception)
            {
                QueryDb.AbortTransaction();
                throw new Exception();
            }
            QueryDb.CompleteTransaction();
            return(true);
        }
        public object Handle(APIContext context)
        {
            var data = JsonHelper.DeserializeJsonToObject <case_coverFinishReq>(context.Data);

            if (data.CaseCover == null)
            {
                throw new Exception("没有主体数据");
            }
            data.CaseCover.TaskId      = data.SourceTaskId;
            data.CaseCover.EventInfoId = data.EventInfoId;
            QueryDb.BeginTransaction();
            try
            {
                CreateInfo(data.CaseCover);
                _sHBaseService.CreatTasksAndCreatWorkrecor(data.NextTasks, data.SourceTaskId);
                _sHBaseService.UpdateWorkTaskState(data.SourceTaskId, WorkTaskStatus.Close);//关闭任务
            }
            catch (Exception e)
            {
                QueryDb.AbortTransaction();
                throw e;
            }
            QueryDb.CompleteTransaction();
            return(true);
        }
        public object Handle(APIContext context)
        {
            var data = JsonHelper.DeserializeJsonToObject <case_reportFinishReq>(context.Data);

            if (data.CaseReport == null)
            {
                throw new Exception("没有主体数据");
            }
            data.CaseReport.TaskId      = data.SourceTaskId;
            data.CaseReport.EventInfoId = data.EventInfoId;
            QueryDb.BeginTransaction();
            try
            {
                #region 发起钉钉的审批 并将其返回的ID写入Task内
                if (data.oapiProcessinstanceCreateRequest != null)
                {
                    //填值
                    var UsrService      = SysContext.GetService <IUserServices>();
                    var loginClientInfo = SysContext.GetService <WanJiang.Framework.Infrastructure.Logging.ClientInfo>();

                    //ServiceConfig userServiceConfig = ServiceHelper.GetServiceConfig("user");
                    //var OTDB = SysContext.GetOtherDB(userServiceConfig.model.dbName);
                    //var deptId = OTDB.FirstOrDefault<long>(@"SELECT org.id FROM organization org
                    //                        inner join organizationuser ou on ou.OrganizationId = org.Id
                    //                        inner join user usr on usr.Id = ou.UserId
                    //                        where usr.AccountId = @0", loginClientInfo.AccountId);
                    ////
                    //if (deptId == null)
                    //    throw new Exception("无组织部门");

                    var usrDetail = UsrService.GetUserDetails(loginClientInfo.UserId);
                    var ddService = SysContext.GetService <IDingDingServices>();
                    if (usrDetail.Result.Organizations == null || usrDetail.Result.Organizations.Count <= 0)
                    {
                        throw new Exception("无组织部门");
                    }
                    var deptId = usrDetail.Result.Organizations[0].Id;

                    data.oapiProcessinstanceCreateRequest.DeptId           = deptId;
                    data.oapiProcessinstanceCreateRequest.OriginatorUserId = loginClientInfo.AccountId;

                    var result = ddService.ProcessInstaceCreateAsync(data.oapiProcessinstanceCreateRequest);
                    var test   = result.Result;
                    if (result.Result.Errcode != 0)
                    {
                        throw new Exception("发起审核流失败" + result.Result.ErrMsg);
                    }
                    data.CaseReport.ProcessInstanceId = result.Result.ProcessInstanceId;
                    data.CaseReport.FormState         = "待审核";
                    //更新该Report上的信息
                    //var targetId = result.Result.ProcessInstanceId;
                    //if (data.CaseReport.TaskId == null || data.CaseReport.TaskId == "")
                    //    throw new Exception("Task为空");
                    //var taskObj = QueryDb.FirstOrDefault<work_task>("where TaskID =@0", data.CaseReport.TaskId);
                    //if (taskObj == null)
                    //    throw new Exception("该Task不存在");
                    ////更新值
                    //taskObj.processInstanceId = result.Result.ProcessInstanceId;
                    //data.CaseReport.FormState = "待审批";
                    ////data.CaseReport.
                    //QueryDb.Update(taskObj);
                    //ServiceHelper.GetService("work_task").Update(taskObj);
                }
                #endregion
                CreateInfo(data.CaseReport);
                if (!string.IsNullOrEmpty(data.CaseReport.CaseId))
                {
                    var caseinfo = QueryDb.FirstOrDefault <case_Info>("select * from case_Info where Id=@0", data.CaseReport.CaseId);
                    if (caseinfo == null)
                    {
                        throw new Exception("没有案件信息");
                    }
                    caseinfo.CaseStatus = "完成处罚";
                    QueryDb.Update(caseinfo);
                }
                else
                {
                    throw new Exception("没有案件信息");
                }
                _sHBaseService.CreatTasksAndCreatWorkrecor(data.NextTasks, data.SourceTaskId);
                _sHBaseService.UpdateWorkTaskState(data.SourceTaskId, WorkTaskStatus.Close);//关闭任务

                //打印预生成
                var PDFSerivce = ServiceHelper.GetService("form_printPDFService") as form_printPDFService;
                PDFSerivce.AsposeToPdf(new APIContext()
                {
                    Data = @"{""formId"":""" + data.CaseReport.ID + @""",""formType"":""case_report""}"
                });
            }
            catch (Exception e)
            {
                QueryDb.AbortTransaction();
                throw e;
            }
            QueryDb.CompleteTransaction();
            return(true);
        }