|
@@ -7,7 +7,9 @@ import com.qmth.boot.api.annotation.BOOL;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.distributed.print.business.bean.params.LoginParam;
|
|
import com.qmth.distributed.print.business.bean.params.LoginParam;
|
|
|
|
+import com.qmth.distributed.print.business.bean.result.DictionaryResult;
|
|
import com.qmth.distributed.print.business.bean.result.EditResult;
|
|
import com.qmth.distributed.print.business.bean.result.EditResult;
|
|
|
|
+import com.qmth.distributed.print.business.enums.DictionaryEnum;
|
|
import com.qmth.distributed.print.business.enums.SystemCodeEnum;
|
|
import com.qmth.distributed.print.business.enums.SystemCodeEnum;
|
|
import com.qmth.distributed.print.business.service.BasicVerifyCodeService;
|
|
import com.qmth.distributed.print.business.service.BasicVerifyCodeService;
|
|
import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
@@ -36,11 +38,10 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
|
+import javax.validation.constraints.Max;
|
|
|
|
+import javax.validation.constraints.Min;
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.security.NoSuchAlgorithmException;
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -91,6 +92,18 @@ public class SysController {
|
|
@Resource
|
|
@Resource
|
|
BasicCourseService basicCourseService;
|
|
BasicCourseService basicCourseService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ SysOrgService sysOrgService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ BasicMajorService basicMajorService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ BasicClazzService basicClazzService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ BasicStudentService basicStudentService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 登录
|
|
* 登录
|
|
*
|
|
*
|
|
@@ -339,4 +352,86 @@ public class SysController {
|
|
} while (count > 0);
|
|
} while (count > 0);
|
|
return ResultUtil.ok((Object) paperNumber);
|
|
return ResultUtil.ok((Object) paperNumber);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "共用接口-查询字典")
|
|
|
|
+ @RequestMapping(value = "/get_dictionary", method = RequestMethod.POST)
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
|
|
|
|
+ public Result findDictionaryList(@ApiParam(value = "学院id") @RequestParam(required = false) String collegeId,
|
|
|
|
+ @ApiParam(value = "专业id") @RequestParam(required = false) String majorId,
|
|
|
|
+ @ApiParam(value = "班级id") @RequestParam(required = false) String clazzId,
|
|
|
|
+ @ApiParam(value = "学生id") @RequestParam(required = false) String studentId,
|
|
|
|
+ @ApiParam(value = "查询字典对象") @RequestParam(required = true) DictionaryEnum dictionaryEnum) {
|
|
|
|
+ Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
|
+ List<DictionaryResult> dictionaryResultList = new ArrayList<>();
|
|
|
|
+ switch (dictionaryEnum) {
|
|
|
|
+ case COLLEGE:
|
|
|
|
+ List<SysOrg> sysOrgList = sysOrgService.list(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getSchoolId, schoolId).eq(SysOrg::getEnable, true));
|
|
|
|
+ dictionaryResultList = sysOrgList.stream().map(e -> {
|
|
|
|
+ DictionaryResult dictionaryResult = new DictionaryResult();
|
|
|
|
+ dictionaryResult.setId(e.getId());
|
|
|
|
+ dictionaryResult.setCode(e.getCode());
|
|
|
|
+ dictionaryResult.setName(e.getName());
|
|
|
|
+ return dictionaryResult;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ break;
|
|
|
|
+ case MAJOR:
|
|
|
|
+ QueryWrapper<BasicMajor> majorQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ majorQueryWrapper.lambda()
|
|
|
|
+ .eq(BasicMajor::getSchoolId, schoolId)
|
|
|
|
+ .eq(BasicMajor::getEnable, true);
|
|
|
|
+
|
|
|
|
+ if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(collegeId))) {
|
|
|
|
+ majorQueryWrapper.lambda().eq(BasicMajor::getBelongOrgId, collegeId);
|
|
|
|
+ }
|
|
|
|
+ List<BasicMajor> basicMajorList = basicMajorService.list(majorQueryWrapper);
|
|
|
|
+ dictionaryResultList = basicMajorList.stream().map(e -> {
|
|
|
|
+ DictionaryResult dictionaryResult = new DictionaryResult();
|
|
|
|
+ dictionaryResult.setId(e.getId());
|
|
|
|
+ dictionaryResult.setCode(e.getCode());
|
|
|
|
+ dictionaryResult.setName(e.getName());
|
|
|
|
+ return dictionaryResult;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ break;
|
|
|
|
+ case CLAZZ:
|
|
|
|
+ QueryWrapper<BasicClazz> clazzQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ clazzQueryWrapper.lambda().eq(BasicClazz::getSchoolId, schoolId).eq(BasicClazz::getEnable, true);
|
|
|
|
+ if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(majorId))) {
|
|
|
|
+ clazzQueryWrapper.lambda().eq(BasicClazz::getMajorId, majorId);
|
|
|
|
+ }
|
|
|
|
+ List<BasicClazz> basicClazzList = basicClazzService.list(clazzQueryWrapper);
|
|
|
|
+ dictionaryResultList = basicClazzList.stream().map(e -> {
|
|
|
|
+ DictionaryResult dictionaryResult = new DictionaryResult();
|
|
|
|
+ dictionaryResult.setId(e.getId());
|
|
|
|
+ dictionaryResult.setCode(e.getClazzCode());
|
|
|
|
+ dictionaryResult.setName(e.getClazzName());
|
|
|
|
+ return dictionaryResult;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ break;
|
|
|
|
+ case STUDENT:
|
|
|
|
+ QueryWrapper<BasicStudent> studentQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ studentQueryWrapper.lambda().eq(BasicStudent::getSchoolId, schoolId).eq(BasicStudent::getEnable, true);
|
|
|
|
+ if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(collegeId))) {
|
|
|
|
+ studentQueryWrapper.lambda().eq(BasicStudent::getBelongOrgId, collegeId);
|
|
|
|
+ }
|
|
|
|
+ if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(majorId))) {
|
|
|
|
+ studentQueryWrapper.lambda().eq(BasicStudent::getMajorId, majorId);
|
|
|
|
+ }
|
|
|
|
+ if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(clazzId))) {
|
|
|
|
+ studentQueryWrapper.lambda().eq(BasicStudent::getClazzId, clazzId);
|
|
|
|
+ }
|
|
|
|
+ if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(studentId))) {
|
|
|
|
+ studentQueryWrapper.lambda().eq(BasicStudent::getId, studentId);
|
|
|
|
+ }
|
|
|
|
+ List<BasicStudent> basicStudentList = basicStudentService.list(studentQueryWrapper);
|
|
|
|
+ dictionaryResultList = basicStudentList.stream().map(e -> {
|
|
|
|
+ DictionaryResult dictionaryResult = new DictionaryResult();
|
|
|
|
+ dictionaryResult.setId(e.getId());
|
|
|
|
+ dictionaryResult.setCode(e.getStudentCode());
|
|
|
|
+ dictionaryResult.setName(e.getStudentName());
|
|
|
|
+ return dictionaryResult;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ return ResultUtil.ok(dictionaryResultList);
|
|
|
|
+ }
|
|
}
|
|
}
|