|
- using Nancy;
- using Learun.Util;
- using System.Collections.Generic;
- using Learun.Application.TwoDevelopment.EducationalAdministration;
- using Learun.Application.TwoDevelopment.LogisticsManagement;
- using System;
- using Learun.Application.WorkFlow;
-
- namespace Learun.Application.WebApi
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创 建:超级管理员
- /// 日 期:2020-06-03 14:29
- /// 描 述:系部数据
- /// </summary>
- public class PurchaseEduApplyApi : BaseApi
- {
- private Purchase_Edu_ApplyIBLL purchaseeduIBLL = new Purchase_Edu_ApplyBLL();
- private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
-
- /// <summary>
- /// 注册接口
- /// <summary>
- public PurchaseEduApplyApi()
- : base("/learun/adms/purchaseeduapply")
- {
- Get["/pagelist"] = GetPageList;
- Get["/form"] = GetForm;
- Post["/delete"] = DeleteForm;
- Post["/save"] = SaveForm;
- Post["/submit"] = Submit;
- //Get["/shList"] = GetshList;
- }
- #region 获取数据
-
- /// <summary>
- /// 获取页面显示列表分页数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetPageList(dynamic _)
- {
- ReqPageParam parameter = this.GetReqData<ReqPageParam>();
- var data = purchaseeduIBLL.GetPageList(parameter.pagination, parameter.queryJson);
- var jsonData = new
- {
- rows = data,
- total = parameter.pagination.total,
- page = parameter.pagination.page,
- records = parameter.pagination.records
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetForm(dynamic _)
- {
- string keyValue = this.GetReqData();
- var Purchase_EduData = purchaseeduIBLL.GetPurchase_Edu_ApplyEntity(keyValue);
- var Purchase_Edu_DetailsData = purchaseeduIBLL.GetPurchase_Edu_ApplydetailsList(Purchase_EduData.Id);
- var jsonData = new
- {
- Purchase_Edu = Purchase_EduData,
- Purchase_Edu_Details = Purchase_Edu_DetailsData,
- };
- return Success(jsonData);
- }
-
- ///// <summary>
- ///// 获取页面显示列表数据
- ///// <summary>
- ///// <param name="_"></param>
- ///// <returns></returns>
- //public Response GetshList(dynamic _)
- //{
- // FundsApplyEntity parameter = this.GetReqData<FundsApplyEntity>();
- // var FundsApplyData = fundsApplyIBLL.GetEntityByProcessId(parameter.ProcessId);
- // var FundsApplyDetailData = fundsApplyDetailIBLL.GetListByApplyId(FundsApplyData.Id);
- // var jsonData = new
- // {
- // FundsApply = FundsApplyData,
- // FundsApplyDetail = FundsApplyDetailData,
- // };
- // return Success(jsonData);
- //}
- #endregion
-
- #region 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response DeleteForm(dynamic _)
- {
- string keyValue = this.GetReqData();
- purchaseeduIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response SaveForm(dynamic _)
- {
- //Purchase_EduEntity entity = strEntity.ToObject<Purchase_EduEntity>();
- //List<Purchase_Edu_DetailsEntity> purchase_Edu_DetailsList = strpurchase_Edu_DetailsList.ToObject<List<Purchase_Edu_DetailsEntity>>();
- //purchase_EduIBLL.SaveEntity(keyValue, entity, purchase_Edu_DetailsList);
- ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
- Purchase_Edu_ApplyEntity entity = parameter.strEntity.ToObject<Purchase_Edu_ApplyEntity>();
- List<Purchase_Edu_ApplydetailsEntity> detailList = parameter.DetailList.ToObject<List<Purchase_Edu_ApplydetailsEntity>>();
- //var code = entity.EnCode;
-
- purchaseeduIBLL.SaveEntity(parameter.keyValue, entity, detailList);
- return Success("保存成功!");
- }
- /// <summary>
- /// 提交
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response Submit(dynamic _)
- {
- string keyValue = this.GetReqData();
- var processId = Guid.NewGuid().ToString();
- purchaseeduIBLL.ModifyStatus(keyValue, 1, processId);
- UserInfo userInfo = LoginUserInfo.Get();
- nWFProcessIBLL.CreateFlow("2-1", processId, "", 1, "", userInfo);
- return Success("提交成功!");
- }
- #endregion
-
- #region 私有类
- /// <summary>
- /// 表单实体类
- /// <summary>
- private class ReqFormEntity
- {
- public string keyValue { get; set; }
- public string strEntity { get; set; }
- public string DetailList { get; set; }
- }
- #endregion
- }
- }
|