587 lines
19 KiB
C#
587 lines
19 KiB
C#
using Newtonsoft.Json;
|
||
using Ninject;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Web.Mvc;
|
||
using WX.CRM.BLL.Util;
|
||
using WX.CRM.Common;
|
||
using WX.CRM.Common.StockHelper;
|
||
using WX.CRM.Model.Enum;
|
||
using WX.CRM.WebHelper;
|
||
|
||
namespace WX.CRM.WEB.Controllers.StockPools
|
||
{
|
||
/// <summary>
|
||
/// 企业微信列表
|
||
/// </summary>
|
||
public class StockPoolsController : BaseController
|
||
{
|
||
[Inject]
|
||
public CACHE_BL cache_BL { get; set; }
|
||
//
|
||
// GET: /WorkWx/
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_股票池业务查询)]
|
||
public ActionResult Index()
|
||
{
|
||
//ToolBar
|
||
ToolBar tool = new ToolBar();
|
||
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.股票池业务查询, userRightId);
|
||
tool.AllowButton(toolbtn);
|
||
tool.AddOtherButton("Other1", "聊天记录", "icon-detail", "ChatRecord_Click", true);
|
||
ViewBag.ToolBar = tool;
|
||
|
||
string tableId = "tablist";
|
||
Table tab = new Table(tableId);
|
||
//table
|
||
Pager pager = new Pager() { page = 1, rows = 20 };
|
||
//tab.isCheckbox = true;
|
||
tab.AddHeadCol("ProductLineName", "", "产品线");
|
||
tab.AddHeadCol("ColumnName", "", "栏目");
|
||
tab.AddHeadCol("StockName", "", "股票名称");
|
||
tab.AddHeadCol("StockCode", "", "股票代码");
|
||
tab.AddHeadCol("InduName", "", "所属行业");
|
||
tab.AddHeadCol("FocusOnPriceName", "", "建议关注价格");
|
||
tab.AddHeadCol("WarningPriceName", "", "预警价格");
|
||
/* tab.AddHeadCol("RecommendedStock", "", "建议仓位");*/
|
||
tab.AddHeadCol("CreateTimeName", "", "报备时间");
|
||
tab.AddHeadCol("AuditTypeName", "", "报备方式");
|
||
tab.AddHeadCol("Operator", "", "报备人");
|
||
tab.AddHeadCol("NowPrice", "", "当日价");
|
||
tab.AddHeadCol("Price", "", "最新价");
|
||
tab.AddHeadCol("ZdRatio", "", "今日涨幅", true);
|
||
tab.AddHeadCol("SumRatio", "", "累计涨幅", true);
|
||
//tab.AddHeadCol("WeekPrice", "", "周期价格");
|
||
tab.AddHeadCol("WeekRatio", "", "周期涨幅");
|
||
tab.AddHeadCol("UserOperator", "", "操作");
|
||
tab.AddHeadRow();
|
||
ViewBag.gridTable = tab.GetHead() + Pagination.GetPage(pager, tableId, "5,10,15,20");
|
||
var select = BuildInduNameList();
|
||
ViewBag.InduList = select.InduInfo;
|
||
ViewBag.ProductLineName = select.ProductLineName;
|
||
ViewBag.OperatorName = select.OperatorName;
|
||
ViewBag.ColumnName = select.ColumnName;
|
||
return View();
|
||
}
|
||
|
||
|
||
[HttpPost]
|
||
[AuthorizeRedirect(Roles = InitRights.CONST_股票池业务查询)]
|
||
public JsonResult GetHtmlList(string columns, Pager pager, SearchStockAuditPageDto dto)
|
||
{
|
||
List<CrmStockAuditDto> result = new List<CrmStockAuditDto>();
|
||
var setting = cache_BL.GetValue_Parameter(Parameter.StockPoolsSetting);
|
||
var signConfig = JsonConvert.DeserializeObject<SignConfig>(setting);
|
||
string appId = signConfig.AppId;
|
||
string secret = signConfig.Secret;
|
||
var url = signConfig.Host + "/api/Stock/CrmStockAuditPage";
|
||
if (string.IsNullOrWhiteSpace(url) || string.IsNullOrWhiteSpace(appId) || string.IsNullOrWhiteSpace(secret))
|
||
{
|
||
LogHelper.Error("请检查相关的股票池配置");
|
||
throw new Exception("请检查相关的股票池配置");
|
||
}
|
||
ApiSignHelper apiSignHelper = new ApiSignHelper(appId, secret);
|
||
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.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.AuditTimeStart))
|
||
{
|
||
param.Add("AuditTimeStart", dto.AuditTimeStart);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.AuditTimeEnd))
|
||
{
|
||
param.Add("AuditTimeEnd", dto.AuditTimeEnd);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.Operator))
|
||
{
|
||
param.Add("Operator", dto.Operator);
|
||
}
|
||
if (dto.RiseType.HasValue)
|
||
{
|
||
param.Add("RiseType", dto.RiseType);
|
||
}
|
||
if (dto.Day.HasValue)
|
||
{
|
||
param.Add("Day", dto.Day);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(pager.sort))
|
||
{
|
||
param.Add("Sort", pager.sort);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(pager.order))
|
||
{
|
||
param.Add("Order", pager.order);
|
||
}
|
||
if (dto.AuditType.HasValue)
|
||
{
|
||
param.Add("AuditType", dto.AuditType);
|
||
}
|
||
param.Add("PageIndex", pager.page);
|
||
param.Add("PageSize", pager.rows);
|
||
var ret = apiSignHelper.GetApi<PageResult<CrmStockAuditDto>>(url, param);
|
||
if (ret.Code == -1)
|
||
{
|
||
throw new Exception(ret.Message);
|
||
}
|
||
result = (List<CrmStockAuditDto>)ret.Data.Data;
|
||
Table table = new Table(columns, true);
|
||
foreach (var item in result)
|
||
{
|
||
table.AddCol(item.ProductLineName);
|
||
table.AddCol(item.ColumnName);
|
||
table.AddCol(item.StockName);
|
||
table.AddCol(item.StockCode);
|
||
table.AddCol(item.InduName);
|
||
table.AddCol(item.FocusOnPriceName);
|
||
table.AddCol(item.WarningPriceName);
|
||
/* if (item.RecommendedStock.HasValue)
|
||
{
|
||
table.AddCol(item.RecommendedStock+"%");
|
||
}
|
||
else
|
||
{
|
||
table.AddCol(item.RecommendedStock);
|
||
}*/
|
||
table.AddCol(item.CreateTimeName);
|
||
table.AddCol(item.AuditTypeName);
|
||
table.AddCol(item.Operator);
|
||
table.AddCol(item.NowPrice);
|
||
table.AddCol(item.Price);
|
||
table.AddCol(item.ZdRatio);
|
||
table.AddCol(item.SumRatio);
|
||
//table.AddCol(item.WeekPrice);
|
||
table.AddCol(item.WeekRatio);
|
||
var setTimelink = string.Format("<div><a href='javascript:GetArticle({0})'>原始场景复现</a></div>", item.Id);
|
||
if (item.HasBtn.HasValue && !item.HasBtn.Value)
|
||
{
|
||
setTimelink = "";
|
||
}
|
||
table.AddCol(setTimelink);
|
||
table.AddRow();
|
||
}
|
||
DateTime nowtime = DateTime.Now;
|
||
var json = new
|
||
{
|
||
totalPages = (int)Math.Ceiling((float)ret.Data.Total / (float)pager.rows),
|
||
totalRows = ret.Data.Total,
|
||
rowsList = table.GetRows(),
|
||
foot = table.GetFoot(),
|
||
};
|
||
return Json(json, JsonRequestBehavior.AllowGet);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 行业下拉框
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public DropSelectList BuildInduNameList()
|
||
{
|
||
try
|
||
{
|
||
var setting = cache_BL.GetValue_Parameter(Parameter.StockPoolsSetting);
|
||
var signConfig = JsonConvert.DeserializeObject<SignConfig>(setting);
|
||
string appId = signConfig.AppId;
|
||
string secret = signConfig.Secret;
|
||
ApiSignHelper apiSignHelper = new ApiSignHelper(appId, secret);
|
||
var url = signConfig.Host + "/api/Stock/GetDropSelectList";
|
||
Dictionary<string, object> param = new Dictionary<string, object>();
|
||
var ret = apiSignHelper.GetApi<string>(url, param);
|
||
DropSelectList dropSelectList = JsonConvert.DeserializeObject<DropSelectList>(ret.Data);
|
||
|
||
return dropSelectList;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Error($"获取下拉框失败{ex.Message}");
|
||
return new DropSelectList();
|
||
}
|
||
}
|
||
[HttpGet]
|
||
public ActionResult GetArticle(int id)
|
||
{
|
||
ArticleModel articleModel = new ArticleModel
|
||
{
|
||
Id = id
|
||
};
|
||
return View(articleModel);
|
||
}
|
||
|
||
[HttpGet]
|
||
public JsonResult getData(int ID)
|
||
{
|
||
var setting = cache_BL.GetValue_Parameter(Parameter.StockPoolsSetting);
|
||
var signConfig = JsonConvert.DeserializeObject<SignConfig>(setting);
|
||
string appId = signConfig.AppId;
|
||
string secret = signConfig.Secret;
|
||
ApiSignHelper apiSignHelper = new ApiSignHelper(appId, secret);
|
||
var url = signConfig.Host + "/api/Stock/GetArticle";
|
||
Dictionary<string, object> param = new Dictionary<string, object>();
|
||
param.Add("id", ID);
|
||
var ret = apiSignHelper.GetApi<ArticleModel>(url, param);
|
||
if (ret.Code == -1)
|
||
{
|
||
ArticleModel articleModel = new ArticleModel
|
||
{
|
||
Id = ID,
|
||
publishedAt = apiSignHelper.GetTimeStampByTime(DateTime.Now),
|
||
createdAt = apiSignHelper.GetTimeStampByTime(DateTime.Now)
|
||
};
|
||
return Json(articleModel, JsonRequestBehavior.AllowGet);
|
||
}
|
||
if (ret.Data.productLine == 1004 || ret.Data.contentType == 4)
|
||
{
|
||
ret.Data.isPicture = true;
|
||
}
|
||
return Json(ret.Data, JsonRequestBehavior.AllowGet);
|
||
}
|
||
}
|
||
public class DropSelectList
|
||
{
|
||
/// <summary>
|
||
/// 行业
|
||
/// </summary>
|
||
public List<SelectListItem> InduInfo = new List<SelectListItem>();
|
||
|
||
/// <summary>
|
||
/// 产品
|
||
/// </summary>
|
||
public List<SelectListItem> ProductLineName = new List<SelectListItem>();
|
||
|
||
/// <summary>
|
||
/// 栏目
|
||
/// </summary>
|
||
public List<SelectListItem> ColumnName = new List<SelectListItem>();
|
||
|
||
/// <summary>
|
||
/// 人员
|
||
/// </summary>
|
||
public List<SelectListItem> OperatorName = new List<SelectListItem>();
|
||
}
|
||
public class CrmStockAuditDto : 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; }
|
||
|
||
/// <summary>
|
||
/// 审核人
|
||
/// </summary>
|
||
public string Auditor { get; set; }
|
||
public string NowPrice { get; set; }
|
||
public decimal? Price { get; set; }
|
||
public string ZdRatio { get; set; }
|
||
public string SumRatio { get; set; }
|
||
public string WeekPrice { get; set; }
|
||
public string WeekRatio { get; set; }
|
||
public string Picture { get; set; }
|
||
public bool? HasBtn { 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; }
|
||
|
||
}
|
||
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>
|
||
/// 统计周期
|
||
/// </summary>
|
||
public int? RiseType { get; set; }
|
||
|
||
/// <summary>
|
||
/// 统计周期
|
||
/// </summary>
|
||
public int? Day { get; set; }
|
||
/// <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 InduInfo
|
||
{
|
||
public string induName { get; set; }
|
||
public decimal? induCode { get; set; }
|
||
}
|
||
public class SignConfig
|
||
{
|
||
public string AppId { get; set; }
|
||
public string Secret { get; set; }
|
||
public string Host { get; set; }
|
||
}
|
||
/// <summary>
|
||
/// 场景接收实体
|
||
/// </summary>
|
||
public class ArticleModel
|
||
{
|
||
public int Id { get; set; }
|
||
public int? productLine { get; set; }
|
||
public bool? isPicture { get; set; }
|
||
/// <summary>
|
||
/// 内容类型 1图文,2观点
|
||
/// </summary>
|
||
public int contentType { get; set; }
|
||
|
||
/// <summary>
|
||
/// 标题 观点返回
|
||
/// </summary>
|
||
public string title { get; set; }
|
||
|
||
/// <summary>
|
||
/// 内容
|
||
/// </summary>
|
||
public string content { get; set; }
|
||
|
||
/// <summary>
|
||
/// VIP内容 图文返回
|
||
/// </summary>
|
||
public string pointContent { get; set; }
|
||
|
||
/// <summary>
|
||
/// 删除标记 0未删除,1已删除
|
||
/// </summary>
|
||
public bool? blocked { get; set; }
|
||
|
||
/// <summary>
|
||
/// 文章公开时间
|
||
/// </summary>
|
||
public long? publishedAt { get; set; }
|
||
|
||
/// <summary>
|
||
/// 文章创建时间
|
||
/// </summary>
|
||
public long? createdAt { get; set; }
|
||
|
||
/// <summary>
|
||
/// 是否VIP文章 1:vip内容
|
||
/// </summary>
|
||
public bool? charge { get; set; }
|
||
|
||
/// <summary>
|
||
/// 讲师内容
|
||
/// </summary>
|
||
public lecturer lecturer { get; set; } = new lecturer();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 导师信息
|
||
/// </summary>
|
||
|
||
public class lecturer
|
||
{
|
||
/// <summary>
|
||
/// 讲师ID
|
||
/// </summary>
|
||
public int? lecturerId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 讲师名
|
||
/// </summary>
|
||
public string name { get; set; }
|
||
|
||
/// <summary>
|
||
/// 实名
|
||
/// </summary>
|
||
public string realName { get; set; }
|
||
|
||
/// <summary>
|
||
/// 称号
|
||
/// </summary>
|
||
public string title { get; set; }
|
||
|
||
/// <summary>
|
||
/// 执业编号
|
||
/// </summary>
|
||
public string practiceNo { get; set; }
|
||
|
||
/// <summary>
|
||
/// 头像
|
||
/// </summary>
|
||
public string avatar { get; set; }
|
||
}
|
||
}
|