admin
2023-12-07 c7c0fc6888d64249b4d9a8af7dc988f6da29e791
风控优化备份20231207FX
11个文件已修改
1个文件已添加
166 ■■■■ 已修改文件
.vs/RiskControlRR/v15/Server/sqlite3/storage.ide 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.BLL/ChinaStockBLL.cs 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.BLL/TushareNewsBLL.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.DAL/GasolineBlend.DAL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.DAL/WenCaiListPara.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.Entity/ComSiteSup.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/ChinaStockController.cs 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/EventKgController.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/UserController.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RiskControl.NewService/Service/AlarmService.cs 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RiskControl.NewService/Service/LeaseAlarmService.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RiskControl.NewService/Service/PayService.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/RiskControlRR/v15/Server/sqlite3/storage.ide
Binary files differ
GasolineBlend.BLL/ChinaStockBLL.cs
@@ -45,7 +45,7 @@
                HttpWebRequest request = (System.Net.HttpWebRequest)WebRequest.Create(url);
                request.Method = "POST";
                // 内容类型
                request.ContentType = "application/json";
                request.ContentType = "application/json;charset=utf-8";
                var payload = System.Text.Encoding.UTF8.GetBytes(content);
                request.ContentLength = payload.Length;
                Stream writer = request.GetRequestStream();
@@ -58,7 +58,7 @@
            }
            catch (Exception e)
            {
                return "";
                return "Error";
            }
        }
        public object GetChinaStockDetail(int CompanyId, int ReportType, string TSCode, int Year)
@@ -83,12 +83,25 @@
            industyStockListPara.SearchInfo = SearchInfo;
            industyStockListPara.ReportType = ReportType;
            string Content = JsonHelper.ToJson(industyStockListPara);
            string GetSarchUrl = $"{URL}/IndustryStock/GetIndustryStockList";
            string Result = SendRequest(GetSarchUrl, Content, Encoding.UTF8);
            string GetSearchUrl = $"{URL}/IndustryStock/GetIndustryStockList";
            string Result = SendRequest(GetSearchUrl, Content, Encoding.UTF8);
            //JavaMsgData javaMsgData = JsonHelper.ToObject<JavaMsgData>(Result);
            return (JObject)JsonConvert.DeserializeObject(Result);
        }
        //public object GetWenCaiAnswerList(string SearchInfo, int PageSize,int PageNo)
        //{
        //    string URL = "http://www.iwencai.com/unifiedwap/unified-wap/v2/result/get-robot-data";
        //    WenCaiListPara wenCaiListPara = new WenCaiListPara();
        //    wenCaiListPara.question = SearchInfo;
        //    wenCaiListPara.perpage = PageSize.ToString();
        //    wenCaiListPara.page = PageNo.ToString();
        //    string Content = JsonHelper.ToJson(wenCaiListPara);
        //    string GetSearchUrl = URL;//+"?question=连续5日成交额大于5亿且股东人数&perpage=1000&page=1&secondary_intent=&log_info={'input_type':'click'}&source=Ths_iwencai_Xuangu&version=2.0";
        //    string Result = SendRequest(GetSearchUrl, Content, Encoding.UTF8);
        //    return (JObject)JsonConvert.DeserializeObject(Result);
        //}
        //public object GetChinaStockList(string SearchInfo, int ReportType)
        //{
        //    string URL = Configs.GetValue("HYSiteUrl");
GasolineBlend.BLL/TushareNewsBLL.cs
@@ -108,7 +108,7 @@
            var StrWhere=" 1=1 ";
            if (ParContent!="")
            {
                 ParContent=ParContent.Replace("(", "").Replace(")", "");
                 ParContent=ParContent.Replace("(", "(").Replace(")", ")");
                 StrWhere += $" and  (contains(Contents ,'*{ParContent}*')";
                 if (ParContent.Length <= 5) //判断是否是上市公司并匹配20230318
                 {
@@ -120,7 +120,7 @@
                         var chinaStockFirst = chinaStocks.FirstOrDefault();
                         if (chinaStockFirst != null)
                         {
                             string FullName = chinaStockFirst.fullname;
                             string FullName = chinaStockFirst.fullname.Replace("(", "(").Replace(")", ")");
                             StrWhere += $" or contains(Contents ,'*{FullName}*') ";
                         }
                     }
@@ -140,7 +140,7 @@
                    for (int i = 0; i < InfoKeywordArray.Length; i++)
                    {
                        StrWhere += (i==0?"":" or ")+ $"  contains(Contents ,'*{InfoKeywordArray[i].Trim()}*') ";
                        StrWhere += (i==0?"":" or ")+ $"  contains(Contents ,'*{InfoKeywordArray[i].Trim().Replace("(", "(").Replace(")", ")")}*') ";
                    }
                    StrWhere += ")";
                }
@@ -218,7 +218,7 @@
            var StrWhere = " 1=1 ";
            if (ParContent != "")
            {
                ParContent = ParContent.Replace("(", "").Replace(")", "");
                ParContent = ParContent.Replace("(", "(").Replace(")", ")");//待优化
                StrWhere += $" and  (contains(Contents ,'*{ParContent}*') "; //or Title like '%{ParContent}%' 
                if (ParContent.Length <= 5) //判断是否是上市公司并匹配20230318
                {
@@ -229,7 +229,7 @@
                        var chinaStockFirst = chinaStocks.FirstOrDefault();
                        if (chinaStockFirst != null)
                        {
                            string FullName = chinaStockFirst.fullname;
                            string FullName = chinaStockFirst.fullname.Replace("(", "(").Replace(")", ")");
                            StrWhere += $" or contains(Contents ,'*{FullName}*')  "; //or Title like '%{FullName}%'
                        }
                    }
@@ -248,7 +248,7 @@
                    string[] InfoKeywordArray = InfoKeyword.Keyword.Split(new char[] { ',', ',' });
                    for (int i = 0; i < InfoKeywordArray.Length; i++)
                    {
                        StrWhere += (i == 0 ? "" : " or ") + $" contains(Contents ,'*{InfoKeywordArray[i].Trim()}*') ";
                        StrWhere += (i == 0 ? "" : " or ") + $" contains(Contents ,'*{InfoKeywordArray[i].Trim().Replace("(", "(").Replace(")", ")")}*') ";
                    }
                    StrWhere += ")";
                }
GasolineBlend.DAL/GasolineBlend.DAL.csproj
@@ -274,6 +274,7 @@
    <Compile Include="WaterfallInnerDAL.cs" />
    <Compile Include="WaterfallTableDAL.cs" />
    <Compile Include="CrawlerMonitorDAL.cs" />
    <Compile Include="WenCaiListPara.cs" />
    <Compile Include="WxUserDAL.cs" />
    <Compile Include="YongYiTrustDAL.cs" />
  </ItemGroup>
GasolineBlend.DAL/WenCaiListPara.cs
New file
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GasolineBlend.DAL
{
   public  class WenCaiListPara
    {
        public string question { get; set; }
        public string perpage { get; set; }
        public string page { get; set; }
        public string secondary_intent { get; set; } = "";
        public string log_info { get; set; } = "{ 'input_type':'click' }";
        public string source { get; set; } = "Ths_iwencai_Xuangu";
        public string version { get; set; } = "2.0";
    }
}
GasolineBlend.Entity/ComSiteSup.cs
@@ -109,6 +109,8 @@
            {
                switch (WarnLevel)
                {
                    case 0:
                        return "无风险";
                    case 1:
                        return "低风险";
                    case 2:
@@ -125,8 +127,17 @@
        /// 内容
        /// </summary>
        public string Content { get; set; }
        /// <summary>
        /// 内容时间
        /// </summary>
        public DateTime ContentTime { get; set; }
        /// <summary>
        /// 是否初次
        /// </summary>
        public bool BlankFlag { get; set; }
        //public DateTime CreateTime { get; set; }
        /// <summary>
        /// 详情
GasolineBlend/Controllers/ChinaStockController.cs
@@ -45,21 +45,6 @@
            }
        }
        //[HttpPost]
        //public ActionResult GetChinaStockDetail(string fullName)
        //{
        //    try
        //    {
        //        var list = _acc.GetChinaStockDetail(fullName);
        //        return SuccessNoShow(data: list);
        //    }
        //    catch (Exception e)
        //    {
        //        LogHelper.Write(Level.Error, "获取上市公司股票详情 GetChinaStockDetail", e,
        //            "Guest"); //OperatorProvider.Instance.Current.LoginName
        //        return Error();
        //    }
        //}
        [HttpPost]
        public ActionResult GetIndustryStockList(string SearchInfo, int ReportType)
@@ -76,5 +61,21 @@
                return Error();
            }
        }
        //[HttpPost]
        //public ActionResult GetWenCaiAnswerList(string SearchInfo, int PageSize, int PageNo)
        //{
        //    try
        //    {
        //        var list = _acc.GetWenCaiAnswerList(SearchInfo,PageSize,PageNo);
        //        return SuccessNoShow(data: list);
        //    }
        //    catch (Exception e)
        //    {
        //        LogHelper.Write(Level.Error, "获取问财问答列表 GetWenCaiAnswerList", e,
        //            "Guest");//OperatorProvider.Instance.Current.LoginName
        //        return Error();
        //    }
        //}
    }
}
GasolineBlend/Controllers/EventKgController.cs
@@ -5,6 +5,7 @@
using CommonHelper;
using GasolineBlend.BLL;
using GasolineBlend.Entity;
using GasolineBlend.Filter;
using RiskControl.NewService.Entity.RRAutoBIDB;
using RiskControl.NewService.Service;
using RiskControl.NewService.ViewModel;
@@ -152,6 +153,20 @@
        }
        /// <summary>
        /// 获取指定Id的预警信息
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpPost]
        [LoginChecked(false)]
        public ActionResult GetDynamicById(int Id)
        {
            var res = _alarmService.GetDynamicById(Id);
            return SuccessNoShow(data: res);
        }
        /// <summary>
        /// 获取投资事件的数量-投资方
        /// </summary>
        /// <param name="title"></param>
GasolineBlend/Controllers/UserController.cs
@@ -1231,6 +1231,7 @@
                account.MoneyMonitorId = MoneyMonitorId;
                account.CompanyMonitorId = CompanyMonitorId;
                account.CurrentTypeId = CurrentTypeId;
                account.ValidDateTime=DateTime.Now.AddMonths(6);
                account.Id = 0;
                var redisClient = new CustomerRedis(0);
RiskControl.NewService/Service/AlarmService.cs
@@ -54,7 +54,7 @@
            //如果企业为空就返回空
            if (companyNames.Length == 0) return new List<WarnEventTypeCountResult>();
            var sqlTemp = $@"SELECT EventType,COUNT(1) num INTO #temp FROM dbo.ComDynamic WHERE CompanyName IN ('{string.Join("','", companyNames)}')
            var sqlTemp = $@"SELECT EventType,COUNT(1) num INTO #temp FROM dbo.ComDynamic WHERE BlankFlag=0 and  CompanyName IN ('{string.Join("','", companyNames)}')
{(startTime == null ? "" : $" AND ContentTime>='{startTime:yyyy-MM-dd HH:mm:ss}'")}
{(endTime == null ? "" : $" AND ContentTime<='{endTime:yyyy-MM-dd HH:mm:ss}'")}
GROUP BY EventType;";
@@ -84,14 +84,14 @@
            {
                eventTypeSql = @"
  SELECT '新闻类' level1,EventType level2,SUM(num) num FROM #temp 
  WHERE EventType IN ('深度信息-经营信息-招投标','深度信息-经营信息-购地信息','深度信息-经营信息-招聘信息','深度信息-经营信息-新闻舆论','深度信息-经营信息-新闻快讯','深度信息-经营信息-新闻资讯','深度信息-经营信息-商标信息','深度信息-经营信息-专利信息')
  WHERE EventType IN ('深度信息-经营信息-招投标','深度信息-经营信息-购地信息','深度信息-经营信息-招聘信息','深度信息-经营信息-新闻舆论','深度信息-经营信息-新闻快讯','深度信息-经营信息-新闻资讯','深度信息-经营信息-商标信息','深度信息-经营信息-专利信息')
  GROUP BY EventType";
            }
            else if (type == "公告类")
            {
                eventTypeSql = @"
  SELECT '公告类' level1,EventType level2,SUM(num) num FROM #temp 
  WHERE EventType IN ('深度信息-上市信息-公司公告-业绩预告','深度信息-上市信息-公司公告-公司公告','深度信息-新三板上市信息-公司公告','深度信息-上市信息-行情走势-交易行情-每日指标', '深度信息-上市信息-行情走势-股东增减持')
  WHERE EventType IN ('深度信息-上市信息-公司公告-业绩预告','深度信息-上市信息-公司公告-公司公告','深度信息-新三板上市信息-公司公告','深度信息-上市信息-行情走势-交易行情-每日指标', '深度信息-上市信息-行情走势-股东增减持','深度信息-上市信息-行情走势-交易行情-资金流向','深度信息-上市信息-行情走势-融资融券','深度信息-上市信息-行情走势-大宗交易','深度信息-上市信息-行情走势-股票回购','深度信息-上市信息-公司资料-基本信息','深度信息-上市信息-分红融资-分红送股')
  GROUP BY EventType";
            }
            else
@@ -185,10 +185,15 @@
                "深度信息-经营信息-招投标", "深度信息-经营信息-购地信息", "深度信息-经营信息-招聘信息", "深度信息-经营信息-新闻舆论","深度信息-经营信息-新闻快讯","深度信息-经营信息-新闻资讯", "深度信息-经营信息-商标信息",
                "深度信息-经营信息-专利信息"
            };
            var anTypeArr = new[] {"深度信息-上市信息-公司公告-业绩预告", "深度信息-上市信息-公司公告-公司公告", "深度信息-新三板上市信息-公司公告", "深度信息-上市信息-行情走势-交易行情-每日指标", "深度信息-上市信息-行情走势-股东增减持" };
            var anTypeArr = new[]
            {
                "深度信息-上市信息-公司公告-业绩预告", "深度信息-上市信息-公司公告-公司公告", "深度信息-新三板上市信息-公司公告", "深度信息-上市信息-行情走势-交易行情-每日指标",
                "深度信息-上市信息-行情走势-股东增减持", "深度信息-上市信息-行情走势-交易行情-资金流向", "深度信息-上市信息-行情走势-融资融券", "深度信息-上市信息-行情走势-大宗交易",
                "深度信息-上市信息-行情走势-股票回购", "深度信息-上市信息-公司资料-基本信息","深度信息-上市信息-分红融资-分红送股"
            };
            var sqlTemp = $@"SELECT EventType,WarnLevel,COUNT(1) Num  FROM dbo.ComDynamic WHERE CompanyName IN ('{string.Join("','", companyNames)}')
            var sqlTemp = $@"SELECT EventType,WarnLevel,COUNT(1) Num  FROM dbo.ComDynamic WHERE BlankFlag=0 and  CompanyName IN ('{string.Join("','", companyNames)}')
{(startTime == null ? "" : $" AND ContentTime>='{startTime:yyyy-MM-dd HH:mm:ss}'")}
{(endTime == null ? "" : $" AND ContentTime<='{endTime:yyyy-MM-dd HH:mm:ss}'")}
GROUP BY EventType,WarnLevel;";
@@ -261,7 +266,12 @@
                "深度信息-经营信息-招投标", "深度信息-经营信息-购地信息", "深度信息-经营信息-招聘信息", "深度信息-经营信息-新闻舆论","深度信息-经营信息-新闻快讯","深度信息-经营信息-新闻资讯", "深度信息-经营信息-商标信息",
                "深度信息-经营信息-专利信息"
            };
            var anTypeArr = new[] { "深度信息-上市信息-公司公告-业绩预告", "深度信息-上市信息-公司公告-公司公告", "深度信息-新三板上市信息-公司公告", "深度信息-上市信息-行情走势-交易行情-每日指标", "深度信息-上市信息-行情走势-股东增减持" };
            var anTypeArr = new[]
            {
                "深度信息-上市信息-公司公告-业绩预告", "深度信息-上市信息-公司公告-公司公告", "深度信息-新三板上市信息-公司公告", "深度信息-上市信息-行情走势-交易行情-每日指标",
                "深度信息-上市信息-行情走势-股东增减持", "深度信息-上市信息-行情走势-交易行情-资金流向", "深度信息-上市信息-行情走势-融资融券", "深度信息-上市信息-行情走势-大宗交易",
                "深度信息-上市信息-行情走势-股票回购", "深度信息-上市信息-公司资料-基本信息","深度信息-上市信息-分红融资-分红送股"
            };
            var result = alarmDb.Queryable<ComDynamic>()
                .WhereIF(startTime != null, a => a.ContentTime >= startTime)
                .WhereIF(endTime != null, a => a.ContentTime <= endTime)
@@ -269,6 +279,7 @@
                .WhereIF(type == "风险", a => rateTypeArr.Contains(a.EventType))
                .WhereIF(type == "新闻", a => newsTypeArr.Contains(a.EventType))
                .WhereIF(type == "公告", a => anTypeArr.Contains(a.EventType))
                .Where(a => a.BlankFlag == false)
                .WhereIF(level != null, a => a.WarnLevel == level)
                .ToList();
            return result;
@@ -301,7 +312,12 @@
                "深度信息-经营信息-招投标", "深度信息-经营信息-购地信息", "深度信息-经营信息-招聘信息", "深度信息-经营信息-新闻舆论","深度信息-经营信息-新闻快讯","深度信息-经营信息-新闻资讯", "深度信息-经营信息-商标信息",
                "深度信息-经营信息-专利信息"
            };
            var anTypeArr = new[] { "深度信息-上市信息-公司公告-业绩预告", "深度信息-上市信息-公司公告-公司公告", "深度信息-新三板上市信息-公司公告", "深度信息-上市信息-行情走势-交易行情-每日指标", "深度信息-上市信息-行情走势-股东增减持" };
            var anTypeArr = new[]
            {
                "深度信息-上市信息-公司公告-业绩预告", "深度信息-上市信息-公司公告-公司公告", "深度信息-新三板上市信息-公司公告", "深度信息-上市信息-行情走势-交易行情-每日指标",
                "深度信息-上市信息-行情走势-股东增减持", "深度信息-上市信息-行情走势-交易行情-资金流向", "深度信息-上市信息-行情走势-融资融券", "深度信息-上市信息-行情走势-大宗交易",
                "深度信息-上市信息-行情走势-股票回购", "深度信息-上市信息-公司资料-基本信息","深度信息-上市信息-分红融资-分红送股"
            };
            var orWhere = Expressionable.Create<ComDynamic>();
            orWhere.AndIF(eventType1.Contains("经营预警类"), a => a.EventType.StartsWith("深度信息-经营预警"))
                .OrIF(eventType1.Contains("司法涉诉类"), a => a.EventType.StartsWith("深度信息-司法涉诉"))
@@ -312,6 +328,7 @@
                .WhereIF(startTime != null, a => a.ContentTime >= startTime)
                .WhereIF(endTime != null, a => a.ContentTime <= endTime)
                .Where(a => companyNames.Contains(a.CompanyName))
                .Where(a => a.BlankFlag==false)
                .Where(orWhere.ToExpression())
                .WhereIF(!string.IsNullOrWhiteSpace(eventType2), a => a.EventType.EndsWith(eventType2))
                .WhereIF(warnLevel != null, a => a.WarnLevel == warnLevel)
@@ -320,6 +337,17 @@
            return result;
        }
        /// <summary>
        /// 获取指定Id的预警信息
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ComDynamic GetDynamicById(int Id)
        {
            var result = alarmDb.Queryable<ComDynamic>()
                .WhereIF(Id > 0, a => a.Id == Id)
               .First();
            return result;
        }
    }
}
RiskControl.NewService/Service/LeaseAlarmService.cs
@@ -4609,7 +4609,7 @@
                var list = tushareService.GetMoneyFlow(queryParam);
                if (list.Result.Data != null)
                {
                    int WarnLevel = 1;
                    int WarnLevel = 0;
                    var slist = (list.Result.Data as IEnumerable<object>).ToList();
                    //交易日期
                    var trade_date = slist[0].GetType().GetProperty("trade_date").GetValue(slist[0]);
@@ -4630,6 +4630,7 @@
                    }
                    else
                    {
                        WarnLevel = 2;
                        Content += $"当日净流出{net_mf_vol}手,";
                    }
                    if (Convert.ToDouble(net_mf_amount) > 0)
RiskControl.NewService/Service/PayService.cs
@@ -21,6 +21,7 @@
                .AndIF(startTime != null, a => a.CreateTime >= startTime)
                .AndIF(endTime != null, a => a.CreateTime <= endTime)
                .AndIF(payment != null, a => a.Payment == payment)
                .And(a=>a.PaymentStatus!= EnumPaymentStatus.Paying)
                .ToExpression();
            var res = await RiskControlRRDb.Queryable<PayOrder>()