|
@@ -1,28 +1,35 @@
|
|
|
package com.qmth.paper.library.api;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
|
import com.qmth.boot.api.annotation.BOOL;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
+import com.qmth.paper.library.business.bean.result.DictionaryResult;
|
|
|
import com.qmth.paper.library.business.bean.result.EditResult;
|
|
|
import com.qmth.paper.library.business.bean.result.SelectResult;
|
|
|
+import com.qmth.paper.library.business.enums.DictionaryEnum;
|
|
|
import com.qmth.paper.library.business.service.PaperArchivesService;
|
|
|
import com.qmth.paper.library.business.service.PaperArchivesTypeService;
|
|
|
import com.qmth.paper.library.business.service.PaperScanTaskService;
|
|
|
+import com.qmth.paper.library.common.contant.SystemConstant;
|
|
|
import com.qmth.paper.library.common.entity.BasicSemester;
|
|
|
+import com.qmth.paper.library.common.entity.BasicStudent;
|
|
|
import com.qmth.paper.library.common.service.BasicSemesterService;
|
|
|
+import com.qmth.paper.library.common.service.BasicStudentService;
|
|
|
+import com.qmth.paper.library.common.service.SysOrgService;
|
|
|
import com.qmth.paper.library.common.util.Result;
|
|
|
import com.qmth.paper.library.common.util.ResultUtil;
|
|
|
+import com.qmth.paper.library.common.util.ServletUtil;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -48,6 +55,12 @@ public class ConditionController {
|
|
|
@Resource
|
|
|
PaperScanTaskService paperScanTaskService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ SysOrgService sysOrgService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ BasicStudentService basicStudentService;
|
|
|
+
|
|
|
@ApiOperation(value = "查询条件-学期")
|
|
|
@PostMapping("/semester/query")
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
|
|
@@ -110,4 +123,48 @@ public class ConditionController {
|
|
|
return ResultUtil.ok(scanTaskList);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "查询条件-学生查询条件级联查询(学生学院-专业-班级)")
|
|
|
+ @RequestMapping(value = "/basic_student/condition", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
|
|
|
+ public Result findDictionaryList(@ApiParam(value = "学院id") @RequestParam(required = false) String collegeId,
|
|
|
+ @ApiParam(value = "专业名称") @RequestParam(required = false) String majorName,
|
|
|
+ @ApiParam(value = "查询字典对象", required = true) @RequestParam DictionaryEnum dictionaryEnum) {
|
|
|
+ Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
+ QueryWrapper<BasicStudent> studentQuery = new QueryWrapper<>();
|
|
|
+ studentQuery.lambda().eq(BasicStudent::getSchoolId, schoolId);
|
|
|
+ if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(collegeId))) {
|
|
|
+ Long orgId = SystemConstant.convertIdToLong(collegeId);
|
|
|
+ studentQuery.lambda().eq(BasicStudent::getBelongOrgId, orgId);
|
|
|
+ }
|
|
|
+ if (SystemConstant.strNotNull(majorName)) {
|
|
|
+ studentQuery.lambda().eq(BasicStudent::getMajorName, majorName);
|
|
|
+ }
|
|
|
+ List<DictionaryResult> dictionaryResultList = new ArrayList<>();
|
|
|
+ switch (dictionaryEnum) {
|
|
|
+ case COLLEGE:
|
|
|
+ dictionaryResultList = sysOrgService.findCollegeLevelOrgList(schoolId).stream().flatMap(e -> {
|
|
|
+ DictionaryResult dictionaryResult = new DictionaryResult();
|
|
|
+ dictionaryResult.setId(e.getId());
|
|
|
+ dictionaryResult.setCode(e.getCode());
|
|
|
+ dictionaryResult.setName(e.getName());
|
|
|
+ return Stream.of(dictionaryResult);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ break;
|
|
|
+ case MAJOR:
|
|
|
+ dictionaryResultList = basicStudentService.list(studentQuery).stream().map(BasicStudent::getMajorName).distinct().flatMap(e -> {
|
|
|
+ DictionaryResult dictionaryResult = new DictionaryResult();
|
|
|
+ dictionaryResult.setName(e);
|
|
|
+ return Stream.of(dictionaryResult);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ break;
|
|
|
+ case CLAZZ:
|
|
|
+ dictionaryResultList = basicStudentService.list(studentQuery).stream().map(BasicStudent::getClazzName).distinct().flatMap(e -> {
|
|
|
+ DictionaryResult dictionaryResult = new DictionaryResult();
|
|
|
+ dictionaryResult.setName(e);
|
|
|
+ return Stream.of(dictionaryResult);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(dictionaryResultList);
|
|
|
+ }
|
|
|
}
|