You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

257 lines
8.1 KiB

  1. using Dapper;
  2. using Learun.Application.TwoDevelopment.AssetManagementSystem;
  3. using Learun.DataBase.Repository;
  4. using Learun.Util;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Data;
  8. using System.Text;
  9. namespace Learun.Application.TwoDevelopment.EducationalAdministration
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  13. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2021-03-26 15:23
  16. /// 描 述:学生违纪管理
  17. /// </summary>
  18. public class StuDisciplineManagementService : RepositoryFactory
  19. {
  20. #region 获取数据
  21. /// <summary>
  22. /// 获取页面显示列表数据
  23. /// </summary>
  24. /// <param name="pagination">分页参数</param>
  25. /// <param name="queryJson">查询参数</param>
  26. /// <returns></returns>
  27. public IEnumerable<StuDisciplineManagementEntity> GetPageList(Pagination pagination, string queryJson)
  28. {
  29. try
  30. {
  31. var strSql = new StringBuilder();
  32. strSql.Append(" SELECT t.*,sib.StuName,sib.DeptNo,sib.majorno,sib.classno,sib.GenderNo,sib.Mobile ");
  33. strSql.Append(" FROM StuDisciplineManagement t ");
  34. strSql.Append(" left join stuinfobasic sib on t.Stuno = sib.stuno WHERE 1=1 ");
  35. var queryParam = queryJson.ToJObject();
  36. // 虚拟参数
  37. var dp = new DynamicParameters(new { });
  38. if (!queryParam["StuNo"].IsEmpty())
  39. {
  40. dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String);
  41. strSql.Append(" AND t.StuNo = @StuNo ");
  42. }
  43. if (!queryParam["EmpNo"].IsEmpty())
  44. {
  45. dp.Add("EmpNo", queryParam["EmpNo"].ToString(), DbType.String);
  46. strSql.Append(" AND t.EmpNo = @EmpNo ");
  47. }
  48. return this.BaseRepository("CollegeMIS").FindList<StuDisciplineManagementEntity>(strSql.ToString(), dp, pagination);
  49. }
  50. catch (Exception ex)
  51. {
  52. if (ex is ExceptionEx)
  53. {
  54. throw;
  55. }
  56. else
  57. {
  58. throw ExceptionEx.ThrowServiceException(ex);
  59. }
  60. }
  61. }
  62. /// <summary>
  63. /// 获取StuDisciplineManagement表实体数据
  64. /// </summary>
  65. /// <param name="keyValue">主键</param>
  66. /// <returns></returns>
  67. public StuDisciplineManagementEntity GetStuDisciplineManagementEntity(string keyValue)
  68. {
  69. try
  70. {
  71. return this.BaseRepository("CollegeMIS").FindEntity<StuDisciplineManagementEntity>(keyValue);
  72. }
  73. catch (Exception ex)
  74. {
  75. if (ex is ExceptionEx)
  76. {
  77. throw;
  78. }
  79. else
  80. {
  81. throw ExceptionEx.ThrowServiceException(ex);
  82. }
  83. }
  84. }
  85. /// <summary>
  86. /// 获取主表实体数据
  87. /// </summary>
  88. /// <param name="processId">流程实例ID</param>
  89. /// <returns></returns>
  90. public StuDisciplineManagementEntity GetEntityByProcessId(string processId)
  91. {
  92. try
  93. {
  94. return this.BaseRepository("CollegeMIS").FindEntity<StuDisciplineManagementEntity>(t => t.ProcessId == processId);
  95. }
  96. catch (Exception ex)
  97. {
  98. if (ex is ExceptionEx)
  99. {
  100. throw;
  101. }
  102. else
  103. {
  104. throw ExceptionEx.ThrowServiceException(ex);
  105. }
  106. }
  107. }
  108. #endregion
  109. #region 提交数据
  110. /// <summary>
  111. /// 删除实体数据
  112. /// </summary>
  113. /// <param name="keyValue">主键</param>
  114. public void DeleteEntity(string keyValue)
  115. {
  116. try
  117. {
  118. this.BaseRepository("CollegeMIS").Delete<StuDisciplineManagementEntity>(t => t.Id == keyValue);
  119. }
  120. catch (Exception ex)
  121. {
  122. if (ex is ExceptionEx)
  123. {
  124. throw;
  125. }
  126. else
  127. {
  128. throw ExceptionEx.ThrowServiceException(ex);
  129. }
  130. }
  131. }
  132. /// <summary>
  133. /// 保存实体数据(新增、修改)
  134. /// </summary>
  135. /// <param name="keyValue">主键</param>
  136. /// <param name="entity">实体</param>
  137. /// <returns></returns>
  138. public void SaveEntity(string keyValue, StuDisciplineManagementEntity entity)
  139. {
  140. try
  141. {
  142. if (!string.IsNullOrEmpty(keyValue))
  143. {
  144. entity.Modify(keyValue);
  145. this.BaseRepository("CollegeMIS").Update(entity);
  146. }
  147. else
  148. {
  149. entity.Create();
  150. this.BaseRepository("CollegeMIS").Insert(entity);
  151. }
  152. }
  153. catch (Exception ex)
  154. {
  155. if (ex is ExceptionEx)
  156. {
  157. throw;
  158. }
  159. else
  160. {
  161. throw ExceptionEx.ThrowServiceException(ex);
  162. }
  163. }
  164. }
  165. /// <summary>
  166. /// 提交实体数据
  167. /// </summary>
  168. /// <param name="keyValue">主键</param>
  169. public void DoSubmit(string keyValue, string status, string processId)
  170. {
  171. try
  172. {
  173. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuDisciplineManagement set CheckStatus='" + status + "',ProcessId='" + processId + "' where Id='" + keyValue + "' ");
  174. }
  175. catch (Exception ex)
  176. {
  177. if (ex is ExceptionEx)
  178. {
  179. throw;
  180. }
  181. else
  182. {
  183. throw ExceptionEx.ThrowServiceException(ex);
  184. }
  185. }
  186. }
  187. /// <summary>
  188. /// 审核实体数据
  189. /// </summary>
  190. /// <param name="keyValue">主键</param>
  191. public void ChangeStatusByProcessId(string status, string processId, string userId)
  192. {
  193. try
  194. {
  195. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuDisciplineManagement set CheckStatus='" + status + "',CheckUserId='" + userId + "',CheckTime='" + DateTime.Now + "' where ProcessId='" + processId + "' ");
  196. }
  197. catch (Exception ex)
  198. {
  199. if (ex is ExceptionEx)
  200. {
  201. throw;
  202. }
  203. else
  204. {
  205. throw ExceptionEx.ThrowServiceException(ex);
  206. }
  207. }
  208. }
  209. #endregion
  210. public void ChangeStatusByProcessId(string ProcessID, int PStatus, string userId)
  211. {
  212. var receiveEntity = this.BaseRepository("CollegeMIS").FindEntity<StuDisciplineManagementEntity>(a => a.ProcessId == ProcessID);
  213. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  214. try
  215. {
  216. //if (PStatus == 2)
  217. //{
  218. //修改领取记录的状态
  219. receiveEntity.CheckStatus = PStatus.ToString();
  220. receiveEntity.CheckUserId = userId;
  221. receiveEntity.CheckTime = DateTime.Now;
  222. db.Update(receiveEntity);
  223. //}
  224. db.Commit();
  225. }
  226. catch (Exception ex)
  227. {
  228. db.Rollback();
  229. if (ex is ExceptionEx)
  230. {
  231. throw;
  232. }
  233. else
  234. {
  235. throw ExceptionEx.ThrowServiceException(ex);
  236. }
  237. }
  238. }
  239. }
  240. }