StudentManagerServiceImpl.java 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  1. package com.xjrsoft.module.student.service.impl;
  2. import cn.dev33.satoken.secure.BCrypt;
  3. import cn.dev33.satoken.stp.StpUtil;
  4. import cn.hutool.core.bean.BeanUtil;
  5. import cn.hutool.core.collection.CollectionUtil;
  6. import cn.hutool.core.convert.Convert;
  7. import cn.hutool.core.util.IdUtil;
  8. import cn.hutool.core.util.StrUtil;
  9. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  10. import com.baomidou.mybatisplus.core.toolkit.StringPool;
  11. import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  12. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  13. import com.github.yulichang.base.MPJBaseServiceImpl;
  14. import com.github.yulichang.wrapper.MPJLambdaWrapper;
  15. import com.xjrsoft.common.constant.GlobalConstant;
  16. import com.xjrsoft.common.enums.DeleteMark;
  17. import com.xjrsoft.common.enums.EnabledMark;
  18. import com.xjrsoft.common.enums.GenderDictionaryEnum;
  19. import com.xjrsoft.common.enums.RoleEnum;
  20. import com.xjrsoft.common.enums.YesOrNoEnum;
  21. import com.xjrsoft.common.exception.MyException;
  22. import com.xjrsoft.common.utils.RedisUtil;
  23. import com.xjrsoft.common.utils.TreeUtil;
  24. import com.xjrsoft.config.CommonPropertiesConfig;
  25. import com.xjrsoft.module.base.entity.BaseClass;
  26. import com.xjrsoft.module.base.entity.BaseGrade;
  27. import com.xjrsoft.module.base.entity.BaseMajorSet;
  28. import com.xjrsoft.module.base.mapper.BaseClassMapper;
  29. import com.xjrsoft.module.base.mapper.BaseGradeMapper;
  30. import com.xjrsoft.module.base.mapper.BaseMajorSetMapper;
  31. import com.xjrsoft.module.base.service.IBaseClassService;
  32. import com.xjrsoft.module.base.service.IBaseGradeService;
  33. import com.xjrsoft.module.organization.entity.Department;
  34. import com.xjrsoft.module.organization.entity.User;
  35. import com.xjrsoft.module.organization.entity.UserDeptRelation;
  36. import com.xjrsoft.module.organization.entity.UserRoleRelation;
  37. import com.xjrsoft.module.organization.mapper.UserDeptRelationMapper;
  38. import com.xjrsoft.module.organization.mapper.UserRoleRelationMapper;
  39. import com.xjrsoft.module.organization.service.IDepartmentService;
  40. import com.xjrsoft.module.organization.service.IUserDeptRelationService;
  41. import com.xjrsoft.module.organization.service.IUserService;
  42. import com.xjrsoft.module.student.dto.AddBaseStudentUserDto;
  43. import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
  44. import com.xjrsoft.module.student.dto.MajorGradeClassDto;
  45. import com.xjrsoft.module.student.dto.UpdateBaseStudentUserDto;
  46. import com.xjrsoft.module.student.entity.BaseClassMajorSet;
  47. import com.xjrsoft.module.student.entity.BaseMajor;
  48. import com.xjrsoft.module.student.entity.BaseStudent;
  49. import com.xjrsoft.module.student.entity.BaseStudentContact;
  50. import com.xjrsoft.module.student.entity.BaseStudentFamily;
  51. import com.xjrsoft.module.student.entity.BaseStudentFamilyMember;
  52. import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
  53. import com.xjrsoft.module.student.entity.BaseStudentSubsidize;
  54. import com.xjrsoft.module.student.entity.BaseStudentUser;
  55. import com.xjrsoft.module.student.entity.StudentChangeRecord;
  56. import com.xjrsoft.module.student.mapper.BaseStudentFamilyMapper;
  57. import com.xjrsoft.module.student.mapper.BaseStudentFamilyMemberMapper;
  58. import com.xjrsoft.module.student.mapper.BaseStudentMapper;
  59. import com.xjrsoft.module.student.mapper.BaseStudentUserMapper;
  60. import com.xjrsoft.module.student.service.IBaseMajorService;
  61. import com.xjrsoft.module.student.service.IBaseStudentContactService;
  62. import com.xjrsoft.module.student.service.IBaseStudentFamilyService;
  63. import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
  64. import com.xjrsoft.module.student.service.IBaseStudentService;
  65. import com.xjrsoft.module.student.service.IBaseStudentSubsidizeService;
  66. import com.xjrsoft.module.student.service.IStudentChangeRecordService;
  67. import com.xjrsoft.module.student.service.IStudentManagerService;
  68. import com.xjrsoft.module.student.vo.BaseClassMajorSetVo;
  69. import com.xjrsoft.module.student.vo.BaseDepMajorGradeClassStudenTreeVo;
  70. import com.xjrsoft.module.student.vo.BaseStudentClassVo;
  71. import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
  72. import com.xjrsoft.module.student.vo.PersonalPortraitPersonalInfoVo;
  73. import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
  74. import com.xjrsoft.module.system.entity.Area;
  75. import com.xjrsoft.module.system.entity.DictionaryDetail;
  76. import com.xjrsoft.module.system.entity.DictionaryItem;
  77. import com.xjrsoft.module.system.mapper.DictionarydetailMapper;
  78. import com.xjrsoft.module.system.mapper.DictionaryitemMapper;
  79. import com.xjrsoft.module.system.service.IAreaService;
  80. import com.xjrsoft.module.system.service.IDictionarydetailService;
  81. import lombok.AllArgsConstructor;
  82. import org.apache.commons.lang3.StringUtils;
  83. import org.springframework.beans.BeanUtils;
  84. import org.springframework.stereotype.Service;
  85. import org.springframework.transaction.annotation.Transactional;
  86. import org.springframework.web.multipart.MultipartFile;
  87. import java.io.IOException;
  88. import java.text.ParseException;
  89. import java.text.SimpleDateFormat;
  90. import java.time.LocalDate;
  91. import java.time.LocalDateTime;
  92. import java.time.format.DateTimeFormatter;
  93. import java.time.format.DateTimeParseException;
  94. import java.util.ArrayList;
  95. import java.util.Arrays;
  96. import java.util.Base64;
  97. import java.util.HashMap;
  98. import java.util.HashSet;
  99. import java.util.List;
  100. import java.util.Map;
  101. import java.util.Objects;
  102. import java.util.Set;
  103. import java.util.concurrent.CompletableFuture;
  104. import java.util.stream.Collectors;
  105. @Service
  106. @AllArgsConstructor
  107. public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUserMapper, BaseStudentUser> implements IStudentManagerService {
  108. private final com.xjrsoft.module.student.mapper.BaseStudentUserMapper studentbaseManagerBaseStudentUserMapper;
  109. private final IBaseStudentService baseStudentService;
  110. private final BaseClassMapper baseClassMapper;
  111. private final IBaseStudentContactService studentContactService;
  112. private final BaseStudentFamilyMapper familyMapper;
  113. private final BaseStudentFamilyMemberMapper familyMemberMapper;
  114. private final UserRoleRelationMapper userRoleRelationMapper;
  115. private final DictionarydetailMapper dictionarydetailMapper;
  116. private final IAreaService areaService;
  117. private final BaseGradeMapper baseGradeMapper;
  118. private final BaseMajorSetMapper baseMajorSetMapper;
  119. private final DictionaryitemMapper dictionaryitemMapper;
  120. private final IBaseStudentSchoolRollService schoolRollService;
  121. private final IBaseStudentSubsidizeService subsidizeService;
  122. private final IBaseStudentFamilyService familyService;
  123. private final BaseStudentMapper baseStudentMapper;
  124. private final IUserDeptRelationService userDeptRelationService;
  125. private final RedisUtil redisUtil;
  126. private final UserDeptRelationMapper userDeptRelationMapper;
  127. private final IUserService userService;
  128. private final CommonPropertiesConfig propertiesConfig;
  129. private final IDepartmentService baseDeparmentService;
  130. private final IBaseMajorService baseMajorService;
  131. private final IBaseClassService baseClassService;
  132. private final IBaseGradeService baseGradeService;
  133. private IDictionarydetailService dictionarydetailService;
  134. private final IStudentChangeRecordService recordService;
  135. @Override
  136. @Transactional(rollbackFor = Exception.class)
  137. public Long add(AddBaseStudentUserDto dto){
  138. BaseStudentUser baseStudentUser = BeanUtil.toBean(dto, BaseStudentUser.class);
  139. baseStudentUser.setCode(dto.getUserName());
  140. // 用户身份证后6位作为默认密码
  141. baseStudentUser.setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
  142. studentbaseManagerBaseStudentUserMapper.insert(baseStudentUser);
  143. for (BaseStudent baseStudent : baseStudentUser.getBaseStudentList()) {
  144. baseStudent.setUserId(baseStudentUser.getId());
  145. BaseStudentSchoolRoll baseStudentSchoolRoll=baseStudentUser.getBaseStudentSchoolRollList().get(0);
  146. if (!StrUtil.isNotBlank(baseStudentSchoolRoll.getArchivesStatus())) {
  147. baseStudent.setIsNormal(1);
  148. } else {
  149. DictionaryDetail dictionaryDetail = dictionarydetailService.getOne(Wrappers.<DictionaryDetail>query()
  150. .lambda()
  151. .eq(DictionaryDetail::getCode, baseStudentSchoolRoll.getArchivesStatus())
  152. .inSql(DictionaryDetail::getItemId,"SELECT id from xjr_dictionary_item where code='archives_status'"));
  153. if (dictionaryDetail != null) {
  154. if ("0".equals(dictionaryDetail.getExtendField1())) {
  155. baseStudent.setIsNormal(0);
  156. } else {
  157. baseStudent.setIsNormal(1);
  158. }
  159. }
  160. }
  161. baseStudentService.save(baseStudent);
  162. }
  163. for (BaseStudentContact baseStudentContact : baseStudentUser.getBaseStudentContactList()) {
  164. baseStudentContact.setUserId(baseStudentUser.getId());
  165. studentContactService.save(baseStudentContact);
  166. }
  167. for (BaseStudentFamily BaseStudentFamily : baseStudentUser.getBaseStudentFamilyList()) {
  168. BaseStudentFamily.setUserId(baseStudentUser.getId());
  169. familyMapper.insert(BaseStudentFamily);
  170. }
  171. for (BaseStudentFamilyMember BaseStudentFamilyMember : baseStudentUser.getBaseStudentFamilyMemberList()) {
  172. BaseStudentFamilyMember.setUserId(baseStudentUser.getId());
  173. familyMemberMapper.insert(BaseStudentFamilyMember);
  174. }
  175. for (BaseStudentSchoolRoll baseStudentSchoolRoll : baseStudentUser.getBaseStudentSchoolRollList()) {
  176. baseStudentSchoolRoll.setUserId(baseStudentUser.getId());
  177. schoolRollService.save(baseStudentSchoolRoll);
  178. }
  179. for (BaseStudentSubsidize baseStudentSubsidize : baseStudentUser.getBaseStudentSubsidizeList()) {
  180. baseStudentSubsidize.setUserId(baseStudentUser.getId());
  181. subsidizeService.save(baseStudentSubsidize);
  182. }
  183. List<UserDeptRelation> userDeptRelationList = new ArrayList<>();
  184. if (StrUtil.isNotBlank(dto.getDepartmentIds())) {
  185. String allDeptIdStr = StrUtil.join(StringPool.COMMA, dto.getDepartmentIds());
  186. List<Long> departmentIds = Arrays.stream(allDeptIdStr.split(StringPool.COMMA)).map(Convert::toLong).collect(Collectors.toList());
  187. if (CollectionUtil.isNotEmpty(departmentIds)) {
  188. for (Long deptId : departmentIds) {
  189. //将用户所选部门保存到关联表中
  190. UserDeptRelation userDeptRelation = new UserDeptRelation();
  191. userDeptRelation.setUserId(baseStudentUser.getId());
  192. userDeptRelation.setDeptId(deptId);
  193. userDeptRelationList.add(userDeptRelation);
  194. }
  195. }
  196. userDeptRelationService.saveBatch(userDeptRelationList);
  197. }
  198. // 添加角色
  199. UserRoleRelation userRoleRelation = new UserRoleRelation();
  200. userRoleRelation.setUserId(baseStudentUser.getId());
  201. userRoleRelation.setRoleId(RoleEnum.STUDENT.getCode());
  202. userRoleRelationMapper.insert(userRoleRelation);
  203. CompletableFuture.runAsync(() -> {
  204. List<User> list = userService.list();
  205. redisUtil.set(GlobalConstant.USER_CACHE_KEY, list);
  206. List<UserDeptRelation> deptRelationList = userDeptRelationMapper.selectList(Wrappers.lambdaQuery(UserDeptRelation.class));
  207. redisUtil.set(GlobalConstant.USER_DEPT_RELATION_CACHE_KEY, deptRelationList);
  208. List<UserRoleRelation> userRoleRelationList = userRoleRelationMapper.selectList(Wrappers.lambdaQuery(UserRoleRelation.class));
  209. redisUtil.set(GlobalConstant.USER_ROLE_RELATION_CACHE_KEY, userRoleRelationList);
  210. });
  211. return baseStudentUser.getId();
  212. }
  213. @Override
  214. @Transactional(rollbackFor = Exception.class)
  215. public Boolean update(UpdateBaseStudentUserDto dto){
  216. BaseStudentUser baseStudentUser = BeanUtil.toBean(dto, BaseStudentUser.class);
  217. baseStudentUser.setCode(dto.getUserName());
  218. studentbaseManagerBaseStudentUserMapper.updateById(baseStudentUser);
  219. //先删除再新增
  220. userDeptRelationService.remove(Wrappers.<UserDeptRelation>query().lambda().eq(UserDeptRelation::getUserId, baseStudentUser.getId()));
  221. List<UserDeptRelation> userDeptRelationList = new ArrayList<>();
  222. if (StrUtil.isNotBlank(dto.getDepartmentIds())) {
  223. String allDeptIdStr = StrUtil.join(StringPool.COMMA, dto.getDepartmentIds());
  224. List<Long> departmentIds = Arrays.stream(allDeptIdStr.split(StringPool.COMMA)).map(Convert::toLong).collect(Collectors.toList());
  225. if (CollectionUtil.isNotEmpty(departmentIds)) {
  226. for (Long deptId : departmentIds) {
  227. //将用户所选部门保存到关联表中
  228. UserDeptRelation userDeptRelation = new UserDeptRelation();
  229. userDeptRelation.setUserId(baseStudentUser.getId());
  230. userDeptRelation.setDeptId(deptId);
  231. userDeptRelationList.add(userDeptRelation);
  232. }
  233. }
  234. userDeptRelationService.saveBatch(userDeptRelationList);
  235. }
  236. //********************************* BaseStudent 增删改 开始 *******************************************/
  237. {
  238. // 查出所有子级的id
  239. List<BaseStudent> baseStudentList = baseStudentService.list(Wrappers.lambdaQuery(BaseStudent.class).eq(BaseStudent::getUserId, baseStudentUser.getId()).select(BaseStudent::getId));
  240. List<Long> baseStudentIds = baseStudentList.stream().map(BaseStudent::getId).collect(Collectors.toList());
  241. //原有子表单 没有被删除的主键
  242. List<Long> baseStudentOldIds = baseStudentUser.getBaseStudentList().stream().map(BaseStudent::getId).filter(Objects::nonNull).collect(Collectors.toList());
  243. //找到需要删除的id
  244. List<Long> baseStudentRemoveIds = baseStudentIds.stream().filter(item -> !baseStudentOldIds.contains(item)).collect(Collectors.toList());
  245. for (BaseStudent baseStudent : baseStudentUser.getBaseStudentList()) {
  246. BaseStudentSchoolRoll baseStudentSchoolRoll=baseStudentUser.getBaseStudentSchoolRollList().get(0);
  247. if (!StrUtil.isNotBlank(baseStudentSchoolRoll.getArchivesStatus())) {
  248. baseStudent.setIsNormal(1);
  249. } else {
  250. DictionaryDetail dictionaryDetail = dictionarydetailService.getOne(Wrappers.<DictionaryDetail>query()
  251. .lambda()
  252. .eq(DictionaryDetail::getCode, baseStudentSchoolRoll.getArchivesStatus())
  253. .inSql(DictionaryDetail::getItemId,"SELECT id from xjr_dictionary_item where code='archives_status'"));
  254. if (dictionaryDetail != null) {
  255. if ("0".equals(dictionaryDetail.getExtendField1())) {
  256. baseStudent.setIsNormal(0);
  257. } else {
  258. baseStudent.setIsNormal(1);
  259. }
  260. }
  261. }
  262. //如果不等于空则修改
  263. if (baseStudent.getId() != null) {
  264. baseStudentService.updateById(baseStudent);
  265. }
  266. //如果等于空 则新增
  267. else {
  268. //已经不存在的id 删除
  269. baseStudent.setUserId(baseStudentUser.getId());
  270. baseStudentService.save(baseStudent);
  271. }
  272. }
  273. //已经不存在的id 删除
  274. if (baseStudentRemoveIds.size() > 0) {
  275. baseStudentService.removeBatchByIds(baseStudentRemoveIds);
  276. }
  277. }
  278. //********************************* BaseStudent 增删改 结束 *******************************************/
  279. //********************************* BaseStudentContact 增删改 开始 *******************************************/
  280. {
  281. // 查出所有子级的id
  282. List<BaseStudentContact> baseStudentContactList = studentContactService.list(Wrappers.lambdaQuery(BaseStudentContact.class).eq(BaseStudentContact::getUserId, baseStudentUser.getId()).select(BaseStudentContact::getId));
  283. List<Long> baseStudentContactIds = baseStudentContactList.stream().map(BaseStudentContact::getId).collect(Collectors.toList());
  284. //原有子表单 没有被删除的主键
  285. List<Long> baseStudentContactOldIds = baseStudentUser.getBaseStudentContactList().stream().map(BaseStudentContact::getId).filter(Objects::nonNull).collect(Collectors.toList());
  286. //找到需要删除的id
  287. List<Long> baseStudentContactRemoveIds = baseStudentContactIds.stream().filter(item -> !baseStudentContactOldIds.contains(item)).collect(Collectors.toList());
  288. for (BaseStudentContact baseStudentContact : baseStudentUser.getBaseStudentContactList()) {
  289. //如果不等于空则修改
  290. if (baseStudentContact.getId() != null) {
  291. studentContactService.updateById(baseStudentContact);
  292. }
  293. //如果等于空 则新增
  294. else {
  295. //已经不存在的id 删除
  296. baseStudentContact.setUserId(baseStudentUser.getId());
  297. studentContactService.save(baseStudentContact);
  298. }
  299. }
  300. //已经不存在的id 删除
  301. if (baseStudentContactRemoveIds.size() > 0) {
  302. studentContactService.removeBatchByIds(baseStudentContactRemoveIds);
  303. }
  304. }
  305. //********************************* BaseStudentContact 增删改 结束 *******************************************/
  306. //********************************* BaseStudentFamily 增删改 开始 *******************************************/
  307. {
  308. // 查出所有子级的id
  309. List<BaseStudentFamily> BaseStudentFamilyList = familyMapper.selectList(Wrappers.lambdaQuery(BaseStudentFamily.class).eq(BaseStudentFamily::getUserId, baseStudentUser.getId()).select(BaseStudentFamily::getId));
  310. List<Long> BaseStudentFamilyIds = BaseStudentFamilyList.stream().map(BaseStudentFamily::getId).collect(Collectors.toList());
  311. //原有子表单 没有被删除的主键
  312. List<Long> BaseStudentFamilyOldIds = baseStudentUser.getBaseStudentFamilyList().stream().map(BaseStudentFamily::getId).filter(Objects::nonNull).collect(Collectors.toList());
  313. //找到需要删除的id
  314. List<Long> BaseStudentFamilyRemoveIds = BaseStudentFamilyIds.stream().filter(item -> !BaseStudentFamilyOldIds.contains(item)).collect(Collectors.toList());
  315. for (BaseStudentFamily BaseStudentFamily : baseStudentUser.getBaseStudentFamilyList()) {
  316. //如果不等于空则修改
  317. if (BaseStudentFamily.getId() != null) {
  318. familyMapper.updateById(BaseStudentFamily);
  319. }
  320. //如果等于空 则新增
  321. else {
  322. //已经不存在的id 删除
  323. BaseStudentFamily.setUserId(baseStudentUser.getId());
  324. familyMapper.insert(BaseStudentFamily);
  325. }
  326. }
  327. //已经不存在的id 删除
  328. if (BaseStudentFamilyRemoveIds.size() > 0) {
  329. familyMapper.deleteBatchIds(BaseStudentFamilyRemoveIds);
  330. }
  331. }
  332. //********************************* BaseStudentFamily 增删改 结束 *******************************************/
  333. //********************************* BaseStudentFamilyMember 增删改 开始 *******************************************/
  334. {
  335. // 查出所有子级的id
  336. List<BaseStudentFamilyMember> BaseStudentFamilyMemberList = familyMemberMapper.selectList(Wrappers.lambdaQuery(BaseStudentFamilyMember.class).eq(BaseStudentFamilyMember::getUserId, baseStudentUser.getId()).select(BaseStudentFamilyMember::getId));
  337. List<Long> BaseStudentFamilyMemberIds = BaseStudentFamilyMemberList.stream().map(BaseStudentFamilyMember::getId).collect(Collectors.toList());
  338. //原有子表单 没有被删除的主键
  339. List<Long> BaseStudentFamilyMemberOldIds = baseStudentUser.getBaseStudentFamilyMemberList().stream().map(BaseStudentFamilyMember::getId).filter(Objects::nonNull).collect(Collectors.toList());
  340. //找到需要删除的id
  341. List<Long> BaseStudentFamilyMemberRemoveIds = BaseStudentFamilyMemberIds.stream().filter(item -> !BaseStudentFamilyMemberOldIds.contains(item)).collect(Collectors.toList());
  342. for (BaseStudentFamilyMember BaseStudentFamilyMember : baseStudentUser.getBaseStudentFamilyMemberList()) {
  343. //如果不等于空则修改
  344. if (BaseStudentFamilyMember.getId() != null) {
  345. familyMemberMapper.updateById(BaseStudentFamilyMember);
  346. }
  347. //如果等于空 则新增
  348. else {
  349. //已经不存在的id 删除
  350. BaseStudentFamilyMember.setUserId(baseStudentUser.getId());
  351. familyMemberMapper.insert(BaseStudentFamilyMember);
  352. }
  353. }
  354. //已经不存在的id 删除
  355. if (BaseStudentFamilyMemberRemoveIds.size() > 0) {
  356. familyMemberMapper.deleteBatchIds(BaseStudentFamilyMemberRemoveIds);
  357. }
  358. }
  359. //********************************* BaseStudentFamilyMember 增删改 结束 *******************************************/
  360. //********************************* StudentSchoolRoll 增删改 开始 *******************************************/
  361. {
  362. // 查出所有子级的id
  363. List<BaseStudentSchoolRoll> baseStudentSchoolRollList = schoolRollService.list(Wrappers.lambdaQuery(BaseStudentSchoolRoll.class).eq(BaseStudentSchoolRoll::getUserId, baseStudentUser.getId()).select(BaseStudentSchoolRoll::getId));
  364. List<Long> baseStudentSchoolRollIds = baseStudentSchoolRollList.stream().map(BaseStudentSchoolRoll::getId).collect(Collectors.toList());
  365. //原有子表单 没有被删除的主键
  366. List<Long> baseStudentSchoolRollOldIds = baseStudentUser.getBaseStudentSchoolRollList().stream().map(BaseStudentSchoolRoll::getId).filter(Objects::nonNull).collect(Collectors.toList());
  367. //找到需要删除的id
  368. List<Long> baseStudentSchoolRollRemoveIds = baseStudentSchoolRollIds.stream().filter(item -> !baseStudentSchoolRollOldIds.contains(item)).collect(Collectors.toList());
  369. for (BaseStudentSchoolRoll baseStudentSchoolRoll : baseStudentUser.getBaseStudentSchoolRollList()) {
  370. //如果不等于空则修改
  371. if (baseStudentSchoolRoll.getId() != null) {
  372. BaseStudentSchoolRoll beforeRoll = schoolRollService.getById(baseStudentSchoolRoll.getId());
  373. recordService.insertDataByStudentUpdate(beforeRoll, baseStudentSchoolRoll);
  374. schoolRollService.updateById(baseStudentSchoolRoll);
  375. }
  376. //如果等于空 则新增
  377. else {
  378. //已经不存在的id 删除
  379. baseStudentSchoolRoll.setUserId(baseStudentUser.getId());
  380. schoolRollService.save(baseStudentSchoolRoll);
  381. }
  382. }
  383. //已经不存在的id 删除
  384. if (baseStudentSchoolRollRemoveIds.size() > 0) {
  385. schoolRollService.removeBatchByIds(baseStudentSchoolRollRemoveIds);
  386. }
  387. }
  388. //********************************* StudentSchoolRoll 增删改 结束 *******************************************/
  389. //********************************* BaseStudentSubsidize 增删改 开始 *******************************************/
  390. {
  391. // 查出所有子级的id
  392. List<BaseStudentSubsidize> baseStudentSubsidizeList = subsidizeService.list(Wrappers.lambdaQuery(BaseStudentSubsidize.class).eq(BaseStudentSubsidize::getUserId, baseStudentUser.getId()).select(BaseStudentSubsidize::getId));
  393. List<Long> baseStudentSubsidizeIds = baseStudentSubsidizeList.stream().map(BaseStudentSubsidize::getId).collect(Collectors.toList());
  394. //原有子表单 没有被删除的主键
  395. List<Long> baseStudentSubsidizeOldIds = baseStudentUser.getBaseStudentSubsidizeList().stream().map(BaseStudentSubsidize::getId).filter(Objects::nonNull).collect(Collectors.toList());
  396. //找到需要删除的id
  397. List<Long> baseStudentSubsidizeRemoveIds = baseStudentSubsidizeIds.stream().filter(item -> !baseStudentSubsidizeOldIds.contains(item)).collect(Collectors.toList());
  398. for (BaseStudentSubsidize BaseStudentEducation : baseStudentUser.getBaseStudentSubsidizeList()) {
  399. //如果不等于空则修改
  400. if (BaseStudentEducation.getId() != null) {
  401. subsidizeService.updateById(BaseStudentEducation);
  402. }
  403. //如果等于空 则新增
  404. else {
  405. //已经不存在的id 删除
  406. BaseStudentEducation.setUserId(baseStudentUser.getId());
  407. subsidizeService.save(BaseStudentEducation);
  408. }
  409. }
  410. //已经不存在的id 删除
  411. if (baseStudentSubsidizeRemoveIds.size() > 0) {
  412. subsidizeService.removeBatchByIds(baseStudentSubsidizeRemoveIds);
  413. }
  414. }
  415. //********************************* BaseStudentEducation 增删改 结束 *******************************************/
  416. return true;
  417. }
  418. @Override
  419. @Transactional(rollbackFor = Exception.class)
  420. public Boolean delete(List<Long> ids) {
  421. studentbaseManagerBaseStudentUserMapper.deleteBatchIds(ids);
  422. baseStudentService.remove(Wrappers.lambdaQuery(BaseStudent.class).in(BaseStudent::getUserId, ids));
  423. studentContactService.remove(Wrappers.lambdaQuery(BaseStudentContact.class).in(BaseStudentContact::getUserId, ids));
  424. familyMapper.delete(Wrappers.lambdaQuery(BaseStudentFamily.class).in(BaseStudentFamily::getUserId, ids));
  425. familyMemberMapper.delete(Wrappers.lambdaQuery(BaseStudentFamilyMember.class).in(BaseStudentFamilyMember::getUserId, ids));
  426. schoolRollService.remove(Wrappers.lambdaQuery(BaseStudentSchoolRoll.class).in(BaseStudentSchoolRoll::getUserId, ids));
  427. subsidizeService.remove(Wrappers.lambdaQuery(BaseStudentSubsidize.class).in(BaseStudentSubsidize::getUserId, ids));
  428. return true;
  429. }
  430. @Override
  431. public BaseStudentClassVo getStudentClass(Long userId) {
  432. MPJLambdaWrapper<BaseClass> queryWrapper = new MPJLambdaWrapper<>();
  433. queryWrapper
  434. .disableSubLogicDel()
  435. .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getClassId, BaseStudent::getId)
  436. .eq(BaseStudentSchoolRoll::getUserId, userId)
  437. .selectAsClass(BaseClass.class, BaseStudentClassVo.class);
  438. BaseClass baseClass = baseClassMapper.selectOne(queryWrapper);
  439. return BeanUtil.toBean(baseClass, BaseStudentClassVo.class);
  440. }
  441. /**
  442. * 个人财务画像,获取学生个人信息
  443. */
  444. @Override
  445. public PersonalPortraitPersonalInfoVo getPersonalInfo(Long userId) {
  446. StudentPersonalInfoVo info = baseStudentService.getPersonalInfo(userId);
  447. PersonalPortraitPersonalInfoVo p = new PersonalPortraitPersonalInfoVo();
  448. BeanUtils.copyProperties(info, p);
  449. List<BaseStudentFamilyMember> members = familyMemberMapper.selectList(
  450. new QueryWrapper<BaseStudentFamilyMember>().lambda()
  451. .eq(BaseStudentFamilyMember::getUserId, userId)
  452. .eq(BaseStudentFamilyMember::getIsGuardian, 1)
  453. );
  454. String guardianPhone = "";
  455. for (int i = 0; i < members.size(); i ++){
  456. if(i > 0){
  457. guardianPhone += ",";
  458. }
  459. guardianPhone += members.get(i).getMobile();
  460. }
  461. if(StrUtil.isNotEmpty(guardianPhone)){
  462. info.setGuardianPhone(guardianPhone);
  463. }
  464. return p;
  465. }
  466. @Override
  467. public Boolean importStudentData(List<Map<Integer, Object>> excelDataList) throws ParseException {
  468. List<String> idNumbers = new ArrayList<>();
  469. for (Map<Integer, Object> integerObjectMap : excelDataList) {
  470. idNumbers.add(integerObjectMap.get(0).toString());
  471. }
  472. //查询所有学生的用户信息,组装起来备用
  473. List<BaseStudentUser> studentUsers = this.selectJoinList(BaseStudentUser.class,
  474. new MPJLambdaWrapper<BaseStudentUser>()
  475. .leftJoin(BaseStudent.class, BaseStudent::getUserId, BaseStudentUser::getId)
  476. .in(BaseStudentUser::getCredentialNumber, idNumbers)
  477. );
  478. Map<String, BaseStudentUser> studentUserMap = new HashMap<>();
  479. Set<Long> userIds = new HashSet<>();
  480. for (BaseStudentUser studentUser : studentUsers) {
  481. studentUserMap.put(studentUser.getCredentialNumber(), studentUser);
  482. userIds.add(studentUser.getId());
  483. }
  484. //查询所有的学生信息,组装起来备用
  485. List<BaseStudent> baseStudents = baseStudentService.selectJoinList(BaseStudent.class,
  486. new MPJLambdaWrapper<BaseStudent>()
  487. .leftJoin(BaseStudentUser.class, BaseStudentUser::getId, BaseStudent::getUserId)
  488. .in(BaseStudentUser::getCredentialNumber, idNumbers)
  489. );
  490. Map<Long, BaseStudent> baseStudentMap = new HashMap<>();
  491. for (BaseStudent studentUser : baseStudents) {
  492. baseStudentMap.put(studentUser.getUserId(), studentUser);
  493. }
  494. //查询所用到的字典
  495. Map<String, String> dictionary = initDictionary();
  496. //查行政区划
  497. List<Area> areaList = areaService.list();
  498. Map<String, Long> areaMap = new HashMap<>();
  499. for (Area area : areaList) {
  500. areaMap.put(area.getName(), Long.parseLong(area.getCode()));
  501. }
  502. List<BaseStudentSchoolRoll> baseStudentSchoolRolls = schoolRollService.selectJoinList(BaseStudentSchoolRoll.class,
  503. new MPJLambdaWrapper<BaseStudentSchoolRoll>()
  504. .leftJoin(BaseStudent.class, BaseStudent::getUserId, BaseStudentSchoolRoll::getUserId)
  505. .in(!userIds.isEmpty(), BaseStudentSchoolRoll::getUserId, userIds)
  506. );
  507. Map<Long, BaseStudentSchoolRoll> studentSchoolRollMap = new HashMap<>();
  508. for (BaseStudentSchoolRoll schoolRoll : baseStudentSchoolRolls) {
  509. studentSchoolRollMap.put(schoolRoll.getUserId(), schoolRoll);
  510. }
  511. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  512. //查询年级
  513. List<BaseGrade> gradeList = baseGradeMapper.selectList(new QueryWrapper<BaseGrade>().lambda().eq(BaseGrade::getDeleteMark, DeleteMark.NODELETE.getCode()));
  514. Map<String, Long> gradeMap = new HashMap<>();
  515. for (BaseGrade grade : gradeList) {
  516. gradeMap.put(grade.getName(), grade.getId());
  517. }
  518. //查询班级
  519. List<BaseClass> classList = baseClassMapper.selectList(new QueryWrapper<BaseClass>().lambda().eq(BaseClass::getDeleteMark, DeleteMark.NODELETE.getCode()));
  520. Map<String, Long> classMap = new HashMap<>();
  521. for (BaseClass grade : classList) {
  522. classMap.put(grade.getName(), grade.getId());
  523. }
  524. //查询专业
  525. List<BaseMajorSet> majorSetList = baseMajorSetMapper.selectList(new QueryWrapper<BaseMajorSet>().lambda().eq(BaseMajorSet::getDeleteMark, DeleteMark.NODELETE.getCode()));
  526. Map<String, Long> majorSetMap = new HashMap<>();
  527. for (BaseMajorSet baseMajorSet : majorSetList) {
  528. majorSetMap.put(baseMajorSet.getName(), baseMajorSet.getId());
  529. }
  530. //查询资助
  531. List<BaseStudentSubsidize> baseStudentSubsidizes = subsidizeService.list(null);
  532. Map<Long, BaseStudentSubsidize> subsidizesMap = new HashMap<>();
  533. for (BaseStudentSubsidize el : baseStudentSubsidizes) {
  534. subsidizesMap.put(el.getUserId(), el);
  535. }
  536. //查询家庭
  537. List<BaseStudentFamily> studentFamilies = familyMapper.selectList(null);
  538. Map<Long, BaseStudentFamily> familyMap = new HashMap<>();
  539. for (BaseStudentFamily el : studentFamilies) {
  540. familyMap.put(el.getUserId(), el);
  541. }
  542. //查询联系信息
  543. List<BaseStudentContact> contactList = studentContactService.list();
  544. Map<Long, BaseStudentContact> contactMap = new HashMap<>();
  545. for (BaseStudentContact el : contactList) {
  546. contactMap.put(el.getUserId(), el);
  547. }
  548. List<BaseStudentUser> updateStudentUserList = new ArrayList();
  549. List<BaseStudent> updateBaseStudentList = new ArrayList();
  550. List<BaseStudentSchoolRoll> updateSchoolRollList = new ArrayList();
  551. List<BaseStudentSubsidize> updateSubsidizeList = new ArrayList();
  552. List<BaseStudentFamily> updateFamilyList = new ArrayList();
  553. List<BaseStudentContact> updateContactList = new ArrayList();
  554. List<BaseStudentUser> insertStudentUserList = new ArrayList();
  555. List<BaseStudent> insertBaseStudentList = new ArrayList();
  556. List<BaseStudentSchoolRoll> insertSchoolRollList = new ArrayList();
  557. List<BaseStudentSubsidize> insertSubsidizeList = new ArrayList();
  558. List<BaseStudentFamily> insertFamilyList = new ArrayList();
  559. List<BaseStudentContact> insertContactList = new ArrayList();
  560. //异动记录
  561. List<StudentChangeRecord> changeRecordList = new ArrayList();
  562. long createUserId = StpUtil.getLoginIdAsLong();
  563. // long createUserId = 1000000000000000000L;
  564. int row = 3;
  565. for (Map<Integer, Object> dataMaps : excelDataList) {
  566. if(dataMaps.get(0) == null){
  567. throw new MyException("第" + row + "行数据身份证号为空,无法导入");
  568. }
  569. String credentialNumber = dataMaps.get(0).toString();//身份证号
  570. //已存在,更新
  571. BaseStudentUser user = studentUserMap.get(credentialNumber);
  572. BaseStudent baseStudent;
  573. BaseStudentSchoolRoll schoolRoll;
  574. BaseStudentSubsidize subsidize;
  575. BaseStudentFamily studentFamily;
  576. BaseStudentContact contact;
  577. long userId = IdUtil.getSnowflakeNextId();
  578. if(user != null){
  579. userId = user.getId();
  580. user.setDeleteMark(DeleteMark.NODELETE.getCode());
  581. baseStudent = baseStudentMap.get(user.getId());
  582. if(baseStudent == null){
  583. baseStudent = new BaseStudent();
  584. baseStudent.setUserId(userId);
  585. baseStudent.setCreateUserId(createUserId);
  586. baseStudent.setCreateDate(LocalDateTime.now());
  587. }
  588. baseStudent.setDeleteMark(DeleteMark.NODELETE.getCode());
  589. schoolRoll = studentSchoolRollMap.get(user.getId());
  590. if(schoolRoll == null){
  591. schoolRoll = new BaseStudentSchoolRoll();
  592. schoolRoll.setUserId(userId);
  593. schoolRoll.setCreateUserId(createUserId);
  594. schoolRoll.setCreateDate(LocalDateTime.now());
  595. }
  596. schoolRoll.setDeleteMark(DeleteMark.NODELETE.getCode());
  597. subsidize = subsidizesMap.get(user.getId());
  598. if(subsidize == null){
  599. subsidize = new BaseStudentSubsidize();
  600. subsidize.setUserId(userId);
  601. subsidize.setCreateUserId(createUserId);
  602. subsidize.setCreateDate(LocalDateTime.now());
  603. }
  604. subsidize.setDeleteMark(DeleteMark.NODELETE.getCode());
  605. studentFamily = familyMap.get(user.getId());
  606. if(studentFamily == null){
  607. studentFamily = new BaseStudentFamily();
  608. studentFamily.setUserId(userId);
  609. studentFamily.setCreateUserId(createUserId);
  610. studentFamily.setCreateDate(LocalDateTime.now());
  611. }
  612. studentFamily.setDeleteMark(DeleteMark.NODELETE.getCode());
  613. contact = contactMap.get(user.getId());
  614. if(contact == null){
  615. contact = new BaseStudentContact();
  616. contact.setUserId(userId);
  617. contact.setCreateUserId(createUserId);
  618. contact.setCreateDate(LocalDateTime.now());
  619. }
  620. contact.setDeleteMark(DeleteMark.NODELETE.getCode());
  621. }else{
  622. user = new BaseStudentUser();
  623. user.setId(userId);
  624. user.setUserName(credentialNumber);
  625. user.setCredentialNumber(credentialNumber);
  626. user.setCreateUserId(createUserId);
  627. user.setCreateDate(LocalDateTime.now());
  628. baseStudent = new BaseStudent();
  629. baseStudent.setUserId(userId);
  630. baseStudent.setCreateUserId(createUserId);
  631. baseStudent.setCreateDate(LocalDateTime.now());
  632. schoolRoll = new BaseStudentSchoolRoll();
  633. schoolRoll.setUserId(userId);
  634. schoolRoll.setCreateUserId(createUserId);
  635. schoolRoll.setCreateDate(LocalDateTime.now());
  636. subsidize = new BaseStudentSubsidize();
  637. subsidize.setUserId(userId);
  638. subsidize.setCreateUserId(createUserId);
  639. subsidize.setCreateDate(LocalDateTime.now());
  640. studentFamily = new BaseStudentFamily();
  641. studentFamily.setUserId(userId);
  642. studentFamily.setCreateUserId(createUserId);
  643. studentFamily.setCreateDate(LocalDateTime.now());
  644. contact = new BaseStudentContact();
  645. contact.setUserId(userId);
  646. contact.setCreateUserId(createUserId);
  647. contact.setCreateDate(LocalDateTime.now());
  648. }
  649. //设置字段值
  650. if(dataMaps.get(1) != null && !"".equals(dataMaps.get(1).toString())){
  651. baseStudent.setStudentId(dataMaps.get(1).toString());//学号
  652. }
  653. if(dataMaps.get(2) != null && !"".equals(dataMaps.get(2).toString())){
  654. schoolRoll.setCandidateNumber(dataMaps.get(2).toString());//考号
  655. }
  656. if(dataMaps.get(3) != null && !"".equals(dataMaps.get(3).toString())){
  657. user.setName(dataMaps.get(3).toString());//姓名
  658. }
  659. if(dataMaps.get(4) != null && !"".equals(dataMaps.get(4).toString())){
  660. user.setGender(GenderDictionaryEnum.getCode(dataMaps.get(4).toString()));//性别
  661. }
  662. if(dataMaps.get(5) != null && !"".equals(dataMaps.get(5).toString())){
  663. user.setMobile(dataMaps.get(5).toString());//手机号
  664. }
  665. if(dataMaps.get(6) != null && !"".equals(dataMaps.get(6).toString())){
  666. user.setEmail(dataMaps.get(6).toString());//邮箱
  667. }
  668. if(dataMaps.get(7) != null && !"".equals(dataMaps.get(7).toString())){
  669. baseStudent.setAsName(dataMaps.get(7).toString());//别名
  670. }
  671. if(dataMaps.get(8) != null && !"".equals(dataMaps.get(8).toString())){
  672. baseStudent.setEnName(dataMaps.get(8).toString());//英文名
  673. }
  674. if(dataMaps.get(9) != null && !"".equals(dataMaps.get(9).toString())){
  675. baseStudent.setPyName(dataMaps.get(9).toString());//姓名拼音
  676. }
  677. if(dataMaps.get(10) != null && !"".equals(dataMaps.get(10).toString())){
  678. baseStudent.setFormerName(dataMaps.get(10).toString());//曾用名
  679. }
  680. if(dataMaps.get(11) != null && !"".equals(dataMaps.get(11).toString())){
  681. user.setCredentialType(dictionary.get("credential_type" + dataMaps.get(11).toString()));//证件类型
  682. }
  683. if(dataMaps.get(12) != null && !"".equals(dataMaps.get(12).toString())){
  684. LocalDateTime birthday = parseLocalDateTime(dataMaps.get(12).toString());
  685. user.setBirthDate(birthday);//出生日期
  686. baseStudent.setDayOfBirth(birthday.toLocalDate());//出生日期
  687. }
  688. if(dataMaps.get(13) != null && !"".equals(dataMaps.get(13).toString())){
  689. baseStudent.setBirthType(dictionary.get("date_type" + dataMaps.get(13).toString()));//生日类型
  690. }
  691. if(dataMaps.get(14) != null && !"".equals(dataMaps.get(14).toString())){
  692. baseStudent.setNation(dictionary.get("nation" + dataMaps.get(14).toString()));//民族
  693. }
  694. if(dataMaps.get(15) != null && !"".equals(dataMaps.get(15).toString())){
  695. baseStudent.setBloodType(dictionary.get("blood_type" + dataMaps.get(15).toString()));//血型
  696. }
  697. if(dataMaps.get(16) != null && !"".equals(dataMaps.get(16).toString())){
  698. baseStudent.setHealth(dictionary.get("health" + dataMaps.get(16).toString()));//健康状况
  699. }
  700. if(dataMaps.get(17) != null && !"".equals(dataMaps.get(17).toString())){
  701. baseStudent.setMaritalState(dictionary.get("marital_state" + dataMaps.get(17).toString()));//婚姻状况
  702. }
  703. if(dataMaps.get(18) != null && !"".equals(dataMaps.get(18).toString())){
  704. baseStudent.setPoliticalState(dictionary.get("political_state" + dataMaps.get(18).toString()));//政治面貌
  705. }
  706. if(dataMaps.get(19) != null && !"".equals(dataMaps.get(19).toString())){
  707. baseStudent.setNationality(dictionary.get("nationality" + dataMaps.get(19).toString()));//国籍地区
  708. }
  709. if(dataMaps.get(20) != null && !"".equals(dataMaps.get(20).toString())){
  710. baseStudent.setChineseType(dictionary.get("chinese_type" + dataMaps.get(20).toString()));//港澳台侨外
  711. }
  712. if(dataMaps.get(21) != null && !"".equals(dataMaps.get(21).toString())){
  713. baseStudent.setHouseHoldType(dictionary.get("house_hold_type" + dataMaps.get(21).toString()));//户口类别
  714. }
  715. if(dataMaps.get(22) != null && !"".equals(dataMaps.get(22).toString())){
  716. baseStudent.setNativePlaceType(dataMaps.get(22).toString());//籍贯类型
  717. }
  718. if(dataMaps.get(23) != null && !"".equals(dataMaps.get(23).toString())){
  719. baseStudent.setProvinces(areaMap.get(dataMaps.get(23).toString()));//省
  720. }
  721. if(dataMaps.get(24) != null && !"".equals(dataMaps.get(24).toString())){
  722. baseStudent.setCity(areaMap.get(dataMaps.get(24).toString()));//市
  723. }
  724. if(dataMaps.get(25) != null && !"".equals(dataMaps.get(25).toString())){
  725. baseStudent.setDistrict(areaMap.get(dataMaps.get(25).toString()));//区县
  726. }
  727. if(dataMaps.get(26) != null && !"".equals(dataMaps.get(26).toString())){
  728. baseStudent.setHouseProvinces(areaMap.get(dataMaps.get(26).toString()));//户口所在地省
  729. }
  730. if(dataMaps.get(27) != null && !"".equals(dataMaps.get(27).toString())){
  731. baseStudent.setHouseCity(areaMap.get(dataMaps.get(27).toString()));//户口所在地市
  732. }
  733. if(dataMaps.get(28) != null && !"".equals(dataMaps.get(28).toString())){
  734. baseStudent.setHouseDistrict(areaMap.get(dataMaps.get(28).toString()));//户口所在地区/县
  735. }
  736. if(dataMaps.get(29) != null && !"".equals(dataMaps.get(29).toString())){
  737. baseStudent.setBelongsPolice(dataMaps.get(29).toString());//户口所属派出所
  738. }
  739. if(dataMaps.get(30) != null && !"".equals(dataMaps.get(30).toString())){
  740. baseStudent.setBirthProvinces(areaMap.get(dataMaps.get(30).toString()));//出生所在地省
  741. }
  742. if(dataMaps.get(31) != null && !"".equals(dataMaps.get(31).toString())){
  743. baseStudent.setBirthCity(areaMap.get(dataMaps.get(31).toString()));//出生所在地市
  744. }
  745. if(dataMaps.get(32) != null && !"".equals(dataMaps.get(32).toString())){
  746. baseStudent.setBirthDistrict(areaMap.get(dataMaps.get(32).toString()));//出生所在地/区县
  747. }
  748. if(dataMaps.get(33) != null && !"".equals(dataMaps.get(33).toString())){
  749. baseStudent.setHouseHoldAddress(dataMaps.get(33).toString());//户籍地址
  750. }
  751. if(dataMaps.get(34) != null && !"".equals(dataMaps.get(34).toString())){
  752. baseStudent.setResidenceType(dictionary.get("residence_type" + dataMaps.get(34).toString()));//学生居住地类型
  753. }
  754. if(dataMaps.get(35) != null && !"".equals(dataMaps.get(35).toString())){
  755. baseStudent.setTrainInterval(dataMaps.get(35).toString());//乘火车区间
  756. }
  757. if(dataMaps.get(36) != null && !"".equals(dataMaps.get(36).toString())){
  758. baseStudent.setIsMigrateChildren(YesOrNoEnum.getCode(dataMaps.get(36).toString()));//是否随迁子女
  759. }
  760. if(dataMaps.get(37) != null && !"".equals(dataMaps.get(37).toString())){
  761. baseStudent.setIsFloatingPopulation(YesOrNoEnum.getCode(dataMaps.get(37).toString()));//是否流动人口
  762. }
  763. if(dataMaps.get(38) != null && !"".equals(dataMaps.get(38).toString())){
  764. baseStudent.setHeight(Double.parseDouble(dataMaps.get(38).toString()));//身高
  765. }
  766. if(dataMaps.get(39) != null && !"".equals(dataMaps.get(39).toString())){
  767. baseStudent.setWeight(Double.parseDouble(dataMaps.get(39).toString()));//体重
  768. }
  769. if(dataMaps.get(40) != null && !"".equals(dataMaps.get(40).toString())){
  770. baseStudent.setVision(Double.parseDouble(dataMaps.get(40).toString()));//视力
  771. }
  772. if(dataMaps.get(41) != null && !"".equals(dataMaps.get(41).toString())){
  773. baseStudent.setSpecialty(dataMaps.get(41).toString());//特长
  774. }
  775. if(dataMaps.get(42) != null && !"".equals(dataMaps.get(42).toString())){
  776. user.setQqNumber(dataMaps.get(42).toString());//QQ&MSN
  777. contact.setQqMsn(dataMaps.get(42).toString());//QQ&MSN
  778. }
  779. if(dataMaps.get(43) != null && !"".equals(dataMaps.get(43).toString())){
  780. user.setWechatNumber(dataMaps.get(43).toString());//微信号码
  781. contact.setWechat(dataMaps.get(43).toString());//微信号码
  782. }
  783. if(dataMaps.get(44) != null && !"".equals(dataMaps.get(44).toString())){
  784. contact.setUserPage(dataMaps.get(44).toString());//个人主页
  785. }
  786. if(dataMaps.get(45) != null && !"".equals(dataMaps.get(45).toString())){
  787. schoolRoll.setRollNumber(dataMaps.get(45).toString());//学籍号
  788. }
  789. if(dataMaps.get(46) != null && !"".equals(dataMaps.get(46).toString())){
  790. schoolRoll.setArchivesNumber(dataMaps.get(46).toString());//学生档案编号
  791. }
  792. if(dataMaps.get(47) != null && !"".equals(dataMaps.get(47).toString())){
  793. schoolRoll.setEnrollmentDate(sdf.parse(dataMaps.get(47).toString()));//入学年月
  794. }
  795. if(dataMaps.get(48) != null && !"".equals(dataMaps.get(48).toString())){
  796. schoolRoll.setEnrollmentType(dictionary.get("enrollment_type" + dataMaps.get(48).toString()));//入学方式
  797. }
  798. if(dataMaps.get(49) != null && !"".equals(dataMaps.get(49).toString())){
  799. schoolRoll.setGradeId(gradeMap.get(dataMaps.get(49).toString()));//入学年级
  800. }
  801. if(dataMaps.get(50) != null && !"".equals(dataMaps.get(50).toString())){
  802. schoolRoll.setEnrollType(dictionary.get("enroll_type" + dataMaps.get(50).toString()));//入学招生类型
  803. }
  804. if(dataMaps.get(51) != null && !"".equals(dataMaps.get(51).toString())){
  805. schoolRoll.setMajorSetId(majorSetMap.get(dataMaps.get(51).toString()));//在读专业方向
  806. }
  807. if(dataMaps.get(52) != null && !"".equals(dataMaps.get(52).toString())){
  808. schoolRoll.setStudyYear(Double.parseDouble(dataMaps.get(52).toString()));//学制
  809. }
  810. if(dataMaps.get(53) != null && !"".equals(dataMaps.get(53).toString())){
  811. //schoolRoll.setClassId(classMap.get(dataMaps.get(53).toString()));//班级
  812. }
  813. if(dataMaps.get(54) != null && !"".equals(dataMaps.get(54).toString())){
  814. schoolRoll.setStudentSource(dictionary.get("student_type" + dataMaps.get(54).toString()));//学生来源
  815. }
  816. if(dataMaps.get(55) != null && !"".equals(dataMaps.get(55).toString())){
  817. //schoolRoll.setStudentType(dictionary.get("student_type" + dataMaps.get(55).toString()));//学生类别
  818. }
  819. if(dataMaps.get(56) != null && !"".equals(dataMaps.get(56).toString())){
  820. //schoolRoll.setArchivesStatus(dictionary.get("archives_status" + dataMaps.get(56).toString()));//学籍状态
  821. }
  822. if(dataMaps.get(57) != null && !"".equals(dataMaps.get(57).toString())){
  823. //schoolRoll.setLearnStatus(dictionary.get("roll_modality" + dataMaps.get(57).toString()));//学习形式
  824. //schoolRoll.setRollModality(dictionary.get("roll_modality" + dataMaps.get(57).toString()));//学习形式
  825. }
  826. if(dataMaps.get(58) != null && !"".equals(dataMaps.get(58).toString())){
  827. //schoolRoll.setStduyStatus(dictionary.get("stduy_status" + dataMaps.get(58).toString()));//就读方式
  828. }
  829. if(dataMaps.get(59) != null && !"".equals(dataMaps.get(59).toString())){
  830. schoolRoll.setChooseStatus(dictionary.get("choose_status" + dataMaps.get(59).toString()));//分流状态
  831. }
  832. if(dataMaps.get(60) != null && !"".equals(dataMaps.get(60).toString())){
  833. schoolRoll.setFosterType(dictionary.get("foster_type" + dataMaps.get(60).toString()));//分段培养方式
  834. }
  835. if(dataMaps.get(61) != null && !"".equals(dataMaps.get(61).toString())){
  836. schoolRoll.setRecruitType(dictionary.get("recruit_type" + dataMaps.get(61).toString()));//招生类型
  837. }
  838. if(dataMaps.get(62) != null && !"".equals(dataMaps.get(62).toString())){
  839. schoolRoll.setRecruitTarget(dictionary.get("recruit_target" + dataMaps.get(62).toString()));//招生对象
  840. }
  841. if(dataMaps.get(63) != null && !"".equals(dataMaps.get(63).toString())){
  842. schoolRoll.setHighestEducation(dictionary.get("education" + dataMaps.get(63).toString()));//入学前最高学历
  843. }
  844. if(dataMaps.get(64) != null && !"".equals(dataMaps.get(64).toString())){
  845. schoolRoll.setGraduatedUniversity(dataMaps.get(64).toString());//入学前毕业院校
  846. }
  847. if(dataMaps.get(65) != null && !"".equals(dataMaps.get(65).toString())){
  848. schoolRoll.setGraduatedScore(Double.parseDouble(dataMaps.get(65).toString()));//入学前毕业成绩
  849. }
  850. if(dataMaps.get(66) != null && !"".equals(dataMaps.get(66).toString())){
  851. schoolRoll.setExamineeNumber(dataMaps.get(66).toString());//入学考试准考证号
  852. }
  853. if(dataMaps.get(67) != null && !"".equals(dataMaps.get(67).toString())){
  854. schoolRoll.setTicketNumber(dataMaps.get(67).toString());//入学考试准考证号
  855. }
  856. if(dataMaps.get(68) != null && !"".equals(dataMaps.get(68).toString())){
  857. schoolRoll.setAdmissionScores(Double.parseDouble(dataMaps.get(68).toString()));//入学考试成绩
  858. }
  859. if(dataMaps.get(69) != null && !"".equals(dataMaps.get(69).toString())){
  860. schoolRoll.setRemark(dataMaps.get(69).toString());//备注
  861. }
  862. if(dataMaps.get(69) != null && !"".equals(dataMaps.get(69).toString())){
  863. schoolRoll.setRemark(dataMaps.get(69).toString());//备注
  864. }
  865. if(dataMaps.get(70) != null && !"".equals(dataMaps.get(70).toString())){
  866. subsidize.setIsIndemnify(YesOrNoEnum.getCode(dataMaps.get(70).toString()));//是否低保户
  867. }
  868. if(dataMaps.get(71) != null && !"".equals(dataMaps.get(71).toString())){
  869. subsidize.setIsStipend(YesOrNoEnum.getCode(dataMaps.get(71).toString()));//是否享受国家助学金
  870. }
  871. if(dataMaps.get(72) != null && !"".equals(dataMaps.get(72).toString())){
  872. subsidize.setStipendStand(Double.parseDouble(dataMaps.get(72).toString()));//助学金发放标准(元)
  873. }
  874. if(dataMaps.get(73) != null && !"".equals(dataMaps.get(73).toString())){
  875. subsidize.setStipendNumber(dataMaps.get(73).toString());//学生资助卡号
  876. }
  877. if(dataMaps.get(74) != null && !"".equals(dataMaps.get(74).toString())){
  878. subsidize.setIsFree(YesOrNoEnum.getCode(dataMaps.get(74).toString()));//是否免学费
  879. }
  880. if(dataMaps.get(75) != null && !"".equals(dataMaps.get(75).toString())){
  881. subsidize.setIsFilingCard(YesOrNoEnum.getCode(dataMaps.get(75).toString()));//是否建档立卡
  882. }
  883. if(dataMaps.get(76) != null && !"".equals(dataMaps.get(76).toString())){
  884. studentFamily.setZipCode(dataMaps.get(76).toString());//家庭邮编
  885. }
  886. if(dataMaps.get(77) != null && !"".equals(dataMaps.get(77).toString())){
  887. studentFamily.setTelephone(dataMaps.get(77).toString());//家庭电话
  888. }
  889. if(dataMaps.get(78) != null && !"".equals(dataMaps.get(78).toString())){
  890. studentFamily.setContact(dataMaps.get(76).toString());//联系人姓名
  891. }
  892. if(dataMaps.get(79) != null && !"".equals(dataMaps.get(79).toString())){
  893. studentFamily.setPopulation(Integer.parseInt(dataMaps.get(79).toString()));//家庭人口
  894. }
  895. if(dataMaps.get(80) != null && !"".equals(dataMaps.get(80).toString())){
  896. studentFamily.setAddress(dataMaps.get(80).toString());//家庭地址
  897. }
  898. if(dataMaps.get(81) != null && !"".equals(dataMaps.get(81).toString())){
  899. studentFamily.setIncomeSource(dataMaps.get(81).toString());//家庭主要收入来源
  900. }
  901. if(dataMaps.get(82) != null && !"".equals(dataMaps.get(82).toString())){
  902. studentFamily.setIncomeNumber(Double.parseDouble(dataMaps.get(82).toString()));//家庭月收入(元)
  903. }
  904. if(dataMaps.get(83) != null && !"".equals(dataMaps.get(83).toString())){
  905. studentFamily.setRailwayStation(dataMaps.get(83).toString());//离家最近火车站
  906. }
  907. if(studentUserMap.containsKey(credentialNumber)){
  908. updateStudentUserList.add(user);
  909. updateBaseStudentList.add(baseStudent);
  910. updateSchoolRollList.add(schoolRoll);
  911. updateSubsidizeList.add(subsidize);
  912. updateFamilyList.add(studentFamily);
  913. updateContactList.add(contact);
  914. }else{
  915. insertStudentUserList.add(user);
  916. insertBaseStudentList.add(baseStudent);
  917. if(schoolRoll.getClassId() != null && schoolRoll.getGradeId() != null && schoolRoll.getMajorSetId() != null){
  918. insertSchoolRollList.add(schoolRoll);
  919. }
  920. insertSubsidizeList.add(subsidize);
  921. insertFamilyList.add(studentFamily);
  922. insertContactList.add(contact);
  923. }
  924. row ++;
  925. }
  926. //批量修改
  927. if(!updateStudentUserList.isEmpty()){
  928. this.updateBatchById(updateStudentUserList);
  929. }
  930. if(!updateSchoolRollList.isEmpty()){
  931. schoolRollService.updateBatchById(updateSchoolRollList);
  932. }
  933. if(!updateSubsidizeList.isEmpty()){
  934. subsidizeService.updateBatchById(updateSubsidizeList);
  935. }
  936. if(!updateFamilyList.isEmpty()){
  937. familyService.updateBatchById(updateFamilyList);
  938. }
  939. if(!updateBaseStudentList.isEmpty()){
  940. baseStudentService.updateBatchById(updateBaseStudentList);
  941. }
  942. if(!updateContactList.isEmpty()){
  943. studentContactService.updateBatchById(updateContactList);
  944. }
  945. //批量新增
  946. if(!insertStudentUserList.isEmpty()){
  947. this.saveBatch(insertStudentUserList);
  948. }
  949. if(!insertBaseStudentList.isEmpty()){
  950. baseStudentService.saveBatch(insertBaseStudentList);
  951. }
  952. if(!insertSubsidizeList.isEmpty()){
  953. subsidizeService.saveBatch(insertSubsidizeList);
  954. }
  955. if(!insertFamilyList.isEmpty()){
  956. familyService.saveBatch(insertFamilyList);
  957. }
  958. if(!insertSchoolRollList.isEmpty()){
  959. schoolRollService.saveBatch(insertSchoolRollList);
  960. }
  961. if(!insertContactList.isEmpty()){
  962. studentContactService.saveBatch(insertContactList);
  963. }
  964. return true;
  965. }
  966. @Override
  967. public Page<BaseStudentUserPageVo> getStudentPage(Page<BaseStudentUserPageVo> page, BaseStudentUserPageDto dto) {
  968. return baseStudentMapper.getStudentPage(page, dto);
  969. }
  970. @Override
  971. public Boolean uploadImage(Long userId, MultipartFile file) throws IOException {
  972. BaseStudentUser studentUser = studentbaseManagerBaseStudentUserMapper.selectById(userId);
  973. String[] imgSuffix = new String[]{"png", "jpg", "jpeg"};
  974. String suffix = StringUtils.substringAfterLast(file.getOriginalFilename(), StringPool.DOT);
  975. if (!Arrays.asList(imgSuffix).contains(suffix)) {
  976. throw new MyException("图片格式不正确!");
  977. }
  978. String base64String = Base64.getEncoder().encodeToString(file.getBytes());
  979. Map<String, String> map = new HashMap<String, String>() {
  980. {
  981. put("jpg", "data:image/jpg;base64,");
  982. put("jpeg", "data:image/jpeg;base64,");
  983. put("png", "data:image/png;base64,");
  984. }
  985. };
  986. studentUser.setAvatar(map.get(suffix) + base64String);
  987. studentbaseManagerBaseStudentUserMapper.updateById(studentUser);
  988. return true;
  989. }
  990. @Override
  991. public List<BaseDepMajorGradeClassStudenTreeVo> deptMajorGradeClassTree(MajorGradeClassDto dto) {
  992. List<BaseDepMajorGradeClassStudenTreeVo> voList = new ArrayList<>();
  993. MPJLambdaWrapper<BaseClass> baseClassMPJLambdaWrapper = new MPJLambdaWrapper<>();
  994. baseClassMPJLambdaWrapper
  995. .selectAs(BaseClass::getId, BaseClassMajorSetVo::getClassId)
  996. .selectAs(BaseMajorSet::getMajorId, BaseClassMajorSetVo::getMajorId)
  997. .selectAs(BaseClass::getName, BaseClassMajorSetVo::getClassName)
  998. .selectAs(BaseClass::getGradeId, BaseClassMajorSetVo::getGradeId)
  999. .leftJoin(BaseClassMajorSet.class, BaseClassMajorSet::getClassId, BaseClass::getId)
  1000. .leftJoin(BaseMajorSet.class, BaseMajorSet::getId, BaseClassMajorSet::getMajorSetId)
  1001. .eq(dto.getIsGraduate() != null, BaseClass::getIsGraduate, dto.getIsGraduate())
  1002. .eq(BaseClass::getDeleteMark, DeleteMark.NODELETE.getCode())
  1003. .eq(BaseClass::getEnabledMark, EnabledMark.ENABLED.getCode())
  1004. ;
  1005. List<BaseClassMajorSetVo> majorSetList = baseClassService.selectJoinList(BaseClassMajorSetVo.class, baseClassMPJLambdaWrapper);
  1006. if(majorSetList.isEmpty()){
  1007. return new ArrayList<>();
  1008. }
  1009. Set<Long> gradeIds = majorSetList.stream().map(BaseClassMajorSetVo::getGradeId).collect(Collectors.toSet());
  1010. Set<Long> majorSetIds = majorSetList.stream().map(BaseClassMajorSetVo::getMajorId).collect(Collectors.toSet());
  1011. Map<Long, Map<Long, List<BaseClassMajorSetVo>>> classMap = majorSetList.stream().collect(Collectors.groupingBy(BaseClassMajorSetVo::getMajorId, Collectors.groupingBy(BaseClassMajorSetVo::getGradeId)));
  1012. List<BaseGrade> gradeList = baseGradeService.list(
  1013. new QueryWrapper<BaseGrade>().lambda()
  1014. .eq(BaseGrade::getDeleteMark, DeleteMark.NODELETE.getCode())
  1015. .in(!gradeIds.isEmpty(), BaseGrade::getId, gradeIds)
  1016. .orderByDesc(BaseGrade::getTitle)
  1017. );
  1018. List<BaseMajor> majorList = baseMajorService.list(
  1019. new QueryWrapper<BaseMajor>().lambda()
  1020. .eq(BaseMajor::getDeleteMark, DeleteMark.NODELETE.getCode())
  1021. .in(!majorSetIds.isEmpty(), BaseMajor::getId, majorSetIds)
  1022. );
  1023. List<Long> deptIds = majorList.stream().map(BaseMajor::getDepartmentId).collect(Collectors.toList());
  1024. List<Department> departmentList =baseDeparmentService.list(
  1025. new QueryWrapper<Department>().lambda()
  1026. .eq(Department::getDeleteMark, DeleteMark.NODELETE.getCode())
  1027. .eq(Department::getIsMajor,1)
  1028. .in(!deptIds.isEmpty(), Department::getId, deptIds)
  1029. );
  1030. departmentList.forEach((node) -> {
  1031. voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
  1032. setId(node.getId().toString());
  1033. setTreeType(1);
  1034. setName(node.getName());
  1035. setParentId("0");
  1036. }});
  1037. });
  1038. majorList.forEach((node)->{
  1039. voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
  1040. setId(node.getId().toString());
  1041. setName(node.getName());
  1042. setTreeType(2);
  1043. setParentId(node.getDepartmentId().toString());
  1044. }});
  1045. Map<Long, List<BaseClassMajorSetVo>> gradeMap = classMap.get(node.getId());
  1046. gradeList.forEach((DDD)->{
  1047. List<BaseClassMajorSetVo> list = gradeMap.get(DDD.getId());
  1048. if(list == null|| list.isEmpty() || list.size() == 0){
  1049. return;
  1050. }
  1051. voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
  1052. setId(node.getId().toString()+"_"+DDD.getId().toString());
  1053. setName(DDD.getName());
  1054. setTreeType(3);
  1055. setParentId(node.getId().toString());
  1056. }});
  1057. });
  1058. });
  1059. majorSetList.forEach((node)->{
  1060. voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
  1061. setId(node.getClassId().toString());
  1062. setName(node.getClassName());
  1063. setTreeType(4);
  1064. setParentId(node.getMajorId().toString()+"_"+node.getGradeId());
  1065. }});
  1066. });
  1067. List<BaseDepMajorGradeClassStudenTreeVo> treeVoList = TreeUtil.build(voList);
  1068. return treeVoList;
  1069. }
  1070. /**
  1071. * 初始化字典信息
  1072. * 身份证类型、
  1073. */
  1074. private Map<String, String> initDictionary(){
  1075. List<String> codeList = new ArrayList<>();
  1076. codeList.add("credential_type");codeList.add("nation");
  1077. codeList.add("blood_type");codeList.add("health");
  1078. codeList.add("marital_state");codeList.add("political_state");
  1079. codeList.add("nationality");codeList.add("chinese_type");
  1080. codeList.add("house_hold_type");codeList.add("residence_type");
  1081. codeList.add("enrollment_type");codeList.add("enroll_type");
  1082. codeList.add("student_type");codeList.add("archives_status");
  1083. codeList.add("roll_modality");codeList.add("stduy_status");
  1084. codeList.add("choose_status");codeList.add("foster_type");
  1085. codeList.add("recruit_type");codeList.add("recruit_target");
  1086. codeList.add("education");codeList.add("recruit_target");
  1087. codeList.add("date_type");
  1088. List<DictionaryDetail> detailList = dictionarydetailMapper.selectJoinList(DictionaryDetail.class,
  1089. new MPJLambdaWrapper<DictionaryDetail>()
  1090. .leftJoin(DictionaryItem.class, DictionaryItem::getId, DictionaryDetail::getItemId)
  1091. .in(DictionaryItem::getCode, codeList)
  1092. );
  1093. List<DictionaryItem> dictionaryItemList = dictionaryitemMapper.selectList(
  1094. new QueryWrapper<DictionaryItem>().lambda()
  1095. .eq(DictionaryItem::getDeleteMark, DeleteMark.NODELETE.getCode())
  1096. );
  1097. Map<Long, String> itemMap = new HashMap<>();
  1098. for (DictionaryItem dictionaryItem : dictionaryItemList) {
  1099. itemMap.put(dictionaryItem.getId(), dictionaryItem.getCode());
  1100. }
  1101. Map<String, String> resultMap = new HashMap<>();
  1102. for (DictionaryDetail dictionaryDetail : detailList) {
  1103. resultMap.put(itemMap.get(dictionaryDetail.getItemId()) + dictionaryDetail.getName(), dictionaryDetail.getCode());
  1104. }
  1105. return resultMap;
  1106. }
  1107. private LocalDateTime parseLocalDateTime(String dateStr){
  1108. LocalDate time = null;
  1109. try {
  1110. time = LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
  1111. }catch (DateTimeParseException e){
  1112. try {
  1113. time = LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy/MM/dd"));
  1114. }catch (DateTimeParseException e2){
  1115. try {
  1116. time = LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
  1117. }catch (DateTimeParseException e3){
  1118. try {
  1119. time = LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyyMMdd"));
  1120. }catch (DateTimeParseException e4){
  1121. throw new MyException("日期格式不正确");
  1122. }
  1123. }
  1124. }
  1125. }
  1126. if(time != null){
  1127. return time.atStartOfDay();
  1128. }
  1129. return null;
  1130. }
  1131. }