/// <summary>
        /// 根据附件列表生成协同附件地址
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public static string CreateXtAttachPath(List <Epm_TzAttachs> list)
        {
            string attachUrl = string.Empty;

            if (list != null && list.Any())
            {
                foreach (var item in list)
                {
                    string fileUrl = XtWorkFlowService.GetXtAttachPaht(item.FilePath);
                    if (string.IsNullOrWhiteSpace(attachUrl))
                    {
                        attachUrl = fileUrl;
                    }
                    else
                    {
                        attachUrl = attachUrl + "|" + fileUrl;
                    }
                }
            }
            return(attachUrl);
        }
        ///<summary>
        ///添加:
        ///</summary>
        /// <param name="model">要添加的model</param>
        /// <returns>受影响的行数</returns>
        public Result <int> AddProjectApproval(ProjectApprovalView model)
        {
            Result <int> result = new Result <int>();

            try
            {
                model.ProjectPolit = SetCreateUser(model.ProjectPolit);

                var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow");

                if (model.ProjectPolit.State == (int)PreProjectState.WaitApproval && XtWorkFlow == "1")
                {
                    ProjectApprovalApplyView view = new ProjectApprovalApplyView();
                    view.txt_xmmc = model.ProjectPolit.ProjectName;

                    if (model.ProjectPolit.CompanyId != null)
                    {
                        var company = DataOperateBasic <Base_Company> .Get().GetModel(model.ProjectPolit.CompanyId.Value);

                        if (company == null)
                        {
                            throw new Exception("未获取到申请单位信息!");
                        }
                        view.sub_sqdw = company.ObjeId;
                    }
                    else
                    {
                        throw new Exception("请选择申请单位!");
                    }

                    view.date_kgrq   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.StartDate);
                    view.date_jgrq   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.EndDate);
                    view.date_ysrq   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.AcceptDate);
                    view.date_zgrq   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.RectFinishDate);
                    view.date_jssj   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.FinalDate);
                    view.date_sjsj   = string.Format("{0:yyyy-MM-dd}", model.ProjectPolit.AuditDate);
                    view.txts_zlsfqq = model.ProjectPolit.FullFiles;
                    view.txt_ysyj    = model.ProjectPolit.AcceptOpinion;
                    view.date_sqrq   = string.Format("{0:yyyy-MM-dd}", DateTime.Now);

                    var baseUser = DataOperateBasic <Base_User> .Get().GetModel(model.ProjectPolit.CreateUserId);

                    if (baseUser == null)
                    {
                        throw new Exception("未找到申请人相关信息!");
                    }

                    view.hr_sqr  = baseUser.ObjeId;
                    view.file_fj = "";

                    model.ProjectPolit       = SetCurrentUser(model.ProjectPolit);
                    model.ProjectPolit.State = 0;

                    if (model.FileList.Count > 0)
                    {
                        AddFilesByTable(model.ProjectPolit, model.FileList); //上传附件

                        foreach (var item in model.FileList)
                        {
                            switch (item.TableColumn)
                            {
                            case "SBJJ":            // 销售企业二级单位验收主要事项表
                                view.file_fj = XtWorkFlowService.GetXtAttachPaht(item.Url);
                                break;

                            case "SGSC":            // 施工转生产界面交接确认单
                                view.file_sgdw = XtWorkFlowService.GetXtAttachPaht(item.Url);
                                break;

                            case "GCJJ":            // 工程交接证书
                                view.file_gcjjzs = XtWorkFlowService.GetXtAttachPaht(item.Url);
                                break;

                            default:
                                break;
                            }
                        }
                    }

                    model.ProjectPolit.WorkFlowId = XtWorkFlowService.CreateApplyWorkFlow(view);
                }

                var rows = DataOperateBusiness <Epm_TzProjectPolit> .Get().Add(model.ProjectPolit);

                result.Data = rows;
                result.Flag = EResultFlag.Success;
                WriteLog(AdminModule.ProjectApproval.GetText(), SystemRight.Add.GetText(), "新增: " + model.ProjectPolit.Id);
            }
            catch (Exception ex)
            {
                result.Data      = -1;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "AddProjectApproval");
            }
            return(result);
        }