163 lines
6.1 KiB
C#
163 lines
6.1 KiB
C#
using Core.Web.App_Start;
|
|
using Core.Web.WebHelper;
|
|
using CRM.Core.BLL.Util;
|
|
using CRM.Core.Common.Layui;
|
|
using CRM.Core.Common.WebHelper;
|
|
using CRM.Core.DTO;
|
|
using CRM.Core.DTO.Lecturer;
|
|
using CRM.Core.DTO.LivePlan;
|
|
using CRM.Core.Model.Enum;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.Common.StockHelper;
|
|
|
|
namespace Core.Web.Controllers
|
|
{
|
|
public class LecturerController : BaseController
|
|
{
|
|
private CACHE_BL _cache = new CACHE_BL();
|
|
|
|
public readonly string webapi = "";
|
|
|
|
public LecturerController()
|
|
{
|
|
webapi = _cache.GetValue_Parameter(Parameter.Hg_Core_WebApi);
|
|
//webapi = "https://localhost:7090";
|
|
}
|
|
|
|
#region 讲师报备
|
|
[AuthorizeRedirect(RightsConfig.CONST_讲师报备, ToolBarConfig.CONST_NotButton, false)]
|
|
public ActionResult Index()
|
|
{
|
|
ViewBag.Eid = Eid;
|
|
ViewBag.rightCode = RightsConfig.CONST_讲师报备;
|
|
var operatorModel = _cache.GetReportOperator();
|
|
var allOperator = new List<Dictionary<string, string>>();
|
|
foreach (var company in operatorModel)
|
|
{
|
|
var channel = new Dictionary<string, string>
|
|
{
|
|
{ "name", company.Ename },
|
|
{ "value", company.Eid.ToString()}
|
|
};
|
|
allOperator.Add(channel);
|
|
}
|
|
ViewBag.allOperator = JsonHelper.ToJson(allOperator);
|
|
var deptments = _cache.GetReportDeptments();
|
|
var allCompany = new List<Dictionary<string, string>>();
|
|
foreach (var company in deptments)
|
|
{
|
|
var channel = new Dictionary<string, string>
|
|
{
|
|
{ "name", company.Title },
|
|
{ "value", company.DepartmentId.ToString()}
|
|
};
|
|
allCompany.Add(channel);
|
|
}
|
|
ViewBag.companyList = JsonHelper.ToJson(allCompany);
|
|
var setting = _cache.GetValue_Parameter("RejectSetting");
|
|
var setList = JsonConvert.DeserializeObject<List<string>>(setting);
|
|
var allChannel = new List<Dictionary<string, string>>();
|
|
foreach (var company in setList)
|
|
{
|
|
var channel = new Dictionary<string, string>
|
|
{
|
|
{ "name", company },
|
|
{ "value", company}
|
|
};
|
|
allChannel.Add(channel);
|
|
}
|
|
ViewBag.AllChannel = JsonHelper.ToJson(allChannel);
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
[AuthorizeRedirect(RightsConfig.CONST_讲师报备, ToolBarConfig.CONST_NotButton, false)]
|
|
public JsonResult GetListHtml(Laypage pager, LecturerRequestDto dto)
|
|
{
|
|
var url = $"{webapi}/api/Live/Lecturer/Page";
|
|
dto.PageIndex = pager.page;
|
|
dto.PageSize = pager.limit;
|
|
|
|
var para = Utility.GetParamToString(dto);
|
|
var result = Utility.GetData(url, para, Encoding.UTF8);
|
|
var page = JsonConvert.DeserializeObject<ApiResult<PageResult<LecturerResponseDto>>>(result);
|
|
var list = new List<LecturerResponseDto>();
|
|
if (page.Code == 0)
|
|
{
|
|
list = page.Data.Data.ToList();
|
|
}
|
|
var data = new LayuiData<LecturerResponseDto>()
|
|
{
|
|
msg = "数据加载成功!",
|
|
count = page.Data.Total,
|
|
code = 0,
|
|
data = list
|
|
};
|
|
return Json(data, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
[AuthorizeRedirect(RightsConfig.CONST_讲师报备, ToolBarConfig.CONST_Other1, false)]
|
|
public ActionResult ComplianceStatus(int id)
|
|
{
|
|
ViewBag.rightCode = RightsConfig.CONST_讲师报备;
|
|
var url = $"{webapi}/api/Live/Lecturer/Detail";
|
|
var para = $"id={id}";
|
|
var result = Utility.GetData(url, para, Encoding.UTF8);
|
|
var data = JsonConvert.DeserializeObject<ApiResult<LecturerAuditDetailModel>>(result);
|
|
if (data.Code == 0)
|
|
{
|
|
ViewBag.LogList = data.Data.Logs;
|
|
}
|
|
var setting = _cache.GetValue_Parameter("RejectSetting");
|
|
var setList = JsonConvert.DeserializeObject<List<string>>(setting);
|
|
var allChannel = new List<Dictionary<string, string>>();
|
|
foreach (var company in setList)
|
|
{
|
|
var channel = new Dictionary<string, string>
|
|
{
|
|
{ "name", company },
|
|
{ "value", company}
|
|
};
|
|
allChannel.Add(channel);
|
|
}
|
|
ViewBag.AllChannel = allChannel.ToJson();
|
|
return View(data.Data);
|
|
}
|
|
|
|
[AuthorizeRedirect(RightsConfig.CONST_讲师报备, ToolBarConfig.CONST_Other1, false)]
|
|
[ValidateInput(false)]
|
|
public JsonResult ComplianceStatusSubmit(int id, int status, int tostatus)
|
|
{
|
|
var memo = CRM.Core.Common.TextHelper.Encode(Request["memo"] ?? string.Empty);
|
|
var url = $"{webapi}/api/Live/plan/audit";
|
|
LivePlanAuditDto postModel = new LivePlanAuditDto
|
|
{
|
|
PlanId = id,
|
|
Status = tostatus,
|
|
sourcetype = (int)ComplianceCheckSourceType.讲师,
|
|
Memo = memo,
|
|
OperatorId = Eid,
|
|
OperatorName = UserName
|
|
};
|
|
var result = Utility.PostAjaxData(url, postModel.ToJson(), Encoding.UTF8);
|
|
var data = JsonConvert.DeserializeObject<ApiResult<object>>(result);
|
|
if (data.Code == 0)
|
|
{
|
|
return Json(new { result = true, code = 0, msg = "保存成功!" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
else
|
|
{
|
|
return Json(new { result = false, code = 0, msg = $"{data.Message}" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
|
|
#endregion 讲师报备
|
|
}
|
|
} |