PaperServiceImpl.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. package cn.com.qmth.mps.service.impl;
  2. import java.io.IOException;
  3. import java.io.InputStream;
  4. import java.util.ArrayList;
  5. import java.util.Comparator;
  6. import java.util.HashMap;
  7. import java.util.List;
  8. import java.util.Map;
  9. import java.util.stream.Collectors;
  10. import org.apache.commons.collections4.CollectionUtils;
  11. import org.apache.commons.lang3.StringUtils;
  12. import org.springframework.beans.BeanUtils;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.dao.DuplicateKeyException;
  15. import org.springframework.stereotype.Service;
  16. import org.springframework.transaction.annotation.Transactional;
  17. import org.springframework.transaction.interceptor.TransactionAspectSupport;
  18. import org.springframework.web.multipart.MultipartFile;
  19. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  20. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  21. import com.baomidou.mybatisplus.core.metadata.IPage;
  22. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  23. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  24. import com.qmth.boot.core.collection.PageResult;
  25. import com.qmth.boot.core.exception.StatusException;
  26. import com.qmth.boot.tools.excel.ExcelReader;
  27. import com.qmth.boot.tools.excel.enums.ExcelType;
  28. import com.qmth.boot.tools.excel.model.DataMap;
  29. import cn.com.qmth.mps.bean.PaperDetail;
  30. import cn.com.qmth.mps.bean.PaperDetailUnit;
  31. import cn.com.qmth.mps.bean.User;
  32. import cn.com.qmth.mps.dao.PaperDao;
  33. import cn.com.qmth.mps.entity.CourseEntity;
  34. import cn.com.qmth.mps.entity.ExamEntity;
  35. import cn.com.qmth.mps.entity.PaperEntity;
  36. import cn.com.qmth.mps.enums.ExamStatus;
  37. import cn.com.qmth.mps.enums.Role;
  38. import cn.com.qmth.mps.service.CourseService;
  39. import cn.com.qmth.mps.service.ExamService;
  40. import cn.com.qmth.mps.service.PaperDetailService;
  41. import cn.com.qmth.mps.service.PaperGroupService;
  42. import cn.com.qmth.mps.service.PaperService;
  43. import cn.com.qmth.mps.util.BatchSetDataUtil;
  44. import cn.com.qmth.mps.util.Calculator;
  45. import cn.com.qmth.mps.util.PageUtil;
  46. import cn.com.qmth.mps.vo.exam.ExamPaperCountVo;
  47. import cn.com.qmth.mps.vo.paper.GroupCountVo;
  48. import cn.com.qmth.mps.vo.paper.PaperInfoVo;
  49. import cn.com.qmth.mps.vo.paper.PaperQuery;
  50. import cn.com.qmth.mps.vo.paper.PaperStructInfoVo;
  51. import cn.com.qmth.mps.vo.paper.PaperVo;
  52. import cn.com.qmth.mps.vo.paper.StructDomain;
  53. @Service
  54. public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> implements PaperService {
  55. @Autowired
  56. private ExamService examService;
  57. @Autowired
  58. private CourseService courseService;
  59. @Autowired
  60. private PaperGroupService paperGroupService;
  61. @Autowired
  62. private PaperDetailService paperDetailService;
  63. @Transactional
  64. @Override
  65. public List<String> importPaper(Long examId, User user, MultipartFile file) {
  66. ExamEntity exam = examService.getById(examId);
  67. if (exam == null) {
  68. throw new StatusException("未找到考试批次");
  69. }
  70. if(!ExamStatus.EDIT.equals(exam.getExamStatus())) {
  71. throw new StatusException("考试未开放上报,不能设置结构信息或分组信息");
  72. }
  73. if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(exam.getSchoolId())) {
  74. throw new StatusException("没有权限");
  75. }
  76. InputStream inputStream = null;
  77. try {
  78. inputStream = file.getInputStream();
  79. List<DataMap> lineList = ExcelReader.create(ExcelType.XLSX, inputStream, 0).getDataMapList();
  80. if (CollectionUtils.isEmpty(lineList)) {
  81. throw new StatusException("Excel无内容");
  82. }
  83. if (1001 < lineList.size()) {
  84. throw new StatusException("数据行数不能超过1000");
  85. }
  86. List<String> failRecords = new ArrayList<>();
  87. List<PaperEntity> ret = new ArrayList<>();
  88. for (int i = 0; i < lineList.size(); i++) {
  89. DataMap line = lineList.get(i);
  90. StringBuilder msg = new StringBuilder();
  91. PaperEntity imp = new PaperEntity();
  92. imp.setTotalScore(0.0);
  93. imp.setObjectiveScore(0.0);
  94. imp.setSubjectiveScore(0.0);
  95. imp.setSchoolId(exam.getSchoolId());
  96. imp.setGroupFinish(false);
  97. imp.setStructFinish(false);
  98. imp.setExamId(examId);
  99. String code = trimAndNullIfBlank(line.getValue(0));
  100. if (StringUtils.isBlank(code)) {
  101. msg.append(" 科目代码不能为空");
  102. } else if (code.length() > 20) {
  103. msg.append(" 科目代码不能超过20个字符");
  104. }
  105. String name = trimAndNullIfBlank(line.getValue(1));
  106. if (StringUtils.isBlank(name)) {
  107. msg.append(" 科目名称不能为空");
  108. } else if (name.length() > 20) {
  109. msg.append(" 科目名称不能超过20个字符");
  110. }
  111. if (msg.length() == 0) {
  112. CourseEntity course = courseService.saveOrGet(exam.getSchoolId(), code, name);
  113. imp.setCourseId(course.getId());
  114. }
  115. if (msg.length() > 0) {
  116. failRecords.add(newError(i + 1, msg.toString()));
  117. } else {
  118. ret.add(imp);
  119. }
  120. }
  121. if (CollectionUtils.isNotEmpty(failRecords)) {
  122. return failRecords;
  123. }
  124. for (int i = 0; i < ret.size(); i++) {
  125. PaperEntity cur = ret.get(i);
  126. try {
  127. this.save(cur);
  128. } catch (DuplicateKeyException e) {
  129. failRecords.add(newError(i + 1, "科目已存在"));
  130. } catch (Exception e) {
  131. failRecords.add(newError(i + 1, "系统异常"));
  132. log.error("科目导入系统异常", e);
  133. }
  134. }
  135. if (CollectionUtils.isNotEmpty(failRecords)) {
  136. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  137. }
  138. return failRecords;
  139. } catch (StatusException e) {
  140. throw e;
  141. } catch (Exception e) {
  142. throw new RuntimeException("系统错误", e);
  143. } finally {
  144. if (inputStream != null) {
  145. try {
  146. inputStream.close();
  147. } catch (IOException e) {
  148. }
  149. }
  150. }
  151. }
  152. private String trimAndNullIfBlank(String s) {
  153. if (StringUtils.isBlank(s)) {
  154. return null;
  155. }
  156. return s.trim();
  157. }
  158. private String newError(int lineNum, String msg) {
  159. return "第" + lineNum + "行" + msg;
  160. }
  161. @Override
  162. public List<ExamPaperCountVo> findPaperCount(List<Long> examIds) {
  163. return this.baseMapper.findPaperCount(examIds);
  164. }
  165. @Override
  166. public Integer findPaperCount(Long examId) {
  167. QueryWrapper<PaperEntity> wrapper = new QueryWrapper<>();
  168. LambdaQueryWrapper<PaperEntity> lw = wrapper.lambda();
  169. lw.eq(PaperEntity::getExamId, examId);
  170. return this.count(wrapper);
  171. }
  172. private PaperEntity findByExamAndCourse(Long examId, Long courseId) {
  173. QueryWrapper<PaperEntity> wrapper = new QueryWrapper<>();
  174. LambdaQueryWrapper<PaperEntity> lw = wrapper.lambda();
  175. lw.eq(PaperEntity::getExamId, examId);
  176. lw.eq(PaperEntity::getCourseId, courseId);
  177. return this.getOne(wrapper);
  178. }
  179. private PaperEntity saveOrGet(Long schoolId, Long examId, Long courseId) {
  180. PaperEntity ret = findByExamAndCourse(examId, courseId);
  181. if (ret != null) {
  182. return ret;
  183. }
  184. PaperEntity imp = new PaperEntity();
  185. imp.setTotalScore(0.0);
  186. imp.setObjectiveScore(0.0);
  187. imp.setSubjectiveScore(0.0);
  188. imp.setSchoolId(schoolId);
  189. imp.setGroupFinish(false);
  190. imp.setCourseId(courseId);
  191. imp.setExamId(examId);
  192. imp.setStructFinish(true);
  193. this.save(imp);
  194. return imp;
  195. }
  196. @Override
  197. public PageResult<PaperVo> page(PaperQuery query, User user) {
  198. if (query.getSchoolId() == null) {
  199. throw new StatusException("学校不能为空");
  200. }
  201. if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(query.getSchoolId())) {
  202. throw new StatusException("没有权限");
  203. }
  204. IPage<PaperVo> iPage = this.baseMapper.page(new Page<PaperVo>(query.getPageNumber(), query.getPageSize()),
  205. query);
  206. if (CollectionUtils.isNotEmpty(iPage.getRecords())) {
  207. new BatchSetDataUtil<PaperVo>() {
  208. @Override
  209. protected void setData(List<PaperVo> dataList) {
  210. List<Long> paperIds = dataList.stream().map(dto -> dto.getId()).distinct()
  211. .collect(Collectors.toList());
  212. List<GroupCountVo> ret = paperGroupService.findGroupCount(paperIds);
  213. if (ret != null && ret.size() > 0) {
  214. Map<Long, Integer> countMap = new HashMap<>();
  215. for (GroupCountVo item : ret) {
  216. countMap.put(item.getPaperId(), item.getGroupCount());
  217. }
  218. for (PaperVo vo : dataList) {
  219. vo.setGroupCount(countMap.get(vo.getId()));
  220. }
  221. }
  222. }
  223. }.setDataForBatch(iPage.getRecords(), 20);
  224. for (PaperVo vo : iPage.getRecords()) {
  225. if(vo.getGroupCount()==null) {
  226. vo.setGroupCount(0);
  227. }
  228. }
  229. }
  230. return PageUtil.of(iPage);
  231. }
  232. @Override
  233. public List<PaperVo> list(Long examId, User user) {
  234. ExamEntity exam = examService.getById(examId);
  235. if (exam == null) {
  236. throw new StatusException("未找到考试批次");
  237. }
  238. if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(exam.getSchoolId())) {
  239. throw new StatusException("没有权限");
  240. }
  241. List<PaperVo> ret=this.baseMapper.myPaperlist(examId,user.getId());
  242. if (CollectionUtils.isNotEmpty(ret)) {
  243. new BatchSetDataUtil<PaperVo>() {
  244. @Override
  245. protected void setData(List<PaperVo> dataList) {
  246. List<Long> paperIds = dataList.stream().map(dto -> dto.getId()).distinct()
  247. .collect(Collectors.toList());
  248. List<GroupCountVo> ret = paperGroupService.findGroupCount(paperIds);
  249. if (ret != null && ret.size() > 0) {
  250. Map<Long, Integer> countMap = new HashMap<>();
  251. for (GroupCountVo item : ret) {
  252. countMap.put(item.getPaperId(), item.getGroupCount());
  253. }
  254. for (PaperVo vo : dataList) {
  255. vo.setGroupCount(countMap.get(vo.getId()));
  256. }
  257. }
  258. }
  259. }.setDataForBatch(ret, 20);
  260. }
  261. return ret;
  262. }
  263. @Override
  264. public PaperInfoVo info(Long id, User user) {
  265. PaperEntity paper = this.getById(id);
  266. if (paper == null) {
  267. throw new StatusException("未找到试卷结构信息");
  268. }
  269. if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(paper.getSchoolId())) {
  270. throw new StatusException("没有权限");
  271. }
  272. PaperInfoVo vo = new PaperInfoVo();
  273. BeanUtils.copyProperties(paper, vo);
  274. CourseEntity course = courseService.getById(vo.getCourseId());
  275. vo.setCourseCode(course.getCode());
  276. vo.setCourseName(course.getName());
  277. vo.setStructInfo(paperDetailService.getStructInfo(vo.getId()));
  278. vo.setGroupInfo(paperGroupService.getGroupInfo(vo.getId()));
  279. return vo;
  280. }
  281. @Transactional
  282. @Override
  283. public List<String> importSubjectStruct(Long examId, User user, MultipartFile file) {
  284. ExamEntity exam = examService.getById(examId);
  285. if (exam == null) {
  286. throw new StatusException("未找到考试批次");
  287. }
  288. if(!ExamStatus.EDIT.equals(exam.getExamStatus())) {
  289. throw new StatusException("考试未开放上报,不能设置结构信息或分组信息");
  290. }
  291. if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(exam.getSchoolId())) {
  292. throw new StatusException("没有权限");
  293. }
  294. InputStream inputStream = null;
  295. try {
  296. inputStream = file.getInputStream();
  297. List<DataMap> lineList = ExcelReader.create(ExcelType.XLSX, inputStream, 0).getDataMapList();
  298. if (CollectionUtils.isEmpty(lineList)) {
  299. throw new StatusException("Excel无内容");
  300. }
  301. if (10001 < lineList.size()) {
  302. throw new StatusException("数据行数不能超过10000");
  303. }
  304. List<String> failRecords = new ArrayList<>();
  305. List<PaperStructInfoVo> ret = new ArrayList<>();
  306. for (int i = 0; i < lineList.size(); i++) {
  307. DataMap line = lineList.get(i);
  308. StringBuilder msg = new StringBuilder();
  309. PaperStructInfoVo imp = new PaperStructInfoVo();
  310. String code = trimAndNullIfBlank(line.getValue(0));
  311. if (StringUtils.isBlank(code)) {
  312. msg.append(" 科目代码不能为空");
  313. } else if (code.length() > 20) {
  314. msg.append(" 科目代码不能超过20个字符");
  315. }
  316. imp.setCourseCode(code);
  317. String name = trimAndNullIfBlank(line.getValue(1));
  318. if (StringUtils.isBlank(name)) {
  319. msg.append(" 科目名称不能为空");
  320. } else if (name.length() > 20) {
  321. msg.append(" 科目名称不能超过20个字符");
  322. }
  323. if (msg.length() == 0) {
  324. CourseEntity course = courseService.saveOrGet(exam.getSchoolId(), code, name);
  325. PaperEntity paper = saveOrGet(exam.getSchoolId(), examId, course.getId());
  326. imp.setPaperId(paper.getId());
  327. }
  328. String detailName = trimAndNullIfBlank(line.getValue(2));
  329. if (StringUtils.isBlank(detailName)) {
  330. msg.append(" 大题名称不能为空");
  331. } else if (detailName.length() > 50) {
  332. msg.append(" 大题名称不能超过50个字符");
  333. }
  334. imp.setDetailName(detailName);
  335. String detailNumber = trimAndNullIfBlank(line.getValue(3));
  336. if (StringUtils.isBlank(detailNumber)) {
  337. msg.append(" 大题号不能为空");
  338. } else {
  339. try {
  340. int n = Integer.valueOf(detailNumber);
  341. if (n <= 0) {
  342. msg.append(" 大题号不能小于0");
  343. } else {
  344. imp.setDetailNumber(n);
  345. }
  346. } catch (Exception e) {
  347. msg.append(" 大题号只能是整数");
  348. }
  349. }
  350. String unitNumber = trimAndNullIfBlank(line.getValue(4));
  351. if (StringUtils.isBlank(unitNumber)) {
  352. msg.append(" 小题号不能为空");
  353. } else {
  354. try {
  355. int n = Integer.valueOf(unitNumber);
  356. if (n <= 0) {
  357. msg.append(" 小题号不能小于0");
  358. } else {
  359. imp.setUnitNumber(n);
  360. }
  361. } catch (Exception e) {
  362. msg.append(" 小题号只能是整数");
  363. }
  364. }
  365. String score = trimAndNullIfBlank(line.getValue(5));
  366. if (StringUtils.isBlank(score)) {
  367. msg.append(" 小题满分不能为空");
  368. } else {
  369. try {
  370. Double n = Double.valueOf(score);
  371. if (n <= 0) {
  372. msg.append(" 小题满分不能小于0");
  373. } else {
  374. if (score.indexOf(".") < score.length() - 2) {
  375. msg.append("小题满分只能有一位小数");
  376. } else {
  377. imp.setScore(n);
  378. }
  379. }
  380. } catch (Exception e) {
  381. msg.append(" 小题满分格式错误");
  382. }
  383. }
  384. String scoreStep = trimAndNullIfBlank(line.getValue(6));
  385. if (StringUtils.isBlank(scoreStep)) {
  386. msg.append(" 间隔分不能为空");
  387. } else {
  388. try {
  389. Double n = Double.valueOf(scoreStep);
  390. if (n <= 0) {
  391. msg.append(" 间隔分不能小于0");
  392. } else {
  393. if (scoreStep.indexOf(".") < scoreStep.length() - 2) {
  394. msg.append("小间隔分只能有一位小数");
  395. } else {
  396. imp.setScoreStep(n);
  397. }
  398. }
  399. } catch (Exception e) {
  400. msg.append(" 间隔分格式错误");
  401. }
  402. }
  403. if (msg.length() > 0) {
  404. failRecords.add(newError(i + 1, msg.toString()));
  405. } else {
  406. ret.add(imp);
  407. }
  408. }
  409. if (CollectionUtils.isNotEmpty(failRecords)) {
  410. return failRecords;
  411. }
  412. this.saveStruct(ret, user, failRecords);
  413. if (CollectionUtils.isNotEmpty(failRecords)) {
  414. TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
  415. }
  416. return failRecords;
  417. } catch (StatusException e) {
  418. throw e;
  419. } catch (Exception e) {
  420. throw new RuntimeException("系统错误", e);
  421. } finally {
  422. if (inputStream != null) {
  423. try {
  424. inputStream.close();
  425. } catch (IOException e) {
  426. }
  427. }
  428. }
  429. }
  430. private void saveStruct(List<PaperStructInfoVo> cards, User user, List<String> failRecords) {
  431. Map<Long,String> map=new HashMap<>();
  432. for(PaperStructInfoVo vo:cards) {
  433. map.put(vo.getPaperId(), vo.getCourseCode());
  434. }
  435. List<StructDomain> ces = getBeans(cards);
  436. checkStruct(ces, failRecords,map);
  437. if (CollectionUtils.isNotEmpty(failRecords)) {
  438. return;
  439. }
  440. for (StructDomain domain : ces) {
  441. try {
  442. paperDetailService.structSubmit(domain, user);
  443. } catch (StatusException e) {
  444. failRecords.add("科目:"+map.get(domain.getPaperId())+" "+e.getMessage());
  445. } catch (Exception e) {
  446. throw new RuntimeException("系统错误", e);
  447. }
  448. }
  449. }
  450. private void checkStruct(List<StructDomain> ces, List<String> failRecords,Map<Long,String> courseMap) {
  451. for (StructDomain card : ces) {
  452. int lastDetailNum = 0;
  453. for (PaperDetail detail : card.getStructInfo()) {
  454. if (detail.getNumber() - lastDetailNum != 1) {
  455. failRecords.add(
  456. "科目:" + courseMap.get(card.getPaperId()) + ",大题号" + detail.getNumber() + "错误");
  457. }
  458. lastDetailNum = detail.getNumber();
  459. int lastUnitNum = 0;
  460. for (PaperDetailUnit unit : detail.getUnits()) {
  461. if (unit.getNumber() - lastUnitNum != 1) {
  462. failRecords.add("科目:" + courseMap.get(card.getPaperId()) + ",大题号:"
  463. + detail.getNumber() + ",小题号" + unit.getNumber() + "错误");
  464. }
  465. lastUnitNum = unit.getNumber();
  466. }
  467. }
  468. }
  469. }
  470. private List<StructDomain> getBeans(List<PaperStructInfoVo> cards) {
  471. cards.sort(new Comparator<PaperStructInfoVo>() {
  472. @Override
  473. public int compare(PaperStructInfoVo o1, PaperStructInfoVo o2) {
  474. long c1 = o1.getPaperId();
  475. long c2 = o2.getPaperId();
  476. if (c1 < c2) {
  477. return -1;
  478. } else if (c1 > c2) {
  479. return 1;
  480. } else {
  481. int indx1 = o1.getDetailNumber();
  482. int indx2 = o2.getDetailNumber();
  483. if (indx1 < indx2) {
  484. return -1;
  485. } else if (indx1 > indx2) {
  486. return 1;
  487. } else {
  488. int u1 = o1.getUnitNumber();
  489. int u2 = o2.getUnitNumber();
  490. if (u1 < u2) {
  491. return -1;
  492. } else if (u1 > u2) {
  493. return 1;
  494. } else {
  495. return 0;
  496. }
  497. }
  498. }
  499. }
  500. });
  501. List<StructDomain> ces = new ArrayList<>();
  502. StructDomain curCard = null;
  503. PaperDetail curDetail = null;
  504. for (PaperStructInfoVo info : cards) {
  505. if (curCard == null || !info.getPaperId().equals(curCard.getPaperId())) {
  506. curCard = new StructDomain();
  507. curCard.setPaperId(info.getPaperId());
  508. curCard.setStructInfo(new ArrayList<>());
  509. ces.add(curCard);
  510. curDetail = null;
  511. }
  512. if (curDetail == null || !info.getDetailNumber().equals(curDetail.getNumber())) {
  513. curDetail = new PaperDetail();
  514. curDetail.setName(info.getDetailName());
  515. curDetail.setNumber(info.getDetailNumber());
  516. curDetail.setUnits(new ArrayList<>());
  517. curCard.getStructInfo().add(curDetail);
  518. }
  519. PaperDetailUnit unit = new PaperDetailUnit();
  520. curDetail.getUnits().add(unit);
  521. unit.setNumber(info.getUnitNumber());
  522. unit.setScore(info.getScore());
  523. unit.setScoreStep(info.getScoreStep());
  524. }
  525. for (StructDomain sd : ces) {
  526. setTotalScore(sd);
  527. }
  528. return ces;
  529. }
  530. private void setTotalScore(StructDomain domain) {
  531. double total = 0.0;
  532. for (PaperDetail detial : domain.getStructInfo()) {
  533. for (PaperDetailUnit unit : detial.getUnits()) {
  534. total = Calculator.add(total, unit.getScore(), 1);
  535. }
  536. }
  537. domain.setTotalScore(total);
  538. }
  539. @Override
  540. public List<PaperStructInfoVo> subjectiveList(PaperQuery query, User user) {
  541. if (query.getSchoolId() == null) {
  542. throw new StatusException("学校不能为空");
  543. }
  544. if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(query.getSchoolId())) {
  545. throw new StatusException("没有权限");
  546. }
  547. List<PaperStructInfoVo> ret = this.baseMapper.subjectiveList(query);
  548. if (CollectionUtils.isNotEmpty(ret)) {
  549. }
  550. return ret;
  551. }
  552. }