|
|
@@ -0,0 +1,149 @@ |
|
|
|
using System; |
|
|
|
using Learun.Application.TwoDevelopment.EducationalAdministration; |
|
|
|
using Learun.Application.WorkFlow; |
|
|
|
using Learun.Util; |
|
|
|
using Nancy; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.Drawing; |
|
|
|
using System.Web.Mvc; |
|
|
|
|
|
|
|
namespace Learun.Application.WebApi.Modules |
|
|
|
{ |
|
|
|
public class DepartmentWeekApi : BaseApi |
|
|
|
{ |
|
|
|
private DepartmentWeekIBLL departmentWeekIBLL = new DepartmentWeekBLL(); |
|
|
|
private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL(); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 注册接口 |
|
|
|
/// </summary> |
|
|
|
public DepartmentWeekApi() |
|
|
|
: base("/learun/departmentWeek") |
|
|
|
{ |
|
|
|
Get["/pageList"] = GetPageList;// 获取列表 |
|
|
|
Get["/getFormData"] = GetFormData;// 根据id获取详情 |
|
|
|
Get["/getFormDataByProcessId"] = GetFormDataByProcessId;// 根据流程id获取详情 |
|
|
|
Post["/saveForm"] = SaveForm;// 添加/编辑 |
|
|
|
Post["/pushForm"] = PushForm;// 发布 |
|
|
|
Post["/changeStatusById"] = ChangeStatusById;// 提交 |
|
|
|
Post["/deleteForm"] = DeleteForm;// 删除 |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 推送发布 |
|
|
|
/// </summary> |
|
|
|
/// <param name="keyValue"></param> |
|
|
|
/// <returns></returns> |
|
|
|
public Response PushForm(dynamic _) |
|
|
|
{ |
|
|
|
departmentWeekIBLL.PushEntity(); |
|
|
|
return Success("推送成功!"); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 获取列表 |
|
|
|
/// </summary> |
|
|
|
/// <param name="_"></param> |
|
|
|
/// <returns></returns> |
|
|
|
public Response GetPageList(dynamic _) |
|
|
|
{ |
|
|
|
ReqPageParam parameter = this.GetReqData<ReqPageParam>(); |
|
|
|
var data = departmentWeekIBLL.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); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 提交 |
|
|
|
/// </summary> |
|
|
|
/// <returns></returns> |
|
|
|
public Response ChangeStatusById(dynamic _) |
|
|
|
{ |
|
|
|
var processId = Guid.NewGuid().ToString(); |
|
|
|
var keyValue = this.GetReqData(); |
|
|
|
departmentWeekIBLL.ChangeStatusById(keyValue,1, processId); |
|
|
|
nWFProcessIBLL.CreateFlow("DepartmentWeek", processId, "", 1, "", userInfo); |
|
|
|
return Success("提交成功!"); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 删除 |
|
|
|
/// </summary> |
|
|
|
/// <returns></returns> |
|
|
|
public Response DeleteForm(dynamic _) |
|
|
|
{ |
|
|
|
var keyValue = this.GetReqData(); |
|
|
|
departmentWeekIBLL.DeleteEntity(keyValue); |
|
|
|
return Success("删除成功!"); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 根据id获取表单数据 |
|
|
|
/// </summary> |
|
|
|
/// <returns></returns> |
|
|
|
public Response GetFormData(dynamic _) |
|
|
|
{ |
|
|
|
var keyValue = this.GetReqData(); |
|
|
|
var DepartmentWeekData = departmentWeekIBLL.GetDepartmentWeekEntity(keyValue); |
|
|
|
var Firset = departmentWeekIBLL.GetDetail(DepartmentWeekData.ID, "1"); |
|
|
|
var Second = departmentWeekIBLL.GetDetail(DepartmentWeekData.ID, "2"); |
|
|
|
var jsonData = new |
|
|
|
{ |
|
|
|
DepartmentWeek = DepartmentWeekData, |
|
|
|
Firset = Firset, |
|
|
|
Second = Second, |
|
|
|
}; |
|
|
|
return Success(jsonData); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 根据流程实例主键获取表单数据 |
|
|
|
/// </summary> |
|
|
|
/// <returns></returns> |
|
|
|
public Response GetFormDataByProcessId(dynamic _) |
|
|
|
{ |
|
|
|
var processId = this.GetReqData(); |
|
|
|
var DepartmentWeekData = departmentWeekIBLL.GetEntityByProcessId(processId); |
|
|
|
var Firset = departmentWeekIBLL.GetDetail(DepartmentWeekData.ID, "1"); |
|
|
|
var Second = departmentWeekIBLL.GetDetail(DepartmentWeekData.ID, "2"); |
|
|
|
var jsonData = new |
|
|
|
{ |
|
|
|
DepartmentWeek = DepartmentWeekData, |
|
|
|
Firset = Firset, |
|
|
|
Second = Second, |
|
|
|
}; |
|
|
|
return Success(jsonData); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 保存实体数据(新增、修改) |
|
|
|
/// </summary> |
|
|
|
/// <returns></returns> |
|
|
|
public Response SaveForm(dynamic _) |
|
|
|
{ |
|
|
|
var parameter = this.GetReqData<AddDepartmentWeekModel>(); |
|
|
|
DepartmentWeekEntity entity = parameter.strEntity.ToObject<DepartmentWeekEntity>(); |
|
|
|
|
|
|
|
List<DepartmentWeekDetailEntity> FirsetDetail = parameter.Firset.ToObject<List<DepartmentWeekDetailEntity>>(); |
|
|
|
List<DepartmentWeekDetailEntity> SecondDetail = parameter.Second.ToObject<List<DepartmentWeekDetailEntity>>(); |
|
|
|
|
|
|
|
departmentWeekIBLL.SaveEntity(parameter.keyValue, entity, FirsetDetail, SecondDetail); |
|
|
|
return SuccessString(entity.ID); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class SmubitModel |
|
|
|
{ |
|
|
|
public string keyValue { get; set; } |
|
|
|
public int status { get; set; } |
|
|
|
public string processId { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
public class AddDepartmentWeekModel |
|
|
|
{ |
|
|
|
public string keyValue { get; set; } |
|
|
|
public string strEntity { get; set; } |
|
|
|
public string Firset { get; set; } |
|
|
|
public string Second { get; set; } |
|
|
|
} |
|
|
|
} |