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.

StuEnrollService.cs 78 KiB

4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202
  1. using Dapper;
  2. using Learun.Application.Organization;
  3. using Learun.Application.TwoDevelopment.LogisticsManagement;
  4. using Learun.Application.TwoDevelopment.ReceiveSendFeeManagement;
  5. using Learun.DataBase.Repository;
  6. using Learun.Util;
  7. using Newtonsoft.Json;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Data;
  11. using System.Linq;
  12. using System.Text;
  13. using Learun.Application.Base.SystemModule;
  14. namespace Learun.Application.TwoDevelopment.EducationalAdministration
  15. {
  16. /// <summary>
  17. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  18. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  19. /// 创 建:超级管理员
  20. /// 日 期:2019-07-17 11:20
  21. /// 描 述:新生录取管理
  22. /// </summary>
  23. public class StuEnrollService : RepositoryFactory
  24. {
  25. #region 获取数据
  26. /// <summary>
  27. /// 获取页面显示列表数据
  28. /// <summary>
  29. /// <param name="queryJson">查询参数</param>
  30. /// <returns></returns>
  31. public IEnumerable<StuEnrollEntity> GetPageList(Pagination pagination, string queryJson)
  32. {
  33. try
  34. {
  35. var strSql = new StringBuilder();
  36. strSql.Append("SELECT ");
  37. strSql.Append(@"
  38. t.StuId,
  39. t.RegistrationNo,
  40. t.StuName,
  41. t.Gender,
  42. t.Nationals,
  43. t.Birthday,
  44. t.IDCard,
  45. t.Political,
  46. t.FreshType,
  47. t.ResidenceType,
  48. t.StuType,
  49. t.ResidenceAddress,
  50. t.NonNative,
  51. t.FromSchool,
  52. t.HomeAddress,
  53. t.FirstGuardian,
  54. t.FirstRelationship,
  55. t.FirstUnits,
  56. t.FirstMobile,
  57. t.SecondGuardian,
  58. t.SecondRelationship,
  59. t.SecondUnits,
  60. t.SecondMobile,
  61. t.Acceptance,
  62. t.Recipient,
  63. t.ZipCode,
  64. t.MedicalHistory,
  65. t.AdditionalCare,
  66. t.MajorNo,
  67. t.MajorName,
  68. t.Admissions,
  69. t.IsAccommodation,
  70. t.ExamRegistration,
  71. t.ClassNo,
  72. t.DormitoryNo,
  73. t.DormitoryName,
  74. t.IsPay,
  75. t.IsCheckIn,
  76. t.IsCheckIn2,
  77. t.EnrollType,
  78. t.IsSubsidize1,
  79. t.IsSubsidize12,
  80. t.IsMilitary,
  81. t.IsMilitary2,
  82. t.IsQuantity,
  83. t.IsTakeCloths,
  84. t.IsMug,
  85. t.IsGetBeddingArticle,
  86. t.IsReport,
  87. t.EductionalSystme,
  88. t.CheckInUrl,
  89. t.SubsidizeUrl,
  90. t.MilitaryUrl,
  91. t.AddTime,
  92. t.StuNo,
  93. t.StuStatusNo,
  94. t.PayAmount,
  95. t.ActualPayAmount,
  96. t.DeptNo,
  97. t.Grade,
  98. t.THROUGHPROJECT,
  99. t.Status
  100. ");
  101. strSql.Append(" FROM StuEnroll t ");
  102. strSql.Append(" WHERE 1=1 ");
  103. var queryParam = queryJson.ToJObject();
  104. // 虚拟参数
  105. var dp = new DynamicParameters(new { });
  106. if (!queryParam["IDCard"].IsEmpty())
  107. {
  108. dp.Add("IDCard", "%" + queryParam["IDCard"].ToString() + "%", DbType.String);
  109. strSql.Append(" AND t.IDCard Like @IDCard ");
  110. }
  111. if (!queryParam["Year"].IsEmpty())
  112. {
  113. dp.Add("Year", "%" + queryParam["Year"].ToString() + "%", DbType.String);
  114. strSql.Append(" AND t.ClassNo Like @Year ");
  115. }
  116. //sql条件
  117. if (!queryParam["SqlParameter"].IsEmpty())
  118. {
  119. strSql.Append(queryParam["SqlParameter"].ToString());
  120. }
  121. if (!queryParam["RegistrationNo"].IsEmpty())
  122. {
  123. dp.Add("RegistrationNo", "%" + queryParam["RegistrationNo"].ToString() + "%", DbType.String);
  124. strSql.Append(" AND t.RegistrationNo Like @RegistrationNo ");
  125. }
  126. if (!queryParam["Admissions"].IsEmpty())
  127. {
  128. dp.Add("Admissions", queryParam["Admissions"].ToString() , DbType.String);
  129. strSql.Append(" AND t.Admissions = @Admissions ");
  130. }
  131. if (!queryParam["DeptNo"].IsEmpty())
  132. {
  133. dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String);
  134. strSql.Append(" AND t.DeptNo = @DeptNo ");
  135. }
  136. if (!queryParam["MajorNo"].IsEmpty())
  137. {
  138. dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String);
  139. strSql.Append(" AND t.MajorNo = @MajorNo ");
  140. }
  141. if (!queryParam["Grade"].IsEmpty())
  142. {
  143. dp.Add("Grade", queryParam["Grade"].ToString(), DbType.String);
  144. strSql.Append(" AND t.Grade = @Grade ");
  145. }
  146. if (!queryParam["ClassNo"].IsEmpty())
  147. {
  148. dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String);
  149. strSql.Append(" AND t.ClassNo = @ClassNo ");
  150. }
  151. if (!queryParam["IsAllocation"].IsEmpty())
  152. {
  153. var IsAllocation = Convert.ToBoolean(queryParam["IsAllocation"].ToString());
  154. if (IsAllocation)
  155. {
  156. strSql.Append(" AND (t.ClassNo IS NOT NULL AND t.ClassNo<>'')");
  157. }
  158. else
  159. {
  160. strSql.Append(" AND (t.ClassNo IS NULL OR t.ClassNo='')");
  161. }
  162. }
  163. if (!queryParam["IsAllocationDormitory"].IsEmpty())
  164. {
  165. var IsAllocation = Convert.ToBoolean(queryParam["IsAllocationDormitory"].ToString());
  166. if (IsAllocation)
  167. {
  168. strSql.Append(" AND (t.DormitoryNo IS NOT NULL AND t.DormitoryNo<>'')");
  169. }
  170. else
  171. {
  172. strSql.Append(" AND (t.DormitoryNo IS NULL OR t.DormitoryNo='')");
  173. }
  174. }
  175. if (!queryParam["StuName"].IsEmpty())
  176. {
  177. dp.Add("StuName", "%" + queryParam["StuName"].ToString() + "%", DbType.String);
  178. strSql.Append(" AND t.StuName Like @StuName ");
  179. }
  180. if (!queryParam["Status"].IsEmpty())
  181. {
  182. dp.Add("Status", queryParam["Status"].ToString(), DbType.String);
  183. strSql.Append(" AND t.Status = @Status ");
  184. }
  185. if (!queryParam["Gender"].IsEmpty())
  186. {
  187. dp.Add("Gender", Convert.ToBoolean(queryParam["Gender"].ToString()), DbType.Boolean);
  188. strSql.Append(" AND t.Gender = @Gender ");
  189. }
  190. if (!queryParam["PayList"].IsEmpty())
  191. {
  192. strSql.Append(" AND t.Status>=3 AND t.Status<6 ");
  193. }
  194. if (!queryParam["IsCheckIn"].IsEmpty())
  195. {
  196. if (queryParam["IsCheckIn"].ToString() == "null")
  197. {
  198. strSql.Append(" AND t.IsCheckIn is null ");
  199. }
  200. else
  201. {
  202. dp.Add("IsCheckIn", queryParam["IsCheckIn"].ToString(), DbType.String);
  203. strSql.Append(" AND t.IsCheckIn = @IsCheckIn ");
  204. }
  205. }
  206. if (!queryParam["IsSubsidize1"].IsEmpty())
  207. {
  208. if (queryParam["IsSubsidize1"].ToString() == "null")
  209. {
  210. strSql.Append(" AND t.IsSubsidize1 is null ");
  211. }
  212. else
  213. {
  214. dp.Add("IsSubsidize1", queryParam["IsSubsidize1"].ToString(), DbType.String);
  215. strSql.Append(" AND t.IsSubsidize1 = @IsSubsidize1 ");
  216. }
  217. }
  218. if (!queryParam["IsMilitary"].IsEmpty())
  219. {
  220. if (queryParam["IsMilitary"].ToString() == "null")
  221. {
  222. strSql.Append(" AND t.IsMilitary is null ");
  223. }
  224. else
  225. {
  226. dp.Add("IsMilitary", queryParam["IsMilitary"].ToString(), DbType.String);
  227. strSql.Append(" AND t.IsMilitary = @IsMilitary ");
  228. }
  229. }
  230. if (!queryParam["IsPay"].IsEmpty())
  231. {
  232. if (queryParam["IsPay"].ToString() == "null")
  233. {
  234. strSql.Append(" AND t.IsPay is null ");
  235. }
  236. else
  237. {
  238. dp.Add("IsPay", queryParam["IsPay"].ToString(), DbType.String);
  239. strSql.Append(" AND t.IsPay = @IsPay ");
  240. }
  241. }
  242. if (!queryParam["IsMug"].IsEmpty())
  243. {
  244. if (queryParam["IsMug"].ToString() == "null")
  245. {
  246. strSql.Append(" AND t.IsMug is null ");
  247. }
  248. else
  249. {
  250. dp.Add("IsMug", queryParam["IsMug"].ToString(), DbType.String);
  251. strSql.Append(" AND t.IsMug = @IsMug ");
  252. }
  253. }
  254. if (!queryParam["IsTakeCloths"].IsEmpty())
  255. {
  256. if (queryParam["IsTakeCloths"].ToString() == "null")
  257. {
  258. strSql.Append(" AND t.IsTakeCloths is null ");
  259. }
  260. else
  261. {
  262. dp.Add("IsTakeCloths", queryParam["IsTakeCloths"].ToString(), DbType.String);
  263. strSql.Append(" AND t.IsTakeCloths = @IsTakeCloths ");
  264. }
  265. }
  266. if (!queryParam["IsQuantity"].IsEmpty())
  267. {
  268. if (queryParam["IsQuantity"].ToString() == "null")
  269. {
  270. strSql.Append(" AND t.IsQuantity is null ");
  271. }
  272. else
  273. {
  274. dp.Add("IsQuantity", queryParam["IsQuantity"].ToString(), DbType.String);
  275. strSql.Append(" AND t.IsQuantity = @IsQuantity ");
  276. }
  277. }
  278. if (!queryParam["IsGetBeddingArticle"].IsEmpty())
  279. {
  280. if (queryParam["IsGetBeddingArticle"].ToString() == "null")
  281. {
  282. strSql.Append(" AND t.IsGetBeddingArticle is null ");
  283. }
  284. else
  285. {
  286. dp.Add("IsGetBeddingArticle", queryParam["IsGetBeddingArticle"].ToString(), DbType.String);
  287. strSql.Append(" AND t.IsGetBeddingArticle = @IsGetBeddingArticle ");
  288. }
  289. }
  290. //获取班主任所带的班级
  291. var roleid = this.BaseRepository().FindEntity<RoleEntity>(a => a.F_FullName == "班主任")?.F_RoleId;
  292. var userInfo = LoginUserInfo.Get();
  293. var sqlClasses = "";
  294. if (!string.IsNullOrEmpty(roleid))
  295. {
  296. if (userInfo.roleIds.Contains(roleid))
  297. {
  298. var classes = this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>(a => a.ClassDiredctorNo == userInfo.account).Select(a => a.ClassNo).ToList();
  299. if (classes != null)
  300. {
  301. foreach (var item in classes)
  302. {
  303. sqlClasses += $"'{item}',";
  304. }
  305. sqlClasses = sqlClasses.TrimEnd(',');
  306. }
  307. }
  308. if (!string.IsNullOrEmpty(sqlClasses))
  309. {
  310. strSql.Append($" AND t.ClassNo IN({sqlClasses})");
  311. }
  312. }
  313. return this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>(strSql.ToString(), dp, pagination);
  314. }
  315. catch (Exception ex)
  316. {
  317. if (ex is ExceptionEx)
  318. {
  319. throw;
  320. }
  321. else
  322. {
  323. throw ExceptionEx.ThrowServiceException(ex);
  324. }
  325. }
  326. }
  327. public IEnumerable<StuEnrollEntity> AllStudent()
  328. {
  329. try
  330. {
  331. return this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>();
  332. }
  333. catch (Exception ex)
  334. {
  335. if (ex is ExceptionEx)
  336. {
  337. throw;
  338. }
  339. else
  340. {
  341. throw ExceptionEx.ThrowServiceException(ex);
  342. }
  343. }
  344. }
  345. public IEnumerable<Acc_DormitoryBuildEntity> GetDormitorys(Pagination pagination, string queryJson)
  346. {
  347. try
  348. {
  349. var strSql = new StringBuilder();
  350. strSql.Append("SELECT ");
  351. strSql.Append(@"
  352. t.ID,
  353. t.Name,
  354. t.Address,
  355. t.Campus,
  356. t.Dept,
  357. t.BuildType,
  358. t.Major,
  359. t.Class,
  360. t.Sex,
  361. t.Functionary,
  362. t.Phone,
  363. t.Price,
  364. t.Leader,
  365. t.StudentID,
  366. t.PlanStudentID,
  367. t.ParentID,
  368. t.Remark,
  369. t.Starred,
  370. t.PlanClassNo,
  371. t.HasToilet
  372. ");
  373. strSql.Append(" FROM Acc_DormitoryBuild t ");
  374. strSql.Append(" WHERE 1=1 ");
  375. var queryParam = queryJson.ToJObject();
  376. // 虚拟参数
  377. var dp = new DynamicParameters(new { });
  378. if (!queryParam["ParentID"].IsEmpty())
  379. {
  380. dp.Add("ParentID", queryParam["ParentID"].ToString(), DbType.String);
  381. strSql.Append(" AND t.ParentID =@ParentID ");
  382. }
  383. if (!queryParam["Sex"].IsEmpty())
  384. {
  385. dp.Add("Sex", queryParam["Sex"].ToString(), DbType.String);
  386. strSql.Append(" AND t.Sex = @Sex ");
  387. }
  388. if (!queryParam["IsAllocationDormitory"].IsEmpty())
  389. {
  390. if (queryParam["IsAllocationDormitory"].ToString() == "false")
  391. {
  392. strSql.Append(" AND t.PlanClassNo is not null or t.PlanClassNo<>'' ");
  393. }
  394. else
  395. {
  396. strSql.Append(" AND t.PlanClassNo is null or t.PlanClassNo=''");
  397. }
  398. }
  399. if (!queryParam["PlanClassNo"].IsEmpty())
  400. {
  401. dp.Add("PlanClassNo", queryParam["PlanClassNo"].ToString(), DbType.String);
  402. strSql.Append(" AND t.PlanClassNo =@PlanClassNo ");
  403. }
  404. var data = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(strSql.ToString(), dp, pagination).OrderBy(a => a.Name).ToList();
  405. foreach (var item in data)
  406. {
  407. item.ChildCount = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(a => a.ParentID == item.ID).Count();
  408. }
  409. return data;
  410. }
  411. catch (Exception ex)
  412. {
  413. if (ex is ExceptionEx)
  414. {
  415. throw;
  416. }
  417. else
  418. {
  419. throw ExceptionEx.ThrowServiceException(ex);
  420. }
  421. }
  422. }
  423. internal List<Tuple<int, int, string, string>> GetTree()
  424. {
  425. try
  426. {
  427. var data = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>(a => !string.IsNullOrEmpty(a.ClassNo)).ToList();
  428. var classInfos = this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>().ToList();
  429. var classes = data.GroupBy(a => a.ClassNo).Select(a => a.Key).ToList();
  430. List<Tuple<int, int, string, string>> list = new List<Tuple<int, int, string, string>>();
  431. foreach (var classNo in classes)
  432. {
  433. var boy = data.Count(a => a.ClassNo == classNo && a.Gender == true);
  434. var girl = data.Count(a => a.ClassNo == classNo && a.Gender == false);
  435. var className = classInfos.FirstOrDefault(a => a.ClassNo == classNo)?.ClassName;
  436. Tuple<int, int, string, string> tuple = new Tuple<int, int, string, string>(boy, girl, classNo, className);
  437. list.Add(tuple);
  438. }
  439. return list;
  440. }
  441. catch (Exception ex)
  442. {
  443. if (ex is ExceptionEx)
  444. {
  445. throw;
  446. }
  447. else
  448. {
  449. throw ExceptionEx.ThrowServiceException(ex);
  450. }
  451. }
  452. }
  453. internal List<Acc_DormitoryBuildEntity> GetBedTree(string classNo, string gender)
  454. {
  455. try
  456. {
  457. var sex = "";
  458. if (gender == "true")
  459. {
  460. sex = "1";
  461. }
  462. else
  463. {
  464. sex = "0";
  465. }
  466. List<Acc_DormitoryBuildEntity> list = new List<Acc_DormitoryBuildEntity>();
  467. var data = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(a => a.PlanClassNo == classNo && a.Sex == sex).ToList();
  468. var bb = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  469. foreach (var item in data)
  470. {
  471. list.Add(item);
  472. var beds = this.BaseRepository("CollegeMIS").FindList<Acc_DormitoryBuildEntity>(a => a.ParentID == item.ID).ToList();
  473. foreach (var bed in beds)
  474. {
  475. var stuName = bb.FirstOrDefault(a => a.DormitoryNo == bed.ID)?.StuName;
  476. if (!string.IsNullOrEmpty(stuName))
  477. {
  478. bed.Name = $"{bed.Name}({stuName})";
  479. }
  480. list.Add(bed);
  481. }
  482. }
  483. return list;
  484. }
  485. catch (Exception ex)
  486. {
  487. if (ex is ExceptionEx)
  488. {
  489. throw;
  490. }
  491. else
  492. {
  493. throw ExceptionEx.ThrowServiceException(ex);
  494. }
  495. }
  496. }
  497. internal List<string> GetStuIdCards()
  498. {
  499. try
  500. {
  501. return this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().Select(a => a.IDCard).ToList();
  502. }
  503. catch (Exception ex)
  504. {
  505. if (ex is ExceptionEx)
  506. {
  507. throw;
  508. }
  509. else
  510. {
  511. throw ExceptionEx.ThrowServiceException(ex);
  512. }
  513. }
  514. }
  515. internal object GetStuInfo(string stuId)
  516. {
  517. try
  518. {
  519. var stuEnroll = this.BaseRepository("CollegeMIS").FindEntity<StuEnrollEntity>(a => a.StuId == stuId);
  520. var majorInfo = this.BaseRepository("CollegeMIS").FindEntity<CdMajorEntity>(a => a.MajorNo == stuEnroll.MajorNo);
  521. var deptNo = majorInfo?.DeptNo;
  522. var majorName = majorInfo?.MajorName;
  523. var deptName = this.BaseRepository("CollegeMIS").FindEntity<CdDeptEntity>(a => a.DeptNo == deptNo)?.DeptName;
  524. var classInfo = this.BaseRepository("CollegeMIS").FindEntity<ClassInfoEntity>(a => a.ClassNo == stuEnroll.ClassNo);
  525. var teacherInfo = new EmpInfoEntity();
  526. var yearAndSemester = Common.GetSemesterAndYear();
  527. var result = new List<StuPayInfo>();
  528. if (classInfo != null)
  529. {
  530. teacherInfo = this.BaseRepository("CollegeMIS").FindEntity<EmpInfoEntity>(a => a.EmpNo == classInfo.ClassDiredctorNo);
  531. result = this.BaseRepository("CollegeMIS").FindList<FinaChargesStandardEntity>(a => a.Grade == classInfo.Grade && a.MajorNo == stuEnroll.MajorNo && a.AcademicYearNo == yearAndSemester.AcademicYearShort && a.Semester == yearAndSemester.Semester)
  532. .Select(a => new StuPayInfo
  533. {
  534. standerid = a.ChargeItemID,
  535. shouldPay = a.Standard,
  536. standard = a.Standard,
  537. standerdName = this.BaseRepository("CollegeMIS").FindEntity<FinaChargeItemEntity>(b => b.ChargeItemID == a.ChargeItemID).ChargeItemName.Trim()
  538. }).ToList();
  539. }
  540. foreach (var item in result)
  541. {
  542. //住宿费
  543. if (item.standerid == 12 && stuEnroll.IsCheckIn == false)
  544. {
  545. item.shouldPay = 0;
  546. }
  547. //学费
  548. if (item.standerid == 14 && stuEnroll.IsSubsidize1 == true)
  549. {
  550. item.shouldPay = 0;
  551. }
  552. switch (item.standerid)
  553. {
  554. case 12:
  555. if (stuEnroll.IsCheckIn == false) item.shouldPay = 0;
  556. break;
  557. case 14:
  558. if (stuEnroll.IsSubsidize1 == true) item.shouldPay = 0;
  559. break;
  560. case 15:
  561. if (stuEnroll.IsMilitary == false) item.shouldPay = 0;
  562. break;
  563. case 32:
  564. if (stuEnroll.IsCheckIn == false) item.shouldPay = 0;
  565. break;
  566. case 33:
  567. if (stuEnroll.EnrollType == "0") item.shouldPay = 0;
  568. break;
  569. default:
  570. break;
  571. }
  572. }
  573. decimal money = 0;
  574. decimal allMoney = 0;
  575. //记录缴费金额
  576. foreach (var item in result)
  577. {
  578. money += Convert.ToDecimal(item.shouldPay);
  579. allMoney += Convert.ToDecimal(item.standard);
  580. }
  581. stuEnroll.PayAmount = money;
  582. this.BaseRepository("CollegeMIS").Update(stuEnroll);
  583. return new
  584. {
  585. deptName,
  586. majorName,
  587. className = classInfo?.ClassName,
  588. teacherName = teacherInfo?.EmpName,
  589. teacherMobile = teacherInfo?.mobile,
  590. chagerItemList = result,
  591. money,
  592. allMoney
  593. };
  594. }
  595. catch (Exception ex)
  596. {
  597. if (ex is ExceptionEx)
  598. {
  599. throw;
  600. }
  601. else
  602. {
  603. throw ExceptionEx.ThrowServiceException(ex);
  604. }
  605. }
  606. }
  607. public class StuPayInfo
  608. {
  609. public int standerid { get; set; }
  610. public decimal? shouldPay { get; set; }
  611. public decimal? standard { get; set; }
  612. public string standerdName { get; set; }
  613. }
  614. internal object GetCheckInStatistics(string DeptNo, string MajorNo, string ClassNo)
  615. {
  616. try
  617. {
  618. var data = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>()
  619. .Where(a => string.IsNullOrEmpty(DeptNo) || a.DeptNo == DeptNo)
  620. .Where(a => string.IsNullOrEmpty(MajorNo) || a.MajorNo == MajorNo)
  621. .Where(a => string.IsNullOrEmpty(ClassNo) || a.ClassNo == ClassNo)
  622. ;
  623. var aa = data.Count(a => a.IsCheckIn == true);
  624. var bb = data.Count(a => a.IsCheckIn == false);
  625. return new { aa, bb };
  626. }
  627. catch (Exception ex)
  628. {
  629. if (ex is ExceptionEx)
  630. {
  631. throw;
  632. }
  633. else
  634. {
  635. throw ExceptionEx.ThrowServiceException(ex);
  636. }
  637. }
  638. }
  639. internal object GetHelpStatistics(string DeptNo, string MajorNo, string ClassNo)
  640. {
  641. try
  642. {
  643. var data = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>()
  644. .Where(a => string.IsNullOrEmpty(DeptNo) || a.DeptNo == DeptNo)
  645. .Where(a => string.IsNullOrEmpty(MajorNo) || a.MajorNo == MajorNo)
  646. .Where(a => string.IsNullOrEmpty(ClassNo) || a.ClassNo == ClassNo)
  647. ;
  648. var aa = data.Count(a => a.IsSubsidize1 == true);
  649. var bb = data.Count(a => a.IsSubsidize1 == false);
  650. return new { aa, bb };
  651. }
  652. catch (Exception ex)
  653. {
  654. if (ex is ExceptionEx)
  655. {
  656. throw;
  657. }
  658. else
  659. {
  660. throw ExceptionEx.ThrowServiceException(ex);
  661. }
  662. }
  663. }
  664. internal object GetMilitaryStatistics(string DeptNo, string MajorNo, string ClassNo)
  665. {
  666. try
  667. {
  668. var data = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>()
  669. .Where(a => string.IsNullOrEmpty(DeptNo) || a.DeptNo == DeptNo)
  670. .Where(a => string.IsNullOrEmpty(MajorNo) || a.MajorNo == MajorNo)
  671. .Where(a => string.IsNullOrEmpty(ClassNo) || a.ClassNo == ClassNo)
  672. ;
  673. var aa = data.Count(a => a.IsMilitary == true);
  674. var bb = data.Count(a => a.IsMilitary == false);
  675. return new { aa, bb };
  676. }
  677. catch (Exception ex)
  678. {
  679. if (ex is ExceptionEx)
  680. {
  681. throw;
  682. }
  683. else
  684. {
  685. throw ExceptionEx.ThrowServiceException(ex);
  686. }
  687. }
  688. }
  689. /// <summary>
  690. /// 获取页面显示列表数据
  691. /// <summary>
  692. /// <param name="queryJson">查询参数</param>
  693. /// <returns></returns>
  694. public IEnumerable<StuEnrollEntity> GetReportPageList(Pagination pagination, string queryJson)
  695. {
  696. try
  697. {
  698. var strSql = new StringBuilder();
  699. strSql.Append("SELECT ");
  700. strSql.Append(@"
  701. t.StuId,
  702. t.RegistrationNo,
  703. t.StuName,
  704. t.Gender,
  705. t.Nationals,
  706. t.Birthday,
  707. t.IDCard,
  708. t.Political,
  709. t.FreshType,
  710. t.ResidenceType,
  711. t.StuType,
  712. t.ResidenceAddress,
  713. t.NonNative,
  714. t.FromSchool,
  715. t.HomeAddress,
  716. t.FirstGuardian,
  717. t.FirstRelationship,
  718. t.FirstUnits,
  719. t.FirstMobile,
  720. t.SecondGuardian,
  721. t.SecondRelationship,
  722. t.SecondUnits,
  723. t.SecondMobile,
  724. t.Acceptance,
  725. t.Recipient,
  726. t.ZipCode,
  727. t.MedicalHistory,
  728. t.AdditionalCare,
  729. t.MajorNo,
  730. t.MajorName,
  731. t.Admissions,
  732. t.IsAccommodation,
  733. t.ExamRegistration,
  734. t.ClassNo,
  735. t.DormitoryNo,
  736. t.DormitoryName,
  737. t.EnrollType,
  738. t.IsCheckIn,
  739. t.IsSubsidize1,
  740. t.IsMilitary,
  741. t.Grade,
  742. t.IsQuantity,
  743. t.IsTakeCloths,
  744. t.IsMug,
  745. t.IsGetBeddingArticle,
  746. t.IsReport,
  747. t.EductionalSystme,
  748. t.AddTime,
  749. t.StuNo,
  750. t.StuStatusNo,
  751. t.SecurityAgreement,
  752. t.Status
  753. ");
  754. strSql.Append(" FROM StuEnroll t ");
  755. strSql.Append(" WHERE 1=1 ");
  756. var queryParam = queryJson.ToJObject();
  757. // 虚拟参数
  758. var dp = new DynamicParameters(new { });
  759. if (!queryParam["IsReport"].IsEmpty())
  760. {
  761. if (queryParam["IsReport"].ToString() == "null")
  762. {
  763. strSql.Append(" AND t.IsReport is null ");
  764. }
  765. else
  766. {
  767. dp.Add("IsReport", queryParam["IsReport"].ToString(), DbType.String);
  768. strSql.Append(" AND t.IsReport = @IsReport ");
  769. }
  770. }
  771. if (!queryParam["IDCard"].IsEmpty())
  772. {
  773. dp.Add("IDCard", "%" + queryParam["IDCard"].ToString() + "%", DbType.String);
  774. strSql.Append(" AND t.IDCard Like @IDCard ");
  775. }
  776. if (!queryParam["DeptNo"].IsEmpty())
  777. {
  778. dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String);
  779. strSql.Append(" AND t.DeptNo = @DeptNo ");
  780. }
  781. if (!queryParam["Admissions"].IsEmpty())
  782. {
  783. dp.Add("Admissions", queryParam["Admissions"].ToString(), DbType.String);
  784. strSql.Append(" AND t.Admissions = @Admissions ");
  785. }
  786. if (!queryParam["Grade"].IsEmpty())
  787. {
  788. dp.Add("Grade", queryParam["Grade"].ToString(), DbType.String);
  789. strSql.Append(" AND t.Grade = @Grade ");
  790. }
  791. if (!queryParam["MajorNo"].IsEmpty())
  792. {
  793. dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String);
  794. strSql.Append(" AND t.MajorNo = @MajorNo ");
  795. }
  796. if (!queryParam["ClassNo"].IsEmpty())
  797. {
  798. dp.Add("ClassNo", queryParam["ClassNo"].ToString(), DbType.String);
  799. strSql.Append(" AND t.ClassNo = @ClassNo ");
  800. }
  801. if (!queryParam["RegistrationNo"].IsEmpty())
  802. {
  803. dp.Add("RegistrationNo", "%" + queryParam["RegistrationNo"].ToString() + "%", DbType.String);
  804. strSql.Append(" AND t.RegistrationNo Like @RegistrationNo ");
  805. }
  806. if (!queryParam["StuName"].IsEmpty())
  807. {
  808. dp.Add("StuName", "%" + queryParam["StuName"].ToString() + "%", DbType.String);
  809. strSql.Append(" AND t.StuName Like @StuName ");
  810. }
  811. //获取班主任所带的班级
  812. var roleid = this.BaseRepository().FindEntity<RoleEntity>(a => a.F_FullName == "班主任").F_RoleId;
  813. var userInfo = LoginUserInfo.Get();
  814. var sqlClasses = "";
  815. if (userInfo.roleIds.Contains(roleid))
  816. {
  817. var classes = this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>(a => a.ClassDiredctorNo == userInfo.account).Select(a => a.ClassNo).ToList();
  818. if (classes != null)
  819. {
  820. foreach (var item in classes)
  821. {
  822. sqlClasses += $"'{item}',";
  823. }
  824. sqlClasses = sqlClasses.TrimEnd(',');
  825. }
  826. }
  827. if (!string.IsNullOrEmpty(sqlClasses))
  828. {
  829. strSql.Append($" AND t.ClassNo IN({sqlClasses})");
  830. }
  831. return this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>(strSql.ToString(), dp, pagination);
  832. }
  833. catch (Exception ex)
  834. {
  835. if (ex is ExceptionEx)
  836. {
  837. throw;
  838. }
  839. else
  840. {
  841. throw ExceptionEx.ThrowServiceException(ex);
  842. }
  843. }
  844. }
  845. internal (bool, string) Stay(string stuId, bool status, bool payAfter)
  846. {
  847. try
  848. {
  849. var roleid = this.BaseRepository().FindEntity<RoleEntity>(a => a.F_FullName == "学生科科长")?.F_RoleId;
  850. var loginUser = LoginUserInfo.Get();
  851. var resultbool = false;
  852. var result = "";
  853. if (!string.IsNullOrEmpty(stuId))
  854. {
  855. var data = JsonConvert.DeserializeObject<List<StuEnrollEntity>>(stuId);
  856. if (data.Any())
  857. {
  858. foreach (var item in data)
  859. {
  860. if (payAfter)
  861. {
  862. //if (loginUser.roleIds.Contains(roleid))
  863. //{
  864. item.IsCheckIn2 = status;
  865. this.BaseRepository("CollegeMIS").Update(item);
  866. //}
  867. }
  868. else
  869. {
  870. item.IsCheckIn = status;
  871. item.IsCheckIn2 = status;
  872. item.Status = 2;
  873. if (!status)
  874. {
  875. item.IsGetBeddingArticle = false;
  876. }
  877. this.BaseRepository("CollegeMIS").Update(item);
  878. }
  879. StuEnrollAmountRecordEntity amountRecordEntity = new StuEnrollAmountRecordEntity();
  880. amountRecordEntity.Create();
  881. if (status)
  882. {
  883. amountRecordEntity.Content = "确认入住";
  884. }
  885. else
  886. {
  887. amountRecordEntity.Content = "取消入住";
  888. }
  889. amountRecordEntity.StuID = item.StuId;
  890. this.BaseRepository("CollegeMIS").Insert(amountRecordEntity);
  891. }
  892. resultbool = true;
  893. result = "操作成功";
  894. }
  895. }
  896. else
  897. {
  898. result = "错误";
  899. }
  900. return (resultbool, result);
  901. }
  902. catch (Exception ex)
  903. {
  904. if (ex is ExceptionEx)
  905. {
  906. throw;
  907. }
  908. else
  909. {
  910. throw ExceptionEx.ThrowServiceException(ex);
  911. }
  912. }
  913. }
  914. internal void AllStay()
  915. {
  916. try
  917. {
  918. var list = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>(a => a.IsPay != true && a.IsReport == true).ToList();
  919. foreach (var item in list)
  920. {
  921. item.IsCheckIn = true;
  922. item.IsCheckIn2 = true;
  923. item.Status = 2;
  924. this.BaseRepository("CollegeMIS").Update(item);
  925. StuEnrollAmountRecordEntity amountRecordEntity = new StuEnrollAmountRecordEntity();
  926. amountRecordEntity.Create();
  927. amountRecordEntity.Content = "确认入住";
  928. amountRecordEntity.StuID = item.StuId;
  929. this.BaseRepository("CollegeMIS").Insert(amountRecordEntity);
  930. }
  931. }
  932. catch (Exception ex)
  933. {
  934. if (ex is ExceptionEx)
  935. {
  936. throw;
  937. }
  938. else
  939. {
  940. throw ExceptionEx.ThrowServiceException(ex);
  941. }
  942. }
  943. }
  944. internal (bool, string) Help(string stuId, bool status, bool payAfter)
  945. {
  946. try
  947. {
  948. var roleid = this.BaseRepository().FindEntity<RoleEntity>(a => a.F_FullName == "学生科科长")?.F_RoleId;
  949. var loginUser = LoginUserInfo.Get();
  950. var resultbool = false;
  951. var result = "";
  952. if (!string.IsNullOrEmpty(stuId))
  953. {
  954. var data = JsonConvert.DeserializeObject<List<StuEnrollEntity>>(stuId);
  955. if (data.Any())
  956. {
  957. foreach (var item in data)
  958. {
  959. if (payAfter)
  960. {
  961. //if (loginUser.roleIds.Contains(roleid))
  962. //{
  963. item.IsSubsidize12 = status;
  964. this.BaseRepository("CollegeMis").Update(item);
  965. //}
  966. }
  967. else
  968. {
  969. item.IsSubsidize1 = status;
  970. item.IsSubsidize12 = status;
  971. item.Status = 3;
  972. this.BaseRepository("CollegeMis").Update(item);
  973. }
  974. StuEnrollAmountRecordEntity amountRecordEntity = new StuEnrollAmountRecordEntity();
  975. amountRecordEntity.Create();
  976. if (status)
  977. {
  978. amountRecordEntity.Content = "确认资助";
  979. }
  980. else
  981. {
  982. amountRecordEntity.Content = "取消资助";
  983. }
  984. amountRecordEntity.StuID = item.StuId;
  985. this.BaseRepository("CollegeMIS").Insert(amountRecordEntity);
  986. }
  987. resultbool = true;
  988. result = "操作成功";
  989. }
  990. }
  991. else
  992. {
  993. result = "错误";
  994. }
  995. return (resultbool, result);
  996. }
  997. catch (Exception ex)
  998. {
  999. if (ex is ExceptionEx)
  1000. {
  1001. throw;
  1002. }
  1003. else
  1004. {
  1005. throw ExceptionEx.ThrowServiceException(ex);
  1006. }
  1007. }
  1008. }
  1009. internal void AllHelp()
  1010. {
  1011. try
  1012. {
  1013. var list = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>(a => a.IsPay != true && a.IsReport == true).ToList();
  1014. foreach (var item in list)
  1015. {
  1016. item.IsSubsidize1 = true;
  1017. item.Status = 3;
  1018. this.BaseRepository("CollegeMIS").Update(item);
  1019. StuEnrollAmountRecordEntity amountRecordEntity = new StuEnrollAmountRecordEntity();
  1020. amountRecordEntity.Create();
  1021. amountRecordEntity.Content = "确认资助";
  1022. amountRecordEntity.StuID = item.StuId;
  1023. this.BaseRepository("CollegeMIS").Insert(amountRecordEntity);
  1024. }
  1025. }
  1026. catch (Exception ex)
  1027. {
  1028. if (ex is ExceptionEx)
  1029. {
  1030. throw;
  1031. }
  1032. else
  1033. {
  1034. throw ExceptionEx.ThrowServiceException(ex);
  1035. }
  1036. }
  1037. }
  1038. internal (bool, string) Military(string stuId, bool status, bool payAfter)
  1039. {
  1040. try
  1041. {
  1042. var roleid = this.BaseRepository().FindEntity<RoleEntity>(a => a.F_FullName == "学生科科长")?.F_RoleId;
  1043. var loginUser = LoginUserInfo.Get();
  1044. var resultbool = false;
  1045. var result = "";
  1046. if (!string.IsNullOrEmpty(stuId))
  1047. {
  1048. var data = JsonConvert.DeserializeObject<List<StuEnrollEntity>>(stuId);
  1049. if (data.Any())
  1050. {
  1051. foreach (var item in data)
  1052. {
  1053. if (payAfter)
  1054. {
  1055. //if (loginUser.roleIds.Contains(roleid))
  1056. //{
  1057. item.IsMilitary2 = status;
  1058. this.BaseRepository("CollegeMis").Update(item);
  1059. //}
  1060. }
  1061. else
  1062. {
  1063. item.IsMilitary = status;
  1064. item.IsMilitary2 = status;
  1065. item.Status = 4;
  1066. if (!status)
  1067. {
  1068. item.IsTakeCloths = false;
  1069. }
  1070. this.BaseRepository("CollegeMis").Update(item);
  1071. }
  1072. StuEnrollAmountRecordEntity amountRecordEntity = new StuEnrollAmountRecordEntity();
  1073. amountRecordEntity.Create();
  1074. if (status)
  1075. {
  1076. amountRecordEntity.Content = "确认军训";
  1077. }
  1078. else
  1079. {
  1080. amountRecordEntity.Content = "取消军训";
  1081. }
  1082. amountRecordEntity.StuID = item.StuId;
  1083. this.BaseRepository("CollegeMIS").Insert(amountRecordEntity);
  1084. }
  1085. resultbool = true;
  1086. result = "操作成功";
  1087. }
  1088. }
  1089. else
  1090. {
  1091. result = "错误";
  1092. }
  1093. return (resultbool, result);
  1094. }
  1095. catch (Exception ex)
  1096. {
  1097. if (ex is ExceptionEx)
  1098. {
  1099. throw;
  1100. }
  1101. else
  1102. {
  1103. throw ExceptionEx.ThrowServiceException(ex);
  1104. }
  1105. }
  1106. }
  1107. internal void AllReport()
  1108. {
  1109. try
  1110. {
  1111. var list = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  1112. foreach (var item in list)
  1113. {
  1114. item.IsReport = true;
  1115. item.SecurityAgreement = true;
  1116. item.Status = 1;
  1117. this.BaseRepository("CollegeMIS").Update(item);
  1118. }
  1119. }
  1120. catch (Exception ex)
  1121. {
  1122. if (ex is ExceptionEx)
  1123. {
  1124. throw;
  1125. }
  1126. else
  1127. {
  1128. throw ExceptionEx.ThrowServiceException(ex);
  1129. }
  1130. }
  1131. }
  1132. internal void AllPhoto()
  1133. {
  1134. try
  1135. {
  1136. var list = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  1137. foreach (var item in list)
  1138. {
  1139. item.IsMug = true;
  1140. item.Status = 6;
  1141. this.BaseRepository("CollegeMIS").Update(item);
  1142. }
  1143. }
  1144. catch (Exception ex)
  1145. {
  1146. if (ex is ExceptionEx)
  1147. {
  1148. throw;
  1149. }
  1150. else
  1151. {
  1152. throw ExceptionEx.ThrowServiceException(ex);
  1153. }
  1154. }
  1155. }
  1156. internal void AllGetCloth()
  1157. {
  1158. try
  1159. {
  1160. var list = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  1161. foreach (var item in list)
  1162. {
  1163. item.IsTakeCloths = true;
  1164. item.Status = 7;
  1165. this.BaseRepository("CollegeMIS").Update(item);
  1166. }
  1167. }
  1168. catch (Exception ex)
  1169. {
  1170. if (ex is ExceptionEx)
  1171. {
  1172. throw;
  1173. }
  1174. else
  1175. {
  1176. throw ExceptionEx.ThrowServiceException(ex);
  1177. }
  1178. }
  1179. }
  1180. internal void AllGetSize()
  1181. {
  1182. try
  1183. {
  1184. var list = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  1185. foreach (var item in list)
  1186. {
  1187. item.IsQuantity = true;
  1188. item.Status = 8;
  1189. this.BaseRepository("CollegeMIS").Update(item);
  1190. }
  1191. }
  1192. catch (Exception ex)
  1193. {
  1194. if (ex is ExceptionEx)
  1195. {
  1196. throw;
  1197. }
  1198. else
  1199. {
  1200. throw ExceptionEx.ThrowServiceException(ex);
  1201. }
  1202. }
  1203. }
  1204. internal void AllGetArticle()
  1205. {
  1206. try
  1207. {
  1208. var list = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  1209. foreach (var item in list)
  1210. {
  1211. item.IsGetBeddingArticle = true;
  1212. item.Status = 9;
  1213. this.BaseRepository("CollegeMIS").Update(item);
  1214. }
  1215. }
  1216. catch (Exception ex)
  1217. {
  1218. if (ex is ExceptionEx)
  1219. {
  1220. throw;
  1221. }
  1222. else
  1223. {
  1224. throw ExceptionEx.ThrowServiceException(ex);
  1225. }
  1226. }
  1227. }
  1228. internal void AllMilitary()
  1229. {
  1230. try
  1231. {
  1232. var list = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>(a => a.IsPay != true && a.IsReport == true).ToList();
  1233. foreach (var item in list)
  1234. {
  1235. item.IsMilitary = true;
  1236. item.Status = 4;
  1237. this.BaseRepository("CollegeMIS").Update(item);
  1238. StuEnrollAmountRecordEntity amountRecordEntity = new StuEnrollAmountRecordEntity();
  1239. amountRecordEntity.Create();
  1240. amountRecordEntity.Content = "确认军训";
  1241. amountRecordEntity.StuID = item.StuId;
  1242. this.BaseRepository("CollegeMIS").Insert(amountRecordEntity);
  1243. }
  1244. }
  1245. catch (Exception ex)
  1246. {
  1247. if (ex is ExceptionEx)
  1248. {
  1249. throw;
  1250. }
  1251. else
  1252. {
  1253. throw ExceptionEx.ThrowServiceException(ex);
  1254. }
  1255. }
  1256. }
  1257. internal (bool, string) IsPay(string stuId, bool status)
  1258. {
  1259. try
  1260. {
  1261. var resultbool = false;
  1262. var result = "";
  1263. if (!string.IsNullOrEmpty(stuId))
  1264. {
  1265. var data = JsonConvert.DeserializeObject<List<StuEnrollEntity>>(stuId);
  1266. if (data.Any())
  1267. {
  1268. foreach (var item in data)
  1269. {
  1270. item.IsPay = status;
  1271. item.Status = 5;
  1272. this.BaseRepository("CollegeMis").Update(item);
  1273. }
  1274. resultbool = true;
  1275. result = "操作成功";
  1276. }
  1277. }
  1278. else
  1279. {
  1280. result = "错误";
  1281. }
  1282. return (resultbool, result);
  1283. }
  1284. catch (Exception ex)
  1285. {
  1286. if (ex is ExceptionEx)
  1287. {
  1288. throw;
  1289. }
  1290. else
  1291. {
  1292. throw ExceptionEx.ThrowServiceException(ex);
  1293. }
  1294. }
  1295. }
  1296. /// <summary>
  1297. /// 缴费金额统计
  1298. /// </summary>
  1299. /// <returns></returns>
  1300. internal object GetPaymentInfo()
  1301. {
  1302. try
  1303. {
  1304. var model = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  1305. var listAllamount = model.Where(a => a.PayAmount != null && a.IsCheckIn != null && a.IsSubsidize1 != null).Select(a => a.PayAmount);
  1306. decimal allamount = 0;
  1307. foreach (var item in listAllamount)
  1308. {
  1309. if (item != null)
  1310. {
  1311. allamount += Convert.ToDecimal(item);
  1312. }
  1313. }
  1314. var listIsamount = model.Where(a => a.IsPay == true).Select(a => a.PayAmount);
  1315. decimal isamount = 0;
  1316. foreach (var item in listIsamount)
  1317. {
  1318. if (item != null)
  1319. {
  1320. isamount += Convert.ToDecimal(item);
  1321. }
  1322. }
  1323. return new
  1324. {
  1325. a = allamount,
  1326. b = isamount
  1327. };
  1328. }
  1329. catch (Exception ex)
  1330. {
  1331. if (ex is ExceptionEx)
  1332. {
  1333. throw;
  1334. }
  1335. else
  1336. {
  1337. throw ExceptionEx.ThrowServiceException(ex);
  1338. }
  1339. }
  1340. }
  1341. internal object GetStuDefaultInfo(string StuId)
  1342. {
  1343. try
  1344. {
  1345. var model = this.BaseRepository("CollegeMIS").FindEntity<StuEnrollEntity>(a => a.StuId == StuId);
  1346. var imgUrl = "";
  1347. if (model?.Photo != null)
  1348. {
  1349. imgUrl = this.BaseRepository().FindEntity<AnnexesFileEntity>(a => a.F_Id == model.Photo)?.F_FilePath;
  1350. if (!string.IsNullOrEmpty(imgUrl))
  1351. {
  1352. imgUrl = "/" + imgUrl.Substring(imgUrl.IndexOf("Resource"));
  1353. }
  1354. }
  1355. return new
  1356. {
  1357. stuName = model.StuName + (model.IsCheckIn == false ? "(走)" : ""),
  1358. className = this.BaseRepository("CollegeMIS")
  1359. .FindEntity<ClassInfoEntity>(a => a.ClassNo == model.ClassNo)?.ClassName,
  1360. imgUrl
  1361. };
  1362. }
  1363. catch (Exception ex)
  1364. {
  1365. if (ex is ExceptionEx)
  1366. {
  1367. throw;
  1368. }
  1369. else
  1370. {
  1371. throw ExceptionEx.ThrowServiceException(ex);
  1372. }
  1373. }
  1374. }
  1375. internal (bool, string) IsPhoto(string stuId, bool status, string fileGuid)
  1376. {
  1377. try
  1378. {
  1379. string result = "";
  1380. bool resultBool = false;
  1381. var model = this.BaseRepository("CollegeMIS").FindEntity<StuEnrollEntity>(a => a.StuId == stuId);
  1382. if (model != null)
  1383. {
  1384. model.Photo = fileGuid;
  1385. model.IsMug = status;
  1386. model.Status = 6;//确认拍照
  1387. resultBool = true;
  1388. result = "操作成功!";
  1389. this.BaseRepository("CollegeMIS").Update(model);
  1390. }
  1391. else
  1392. {
  1393. result = "错误";
  1394. }
  1395. return (resultBool, result);
  1396. }
  1397. catch (Exception ex)
  1398. {
  1399. if (ex is ExceptionEx)
  1400. {
  1401. throw;
  1402. }
  1403. else
  1404. {
  1405. throw ExceptionEx.ThrowServiceException(ex);
  1406. }
  1407. }
  1408. }
  1409. internal (bool, string) GetCloth(string stuId, bool status)
  1410. {
  1411. try
  1412. {
  1413. bool resultBool = false;
  1414. var result = "";
  1415. if (!string.IsNullOrEmpty(stuId))
  1416. {
  1417. var data = JsonConvert.DeserializeObject<List<StuEnrollEntity>>(stuId);
  1418. if (data.Any())
  1419. {
  1420. foreach (var item in data)
  1421. {
  1422. item.IsTakeCloths = status;
  1423. item.Status = 7;
  1424. this.BaseRepository("CollegeMis").Update(item);
  1425. }
  1426. resultBool = true;
  1427. result = "操作成功";
  1428. }
  1429. }
  1430. else
  1431. {
  1432. result = "错误";
  1433. }
  1434. return (resultBool, result);
  1435. }
  1436. catch (Exception ex)
  1437. {
  1438. if (ex is ExceptionEx)
  1439. {
  1440. throw;
  1441. }
  1442. else
  1443. {
  1444. throw ExceptionEx.ThrowServiceException(ex);
  1445. }
  1446. }
  1447. }
  1448. internal (bool, string) GetClothSize(string stuId, bool status)
  1449. {
  1450. try
  1451. {
  1452. bool resultBool = false;
  1453. var result = "";
  1454. if (!string.IsNullOrEmpty(stuId))
  1455. {
  1456. var data = JsonConvert.DeserializeObject<List<StuEnrollEntity>>(stuId);
  1457. if (data.Any())
  1458. {
  1459. foreach (var item in data)
  1460. {
  1461. item.IsQuantity = status;
  1462. item.Status = 8;
  1463. this.BaseRepository("CollegeMis").Update(item);
  1464. }
  1465. resultBool = true;
  1466. result = "操作成功";
  1467. }
  1468. }
  1469. else
  1470. {
  1471. result = "错误";
  1472. }
  1473. return (resultBool, result);
  1474. }
  1475. catch (Exception ex)
  1476. {
  1477. if (ex is ExceptionEx)
  1478. {
  1479. throw;
  1480. }
  1481. else
  1482. {
  1483. throw ExceptionEx.ThrowServiceException(ex);
  1484. }
  1485. }
  1486. }
  1487. internal (bool, string) GetArticles(string stuId, bool status)
  1488. {
  1489. try
  1490. {
  1491. bool resultBool = false;
  1492. var result = "";
  1493. if (!string.IsNullOrEmpty(stuId))
  1494. {
  1495. var data = JsonConvert.DeserializeObject<List<StuEnrollEntity>>(stuId);
  1496. if (data.Any())
  1497. {
  1498. foreach (var item in data)
  1499. {
  1500. item.IsGetBeddingArticle = status;
  1501. item.Status = 9;
  1502. this.BaseRepository("CollegeMis").Update(item);
  1503. }
  1504. resultBool = true;
  1505. result = "操作成功";
  1506. }
  1507. }
  1508. else
  1509. {
  1510. result = "错误";
  1511. }
  1512. return (resultBool, result);
  1513. }
  1514. catch (Exception ex)
  1515. {
  1516. if (ex is ExceptionEx)
  1517. {
  1518. throw;
  1519. }
  1520. else
  1521. {
  1522. throw ExceptionEx.ThrowServiceException(ex);
  1523. }
  1524. }
  1525. }
  1526. /// <summary>
  1527. /// 生成缴费金额
  1528. /// </summary>
  1529. internal void GetMoney()
  1530. {
  1531. try
  1532. {
  1533. var stuList = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  1534. foreach (var stuEnroll in stuList)
  1535. {
  1536. var classInfo = this.BaseRepository("CollegeMIS").FindEntity<ClassInfoEntity>(a => a.ClassNo == stuEnroll.ClassNo);
  1537. var yearAndSemester = Common.GetSemesterAndYear();
  1538. var result = new List<StuPayInfo>();
  1539. if (classInfo != null)
  1540. {
  1541. result = this.BaseRepository("CollegeMIS").FindList<FinaChargesStandardEntity>(a => a.Grade == classInfo.Grade && a.MajorNo == stuEnroll.MajorNo && a.AcademicYearNo == yearAndSemester.AcademicYearShort && a.Semester == yearAndSemester.Semester)
  1542. .Select(a => new StuPayInfo
  1543. {
  1544. standerid = a.ChargeItemID,
  1545. shouldPay = a.Standard,
  1546. standard = a.Standard,
  1547. standerdName = this.BaseRepository("CollegeMIS").FindEntity<FinaChargeItemEntity>(b => b.ChargeItemID == a.ChargeItemID).ChargeItemName.Trim()
  1548. }).ToList();
  1549. }
  1550. foreach (var item in result)
  1551. {
  1552. //住宿费
  1553. if (item.standerid == 12 && stuEnroll.IsCheckIn == false)
  1554. {
  1555. item.shouldPay = 0;
  1556. }
  1557. //学费
  1558. if (item.standerid == 14 && stuEnroll.IsSubsidize1 == true)
  1559. {
  1560. item.shouldPay = 0;
  1561. }
  1562. switch (item.standerid)
  1563. {
  1564. case 12:
  1565. if (stuEnroll.IsCheckIn == false) item.shouldPay = 0;
  1566. break;
  1567. case 14:
  1568. if (stuEnroll.IsSubsidize1 == true) item.shouldPay = 0;
  1569. break;
  1570. case 15:
  1571. if (stuEnroll.IsMilitary == false) item.shouldPay = 0;
  1572. break;
  1573. case 32:
  1574. if (stuEnroll.IsCheckIn == false) item.shouldPay = 0;
  1575. break;
  1576. case 33:
  1577. if (stuEnroll.EnrollType == "0") item.shouldPay = 0;
  1578. break;
  1579. default:
  1580. break;
  1581. }
  1582. }
  1583. decimal money = 0;
  1584. //记录缴费金额
  1585. foreach (var item in result)
  1586. {
  1587. money += Convert.ToDecimal(item.shouldPay);
  1588. }
  1589. stuEnroll.PayAmount = money;
  1590. this.BaseRepository("CollegeMIS").Update(stuEnroll);
  1591. }
  1592. }
  1593. catch (Exception ex)
  1594. {
  1595. if (ex is ExceptionEx)
  1596. {
  1597. throw;
  1598. }
  1599. else
  1600. {
  1601. throw ExceptionEx.ThrowServiceException(ex);
  1602. }
  1603. }
  1604. }
  1605. internal void AllocationDormitory(string dormitoryNo, string stuId, string dormitoryName)
  1606. {
  1607. try
  1608. {
  1609. var oldstuEnroll = this.BaseRepository("CollegeMIS").FindEntity<StuEnrollEntity>(a => a.DormitoryNo == dormitoryNo);
  1610. if (oldstuEnroll != null)
  1611. {
  1612. oldstuEnroll.DormitoryNo = "";
  1613. oldstuEnroll.DormitoryName = "";
  1614. this.BaseRepository("CollegeMIS").Update(oldstuEnroll);
  1615. }
  1616. var olddormitory = this.BaseRepository("CollegeMIS").FindEntity<Acc_DormitoryBuildEntity>(a => a.PlanStudentID == stuId);
  1617. if (olddormitory != null)
  1618. {
  1619. olddormitory.PlanStudentID = "";
  1620. this.BaseRepository("CollegeMIS").Update(olddormitory);
  1621. }
  1622. var dormitory = this.BaseRepository("CollegeMIS").FindEntity<Acc_DormitoryBuildEntity>(a => a.ID == dormitoryNo);
  1623. dormitory.PlanStudentID = stuId;
  1624. this.BaseRepository("CollegeMIS").Update(dormitory);
  1625. var stuEroll = this.BaseRepository("CollegeMIS").FindEntity<StuEnrollEntity>(a => a.StuId == stuId);
  1626. stuEroll.DormitoryNo = dormitoryNo;
  1627. stuEroll.DormitoryName = dormitoryName;
  1628. this.BaseRepository("CollegeMIS").Update(stuEroll);
  1629. }
  1630. catch (Exception ex)
  1631. {
  1632. if (ex is ExceptionEx)
  1633. {
  1634. throw;
  1635. }
  1636. else
  1637. {
  1638. throw ExceptionEx.ThrowServiceException(ex);
  1639. }
  1640. }
  1641. }
  1642. internal void AllocationClass(string classNo, string dataJson)
  1643. {
  1644. try
  1645. {
  1646. var data = JsonConvert.DeserializeObject<List<StuEnrollEntity>>(dataJson);
  1647. if (data.Any())
  1648. {
  1649. foreach (var item in data)
  1650. {
  1651. item.ClassNo = classNo;
  1652. this.BaseRepository("CollegeMis").Update(item);
  1653. }
  1654. }
  1655. }
  1656. catch (Exception ex)
  1657. {
  1658. if (ex is ExceptionEx)
  1659. {
  1660. throw;
  1661. }
  1662. else
  1663. {
  1664. throw ExceptionEx.ThrowServiceException(ex);
  1665. }
  1666. }
  1667. }
  1668. /// <summary>
  1669. /// 关联照片
  1670. /// </summary>
  1671. internal void RelationPhoto()
  1672. {
  1673. try
  1674. {
  1675. var stuList = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  1676. foreach (var stuEnrollEntity in stuList)
  1677. {
  1678. if (string.IsNullOrEmpty(stuEnrollEntity.Photo))
  1679. {
  1680. stuEnrollEntity.Photo = Guid.NewGuid().ToString();
  1681. AnnexesFileEntity entity = new AnnexesFileEntity
  1682. {
  1683. F_Id = stuEnrollEntity.Photo,
  1684. F_FolderId = stuEnrollEntity.Photo,
  1685. F_FileName = stuEnrollEntity.Photo + ".jpg",
  1686. F_FilePath = $"D:/智慧校园系统/Publish1/Resource/StudentPhotos/{stuEnrollEntity.IDCard}.jpg",
  1687. F_FileExtensions = ".jpg",
  1688. F_FileType = "jpg",
  1689. };
  1690. entity.Create();
  1691. this.BaseRepository("CollegeMIS").Update(stuEnrollEntity);
  1692. this.BaseRepository().Insert(entity);
  1693. }
  1694. else
  1695. {
  1696. var annexes = this.BaseRepository().FindEntity<AnnexesFileEntity>(a => a.F_FolderId == stuEnrollEntity.Photo);
  1697. if (annexes != null)
  1698. {
  1699. if (!string.IsNullOrEmpty(stuEnrollEntity.IDCard))
  1700. {
  1701. annexes.F_FilePath = $"D:/智慧校园系统/Publish1/Resource/StudentPhotos/{stuEnrollEntity.IDCard}.jpg";
  1702. this.BaseRepository().Update(annexes);
  1703. }
  1704. }
  1705. else
  1706. {
  1707. AnnexesFileEntity entity = new AnnexesFileEntity
  1708. {
  1709. F_Id = stuEnrollEntity.Photo,
  1710. F_FolderId = stuEnrollEntity.Photo,
  1711. F_FileName = stuEnrollEntity.Photo + ".jpg",
  1712. F_FilePath = $"D:/智慧校园系统/Publish1/Resource/StudentPhotos/{stuEnrollEntity.IDCard}.jpg",
  1713. F_FileExtensions = ".jpg",
  1714. F_FileType = "jpg",
  1715. };
  1716. entity.Create();
  1717. this.BaseRepository().Insert(entity);
  1718. }
  1719. }
  1720. }
  1721. }
  1722. catch (Exception ex)
  1723. {
  1724. if (ex is ExceptionEx)
  1725. {
  1726. throw;
  1727. }
  1728. else
  1729. {
  1730. throw ExceptionEx.ThrowServiceException(ex);
  1731. }
  1732. }
  1733. }
  1734. internal void NewAllocationDormitory(string classNo, string dataJson)
  1735. {
  1736. try
  1737. {
  1738. var data = JsonConvert.DeserializeObject<List<Acc_DormitoryBuildEntity>>(dataJson);
  1739. if (data.Any())
  1740. {
  1741. foreach (var item in data)
  1742. {
  1743. item.PlanClassNo = classNo;
  1744. this.BaseRepository("CollegeMIS").Update(item);
  1745. }
  1746. }
  1747. }
  1748. catch (Exception ex)
  1749. {
  1750. if (ex is ExceptionEx)
  1751. {
  1752. throw;
  1753. }
  1754. else
  1755. {
  1756. throw ExceptionEx.ThrowServiceException(ex);
  1757. }
  1758. }
  1759. }
  1760. internal void Synchronization()
  1761. {
  1762. try
  1763. {
  1764. var ListNewStudent =
  1765. this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>(a => a.IsReport == true);
  1766. foreach (var newStudent in ListNewStudent)
  1767. {
  1768. var stuEntity = new StuInfoBasicEntity
  1769. {
  1770. StuNo = newStudent.StuNo,
  1771. Birthday = newStudent.Birthday,
  1772. ClassNo = newStudent.ClassNo,
  1773. DeptNo = newStudent.DeptNo,
  1774. MajorNo = newStudent.MajorNo,
  1775. MajorDetailName = newStudent.MajorName,
  1776. IdentityCardNo = newStudent.IDCard,
  1777. Grade = newStudent.ClassNo.Substring(2, 2),
  1778. StuName = newStudent.StuName,
  1779. Photo = newStudent.Photo,
  1780. FatherUnit = newStudent.ResidenceAddress,
  1781. MailAddress = newStudent.HomeAddress,
  1782. PartyFaceNo = newStudent.Political,
  1783. NationalityNo = newStudent.Nationals,
  1784. GenderNo = newStudent.Gender
  1785. };
  1786. stuEntity.Create();
  1787. this.BaseRepository("CollegeMIS").Insert(stuEntity);
  1788. }
  1789. }
  1790. catch (Exception ex)
  1791. {
  1792. if (ex is ExceptionEx)
  1793. {
  1794. throw;
  1795. }
  1796. else
  1797. {
  1798. throw ExceptionEx.ThrowServiceException(ex);
  1799. }
  1800. }
  1801. }
  1802. /// <summary>
  1803. /// 获取StuEnroll表实体数据
  1804. /// <param name="keyValue">主键</param>
  1805. /// <summary>
  1806. /// <returns></returns>
  1807. public StuEnrollEntity GetStuEnrollEntity(string keyValue)
  1808. {
  1809. try
  1810. {
  1811. var entity = this.BaseRepository("CollegeMIS").FindEntity<StuEnrollEntity>(keyValue);
  1812. if (!string.IsNullOrEmpty(entity.Photo))
  1813. {
  1814. var path = this.BaseRepository().FindEntity<AnnexesFileEntity>(a => a.F_Id == entity.Photo)?.F_FilePath;
  1815. if (!string.IsNullOrEmpty(path))
  1816. {
  1817. path = "/" + path.Substring(path.IndexOf("Resource"));
  1818. entity.PhotoUrl = path;
  1819. }
  1820. }
  1821. return entity;
  1822. }
  1823. catch (Exception ex)
  1824. {
  1825. if (ex is ExceptionEx)
  1826. {
  1827. throw;
  1828. }
  1829. else
  1830. {
  1831. throw ExceptionEx.ThrowServiceException(ex);
  1832. }
  1833. }
  1834. }
  1835. #endregion 获取数据
  1836. #region 提交数据
  1837. /// <summary>
  1838. /// 删除实体数据
  1839. /// <param name="keyValue">主键</param>
  1840. /// <summary>
  1841. /// <returns></returns>
  1842. public void DeleteEntity(string keyValue)
  1843. {
  1844. try
  1845. {
  1846. var listId = keyValue.Split(',').ToList();
  1847. foreach (var stuId in listId)
  1848. {
  1849. this.BaseRepository("CollegeMIS").Delete<StuEnrollEntity>(t => t.StuId == stuId);
  1850. }
  1851. }
  1852. catch (Exception ex)
  1853. {
  1854. if (ex is ExceptionEx)
  1855. {
  1856. throw;
  1857. }
  1858. else
  1859. {
  1860. throw ExceptionEx.ThrowServiceException(ex);
  1861. }
  1862. }
  1863. }
  1864. /// <summary>
  1865. /// 保存实体数据(新增、修改)
  1866. /// <param name="keyValue">主键</param>
  1867. /// <summary>
  1868. /// <returns></returns>
  1869. public void SaveEntity(string keyValue, StuEnrollEntity entity)
  1870. {
  1871. try
  1872. {
  1873. if (!string.IsNullOrEmpty(keyValue))
  1874. {
  1875. entity.Modify(keyValue);
  1876. this.BaseRepository("CollegeMIS").Update(entity);
  1877. }
  1878. else
  1879. {
  1880. entity.Create();
  1881. entity.IsMilitary = true;
  1882. this.BaseRepository("CollegeMIS").Insert(entity);
  1883. }
  1884. }
  1885. catch (Exception ex)
  1886. {
  1887. if (ex is ExceptionEx)
  1888. {
  1889. throw;
  1890. }
  1891. else
  1892. {
  1893. throw ExceptionEx.ThrowServiceException(ex);
  1894. }
  1895. }
  1896. }
  1897. public void EditEnrollType(string stuIds, string enrollType)
  1898. {
  1899. try
  1900. {
  1901. List<string> list = stuIds.Split(',').ToList();
  1902. if (list.Count > 0)
  1903. {
  1904. foreach (var item in list)
  1905. {
  1906. if (!string.IsNullOrEmpty(item))
  1907. {
  1908. var model = this.BaseRepository("CollegeMIS").FindEntity<StuEnrollEntity>(a => a.StuId == item);
  1909. if (model != null)
  1910. {
  1911. model.EnrollType = enrollType;
  1912. this.BaseRepository("CollegeMIS").Update(model);
  1913. }
  1914. }
  1915. }
  1916. }
  1917. }
  1918. catch (Exception ex)
  1919. {
  1920. if (ex is ExceptionEx)
  1921. {
  1922. throw;
  1923. }
  1924. else
  1925. {
  1926. throw ExceptionEx.ThrowServiceException(ex);
  1927. }
  1928. }
  1929. }
  1930. public void SyncDept()
  1931. {
  1932. try
  1933. {
  1934. var data = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  1935. var majorList = this.BaseRepository("CollegeMIS").FindList<CdMajorEntity>().ToList();
  1936. foreach (var item in data)
  1937. {
  1938. var deptNo = majorList.FirstOrDefault(a => a.MajorNo == item.MajorNo)?.DeptNo;
  1939. item.DeptNo = deptNo;
  1940. this.BaseRepository("CollegeMIS").Update(item);
  1941. }
  1942. }
  1943. catch (Exception ex)
  1944. {
  1945. if (ex is ExceptionEx)
  1946. {
  1947. throw;
  1948. }
  1949. else
  1950. {
  1951. throw ExceptionEx.ThrowServiceException(ex);
  1952. }
  1953. }
  1954. }
  1955. public void SyncMajor()
  1956. {
  1957. try
  1958. {
  1959. var data = this.BaseRepository("CollegeMIS").FindList<StuEnrollEntity>().ToList();
  1960. var classList = this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>().ToList();
  1961. foreach (var item in data)
  1962. {
  1963. var majorNo = classList.FirstOrDefault(a => a.ClassNo == item.ClassNo)?.MajorNo;
  1964. item.MajorNo = majorNo;
  1965. this.BaseRepository("CollegeMIS").Update(item);
  1966. }
  1967. }
  1968. catch (Exception ex)
  1969. {
  1970. if (ex is ExceptionEx)
  1971. {
  1972. throw;
  1973. }
  1974. else
  1975. {
  1976. throw ExceptionEx.ThrowServiceException(ex);
  1977. }
  1978. }
  1979. }
  1980. /// <summary>
  1981. /// 签订安全自律协议
  1982. /// </summary>
  1983. /// <param name="stuId"></param>
  1984. /// <param name="status"></param>
  1985. /// <returns></returns>
  1986. public (bool, string) Sign(string stuId, bool status)
  1987. {
  1988. try
  1989. {
  1990. var resultbool = false;
  1991. var result = "";
  1992. if (!string.IsNullOrEmpty(stuId))
  1993. {
  1994. var data = JsonConvert.DeserializeObject<List<StuEnrollEntity>>(stuId);
  1995. if (data.Any())
  1996. {
  1997. foreach (var item in data)
  1998. {
  1999. item.SecurityAgreement = status;
  2000. this.BaseRepository("CollegeMis").Update(item);
  2001. }
  2002. resultbool = true;
  2003. result = "操作成功";
  2004. }
  2005. }
  2006. else
  2007. {
  2008. result = "错误";
  2009. }
  2010. return (resultbool, result);
  2011. }
  2012. catch (Exception ex)
  2013. {
  2014. if (ex is ExceptionEx)
  2015. {
  2016. throw;
  2017. }
  2018. else
  2019. {
  2020. throw ExceptionEx.ThrowServiceException(ex);
  2021. }
  2022. }
  2023. }
  2024. /// <summary>
  2025. /// 报到
  2026. /// </summary>
  2027. /// <param name="stuId"></param>
  2028. /// <param name="status"></param>
  2029. /// <returns></returns>
  2030. public (bool, string) Report(string stuId, bool status)
  2031. {
  2032. try
  2033. {
  2034. var resultbool = false;
  2035. var result = "";
  2036. if (!string.IsNullOrEmpty(stuId))
  2037. {
  2038. var data = JsonConvert.DeserializeObject<List<StuEnrollEntity>>(stuId);
  2039. if (data.Any())
  2040. {
  2041. foreach (var item in data)
  2042. {
  2043. item.IsReport = status;
  2044. item.Status = 1;
  2045. item.SecurityAgreement = status;
  2046. this.BaseRepository("CollegeMis").Update(item);
  2047. }
  2048. resultbool = true;
  2049. result = "操作成功";
  2050. }
  2051. }
  2052. else
  2053. {
  2054. result = "错误";
  2055. }
  2056. return (resultbool, result);
  2057. }
  2058. catch (Exception ex)
  2059. {
  2060. if (ex is ExceptionEx)
  2061. {
  2062. throw;
  2063. }
  2064. else
  2065. {
  2066. throw ExceptionEx.ThrowServiceException(ex);
  2067. }
  2068. }
  2069. }
  2070. #endregion 提交数据
  2071. }
  2072. }