178 lines
6.0 KiB
C#
178 lines
6.0 KiB
C#
using Core.Web.App_Start;
|
|
using Core.Web.WebHelper;
|
|
using CRM.Core.BLL;
|
|
using CRM.Core.Common;
|
|
using CRM.Core.Common.Layui;
|
|
using CRM.Core.DTO;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.Common.StockHelper;
|
|
|
|
namespace Core.Web.Controllers
|
|
{
|
|
public class StockPoolsController : BaseController
|
|
{
|
|
private StockPools_BL _stockBL = new StockPools_BL();
|
|
private WX.CRM.Common.ValidationErrors errors = new WX.CRM.Common.ValidationErrors();
|
|
|
|
public StockPoolsController()
|
|
{
|
|
}
|
|
|
|
[AuthorizeRedirect(RightsConfig.CONST_股票池管理, ToolBarConfig.CONST_NotButton, true)]
|
|
[HttpGet]
|
|
public ActionResult Index()
|
|
{
|
|
ViewBag.rightCode = RightsConfig.CONST_股票池管理;
|
|
var select = BuildInduNameList();
|
|
ViewBag.InduList = select.InduInfo;
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
[AuthorizeRedirect(RightsConfig.CONST_股票池管理, ToolBarConfig.CONST_NotButton, false)]
|
|
public JsonResult Index(Laypage pager, SearchStockPoolPageDto dto)
|
|
{
|
|
try
|
|
{
|
|
|
|
var list = _stockBL.GetList(ref pager, dto);
|
|
foreach (var item in list)
|
|
{
|
|
item.StatusName = item.Status == null ? "禁用" : item.Status == 0 ? "正常" : "禁用";
|
|
item.UpdateTime = !string.IsNullOrWhiteSpace(item.UpdateTime) ? Convert.ToDateTime(item.UpdateTime).ToString("yyyy-MM-dd HH:mm:ss") : item.UpdateTime;
|
|
}
|
|
var data = new LayuiData<ZxdStockPoolDto>()
|
|
{
|
|
msg = "数据加载成功!",
|
|
count = pager.count,
|
|
code = 0,
|
|
data = list
|
|
};
|
|
return Json(data, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex.ToString());
|
|
return Json(new { }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
[AuthorizeRedirect(RightsConfig.CONST_已报备股票, ToolBarConfig.CONST_NotButton, true)]
|
|
[HttpGet]
|
|
public ActionResult ReportList()
|
|
{
|
|
ViewBag.rightCode = RightsConfig.CONST_已报备股票;
|
|
var select = BuildInduNameList();
|
|
ViewBag.InduList = select.InduInfo;
|
|
ViewBag.ProductLineName = select.ProductLineName;
|
|
ViewBag.OperatorName = select.OperatorName;
|
|
ViewBag.ColumnName = select.ColumnName;
|
|
return View();
|
|
}
|
|
[HttpPost]
|
|
[AuthorizeRedirect(RightsConfig.CONST_已报备股票, ToolBarConfig.CONST_NotButton, false)]
|
|
public JsonResult ReportList(Laypage pager, SearchStockAuditPageDto dto)
|
|
{
|
|
try
|
|
{
|
|
|
|
var list = _stockBL.GetReportList(ref pager, dto);
|
|
var data = new LayuiData<ZxdStockAuditDto>()
|
|
{
|
|
msg = "数据加载成功!",
|
|
count = pager.count,
|
|
code = 0,
|
|
data = list
|
|
};
|
|
return Json(data, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex.ToString());
|
|
return Json(new { }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
[HttpGet]
|
|
public ActionResult Check(int id, int check)
|
|
{
|
|
var model = new StockAuditOrRejectDto
|
|
{
|
|
id = id,
|
|
check = check
|
|
};
|
|
return View(model);
|
|
}
|
|
[HttpPost]
|
|
public ActionResult Check(int id, string remark, int check)
|
|
{
|
|
var ret = new retMsg { result = true, retcode = 200 };
|
|
try
|
|
{
|
|
StockAuditOrRejectDto model = new StockAuditOrRejectDto
|
|
{
|
|
id = id,
|
|
remark = remark,
|
|
check = check,
|
|
checkUserName = UserName
|
|
};
|
|
_stockBL.CheckStockPools(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ret = new retMsg { result = false, retcode = 200, retmsg = ex.Message };
|
|
}
|
|
return Json(ret, JsonRequestBehavior.AllowGet);
|
|
}
|
|
/// <summary>
|
|
/// 行业下拉框
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public DropSelectList BuildInduNameList()
|
|
{
|
|
try
|
|
{
|
|
var appId = ConfigurationManager.AppSettings["StockPoolAppId"];
|
|
var secret = ConfigurationManager.AppSettings["StockPoolSecret"];
|
|
ApiSignHelper apiSignHelper = new ApiSignHelper(appId, secret);
|
|
var url = ConfigurationManager.AppSettings["StockPoolUrl"] + "/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();
|
|
}
|
|
}
|
|
|
|
}
|
|
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>();
|
|
}
|
|
|
|
} |