Пример #1
0
        public ActionResult BatchSavePayNotice(PayNoticeEntity model)
        {
            IFinanceFacadeAPIService service = ServiceContainer.Instance.Container.Resolve <IFinanceFacadeAPIService>();
            IList <PayNoticeEntity>  list    = (IList <PayNoticeEntity>)TempData["list"];

            if (list != null && list.Count > 0)
            {
                #region 批量改变稿件状态  为 通知交审稿费
                int actionID = 0;
                ISiteConfigFacadeService facadeService = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();
                DictEntity dicteEntity = null;
                if (model.PayType == 1)//审稿费
                {
                    dicteEntity = facadeService.GetDictModelByKey(new DictQuery()
                    {
                        JournalID = CurAuthor.JournalID, DictKey = "PayNotice"
                    });
                }
                else //版面费
                {
                    dicteEntity = facadeService.GetDictModelByKey(new DictQuery()
                    {
                        JournalID = CurAuthor.JournalID, DictKey = "PayPageNotice"
                    });
                }
                if (dicteEntity != null)
                {
                    ISiteConfigFacadeService currentService = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();
                    IList <DictValueEntity>  currentList    = currentService.GetDictValueList(new DictValueQuery()
                    {
                        JournalID = CurAuthor.JournalID, DictKey = dicteEntity.DictKey
                    });
                    if (currentList != null && currentList.Count > 0)
                    {
                        DictValueEntity entity = currentList.Single <DictValueEntity>();
                        if (entity != null)
                        {
                            actionID = entity.ValueID;
                            IFlowFacadeService flowFacadeService = ServiceContainer.Instance.Container.Resolve <IFlowFacadeService>();

                            #region 获取流程操作

                            FlowActionQuery actionQuery = new FlowActionQuery();
                            actionQuery.JournalID  = JournalID;
                            actionQuery.ToStatusID = actionID;
                            IFlowFacadeService       flowService      = ServiceContainer.Instance.Container.Resolve <IFlowFacadeService>();
                            IList <FlowActionEntity> actionEntityList = flowService.GetFlowActionList(actionQuery);
                            #endregion

                            foreach (var item in list)
                            {
                                item.Status   = 0;
                                item.Body     = Server.UrlDecode(model.Body).Replace("${金额}$", model.Amount.ToString()).Replace("${接收人}$", item.AuthorName).Replace("${邮箱}$", item.LoginName).Replace("${稿件编号}$", item.CNumber).Replace("${稿件标题}$", item.CTitle).Replace("${手机}$", item.Mobile);
                                item.SendUser = CurAuthor.AuthorID;
                                item.Amount   = model.Amount;
                                item.Title    = model.Title;
                                if (item.NoticeID == 0)
                                {
                                    #region 根据审稿状态获取  审稿流程日志ID

                                    CirculationEntity cirQuery = new CirculationEntity();
                                    cirQuery.CID       = item.CID;
                                    cirQuery.JournalID = JournalID;
                                    cirQuery.GroupID   = 1;
                                    IFlowFacadeService        flowInfoLogService = ServiceContainer.Instance.Container.Resolve <IFlowFacadeService>();
                                    IList <FlowLogInfoEntity> flowLogEntityList  = flowInfoLogService.GetFlowLog(cirQuery);
                                    FlowActionEntity          single             = null;
                                    FlowLogInfoEntity         flowLogEntity      = null;
                                    if (flowLogEntityList != null && flowLogEntityList.Count > 0)
                                    {
                                        flowLogEntity = flowLogEntityList.OrderByDescending(o => o.FlowLogID).Take(1).SingleOrDefault();
                                        single        = actionEntityList.Where(o => o.StatusID == flowLogEntity.TargetStatusID).SingleOrDefault();
                                    }
                                    #endregion

                                    #region 批量提交审稿状态

                                    AuditBillEntity auditBillEntity = new AuditBillEntity();
                                    auditBillEntity.JournalID  = JournalID;
                                    auditBillEntity.Processer  = CurAuthor.AuthorID;
                                    auditBillEntity.ActionType = 1;
                                    auditBillEntity.CID        = item.CID;
                                    if (single != null && flowLogEntity != null)
                                    {
                                        auditBillEntity.ActionID     = single.ActionID;
                                        auditBillEntity.StatusID     = single.StatusID;
                                        auditBillEntity.ReveiverList = flowLogEntity.RecUserID.ToString();
                                        auditBillEntity.FlowLogID    = flowLogEntity.FlowLogID;
                                        auditBillEntity.CPath        = string.IsNullOrEmpty(flowLogEntity.CPath) ? "" : flowLogEntity.CPath;
                                        auditBillEntity.FigurePath   = string.IsNullOrEmpty(flowLogEntity.FigurePath) ? "" : flowLogEntity.FigurePath;
                                        auditBillEntity.OtherPath    = string.IsNullOrEmpty(flowLogEntity.OtherPath) ? "" : flowLogEntity.OtherPath;
                                        flowFacadeService.SubmitAuditBill(auditBillEntity);
                                    }

                                    #endregion
                                }
                            }
                        }
                    }
                }
                #endregion
            }

            ExecResult result = service.BatchSavePayNotice(list);

            return(Json(new { result = result.result, msg = result.msg }));
        }
Пример #2
0
        public ActionResult SavePayNotice(PayNoticeEntity model)
        {
            IFinanceFacadeAPIService service = ServiceContainer.Instance.Container.Resolve <IFinanceFacadeAPIService>();

            model.JournalID = CurAuthor.JournalID;
            model.SendUser  = CurAuthor.AuthorID;
            model.Status    = 0;
            model.Body      = Server.UrlDecode(model.Body).Replace("${金额}$", model.Amount.ToString());
            if (model.NoticeID == 0)
            {
                #region 改变稿件状态  为 通知交审稿费

                int actionID = 0;
                ISiteConfigFacadeService facadeService = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();
                DictEntity dicteEntity = null;
                if (model.PayType == 1)//审稿费
                {
                    dicteEntity = facadeService.GetDictModelByKey(new DictQuery()
                    {
                        JournalID = CurAuthor.JournalID, DictKey = "PayNotice"
                    });
                }
                else //版面费
                {
                    dicteEntity = facadeService.GetDictModelByKey(new DictQuery()
                    {
                        JournalID = CurAuthor.JournalID, DictKey = "PayPageNotice"
                    });
                }
                if (dicteEntity != null)
                {
                    ISiteConfigFacadeService currentService = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();
                    IList <DictValueEntity>  list           = currentService.GetDictValueList(new DictValueQuery()
                    {
                        JournalID = CurAuthor.JournalID, DictKey = dicteEntity.DictKey
                    });
                    if (list != null && list.Count > 0)
                    {
                        DictValueEntity entity = list.Single <DictValueEntity>();
                        if (entity != null)
                        {
                            actionID = entity.ValueID;
                            #region 获取流程操作

                            FlowActionQuery actionQuery = new FlowActionQuery();
                            actionQuery.JournalID  = JournalID;
                            actionQuery.ToStatusID = actionID;
                            IFlowFacadeService       flowService      = ServiceContainer.Instance.Container.Resolve <IFlowFacadeService>();
                            IList <FlowActionEntity> actionEntityList = flowService.GetFlowActionList(actionQuery);
                            //long statusID = actionEntity != null ? actionEntity.StatusID : 0;

                            #endregion

                            #region 根据审稿状态获取  审稿流程日志ID

                            CirculationEntity cirQuery        = new CirculationEntity();
                            AuditBillEntity   auditBillEntity = new AuditBillEntity();
                            cirQuery.CID       = model.CID;
                            cirQuery.JournalID = JournalID;
                            cirQuery.GroupID   = 1;
                            IFlowFacadeService        flowInfoLogService = ServiceContainer.Instance.Container.Resolve <IFlowFacadeService>();
                            IList <FlowLogInfoEntity> flowLogEntityList  = flowInfoLogService.GetFlowLog(cirQuery);
                            FlowActionEntity          single             = null;
                            FlowLogInfoEntity         flowLogEntity      = null;
                            if (flowLogEntityList != null && flowLogEntityList.Count > 0)
                            {
                                auditBillEntity.ReveiverList = flowLogEntityList[flowLogEntityList.Count - 1].SendUserID.ToString();
                                flowLogEntity = flowLogEntityList.OrderByDescending(o => o.FlowLogID).Take(1).SingleOrDefault();
                                single        = actionEntityList.Where(o => o.StatusID == flowLogEntity.TargetStatusID).FirstOrDefault();
                            }

                            #endregion

                            IFlowFacadeService flowFacadeService = ServiceContainer.Instance.Container.Resolve <IFlowFacadeService>();

                            auditBillEntity.JournalID = JournalID;
                            auditBillEntity.Processer = CurAuthor.AuthorID;


                            if (single != null)
                            {
                                auditBillEntity.ActionID = single.ActionID;
                                auditBillEntity.StatusID = single.StatusID;
                            }
                            auditBillEntity.ActionType = 1;
                            auditBillEntity.CID        = model.CID;
                            if (flowLogEntity != null)
                            {
                                auditBillEntity.FlowLogID  = flowLogEntity.FlowLogID;
                                auditBillEntity.CPath      = "";
                                auditBillEntity.FigurePath = "";
                                auditBillEntity.OtherPath  = "";
                            }
                            flowFacadeService.SubmitAuditBill(auditBillEntity);
                        }
                    }
                }

                #endregion
            }
            ExecResult result = service.SavePayNotice(model);

            return(Json(new { result = result.result, msg = result.msg }));
        }