Exemple #1
0
        /// <summary>
        /// 获取历史环节人
        /// </summary>
        /// <param name="wfsid"></param>
        /// <param name="wfdid"></param>
        /// <returns></returns>
        public WF_WorkFlowLinkOld GetOldLink(string wfsid, string wfdid)
        {
            using (Entities db = new Entities())
            {
                string sql = string.Format(@"select * from (select dealuserid,wfdid from wf_workflowspecificactivitys where wfsid={0} and wfdid={1} and status=2
ORDER BY createtime desc) tab1 GROUP BY tab1.wfdid", wfsid, wfdid);
                IEnumerable <WF_WorkFlowLinkOld> query = db.Database.SqlQuery <WF_WorkFlowLinkOld>(sql);
                WF_WorkFlowLinkOld model = query.FirstOrDefault();
                return(model);
            }
        }
Exemple #2
0
        public object YHTaskFlowLink(YHDealWithLinkModel scmodel)
        {
            try
            {
                yh_yhtasks model = new yh_yhtasks();

                #region 图片处理
                List <FileClass> List_FC   = new List <FileClass>();
                string[]         fileClass = scmodel.uploadpanelValue;
                if (fileClass != null && fileClass.Length > 0)
                {
                    foreach (var item in fileClass)
                    {
                        FileClass infileClass = new FileClass();
                        JObject   jo          = new JObject();
                        jo = (JObject)JsonConvert.DeserializeObject(item);
                        infileClass.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                        infileClass.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                        infileClass.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                        infileClass.size         = jo["size"] == null ? 0 : (double)jo["size"];
                        List_FC.Add(infileClass);
                    }
                }
                #endregion
                if (scmodel.wfdid == "2017040610570002")
                {
                    model.pqrid = scmodel.wfcreateuserid;
                }

                WorkFlowManagerBLL bll     = new WorkFlowManagerBLL();
                SMS_Messages       sm      = new SMS_Messages();
                UserBLL            userbll = new UserBLL();
                if (scmodel.nextwfuserids == "0")//回退
                {
                    WF_WorkFlowLinkOld oldmodel = bll.GetOldLink(scmodel.wfsid, scmodel.nextwfdid);
                    if (oldmodel != null)
                    {
                        scmodel.nextwfuserids = oldmodel.dealuserid.ToString();
                    }
                }
                if (scmodel.nextwfuserids == "-1")//无派遣
                {
                    scmodel.nextwfuserids = "";
                    //获取市容环卫科人员ID
                    foreach (UserModel item in userbll.GetUsersStaff(8))
                    {
                        scmodel.nextwfuserids += item.ID + ",";
                    }
                    scmodel.nextwfuserids = "," + scmodel.nextwfuserids;
                }
                #region 发送短信
                //if (!string.IsNullOrEmpty(scmodel.mobile))
                //{
                //    sm.SendMessage(scmodel.mobile);
                //}
                #endregion



                WorkFlowClass wf = new WorkFlowClass();

                #region 事件流程
                wf.FunctionName   = "yh_yhtasks";          //市民事件表名
                wf.WFID           = "2017040610490001";    //工作流程编号 2017021409560001 事件流程
                wf.WFDID          = scmodel.wfdid;         //工作流详细编号 2017021410240003 事件处理
                wf.NextWFDID      = scmodel.nextwfdid;     //下一步流程编号 2017021410240004 中队长审核
                wf.NextWFUSERIDS  = scmodel.nextwfuserids; //下一步流程用户ID
                wf.WFSAID         = scmodel.wfsaid;
                wf.WFSID          = scmodel.wfsid;
                wf.DEALCONTENT    = scmodel.dealcontent;
                wf.IsSendMsg      = "false";                //是否发送短信
                wf.WFCreateUserID = scmodel.wfcreateuserid; //当前流程创建人
                wf.files          = List_FC;
                #endregion

                bll.WF_Submit(wf, model);
                return(new
                {
                    msg = "上报成功",
                    resCode = 1
                });
            }
            catch (Exception)
            {
                return(new
                {
                    msg = "json数据不正确",
                    resCode = 0
                });
            }
        }
        public object CizitenEventFlowLink(DealWithLinkModel scmodel)
        {
            try
            {
                sm_citizenservices model   = new sm_citizenservices();
                UserBLL            userbll = new UserBLL();
                #region 图片处理
                List <FileClass> List_FC    = new List <FileClass>();
                string           OriginPath = ConfigManageClass.CitizenServiceOriginalPath;
                string           smallPath  = ConfigManageClass.CitizenServiceFilesPath;


                if (scmodel.photo1 != null && scmodel.photo1.Length != 0)
                {
                    string[] spilt = scmodel.photo1.Split(',');
                    if (spilt.Length > 1)
                    {
                        byte[]    myByte = Convert.FromBase64String(spilt[1]);
                        FileClass FC     = FileFactory.FileUpload(myByte, ".jpg", OriginPath, smallPath, 100, 100);
                        List_FC.Add(FC);
                    }
                }
                if (scmodel.photo2 != null && scmodel.photo2.Length != 0)
                {
                    string[] spilt = scmodel.photo2.Split(',');
                    if (spilt.Length > 1)
                    {
                        byte[]    myByte = Convert.FromBase64String(spilt[1]);
                        FileClass FC     = FileFactory.FileUpload(myByte, ".jpg", OriginPath, smallPath, 100, 100);
                        List_FC.Add(FC);
                    }
                }
                if (scmodel.photo3 != null && scmodel.photo3.Length != 0)
                {
                    string[] spilt = scmodel.photo3.Split(',');
                    if (spilt.Length > 1)
                    {
                        byte[]    myByte = Convert.FromBase64String(spilt[1]);
                        FileClass FC     = FileFactory.FileUpload(myByte, ".jpg", OriginPath, smallPath, 100, 100);
                        List_FC.Add(FC);
                    }
                }
                if (scmodel.photo4 != null && scmodel.photo4.Length != 0)
                {
                    string[] spilt = scmodel.photo4.Split(',');
                    if (spilt.Length > 1)
                    {
                        byte[]    myByte = Convert.FromBase64String(spilt[1]);
                        FileClass FC     = FileFactory.FileUpload(myByte, ".jpg", OriginPath, smallPath, 100, 100);
                        List_FC.Add(FC);
                    }
                }
                #endregion

                model.processmode   = scmodel.processmode;
                model.satisfaction  = scmodel.satisfaction;
                model.processuserid = scmodel.processuserid;
                if (scmodel.nextwfdid == "2017021410240006")
                {
                    model.gdsj = DateTime.Now;
                }
                if (scmodel.wfdid == "2017021410240001")
                {
                    model.officeuserid = scmodel.wfcreateuserid;
                    model.workflowtype = scmodel.nextwfdid;
                    model.suggest      = scmodel.dealcontent;
                }
                WorkFlowManagerBLL bll        = new WorkFlowManagerBLL();
                string             nextperson = scmodel.nextwfuserids;
                if (nextperson == "0")
                {
                    WF_WorkFlowLinkOld oldmodel = bll.GetOldLink(scmodel.wfsid, scmodel.nextwfdid);
                    if (oldmodel != null && scmodel.wfdid != "2017021410240008")
                    {
                        nextperson = oldmodel.dealuserid.ToString();
                    }
                }
                if (nextperson == "0")
                {
                    string userids = "";

                    //获取指挥中心人员id
                    foreach (UserModel item in userbll.GetUsersStaffList(2))
                    {
                        userids += item.ID + ",";
                    }
                    nextperson = "," + userids;
                }



                WorkFlowClass wf = new WorkFlowClass();

                #region 事件流程
                wf.FunctionName   = "sm_citizenservices"; //市民事件表名
                wf.WFID           = "2017021409560001";   //工作流程编号 2017021409560001 事件流程
                wf.WFDID          = scmodel.wfdid;        //工作流详细编号 2017021410240003 事件处理
                wf.NextWFDID      = scmodel.nextwfdid;    //下一步流程编号 2017021410240004 中队长审核
                wf.NextWFUSERIDS  = nextperson;           //下一步流程用户ID
                wf.WFSAID         = scmodel.wfsaid;
                wf.WFSID          = scmodel.wfsid;
                wf.DEALCONTENT    = scmodel.dealcontent;
                wf.IsSendMsg      = "false";                //是否发送短信
                wf.WFCreateUserID = scmodel.wfcreateuserid; //当前流程创建人
                wf.files          = List_FC;
                #endregion

                bll.WF_Submit(wf, model);


                //#region 发送短信
                //if (scmodel.isSendMsg == "1" && !string.IsNullOrEmpty(wf.NextWFUSERIDS))
                //{
                //    string phone = userbll.GetPhones(wf.NextWFUSERIDS);//15888309757,18768196242
                //    string[] phones = phone.Split(',');
                //    string content = "您有一条新的市民事件需要处理,限办期限:" + scmodel.limittime + ",请及时处理";
                //    SMSMessagesBLL smsbll = new SMSMessagesBLL();
                //    smsbll.SendMessage(phones, content);
                //}
                //#endregion
                return(new
                {
                    msg = "提交成功",
                    resCode = 1
                });
            }
            catch (Exception)
            {
                return(new
                {
                    msg = "json数据不正确",
                    resCode = 0
                });
            }
        }
        public HttpResponseMessage CizitenEventFlow(RSM_CitizenModel cmmodel)
        {
            HttpRequestBase    request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;
            sm_citizenservices model   = new sm_citizenservices();
            //文件上传
            HttpFileCollectionBase files = request.Files;

            List <FileClass> list = new List <FileClass>();

            string[] fileClass = cmmodel.uploadpanelValue;

            if (fileClass != null && fileClass.Length > 0)
            {
                foreach (var item in fileClass)
                {
                    FileClass infileClass = new FileClass();
                    JObject   jo          = new JObject();
                    jo = (JObject)JsonConvert.DeserializeObject(item);
                    infileClass.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                    infileClass.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                    infileClass.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                    infileClass.size         = jo["size"] == null ? 0 : (double)jo["size"];
                    list.Add(infileClass);
                }
            }

            model.processmode  = request.Form["processmode"];
            model.satisfaction = request.Form["satisfaction"];
            if (!string.IsNullOrEmpty(request.Form["userid"]))
            {
                model.processuserid = Convert.ToInt32(request.Form["userid"]);
            }
            if (request.Form["nextwfdid"] == "2017021410240006" || request.Form["nextwfdid"] == "2017021410240009")
            {
                model.gdsj = DateTime.Now;
            }
            if (request.Form["wfdid"] == "2017021410240001" && !string.IsNullOrEmpty(request.Form["userid"]))
            {
                model.officeuserid = Convert.ToInt32(request.Form["userid"]);
                model.workflowtype = request.Form["nextwfdid"];
                model.suggest      = request.Form["suggest"];
            }
            WorkFlowManagerBLL wfbll      = new WorkFlowManagerBLL();
            string             nextperson = request.Form["nextperson"];

            if (request.Form["nextperson"] == "0")
            {
                WF_WorkFlowLinkOld oldmodel = wfbll.GetOldLink(request.Form["wfsid"], "2017021410240001");
                if (oldmodel != null)
                {
                    nextperson = oldmodel.dealuserid.ToString();
                }
            }
            if (nextperson == "0")
            {
                string  userids = "";
                UserBLL userbll = new UserBLL();
                //获取指挥中心人员id
                foreach (UserModel item in userbll.GetUsersStaffList(2))
                {
                    userids += item.ID + ",";
                }
                nextperson = "," + userids;
            }

            WorkFlowClass wf = new WorkFlowClass();

            #region 事件完成生成交办单
            if (request.Form["nextwfdid"] == "2017021410240006")
            {
                SM_CitizenServicesBLL       smbll         = new SM_CitizenServicesBLL();
                Case_CaseSourcesBLL         casesourcebll = new Case_CaseSourcesBLL();
                DocumentReplaceHandleBLL    drhbll        = new DocumentReplaceHandleBLL();
                SM_CitizenServicesModel     smmodel       = smbll.GetCitizenServiceModel(request["citizenid"]);
                Dictionary <string, string> dic           = casesourcebll.ToWordPDF("事件交办单", System.Web.Hosting.HostingEnvironment.MapPath("~/DocumentTemplate/市民事件交办单.docx"), ConfigManageClass.CitizenServiceOriginalPath, drhbll.GetDocumentDictory(smmodel));
                FileClass infileClass = new FileClass();
                infileClass.OriginalPath = dic["PDFPath"];
                infileClass.OriginalName = "事件交办单";
                infileClass.OriginalType = ".pdf";
                list.Add(infileClass);
            }
            #endregion

            #region 事件流程
            wf.FunctionName   = "sm_citizenservices";      //市民事件表名
            wf.WFID           = "2017021409560001";        //工作流程编号 2017021409560001 事件流程
            wf.WFDID          = request.Form["wfdid"];     //工作流详细编号 2017021410240003 事件处理
            wf.NextWFDID      = request.Form["nextwfdid"]; //下一步流程编号 2017021410240004 中队长审核
            wf.NextWFUSERIDS  = nextperson;                //下一步流程ID
            wf.WFSAID         = request.Form["wfsaid"];
            wf.WFSID          = request.Form["wfsid"];
            wf.DEALCONTENT    = request.Form["suggest"];
            wf.IsSendMsg      = "false";                                 //是否发送短信
            wf.WFCreateUserID = Convert.ToInt32(request.Form["userid"]); //当前流程创建人
            wf.files          = list;
            #endregion

            WorkFlowManagerBLL bll = new WorkFlowManagerBLL();
            bll.WF_Submit(wf, model);

            //#region 发送短信
            //string phone = "";//15888309757,18768196242
            //SMS_Messages sm = new SMS_Messages();
            //string[] phones = phone.Split(',');
            //string content = "您有一条新的市民事件需要处理,限办期限:" + model.limittime + ",请及时处理";
            //sm.SendMessage(phones, content);
            //#endregion

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            return(response);
        }