|
- 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 PurchaseTravelApi : BaseApi
- {
- private Purchase_TravelIBLL PurchaseTravelIBLL = new Purchase_TravelBLL();
- private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
-
- /// <summary>
- /// 注册接口
- /// <summary>
- public PurchaseTravelApi()
- : base("/learun/adms/PurchaseTravel")
- {
- Get["/pagelist"] = GetPageList;
- Get["/form"] = GetForm;
- //Get["/formdetail"] = GetFormDetails;
- 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 = PurchaseTravelIBLL.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_TravelData = PurchaseTravelIBLL.GetPurchase_TravelEntity(keyValue);
- //var Purchase_Travel_DetailsData = PurchaseTravelIBLL.GetPurchase_Travel_DetailsList(Purchase_TravelData.Id);
- var jsonData = new
- {
- Purchase_Travel = Purchase_TravelData,
- //Purchase_Travel_Details = Purchase_Travel_DetailsData,
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- //public Response GetFormDetails(dynamic _)
- //{
- // string keyValue = this.GetReqData();
-
- // var Purchase_Travel_DetailsData = PurchaseTravelIBLL.GetPurchase_Travel_DetailsList(keyValue);
-
- // return Success(Purchase_Travel_DetailsData);
- //}
-
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetshList(dynamic _)
- {
- Purchase_TravelEntity parameter = this.GetReqData<Purchase_TravelEntity>();
- var Purchase_TravelData = PurchaseTravelIBLL.GetEntityByProcessId(parameter.ProcessId);
- //var FundsApplyDetailData = fundsApplyDetailIBLL.GetListByApplyId(FundsApplyData.Id);
- var jsonData = new
- {
- Purchase_Travel = Purchase_TravelData,
- //FundsApplyDetail = FundsApplyDetailData,
- };
- return Success(jsonData);
- }
- #endregion
-
- #region 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response DeleteForm(dynamic _)
- {
- string keyValue = this.GetReqData();
- PurchaseTravelIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response SaveForm(dynamic _)
- {
- ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
- Purchase_TravelEntity entity = parameter.strEntity.ToObject<Purchase_TravelEntity>();
- //List<Purchase_Travel_DetailsEntity> detailList = parameter.DetailList.ToObject<List<Purchase_Travel_DetailsEntity>>();
- //var code = entity.EnCode;
-
- string id=PurchaseTravelIBLL.SaveEntity(parameter.keyValue, entity);
- var json = new
- {
- Id = id
- };
- return Success(json);
- }
- /// <summary>
- /// 提交
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response Submit(dynamic _)
- {
- Purchase_TravelEntity parameter = this.GetReqData<Purchase_TravelEntity>();
- //string keyValue = this.GetReqData();
- //var processId = Guid.NewGuid().ToString();
- PurchaseTravelIBLL.ModifyStatus(parameter.Id, 1, parameter.ProcessId);
- //UserInfo userInfo = LoginUserInfo.Get();
- //nWFProcessIBLL.CreateFlow("0.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
- }
- }
|