From 631a777bfed6206f8742dde12800c618a0768598 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Tue, 22 Nov 2022 11:08:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=8F=E8=B4=B9=E5=BC=80=E6=94=AF=E7=94=B3?= =?UTF-8?q?=E6=8A=A5API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/FundsApply/Form.js | 2 +- .../Learun.Application.WebApi.csproj | 1 + .../Modules/FundsApplyApi.cs | 147 ++++++++++++++++++ 3 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js index 7e40036df..7a8c570f2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/FundsApply/Form.js @@ -119,7 +119,7 @@ var bootstrap = function ($, learun) { }, ], height: 400, - mainId: 'AAIId', + mainId: 'Id', reloadSelected: false, }); }, diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj index 50a57bd0b..d1a2ad1e5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj @@ -190,6 +190,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs new file mode 100644 index 000000000..63d9e3129 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/FundsApplyApi.cs @@ -0,0 +1,147 @@ +using System; +using Nancy; +using Learun.Util; +using System.Collections.Generic; +using Learun.Application.TwoDevelopment.LogisticsManagement; +using Learun.Application.TwoDevelopment.AssetManagementSystem; +using Learun.Application.WorkFlow; + +namespace Learun.Application.WebApi +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-11-21 10:09 + /// 描 述:考勤记录 + /// + public class FundsApplyApi : BaseApi + { + private FundsApplyIBLL fundsApplyIBLL = new FundsApplyBLL(); + private FundsApplyDetailIBLL fundsApplyDetailIBLL = new FundsApplyDetailBLL(); + private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL(); + + /// + /// 注册接口 + /// + public FundsApplyApi() + : base("/learun/adms/FundsApply") + { + Get["/pagelist"] = GetPageList; + Get["/form"] = GetForm; + Get["/getEnCode"] = GetEnCode; + Post["/delete"] = DeleteForm; + Post["/save"] = SaveForm; + Post["/submit"] = Submit; + } + #region 获取数据 + + /// + /// 获取页面显示列表分页数据 + /// + /// + /// + public Response GetPageList(dynamic _) + { + ReqPageParam parameter = this.GetReqData(); + var data = fundsApplyIBLL.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); + } + /// + /// 获取表单数据 + /// + /// + /// + public Response GetForm(dynamic _) + { + string keyValue = this.GetReqData(); + var FundsApplyData = fundsApplyIBLL.GetFundsApplyEntity(keyValue); + var FundsApplyDetailData = fundsApplyDetailIBLL.GetListByApplyId(keyValue); + var jsonData = new + { + FundsApply = FundsApplyData, + FundsApplyDetail = FundsApplyDetailData, + }; + return Success(jsonData); + } + + /// + /// 获取申请单号 + /// + /// + /// + public Response GetEnCode(dynamic _) + { + var jsonData = new + { + EnCode = "JFKZ_" + CommonHelper.CreateNo() + }; + return Success(jsonData); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// + /// + public Response DeleteForm(dynamic _) + { + string keyValue = this.GetReqData(); + fundsApplyIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// + /// + public Response SaveForm(dynamic _) + { + ReqFormEntity parameter = this.GetReqData(); + FundsApplyEntity entity = parameter.strEntity.ToObject(); + List detailList = parameter.fundsApplyDetailList.ToObject>(); + + fundsApplyIBLL.SaveEntity(parameter.keyValue, entity, detailList); + return Success("保存成功!"); + } + /// + /// 提交 + /// + /// + /// + public Response Submit(dynamic _) + { + string keyValue = this.GetReqData(); + var processId = Guid.NewGuid().ToString(); + fundsApplyIBLL.ChangeStatusById(keyValue, 1, processId); + UserInfo userInfo = LoginUserInfo.Get(); + nWFProcessIBLL.CreateFlow("LC_FundsApply", processId, "", 1, "", userInfo); + return Success("提交成功!"); + } + #endregion + + #region 私有类 + + /// + /// 表单实体类 + /// + private class ReqFormEntity + { + public string keyValue { get; set; } + public string strEntity { get; set; } + public string fundsApplyDetailList { get; set; } + } + #endregion + + } +}