249 lines
11 KiB
C#
249 lines
11 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Threading;
|
||
using System.Web.Http;
|
||
using System.Web.Http.Description;
|
||
using ESCG = CommercialApi.GeneralMethod;
|
||
using ESCM = CommercialApi.Model;
|
||
using Newtonsoft.Json;
|
||
using HZQR.Common;
|
||
|
||
namespace CommercialApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 财务预算相关接口
|
||
/// </summary>
|
||
public class BudgetController : BaseController
|
||
{
|
||
#region 获取安徽财务预算表列表
|
||
/// <summary>
|
||
/// 获取安徽财务预算表列表
|
||
/// </summary>
|
||
/// <param name="searchModel">查询条件对象</param>
|
||
/// <returns></returns>
|
||
[Route("Budget/GetBUDGETPROJECT_AHList")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.BUDGETPROJECT_AHModel>>))]
|
||
public IHttpActionResult GetBUDGETPROJECT_AHList(ESCM.SearchModel<ESCM.BUDGETPROJECT_AHModel> searchModel)
|
||
{
|
||
string Parameter = "入参信息:" + JsonConvert.SerializeObject(searchModel);
|
||
try
|
||
{
|
||
int TotalCount = 0;
|
||
//获取安徽财务预算表列表
|
||
List<ESCM.BUDGETPROJECT_AHModel> BUDGETPROJECT_AHList = ESCG.BUDGETPROJECT_AHHelper.GetBUDGETPROJECT_AHList(
|
||
transaction, ref TotalCount, searchModel);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.BUDGETPROJECT_AHModel> jsonList = Models.JsonList<ESCM.BUDGETPROJECT_AHModel>.Success(
|
||
BUDGETPROJECT_AHList, TotalCount, searchModel.PageIndex, searchModel.PageSize);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.BUDGETPROJECT_AHModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBUDGETPROJECT_AHList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取安徽财务预算表明细
|
||
/// <summary>
|
||
/// 获取安徽财务预算表明细
|
||
/// </summary>
|
||
/// <param name="BUDGETPROJECT_AHId">安徽财务预算表内码</param>
|
||
/// <returns></returns>
|
||
[Route("Budget/GetBUDGETPROJECT_AHDetail")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.BUDGETPROJECT_AHModel>))]
|
||
public IHttpActionResult GetBUDGETPROJECT_AHDetail(int BUDGETPROJECT_AHId)
|
||
{
|
||
string Parameter = "入参信息:安徽财务预算表内码【" + BUDGETPROJECT_AHId + "】";
|
||
try
|
||
{
|
||
//获取安徽财务预算表明细
|
||
ESCM.BUDGETPROJECT_AHModel budgetproject_ahModel = ESCG.BUDGETPROJECT_AHHelper.GetBUDGETPROJECT_AHDetail(transaction, BUDGETPROJECT_AHId);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.BUDGETPROJECT_AHModel>.Success(budgetproject_ahModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBUDGETPROJECT_AHDetail");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 同步安徽财务预算表
|
||
/// <summary>
|
||
/// 同步安徽财务预算表
|
||
/// </summary>
|
||
/// <param name="budgetproject_ahModel"></param>
|
||
/// <returns></returns>
|
||
[Route("Budget/SynchroBUDGETPROJECT_AH")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.BUDGETPROJECT_AHModel>))]
|
||
public IHttpActionResult SynchroBUDGETPROJECT_AH(ESCM.BUDGETPROJECT_AHModel budgetproject_ahModel)
|
||
{
|
||
try
|
||
{
|
||
//新增安徽财务预算表
|
||
bool SynchroFlag = ESCG.BUDGETPROJECT_AHHelper.SynchroBUDGETPROJECT_AH(transaction, budgetproject_ahModel);
|
||
|
||
if (SynchroFlag)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(100, "同步成功", budgetproject_ahModel));
|
||
}
|
||
else
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(200, "更新失败,数据不存在!"));
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "同步失败!失败原因:" + ex.Message,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_SynchroBUDGETPROJECT_AH");
|
||
return Ok(ESCG.Common.ReturnJson(999, "同步失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 删除安徽财务预算表
|
||
/// <summary>
|
||
/// 删除安徽财务预算表
|
||
/// </summary>
|
||
/// <param name="BUDGETPROJECT_AHId">安徽财务预算表内码</param>
|
||
/// <returns></returns>
|
||
[Route("Budget/DeleteBUDGETPROJECT_AH")]
|
||
[AcceptVerbs("GET", "POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult DeleteBUDGETPROJECT_AH(int BUDGETPROJECT_AHId)
|
||
{
|
||
string Parameter = "入参信息:安徽财务预算表内码【" + BUDGETPROJECT_AHId + "】";
|
||
try
|
||
{
|
||
//删除安徽财务预算表
|
||
bool DeleteFlag = ESCG.BUDGETPROJECT_AHHelper.DeleteBUDGETPROJECT_AH(transaction, BUDGETPROJECT_AHId);
|
||
|
||
if (DeleteFlag)
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(100, "删除成功"));
|
||
}
|
||
else
|
||
{
|
||
return Ok(ESCG.Common.ReturnJson(200, "删除失败,数据不存在!"));
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "删除失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_DeleteBUDGETPROJECT_AH");
|
||
return Ok(ESCG.Common.ReturnJson(999, "删除失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取月度安徽财务预算明细表数据
|
||
/// <summary>
|
||
/// 获取月度安徽财务预算明细表数据
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 接口应用描述:<br/>
|
||
/// 展示服务区每个月的预算分解数据,可以根据一级科目代码查询预算数据<br/>
|
||
/// 业务逻辑描述:<br/>
|
||
/// 1、从【安徽财务预算表】和【安徽财务预算明细表】查询当前片区下服务区的预算分解数据<br/>
|
||
/// 2、从枚举表获取科目代码数据,从一级科目代码开始遍历,逐级绑定科目代码预算分解数据
|
||
/// </remarks>
|
||
/// <param name="BUDGETPROJECT_AH_ID">预算项目ID</param>
|
||
/// <param name="BUDGETPROJECT_YEAR">项目年份</param>
|
||
/// <param name="STATISTICS_MONTH">统计月份</param>
|
||
/// <param name="SERVERPART_ID">服务区内码</param>
|
||
/// <param name="ACCOUNT_CODE">一级科目代码,多个用,隔开</param>
|
||
/// <param name="STATISTICS_DATE">结算日期</param>
|
||
/// <remarks>
|
||
/// 涉及到的数据表:
|
||
/// 1、安徽财务预算表:FINANCE_STORAGE.T_BUDGETPROJECT_AH<br/>
|
||
/// 2、安徽财务预算明细表:FINANCE_STORAGE.T_BUDGETDETAIL_AH<br/>
|
||
/// 3、枚举字段对象:FieldExplain;枚举解释对象:FieldEnum
|
||
/// </remarks>
|
||
/// <example>
|
||
/// <!--
|
||
/// 入参样例:
|
||
/// 返回结果样例:
|
||
/// -->
|
||
/// </example>
|
||
/// <returns></returns>
|
||
[Route("Budget/GetBudgetProjectDetailList")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<ESCM.BudgetProjectDetailModel>>>))]
|
||
public IHttpActionResult GetBudgetProjectDetailList(int? BUDGETPROJECT_AH_ID = null, int? BUDGETPROJECT_YEAR = null,
|
||
int? STATISTICS_MONTH = null, string SERVERPART_ID = "", string ACCOUNT_CODE = "", string STATISTICS_DATE = "")
|
||
{
|
||
string Parameter = "入参信息:预算项目ID【" + BUDGETPROJECT_AH_ID + "】,项目年份【" + BUDGETPROJECT_YEAR + "】," +
|
||
"统计月份【" + STATISTICS_MONTH + "】,服务区内码【" + SERVERPART_ID + "】," +
|
||
"科目代码【" + ACCOUNT_CODE + "】,结算日期【" + STATISTICS_DATE + "】";
|
||
try
|
||
{
|
||
//获取月度安徽财务预算明细表数据
|
||
List<ESCM.NestingModel<ESCM.BudgetProjectDetailModel>> BUDGETPROJECTList =
|
||
ESCG.BUDGETDETAIL_AHHelper.GetBudgetProjectDetailList(transaction, BUDGETPROJECT_AH_ID,
|
||
BUDGETPROJECT_YEAR, STATISTICS_MONTH, SERVERPART_ID, ACCOUNT_CODE, STATISTICS_DATE);
|
||
|
||
Models.JsonList<ESCM.NestingModel<ESCM.BudgetProjectDetailModel>> jsonList =
|
||
Models.JsonList<ESCM.NestingModel<ESCM.BudgetProjectDetailModel>>.Success(
|
||
BUDGETPROJECTList, BUDGETPROJECTList.Count, 1, BUDGETPROJECTList.Count);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<ESCM.BudgetProjectDetailModel>>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBudgetProjectDetailList");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取安徽财务预算表明细
|
||
/// <summary>
|
||
/// 获取安徽财务预算表明细
|
||
/// </summary>
|
||
/// <param name="BUDGETPROJECT_AHId">安徽财务预算表内码</param>
|
||
/// <returns></returns>
|
||
[Route("Budget/GetBudgetMainShow")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.BudgetMain>))]
|
||
public IHttpActionResult GetBudgetMainShow(string serverpartId, int year, int month)
|
||
{
|
||
string Parameter = "入参信息:安徽财务预算表内码【" + serverpartId + "】";
|
||
try
|
||
{
|
||
//获取安徽财务预算表明细
|
||
ESCM.BudgetMain budgetproject_ahModel = ESCG.BudgetShowAhHelper.GetBudgetMainShow(transaction, serverpartId, year, month);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.BudgetMain>.Success(budgetproject_ahModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBUDGETPROJECT_AHDetail");
|
||
return Ok(ESCG.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
} |