492 lines
15 KiB
C#
492 lines
15 KiB
C#
using CRM.Core.BLL.Util;
|
||
using CRM.Core.Common.Layui;
|
||
using CRM.Core.Model.Entity;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Data;
|
||
using System.Linq.Expressions;
|
||
using CRM.Core.Model.Enum;
|
||
using Newtonsoft.Json;
|
||
using CRM.Core.Common;
|
||
using System.Diagnostics;
|
||
using System.ComponentModel;
|
||
using System.Configuration;
|
||
using System.Text;
|
||
using WX.CRM.Common.StockHelper;
|
||
|
||
namespace CRM.Core.BLL
|
||
{
|
||
public class StockPools_BL : DbContextRepository<StockAudit>
|
||
{
|
||
private CACHE_BL cache_BL = new CACHE_BL();
|
||
|
||
public List<ZxdStockPoolDto> GetList(ref Laypage pager, SearchStockPoolPageDto dto)
|
||
{
|
||
List<ZxdStockPoolDto> result = new List<ZxdStockPoolDto>();
|
||
var url = ConfigurationManager.AppSettings["StockPoolUrl"];
|
||
var appId = ConfigurationManager.AppSettings["StockPoolAppId"];
|
||
var secret = ConfigurationManager.AppSettings["StockPoolSecret"];
|
||
if (string.IsNullOrWhiteSpace(url) || string.IsNullOrWhiteSpace(appId) || string.IsNullOrWhiteSpace(secret))
|
||
{
|
||
LogHelper.Error("请检查相关的股票池配置");
|
||
throw new Exception("请检查相关的股票池配置");
|
||
}
|
||
ApiSignHelper apiSignHelper = new ApiSignHelper(appId, secret);
|
||
url += "/api/Stock/StockPoolPage";
|
||
Dictionary<string, object> param = new Dictionary<string, object>();
|
||
if (!string.IsNullOrWhiteSpace(dto.StockName))
|
||
{
|
||
param.Add("StockName", dto.StockName);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.StockCode))
|
||
{
|
||
param.Add("StockCode", dto.StockCode);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.InduName))
|
||
{
|
||
param.Add("InduName", dto.InduName);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.ChosenDateStart))
|
||
{
|
||
param.Add("ChosenDateStart", dto.ChosenDateStart);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.ChosenDateEnd))
|
||
{
|
||
param.Add("ChosenDateEnd", dto.ChosenDateEnd);
|
||
}
|
||
if (dto.Status.HasValue)
|
||
{
|
||
param.Add("Status", dto.Status);
|
||
}
|
||
param.Add("PageIndex", pager.page);
|
||
param.Add("PageSize", pager.limit);
|
||
var ret = apiSignHelper.GetApi<PageResult<ZxdStockPoolDto>>(url, param);
|
||
if (ret.Code == -1)
|
||
{
|
||
throw new Exception(ret.Message);
|
||
}
|
||
pager.count = ret.Data.Total;
|
||
result = ret.Data.Data.ToList();
|
||
return result;
|
||
}
|
||
public List<ZxdStockAuditDto> GetReportList(ref Laypage pager, SearchStockAuditPageDto dto)
|
||
{
|
||
List<ZxdStockAuditDto> result = new List<ZxdStockAuditDto>();
|
||
var url = ConfigurationManager.AppSettings["StockPoolUrl"];
|
||
var appId = ConfigurationManager.AppSettings["StockPoolAppId"];
|
||
var secret = ConfigurationManager.AppSettings["StockPoolSecret"];
|
||
if (string.IsNullOrWhiteSpace(url) || string.IsNullOrWhiteSpace(appId) || string.IsNullOrWhiteSpace(secret))
|
||
{
|
||
LogHelper.Error("请检查相关的股票池配置");
|
||
throw new Exception("请检查相关的股票池配置");
|
||
}
|
||
ApiSignHelper apiSignHelper = new ApiSignHelper(appId, secret);
|
||
url += "/api/Stock/StockAuditPage";
|
||
Dictionary<string, object> param = new Dictionary<string, object>();
|
||
if (!string.IsNullOrWhiteSpace(dto.ProductLineName))
|
||
{
|
||
param.Add("ProductLineName", dto.ProductLineName);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.ColumnName))
|
||
{
|
||
param.Add("ColumnName", dto.ColumnName);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.StockCode))
|
||
{
|
||
param.Add("StockCode", dto.StockCode);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.StockName))
|
||
{
|
||
param.Add("StockName", dto.StockName);
|
||
}
|
||
if (dto.AuditType.HasValue)
|
||
{
|
||
param.Add("AuditType", dto.AuditType);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.Operator))
|
||
{
|
||
param.Add("Operator", dto.Operator);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.AuditTimeStart))
|
||
{
|
||
param.Add("AuditTimeStart", dto.AuditTimeStart);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.AuditTimeEnd))
|
||
{
|
||
param.Add("AuditTimeEnd", dto.AuditTimeEnd);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.InduName))
|
||
{
|
||
param.Add("InduName", dto.InduName);
|
||
}
|
||
if (dto.Status.HasValue)
|
||
{
|
||
param.Add("Status", dto.Status);
|
||
}
|
||
param.Add("PageIndex", pager.page);
|
||
param.Add("PageSize", pager.limit);
|
||
var ret = apiSignHelper.GetApi<PageResult<ZxdStockAuditDto>>(url, param);
|
||
if (ret.Code != 0)
|
||
{
|
||
throw new Exception(ret.Message);
|
||
}
|
||
|
||
result = ret.Data.Data.ToList();
|
||
pager.count = ret.Data.Total;
|
||
return result;
|
||
}
|
||
public void CheckStockPools(StockAuditOrRejectDto model)
|
||
{
|
||
var auditUrl = ConfigurationManager.AppSettings["StockPoolUrl"] + "/api/Stock/CheckPools";
|
||
var appId = ConfigurationManager.AppSettings["StockPoolAppId"];
|
||
var secret = ConfigurationManager.AppSettings["StockPoolSecret"];
|
||
if (string.IsNullOrWhiteSpace(auditUrl) || string.IsNullOrWhiteSpace(appId) || string.IsNullOrWhiteSpace(secret))
|
||
{
|
||
LogHelper.Error("请检查相关的股票池配置");
|
||
throw new Exception("请检查相关的股票池配置");
|
||
}
|
||
ApiSignHelper apiSignHelper = new ApiSignHelper(appId, secret);
|
||
Dictionary<string, object> pairs = new Dictionary<string, object>();
|
||
var nowTime = DateTime.Now;
|
||
pairs.Add("check", model.check);
|
||
pairs.Add("checkUserName", model.checkUserName);
|
||
pairs.Add("id", model.id);
|
||
pairs.Add("remark", model.remark);
|
||
var result = apiSignHelper.PostApi<string>(auditUrl, pairs);
|
||
if (result.Code == -1)
|
||
{
|
||
throw new Exception(result.Message);
|
||
}
|
||
}
|
||
|
||
}
|
||
public class ZxdStockPoolDto : StockPoolEntity
|
||
{
|
||
/// <summary>
|
||
/// 最新价
|
||
/// </summary>
|
||
public string Price { get; set; }
|
||
|
||
/// <summary>
|
||
/// 实时涨跌幅
|
||
/// </summary>
|
||
public string ZdRatio { get; set; }
|
||
}
|
||
public class StockPoolEntity
|
||
{
|
||
/// <summary>
|
||
/// 日期
|
||
/// </summary>
|
||
public string CreateTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// 股票代码
|
||
/// </summary>
|
||
public string StockCode { get; set; }
|
||
|
||
/// <summary>
|
||
/// 股票名称
|
||
/// </summary>
|
||
public string StockName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 所属行业
|
||
/// </summary>
|
||
public string InduName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 入选日期
|
||
/// </summary>
|
||
public string ChosenDate { get; set; }
|
||
|
||
/// <summary>
|
||
/// 入选价
|
||
/// </summary>
|
||
public decimal ChosenPrice { get; set; }
|
||
|
||
/// <summary>
|
||
/// 入池方式 0自动 1手动
|
||
/// </summary>
|
||
public int? ChosenType { get; set; }
|
||
|
||
/// <summary>
|
||
/// 状态 0正常 1禁用
|
||
/// </summary>
|
||
public int? Status { get; set; }
|
||
public string StatusName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 操作人
|
||
/// </summary>
|
||
public string Operator { get; set; }
|
||
|
||
/// <summary>
|
||
/// 更新时间
|
||
/// </summary>
|
||
public string UpdateTime { get; set; }
|
||
}
|
||
public class ZxdStockAuditDto : StockAuditDto
|
||
{
|
||
public int Id { get; set; }
|
||
|
||
/// <summary>
|
||
/// 是否审核 0 未审核 1 审核通过 -1 驳回
|
||
/// </summary>
|
||
public int? Audit { get; set; }
|
||
public string AuditName { get; set; }
|
||
/// <summary>
|
||
/// 驳回原因
|
||
/// </summary>
|
||
public string RejectedReasons { get; set; }
|
||
|
||
public string RecommendedStockStr { get; set; }
|
||
|
||
/// <summary>
|
||
/// 审核人
|
||
/// </summary>
|
||
public string Auditor { get; set; }
|
||
public string Checker { get; set; }
|
||
|
||
/// <summary>
|
||
/// 操作时间
|
||
/// </summary>
|
||
public DateTime? CheckTime { get; set; }
|
||
}
|
||
public class StockAuditDto
|
||
{
|
||
/// <summary>
|
||
/// 报备ID(唯一编码)
|
||
/// </summary>
|
||
public string AuditId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 产品线Id
|
||
/// </summary>
|
||
public int? ProductLineId { get; set; }
|
||
/// <summary>
|
||
/// 执业证书编号
|
||
/// </summary>
|
||
public string PracticeId { get; set; }
|
||
/// <summary>
|
||
/// 产品线名称
|
||
/// </summary>
|
||
public string ProductLineName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 栏目ID
|
||
/// </summary>
|
||
public int? ColumnId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 栏目名称
|
||
/// </summary>
|
||
public string ColumnName { get; set; }
|
||
/// <summary>
|
||
/// 所属行业
|
||
/// </summary>
|
||
public string InduName { get; set; }
|
||
/// <summary>
|
||
/// 股票代码
|
||
/// </summary>
|
||
public string StockCode { get; set; }
|
||
|
||
/// <summary>
|
||
/// 股票名称
|
||
/// </summary>
|
||
public string StockName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 建议关注价格
|
||
/// </summary>
|
||
public decimal? FocusOnPriceMin { get; set; }
|
||
|
||
/// <summary>
|
||
/// 建议关注价格
|
||
/// </summary>
|
||
public decimal? FocusOnPriceMax { get; set; }
|
||
/// <summary>
|
||
/// 建议关注价格
|
||
/// </summary>
|
||
public string FocusOnPriceName { get; set; }
|
||
/// <summary>
|
||
/// 预警价格
|
||
/// </summary>
|
||
public decimal? WarningPriceMin { get; set; }
|
||
|
||
/// <summary>
|
||
/// 预警价格
|
||
/// </summary>
|
||
public decimal? WarningPriceMax { get; set; }
|
||
public string WarningPriceName { get; set; }
|
||
/// <summary>
|
||
/// 建议仓位
|
||
/// </summary>
|
||
public decimal? RecommendedStock { get; set; }
|
||
|
||
/// <summary>
|
||
/// 建议理由
|
||
/// </summary>
|
||
public string RecommendedReasons { get; set; }
|
||
|
||
/// <summary>
|
||
/// 来源类型
|
||
/// </summary>
|
||
public string SourceType { get; set; }
|
||
|
||
/// <summary>
|
||
/// 来源
|
||
/// </summary>
|
||
public string Source { get; set; }
|
||
|
||
/// <summary>
|
||
/// 操作人
|
||
/// </summary>
|
||
public string Operator { get; set; }
|
||
/// <summary>
|
||
/// 报备方式
|
||
/// </summary>
|
||
public int? AuditType { get; set; }
|
||
public string AuditTypeName { get; set; }
|
||
/// <summary>
|
||
/// 报备时间
|
||
/// </summary>
|
||
public DateTime? CreateTime { get; set; }
|
||
public string CreateTimeName { get; set; }
|
||
|
||
}
|
||
/// <summary>
|
||
/// 股票池筛选框
|
||
/// </summary>
|
||
public class SearchStockPoolPageDto : SearchPageBase
|
||
{
|
||
/// <summary>
|
||
/// 股票代码(支持逗号查询多个,例:909809,324234)
|
||
/// </summary>
|
||
public string StockCode { get; set; }
|
||
|
||
/// <summary>
|
||
/// 股票名称(模糊查询)
|
||
/// </summary>
|
||
public string StockName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 股票所属行业
|
||
/// </summary>
|
||
public string InduName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 入选时间
|
||
/// </summary>
|
||
public string ChosenDateStart { get; set; }
|
||
|
||
/// <summary>
|
||
/// 入选时间
|
||
/// </summary>
|
||
public string ChosenDateEnd { get; set; }
|
||
|
||
/// <summary>
|
||
/// 股票状态 0正常 1禁用
|
||
/// </summary>
|
||
public int? Status { get; set; }
|
||
}
|
||
public class SearchStockAuditPageDto
|
||
{
|
||
/// <summary>
|
||
/// 产品线名称
|
||
/// </summary>
|
||
public string ProductLineName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 栏目名称
|
||
/// </summary>
|
||
public string ColumnName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 股票代码(支持逗号查询多个,例:909809,324234)
|
||
/// </summary>
|
||
public string StockCode { get; set; }
|
||
|
||
/// <summary>
|
||
/// 股票名称(模糊查询)
|
||
/// </summary>
|
||
public string StockName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 报备类型 0 人工 1 AI
|
||
/// </summary>
|
||
public int? AuditType { get; set; }
|
||
|
||
/// <summary>
|
||
/// 报备人
|
||
/// </summary>
|
||
public string Operator { get; set; }
|
||
|
||
/// <summary>
|
||
/// 报备时间
|
||
/// </summary>
|
||
public string AuditTimeStart { get; set; }
|
||
|
||
/// <summary>
|
||
/// 报备时间
|
||
/// </summary>
|
||
public string AuditTimeEnd { get; set; }
|
||
|
||
/// <summary>
|
||
/// 所属行业
|
||
/// </summary>
|
||
public string InduName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 状态 0已报备 1 已审核 -1 已驳回
|
||
/// </summary>
|
||
public int? Status { get; set; }
|
||
}
|
||
public class SearchPageBase
|
||
{
|
||
/// <summary>
|
||
/// 页数
|
||
/// </summary>
|
||
public int PageIndex { get; set; }
|
||
|
||
/// <summary>
|
||
/// 分页大小
|
||
/// </summary>
|
||
public int PageSize { get; set; }
|
||
|
||
/// <summary>
|
||
/// 排序字段,支持逗号隔开
|
||
/// </summary>
|
||
public string Sort { get; set; }
|
||
|
||
/// <summary>
|
||
/// 升降序,Asc/Desc
|
||
/// </summary>
|
||
public string Order { get; set; }
|
||
}
|
||
/// <summary>
|
||
/// 审核 驳回
|
||
/// </summary>
|
||
public class StockAuditOrRejectDto
|
||
{
|
||
/// <summary>
|
||
/// 报备号
|
||
/// </summary>
|
||
public int? id { get; set; }
|
||
|
||
/// <summary>
|
||
/// 审核状态 -1审核拒绝,1审核通过
|
||
/// </summary>
|
||
public int check { get; set; }
|
||
|
||
/// <summary>
|
||
/// 审核人
|
||
/// </summary>
|
||
public string checkUserName { get; set; }
|
||
/// <summary>
|
||
/// 意见备注
|
||
/// </summary>
|
||
public string remark { get; set; }
|
||
}
|
||
|
||
} |