Beispiel #1
0
        private void parseRES(SieDataItem di)
        {
            if (!KONTO.ContainsKey(di.GetString(1)))
            {
                KONTO.Add(di.GetString(1), new SieAccount()
                {
                    Number = di.GetString(1), Company = this.Company, Import = this.Import
                });
            }
            var objOffset = 0;

            if (di.RawData.Contains("{"))
            {
                objOffset = 1;
            }
            var v = new SiePeriodValue()
            {
                YearNr   = di.GetInt(0),
                Account  = KONTO[di.GetString(1)],
                Amount   = di.GetDecimal(2 + objOffset),
                Quantity = di.GetDecimal(3 + objOffset),
                Token    = di.ItemType
            };

            Callbacks.CallbackRES(v);
            if (!StreamValues)
            {
                RES.Add(v);
            }
            return;
        }
        public RES Get(string appId, string categoryId, int pageIndex, int pageSize)
        {
            var res = RES.FAIL("keyName参数未匹配");

            res = YunNewsService.GetInst().QueryList(null);
            return(res);
        }
        public RES QueryList(string filter)
        {
            try
            {
                var checkRes = this.CheckBeforeQueryList(filter);
                if (!checkRes.SUCCESS)
                {
                    return(checkRes);
                }

                var queryFilter = checkRes.DATA as QueryFilter;

                var res  = RedisDB.Current.QueryList <Document>(queryFilter.ToDictionary());
                var list = res.DATA as List <Document>;
                list.ForEach(p =>
                {
                    p.Detail = null;
                });
                return(RES.OK(list));
            }
            catch (Exception ex)
            {
                return(RES.FAIL(ex));
            }
        }
Beispiel #4
0
        private void btnIgual_Click(object sender, EventArgs e)
        {
            segundo = double.Parse(txtIntroducir.Text);

            double SUM;
            double RES;
            double MUL;
            double DIV;

            switch (operador)
            {
            case "+":
                SUM = obj.Sumar((primero), (segundo));
                txtIntroducir.Text = SUM.ToString();
                break;

            case "-":
                RES = obj2.Restar((primero), (segundo));
                txtIntroducir.Text = RES.ToString();
                break;

            case "*":
                MUL = obj3.Multiplicar((primero), (segundo));
                txtIntroducir.Text = MUL.ToString();
                break;

            case "/":
                DIV = obj4.Dividir((primero), (segundo));
                txtIntroducir.Text = DIV.ToString();
                break;
            }
        }
        public RES CreateTask财务分析(string jsonReq, string jsonRes)
        {
            var setName   = $"Stock:BaseData:AllCode";
            var qTaskName = "Stock:Task:CWFX:Task0";

            try
            {
                var count = 0;
                var total = 0;
                REDIS.Current.KeyRemove(qTaskName);
                var res = REDIS.Current.DictTraverse(setName, "*", (dictName, code, name, count2, index) =>
                {
                    var code2 = (code[0] == '6') ? "SH" + code : "SZ" + code;
                    var item  = new
                    {
                        Code       = code,
                        Url        = $"http://f10.eastmoney.com/f10_v2/FinanceAnalysis.aspx?code={code2}",
                        RetryCount = 3
                    };
                    var res2 = REDIS.Current.Enqueue(qTaskName, item);
                    total++;
                    if (res2.SUCCESS)
                    {
                        count++;
                    }
                    return(true);
                });
                res.MESSAGE = $"{MethodBase.GetCurrentMethod().Name} 任务创建完毕 应该创建 {total} 实际 {count}";
                return(res);
            }
            catch (Exception ex)
            {
                return(RES.FAIL($"{MethodBase.GetCurrentMethod().Name} 任务创建异常 {ex.Message}"));
            }
        }
        public RES CreateTask机构调研列表(string jsonReq, string jsonRes)
        {
            var setName   = $"Stock:ALLCode";
            var qTaskName = "Stock:Task:JGDYLB:Task0";

            try
            {
                var count = 0;
                var total = 0;
                REDIS.Current.KeyRemove(qTaskName);
                var res = REDIS.Current.DictTraverse(setName, "*", (dictName, code, name, count2, index) =>
                {
                    var item = new
                    {
                        Code       = code,
                        Url        = $"http://data.eastmoney.com/jgdy/gsjsdy/{code}.html",
                        RetryCount = 3
                    };
                    var res2 = REDIS.Current.Enqueue(qTaskName, item);
                    total++;
                    if (res2.SUCCESS)
                    {
                        count++;
                    }
                    return(true);
                });
                res.MESSAGE = $"{MethodBase.GetCurrentMethod().Name} 任务创建完毕 应该创建 {total} 实际 {count}";
                return(res);
            }
            catch (Exception ex)
            {
                return(RES.FAIL($"{MethodBase.GetCurrentMethod().Name} 任务创建异常 {ex.Message}"));
            }
        }
        public RES UpdateArticle(string keyName, string jsonReq, string jsonRes)
        {
            var setName    = $"Stock:Article";
            var qSyncName  = $"Stock:Sync:2DB:{setName}";
            var methodName = MethodBase.GetCurrentMethod().Name;

            try
            {
                var list  = JSON.ToObject <List <Article> >(jsonRes);
                var count = 0;
                if (null != list && 0 < list.Count)
                {
                    list.ForEach(p =>
                    {
                        p.Id     = GUID.FromStringToGuid(p.Content);
                        var res1 = REDIS.Current.Enqueue(qSyncName, p);
                        var res2 = REDIS.Current.SortedSetAdd(setName, p, double.Parse(p.PublishTime.ToString("yyyyMMddhhmm")));
                        var res  = (res1.SUCCESS && res2.SUCCESS) ? RES.OK() : RES.FAIL();
                        if (res.SUCCESS)
                        {
                            count += 1;
                        }
                    });
                }
                Console.WriteLine($"{MethodBase.GetCurrentMethod().Name} 传入 {list.Count} 实际 {count}");
                return(RES.OK(count, $"传入 {list.Count} 实际 {count}"));
            }
            catch (Exception ex)
            {
                return(RES.FAIL($"{methodName} {ex.Message}"));
            }
        }
        public RES CreateTask北向持股统计(string jsonReq, string jsonRes)
        {
            var setName   = $"Stock:JG";
            var qTaskName = "Stock:Task:BXCGTJ:Task0";

            try
            {
                var count = 0;
                var total = 0;
                REDIS.Current.KeyRemove(qTaskName);
                var res = REDIS.Current.SortedSetTraverse(setName, "*", (dictName2, href, score, count2, index2) =>
                {
                    var item = new
                    {
                        Score      = score,
                        Url        = href,
                        RetryCount = 3
                    };
                    var res2 = REDIS.Current.Enqueue(qTaskName, item);
                    total++;
                    if (res2.SUCCESS)
                    {
                        count++;
                    }
                    return(true);
                });
                res.MESSAGE = $"北向持股统计任务创建完毕 应该创建 {total} 实际 {count}";
                return(res);
            }
            catch (Exception ex)
            {
                return(RES.FAIL($"CreateTask北向持股统计 {ex.Message}"));
            }
        }
 public RES Update所有北向持股明细链接(string jsonReq, string jsonRes)
 {
     try
     {
         var list  = JSON.ToObject <List <Dictionary <string, string> > >(jsonRes);
         var count = 0;
         if (null != list && 0 < list.Count)
         {
             list.ForEach(p =>
             {
                 var dateTag  = p["DateTag"];
                 var listName = $"Stock:Task:BXCGMXURL:{dateTag}";
                 var res      = REDIS.Current.Enqueue(listName, p);
                 if (res.SUCCESS)
                 {
                     count += 1;
                 }
             });
         }
         Console.WriteLine($"{MethodBase.GetCurrentMethod().Name} 传入 {list.Count} 实际 {count}");
         return(RES.OK(count, $"传入 {list.Count} 实际 {count}"));
     }
     catch (Exception ex)
     {
         return(RES.FAIL($"Update所有北向持股明细链接 {ex.Message}"));
     }
 }
        public RES Update所有机构(string jsonReq, string jsonRes)
        {
            var setName   = $"Stock:JG";
            var qSyncName = $"Stock:Sync:2DB:{setName}";

            try
            {
                var list  = JSON.ToObject <List <所有机构> >(jsonRes);
                var count = 0;
                if (null != list && 0 < list.Count)
                {
                    list.ForEach(p =>
                    {
                        var res1 = REDIS.Current.Enqueue(qSyncName, p);
                        var res2 = REDIS.Current.SortedSetAdd(setName, p.Href, p.Sort);
                        var res  = (res1.SUCCESS && res2.SUCCESS) ? RES.OK() : RES.FAIL();
                        if (res.SUCCESS)
                        {
                            count += 1;
                        }
                    });
                }
                Console.WriteLine($"{MethodBase.GetCurrentMethod().Name} 传入 {list.Count} 实际 {count}");
                return(RES.OK(count, $"传入 {list.Count} 实际 {count}"));
            }
            catch (Exception ex)
            {
                return(RES.FAIL($"JG {ex.Message}"));
            }
        }
        public RES GetTask(string keyName, string taskId)
        {
            var listName = $"Stock:Task:{keyName}:{taskId}";

            var res  = REDIS.Current.GetListLastItems(listName, -1000);
            var list = res.DATA as List <string>;

            if (null != list)
            {
                var res4     = RES.FAIL("尚未进行任务分配");
                var hasFound = false;
                list.ForEach(p =>
                {
                    if (!hasFound)
                    {
                        var res2 = this.IsExistTaskStatus(listName, JSON.ToJson(JSON.ToObject <Dictionary <string, object> >(p)));
                        if (!res2.SUCCESS)
                        {
                            var res3 = this.SaveTaskStatus(listName, p);
                            hasFound = true;
                            res4     = RES.OK(p);
                        }
                    }
                });
                return(res4);
            }
            return(RES.FAIL($"{listName} 为空"));
        }
        public static RES SyncDB <T1, T2>(string redis = null) where T1 : class
            where T2 : class
        {
            var qName    = $"MODIFY:{typeof(T1).FullName.Replace(".", ":")}";
            var dictName = $"LIST:{typeof(T1).FullName.Replace(".", ":")}";
            var res      = REDIS.Current.GetQueueLength(qName);

            if (res.SUCCESS)
            {
                var length = (long)res.DATA;
                while (0 < length)
                {
                    var resItem = REDIS.Current.Dequeue <Item>(qName);
                    if (resItem.SUCCESS && resItem.DATA is Item)
                    {
                        var sourceItem = resItem.DATA as Item;
                        var sourceJson = REDIS.Current.DictGet(dictName, sourceItem.ItemID.ToString());
                        var targetItem = JSON.ToObject <T2>(sourceJson.DATA as string);
                        var task       = DB.SaveEntity <T2>(targetItem);
                        Console.WriteLine(task.Result);
                        if (length == 1)
                        {
                            Console.WriteLine($"同步完毕{task.Result}");
                        }
                    }
                    res    = REDIS.Current.GetQueueLength(qName);
                    length = (long)res.DATA;
                }
            }
            return(RES.OK("全部同步完毕"));
        }
        static void Main(string[] args)
        {
            HttpServer.GetInst("http://127.0.0.1:9090/cache/").Run((req) => {
                var res = RES.FAIL("尚未进行任何处理");
                try
                {
                    var buffer = req.DATA as byte[];
                    if (0 < buffer.Length)
                    {
                        var jsonString = Encoding.UTF8.GetString(buffer);
                        var jquest     = JRequest.Parse(jsonString);
                        if (jquest.Method == "Execute")
                        {
                            var serverId = jquest.Param[0];
                            var command  = jquest.Param[1];
                            var paramArr = jquest.Param.ToList().Skip(2).Take(jquest.Param.Length - 2).ToArray();
                            var resExe   = REDIS.GetInst("127.0.0.1", 7379).Execute(serverId, command, paramArr);
                            return(RES.OK(resExe, ENUM.数据类型.ByteArray));
                        }
                    }

                    return(res);
                }
                catch (Exception ex)
                {
                    return(RES.FAIL(ex, ENUM.数据类型.ByteArray));
                }
                finally
                {
                }
            });
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
Beispiel #14
0
        public RES GetTree <T>(string filter, Action <T> callback = null) where T : Category, new()
        {
            try
            {
                var checkRes = this.CheckBeforeQueryList(filter);
                if (!checkRes.SUCCESS)
                {
                    return(checkRes);
                }

                var queryFilter = checkRes.DATA as QueryFilter;

                var res  = RedisDB.Current.QueryList <T>(queryFilter.ToDictionary());
                var list = res.DATA as List <T>;
                if (null != list && null != callback)
                {
                    list.ForEach(p => {
                        callback(p);
                    });
                }
                return(RES.OK(list));
            }
            catch (Exception ex)
            {
                return(RES.FAIL(ex));
            }
        }
Beispiel #15
0
 void Update()
 {
     if (dropDown.value == 0)
     {
         res = RES.A;
     }
     if (dropDown.value == 1)
     {
         res = RES.B;
     }
     if (dropDown.value == 2)
     {
         res = RES.C;
     }
     if (dropDown.value == 3)
     {
         res = RES.D;
     }
     if (dropDown.value == 4)
     {
         res = RES.E;
     }
     if (dropDown.value == 5)
     {
         res = RES.F;
     }
     if (dropDown.value == 6)
     {
         res = RES.G;
     }
     if (dropDown.value == 7)
     {
         res = RES.H;
     }
 }
Beispiel #16
0
 public RES Get()
 {
     try {
         return(RES.FAIL());
     }
     catch (Exception ex) {
         return(RES.FAIL());
     }
 }
        public static void Main(string[] args)
        {
            HttpServer.GetInst("http://localhost:9090/").Run((req) =>
            {
                Console.WriteLine("处理");
                return(RES.OK(Encoding.UTF8.GetBytes("OK"), 数据类型.ByteArray));
            });

            Console.ReadKey();
        }
Beispiel #18
0
 public Form1()
 {
     InitializeComponent();
     A.Init();
     B.Init();
     RES.Init();
     ars = Convert.ToInt32(A.Rows.Count);
     acs = Convert.ToInt32(A.Columns.Count);
     brs = Convert.ToInt32(B.Rows.Count);
     bcs = Convert.ToInt32(B.Columns.Count);
 }
Beispiel #19
0
 private void BmultByNumb_Click(object sender, EventArgs e)
 {
     try
     {
         RES.ToDisplay(MultiplyNum(B, Double.Parse(textBox2.Text)));
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
        public RES Post()
        {
            var keyName = this.Request.Form["keyName"];
            var method  = this.Request.Form["method"];
            var taskId  = this.Request.Form["taskId"];
            var jsonReq = this.Request.Form["jsonReq"];
            var jsonRes = this.Request.Form["jsonRes"];
            var res     = RES.FAIL("keyName参数未匹配");

            return(res);
        }
Beispiel #21
0
 public RES Get(string command, string paramStr)
 {
     try
     {
         var res = REDIS.Current.Execute(string.Empty, command, paramStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
         return(res);
     }
     catch (Exception ex)
     {
         return(RES.FAIL(ex));
     }
 }
Beispiel #22
0
 /// <summary>
 /// 保存前业务数据检查
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 protected RES CheckBeforeSave <T>(string data) where T : Item, new()
 {
     try
     {
         var inst = JSON.ToObject <T>(data);
         return(RES.OK(inst));
     }
     catch (Exception ex)
     {
         return(RES.FAIL(ex));
     }
 }
Beispiel #23
0
 public RES Execute(string serverId, string command, object[] paramArr)
 {
     try
     {
         var res = (RedisValue[])REDIS.redis.GetDatabase().Execute(command, paramArr);
         return(RES.OK(res));
     }
     catch (Exception ex)
     {
         return(RES.FAIL(ex));
     }
 }
Beispiel #24
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         Matrix R = new Matrix(RES.ToDoubleArray());
         B.ToDisplay(R);
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
 protected RES CheckBeforeRemove(string data)
 {
     try
     {
         var inst = JSON.ToObject <Document>(data);
         return(RES.OK(inst));
     }
     catch (Exception ex)
     {
         return(RES.FAIL(ex));
     }
 }
Beispiel #26
0
    public void ResSettings(RES res)
    {
        switch (res)
        {
        case RES.A:
            resWidth  = 3840;
            resHeight = 2160;
            print("Height = " + resHeight + "Width = " + resWidth);
            break;

        case RES.B:
            resWidth  = 2560;
            resHeight = 1440;
            print("Height = " + resHeight + "Width = " + resWidth);
            break;

        case RES.C:
            resWidth  = 1920;
            resHeight = 1080;
            print("Height = " + resHeight + "Width = " + resWidth);
            break;

        case RES.D:
            resWidth  = 1600;
            resHeight = 900;
            print("Height = " + resHeight + "Width = " + resWidth);
            break;

        case RES.E:
            resWidth  = 1366;
            resHeight = 768;
            print("Height = " + resHeight + "Width = " + resWidth);
            break;

        case RES.F:
            resWidth  = 1280;
            resHeight = 720;
            print("Height = " + resHeight + "Width = " + resWidth);
            break;

        case RES.G:
            resWidth  = 1152;
            resHeight = 648;
            print("Height = " + resHeight + "Width = " + resWidth);
            break;

        case RES.H:
            resWidth  = 1024;
            resHeight = 576;
            print("Height = " + resHeight + "Width = " + resWidth);
            break;
        }
    }
 protected RES CheckBeforeQueryList(string data)
 {
     try
     {
         var inst = JSON.ToObject <QueryFilter>(data);
         return(RES.OK(inst));
     }
     catch (Exception ex)
     {
         return(RES.FAIL(ex));
     }
 }
Beispiel #28
0
        ///入队列
        public RES EnQueue(string appId, string queueName, string data)
        {
            try
            {
                var res = this.Http.UploadString(this.url, JRequest.ToJson("Execute", new string[] { appId, "RPUSH", $"{redisKeyQueue}:{queueName}", data }));

                return(RES.OK(res));
            }
            catch (Exception ex)
            {
                return(RES.FAIL(ex));
            }
        }
Beispiel #29
0
        public RES CacheRemove(string appId, string cacheName, string key)
        {
            try
            {
                var res = this.Http.UploadString(this.url, JRequest.ToJson("Execute", new string[] { appId, "DEL", $"{cacheName}:{key}" }));

                return(RES.OK(res));
            }
            catch (Exception ex)
            {
                return(RES.FAIL(ex));
            }
        }
Beispiel #30
0
        ///清空队列
        public RES QueueClear(string appId, string queueName)
        {
            try
            {
                var res = this.Http.UploadString(this.url, JRequest.ToJson("Execute", new string[] { appId, "DEL", $"{redisKeyQueue}:{queueName}" }));

                return(RES.OK(res));
            }
            catch (Exception ex)
            {
                return(RES.FAIL(ex));
            }
        }