Commit 50b252fc authored by Ryan Loong's avatar Ryan Loong

update 移除部分接口

parent 81da93ca
......@@ -7,7 +7,6 @@ import cn.exploring.engine.server.db.domain.StudentInfo;
*/
public class StudentVo extends StudentInfo {
public String ClassName;
private Integer callTimes;
public String getClassName() {
return ClassName;
......@@ -16,12 +15,4 @@ public class StudentVo extends StudentInfo {
public void setClassName(String className) {
ClassName = className;
}
public Integer getCallTimes() {
return callTimes;
}
public void setCallTimes(Integer callTimes) {
this.callTimes = callTimes;
}
}
......@@ -169,19 +169,10 @@ public class StudentInfoService {
criteria.andClassIdEqualTo(classId);
}
Map<Integer, Integer> callTimeMap = studentPointService.countByClassGroupByStudent(classId);
if (Objects.nonNull(minCall) || Objects.nonNull(maxCall)) {
criteria.andIdNotIn(callTimeMap.entrySet().stream()
.filter(entry -> (Objects.nonNull(minCall) && entry.getValue() < minCall)
|| (Objects.nonNull(maxCall) && entry.getValue() > maxCall))
.map(Map.Entry::getKey).collect(Collectors.toList()));
}
PageHelper.startPage(page, limit);
example.setOrderByClause(sort + " " + order);
List<StudentInfo> studentInfoList = studentInfoMapper.selectByExample(example);
if (CollectionUtils.isEmpty(studentInfoList)) {
......@@ -195,7 +186,6 @@ public class StudentInfoService {
StudentVo voData = new StudentVo();
BeanUtils.copyProperties(x, voData);
voData.setClassName(classMap.get(x.getClassId()));
voData.setCallTimes(callTimeMap.getOrDefault(x.getId(), 0));
if (StringUtils.isEmpty(x.getHead()) || x.getHead().trim().equalsIgnoreCase(STRING_DEFAULT_HEAD)) {
voData.setHead(URL_DEFAULT_HEAD);
......@@ -209,35 +199,35 @@ public class StudentInfoService {
}};
}
/**
* 查询可以被点名的学生名单
* @param classId 班级ID
* @param maxCall 排除点名达到指定次数的学生(null为不排除)
* @return 查询到的list和总数信息
*/
@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public Map<String, Object> listForCall(Integer classId, Integer maxCall) {
Set<Integer> excluded = null;
if (Objects.nonNull(maxCall) && maxCall > 0) {
excluded = studentPointService.countByClassGroupByStudent(classId).entrySet().stream().filter(entry -> entry.getValue() >= maxCall).map(Map.Entry::getKey).collect(Collectors.toSet());
}
StudentInfoExample.Criteria criteria = new StudentInfoExample().createCriteria()
.andDeletedEqualTo(StudentInfo.NOT_DELETED)
.andClassIdEqualTo(classId);
if (Objects.nonNull(maxCall) && maxCall > 0) {
criteria.andIdNotIn(studentPointService.countByClassGroupByStudent(classId).entrySet().stream().filter(entry -> entry.getValue() >= maxCall).map(Map.Entry::getKey).collect(Collectors.toList()));
}
List<StudentInfo> queryList = studentInfoMapper.selectByExample(criteria.example())
.stream().peek(x -> {
if (StringUtils.isEmpty(x.getHead()) || x.getHead().trim().equalsIgnoreCase(STRING_DEFAULT_HEAD)) {
x.setHead(URL_DEFAULT_HEAD);
}
}).collect(Collectors.toList());
return ImmutableMap.of("total", queryList.size(), "items", queryList);
}
// /**
// * 查询可以被点名的学生名单
// * @param classId 班级ID
// * @param maxCall 排除点名达到指定次数的学生(null为不排除)
// * @return 查询到的list和总数信息
// */
// @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
// public Map<String, Object> listForCall(Integer classId, Integer maxCall) {
// Set<Integer> excluded = null;
// if (Objects.nonNull(maxCall) && maxCall > 0) {
// excluded = studentPointService.countByClassGroupByStudent(classId).entrySet().stream().filter(entry -> entry.getValue() >= maxCall).map(Map.Entry::getKey).collect(Collectors.toSet());
// }
//
// StudentInfoExample.Criteria criteria = new StudentInfoExample().createCriteria()
// .andDeletedEqualTo(StudentInfo.NOT_DELETED)
// .andClassIdEqualTo(classId);
//
// if (Objects.nonNull(maxCall) && maxCall > 0) {
// criteria.andIdNotIn(studentPointService.countByClassGroupByStudent(classId).entrySet().stream().filter(entry -> entry.getValue() >= maxCall).map(Map.Entry::getKey).collect(Collectors.toList()));
// }
//
// List<StudentInfo> queryList = studentInfoMapper.selectByExample(criteria.example())
// .stream().peek(x -> {
// if (StringUtils.isEmpty(x.getHead()) || x.getHead().trim().equalsIgnoreCase(STRING_DEFAULT_HEAD)) {
// x.setHead(URL_DEFAULT_HEAD);
// }
// }).collect(Collectors.toList());
// return ImmutableMap.of("total", queryList.size(), "items", queryList);
// }
public List<StudentInfoExcelImportVo> importByExcel(MultipartFile file) throws IOException {
ExcelReaderListener<StudentInfoExcelImportVo> listener = new StudentInfoExcelReaderListener();
......
......@@ -101,10 +101,6 @@ public class StudentPointService {
.stream().collect(Collectors.groupingBy(StudentPointInfo::getStudentId, Collectors.toList()));
}
public Map<Integer, Integer> countByClassGroupByStudent(Integer classId) {
return selectByClassGroupByStudent(classId).entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().size()));
}
@Transactional(rollbackFor = Exception.class)
public void removeAll() {
studentPointInfoMapper.updateByExampleSelective(new StudentPointInfo(){{
......
......@@ -69,10 +69,10 @@ public class PointController {
}
@PostMapping("getStuList")
public Object getStuList(@RequestParam Integer classId, @RequestParam Integer maxCall) {
return ResponseUtil.ok(studentInfoService.listForCall(classId, maxCall));
}
// @PostMapping("getStuList")
// public Object getStuList(@RequestParam Integer classId, @RequestParam Integer maxCall) {
// return ResponseUtil.ok(studentInfoService.listForCall(classId, maxCall));
// }
@GetMapping("export")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment