@@ -0,0 +1,249 @@ | |||
using Learun.Util; | |||
using System; | |||
using System.Data; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 数字化智慧校园 | |||
/// Copyright (c) 2013-2020 北京泉江科技有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2024-12-18 14:13 | |||
/// 描 述:DepartmentWeek | |||
/// </summary> | |||
public class DepartmentWeekBLL : DepartmentWeekIBLL | |||
{ | |||
private DepartmentWeekService departmentWeekService = new DepartmentWeekService(); | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<DepartmentWeekEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
return departmentWeekService.GetPageList(pagination, queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取DepartmentWeek表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public DepartmentWeekEntity GetDepartmentWeekEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
return departmentWeekService.GetDepartmentWeekEntity(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取DepartmentWeek表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public IEnumerable<DepartmentWeekDetailEntity> GetDetail(string keyValue, string types) | |||
{ | |||
try | |||
{ | |||
return departmentWeekService.GetDetail(keyValue, types); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取主表实体数据 | |||
/// </summary> | |||
/// <param name="processId">流程实例ID</param> | |||
/// <returns></returns> | |||
public DepartmentWeekEntity GetEntityByProcessId(string processId) | |||
{ | |||
try | |||
{ | |||
return departmentWeekService.GetEntityByProcessId(processId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
departmentWeekService.DeleteEntity(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
public void SaveEntity(string keyValue, DepartmentWeekEntity entity) | |||
{ | |||
try | |||
{ | |||
departmentWeekService.SaveEntity(keyValue, entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
public void SaveEntity(string keyValue, DepartmentWeekEntity entity, List<DepartmentWeekDetailEntity> Firset, List<DepartmentWeekDetailEntity> Second) | |||
{ | |||
try | |||
{ | |||
departmentWeekService.SaveEntity(keyValue, entity, Firset, Second); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public void ChangeStatusById(string keyValue, int status, string processId) | |||
{ | |||
try | |||
{ | |||
departmentWeekService.ChangeStatusById(keyValue, status, processId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public void ChangeStatusByProcessId(int status, string processId) | |||
{ | |||
try | |||
{ | |||
departmentWeekService.ChangeStatusByProcessId(status, processId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public void PushEntity() | |||
{ | |||
try | |||
{ | |||
departmentWeekService.PushEntity(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,98 @@ | |||
using Learun.Util; | |||
using System; | |||
using System.ComponentModel.DataAnnotations.Schema; | |||
namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 数字化智慧校园 | |||
/// Copyright (c) 2013-2020 北京泉江科技有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2024-12-18 14:13 | |||
/// 描 述:DepartmentWeek | |||
/// </summary> | |||
public class DepartmentWeekEntity | |||
{ | |||
#region 实体成员 | |||
/// <summary> | |||
/// ID | |||
/// </summary> | |||
[Column("ID")] | |||
public string ID { get; set; } | |||
/// <summary> | |||
/// Title | |||
/// </summary> | |||
[Column("TITLE")] | |||
public string Title { get; set; } | |||
/// <summary> | |||
/// Firset | |||
/// </summary> | |||
[Column("FIRSET")] | |||
public string Firset { get; set; } | |||
/// <summary> | |||
/// Second | |||
/// </summary> | |||
[Column("SECOND")] | |||
public string Second { get; set; } | |||
/// <summary> | |||
/// Remark | |||
/// </summary> | |||
[Column("REMARK")] | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// CreateTime | |||
/// </summary> | |||
[Column("CREATETIME")] | |||
public DateTime? CreateTime { get; set; } | |||
/// <summary> | |||
/// CreateUser | |||
/// </summary> | |||
[Column("CREATEUSER")] | |||
public string CreateUser { get; set; } | |||
/// <summary> | |||
/// ProcessId | |||
/// </summary> | |||
[Column("PROCESSID")] | |||
public string ProcessId { get; set; } | |||
/// <summary> | |||
/// STATUS | |||
/// </summary> | |||
[Column("STATUS")] | |||
public int? Status { get; set; } | |||
/// <summary> | |||
/// Department | |||
/// </summary> | |||
[Column("DEPARTMENT")] | |||
public String Department { get; set; } | |||
/// <summary> | |||
/// Week | |||
/// </summary> | |||
[Column("WEEK")] | |||
public String Week { get; set; } | |||
#endregion | |||
#region 扩展操作 | |||
/// <summary> | |||
/// 新增调用 | |||
/// </summary> | |||
public void Create() | |||
{ | |||
this.ID = Guid.NewGuid().ToString(); | |||
this.Status = 0; | |||
} | |||
/// <summary> | |||
/// 编辑调用 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
public void Modify(string keyValue) | |||
{ | |||
this.ID = keyValue; | |||
} | |||
#endregion | |||
#region 扩展字段 | |||
#endregion | |||
} | |||
} | |||
@@ -0,0 +1,70 @@ | |||
using Learun.Util; | |||
using System.Data; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 数字化智慧校园 | |||
/// Copyright (c) 2013-2020 北京泉江科技有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2024-12-18 14:13 | |||
/// 描 述:DepartmentWeek | |||
/// </summary> | |||
public interface DepartmentWeekIBLL | |||
{ | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
IEnumerable<DepartmentWeekEntity> GetPageList(Pagination pagination, string queryJson); | |||
/// <summary> | |||
/// 获取DepartmentWeek表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
DepartmentWeekEntity GetDepartmentWeekEntity(string keyValue); | |||
IEnumerable<DepartmentWeekDetailEntity> GetDetail(string keyValue, string types); | |||
/// <summary> | |||
/// 获取主表实体数据 | |||
/// </summary> | |||
/// <param name="processId">流程实例ID</param> | |||
/// <returns></returns> | |||
DepartmentWeekEntity GetEntityByProcessId(string processId); | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
void DeleteEntity(string keyValue); | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
void SaveEntity(string keyValue, DepartmentWeekEntity entity); | |||
void SaveEntity(string keyValue, DepartmentWeekEntity entity, List<DepartmentWeekDetailEntity> First, List<DepartmentWeekDetailEntity> Second); | |||
/// <summary> | |||
/// 推送 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
void PushEntity(); | |||
/// <summary> | |||
/// 提交 | |||
/// </summary> | |||
void ChangeStatusById(string keyValue, int status, string processId); | |||
void ChangeStatusByProcessId(int status, string processId); | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,360 @@ | |||
using Dapper; | |||
using Learun.DataBase.Repository; | |||
using Learun.Util; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Text; | |||
namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 数字化智慧校园 | |||
/// Copyright (c) 2013-2020 北京泉江科技有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2024-12-18 14:13 | |||
/// 描 述:DepartmentWeek | |||
/// </summary> | |||
public class DepartmentWeekService : RepositoryFactory | |||
{ | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
/// </summary> | |||
/// <param name="pagination">分页参数</param> | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
public IEnumerable<DepartmentWeekEntity> GetPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(@" t.* "); | |||
strSql.Append(" FROM DepartmentWeek t "); | |||
strSql.Append(" WHERE 1=1 "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (!queryParam["CreateUser"].IsEmpty()) | |||
{ | |||
dp.Add("CreateUser", queryParam["CreateUser"].ToString(), DbType.String); | |||
strSql.Append(" AND t.CreateUser = @CreateUser "); | |||
} | |||
if (!queryParam["Department"].IsEmpty()) | |||
{ | |||
dp.Add("Department", queryParam["Department"].ToString(), DbType.String); | |||
strSql.Append(" AND t.Department = @Department "); | |||
} | |||
if (!queryParam["Week"].IsEmpty()) | |||
{ | |||
dp.Add("Week", queryParam["Week"].ToString(), DbType.String); | |||
strSql.Append(" AND t.Week = @Week "); | |||
} | |||
return this.BaseRepository().FindList<DepartmentWeekEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取DepartmentWeek表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
public DepartmentWeekEntity GetDepartmentWeekEntity(string keyValue) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindEntity<DepartmentWeekEntity>(keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取StuInfoFreshEmergePeople表数据 | |||
/// <summary> | |||
/// <returns></returns> | |||
public IEnumerable<DepartmentWeekDetailEntity> GetDetail(string keyValue, string Types) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindList<DepartmentWeekDetailEntity>(t => t.DWeekID == keyValue && t.Types == Types); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取主表实体数据 | |||
/// </summary> | |||
/// <param name="processId">流程实例ID</param> | |||
/// <returns></returns> | |||
public DepartmentWeekEntity GetEntityByProcessId(string processId) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindEntity<DepartmentWeekEntity>(t => t.ProcessId == processId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
public void DeleteEntity(string keyValue) | |||
{ | |||
var db = this.BaseRepository().BeginTrans(); | |||
try | |||
{ | |||
var id = keyValue.Split(','); | |||
foreach (var item in id) | |||
{ | |||
db.Delete<DepartmentWeekEntity>(t => t.ID == item); | |||
db.Delete<DepartmentWeekDetailEntity>(t => t.DWeekID == item); | |||
db.Commit(); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
/// <returns></returns> | |||
public void SaveEntity(string keyValue, DepartmentWeekEntity entity) | |||
{ | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
entity.Modify(keyValue); | |||
this.BaseRepository().Update(entity); | |||
} | |||
else | |||
{ | |||
entity.Create(); | |||
this.BaseRepository().Insert(entity); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
public void SaveEntity(string keyValue, DepartmentWeekEntity entity, List<DepartmentWeekDetailEntity> First, List<DepartmentWeekDetailEntity> Second) | |||
{ | |||
var db = this.BaseRepository().BeginTrans(); | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
var up = GetDepartmentWeekEntity(keyValue); | |||
entity.Modify(keyValue); | |||
db.Update(entity); | |||
db.Delete<DepartmentWeekDetailEntity>(t => t.DWeekID == up.ID); | |||
if (null != First && null != Second) | |||
{ | |||
foreach (DepartmentWeekDetailEntity item in First) | |||
{ | |||
item.Create(); | |||
item.DWeekID = up.ID; | |||
item.Types = "1"; | |||
item.CreateTime = DateTime.Now; | |||
db.Insert<DepartmentWeekDetailEntity>(item); | |||
} | |||
db.Delete<DepartmentWeekDetailEntity>(t => t.DWeekID == up.ID); | |||
foreach (DepartmentWeekDetailEntity item in Second) | |||
{ | |||
item.Create(); | |||
item.DWeekID = up.ID; | |||
item.Types = "2"; | |||
item.CreateTime = DateTime.Now; | |||
db.Insert<DepartmentWeekDetailEntity>(item); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
entity.Create(); | |||
db.Insert(entity); | |||
if (null != First && null != Second) | |||
{ | |||
foreach (DepartmentWeekDetailEntity item in First) | |||
{ | |||
item.Create(); | |||
item.DWeekID = entity.ID; | |||
item.Types = "1"; | |||
item.CreateTime = DateTime.Now; | |||
db.Insert<DepartmentWeekDetailEntity>(item); | |||
} | |||
foreach (DepartmentWeekDetailEntity item in Second) | |||
{ | |||
item.Create(); | |||
item.DWeekID = entity.ID; | |||
item.Types = "2"; | |||
item.CreateTime = DateTime.Now; | |||
db.Insert<DepartmentWeekDetailEntity>(item); | |||
} | |||
} | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 推送 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
public void PushEntity() | |||
{ | |||
var db = this.BaseRepository().BeginTrans(); | |||
try | |||
{ | |||
//var id = keyValue.Split(','); | |||
//foreach (var item in id) | |||
//{ | |||
// db.ExecuteBySql("update DepartmentWeek set Status='3' where ID = '" + item + "'"); | |||
//} | |||
db.ExecuteBySql("update DepartmentWeek set Status='3' where Status = '2' "); | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="processId"></param> | |||
/// <param name="status"></param> | |||
public void ChangeStatusByProcessId(int status, string processId) | |||
{ | |||
try | |||
{ | |||
this.BaseRepository().ExecuteBySql($"update DepartmentWeek set Status='{status}' where processId='{processId}'"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 提交 | |||
/// </summary> | |||
/// <param name="keyValue"></param> | |||
/// <param name="status"></param> | |||
/// <param name="processId"></param> | |||
public void ChangeStatusById(string keyValue, int status, string processId) | |||
{ | |||
try | |||
{ | |||
this.BaseRepository().ExecuteBySql($"update DepartmentWeek set Status='{status}',processId='{processId}' where ID='{keyValue}'"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -16,7 +16,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
#region 实体成员 | |||
/// <summary> | |||
/// ID | |||
/// </summary> | |||
/// </summary> | |||
[Column("ID")] | |||
public string ID { get; set; } | |||
/// <summary> | |||