211 lines
7.4 KiB
C#
211 lines
7.4 KiB
C#
using Org.BouncyCastle.Ocsp;
|
||
using YLErp.DBModels.Enums;
|
||
using YLErp.Model.Enum;
|
||
using YLErp.Modules.AppModule;
|
||
using YLErp.Modules.BasicDataModule;
|
||
using YLErp.Modules.ClientModule;
|
||
using YLErp.Modules.SwapModule;
|
||
using YLErp.Modules.SystemModule;
|
||
|
||
namespace YLErp.Web.Controllers
|
||
{
|
||
public class AccountOpeningProcessController : BaseController
|
||
{
|
||
public AccountOpeningProcessController()
|
||
{
|
||
}
|
||
[MyAuthorize("系统管理-审批流程")]
|
||
public ActionResult Index()
|
||
{
|
||
return View();
|
||
}
|
||
|
||
[HttpPost]
|
||
public ActionResult GetRolesOption()
|
||
{
|
||
var roles = (from r in DbContextFactory.GetErpBaseContext().Roles select r).ToList();
|
||
var list = new List<SelectListItem> {
|
||
new SelectListItem() { Value = "", Text = @"无" }
|
||
};
|
||
|
||
foreach (var role in roles)
|
||
{
|
||
var item = new SelectListItem
|
||
{
|
||
Value = role.Id.ToString(),
|
||
Text = role.Name
|
||
};
|
||
list.Add(item);
|
||
}
|
||
return Json(list);
|
||
}
|
||
|
||
[HttpPost]
|
||
public ActionResult AddProcess(string type, List<ApprovalProcessAddRequest> data)
|
||
{
|
||
if (type == "TradeProcess" && data != null && data.Count > 0)
|
||
{
|
||
foreach (var item in data)
|
||
{
|
||
if (item.ApprovalRules == null)
|
||
{
|
||
item.ApprovalRules = "";
|
||
}
|
||
}
|
||
}
|
||
|
||
new ApprovalProcessService(CurUser).AddProcess(type, data);
|
||
return JsonSuccess("设置成功");
|
||
}
|
||
|
||
[HttpPost]
|
||
public ActionResult GetProcess()
|
||
{
|
||
var list = yldb.approvalprocess.ToList();
|
||
var openProcess = list.Where(s => s.processType == "OpenProcess").OrderBy(s => s.order).ThenBy(s => s.parentNode).ThenBy(s => s.node).ToList();
|
||
|
||
var tradeProcess = list.Where(s => s.processType == "TradeProcess").OrderBy(s => s.order).ThenBy(s => s.parentNode).ThenBy(s => s.node).ToList();
|
||
|
||
var creditProcess = list.Where(s => s.processType == "CreditProcess").OrderBy(s => s.order).ToList();
|
||
var outCashProcess = list.Where(s => s.processType == "OutCashProcess").OrderBy(s => s.order).ToList();
|
||
var clientProcess = list.Where(s => s.processType == "ClientProcess").OrderBy(s => s.order).ThenBy(s => s.parentNode).ThenBy(s => s.node).ToList();
|
||
return Json(new { OpenProcess = openProcess, TradeProcess = tradeProcess, CreditProcess = creditProcess, OutCashProcess= outCashProcess,ClientProcess = clientProcess });
|
||
|
||
}
|
||
|
||
[HttpPost]
|
||
public ActionResult SubmitProcess(int clientId)
|
||
{
|
||
var message = new ClientProcessService(CurUser).SubmitProcess(clientId, out var client);
|
||
if (client.ProcessStatus=="已开户")
|
||
{
|
||
new EtradingRuleService(CurUser).SendEtradingRuleToKafka(client.Number);
|
||
}
|
||
return JsonSuccess(message, client);
|
||
}
|
||
|
||
#region 簿记审批
|
||
[MyAuthorize("系统管理-资产单元")]
|
||
public ActionResult ApprovalAsset()
|
||
{
|
||
return View();
|
||
}
|
||
|
||
public ActionResult ApprovalGradeEdit(string enid = null)
|
||
{
|
||
if (enid == null)
|
||
{
|
||
return View(new ApprovalGrade());
|
||
}
|
||
var intid = DecryptInt(enid);
|
||
var approvalgrade = yldb.approvalGrade.Find(intid);
|
||
return View(approvalgrade);
|
||
}
|
||
|
||
public JsonResult ApprovalGradeEditJson(ApprovalGrade req)
|
||
{
|
||
if (!string.IsNullOrEmpty(req.EncryptId))
|
||
{
|
||
req.id = DecryptInt(req.EncryptId);
|
||
}
|
||
|
||
var r = new ApprovalGradeDataService(CurUser).SaveApprovalGrade(req);
|
||
|
||
return JsonSuccess("更新成功", r);
|
||
}
|
||
|
||
public JsonResult deleteApprovalGrade(string enid)
|
||
{
|
||
var intid = DecryptInt(enid);
|
||
new ApprovalGradeDataService(CurUser).deleteApprovalGrade(intid);
|
||
return JsonSuccess("删除成功");
|
||
}
|
||
|
||
public JsonResult ApprovalGradeQuery(AssetUnitRequest req)
|
||
{
|
||
var sList = new ApprovalGradeDataService(CurUser).SearchList(req);
|
||
|
||
return Json(sList);
|
||
}
|
||
|
||
public static List<SelectListItem> GetRoles()
|
||
{
|
||
var rets = new List<SelectListItem>();
|
||
var roles = ApprovalGradeDataService.getAllRoles();
|
||
foreach (var role in roles)
|
||
{
|
||
var ret = new SelectListItem();
|
||
ret.Text = role.Name;
|
||
ret.Value = role.Id.ToString();
|
||
rets.Add(ret);
|
||
}
|
||
return rets;
|
||
}
|
||
#endregion
|
||
|
||
[MyAuthorize("客户管理-客户查看")]
|
||
public ActionResult clientList()
|
||
{
|
||
return View("clientListV2");
|
||
}
|
||
|
||
public ActionResult clientListV2()
|
||
{
|
||
return View();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新客户基础信息模板
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
public ActionResult UpdateClientInfoTemplate()
|
||
{
|
||
new ClientTemplateImportService(CurUser).UpdateClientInfoTemplate();
|
||
|
||
//return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8", "客户基本信息导入模板.xlsx");
|
||
return JsonSuccess("");
|
||
}
|
||
|
||
|
||
[HttpPost]
|
||
public ActionResult clientQueryForDown(ClientReq req)
|
||
{
|
||
var sList = new ClientQueryService(CurUser).SearchOpeningProcessListForDown(req);
|
||
sList.ForEach(x =>
|
||
{
|
||
if (!PS.Config.Is格林大华)
|
||
{
|
||
if (!string.IsNullOrEmpty(x.CustomerManagerId))
|
||
{
|
||
if (x.CustomerManagerId.Contains(","))
|
||
{
|
||
List<string> managerNames = new List<string>();
|
||
var CustomerManagerIds = x.CustomerManagerId.Split(',').ToList();
|
||
CustomerManagerIds.ForEach(a =>
|
||
{
|
||
var manager = UserBLL.GetById(Convert.ToInt32(a));
|
||
if (manager != null)
|
||
{
|
||
managerNames.Add(manager.Name);
|
||
}
|
||
});
|
||
x.CustomerManager = managerNames.Any() ? string.Join(",", managerNames) : string.Empty;
|
||
}
|
||
else
|
||
{
|
||
var manager = UserBLL.GetById(Convert.ToInt32(x.CustomerManagerId));
|
||
x.CustomerManager = manager == null ? "" : manager.Name;
|
||
}
|
||
}
|
||
}
|
||
|
||
x.CustomerNatureName = x.CustomerNature == null ? "" : ((CustomerNatureEnum)x.CustomerNature.Value).ToString();
|
||
x.SalesDepartment = x.SalesDepartmentId == null ? "" : DepartmentsController.GetDepartmentById(x.SalesDepartmentId.Value)?.Name ?? "";
|
||
x.Phone = x.Phone != null ? x.Phone.Replace(",", ",") : "";
|
||
});
|
||
|
||
return Json(sList);
|
||
}
|
||
}
|
||
} |