WelcomeStudentController.java 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492
  1. package com.template.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.auth0.jwt.interfaces.Claim;
  4. import com.baomidou.mybatisplus.core.conditions.Wrapper;
  5. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  6. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  7. import com.baomidou.mybatisplus.extension.api.R;
  8. import com.template.annotation.PassToken;
  9. import com.template.api.WelcomeStudentControllerAPI;
  10. import com.template.common.utils.ExcelUtils;
  11. import com.template.common.utils.JWTUtil;
  12. import com.template.common.utils.paramUtils;
  13. import com.template.model.enumModel.eFileType;
  14. import com.template.model.enumModel.eProjectType;
  15. import com.template.model.pojo.*;
  16. import com.template.model.request.*;
  17. import com.template.model.result.CommonResult;
  18. import com.template.model.result.PageUtils;
  19. import com.template.model.vo.*;
  20. import com.template.services.*;
  21. import io.swagger.annotations.ApiModelProperty;
  22. import org.apache.poi.hssf.usermodel.HSSFRow;
  23. import org.apache.poi.hssf.usermodel.HSSFSheet;
  24. import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  25. import org.apache.poi.ss.usermodel.DataFormatter;
  26. import org.apache.poi.ss.usermodel.Row;
  27. import org.apache.poi.ss.usermodel.Sheet;
  28. import org.apache.poi.ss.usermodel.Workbook;
  29. import org.apache.poi.xssf.usermodel.XSSFRow;
  30. import org.apache.poi.xssf.usermodel.XSSFSheet;
  31. import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  32. import org.slf4j.Logger;
  33. import org.slf4j.LoggerFactory;
  34. import org.springframework.beans.factory.annotation.Autowired;
  35. import org.springframework.transaction.annotation.Transactional;
  36. import org.springframework.util.StringUtils;
  37. import org.springframework.validation.BindingResult;
  38. import org.springframework.web.bind.annotation.RestController;
  39. import org.springframework.web.multipart.MultipartFile;
  40. import javax.servlet.http.HttpServletResponse;
  41. import java.io.IOException;
  42. import java.io.InputStream;
  43. import java.text.ParseException;
  44. import java.time.LocalDateTime;
  45. import java.time.format.DateTimeFormatter;
  46. import java.util.*;
  47. import java.util.stream.Collectors;
  48. /**
  49. * <p>
  50. * 前端控制器
  51. * </p>
  52. *
  53. * @author ceshi
  54. * @since 2025-06-13
  55. */
  56. @RestController
  57. public class WelcomeStudentController implements WelcomeStudentControllerAPI {
  58. @Autowired
  59. private WelcomeStudentService welcomeStudentService;
  60. @Autowired
  61. private WelcomeFamilyService welcomeFamilyService;
  62. @Autowired
  63. private WelcomeAccompanyService welcomeAccompanyService;
  64. @Autowired
  65. private WelcomeBedService welcomeBedService;
  66. @Autowired
  67. private WelcomeSettingService welcomeSettingService;
  68. @Autowired
  69. private WelcomeArriveSettingService welcomeArriveSettingService;
  70. @Autowired
  71. private WelcomeOrgService welcomeOrgService;
  72. @Autowired
  73. private WelcomeCityService welcomeCityService;
  74. @Autowired
  75. WelcomeSchoolService welcomeSchoolService;
  76. @Autowired
  77. WelcomeBuildService welcomeBuildService;
  78. @Autowired
  79. WelcomeDormitoryService welcomeDormitoryService;
  80. @Autowired
  81. WelcomeVisitorService welcomeVisitorService;
  82. private static Logger logger = LoggerFactory.getLogger(WelcomeStudentController.class);
  83. @Override
  84. @Transactional(rollbackFor = {Exception.class})
  85. public CommonResult insertStudentInfo(InsertStudentRequest isr, BindingResult bindingResult) throws Exception {
  86. if (bindingResult.hasErrors()) {
  87. String st = paramUtils.getParamError(bindingResult);
  88. return CommonResult.fail(st);
  89. }
  90. int existCount = welcomeStudentService.existStudentInfo(isr.getAdmissNum(), isr.getCardId());
  91. if (existCount > 0) {
  92. return CommonResult.fail("当前录取号或身份证号已存在!");
  93. }
  94. //region 学生信息
  95. WelcomeStudent ws = new WelcomeStudent();
  96. ws.setAdmissNum(isr.getAdmissNum());
  97. ws.setName(isr.getName());
  98. ws.setPicture(isr.getPicture());
  99. ws.setCardId(isr.getCardId());
  100. ws.setSex(isr.getSex());
  101. ws.setBirthday(isr.getBirthday());
  102. ws.setSchool(isr.getSchool());
  103. ws.setSchoolId(isr.getSchoolId());
  104. ws.setCollege(isr.getCollege());
  105. ws.setMajor(isr.getMajor());
  106. ws.setClassstr(isr.getClassstr());
  107. ws.setCollegeId(isr.getCollegeId());
  108. ws.setMajorId(isr.getMajorId());
  109. ws.setClassstrId(isr.getClassstrId());
  110. ws.setExamNum(isr.getExamNum());
  111. ws.setEduSystem(isr.getEduSystem());
  112. ws.setGraduationSchool(isr.getGraduationSchool());
  113. ws.setBatchValue(isr.getBatchValue());
  114. ws.setPoliticalStatu(isr.getPoliticalStatu());
  115. ws.setNationality(isr.getNationality());
  116. ws.setPhone(isr.getPhone());
  117. ws.setOprovince(isr.getOprovince());
  118. ws.setOcity(isr.getOcity());
  119. ws.setOdistrict(isr.getOdistrict());
  120. ws.setOprovinceId(isr.getOprovinceId());
  121. ws.setOcityId(isr.getOcityId());
  122. ws.setOdistrictId(isr.getOdistrictId());
  123. ws.setProvinceId(isr.getProvinceId());
  124. ws.setCityId(isr.getCityId());
  125. ws.setDistrictId(isr.getDistrictId());
  126. ws.setProvince(isr.getProvince());
  127. ws.setCity(isr.getCity());
  128. ws.setDistrict(isr.getDistrict());
  129. ws.setAddress(isr.getAddress());
  130. ws.setTrafficMethod(isr.getTrafficMethod());
  131. ws.setArrive(isr.getArrive());
  132. ws.setArrvieDate(isr.getArrvieDate());
  133. ws.setArriveTime(isr.getArriveTime());
  134. ws.setArriveTimeId(isr.getArriveTimeId());
  135. ws.setZipCode(isr.getZipCode());
  136. ws.setRegisterOntime(isr.getRegisterOntime());
  137. ws.setIdenType(1);
  138. ws.setFillStatus("未填报");
  139. //ws.setAmountPayable(isr.getAmountPayable());
  140. //ws.setPayAmount(isr.getPayAmount());
  141. //ws.setIsDrive(isr.getIsDrive());
  142. //ws.setCarNumber(isr.getCarNumber());
  143. //endregion
  144. //region 家庭成员数据
  145. List<WelcomeFamily> wfs = new ArrayList<>();
  146. if (isr.getFvs() != null && isr.getFvs().size() > 0) {
  147. for (InsertFamilyRequest family : isr.getFvs()) {
  148. if(!(StringUtils.hasText(family.getFamilyShip()) && StringUtils.hasText(family.getName())
  149. && StringUtils.hasText(family.getWorkUnit()) && StringUtils.hasText(family.getPhone()))){
  150. return CommonResult.fail("家庭成员信息不能为空!");
  151. }
  152. WelcomeFamily wf = new WelcomeFamily();
  153. wf.setStudentCard(ws.getCardId());
  154. wf.setFamilyShip(family.getFamilyShip());
  155. wf.setName(family.getName());
  156. wf.setWorkUnit(family.getWorkUnit());
  157. wf.setPhone(family.getPhone());
  158. wfs.add(wf);
  159. }
  160. }
  161. //endregion
  162. //region 陪同人员数据
  163. List<WelcomeAccompany> was = new ArrayList<>();
  164. if (isr.getAvs() != null && isr.getAvs().size() > 0) {
  165. for (InsertAccompanyRequest accompany : isr.getAvs()) {
  166. if(!(StringUtils.hasText(accompany.getName()) && StringUtils.hasText(accompany.getPhone()))){
  167. return CommonResult.fail("陪同人员信息不能为空!");
  168. }
  169. WelcomeAccompany wa = new WelcomeAccompany();
  170. wa.setStudentCard(ws.getCardId());
  171. wa.setName(accompany.getName());
  172. wa.setPhone(accompany.getPhone());
  173. was.add(wa);
  174. }
  175. }
  176. //endregion
  177. //region 宿舍信息
  178. WelcomeBed bedData = welcomeBedService.queryBedData(isr.getSchool(), isr.getBuildId(), isr.getDormitoryId(), Integer.valueOf(isr.getBed()));
  179. if (bedData != null) {
  180. if(StringUtils.hasText(bedData.getStudentCard())){
  181. return CommonResult.fail("当前床位已被他人入住,无法入住");
  182. }
  183. bedData.setStudentCard(isr.getCardId());
  184. bedData.setCollege(isr.getCollege());
  185. bedData.setCollegeId(isr.getCollegeId());
  186. bedData.setMajor(isr.getMajor());
  187. bedData.setMajorId(isr.getMajorId());
  188. bedData.setClassstr(isr.getClassstr());
  189. bedData.setClassstrId(isr.getClassstrId());
  190. bedData.setIsCheck(1);
  191. bedData.setCardNum(isr.getAdmissNum());
  192. bedData.setName(isr.getName());
  193. }
  194. //endregion
  195. try {
  196. int studentId = welcomeStudentService.insertWelcomeStudent(ws);
  197. if (studentId <= 0) {
  198. logger.error("添加学生失败,参数:" + JSON.toJSON(isr));
  199. throw new Exception("添加失败!");
  200. }
  201. if (wfs != null && wfs.size() > 0) {
  202. boolean insertBatch = welcomeFamilyService.saveBatch(wfs);
  203. if (!insertBatch) {
  204. logger.error("添加家庭成员失败,参数:" + JSON.toJSON(wfs));
  205. throw new Exception("添加失败!");
  206. }
  207. }
  208. if (was != null && was.size() > 0) {
  209. boolean insertBatch = welcomeAccompanyService.saveBatch(was);
  210. if (!insertBatch) {
  211. logger.error("添加陪同人员失败,参数:" + JSON.toJSON(was));
  212. throw new Exception("添加失败!");
  213. }
  214. }
  215. int insertStudentDormitory = welcomeBedService.updateWelcomeBed(bedData);
  216. if (insertStudentDormitory <= 0) {
  217. logger.error("添加学生床位信息失败,参数:" + JSON.toJSON(bedData));
  218. throw new Exception("添加失败!");
  219. }
  220. } catch (Exception e) {
  221. logger.error(e.getMessage());
  222. throw new Exception("添加失败!");
  223. }
  224. return CommonResult.ok("添加成功");
  225. }
  226. @Override
  227. public CommonResult updateStudentInfo(updateStudentRequest usr, BindingResult bindingResult) throws Exception {
  228. if (bindingResult.hasErrors()) {
  229. String st = paramUtils.getParamError(bindingResult);
  230. return CommonResult.fail(st);
  231. }
  232. WelcomeStudent student = welcomeStudentService.getManageById(usr.getId());
  233. if (student == null) {
  234. return CommonResult.fail("学生数据已失效,编辑失败!");
  235. }
  236. //region 学生信息
  237. student.setAdmissNum(usr.getAdmissNum());
  238. student.setName(usr.getName());
  239. student.setPicture(usr.getPicture());
  240. //student.setCardId(usr.getCardId());
  241. student.setSex(usr.getSex());
  242. student.setBirthday(usr.getBirthday());
  243. student.setSchool(usr.getSchool());
  244. student.setSchoolId(usr.getSchoolId());
  245. student.setCollege(usr.getCollege());
  246. student.setMajor(usr.getMajor());
  247. student.setClassstr(usr.getClassstr());
  248. student.setCollegeId(usr.getCollegeId());
  249. student.setMajorId(usr.getMajorId());
  250. student.setClassstrId(usr.getClassstrId());
  251. student.setExamNum(usr.getExamNum());
  252. student.setEduSystem(usr.getEduSystem());
  253. student.setGraduationSchool(usr.getGraduationSchool());
  254. student.setBatchValue(usr.getBatchValue());
  255. student.setPoliticalStatu(usr.getPoliticalStatu());
  256. student.setNationality(usr.getNationality());
  257. student.setPhone(usr.getPhone());
  258. student.setOprovince(usr.getOprovince());
  259. student.setOcity(usr.getOcity());
  260. student.setOdistrict(usr.getOdistrict());
  261. student.setOprovinceId(usr.getOprovinceId());
  262. student.setOcityId(usr.getOcityId());
  263. student.setOdistrictId(usr.getOdistrictId());
  264. student.setProvinceId(usr.getProvinceId());
  265. student.setCityId(usr.getCityId());
  266. student.setDistrictId(usr.getDistrictId());
  267. student.setProvince(usr.getProvince());
  268. student.setCity(usr.getCity());
  269. student.setDistrict(usr.getDistrict());
  270. student.setAddress(usr.getAddress());
  271. student.setTrafficMethod(usr.getTrafficMethod());
  272. student.setArrive(usr.getArrive());
  273. student.setArrvieDate(usr.getArrvieDate());
  274. student.setArriveTime(usr.getArriveTime());
  275. student.setArriveTimeId(usr.getArriveTimeId());
  276. student.setZipCode(usr.getZipCode());
  277. student.setRegisterOntime(usr.getRegisterOntime());
  278. student.setIdenType(1);
  279. //ws.setAmountPayable(isr.getAmountPayable());
  280. //ws.setPayAmount(isr.getPayAmount());
  281. //ws.setIsDrive(isr.getIsDrive());
  282. //ws.setCarNumber(isr.getCarNumber());
  283. //endregion
  284. //region 家庭成员数据
  285. List<WelcomeFamily> wfs = new ArrayList<>();
  286. if (usr.getFvs() != null && usr.getFvs().size() > 0) {
  287. for (InsertFamilyRequest family : usr.getFvs()) {
  288. if(!(StringUtils.hasText(family.getFamilyShip()) && StringUtils.hasText(family.getName())
  289. && StringUtils.hasText(family.getWorkUnit()) && StringUtils.hasText(family.getPhone()))){
  290. return CommonResult.fail("家庭成员信息不能为空!");
  291. }
  292. WelcomeFamily wf = new WelcomeFamily();
  293. wf.setStudentCard(student.getCardId());
  294. wf.setFamilyShip(family.getFamilyShip());
  295. wf.setName(family.getName());
  296. wf.setWorkUnit(family.getWorkUnit());
  297. wf.setPhone(family.getPhone());
  298. wfs.add(wf);
  299. }
  300. }
  301. //endregion
  302. //region 陪同人员数据
  303. List<WelcomeAccompany> was = new ArrayList<>();
  304. if (usr.getAvs() != null && usr.getAvs().size() > 0) {
  305. for (InsertAccompanyRequest accompany : usr.getAvs()) {
  306. if(!(StringUtils.hasText(accompany.getName()) && StringUtils.hasText(accompany.getPhone()))){
  307. return CommonResult.fail("陪同人员信息不能为空!");
  308. }
  309. WelcomeAccompany wa = new WelcomeAccompany();
  310. wa.setStudentCard(student.getCardId());
  311. wa.setName(accompany.getName());
  312. wa.setPhone(accompany.getPhone());
  313. was.add(wa);
  314. }
  315. }
  316. //endregion
  317. //region 宿舍信息
  318. List<WelcomeBed> bedDatas = new ArrayList<>();
  319. WelcomeBed bedData = welcomeBedService.queryBedData(usr.getSchool(), usr.getBuildId(), usr.getDormitoryId(), Integer.valueOf(usr.getBed()));
  320. if (bedData != null) {//新床位
  321. if(StringUtils.hasText(bedData.getStudentCard()) && !bedData.getStudentCard().equals(student.getCardId())){
  322. return CommonResult.fail("当前床位已被他人入住,无法入住");
  323. }
  324. if (!StringUtils.hasText(bedData.getStudentCard())) {
  325. bedData.setStudentCard(student.getCardId());
  326. bedData.setCollege(student.getCollege());
  327. bedData.setCollegeId(student.getCollegeId());
  328. bedData.setMajor(student.getMajor());
  329. bedData.setMajorId(student.getMajorId());
  330. bedData.setClassstr(student.getClassstr());
  331. bedData.setClassstrId(student.getClassstrId());
  332. bedData.setIsCheck(1);
  333. bedData.setCardNum(student.getAdmissNum());
  334. bedData.setName(student.getName());
  335. //把旧床位清空
  336. WelcomeBed obedData = welcomeBedService.getBedByCardId(student.getCardId());
  337. if (obedData == null) {
  338. obedData = new WelcomeBed();
  339. obedData.setStudentCard(null);
  340. obedData.setCollege(null);
  341. obedData.setCollegeId(null);
  342. obedData.setMajor(null);
  343. obedData.setMajorId(null);
  344. obedData.setClassstr(null);
  345. obedData.setClassstrId(null);
  346. obedData.setIsCheck(0);
  347. obedData.setCardNum(null);
  348. obedData.setName(null);
  349. bedDatas.add(obedData);
  350. }
  351. } else {
  352. bedData.setStudentCard(student.getCardId());
  353. bedData.setCollege(student.getCollege());
  354. bedData.setCollegeId(student.getCollegeId());
  355. bedData.setMajor(student.getMajor());
  356. bedData.setMajorId(student.getMajorId());
  357. bedData.setClassstr(student.getClassstr());
  358. bedData.setClassstrId(student.getClassstrId());
  359. bedData.setIsCheck(1);
  360. bedData.setCardNum(student.getAdmissNum());
  361. bedData.setName(student.getName());
  362. }
  363. bedDatas.add(bedData);
  364. }
  365. //endregion
  366. try {
  367. int studentId = welcomeStudentService.updateWelcomeStudent(student);
  368. if (studentId <= 0) {
  369. logger.error("编辑学生失败,参数:" + JSON.toJSON(usr));
  370. throw new Exception("编辑失败!");
  371. }
  372. int deleteF = welcomeFamilyService.deleteWelcomeFamilyByCard(student.getCardId());
  373. if (wfs != null && wfs.size() > 0) {
  374. boolean insertBatch = welcomeFamilyService.saveBatch(wfs);
  375. if (!insertBatch) {
  376. logger.error("编辑家庭成员失败,参数:" + JSON.toJSON(wfs));
  377. throw new Exception("编辑失败!");
  378. }
  379. }
  380. int deleteA = welcomeAccompanyService.deleteWelcomeAccompanyByCard(student.getCardId());
  381. if (was != null && was.size() > 0) {
  382. boolean insertBatch = welcomeAccompanyService.saveBatch(was);
  383. if (!insertBatch) {
  384. logger.error("编辑陪同人员失败,参数:" + JSON.toJSON(was));
  385. throw new Exception("编辑失败!");
  386. }
  387. }
  388. boolean updateBatch = welcomeBedService.updateBatchById(bedDatas);
  389. if (!updateBatch) {
  390. logger.error("添加宿舍信息失败,参数:" + JSON.toJSON(bedDatas));
  391. throw new Exception("添加失败!");
  392. }
  393. } catch (Exception e) {
  394. logger.error(e.getMessage());
  395. throw new Exception("编辑失败!");
  396. }
  397. return CommonResult.ok("编辑成功");
  398. }
  399. @Override
  400. public CommonResult queryPageStudents(int currentPage, int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
  401. PageUtils<StudentPageVo> result = welcomeStudentService.queryStudentPageList(currentPage, pageCount, collegeId, majorId, classstrId, trafficMethod, name);
  402. return CommonResult.ok(result);
  403. }
  404. @Override
  405. public CommonResult queryStudentDetail(int id) {
  406. StudentDetailVo result = new StudentDetailVo();
  407. WelcomeStudent ws = welcomeStudentService.getManageById(id);
  408. if (ws == null) {
  409. return CommonResult.ok("学生信息已失效,查看失败!");
  410. }
  411. //家庭成员
  412. List<FamilyVo> fvs = new ArrayList<>();
  413. List<WelcomeFamily> familys = welcomeFamilyService.getManageByCardId(ws.getCardId());
  414. if (familys != null && familys.size() > 0) {
  415. for (WelcomeFamily wf : familys) {
  416. FamilyVo fv = new FamilyVo();
  417. fv.setId(wf.getId());
  418. fv.setFamilyShip(wf.getFamilyShip());
  419. fv.setName(wf.getName());
  420. fv.setPhone(wf.getPhone());
  421. fv.setWorkUnit(wf.getWorkUnit());
  422. fvs.add(fv);
  423. }
  424. }
  425. result.setFvs(fvs);
  426. //陪同人员
  427. List<AccompanyVo> avs = new ArrayList<>();
  428. List<WelcomeAccompany> accompanys = welcomeAccompanyService.getManageByCardId(ws.getCardId());
  429. if (accompanys != null && accompanys.size() > 0) {
  430. for (WelcomeAccompany ac : accompanys) {
  431. AccompanyVo av = new AccompanyVo();
  432. av.setId(ac.getId());
  433. av.setName(ac.getName());
  434. av.setPhone(ac.getPhone());
  435. avs.add(av);
  436. }
  437. }
  438. result.setAvs(avs);
  439. //宿舍信息
  440. WelcomeBed wsd = welcomeBedService.getBedByCardId(ws.getCardId());
  441. if (wsd != null) {
  442. result.setBuild(wsd.getBuild());
  443. result.setBuildId(wsd.getBuildId());
  444. result.setDormitory(wsd.getDormitory());//寝室号
  445. result.setDormitoryId(wsd.getDormitoryId());//寝室号
  446. result.setBed(String.valueOf(wsd.getNumber()));//床位号
  447. result.setBedId(wsd.getId());//床位号
  448. }
  449. //时间段
  450. List<ArriveTimeVo> atvs = new ArrayList<>();
  451. List<WelcomeArriveSetting> wass = welcomeArriveSettingService.queryCheckDatas();
  452. if (wass != null && wass.size() > 0) {
  453. for (WelcomeArriveSetting was : wass) {
  454. ArriveTimeVo atv = new ArriveTimeVo();
  455. atv.setId(was.getId());
  456. atv.setStartTime(was.getStartTime());
  457. atv.setEndTime(was.getEndTime());
  458. atv.setTimeStr(was.getStartTime() + "-" + was.getEndTime());
  459. atv.setIsCheck((ws.getArriveTimeId() != null && was.getId().equals(ws.getArriveTimeId())) ? 1 : 0);
  460. atvs.add(atv);
  461. }
  462. }
  463. result.setAtvs(atvs);
  464. result.setId(ws.getId());
  465. result.setSchool(ws.getSchool());
  466. result.setSchoolId(ws.getSchoolId());
  467. result.setAdmissNum(ws.getAdmissNum());
  468. result.setName(ws.getName());
  469. result.setPicture(ws.getPicture());
  470. result.setCardId(ws.getCardId());
  471. result.setSex(ws.getSex());
  472. result.setBirthday(ws.getBirthday());
  473. result.setCollege(ws.getCollege());
  474. result.setMajor(ws.getMajor());
  475. result.setClassstr(ws.getClassstr());
  476. result.setCollegeId(ws.getCollegeId());
  477. result.setMajorId(ws.getMajorId());
  478. result.setClassstrId(ws.getClassstrId());
  479. result.setExamNum(ws.getExamNum());
  480. result.setEduSystem(ws.getEduSystem());
  481. result.setGraduationSchool(ws.getGraduationSchool());
  482. result.setBatchValue(ws.getBatchValue());
  483. result.setPoliticalStatu(ws.getPoliticalStatu());
  484. result.setNationality(ws.getNationality());
  485. result.setPhone(ws.getPhone());
  486. result.setOprovinceId(ws.getOprovinceId());
  487. result.setOprovince(ws.getOprovince());
  488. result.setOcityId(ws.getOcityId());
  489. result.setOcity(ws.getOcity());
  490. result.setOdistrictId(ws.getOdistrictId());
  491. result.setOdistrict(ws.getOdistrict());
  492. result.setProvinceId(ws.getProvinceId());
  493. result.setProvince(ws.getProvince());
  494. result.setCityId(ws.getCityId());
  495. result.setCity(ws.getCity());
  496. result.setDistrictId(ws.getDistrictId());
  497. result.setDistrict(ws.getDistrict());
  498. result.setAddress(ws.getAddress());
  499. result.setRegisterOntime(ws.getRegisterOntime());
  500. result.setZipCode(ws.getZipCode());
  501. result.setTrafficMethod(ws.getTrafficMethod());
  502. result.setArrive(ws.getArrive());
  503. result.setArrvieDate(ws.getArrvieDate());
  504. result.setArriveTime(ws.getArriveTime());
  505. result.setArriveTimeId(ws.getArriveTimeId());
  506. result.setAmountPayable(ws.getAmountPayable());
  507. result.setPayAmount(ws.getPayAmount());
  508. result.setIsDrive(ws.getIsDrive());
  509. result.setCarNumber(ws.getCarNumber());
  510. return CommonResult.ok(result);
  511. }
  512. @Override
  513. @Transactional(rollbackFor = {Exception.class})
  514. public CommonResult infoCollection(InfoCollectionRequest icr, BindingResult bindingResult) throws Exception {
  515. if (bindingResult.hasErrors()) {
  516. String st = paramUtils.getParamError(bindingResult);
  517. return CommonResult.fail(st);
  518. }
  519. WelcomeStudent ws = welcomeStudentService.getDataByIdcard(icr.getCardId());
  520. if (ws == null) {
  521. ws = new WelcomeStudent();
  522. }
  523. ws.setSchool(icr.getSchool());
  524. ws.setAdmissNum(icr.getAdmissNum());
  525. ws.setName(icr.getName());
  526. ws.setPicture(icr.getPicture());
  527. ws.setCardId(icr.getCardId());
  528. ws.setSex(icr.getSex());
  529. ws.setBirthday(icr.getBirthday());
  530. ws.setCollegeId(icr.getCollegeId());
  531. ws.setMajorId(icr.getMajorId());
  532. ws.setClassstrId(icr.getClassstrId());
  533. ws.setExamNum(icr.getExamNum());
  534. ws.setEduSystem(icr.getEduSystem());
  535. ws.setGraduationSchool(icr.getGraduationSchool());
  536. ws.setBatchValue(icr.getBatchValue());
  537. ws.setPoliticalStatu(icr.getPoliticalStatu());
  538. ws.setNationality(icr.getNationality());
  539. ws.setPhone(icr.getPhone());
  540. ws.setOprovinceId(icr.getOprovinceId());
  541. ws.setOprovince(icr.getOprovince());
  542. ws.setOcityId(icr.getOcityId());
  543. ws.setOcity(icr.getOcity());
  544. ws.setOdistrictId(icr.getOdistrictId());
  545. ws.setOdistrict(icr.getOdistrict());
  546. ws.setProvinceId(icr.getProvinceId());
  547. ws.setProvince(icr.getProvince());
  548. ws.setCityId(icr.getCityId());
  549. ws.setCity(icr.getCity());
  550. ws.setDistrictId(icr.getDistrictId());
  551. ws.setDistrict(icr.getDistrict());
  552. ws.setAddress(icr.getAddress());
  553. ws.setRegisterOntime(icr.getRegisterOntime());
  554. ws.setZipCode(icr.getZipCode());
  555. ws.setTrafficMethod(icr.getTrafficMethod());
  556. ws.setArrive(icr.getArrive());
  557. ws.setArrvieDate(icr.getArrvieDate());
  558. ws.setArriveTimeId(icr.getArriveTimeId());
  559. ws.setFillStatus("已填报");
  560. //家庭成员
  561. List<WelcomeFamily> wfs = new ArrayList<>();
  562. if (icr.getFvs() != null && icr.getFvs().size() > 0) {
  563. for (FamilyVo fv : icr.getFvs()) {
  564. if(!(StringUtils.hasText(fv.getName()) && StringUtils.hasText(fv.getPhone()) && StringUtils.hasText(fv.getWorkUnit()) && StringUtils.hasText(fv.getFamilyShip()))){
  565. return CommonResult.fail("家庭成员信息不能为空!");
  566. }
  567. WelcomeFamily wf = new WelcomeFamily();
  568. wf.setName(fv.getName());
  569. wf.setPhone(fv.getPhone());
  570. wf.setWorkUnit(fv.getWorkUnit());
  571. wf.setFamilyShip(fv.getFamilyShip());
  572. wf.setStudentCard(icr.getCardId());
  573. wfs.add(wf);
  574. }
  575. }
  576. //陪同人员
  577. List<WelcomeAccompany> was = new ArrayList<>();
  578. if (icr.getAvs() != null && icr.getAvs().size() > 0) {
  579. for (AccompanyVo av : icr.getAvs()) {
  580. if(!(StringUtils.hasText(av.getName()) && StringUtils.hasText(av.getPhone()))){
  581. return CommonResult.fail("家庭成员信息不能为空!");
  582. }
  583. WelcomeAccompany wa = new WelcomeAccompany();
  584. wa.setName(av.getName());
  585. wa.setPhone(av.getPhone());
  586. wa.setStudentCard(icr.getCardId());
  587. was.add(wa);
  588. }
  589. }
  590. try {
  591. System.out.println("信息采集1");
  592. boolean resultWs = welcomeStudentService.saveOrUpdate(ws);
  593. System.out.println("信息采集1.2");
  594. if (!resultWs) {
  595. System.out.println("信息采集1.1");
  596. logger.error("采集学生信息失败,ws参数:" + JSON.toJSON(ws));
  597. throw new Exception("采集学生信息失败!");
  598. }
  599. System.out.println("信息采集2");
  600. boolean resultWf = welcomeFamilyService.saveBatch(wfs);
  601. System.out.println("信息采集1.3");
  602. if (!resultWf) {
  603. System.out.println("信息采集1.4");
  604. logger.error("采集学生信息失败,wfs参数:" + JSON.toJSON(wfs));
  605. throw new Exception("采集学生信息失败!");
  606. }
  607. System.out.println("信息采集3");
  608. boolean resultWa = welcomeAccompanyService.saveBatch(was);
  609. System.out.println("信息采集1.5");
  610. if (!resultWa) {
  611. System.out.println("信息采集1.6");
  612. logger.error("采集学生信息失败,was参数:" + JSON.toJSON(was));
  613. throw new Exception("采集学生信息失败!");
  614. }
  615. } catch (Exception e) {
  616. logger.error(e.getMessage());
  617. throw new Exception("采集失败!");
  618. }
  619. return CommonResult.ok("采集完成!");
  620. }
  621. @Override
  622. @Transactional(rollbackFor = {Exception.class})
  623. public CommonResult deleteStudentInfo(int id) throws Exception {
  624. WelcomeStudent ws = welcomeStudentService.getManageById(id);
  625. if (ws == null) {
  626. return CommonResult.fail("学生信息已失效,无法进行删除操作!");
  627. }
  628. //把旧床位清空
  629. WelcomeBed obedData = welcomeBedService.getBedByCardId(ws.getCardId());
  630. if (obedData != null) {
  631. obedData.setStudentCard(null);
  632. obedData.setCollege(null);
  633. obedData.setCollegeId(null);
  634. obedData.setMajor(null);
  635. obedData.setMajorId(null);
  636. obedData.setClassstr(null);
  637. obedData.setClassstrId(null);
  638. obedData.setIsCheck(0);
  639. obedData.setCardNum(null);
  640. obedData.setName(null);
  641. }
  642. try {
  643. //删除学生数据
  644. int deleteStudent = welcomeStudentService.deleteWelcomeStudentById(id);
  645. if (deleteStudent <= 0) {
  646. logger.error("删除学生信息失败,id参数:" + JSON.toJSON(id));
  647. throw new Exception("删除学生信息失败!");
  648. }
  649. if (obedData != null) {
  650. //删除宿舍数据
  651. int deleteSd = welcomeBedService.updateWelcomeBed(obedData);
  652. if (deleteSd < 0) {
  653. logger.error("删除宿舍失败,obedData参数:" + JSON.toJSON(obedData));
  654. throw new Exception("删除学生信息失败!");
  655. }
  656. }
  657. //删除同行人员
  658. int deleteWa = welcomeAccompanyService.deleteWelcomeAccompanyByCard(ws.getCardId());
  659. //删除家庭成员
  660. int deletef = welcomeFamilyService.deleteWelcomeFamilyByCard(ws.getCardId());
  661. } catch (Exception e) {
  662. logger.error(e.getMessage());
  663. throw new Exception("删除失败!");
  664. }
  665. return CommonResult.ok("删除成功");
  666. }
  667. @Override
  668. public CommonResult importStudentExcel(MultipartFile file) throws IOException, ParseException {
  669. System.out.println("导入学生信息");
  670. if (file.isEmpty() || file.getSize() == 0) {
  671. return CommonResult.fail("导入文件不能为空");
  672. }
  673. String ContentType = file.getContentType();
  674. InputStream inputStream = file.getInputStream();
  675. List<WelcomeStudent> result = new ArrayList<>();
  676. //xls格式文件
  677. if (ContentType.equals(eFileType.Xls.getValue())) {
  678. CommonResult<List<WelcomeStudent>> resultData = readXls(inputStream);
  679. if (!resultData.isSuccess()) {
  680. return resultData;
  681. }
  682. result = resultData.getData();
  683. } else if (ContentType.equals(eFileType.Xlsx.getValue())) {
  684. CommonResult<List<WelcomeStudent>> resultData = readXlsx(inputStream);
  685. if (!resultData.isSuccess()) {
  686. return resultData;
  687. }
  688. result = resultData.getData();
  689. } else {
  690. return CommonResult.fail("学生信息数据导入只支持Xls或Xlsx格式文件");
  691. }
  692. List<String> cardIds = result.stream().map(WelcomeStudent::getCardId).collect(Collectors.toList());
  693. List<WelcomeStudent> existStudents = welcomeStudentService.queryStudentByCardId(cardIds);
  694. if (existStudents != null && existStudents.size() > 0) {
  695. for (WelcomeStudent ws : result) {
  696. Optional<WelcomeStudent> ows = existStudents.stream().filter(e -> e.getCardId().equals(ws.getCardId())).findFirst();
  697. if (ows != null && ows.isPresent()) {
  698. ws.setId(ows.get().getId());
  699. ws.setAdmissNum(ws.getAdmissNum());//录取号
  700. ws.setName(ws.getName());//姓名
  701. ws.setCardId(ws.getCardId());//身份证号
  702. ws.setSchool(ws.getSchool());//校区
  703. ws.setCollege(ws.getCollege());
  704. ws.setCollegeId(ws.getCollegeId());
  705. ws.setMajor(ws.getMajor());
  706. ws.setMajorId(ws.getMajorId());
  707. ws.setClassstr(ws.getClassstr());
  708. ws.setClassstrId(ws.getClassstrId());
  709. ws.setExamNum(ws.getExamNum());//考生号
  710. ws.setEduSystem(ws.getEduSystem());//学制
  711. ws.setGraduationSchool(ws.getGraduationSchool());//毕业中学
  712. ws.setBatchValue(ws.getBatchValue());//批次
  713. ws.setPoliticalStatu(ws.getPoliticalStatu());//政治面貌
  714. ws.setNationality(ws.getNationality());//民族
  715. ws.setPhone(ws.getPhone());//手机号码
  716. ws.setOprovince(ws.getOprovince());
  717. ws.setOprovinceId(ws.getOprovinceId());
  718. ws.setOcity(ws.getOcity());
  719. ws.setOcityId(ws.getOcityId());
  720. ws.setOdistrict(ws.getOdistrict());
  721. ws.setOdistrictId(ws.getOdistrictId());
  722. ws.setProvince(ws.getProvince());
  723. ws.setProvinceId(ws.getProvinceId());
  724. ws.setCity(ws.getCity());
  725. ws.setCityId(ws.getCityId());
  726. ws.setDistrict(ws.getDistrict());
  727. ws.setDistrictId(ws.getDistrictId());
  728. ws.setAddress(ws.getAddress());
  729. ws.setZipCode(ws.getZipCode());
  730. }
  731. }
  732. }
  733. boolean resultBool = welcomeStudentService.saveOrUpdateBatch(result);
  734. System.out.println("导入学生1");
  735. return resultBool ? CommonResult.ok("导入成功") : CommonResult.fail("导入失败");
  736. }
  737. /**
  738. * xls文件读取方法
  739. *
  740. * @param inputStream
  741. * @return
  742. * @throws IOException
  743. * @throws ParseException
  744. */
  745. private CommonResult<List<WelcomeStudent>> readXls(InputStream inputStream) throws IOException, ParseException {
  746. List<WelcomeStudent> result = new ArrayList<>();
  747. HSSFWorkbook sheets = new HSSFWorkbook(inputStream);
  748. List<WelcomeOrg> ws = welcomeOrgService.list(null);
  749. List<WelcomeCity> citys = welcomeCityService.list(null);
  750. //读取第一张sheet
  751. HSSFSheet sheetAt = sheets.getSheetAt(0);
  752. DataFormatter dataFormatter = new DataFormatter();
  753. try {
  754. //rowNum = 3 从第三行开始获取值
  755. //sheetAt.getLastRowNum():从0开始统计数量 所以得+1
  756. for (int rowNum = 0; rowNum < sheetAt.getLastRowNum() + 1; rowNum++) {
  757. HSSFRow row = sheetAt.getRow(rowNum);
  758. if (row != null) {
  759. //使用了getStringCellValue()方法来获取值,POI会判断单元格的类型,如果非字符串类型就会抛出上面的异常。
  760. //所以先使用setCellType()方法先将该单元格的类型设置为STRING
  761. //然后poi会根据字符串读取它
  762. //第一行数据获取月份
  763. if (rowNum == 0) {
  764. String number = dataFormatter.formatCellValue(row.getCell(0));//序号
  765. if (!number.equals("序号")) {
  766. return CommonResult.fail("导入数据第一列为序号");
  767. }
  768. String assNum = dataFormatter.formatCellValue(row.getCell(1));//录取号
  769. if (!assNum.equals("录取号")) {
  770. return CommonResult.fail("导入数据第二列为录取号");
  771. }
  772. String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
  773. if (!name.equals("姓名")) {
  774. return CommonResult.fail("导入数据第三列为姓名");
  775. }
  776. String cardId = dataFormatter.formatCellValue(row.getCell(3));//身份证号
  777. if (!cardId.equals("身份证号")) {
  778. return CommonResult.fail("导入数据第四列为身份证号");
  779. }
  780. String school = dataFormatter.formatCellValue(row.getCell(4));//校区
  781. if (!school.equals("校区")) {
  782. return CommonResult.fail("导入数据第五列为校区");
  783. }
  784. String college = dataFormatter.formatCellValue(row.getCell(5));//院系
  785. if (!college.equals("院系")) {
  786. return CommonResult.fail("导入数据第六列为院系");
  787. }
  788. String major = dataFormatter.formatCellValue(row.getCell(6));//专业
  789. if (!major.equals("专业")) {
  790. return CommonResult.fail("导入数据第七列为专业");
  791. }
  792. String classstr = dataFormatter.formatCellValue(row.getCell(7));//班级
  793. if (!classstr.equals("班级")) {
  794. return CommonResult.fail("导入数据第八列为班级");
  795. }
  796. String examNum = dataFormatter.formatCellValue(row.getCell(8));//考生号
  797. if (!examNum.equals("考生号")) {
  798. return CommonResult.fail("导入数据第九列为考生号");
  799. }
  800. String eduSystem = dataFormatter.formatCellValue(row.getCell(9));//学制
  801. if (!eduSystem.equals("学制")) {
  802. return CommonResult.fail("导入数据第十列为学制");
  803. }
  804. String graSchool = dataFormatter.formatCellValue(row.getCell(10));//毕业中学
  805. if (!graSchool.equals("毕业中学")) {
  806. return CommonResult.fail("导入数据第十一列为毕业中学批次");
  807. }
  808. String batchValue = dataFormatter.formatCellValue(row.getCell(11));//批次
  809. if (!batchValue.equals("批次")) {
  810. return CommonResult.fail("导入数据第十二列为批次");
  811. }
  812. String politicalStatu = dataFormatter.formatCellValue(row.getCell(12));//政治面貌
  813. if (!politicalStatu.equals("政治面貌")) {
  814. return CommonResult.fail("导入数据第十三列为政治面貌");
  815. }
  816. String nationality = dataFormatter.formatCellValue(row.getCell(13));//民族
  817. if (!nationality.equals("民族")) {
  818. return CommonResult.fail("导入数据第十四列为民族");
  819. }
  820. String phone = dataFormatter.formatCellValue(row.getCell(14));//手机号码
  821. if (!phone.equals("手机号码")) {
  822. return CommonResult.fail("导入数据第十五列为手机号码");
  823. }
  824. String nativePlace = dataFormatter.formatCellValue(row.getCell(15));//籍贯
  825. if (!nativePlace.contains("籍贯")) {
  826. return CommonResult.fail("导入数据第十六列为籍贯");
  827. }
  828. String addressPlace = dataFormatter.formatCellValue(row.getCell(16));//家庭住址
  829. if (!addressPlace.contains("家庭住址")) {
  830. return CommonResult.fail("导入数据第十七列为家庭住址");
  831. }
  832. String addressDetail = dataFormatter.formatCellValue(row.getCell(17));//详细住址
  833. if (!addressDetail.equals("详细住址")) {
  834. return CommonResult.fail("导入数据第十八列为详细住址");
  835. }
  836. String zipCode = dataFormatter.formatCellValue(row.getCell(18));//邮编
  837. if (!zipCode.equals("邮编")) {
  838. return CommonResult.fail("导入数据第十九列为邮编");
  839. }
  840. } else {
  841. WelcomeStudent studentData = new WelcomeStudent();
  842. String assNum = dataFormatter.formatCellValue(row.getCell(1));//录取号
  843. if(!StringUtils.hasText(assNum)){
  844. break;
  845. }
  846. studentData.setAdmissNum(assNum);
  847. String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
  848. studentData.setName(name);
  849. String cardId = dataFormatter.formatCellValue(row.getCell(3));//身份证号
  850. studentData.setCardId(cardId);
  851. String school = dataFormatter.formatCellValue(row.getCell(4));//校区
  852. studentData.setSchool(school);
  853. //region 院系专业
  854. String college = dataFormatter.formatCellValue(row.getCell(5));//院系
  855. Optional<WelcomeOrg> owo = ws.stream().filter(e -> e.getName().equals(college)).findFirst();
  856. if (owo != null && owo.isPresent()) {
  857. studentData.setCollege(college);
  858. studentData.setCollegeId(owo.get().getId());
  859. }
  860. String major = dataFormatter.formatCellValue(row.getCell(6));//专业
  861. Optional<WelcomeOrg> omwo = ws.stream().filter(e -> e.getName().equals(major)).findFirst();
  862. if (omwo != null && omwo.isPresent()) {
  863. studentData.setMajor(major);
  864. studentData.setMajorId(omwo.get().getId());
  865. }
  866. String classstr = dataFormatter.formatCellValue(row.getCell(7));//班级
  867. Optional<WelcomeOrg> ocwo = ws.stream().filter(e -> e.getName().equals(classstr)).findFirst();
  868. if (ocwo != null && ocwo.isPresent()) {
  869. studentData.setClassstr(classstr);
  870. studentData.setClassstrId(ocwo.get().getId());
  871. }
  872. //endregion
  873. String examNum = dataFormatter.formatCellValue(row.getCell(8));//考生号
  874. studentData.setExamNum(examNum);
  875. String eduSystem = dataFormatter.formatCellValue(row.getCell(9));//学制
  876. studentData.setEduSystem(eduSystem);
  877. String graSchool = dataFormatter.formatCellValue(row.getCell(10));//毕业中学
  878. studentData.setGraduationSchool(graSchool);
  879. String batchValue = dataFormatter.formatCellValue(row.getCell(11));//批次
  880. studentData.setBatchValue(batchValue);
  881. String politicalStatu = dataFormatter.formatCellValue(row.getCell(12));//政治面貌
  882. studentData.setPoliticalStatu(politicalStatu);
  883. String nationality = dataFormatter.formatCellValue(row.getCell(13));//民族
  884. studentData.setNationality(nationality);
  885. String phone = dataFormatter.formatCellValue(row.getCell(14));//手机号码
  886. studentData.setPhone(phone);
  887. //region 籍贯
  888. String nativePlace = dataFormatter.formatCellValue(row.getCell(15));//籍贯
  889. String[] addressDatas = nativePlace.split("/");
  890. if (citys != null && citys.size() > 0) {
  891. if (addressDatas != null && addressDatas.length >= 1) {
  892. if (!addressDatas[0].contains("省")) {
  893. return CommonResult.fail("录取编号为\" + assNum + \"的籍贯格式应该是 省/市/县");
  894. }
  895. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressDatas[0])).findFirst();
  896. if (oProvince != null && oProvince.isPresent()) {
  897. studentData.setOprovince(addressDatas[0]);
  898. studentData.setOprovinceId(oProvince.get().getId());
  899. } else {
  900. return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县区");
  901. }
  902. }
  903. if (addressDatas != null && addressDatas.length >= 2) {
  904. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressDatas[1])).findFirst();
  905. if (oProvince != null && oProvince.isPresent()) {
  906. studentData.setOcity(addressDatas[1]);
  907. studentData.setOcityId(oProvince.get().getId());
  908. } else {
  909. return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县区");
  910. }
  911. }
  912. if (addressDatas != null && addressDatas.length >= 3) {
  913. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getCityZh().equals(addressDatas[1]) && e.getDistrictZh().equals(addressDatas[2])).findFirst();
  914. if (oProvince != null && oProvince.isPresent()) {
  915. studentData.setOdistrict(addressDatas[2]);
  916. studentData.setOdistrictId(oProvince.get().getId());
  917. } else {
  918. return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县区");
  919. }
  920. }
  921. }
  922. //endregion
  923. //region 家庭住址
  924. String addressPlace = dataFormatter.formatCellValue(row.getCell(16));//家庭住址
  925. String[] addressPlaces = addressPlace.split("/");
  926. if (citys != null && citys.size() > 0) {
  927. if (addressPlaces != null && addressPlaces.length >= 1) {
  928. if (!addressPlaces[0].contains("省")) {
  929. return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县区");
  930. }
  931. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressPlaces[0])).findFirst();
  932. if (oProvince != null && oProvince.isPresent()) {
  933. studentData.setProvince(addressPlaces[0]);
  934. studentData.setProvinceId(oProvince.get().getId());
  935. } else {
  936. return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县区");
  937. }
  938. }
  939. if (addressPlaces != null && addressPlaces.length >= 2) {
  940. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressPlaces[1])).findFirst();
  941. if (oProvince != null && oProvince.isPresent()) {
  942. studentData.setCity(addressPlaces[1]);
  943. studentData.setCityId(oProvince.get().getId());
  944. } else {
  945. return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县区");
  946. }
  947. }
  948. if (addressPlaces != null && addressPlaces.length >= 3) {
  949. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getCityZh().equals(addressPlaces[1]) && e.getDistrictZh().equals(addressPlaces[2])).findFirst();
  950. if (oProvince != null && oProvince.isPresent()) {
  951. studentData.setDistrict(addressPlaces[2]);
  952. studentData.setDistrictId(oProvince.get().getId());
  953. } else {
  954. return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县区");
  955. }
  956. }
  957. }
  958. //endregion
  959. String addressDetail = dataFormatter.formatCellValue(row.getCell(17));//详细住址
  960. studentData.setAddress(addressDetail);
  961. String zipCode = dataFormatter.formatCellValue(row.getCell(18));//邮编
  962. studentData.setZipCode(zipCode);
  963. studentData.setIdenType(1);
  964. studentData.setFillStatus("未填报");
  965. result.add(studentData);
  966. }
  967. }
  968. }
  969. } catch (Exception e) {
  970. return CommonResult.fail("请按模板格式导入数据");
  971. }
  972. return CommonResult.ok(result);
  973. }
  974. /**
  975. * xls文件读取方法
  976. *
  977. * @param inputStream
  978. * @return
  979. * @throws IOException
  980. * @throws ParseException
  981. */
  982. private CommonResult<List<WelcomeStudent>> readXlsx(InputStream inputStream) throws IOException, ParseException {
  983. List<WelcomeStudent> result = new ArrayList<>();
  984. XSSFWorkbook sheets = new XSSFWorkbook(inputStream);
  985. List<WelcomeOrg> ws = welcomeOrgService.list(null);
  986. List<WelcomeCity> citys = welcomeCityService.list(null);
  987. //读取第一张sheet
  988. XSSFSheet sheetAt = sheets.getSheetAt(0);
  989. DataFormatter dataFormatter = new DataFormatter();
  990. try {
  991. //rowNum = 3 从第三行开始获取值
  992. //sheetAt.getLastRowNum():从0开始统计数量 所以得+1
  993. for (int rowNum = 0; rowNum < sheetAt.getLastRowNum() + 1; rowNum++) {
  994. XSSFRow row = sheetAt.getRow(rowNum);
  995. if (row != null) {
  996. //使用了getStringCellValue()方法来获取值,POI会判断单元格的类型,如果非字符串类型就会抛出上面的异常。
  997. //所以先使用setCellType()方法先将该单元格的类型设置为STRING
  998. //然后poi会根据字符串读取它
  999. //第一行数据获取月份
  1000. if (rowNum == 0) {
  1001. String number = dataFormatter.formatCellValue(row.getCell(0));//序号
  1002. if (!number.equals("序号")) {
  1003. return CommonResult.fail("导入数据第一列为序号");
  1004. }
  1005. String assNum = dataFormatter.formatCellValue(row.getCell(1));//录取号
  1006. if (!assNum.equals("录取号")) {
  1007. return CommonResult.fail("导入数据第二列为录取号");
  1008. }
  1009. String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
  1010. if (!name.equals("姓名")) {
  1011. return CommonResult.fail("导入数据第三列为姓名");
  1012. }
  1013. String cardId = dataFormatter.formatCellValue(row.getCell(3));//身份证号
  1014. if (!cardId.equals("身份证号")) {
  1015. return CommonResult.fail("导入数据第四列为身份证号");
  1016. }
  1017. String school = dataFormatter.formatCellValue(row.getCell(4));//校区
  1018. if (!school.equals("校区")) {
  1019. return CommonResult.fail("导入数据第五列为校区");
  1020. }
  1021. String college = dataFormatter.formatCellValue(row.getCell(5));//院系
  1022. if (!college.equals("院系")) {
  1023. return CommonResult.fail("导入数据第六列为院系");
  1024. }
  1025. String major = dataFormatter.formatCellValue(row.getCell(6));//专业
  1026. if (!major.equals("专业")) {
  1027. return CommonResult.fail("导入数据第七列为专业");
  1028. }
  1029. String classstr = dataFormatter.formatCellValue(row.getCell(7));//班级
  1030. if (!classstr.equals("班级")) {
  1031. return CommonResult.fail("导入数据第八列为班级");
  1032. }
  1033. String examNum = dataFormatter.formatCellValue(row.getCell(8));//考生号
  1034. if (!examNum.equals("考生号")) {
  1035. return CommonResult.fail("导入数据第九列为考生号");
  1036. }
  1037. String eduSystem = dataFormatter.formatCellValue(row.getCell(9));//学制
  1038. if (!eduSystem.equals("学制")) {
  1039. return CommonResult.fail("导入数据第十列为学制");
  1040. }
  1041. String graSchool = dataFormatter.formatCellValue(row.getCell(10));//毕业中学
  1042. if (!graSchool.equals("毕业中学")) {
  1043. return CommonResult.fail("导入数据第十一列为毕业中学批次");
  1044. }
  1045. String batchValue = dataFormatter.formatCellValue(row.getCell(11));//批次
  1046. if (!batchValue.equals("批次")) {
  1047. return CommonResult.fail("导入数据第十二列为批次");
  1048. }
  1049. String politicalStatu = dataFormatter.formatCellValue(row.getCell(12));//政治面貌
  1050. if (!politicalStatu.equals("政治面貌")) {
  1051. return CommonResult.fail("导入数据第十三列为政治面貌");
  1052. }
  1053. String nationality = dataFormatter.formatCellValue(row.getCell(13));//民族
  1054. if (!nationality.equals("民族")) {
  1055. return CommonResult.fail("导入数据第十四列为民族");
  1056. }
  1057. String phone = dataFormatter.formatCellValue(row.getCell(14));//手机号码
  1058. if (!phone.equals("手机号码")) {
  1059. return CommonResult.fail("导入数据第十五列为手机号码");
  1060. }
  1061. String nativePlace = dataFormatter.formatCellValue(row.getCell(15));//籍贯
  1062. if (!nativePlace.contains("籍贯")) {
  1063. return CommonResult.fail("导入数据第十六列为籍贯");
  1064. }
  1065. String addressPlace = dataFormatter.formatCellValue(row.getCell(16));//家庭住址
  1066. if (!addressPlace.contains("家庭住址")) {
  1067. return CommonResult.fail("导入数据第十七列为家庭住址");
  1068. }
  1069. String addressDetail = dataFormatter.formatCellValue(row.getCell(17));//详细住址
  1070. if (!addressDetail.equals("详细住址")) {
  1071. return CommonResult.fail("导入数据第十八列为详细住址");
  1072. }
  1073. String zipCode = dataFormatter.formatCellValue(row.getCell(18));//邮编
  1074. if (!zipCode.equals("邮编")) {
  1075. return CommonResult.fail("导入数据第十九列为邮编");
  1076. }
  1077. } else {
  1078. WelcomeStudent studentData = new WelcomeStudent();
  1079. String assNum = dataFormatter.formatCellValue(row.getCell(1));//录取号
  1080. if(!StringUtils.hasText(assNum)){
  1081. break;
  1082. }
  1083. studentData.setAdmissNum(assNum);
  1084. String name = dataFormatter.formatCellValue(row.getCell(2));//姓名
  1085. studentData.setName(name);
  1086. String cardId = dataFormatter.formatCellValue(row.getCell(3));//身份证号
  1087. studentData.setCardId(cardId);
  1088. String school = dataFormatter.formatCellValue(row.getCell(4));//校区
  1089. studentData.setSchool(school);
  1090. //region 院系专业
  1091. String college = dataFormatter.formatCellValue(row.getCell(5));//院系
  1092. Optional<WelcomeOrg> owo = ws.stream().filter(e -> e.getName().equals(college)).findFirst();
  1093. if (owo != null && owo.isPresent()) {
  1094. studentData.setCollege(college);
  1095. studentData.setCollegeId(owo.get().getId());
  1096. }
  1097. String major = dataFormatter.formatCellValue(row.getCell(6));//专业
  1098. Optional<WelcomeOrg> omwo = ws.stream().filter(e -> e.getName().equals(major)).findFirst();
  1099. if (omwo != null && omwo.isPresent()) {
  1100. studentData.setMajor(major);
  1101. studentData.setMajorId(omwo.get().getId());
  1102. }
  1103. String classstr = dataFormatter.formatCellValue(row.getCell(7));//班级
  1104. Optional<WelcomeOrg> ocwo = ws.stream().filter(e -> e.getName().equals(classstr)).findFirst();
  1105. if (ocwo != null && ocwo.isPresent()) {
  1106. studentData.setClassstr(classstr);
  1107. studentData.setClassstrId(ocwo.get().getId());
  1108. }
  1109. //endregion
  1110. String examNum = dataFormatter.formatCellValue(row.getCell(8));//考生号
  1111. studentData.setExamNum(examNum);
  1112. String eduSystem = dataFormatter.formatCellValue(row.getCell(9));//学制
  1113. studentData.setEduSystem(eduSystem);
  1114. String graSchool = dataFormatter.formatCellValue(row.getCell(10));//毕业中学
  1115. studentData.setGraduationSchool(graSchool);
  1116. String batchValue = dataFormatter.formatCellValue(row.getCell(11));//批次
  1117. studentData.setBatchValue(batchValue);
  1118. String politicalStatu = dataFormatter.formatCellValue(row.getCell(12));//政治面貌
  1119. studentData.setPoliticalStatu(politicalStatu);
  1120. String nationality = dataFormatter.formatCellValue(row.getCell(13));//民族
  1121. studentData.setNationality(nationality);
  1122. String phone = dataFormatter.formatCellValue(row.getCell(14));//手机号码
  1123. studentData.setPhone(phone);
  1124. //region 籍贯
  1125. String nativePlace = dataFormatter.formatCellValue(row.getCell(15));//籍贯
  1126. String[] addressDatas = nativePlace.split("/");
  1127. if (citys != null && citys.size() > 0) {
  1128. if (addressDatas != null && addressDatas.length >= 1) {
  1129. if (!addressDatas[0].contains("省")) {
  1130. return CommonResult.fail("录取编号为\" + assNum + \"的籍贯格式应该是 省/市/县区");
  1131. }
  1132. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressDatas[0])).findFirst();
  1133. if (oProvince != null && oProvince.isPresent()) {
  1134. studentData.setOprovince(addressDatas[0]);
  1135. studentData.setOprovinceId(oProvince.get().getId());
  1136. } else {
  1137. return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县区");
  1138. }
  1139. }
  1140. if (addressDatas != null && addressDatas.length >= 2) {
  1141. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressDatas[1])).findFirst();
  1142. if (oProvince != null && oProvince.isPresent()) {
  1143. studentData.setOcity(addressDatas[1]);
  1144. studentData.setOcityId(oProvince.get().getId());
  1145. } else {
  1146. return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县区");
  1147. }
  1148. }
  1149. if (addressDatas != null && addressDatas.length >= 3) {
  1150. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getCityZh().equals(addressDatas[1]) && e.getDistrictZh().equals(addressDatas[2])).findFirst();
  1151. if (oProvince != null && oProvince.isPresent()) {
  1152. studentData.setOdistrict(addressDatas[2]);
  1153. studentData.setOdistrictId(oProvince.get().getId());
  1154. } else {
  1155. return CommonResult.fail("录取编号为" + assNum + "的籍贯格式应该是 省/市/县区");
  1156. }
  1157. }
  1158. }
  1159. //endregion
  1160. //region 家庭住址
  1161. String addressPlace = dataFormatter.formatCellValue(row.getCell(16));//家庭住址
  1162. String[] addressPlaces = addressPlace.split("/");
  1163. if (citys != null && citys.size() > 0) {
  1164. if (addressPlaces != null && addressPlaces.length >= 1) {
  1165. if (!addressPlaces[0].contains("省")) {
  1166. return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县区");
  1167. }
  1168. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressPlaces[0])).findFirst();
  1169. if (oProvince != null && oProvince.isPresent()) {
  1170. studentData.setProvince(addressPlaces[0]);
  1171. studentData.setProvinceId(oProvince.get().getId());
  1172. } else {
  1173. return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县区");
  1174. }
  1175. }
  1176. if (addressPlaces != null && addressPlaces.length >= 2) {
  1177. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getDistrictZh().equals(addressPlaces[1])).findFirst();
  1178. if (oProvince != null && oProvince.isPresent()) {
  1179. studentData.setCity(addressPlaces[1]);
  1180. studentData.setCityId(oProvince.get().getId());
  1181. } else {
  1182. return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县区");
  1183. }
  1184. }
  1185. if (addressPlaces != null && addressPlaces.length >= 3) {
  1186. Optional<WelcomeCity> oProvince = citys.stream().filter(e -> e.getCityZh().equals(addressPlaces[1]) && e.getDistrictZh().equals(addressPlaces[2])).findFirst();
  1187. if (oProvince != null && oProvince.isPresent()) {
  1188. studentData.setDistrict(addressPlaces[2]);
  1189. studentData.setDistrictId(oProvince.get().getId());
  1190. } else {
  1191. return CommonResult.fail("录取编号为" + assNum + "的家庭住址格式应该是 省/市/县区");
  1192. }
  1193. }
  1194. }
  1195. //endregion
  1196. String addressDetail = dataFormatter.formatCellValue(row.getCell(17));//详细住址
  1197. studentData.setAddress(addressDetail);
  1198. String zipCode = dataFormatter.formatCellValue(row.getCell(18));//邮编
  1199. studentData.setZipCode(zipCode);
  1200. studentData.setIdenType(1);
  1201. studentData.setFillStatus("未填报");
  1202. result.add(studentData);
  1203. }
  1204. }
  1205. }
  1206. } catch (Exception e) {
  1207. return CommonResult.fail("请按模板格式导入数据");
  1208. }
  1209. return CommonResult.ok(result);
  1210. }
  1211. @Override
  1212. public CommonResult downloadStudentExcel() {
  1213. return CommonResult.ok("200", "操作成功", "https://chtech.ncjti.edu.cn/alumnus/homeimage/学生信息管理.xlsx");
  1214. }
  1215. @Override
  1216. public void welcomeStudentExport(HttpServletResponse response, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
  1217. List<StudentPageVo> result = welcomeStudentService.queryStudentList(collegeId, majorId, classstrId, trafficMethod, name);
  1218. //导出
  1219. Workbook workbook = new XSSFWorkbook();
  1220. Sheet sheet = workbook.createSheet("学生信息");
  1221. Row headerRow = sheet.createRow(0);
  1222. headerRow.createCell(0).setCellValue("序号");
  1223. headerRow.createCell(1).setCellValue("录取号");
  1224. headerRow.createCell(2).setCellValue("姓名");
  1225. headerRow.createCell(3).setCellValue("身份证号");
  1226. headerRow.createCell(4).setCellValue("院系");
  1227. headerRow.createCell(5).setCellValue("专业");
  1228. headerRow.createCell(6).setCellValue("班级");
  1229. headerRow.createCell(7).setCellValue("交通方式");
  1230. headerRow.createCell(8).setCellValue("到站地点");
  1231. headerRow.createCell(9).setCellValue("陪同人数");
  1232. headerRow.createCell(10).setCellValue("填报状态");
  1233. headerRow.createCell(11).setCellValue("应缴金额");
  1234. headerRow.createCell(12).setCellValue("实付金额");
  1235. headerRow.createCell(13).setCellValue("宿舍信息");
  1236. for (int i = 0; i < result.size(); i++) {
  1237. StudentPageVo studentData = result.get(i);
  1238. Row dataRow = sheet.createRow(i + 1);
  1239. dataRow.createCell(0).setCellValue(i + 1);
  1240. dataRow.createCell(1).setCellValue(studentData.getAdmissNum());
  1241. dataRow.createCell(2).setCellValue(studentData.getName());
  1242. dataRow.createCell(3).setCellValue(studentData.getCardId());
  1243. dataRow.createCell(4).setCellValue(studentData.getCollege());
  1244. dataRow.createCell(5).setCellValue(studentData.getMajor());
  1245. dataRow.createCell(6).setCellValue(studentData.getClassstr());
  1246. dataRow.createCell(7).setCellValue(studentData.getTrafficMethod());
  1247. dataRow.createCell(8).setCellValue(studentData.getArrive());
  1248. dataRow.createCell(9).setCellValue(studentData.getAccompanyNum());
  1249. dataRow.createCell(10).setCellValue(studentData.getFillStatus());
  1250. dataRow.createCell(11).setCellValue(String.valueOf(studentData.getAmountPayable()));
  1251. dataRow.createCell(12).setCellValue(String.valueOf(studentData.getPayAmount()));
  1252. dataRow.createCell(13).setCellValue(studentData.getDormitory());
  1253. }
  1254. // 将工作簿写入文件
  1255. ExcelUtils.excelDownload(workbook, "学生信息.xlsx", response);
  1256. }
  1257. @Override
  1258. public CommonResult studentOverview() {
  1259. QueryWrapper<WelcomeStudent> queryWrapper = new QueryWrapper<>();
  1260. queryWrapper.eq("iden_type",1);
  1261. queryWrapper.eq("fill_status","已填报");
  1262. // 报到总数
  1263. int studentTotal = welcomeStudentService.count(queryWrapper);
  1264. // 寝室总数
  1265. int dormitoryTotal = welcomeDormitoryService.count(new QueryWrapper<>());
  1266. int payCount=welcomeStudentService.payCount();
  1267. // 已入住寝室数
  1268. LambdaQueryWrapper<WelcomeDormitory> wrapper=new LambdaQueryWrapper<>();
  1269. wrapper.ne(WelcomeDormitory::getStatus,2);
  1270. int count = welcomeDormitoryService.count(wrapper);
  1271. LocalDateTime start = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
  1272. LocalDateTime end = start.plusDays(1);
  1273. DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
  1274. Integer visitorTotal=welcomeVisitorService.countTotal(start,end);
  1275. List<WelcomeSetting> wss = welcomeSettingService.list(null);
  1276. Integer carTotal =wss !=null && wss.size() > 0 ? wss.get(0).getCarNum() : 0;
  1277. StudentOverviewVo vo = new StudentOverviewVo();
  1278. vo.setEnrollmentTotal(6532);
  1279. vo.setStudentTotal(studentTotal);
  1280. vo.setPayCount(payCount);
  1281. vo.setDormitoryTotal(dormitoryTotal);
  1282. vo.setCheckInTotal(count);
  1283. vo.setVisitorTotal(visitorTotal);
  1284. vo.setCarTotal(carTotal);
  1285. return CommonResult.ok(vo);
  1286. }
  1287. @Override
  1288. public CommonResult studentRegister() {
  1289. // 获取总数
  1290. Integer count = welcomeStudentService.totalCount();
  1291. List<StudentRegisterVo> vos = welcomeStudentService.studentRegister();
  1292. StudentRegisterVo vo = new StudentRegisterVo();
  1293. vo.setCollegeName("报到总数");
  1294. vo.setCount(count);
  1295. vos.add(vo);
  1296. return CommonResult.ok(vos);
  1297. }
  1298. @Override
  1299. public CommonResult studentTraffic() {
  1300. List<StudentTrafficVo> vos = welcomeStudentService.studentTraffic();
  1301. return CommonResult.ok(vos);
  1302. }
  1303. @Override
  1304. public CommonResult studentSexRatio() {
  1305. Integer manCount = welcomeStudentService.genderCount("男");
  1306. Integer girlCount = welcomeStudentService.genderCount("女");
  1307. StudentSexRatioVo vo = new StudentSexRatioVo();
  1308. vo.setCollegeName("全部");
  1309. vo.setManCount(manCount);
  1310. vo.setGirlCount(girlCount);
  1311. List<StudentSexRatioVo> vos = welcomeStudentService.studentSexRatio();
  1312. vos.add(vo);
  1313. return CommonResult.ok(vos);
  1314. }
  1315. @Override
  1316. public CommonResult studentStay() {
  1317. ArrayList<StudentStayVo> vos = new ArrayList<>();
  1318. List<WelcomeSchool> list = welcomeSchoolService.list(new QueryWrapper<>());
  1319. for (WelcomeSchool welcomeSchool : list) {
  1320. Integer schoolId = welcomeSchool.getId();
  1321. List<WelcomeBuild> builds=welcomeBuildService.getBuild(schoolId);
  1322. for (WelcomeBuild build : builds) {
  1323. Integer buildId = build.getId();
  1324. StudentStayVo vo =welcomeDormitoryService.getTotalCount(buildId);
  1325. vo.setSchoolName(welcomeSchool.getSchool());
  1326. vo.setBuildName(build.getBuild());
  1327. vos.add(vo);
  1328. }
  1329. }
  1330. return CommonResult.ok(vos);
  1331. }
  1332. @Override
  1333. public CommonResult queryStudentByToken( String userId) {
  1334. WelcomeStudent student = welcomeStudentService.getManageById(Integer.valueOf(userId));
  1335. return CommonResult.ok(student);
  1336. }
  1337. }