diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Controllers/CostRegistrateController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Controllers/CostRegistrateController.cs new file mode 100644 index 000000000..a0ec31156 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Controllers/CostRegistrateController.cs @@ -0,0 +1,212 @@ +using Learun.Util; +using System.Data; +using Learun.Application.TwoDevelopment.CustomFunction; +using System.Web.Mvc; +using Learun.Application.TwoDevelopment.LR_CodeDemo; +using System.Collections.Generic; +using System; + +namespace Learun.Application.Web.Areas.CustomFunction.Controllers +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-05-05 10:34 + /// 描 述:费用登记 + /// + public class CostRegistrateController : MvcControllerBase + { + private CostRegistrateIBLL costRegistrateIBLL = new CostRegistrateBLL(); + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + #endregion + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = costRegistrateIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + /// + /// 获取表单数据 + /// + /// 主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormData(string keyValue) + { + var CostRegistrateData = costRegistrateIBLL.GetCostRegistrateEntity( keyValue ); + var jsonData = new { + CostRegistrate = CostRegistrateData, + }; + return Success(jsonData); + } + /// + /// 获取表单数据 + /// + /// 流程实例主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormDataByProcessId(string processId) + { + var CostRegistrateData = costRegistrateIBLL.GetEntityByProcessId( processId ); + var jsonData = new { + CostRegistrate = CostRegistrateData, + }; + return Success(jsonData); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + costRegistrateIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveForm(string keyValue, string strEntity) + { + var loginUserInfo = LoginUserInfo.Get(); + CostRegistrateEntity entity = strEntity.ToObject(); + entity.PayStatus = "0"; + entity.CheckStatus = "0"; + if (string.IsNullOrEmpty(keyValue)) + { + entity.CreateUserId = loginUserInfo.userId; + entity.CreateUserName = loginUserInfo.realName; + entity.CreateTime = DateTime.Now; + } + else + { + entity.ModifyUserId= loginUserInfo.userId; + entity.ModifyUserName = loginUserInfo.realName; + entity.ModifyTime = DateTime.Now; + } + costRegistrateIBLL.SaveEntity(keyValue, entity, false); + return Success("保存成功!"); + } + + /// + /// 提交实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult ChangeStatusById(string keyValue,string processId) + { + var entity = costRegistrateIBLL.GetCostRegistrateEntity(keyValue); + if (entity != null) + { + entity.ProcessId = processId; + entity.CheckStatus = "1"; + + costRegistrateIBLL.SaveEntity(keyValue, entity,false); + } + return Success("提交成功!"); + } + + /// + /// 提交实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult UpdateStatus(string keyValue, string status) + { + var entity = costRegistrateIBLL.GetCostRegistrateEntity(keyValue); + if (entity != null) + { + entity.CheckStatus = status; + if (status == "2") + { + entity.CheckTime = DateTime.Now; + } + + costRegistrateIBLL.SaveEntity(keyValue, entity, false); + } + return Success("提交成功!"); + } + + /// + /// 确认报销实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult UpdatePayStatus(string keyValue, string status) + { + var loginUserInfo = LoginUserInfo.Get(); + var entity = costRegistrateIBLL.GetCostRegistrateEntity(keyValue); + if (entity != null) + { + entity.PayStatus = status; + entity.PayUserId = loginUserInfo.userId; + entity.PayUserName = loginUserInfo.realName; + entity.PayTime = DateTime.Now; + + costRegistrateIBLL.SaveEntity(keyValue, entity, true); + } + return Success("提交成功!"); + } + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Form.cshtml new file mode 100644 index 000000000..e9e804d13 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Form.cshtml @@ -0,0 +1,15 @@ +@{ + ViewBag.Title = "费用登记"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
预算项目*
+ +
+
+
实际费用*
+ +
+
+@Html.AppendJsFile("/Areas/CustomFunction/Views/CostRegistrate/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Form.js new file mode 100644 index 000000000..bb7763f1e --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Form.js @@ -0,0 +1,105 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-05-05 10:34 + * 描 述:费用登记 + */ +var acceptClick; +var keyValue = request('keyValue'); +// 设置权限 +var setAuthorize; +// 设置表单数据 +var setFormData; +// 验证数据是否填写完整 +var validForm; +// 保存数据 +var save; +var bootstrap = function ($, learun) { + "use strict"; + // 设置权限 + setAuthorize = function (data) { + if(!!data) + { + for (var field in data) { + if (data[field].isLook != 1) {// 如果没有查看权限就直接移除 + $('#' + data[field].fieldId).parent().remove(); + } + else { + if (data[field].isEdit != 1) { + $('#' + data[field].fieldId).attr('disabled', 'disabled'); + if ($('#' + data[field].fieldId).hasClass('lrUploader-wrap')) { + $('#' + data[field].fieldId).css({ 'padding-right': '58px' }); + $('#' + data[field].fieldId).find('.btn-success').remove(); + } + } + } + } + } + }; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/CustomFunction/CostRegistrate/GetFormData?keyValue=' + keyValue, function (data) { + for (var id in data) { + if (!!data[id].length && data[id].length > 0) { + $('#' + id ).jfGridSet('refreshdata', data[id]); + } + else { + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); + } + } + }; + // 设置表单数据 + setFormData = function (processId,param,callback) { + if (!!processId) { + $.lrSetForm(top.$.rootUrl + '/CustomFunction/CostRegistrate/GetFormDataByProcessId?processId=' + processId, function (data) { + for (var id in data) { + if (!!data[id] && data[id].length > 0) { + $('#' + id ).jfGridSet('refreshdata', data[id]); + } + else { + if (id == 'CostRegistrate' && data[id] ){ + keyValue = data[id].Id; + } + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); + } + callback && callback(); } + // 验证数据是否填写完整 + validForm = function () { + if (!$('body').lrValidform()) { + return false; + } + return true; + }; + // 保存数据 + save = function (processId, callBack, i) { + var formData = $('body').lrGetFormData(); + if(!!processId){ + formData.ProcessId =processId; + } + var postData = { + strEntity: JSON.stringify(formData) + }; + $.lrSaveForm(top.$.rootUrl + '/CustomFunction/CostRegistrate/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(res, i); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Index.cshtml new file mode 100644 index 000000000..7da512d7d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Index.cshtml @@ -0,0 +1,50 @@ +@{ + /**/ + + ViewBag.Title = "费用登记"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+
+
预算项目
+ +
+
+
付款状态
+
+
+
+
+
+
+ +
+
+
+
+
+@Html.AppendJsFile("/Areas/CustomFunction/Views/CostRegistrate/Index.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Index.js new file mode 100644 index 000000000..151a4475d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/CustomFunction/Views/CostRegistrate/Index.js @@ -0,0 +1,233 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-05-05 10:34 + * 描 述:费用登记 + */ +var refreshGirdData; +var keyValueInMessageRemind = request('keyValue');//消息提醒-查看-id +var bootstrap = function ($, learun) { + "use strict"; + var processId = ''; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + //消息提醒-查看:按钮隐藏 + if (keyValueInMessageRemind != "" && keyValueInMessageRemind != undefined && keyValueInMessageRemind != null) { + $('.lr-layout-tool > div').hide(); + } else { + $('.lr-layout-tool > div').show(); + } + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 400); + $('#PayStatus').lrselect({ data: [{ id: '0', text: '未报销' }, { id: '1', text: '已报销' }] }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 新增 + $('#lr_add').on('click', function () { + learun.layerForm({ + id: 'form', + title: '新增', + url: top.$.rootUrl + '/CustomFunction/CostRegistrate/Form', + width: 600, + height: 400, + callBack: function (id) { + var res = false; + // 验证数据 + res = top[id].validForm(); + // 保存数据 + if (res) { + //processId = learun.newGuid(); + //res = top[id].save(processId, refreshGirdData); + res = top[id].save('', function () { + page.search(); + }); + } + return res; + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + var CheckStatus = $('#gridtable').jfGridValue('CheckStatus'); + if (CheckStatus != 0) { + learun.alert.warning("当前项目已提交,无法编辑!"); + return; + } + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/CustomFunction/CostRegistrate/Form?keyValue=' + keyValue, + width: 600, + height: 400, + callBack: function (id) { + var res = false; + // 验证数据 + res = top[id].validForm(); + // 保存数据 + if (res) { + res = top[id].save('', function () { + page.search(); + }); + } + return res; + } + }); + } + }); + // 删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + var CheckStatus = $('#gridtable').jfGridValue('CheckStatus'); + if (CheckStatus != 0) { + learun.alert.warning("当前项目已提交,无法删除!"); + return; + } + learun.layerConfirm('是否确认删除该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/CustomFunction/CostRegistrate/DeleteForm', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + //  提交 + $('#lr_submit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + var CheckStatus = $('#gridtable').jfGridValue('CheckStatus'); + if (CheckStatus != 0) { + learun.alert.warning("当前项目已提交,请耐心等待审批!"); + return; + } + learun.layerConfirm('是否确认提交该项!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/CustomFunction/CostRegistrate/UpdateStatus', { keyValue: keyValue, status: 1 }, function (res) { + refreshGirdData(); + }); + } + }); + } + }); + //审批 + $('#lr_check').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + var CheckStatus = $('#gridtable').jfGridValue('CheckStatus'); + if (CheckStatus == 2) { + learun.alert.warning("当前项目已审批通过!"); + return; + } + if (CheckStatus != 1) { + learun.alert.warning("当前项目未提交!"); + return; + } + learun.layerConfirm('是否确认审批该项!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/CustomFunction/CostRegistrate/UpdateStatus', { keyValue: keyValue, status: 2 }, function (res) { + refreshGirdData(); + }); + } + }); + } + }); + //确认报销 + $('#lr_checkPay').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + var CheckStatus = $('#gridtable').jfGridValue('CheckStatus'); + if (CheckStatus != 2) { + learun.alert.warning("当前项目未审批通过!"); + return; + } + learun.layerConfirm('是否确认报销该项!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/CustomFunction/CostRegistrate/UpdatePayStatus', { keyValue: keyValue, status: 1 }, function (res) { + refreshGirdData(); + }); + } + }); + } + }); + + // 管理提醒对象 + $('#lr_messageRemindPerson').on('click', function () { + learun.layerForm({ + id: 'formInMessageRemindPerson', + title: '管理提醒对象', + url: top.$.rootUrl + '/LR_Desktop/MessageRemindPerson/Form?type=05', + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(); + } + }); + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/CustomFunction/CostRegistrate/GetPageList', + headData: [ + { label: "预算项目", name: "BudgetName", width: 100, align: "left" }, + { label: "实际费用", name: "Money", width: 100, align: "left" }, + { + label: "审批状态", name: "CheckStatus", width: 100, align: "left", formatter: function (value) { + if (value == 0) { + return '草稿'; + } else if (value == 1) { + return '审批中'; + } else if (value == 2) { + return '审批通过'; + } else if (value == 3) { + return '审批不通过'; + } else { + return '草稿'; + } + } + }, + { + label: "付款状态", name: "PayStatus", width: 100, align: "left", formatter: function (value) { + return value == "0" ? '未报销' : '已报销'; + } + }, + ], + mainId: 'Id', + isPage: true, + sord: 'desc', + sidx: 'CreateTime' + }); + page.search(); + }, + search: function (param) { + param = param || {}; + param.keyValueInMessageRemind = keyValueInMessageRemind; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function (res, postData) { + if (res && res.code && res.code == 200) { + // 发起流程 + var postData = { + schemeCode: '',// 填写流程对应模板编号 + processId: processId, + level: '1', + }; + learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) { + learun.loading(false); + }); + } + page.search(); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 728117d9e..b23b840dc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -315,6 +315,7 @@ + @@ -1016,6 +1017,8 @@ + + @@ -7689,6 +7692,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/CustomFunction/CostRegistrateMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/CustomFunction/CostRegistrateMap.cs new file mode 100644 index 000000000..002209e6c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/CustomFunction/CostRegistrateMap.cs @@ -0,0 +1,29 @@ +using Learun.Application.TwoDevelopment.CustomFunction; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-05-05 10:34 + /// 描 述:费用登记 + /// + public class CostRegistrateMap : EntityTypeConfiguration + { + public CostRegistrateMap() + { + #region 表、主键 + //表 + this.ToTable("COSTREGISTRATE"); + //主键 + this.HasKey(t => t.Id); + #endregion + + #region 配置关系 + #endregion + } + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj index 0f1db5c6c..a6b18446b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj @@ -67,6 +67,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateBLL.cs new file mode 100644 index 000000000..95a3c9fcc --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateBLL.cs @@ -0,0 +1,173 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.CustomFunction +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-05-05 10:34 + /// 描 述:费用登记 + /// + public class CostRegistrateBLL : CostRegistrateIBLL + { + private CostRegistrateService costRegistrateService = new CostRegistrateService(); + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return costRegistrateService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取CostRegistrate表实体数据 + /// + /// 主键 + /// + public CostRegistrateEntity GetCostRegistrateEntity(string keyValue) + { + try + { + return costRegistrateService.GetCostRegistrateEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取主表实体数据 + /// + /// 流程实例ID + /// + public CostRegistrateEntity GetEntityByProcessId(string processId) + { + try + { + return costRegistrateService.GetEntityByProcessId(processId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + costRegistrateService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string keyValue, CostRegistrateEntity entity, bool isMessageRemind) + { + try + { + costRegistrateService.SaveEntity(keyValue, entity,isMessageRemind); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(流程审批) + /// + /// 流程 + /// 审批状态 + /// + public void ChangeStatusByProcessId(string processId, string status) + { + try + { + costRegistrateService.ChangeStatusByProcessId(processId, status); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateEntity.cs new file mode 100644 index 000000000..85bdb34c9 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateEntity.cs @@ -0,0 +1,120 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.TwoDevelopment.CustomFunction +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-05-05 10:34 + /// 描 述:费用登记 + /// + public class CostRegistrateEntity + { + #region 实体成员 + /// + /// Id + /// + [Column("ID")] + public string Id { get; set; } + /// + /// 预算项目 + /// + [Column("BUDGETNAME")] + public string BudgetName { get; set; } + /// + /// 实际费用 + /// + [Column("MONEY")] + public Decimal? Money { get; set; } + /// + /// 审批状态(0草稿,1审批中,2审批通过,3审批不通过) + /// + [Column("CHECKSTATUS")] + public string CheckStatus { get; set; } + /// + /// 审批时间 + /// + [Column("CHECKTIME")] + public DateTime? CheckTime { get; set; } + /// + /// 付款状态(0未报销,1已报销) + /// + [Column("PAYSTATUS")] + public string PayStatus { get; set; } + /// + /// PayUserName + /// + [Column("PAYUSERNAME")] + public string PayUserName { get; set; } + /// + /// PayUserId + /// + [Column("PAYUSERID")] + public string PayUserId { get; set; } + /// + /// PayTime + /// + [Column("PAYTIME")] + public DateTime? PayTime { get; set; } + /// + /// ProcessId + /// + [Column("PROCESSID")] + public string ProcessId { get; set; } + /// + /// CreateUserName + /// + [Column("CREATEUSERNAME")] + public string CreateUserName { get; set; } + /// + /// CreateUserId + /// + [Column("CREATEUSERID")] + public string CreateUserId { get; set; } + /// + /// CreateTime + /// + [Column("CREATETIME")] + public DateTime? CreateTime { get; set; } + /// + /// ModifyUserName + /// + [Column("MODIFYUSERNAME")] + public string ModifyUserName { get; set; } + /// + /// ModifyUserId + /// + [Column("MODIFYUSERID")] + public string ModifyUserId { get; set; } + /// + /// ModifyTime + /// + [Column("MODIFYTIME")] + public DateTime? ModifyTime { get; set; } + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + this.Id = Guid.NewGuid().ToString(); + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.Id = keyValue; + } + #endregion + #region 扩展字段 + #endregion + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateIBLL.cs new file mode 100644 index 000000000..8f3eb8a6b --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateIBLL.cs @@ -0,0 +1,63 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.CustomFunction +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-05-05 10:34 + /// 描 述:费用登记 + /// + public interface CostRegistrateIBLL + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + /// + /// 获取CostRegistrate表实体数据 + /// + /// 主键 + /// + CostRegistrateEntity GetCostRegistrateEntity(string keyValue); + /// + /// 获取主表实体数据 + /// + /// 流程实例ID + /// + CostRegistrateEntity GetEntityByProcessId(string processId); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string keyValue, CostRegistrateEntity entity, bool isMessageRemind); + + /// + /// 保存实体数据(流程审批) + /// + /// 流程 + /// 审批状态 + /// + void ChangeStatusByProcessId(string processId, string status); + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateService.cs new file mode 100644 index 000000000..a0da74f71 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/CustomFunction/CostRegistrate/CostRegistrateService.cs @@ -0,0 +1,273 @@ +using Dapper; +using Learun.Application.Base.AuthorizeModule; +using Learun.Application.Organization; +using Learun.Application.TwoDevelopment.LR_Desktop; +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; + +namespace Learun.Application.TwoDevelopment.CustomFunction +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-05-05 10:34 + /// 描 述:费用登记 + /// + public class CostRegistrateService : RepositoryFactory + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT t.* "); + strSql.Append(" FROM CostRegistrate t "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["BudgetName"].IsEmpty()) + { + dp.Add("BudgetName", "%" + queryParam["BudgetName"].ToString() + "%", DbType.String); + strSql.Append(" AND t.BudgetName Like @BudgetName "); + } + if (!queryParam["PayStatus"].IsEmpty()) + { + dp.Add("PayStatus", queryParam["PayStatus"].ToString(), DbType.String); + strSql.Append(" AND t.PayStatus = @PayStatus "); + } + if (!queryParam["keyValueInMessageRemind"].IsEmpty()) + { + dp.Add("keyValueInMessageRemind", queryParam["keyValueInMessageRemind"].ToString(), DbType.String); + strSql.Append(" AND t.Id = @keyValueInMessageRemind "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取CostRegistrate表实体数据 + /// + /// 主键 + /// + public CostRegistrateEntity GetCostRegistrateEntity(string keyValue) + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取主表实体数据 + /// + /// 流程实例ID + /// + public CostRegistrateEntity GetEntityByProcessId(string processId) + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(t => t.ProcessId == processId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + this.BaseRepository("CollegeMIS").Delete(t => t.Id == keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// 是否发送消息提醒 + /// + public void SaveEntity(string keyValue, CostRegistrateEntity entity, bool isMessageRemind) + { + try + { + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(keyValue); + this.BaseRepository("CollegeMIS").Update(entity); + } + else + { + entity.Create(); + this.BaseRepository("CollegeMIS").Insert(entity); + } + if (isMessageRemind) + { + //获取实体 + entity = this.BaseRepository("CollegeMIS").FindEntity(x => x.Id == entity.Id); + //提醒对象发消息提醒 + var messageRemindPerson = this.BaseRepository().FindEntity(x => x.Type == "05"); + if (messageRemindPerson != null) + { + //提醒对象包含的人员列表 + var personList = new List(); + //角色 + if (!string.IsNullOrEmpty(messageRemindPerson.RoleIds)) + { + var pp = this.BaseRepository().FindList(x => messageRemindPerson.RoleIds.Contains(x.F_ObjectId)); + if (pp.Any()) + { + personList.AddRange(pp.Select(x => x.F_UserId)); + } + } + //部门 + if (!string.IsNullOrEmpty(messageRemindPerson.DeptIds)) + { + var dd = messageRemindPerson.DeptIds.Split(','); + foreach (var item in dd) + { + var pp = this.BaseRepository().FindList(x => x.F_DepartmentId.Contains(item)); + if (pp.Any()) + { + personList.AddRange(pp.Select(x => x.F_UserId)); + } + } + } + //人员 + if (!string.IsNullOrEmpty(messageRemindPerson.UserIds)) + { + personList.AddRange(messageRemindPerson.UserIds.Split(',')); + } + personList = personList.Distinct().ToList(); + //消息提醒表增加数据 + var mrList = new List(); + foreach (var item in personList) + { + MessageRemindEntity messageRemindEntity = new MessageRemindEntity() + { + ReceiptId = item, + ReceiptName = this.BaseRepository().FindEntity(x => x.F_UserId == item)?.F_RealName, + SenderId = LoginUserInfo.Get().userId, + SenderName = LoginUserInfo.Get().realName, + TheTitle = "费用登记", + TheContent = "费用审批状态:" + (entity.CheckStatus == "0" ? "草稿" : entity.CheckStatus == "1" ? "审批中" : entity.CheckStatus == "2" ? "审批通过" : "审批不通过") + ",报销情况:" + (entity.PayStatus == "0" ? "未报销" : "已报销"), + ConnectionUrl = "/CustomFunction/CostRegistrate/Index?keyValue=", + InstanceId = entity.Id, + SendTime = DateTime.Now, + ReadSigns = false + }; + messageRemindEntity.Create(); + mrList.Add(messageRemindEntity); + } + this.BaseRepository().Insert(mrList); + } + + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(流程审批) + /// + /// 流程 + /// 审批状态 + /// + public void ChangeStatusByProcessId(string processId, string status) + { + try + { + this.BaseRepository("CollegeMIS").ExecuteBySql($"update CostRegistrate set CheckStatus='{status}',CheckTime='{DateTime.Now}' where ProcessId='{processId}' "); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index 768e601dc..5d9f6d36b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -91,6 +91,10 @@ + + + +