582 lines
25 KiB
C#
582 lines
25 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Web.Http;
|
||
using System.Web.Http.Description;
|
||
using ESCG = CodeBuilderApi.GeneralMethod;
|
||
using ESCM = CodeBuilderApi.Model;
|
||
using Newtonsoft.Json.Linq;
|
||
using Newtonsoft.Json;
|
||
using HZQR.Common;
|
||
|
||
namespace CodeBuilderApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 代码生成表相关接口
|
||
/// 2022/10/18 11:36:31自动生成
|
||
/// </summary>
|
||
public class CodeBuilderController : BaseController
|
||
{
|
||
#region 获取附件目录表列表
|
||
/// <summary>
|
||
/// 获取附件目录表列表
|
||
/// </summary>
|
||
/// <param name="searchModel">查询条件对象</param>
|
||
/// <returns></returns>
|
||
[Route("CodeBuilder/GetCATALOGUEList")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.CATALOGUEModel>>))]
|
||
public IHttpActionResult GetCATALOGUEList(ESCM.SearchModel<ESCM.CATALOGUEModel> searchModel)
|
||
{
|
||
string Parameter = "入参信息:" + JsonConvert.SerializeObject(searchModel);
|
||
try
|
||
{
|
||
int TotalCount = 0;
|
||
//获取附件目录表列表
|
||
List<ESCM.CATALOGUEModel> CATALOGUEList = ESCG.CATALOGUEHelper.GetCATALOGUEList(
|
||
transaction, ref TotalCount, searchModel);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.CATALOGUEModel> jsonList = Models.JsonList<ESCM.CATALOGUEModel>.Success(
|
||
CATALOGUEList, TotalCount, searchModel.PageIndex, searchModel.PageSize);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.CATALOGUEModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetCATALOGUEList");
|
||
return Ok(Method.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取附件目录表明细
|
||
/// <summary>
|
||
/// 获取附件目录表明细
|
||
/// </summary>
|
||
/// <param name="CATALOGUEId">附件目录表内码</param>
|
||
/// <returns></returns>
|
||
[Route("CodeBuilder/GetCATALOGUEDetail")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.CATALOGUEModel>))]
|
||
public IHttpActionResult GetCATALOGUEDetail(int CATALOGUEId)
|
||
{
|
||
string Parameter = "入参信息:附件目录表内码【" + CATALOGUEId + "】";
|
||
try
|
||
{
|
||
//获取附件目录表明细
|
||
ESCM.CATALOGUEModel catalogueModel = ESCG.CATALOGUEHelper.GetCATALOGUEDetail(transaction, CATALOGUEId);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.CATALOGUEModel>.Success(catalogueModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetCATALOGUEDetail");
|
||
return Ok(Method.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取代码生成表列表
|
||
/// <summary>
|
||
/// 获取代码生成表列表
|
||
/// </summary>
|
||
/// <param name="searchModel">查询条件对象</param>
|
||
/// <returns></returns>
|
||
[Route("Interface/GetCODEBUILDERList")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.CODEBUILDERModel>>))]
|
||
public IHttpActionResult GetCODEBUILDERList(ESCM.SearchModel<ESCM.CODEBUILDERModel> searchModel)
|
||
{
|
||
string Parameter = "入参信息:" + JsonConvert.SerializeObject(searchModel);
|
||
try
|
||
{
|
||
int TotalCount = 0;
|
||
//获取代码生成表列表
|
||
List<ESCM.CODEBUILDERModel> CODEBUILDERList = ESCG.CodeBuilderHelper.GetCODEBUILDERList(
|
||
transaction, ref TotalCount, searchModel);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.CODEBUILDERModel> jsonList = Models.JsonList<ESCM.CODEBUILDERModel>.Success(
|
||
CODEBUILDERList, TotalCount, searchModel.PageIndex, searchModel.PageSize);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.CODEBUILDERModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetCODEBUILDERList");
|
||
return Ok(Method.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取代码生成表明细
|
||
/// <summary>
|
||
/// 获取代码生成表明细
|
||
/// </summary>
|
||
/// <param name="CODEBUILDERId">代码生成表内码</param>
|
||
/// <returns></returns>
|
||
[Route("Interface/GetCODEBUILDERDetail")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.CODEBUILDERModel>))]
|
||
public IHttpActionResult GetCODEBUILDERDetail(int CODEBUILDERId)
|
||
{
|
||
string Parameter = "入参信息:代码生成表内码【" + CODEBUILDERId + "】";
|
||
try
|
||
{
|
||
//获取代码生成表明细
|
||
ESCM.CODEBUILDERModel codebuilderModel = ESCG.CodeBuilderHelper.GetCODEBUILDERDetail(transaction, CODEBUILDERId);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.CODEBUILDERModel>.Success(codebuilderModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetCODEBUILDERDetail");
|
||
return Ok(Method.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 同步代码生成表
|
||
/// <summary>
|
||
/// 同步代码生成表
|
||
/// </summary>
|
||
/// <param name="codebuilderModel"></param>
|
||
/// <returns></returns>
|
||
[Route("Interface/SynchroCODEBUILDER")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult SynchroCODEBUILDER(ESCM.CODEBUILDERModel codebuilderModel)
|
||
{
|
||
try
|
||
{
|
||
//新增代码生成表
|
||
bool SynchroFlag = ESCG.CodeBuilderHelper.SynchroCODEBUILDER(transaction, codebuilderModel);
|
||
|
||
if (SynchroFlag)
|
||
{
|
||
return Ok(Method.Common.ReturnJson(100, "同步成功"));
|
||
}
|
||
else
|
||
{
|
||
return Ok(Method.Common.ReturnJson(200, "更新失败,数据不存在!"));
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "同步失败!失败原因:" + ex.Message,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_SynchroCODEBUILDER");
|
||
return Ok(Method.Common.ReturnJson(999, "同步失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 删除代码生成表
|
||
/// <summary>
|
||
/// 删除代码生成表
|
||
/// </summary>
|
||
/// <param name="CODEBUILDERId">代码生成表内码</param>
|
||
/// <returns></returns>
|
||
[Route("Interface/DeleteCODEBUILDER")]
|
||
[AcceptVerbs("GET", "POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult DeleteCODEBUILDER(int CODEBUILDERId)
|
||
{
|
||
string Parameter = "入参信息:代码生成表内码【" + CODEBUILDERId + "】";
|
||
try
|
||
{
|
||
//删除代码生成表
|
||
bool DeleteFlag = ESCG.CodeBuilderHelper.DeleteCODEBUILDER(transaction, CODEBUILDERId);
|
||
|
||
if (DeleteFlag)
|
||
{
|
||
return Ok(Method.Common.ReturnJson(100, "删除成功"));
|
||
}
|
||
else
|
||
{
|
||
return Ok(Method.Common.ReturnJson(200, "删除失败,数据不存在!"));
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "删除失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_DeleteCODEBUILDER");
|
||
return Ok(Method.Common.ReturnJson(999, "删除失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取代码生成表嵌套列表
|
||
/// <summary>
|
||
/// 获取代码生成表嵌套列表
|
||
/// </summary>
|
||
/// <param name="CODEBUILDER_PID">父级内码</param>
|
||
/// <param name="CODEBUILDER_FORMAT">代码类型(1:接口;2:普通页面;3:小程序;4:报表页面)</param>
|
||
/// <param name="CODEBUILDER_STATE">有效状态</param>
|
||
/// <param name="SearchKey">模糊查询内容</param>
|
||
/// <returns></returns>
|
||
[Route("Interface/GetNestingCODEBUILDERList")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<ESCM.CODEBUILDERModel>>>))]
|
||
public IHttpActionResult GetNestingCODEBUILDERList(string CODEBUILDER_PID = "-1", string CODEBUILDER_FORMAT = null,
|
||
string CODEBUILDER_STATE = null, string SearchKey = null)
|
||
{
|
||
string Parameter = "入参信息:父级内码【" + CODEBUILDER_PID + "】, 代码类型【" + CODEBUILDER_FORMAT + "】," +
|
||
" 有效状态【" + CODEBUILDER_STATE + "】模糊查询内容【" + SearchKey + "】";
|
||
try
|
||
{
|
||
//获取代码生成表嵌套列表
|
||
List<ESCM.NestingModel<ESCM.CODEBUILDERModel>> CODEBUILDERList = ESCG.CodeBuilderHelper.GetNestingCODEBUILDERList(
|
||
transaction, CODEBUILDER_PID, CODEBUILDER_FORMAT, CODEBUILDER_STATE, SearchKey);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.NestingModel<ESCM.CODEBUILDERModel>> jsonList =
|
||
Models.JsonList<ESCM.NestingModel<ESCM.CODEBUILDERModel>>.Success(CODEBUILDERList);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<ESCM.CODEBUILDERModel>>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetNestingCODEBUILDERList");
|
||
return Ok(Method.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取代码生成表嵌套树
|
||
/// <summary>
|
||
/// 获取代码生成表嵌套树
|
||
/// </summary>
|
||
/// <param name="CODEBUILDER_PID">父级内码</param>
|
||
/// <param name="CODEBUILDER_FORMAT">代码类型(1:接口;2:普通页面;3:小程序;4:报表页面)</param>
|
||
/// <param name="CODEBUILDER_STATE">有效状态</param>
|
||
/// <param name="SearchKey">模糊查询内容</param>
|
||
/// <returns></returns>
|
||
[Route("Interface/GetNestingCODEBUILDERTree")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<ESCM.CommonTypeModel>>>))]
|
||
public IHttpActionResult GetNestingCODEBUILDERTree(string CODEBUILDER_PID = "-1", string CODEBUILDER_FORMAT = null,
|
||
string CODEBUILDER_STATE = null, string SearchKey = null)
|
||
{
|
||
string Parameter = "入参信息:父级内码【" + CODEBUILDER_PID + "】, 代码类型【" + CODEBUILDER_FORMAT + "】," +
|
||
" 有效状态【" + CODEBUILDER_STATE + "】模糊查询内容【" + SearchKey + "】";
|
||
try
|
||
{
|
||
//获取代码生成表嵌套树
|
||
List<ESCM.NestingModel<ESCM.CommonTypeModel>> CODEBUILDERTree = ESCG.CodeBuilderHelper.GetNestingCODEBUILDERTree(
|
||
transaction, CODEBUILDER_PID, CODEBUILDER_FORMAT, CODEBUILDER_STATE, SearchKey);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.NestingModel<ESCM.CommonTypeModel>> jsonList =
|
||
Models.JsonList<ESCM.NestingModel<ESCM.CommonTypeModel>>.Success(CODEBUILDERTree);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.NestingModel<ESCM.CommonTypeModel>>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetNestingCODEBUILDERTree");
|
||
return Ok(Method.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 生成前端接口代码
|
||
/// <summary>
|
||
/// 生成前端接口代码
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[Route("CodeBuilder/BuildInterfaceCode")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.InterfaceCodeResModel>))]
|
||
public IHttpActionResult BuildInterfaceCode(ESCM.InterfaceCodeModel interfaceCodeModel)
|
||
{
|
||
string Parameter = "入参信息:" + JsonConvert.SerializeObject(interfaceCodeModel);
|
||
try
|
||
{
|
||
//生成前端接口代码
|
||
ESCM.InterfaceCodeResModel interfaceCodeResModel = ESCG.CodeBuilderHelper.BuildInterfaceCode(interfaceCodeModel);
|
||
|
||
if (interfaceCodeResModel == null)
|
||
{
|
||
return Ok(Method.Common.ReturnJson(200, "生成失败,没有设置返参列表字段!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.InterfaceCodeResModel>.Success(interfaceCodeResModel, 100, "生成成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "生成失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_BuildInterfaceCode");
|
||
return Ok(Method.Common.ReturnJson(999, "生成失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 生成前端页面代码
|
||
/// <summary>
|
||
/// 生成前端页面代码
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[Route("CodeBuilder/BuildWebPageCode")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.WebPageCodeResModel>))]
|
||
public IHttpActionResult BuildWebPageCode(ESCM.WebPageCodeModel webPageCodeModel)
|
||
{
|
||
string Parameter = "入参信息:" + JsonConvert.SerializeObject(webPageCodeModel);
|
||
try
|
||
{
|
||
//生成前端页面代码
|
||
ESCM.WebPageCodeResModel webPageCodeResModel = ESCG.CodeBuilderHelper.BuildWebPageCode(transaction, webPageCodeModel);
|
||
|
||
if (webPageCodeResModel == null)
|
||
{
|
||
return Ok(Method.Common.ReturnJson(200, "生成失败,没有设置列表字段!"));
|
||
}
|
||
|
||
return Ok(Models.JsonMsg<ESCM.WebPageCodeResModel>.Success(webPageCodeResModel, 100, "生成成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "生成失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_BuildWebPageCode");
|
||
return Ok(Method.Common.ReturnJson(999, "生成失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 执行SQL语句,返回Datatable数据集
|
||
/// <summary>
|
||
/// 执行SQL语句,返回Datatable数据集
|
||
/// </summary>
|
||
/// <param name="exSQLParam">
|
||
/// 执行SQL语句入参对象:<br/>
|
||
/// HostInterfaceId:主表接口内码<br/>
|
||
/// SubInterfaceId:附表接口内码<br/>
|
||
/// txtSQLString:SQL语句内容<br/>
|
||
/// AdvancedConfig:额外的配置项
|
||
/// </param>
|
||
/// <returns></returns>
|
||
[Route("CodeBuilder/ExcuteSQLString")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.dtJsonList>))]
|
||
public IHttpActionResult ExcuteSQLString(ESCM.ExSQLParam exSQLParam)
|
||
{
|
||
string Parameter = "入参信息:" + JsonConvert.SerializeObject(exSQLParam);
|
||
try
|
||
{
|
||
//获取接口嵌套树
|
||
DataTable dtSQLResultClone = ESCG.CodeBuilderHelper.ExcuteSQLString(transaction, exSQLParam);
|
||
|
||
Models.dtJsonList dtJsonList = Models.dtJsonList.Success(dtSQLResultClone);
|
||
|
||
return Ok(Models.JsonMsg<Models.dtJsonList>.Success(dtJsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "获取失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetNestingInterfaceTree");
|
||
return Ok(Method.Common.ReturnJson(999, "获取失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 发布接口代码文件
|
||
/// <summary>
|
||
/// 发布接口代码文件
|
||
/// </summary>
|
||
/// <param name="createFileParam">入参对象</param>
|
||
/// <returns></returns>
|
||
[Route("CodeBuilder/CreateInterfaceFile")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult CreateInterfaceFile(ESCM.CreateITFFileParam createFileParam)
|
||
{
|
||
string Parameter = "入参信息:" + JsonConvert.SerializeObject(createFileParam);
|
||
try
|
||
{
|
||
//发布接口代码文件
|
||
string RebuildslnLogName = DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + createFileParam.UniqueCode;
|
||
bool Flag = ESCG.CodeBuilderHelper.CreateInterfaceFile(transaction, createFileParam, RebuildslnLogName);
|
||
|
||
if (Flag)
|
||
{
|
||
return Ok(Method.Common.ReturnJson(100, "发布成功", RebuildslnLogName));
|
||
}
|
||
|
||
return Ok(Method.Common.ReturnJson(200, "发布失败,没有设置返参列表字段!"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "发布失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_CreateInterfaceFile");
|
||
return Ok(Method.Common.ReturnJson(999, "发布失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 监听接口代码生成结果
|
||
/// <summary>
|
||
/// 监听接口代码生成结果
|
||
/// </summary>
|
||
/// <param name="RebuildslnLogName">监听日志文件名称</param>
|
||
/// <returns></returns>
|
||
[Route("CodeBuilder/ListenRebuildRes")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult ListenRebuildRes(string RebuildslnLogName)
|
||
{
|
||
string Parameter = "入参信息:日志文件名称【" + RebuildslnLogName + "】";
|
||
try
|
||
{
|
||
string resMsg = "";
|
||
bool Flag = ESCG.CodeBuilderHelper.ListenRebuildRes(RebuildslnLogName, ref resMsg);
|
||
|
||
if (Flag)
|
||
{
|
||
if (resMsg != "")
|
||
{
|
||
return Ok(Method.Common.ReturnJson(100, "编译结束,出现异常错误!", resMsg));
|
||
}
|
||
|
||
return Ok(Method.Common.ReturnJson(100, "编译成功!"));
|
||
}
|
||
|
||
return Ok(Method.Common.ReturnJson(200, "正在编译中...!"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "编译失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_ListenRebuildRes");
|
||
return Ok(Method.Common.ReturnJson(999, "编译失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 发布前端代码文件
|
||
/// <summary>
|
||
/// 发布前端代码文件
|
||
/// </summary>
|
||
/// <param name="createWebFileParam">入参对象</param>
|
||
/// <returns></returns>
|
||
[Route("CodeBuilder/CreateWebFile")]
|
||
[AcceptVerbs("POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult CreateWebFile(ESCM.CreateWebFileParam createWebFileParam)
|
||
{
|
||
string Parameter = "入参信息:" + JsonConvert.SerializeObject(createWebFileParam);
|
||
try
|
||
{
|
||
//发布接口代码文件
|
||
ESCG.CodeBuilderHelper.CreateWebFile(transaction, createWebFileParam);
|
||
|
||
return Ok(Method.Common.ReturnJson(100, "发布成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "发布失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_CreateWebFile");
|
||
return Ok(Method.Common.ReturnJson(999, "发布失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 发布前端模块
|
||
/// <summary>
|
||
/// 发布前端模块
|
||
/// </summary>
|
||
/// <param name="UserId">系统用户内码</param>
|
||
/// <param name="UserPassport">用户登录账号</param>
|
||
/// <param name="DirName">原文件所在目录</param>
|
||
/// <param name="ModuleName">模块名称</param>
|
||
/// <param name="ModuleGuid">模块唯一标识</param>
|
||
/// <param name="SystemMenuId">系统菜单内码</param>
|
||
/// <param name="SystemRoleId">系统角色内码</param>
|
||
/// <param name="SaveServer">文件发布地址</param>
|
||
/// <param name="SolutionPath">原文件夹目录</param>
|
||
/// <returns></returns>
|
||
[Route("CodeBuilder/PublishWebFile")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult PublishWebFile(string UserId, string UserPassport, string DirName, string ModuleName,
|
||
string ModuleGuid, int SystemMenuId, int? SystemRoleId = null, string SaveServer = "", string SolutionPath = "")
|
||
{
|
||
string Parameter = "入参信息:" + UserId;
|
||
try
|
||
{
|
||
//发布接口代码文件
|
||
ESCG.CodeBuilderHelper.PublishWebFile(UserId, UserPassport, DirName, ModuleName,
|
||
ModuleGuid, SystemMenuId, SystemRoleId, SaveServer, SolutionPath);
|
||
|
||
return Ok(Method.Common.ReturnJson(100, "发布成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "发布失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_CreateWebFile");
|
||
return Ok(Method.Common.ReturnJson(999, "发布失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 方法 -> 生成本地文件
|
||
/// <summary>
|
||
/// 生成本地文件代码
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[Route("CodeBuilder/BuildCodeFiles")]
|
||
[AcceptVerbs("GET")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult BuildCodeFiles(int DataBaseTableId)
|
||
{
|
||
string Parameter = "入参信息:数据库Id【" + DataBaseTableId + "】";
|
||
try
|
||
{
|
||
//生成前端页面代码
|
||
ESCG.DATABASETABLEHelper.BuildDataBaseTableCode(transaction, DataBaseTableId);
|
||
return Ok(Method.Common.ReturnJson(100, "生成成功!"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "生成失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_BuildWebPageCode");
|
||
return Ok(Method.Common.ReturnJson(999, "生成失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
}
|