WX
2023-06-10 72944aba78e562309a53f1bc2bd4f3e413bddafc
Merge branch 'master' of http://47.92.245.94:8000/r/RiskControl_RR_Fast
10个文件已修改
284 ■■■■ 已修改文件
.vs/RiskControlRR/v15/Server/sqlite3/storage.ide 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend.BLL/TushareNewsBLL.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/ComMonitorController.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/EventKgController.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/FRMReportInfoController.cs 195 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/SysAccountNewsController.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/TushareNewsController.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/Controllers/UserController.cs 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
GasolineBlend/GasolineBlend.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RiskControl.NewService/Service/AlarmService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/RiskControlRR/v15/Server/sqlite3/storage.ide
Binary files differ
GasolineBlend.BLL/TushareNewsBLL.cs
@@ -140,7 +140,7 @@
                    for (int i = 0; i < InfoKeywordArray.Length; i++)
                    {
                        StrWhere += (i==0?"":" or ")+ $"  contains(Contents ,'*{InfoKeywordArray[i]}*') ";
                        StrWhere += (i==0?"":" or ")+ $"  contains(Contents ,'*{InfoKeywordArray[i].Trim()}*') ";
                    }
                    StrWhere += ")";
                }
@@ -249,7 +249,7 @@
                    string[] InfoKeywordArray = InfoKeyword.Keyword.Split(new char[] { ',', ',' });
                    for (int i = 0; i < InfoKeywordArray.Length; i++)
                    {
                        StrWhere += (i == 0 ? "" : " or ") + $" contains(Contents ,'*{InfoKeywordArray[i]}*') ";
                        StrWhere += (i == 0 ? "" : " or ") + $" contains(Contents ,'*{InfoKeywordArray[i].Trim()}*') ";
                    }
                    StrWhere += ")";
                }
GasolineBlend/Controllers/ComMonitorController.cs
@@ -138,7 +138,6 @@
                        comMonitor.CompanyState = 1;
                        var rev = _acc.AddComMonitor(comMonitor);
                        return rev > 0 ? Success(data: rev) : Error();
                    }
                    else
                    {
GasolineBlend/Controllers/EventKgController.cs
@@ -102,13 +102,20 @@
        /// <param name="groupId1"></param>
        /// <param name="groupId2"></param>
        /// <returns></returns>
        public ActionResult GetRiskMonitorWarnCountResult2(DateTime? startTime, DateTime? endTime, int groupId1, int groupId2)
        public ActionResult GetRiskMonitorWarnCountResult2(DateTime? startTime, DateTime? endTime, int groupId1=0, int groupId2=0)
        {
            var res1 = _alarmService.GetRiskMonitorWarnCountResult(startTime, endTime, groupId1);
            var res2 = _alarmService.GetRiskMonitorWarnCountResult(startTime, endTime, groupId2);
            List<RiskMonitorWarnCountResult> listRiskMonitorWarnCountResults = new List<RiskMonitorWarnCountResult>();
            listRiskMonitorWarnCountResults.Add(res1);
            listRiskMonitorWarnCountResults.Add(res2);
            if (groupId1 > 0)
            {
                var res1 = _alarmService.GetRiskMonitorWarnCountResult(startTime, endTime, groupId1);
                listRiskMonitorWarnCountResults.Add(res1);
            }
            if (groupId2 > 0)
            {
                var res2 = _alarmService.GetRiskMonitorWarnCountResult(startTime, endTime, groupId2);
                listRiskMonitorWarnCountResults.Add(res2);
            }
            return SuccessNoShow(data: listRiskMonitorWarnCountResults);
        }
GasolineBlend/Controllers/FRMReportInfoController.cs
@@ -62,11 +62,9 @@
            }
        }
        /// <summary>
        /// 上传图片
        /// 上传图片(Drop)
        /// </summary>
        /// <param name="fileNames"></param>
        /// <param name="note"></param>
        /// <param name="sid"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> AddImg2(string UserId)
@@ -205,108 +203,125 @@
            }
        }
        /// <summary>
        /// 上传图片
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> AddImg(string UserId)
        public async Task<ActionResult> AddImg(int UserId)
        {
            //初始化FRMReportInfo类
            FRMReportInfo fRMReportInfo = new FRMReportInfo();//创建记录
            fRMReportInfo.UserId = UserId;
            if (HttpContext.Request.Files.Count == 0)
                return Error("上传请求文件为0!");
            if (HttpContext.Request.Files.Count != 1)
                return Error("只能上次一张图片!");
            var uploadFile = HttpContext.Request.Files[0]; //上传文件
            if (uploadFile == null)
                return Error("图片为空!请重新上传!");
            FileInfo file = new FileInfo(uploadFile.FileName);
            if (file.Extension != ".jpg" && file.Extension != ".jpeg" && file.Extension != ".png")
                return Error("只能上传图片!请重新上传!");
            if (uploadFile.InputStream.Length > 4 * 1024 * 1024) //1024*1024*100=100M--前端验证
                return Error("文件大小已经超过4M!请重新上传!");
            var createTime = DateTime.Now.ToString("yyyyMMddHHmm");//创建时间
            var filepath = string.Format("{0}【{1}】{2}", _virtualPath, createTime,
                uploadFile.FileName);
            var filename =
                Server.MapPath(string.Format("{0}【{1}】{2}", _virtualPath, createTime, uploadFile.FileName));
            Directory.CreateDirectory(Server.MapPath(_virtualPath));
            uploadFile.SaveAs(filename);
            fRMReportInfo.ImgPath = filepath;
            byte[] bytes;
            using (var memoryStream = new MemoryStream())
            //判断当前的金额是否能支付本次消耗
            UseOrderService _useOrderService = new UseOrderService();
            PayOrderService _payOrderService = new PayOrderService();
            AccountBLL _accountBll = new AccountBLL();
            SysBusinessPlanBLL _sysBusinessPlanBll = new SysBusinessPlanBLL();
            var paySum = await _payOrderService.SumAsync(a => a.CreateUserId == UserId && a.PaymentStatus == EnumPaymentStatus.Success, "OrderAmount");
            var useSum = await _useOrderService.SumAsync(a => a.CreateUserId == UserId, "OrderAmount");
            var userGrade = _accountBll.GetUserGradeById(UserId);
            var freeDescNo = _sysBusinessPlanBll.GetFreeDescbyName("公司财报OCR");
            var vipDescNo = _sysBusinessPlanBll.GetVipDescbyName("公司财报OCR");
            UseOrder param = new UseOrder();
            param.CreateUserId = UserId;//int.Parse(UserId);
            param.OrderType = "公司财报OCR";
            param.OrderNo = Guid.NewGuid().ToString("N");
            if (userGrade == UserGradeType.Free.GetDisplayName()) //普通版
            {
                uploadFile.InputStream.CopyTo(memoryStream);
                bytes = memoryStream.ToArray();
            }
            var base64Str = Convert.ToBase64String(bytes);
            var table = await ResultsIdentifyBLL.AliOcrTable(base64Str);
            if (table != null)
            {
                string fileName = uploadFile.FileName.Replace(file.Extension, "");
                fRMReportInfo.ImgName = fileName;
                var title = "OCR_" + DateTime.Now.ToString("yyyyMMddhhmmssfff");
                var ExcelPath = string.Format("{0}【{1}】{2}", _savePath, createTime,
                    title.ToString() + ".xlsx");
                var ExcelPathShow = string.Format("{0}【{1}】{2}", _savePath, createTime,
                    title.ToString() + "_Show" + ".xlsx");
                var RealPath = Server.MapPath(string.Format("{0}【{1}】{2}", _excelPath, createTime,
                    title.ToString() + ".xlsx"));
                Directory.CreateDirectory(Server.MapPath(_excelPath));
                NPOIHelper.FRMExportExcel(table, RealPath, title, true);
                fRMReportInfo.ReportName = title + ".xlsx";
                fRMReportInfo.ReportPath = ExcelPath;
                fRMReportInfo.ReportPath_Show = ExcelPathShow;
                param.OrderAmount = freeDescNo;
                param.PayAmount = freeDescNo;
            }
            else
            {
                return Error("识别失败!图片智能识别结果为空!");
                param.OrderAmount = vipDescNo;
                param.PayAmount = vipDescNo;
            }
            bool result = _acc.AddFRMReport(fRMReportInfo);
            // 保存失败修改文件名
            if (!result)
            if (paySum < useSum+param.PayAmount)
            {
                if (System.IO.File.Exists(filename))
                return Error("识别失败!当前金币额度不足!请及时充值!");
            }
            else
            {
                //初始化FRMReportInfo类并推荐业务
                FRMReportInfo fRMReportInfo = new FRMReportInfo();//创建记录
                fRMReportInfo.UserId = UserId.ToString();
                if (HttpContext.Request.Files.Count == 0)
                    return Error("上传请求文件为0!");
                if (HttpContext.Request.Files.Count != 1)
                    return Error("只能上次一张图片!");
                var uploadFile = HttpContext.Request.Files[0]; //上传文件
                if (uploadFile == null)
                    return Error("图片为空!请重新上传!");
                FileInfo file = new FileInfo(uploadFile.FileName);
                if (file.Extension != ".jpg" && file.Extension != ".jpeg" && file.Extension != ".png")
                    return Error("只能上传图片!请重新上传!");
                if (uploadFile.InputStream.Length > 4 * 1024 * 1024) //1024*1024*100=100M--前端验证
                    return Error("文件大小已经超过4M!请重新上传!");
                var createTime = DateTime.Now.ToString("yyyyMMddHHmm");//创建时间
                var filepath = string.Format("{0}【{1}】{2}", _virtualPath, createTime,
                    uploadFile.FileName);
                var filename =
                    Server.MapPath(string.Format("{0}【{1}】{2}", _virtualPath, createTime, uploadFile.FileName));
                Directory.CreateDirectory(Server.MapPath(_virtualPath));
                uploadFile.SaveAs(filename);
                fRMReportInfo.ImgPath = filepath;
                byte[] bytes;
                using (var memoryStream = new MemoryStream())
                {
                    var newName = Regex.Replace(filename, @"【\d*】", $"【保存失败{DateTime.Now:yyyyMMdd}】");
                    //文件名重复,删除之前的
                    if (System.IO.File.Exists(newName))
                    {
                        System.IO.File.Delete(newName);
                    }
                    System.IO.File.Move(filename, newName);
                    uploadFile.InputStream.CopyTo(memoryStream);
                    bytes = memoryStream.ToArray();
                }
                return Error("保存文件失败!");
            }
            else
            {
                //消耗积分存入系统20230525FX
                UseOrderService _orderService = new UseOrderService();
                AccountBLL _accountBll = new AccountBLL();
                SysBusinessPlanBLL _sysBusinessPlanBll = new SysBusinessPlanBLL();
                var userGrade = _accountBll.GetUserGradeById(int.Parse(UserId));
                var freeDescNo = _sysBusinessPlanBll.GetFreeDescbyName("公司财报OCR");
                var vipDescNo = _sysBusinessPlanBll.GetVipDescbyName("公司财报OCR");
                UseOrder param = new UseOrder();
                param.CreateUserId = int.Parse(UserId);
                param.OrderType = "公司财报OCR";
                param.OrderNo = Guid.NewGuid().ToString("N");
                if (userGrade == UserGradeType.Free.GetDisplayName()) //普通版
                var base64Str = Convert.ToBase64String(bytes);
                var table = await ResultsIdentifyBLL.AliOcrTable(base64Str);
                if (table != null)
                {
                    param.OrderAmount = freeDescNo;
                    param.PayAmount = freeDescNo;
                    string fileName = uploadFile.FileName.Replace(file.Extension, "");
                    fRMReportInfo.ImgName = fileName;
                    var title = "OCR_" + DateTime.Now.ToString("yyyyMMddhhmmssfff");
                    var ExcelPath = string.Format("{0}【{1}】{2}", _savePath, createTime,
                        title.ToString() + ".xlsx");
                    var ExcelPathShow = string.Format("{0}【{1}】{2}", _savePath, createTime,
                        title.ToString() + "_Show" + ".xlsx");
                    var RealPath = Server.MapPath(string.Format("{0}【{1}】{2}", _excelPath, createTime,
                        title.ToString() + ".xlsx"));
                    Directory.CreateDirectory(Server.MapPath(_excelPath));
                    NPOIHelper.FRMExportExcel(table, RealPath, title, true);
                    fRMReportInfo.ReportName = title + ".xlsx";
                    fRMReportInfo.ReportPath = ExcelPath;
                    fRMReportInfo.ReportPath_Show = ExcelPathShow;
                }
                else
                {
                    param.OrderAmount = vipDescNo;
                    param.PayAmount = vipDescNo;
                    return Error("识别失败!图片智能识别结果为空!");
                }
                await _orderService.AddAsync(param);
                return Success(data: fRMReportInfo.ReportPath);
            }
                bool result = _acc.AddFRMReport(fRMReportInfo);
                // 保存失败修改文件名
                if (!result)
                {
                    if (System.IO.File.Exists(filename))
                    {
                        var newName = Regex.Replace(filename, @"【\d*】", $"【保存失败{DateTime.Now:yyyyMMdd}】");
                        //文件名重复,删除之前的
                        if (System.IO.File.Exists(newName))
                        {
                            System.IO.File.Delete(newName);
                        }
                        System.IO.File.Move(filename, newName);
                    }
                    return Error("保存文件失败!");
                }
                else
                {
                    //消耗积分存入系统20230525FX
                    await _useOrderService.AddAsync(param);
                    return Success(data: fRMReportInfo.ReportPath);
                }
            }
        }
        /// <summary>
GasolineBlend/Controllers/SysAccountNewsController.cs
@@ -2,9 +2,6 @@
using GasolineBlend.BLL;
using GasolineBlend.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace GasolineBlend.Controllers
@@ -54,12 +51,12 @@
                if (_acc.ExistSysAccountNews(sysAccountNews,false) == false)
                {
                    int res = _acc.AddSysAccountNews(sysAccountNews);
                    return res > 0 ? Success() : Error();
                    return res > 0 ? Success("自定义关键词配置成功!") : Error();
                }
                else
                {
                    bool res = _acc.UpdateSysAccountNews(Keyword, UserId, TypeId);
                    return res ? Success() : Error();
                    return res ? Success("自定义关键词配置成功!") : Error();
                }
                
            }
GasolineBlend/Controllers/TushareNewsController.cs
@@ -1,9 +1,6 @@
using CommonHelper;
using GasolineBlend.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GasolineBlend.Filter;
GasolineBlend/Controllers/UserController.cs
@@ -197,52 +197,10 @@
                            account.CurrentTypeName = "accountManagement";
                        }
                    }
                    else
                    {
                        //var PathList = pageRouteBLL.GetPathArr(/*account.CurrentTypeId*/CurrentInfo.TypeId);
                        //_acc.UpdCurrentTypeId(PathList[0].TypeId, PathList[0].Name, PathList[0].Redirect, OperatorProvider.Instance.Current.UserId);
                        //var PathName = PathList.Select(p => p.Name).ToList();
                        //var PathAll = pageRouteBLL.GetPathList(/*account.CurrentTypeId*/CurrentInfo.TypeId);
                        //if (MoneyMonitorShow == false)
                        //{
                        //    PathName.Remove("diligenceTools2s");
                        //}
                        //if (CompanyMonitorShow == false)
                        //{
                        //    PathName.Remove("enterpriseControls");
                        //}
                        //  PathName = PathName.OrderByDescending(x => x == Name).ToList();
                        //var Path = string.Join(",", PathName.ToArray());
                        //access = Path;
                        //if (access == "" || account.CurrentRedirect == "" || account.CurrentTypeName == "" || account.CurrentTypeId == 0)
                        //{
                        //    access = "newdiligenceTools";
                        //    account.CurrentRedirect = "newsFlashEx_tool";
                        //    account.CurrentTypeId = 3;
                        //    account.CurrentTypeName = "newdiligenceTools";
                        //    LogHelper.Error($"当前路由获取为空,当前账号为:{OperatorProvider.Instance.Current.LoginName}");
                        //}
                        //else if (PathAll.Find(p => p.Name == account.CurrentTypeName && p.Redirect == account.CurrentRedirect) == null)
                        //{
                        //    access = "newdiligenceTools";
                        //    account.CurrentRedirect = "newsFlashEx_tool";
                        //    account.CurrentTypeId = 3;
                        //    account.CurrentTypeName = "newdiligenceTools";
                        //    LogHelper.Error($"当前路由获取错误(CurrentTypeName为:{account.CurrentTypeName}CurrentRedirect为:{account.CurrentRedirect}),当前账号为:{OperatorProvider.Instance.Current.LoginName}");
                        //}
                        //else
                        //{
                        //    access = Path;
                        //}
                    }
                    //if (account.CurrentTypeId == 9)
                    //{
                    //    _acc.UpdCurrentTypeId(2, "_homeEx", "homeEx", account.Id);
                    //}
                    //var  newaccountinfo = _acc.GetAccount(OperatorProvider.Instance.Current.UserId);
                    //UseOrderService _useOrderService = new UseOrderService();
                    //PayOrderService _payOrderService = new PayOrderService();
                    //var paySum = _payOrderService.SumAsync(a => a.CreateUserId == id && a.PaymentStatus == EnumPaymentStatus.Success, "OrderAmount");
                    //var useSum = _useOrderService.SumAsync(a => a.CreateUserId == id, "OrderAmount");
                    var accessArr = access.Split(',');
                    var obj = new
                    {
@@ -941,8 +899,8 @@
                        return Error("当前账号所属主体不正确!请重新输入!");
                    if (user.IsDeleted == 1)
                        return Error("当前账号已被管理员禁用!请联系管理员解锁!");
                    if (user.ValidDateTime<DateTime.Now)
                        return Error($"当前账号已过期({user.ValidDateTime.ToString("yyyy-MM-dd")})!请联系管理员延长期限!");
                    //if (user.ValidDateTime<DateTime.Now)
                    //    return Error($"当前账号已过期({user.ValidDateTime.ToString("yyyy-MM-dd")})!请联系管理员延长期限!");
                }
                else//微信登录的情况
GasolineBlend/GasolineBlend.csproj
@@ -423,6 +423,7 @@
    <Folder Include="Pages\" />
    <Folder Include="TableFiles\" />
    <Folder Include="TemplateFiles\" />
    <Folder Include="UploadFiles\IndustryChainAnnex\" />
    <Folder Include="UploadFiles\RRMonitorGroup\" />
    <Folder Include="Views\FinCashFlowTableSup\" />
    <Folder Include="Views\FinCustomAff\" />
RiskControl.NewService/Service/AlarmService.cs
@@ -65,7 +65,7 @@
            {
                eventTypeSql = @"
  SELECT '公告类' level1,EventType level2,SUM(num) num FROM #temp 
  WHERE EventType IN ('深度信息-上市信息-公司公告-业绩预告','深度信息-上市信息-公司公告-公司公告','深度信息-新三板上市信息-公司公告','深度信息-上市信息-行情走势-交易行情-每日指标', '深度信息 - 上市信息 - 行情走势 - 股东增减持')
  WHERE EventType IN ('深度信息-上市信息-公司公告-业绩预告','深度信息-上市信息-公司公告-公司公告','深度信息-新三板上市信息-公司公告','深度信息-上市信息-行情走势-交易行情-每日指标', '深度信息-上市信息-行情走势-股东增减持')
  GROUP BY EventType";
            }
            else