Esempio n. 1
0
        /// <summary>
        /// 压缩需求
        /// </summary>
        /// <param name="strFileData"></param>
        /// <param name="UserInfo"></param>
        /// <returns></returns>
        public string CompressZip(string strFileData, JH_Auth_UserB.UserInfo UserInfo)
        {
            Dictionary <String, String> DATA = new Dictionary <String, String>();

            DATA.Add("data", strFileData);
            HttpWebResponse ResponseData = CommonHelp.CreatePostHttpResponse(UserInfo.QYinfo.FileServerUrl + "zipfolder", DATA, 0, "", null);

            return(CommonHelp.GetResponseString(ResponseData));
        }
Esempio n. 2
0
        /// <summary>
        /// 注册新的文件接口
        /// 传入三个参数,qycode name 和description  第一个不能为空, 后两个可以为空,  第一个如果已经插入,就返回错误, 插入正确就返回true
        /// </summary>
        /// <param name="qycode"></param>
        /// <param name="strQYName"></param>
        /// <returns></returns>
        public void AddQycode(string qycode, string strQYName)
        {
            Dictionary <String, String> DATA = new Dictionary <String, String>();

            DATA.Add("qycode", qycode);
            DATA.Add("name", strQYName);
            string          strFileAPIRegUrl = CommonHelp.GetConfig("FileAPIReg").ToString() + "addqycode";
            HttpWebResponse ResponseData     = CommonHelp.CreatePostHttpResponse(strFileAPIRegUrl, DATA, 0, "", null);

            CommonHelp.GetResponseString(ResponseData);
        }
Esempio n. 3
0
        public void VALIDATETOMONOLICENSE(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            JH_Auth_User j = JsonConvert.DeserializeObject <JH_Auth_User>(P1);

            if (j == null)
            {
                msg.ErrorMsg = "绑定失败";
                return;
            }
            if (string.IsNullOrWhiteSpace(j.UserRealName.Trim()))
            {
                msg.ErrorMsg = "姓名不能为空";
                return;
            }
            if (string.IsNullOrWhiteSpace(j.mobphone.Trim()))
            {
                msg.ErrorMsg = "手机号不能为空";
                return;
            }
            if (string.IsNullOrWhiteSpace(j.IDCard.Trim()))
            {
                msg.ErrorMsg = "身份证号不能为空";
                return;
            }
            if (string.IsNullOrWhiteSpace(j.ToMonoLicense.Trim()))
            {
                msg.ErrorMsg = "专卖许可证号不能为空";
                return;
            }
            string url = "http://order.lstobacco.com:5222/tabacco/logistic/validateCustInfo";
            Dictionary <String, String> DATA = new Dictionary <String, String>();

            DATA.Add("licenseCode", j.ToMonoLicense.Trim());
            DATA.Add("idCard", j.IDCard.Trim());
            DATA.Add("userName", j.UserRealName.Trim());
            try
            {
                HttpWebResponse ResponseData = CommonHelp.CreatePostHttpResponse(url, DATA, 0, "", null);
                string          Returndata   = CommonHelp.GetResponseString(ResponseData);
                JObject         json         = (JObject)JsonConvert.DeserializeObject(Returndata);
                msg.Result = json;
            }
            catch (Exception e)
            {
                msg.ErrorMsg = "验证失败,请检查您的信息!";
            }
        }
Esempio n. 4
0
        public string GetWDPages(string CovOfficeUrl, string downloadUrl, string strType)
        {
            Dictionary <String, String> DATA = new Dictionary <String, String>();

            DATA.Add("downloadUrl", downloadUrl);
            if (strType.ToLower().Contains("pdf"))
            {
                DATA.Add("convertType", "28");
            }
            else
            {
                DATA.Add("convertType", "27");
            }
            HttpWebResponse ResponseData = CommonHelp.CreatePostHttpResponse(CovOfficeUrl, DATA, 0, "", null);
            string          Returndata   = CommonHelp.GetResponseString(ResponseData);
            JObject         json         = (JObject)JsonConvert.DeserializeObject(Returndata);

            Returndata = json.GetValue("pagecount").ToString();
            return(Returndata);
        }
Esempio n. 5
0
        /// <summary>
        /// 向服务器发送压缩目录命令
        /// </summary>
        /// <param name="context"></param>
        /// <param name="msg"></param>
        /// <param name="P1">目录ID</param>
        /// <param name="P2"></param>
        /// <param name="UserInfo"></param>
        public void COMPRESSFOLDER(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo)
        {
            string strCode = P1;
            int    ComId   = int.Parse(P2);

            FT_FolderB.FoldFile Mode = new FT_FolderB.FoldFile();
            Mode.FolderID  = -1;
            Mode.Name      = "压缩文件";
            Mode.SubFileS  = new List <FT_File>();
            Mode.SubFolder = new List <FT_FolderB.FoldFile>();
            foreach (string item in P1.SplitTOList(','))
            {
                int    FileID  = int.Parse(item.Split('|')[0].ToString());
                string strType = item.Split('|')[1].ToString();
                if (item.Split('|')[1].ToString() == "file")
                {
                    FT_File file = new FT_FileB().GetEntity(d => d.ID == FileID);
                    file.YLUrl = "";
                    Mode.SubFileS.Add(file);
                }
                else
                {
                    List <FT_FolderB.FoldFileItem> ListID = new List <FT_FolderB.FoldFileItem>();
                    FT_FolderB.FoldFile            obj    = new FT_FolderB().GetWDTREE(FileID, ref ListID, ComId);
                    Mode.SubFolder.Add(obj);
                }
            }
            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();

            timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            string     Result  = JsonConvert.SerializeObject(Mode, Newtonsoft.Json.Formatting.Indented, timeConverter).Replace("null", "\"\"");
            JH_Auth_QY qymodel = new JH_Auth_QYB().GetEntity(d => d.ComId == ComId);
            //压缩文件
            Dictionary <String, String> DATA = new Dictionary <String, String>();

            DATA.Add("data", Result);
            HttpWebResponse ResponseData = CommonHelp.CreatePostHttpResponse(qymodel.FileServerUrl + "zipfolder", DATA, 0, "", null);
            string          strData      = CommonHelp.GetResponseString(ResponseData);

            msg.Result = strData;
        }
Esempio n. 6
0
        public void CoverOffice(string strMD5, string strName, string strType, JH_Auth_UserB.UserInfo UserInfo)
        {
            string CovOfficeUrl = CommonHelp.GetConfig("Covoffice").ToString();

            if (CovOfficeUrl != "")
            {
                Task <string> TaskCover = Task.Factory.StartNew <string>(() =>
                {
                    Dictionary <String, String> DATA = new Dictionary <String, String>();
                    DATA.Add("downloadUrl", UserInfo.QYinfo.FileServerUrl + strMD5);
                    if (strType.ToLower().Contains("pdf"))
                    {
                        DATA.Add("convertType", "14");
                    }
                    else
                    {
                        DATA.Add("convertType", "0");
                    }
                    HttpWebResponse ResponseData = CommonHelp.CreatePostHttpResponse(CovOfficeUrl, DATA, 0, "", null);
                    string Returndata            = CommonHelp.GetResponseString(ResponseData);
                    JObject json  = (JObject)JsonConvert.DeserializeObject(Returndata);
                    JArray array  = (JArray)json["data"];
                    string strUrl = array[0].ToString();

                    string strYear  = DateTime.Now.Year.ToString();
                    string strMonth = DateTime.Now.Month.ToString();
                    string strUrl1  = string.Empty;
                    string strSum   = GetWDPages(CovOfficeUrl, UserInfo.QYinfo.FileServerUrl + strMD5, strType);
                    string strPath  = UserInfo.QYinfo.QYCode + "/" + strYear + "/" + strMonth + strUrl.Substring(strUrl.LastIndexOf('/'), strUrl.Length - strUrl.LastIndexOf('/'));
                    string strWDIP  = CommonHelp.GetConfig("WDIP");
                    string strWDDK  = CommonHelp.GetConfig("WDDK");

                    if (strWDIP != "" && strWDDK != "")
                    {
                        IPAddress ip        = IPAddress.Parse(strWDIP);
                        Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                        try
                        {
                            string str = strUrl.Substring(strUrl.LastIndexOf('/') + 1, strUrl.Length - strUrl.LastIndexOf('/') - 6);
                            strUrl1    = "/ViewV5/Base/" + strType.Substring(0, 3) + ".html?code=" + str;
                            int dk     = Int32.Parse(strWDDK);
                            clientSocket.Connect(new IPEndPoint(ip, dk));                                                                                    //配置服务器IP与端口
                            clientSocket.Send(Encoding.ASCII.GetBytes(str + "_" + UserInfo.QYinfo.QYCode + "_" + strYear + "_" + strMonth + "_" + strType)); //发送请求到服务器
                            //采用新接口获取页码
                            string SQL = string.Format("update FT_File set YLUrl='{0}',ISYL='Y',YLCode='{2}',YLPath='{3}',YLCount='{4}' WHERE FileMD5='{1}'", strUrl1, strMD5, str, strPath.Substring(0, strPath.Length - 5), strSum);
                            Debug.WriteLine("d" + DateTime.Now);

                            new FT_FileB().ExsSclarSql(SQL);
                        }
                        catch (Exception ex)
                        {
                            CommonHelp.WriteLOG(ex.ToString());
                        }
                    }

                    return(strUrl.Replace(":8000", ""));
                });

                TaskCover.ContinueWith((task) =>
                {
                    try
                    {
                        System.Diagnostics.Debug.WriteLine(DateTime.Now);
                        string strUrl = TaskCover.Result;
                    }
                    catch (Exception ex)
                    {
                        CommonHelp.WriteLOG(ex.ToString());
                    }
                });
            }
        }