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.
 
 
 
 
 
 

276 lines
8.8 KiB

  1. using Dapper;
  2. using Learun.DataBase.Repository;
  3. using Learun.Util;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Text;
  9. namespace Learun.Application.TwoDevelopment.EducationalAdministration
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  13. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2020-05-06 11:20
  16. /// 描 述:在线报名
  17. /// </summary>
  18. public class SignUpAboutOnlineService : RepositoryFactory
  19. {
  20. #region 获取数据
  21. /// <summary>
  22. /// 获取页面显示列表数据
  23. /// <summary>
  24. /// <param name="queryJson">查询参数</param>
  25. /// <returns></returns>
  26. public IEnumerable<SignUpAboutOnlineEntity> GetPageList(Pagination pagination, string queryJson)
  27. {
  28. try
  29. {
  30. var strSql = new StringBuilder();
  31. strSql.Append("SELECT t.* ");
  32. strSql.Append(" FROM SignUpAboutOnline t ");
  33. strSql.Append(" WHERE 1=1 ");
  34. var queryParam = queryJson.ToJObject();
  35. // 虚拟参数
  36. var dp = new DynamicParameters(new { });
  37. if (!queryParam["RealName"].IsEmpty())
  38. {
  39. dp.Add("RealName", "%" + queryParam["RealName"].ToString() + "%", DbType.String);
  40. strSql.Append(" AND t.RealName Like @RealName ");
  41. }
  42. if (!queryParam["IdCard"].IsEmpty())
  43. {
  44. dp.Add("IdCard", "%" + queryParam["IdCard"].ToString() + "%", DbType.String);
  45. strSql.Append(" AND t.IdCard Like @IdCard ");
  46. }
  47. if (!queryParam["DeptNo"].IsEmpty())
  48. {
  49. dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String);
  50. strSql.Append(" AND t.DeptNo = @DeptNo ");
  51. }
  52. if (!queryParam["MajorNo"].IsEmpty())
  53. {
  54. dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String);
  55. strSql.Append(" AND t.MajorNo = @MajorNo ");
  56. }
  57. return this.BaseRepository("CollegeMIS").FindList<SignUpAboutOnlineEntity>(strSql.ToString(), dp, pagination);
  58. }
  59. catch (Exception ex)
  60. {
  61. if (ex is ExceptionEx)
  62. {
  63. throw;
  64. }
  65. else
  66. {
  67. throw ExceptionEx.ThrowServiceException(ex);
  68. }
  69. }
  70. }
  71. /// <summary>
  72. /// 获取SignUpAboutOnline表实体数据
  73. /// <param name="keyValue">主键</param>
  74. /// <summary>
  75. /// <returns></returns>
  76. public SignUpAboutOnlineEntity GetSignUpAboutOnlineEntity(string keyValue)
  77. {
  78. try
  79. {
  80. return this.BaseRepository("CollegeMIS").FindEntity<SignUpAboutOnlineEntity>(keyValue);
  81. }
  82. catch (Exception ex)
  83. {
  84. if (ex is ExceptionEx)
  85. {
  86. throw;
  87. }
  88. else
  89. {
  90. throw ExceptionEx.ThrowServiceException(ex);
  91. }
  92. }
  93. }
  94. /// <summary>
  95. /// 获取SignUpAboutOnline表实体数据
  96. /// <param name="keyValue">主键</param>
  97. /// <summary>
  98. /// <returns></returns>
  99. public SignUpAboutOnlineEntity GetSignUpAboutOnlineEntityByIdCard(string idCard)
  100. {
  101. try
  102. {
  103. return this.BaseRepository("CollegeMIS").FindEntity<SignUpAboutOnlineEntity>(x => x.IdCard == idCard);
  104. }
  105. catch (Exception ex)
  106. {
  107. if (ex is ExceptionEx)
  108. {
  109. throw;
  110. }
  111. else
  112. {
  113. throw ExceptionEx.ThrowServiceException(ex);
  114. }
  115. }
  116. }
  117. #endregion
  118. #region 提交数据
  119. /// <summary>
  120. /// 删除实体数据
  121. /// <param name="keyValue">主键</param>
  122. /// <summary>
  123. /// <returns></returns>
  124. public void DeleteEntity(string keyValue)
  125. {
  126. try
  127. {
  128. this.BaseRepository("CollegeMIS").Delete<SignUpAboutOnlineEntity>(t => t.Id == keyValue);
  129. }
  130. catch (Exception ex)
  131. {
  132. if (ex is ExceptionEx)
  133. {
  134. throw;
  135. }
  136. else
  137. {
  138. throw ExceptionEx.ThrowServiceException(ex);
  139. }
  140. }
  141. }
  142. /// <summary>
  143. /// 保存实体数据(新增、修改)
  144. /// <param name="keyValue">主键</param>
  145. /// <summary>
  146. /// <returns></returns>
  147. public void SaveEntity(string keyValue, SignUpAboutOnlineEntity entity)
  148. {
  149. try
  150. {
  151. if (!string.IsNullOrEmpty(keyValue))
  152. {
  153. entity.Modify(keyValue);
  154. this.BaseRepository("CollegeMIS").Update(entity);
  155. }
  156. else
  157. {
  158. entity.Create();
  159. this.BaseRepository("CollegeMIS").Insert(entity);
  160. }
  161. }
  162. catch (Exception ex)
  163. {
  164. if (ex is ExceptionEx)
  165. {
  166. throw;
  167. }
  168. else
  169. {
  170. throw ExceptionEx.ThrowServiceException(ex);
  171. }
  172. }
  173. }
  174. /// <summary>
  175. /// 审核
  176. /// <param name="keyValue">主键</param>
  177. /// <summary>
  178. /// <returns></returns>
  179. public void DoCheck(string keyValue)
  180. {
  181. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  182. try
  183. {
  184. var model = db.FindEntity<SignUpAboutOnlineEntity>(keyValue);
  185. if (model != null)
  186. {
  187. //修改状态
  188. model.CheckStatus = 1;
  189. db.Update(model);
  190. //新生表加数据
  191. var freshModel = new StuInfoFreshEntity()
  192. {
  193. SignUpTime = model.SignUpTime,
  194. StuName = model.RealName,
  195. GenderNo = model.Sex,
  196. NationalityNo = model.NationalityNo,
  197. HighSchoolName = model.GraduateSchool,
  198. OldClassName = model.ClassNo,
  199. ComprehensiveScore = model.MidExamScore,
  200. FamilyAddress = model.HomeAddress,
  201. OriginAddress = model.OriginAddress,
  202. IdentityCardNo = model.IdCard,
  203. telephone = model.Phone,
  204. MajorNo = model.MajorNo,
  205. DeptNo = db.FindEntity<CdMajorEntity>(model.MajorNo)?.DeptNo,
  206. IsAccommodate = model.IsAccommodate,
  207. HeightWeight = model.HeightWeight,
  208. CreateUserId = LoginUserInfo.Get().userId
  209. };
  210. freshModel.Create();
  211. //去重
  212. if (db.FindList<StuInfoFreshEntity>(m => m.IdentityCardNo == freshModel.IdentityCardNo).Count() == 0)
  213. {
  214. db.Insert(freshModel);
  215. }
  216. }
  217. db.Commit();
  218. }
  219. catch (Exception ex)
  220. {
  221. db.Rollback();
  222. if (ex is ExceptionEx)
  223. {
  224. throw;
  225. }
  226. else
  227. {
  228. throw ExceptionEx.ThrowServiceException(ex);
  229. }
  230. }
  231. }
  232. public void DoUnCheck(string keyValue)
  233. {
  234. var db = this.BaseRepository("CollegeMIS").BeginTrans();
  235. try
  236. {
  237. var model = db.FindEntity<SignUpAboutOnlineEntity>(keyValue);
  238. if (model != null)
  239. {
  240. //修改状态
  241. model.CheckStatus = 0;
  242. db.Update(model);
  243. }
  244. db.Commit();
  245. }
  246. catch (Exception ex)
  247. {
  248. db.Rollback();
  249. if (ex is ExceptionEx)
  250. {
  251. throw;
  252. }
  253. else
  254. {
  255. throw ExceptionEx.ThrowServiceException(ex);
  256. }
  257. }
  258. }
  259. #endregion
  260. }
  261. }