135 lines
5.2 KiB
C#
135 lines
5.2 KiB
C#
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
|
||
using Learun.Application.Base.SystemModule;
|
||
using Learun.Application.TwoDevelopment.ZZDT_EC;
|
||
using Learun.Util;
|
||
using Learun.Util.SqlSugar;
|
||
using SqlSugar;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Web.Http;
|
||
using System.Web.Http.Description;
|
||
|
||
namespace Learun.Application.Web.AppApi
|
||
{
|
||
/// <summary>
|
||
/// 项目接口
|
||
/// </summary>
|
||
[RoutePrefix("api/ProjectApi")]
|
||
//[HandlerApiLogin(FilterMode.Enforce)]
|
||
//[TokenAuthorize]
|
||
public class ProjectApiController : WebApiControllerBase
|
||
{
|
||
/// <summary>
|
||
/// 获取项目列表(比如插件端用户登录后会弹出的)
|
||
/// </summary>
|
||
/// <param name="pageNo">当前页码</param>
|
||
/// <param name="pageSize">每页条数</param>
|
||
/// <returns></returns>
|
||
[HttpGet]
|
||
public IHttpActionResult GetProjectSelectPageList(int pageNo, int pageSize)
|
||
{
|
||
try
|
||
{
|
||
ec_projectIBLL ec_projectIBLL = new ec_projectBLL();
|
||
|
||
string queryJson = "{}";
|
||
Pagination paginationobj = new Pagination();
|
||
paginationobj.page = pageNo;
|
||
paginationobj.rows = pageSize;
|
||
paginationobj.sidx = "CreateTime ";
|
||
paginationobj.sord = "DESC";
|
||
paginationobj.records = 0;
|
||
Logger.Info("开始GetProjectSelectPageList" + "\r\n");
|
||
var data = ec_projectIBLL.GetListUnderUser(paginationobj, queryJson);//客户端
|
||
var jsonData = new
|
||
{
|
||
rows = data,
|
||
total = paginationobj.total,
|
||
records = paginationobj.records
|
||
};
|
||
|
||
Logger.Info("返回GetProjectSelectPageList,共:" + data.Count() + "个项目" + "\r\n");
|
||
return Success(jsonData);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return Fail(ex.Message);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 2023 07 31,插件端选择项目后,统一、整合加载左侧面板里的数据(By YUXH)
|
||
/// </summary>
|
||
/// <param name="ProjId"></param>
|
||
/// <param name="User">当前用户</param>
|
||
/// <returns></returns>
|
||
[HttpGet]
|
||
public IHttpActionResult InitProjInfo(string ProjId, string User)
|
||
{
|
||
var drawingCategoryBll = new ec_drawing_catalogueBLL();
|
||
var templateCategoryBll = new ec_template_catalogueBLL();
|
||
var objectTypeBll = new ec_objecttypeBLL();
|
||
var NotificationBll = new ec_notificationBLL();
|
||
#region 获取图纸目录DrawingFileApi/GetDrawingCatalogue
|
||
var res1 = drawingCategoryBll.GetDrawingCategory(ProjId, "0");
|
||
#endregion
|
||
#region DrawingFileApi/GetDrawingCatalogueByType
|
||
var res2 = drawingCategoryBll.GetDrawingCategoryByType(ProjId);
|
||
#endregion
|
||
#region DrawingFileApi/GetDrawingCatalogueBySystem
|
||
var res3 = drawingCategoryBll.GetDrawingCatalogueBySystem(ProjId);
|
||
#endregion
|
||
#region TemplateFileApi/GetTemplateCatalogue
|
||
var res4 = templateCategoryBll.GetTemplateCategory(ProjId);
|
||
#endregion
|
||
#region ObjectTypeApi/GetObjectTypeData0
|
||
var res5 = objectTypeBll.GetObjectTypeData3Level(ProjId, "0");
|
||
#endregion
|
||
#region ObjectTypeApi/GetObjectTypeData2
|
||
// 这个数据量太大,导致加载项目时卡顿长达6分钟,所以单独独立出去
|
||
// var res6 = objectTypeBll.GetObjectTypeData3Level(ProjId, "2");
|
||
#endregion
|
||
#region NotificationApi/GetUserAllNotification
|
||
var res7 = NotificationBll.GetUserAllNotification(ProjId, User);
|
||
#endregion
|
||
var resAll = new List<object>
|
||
{
|
||
new { Name = "图纸树(按目录)", data = res1 },
|
||
new { Name = "图纸树(按类型)", data = res2 },
|
||
new { Name = "图纸树(按系统)", data = res3 },
|
||
new { Name = "样板文件树", data = res4 },
|
||
new { Name = "对象类型树", data = res5 },
|
||
new { Name = "对象类型树(带位号和图纸信息)", data ="后续独立查询" },
|
||
new { Name = "通知", data = res7 }
|
||
};
|
||
|
||
//var resAll = new List<List<TreeModel>>
|
||
//{
|
||
// res1, res2,res3,res4,res5,res6,res7
|
||
//};
|
||
|
||
return Success(resAll);
|
||
}
|
||
/// <summary>
|
||
/// 获取项目信息
|
||
/// </summary>
|
||
/// <param name="projectId">项目ID</param>
|
||
/// <returns></returns>
|
||
[HttpGet]
|
||
[ResponseType(typeof(TwoDevelopment.ZZDT_EC.ec_projectEntity))]
|
||
public IHttpActionResult GetEntity(string projectId)
|
||
{
|
||
try
|
||
{
|
||
ec_projectIBLL ec_projectIBLL = new ec_projectBLL();
|
||
var entity = ec_projectIBLL.GetEntity(projectId);
|
||
return Success(entity);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return Fail(ex.Message);
|
||
}
|
||
}
|
||
}
|
||
} |