Commit 13726306 authored by Mindfaker's avatar Mindfaker

fix bug

parent 45c08615
......@@ -99,7 +99,7 @@ server:
local:
storagePath: storage
# 这个地方应该是wx模块的WxStorageController的fetch方法对应的地址
address: https://base.exploring.cn/test-emba-server/wx/storage/fetch/
address: https://base.exploring.cn/test-engine-class-work/wx/storage/fetch/
# 阿里云对象存储配置信息
aliyun:
endpoint: oss-cn-zhangjiakou.aliyuncs.com
......
......@@ -231,6 +231,30 @@ public interface SpecialSqlMapper {
@Param("page") Integer page, @Param("limit") Integer limit, @Param("sort") String sort, @Param("order") String order);
/**
* 打卡评分
* @param
* @return
*/
@Select("<script> " +
"SELECT count(*) as count_info FROM " +
"(SELECT * FROM " +
"(SELECT id, student_unique_id, `name`, class_id, add_time FROM student_info WHERE deleted = FALSE " +
"<if test = 'studentName != null'> AND `name` like '%${studentName}%' </if>" +
"<if test = 'studentUniqueId != null'> AND student_unique_id like '%${studentUniqueId}%' </if>" +
"<if test = 'classId != null'> AND class_id = ${classId} </if>" +
") target_stu INNER JOIN (" +
"SELECT student_id, record_time, point FROM student_point_info WHERE deleted = FALSE " +
"<if test = 'startTime != null'> AND record_time &gt;= '${startTime}' </if>" +
"<if test = 'endTime != null'> AND '${endTime} ' &gt;= record_time </if>" +
" ) point_info ON target_stu.id = point_info.student_id) t1 " +
" LEFT JOIN (SELECT id, class_name FROM class_info WHERE deleted = FALSE ) t2 ON t1.class_id = t2.id "+
"</script>"
)
Map<String, String> selectPointCount(@Param("studentName") String studentName, @Param("studentUniqueId") String studentUniqueId,
@Param("classId") Integer classId, @Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 随机选择一个的学生
* @param classId
......
......@@ -41,8 +41,10 @@ public class ClassService {
if (idList != null && idList.size() > 0) {
criteria.andIdIn(idList);
}
criteria.andDeletedEqualTo(false).andClassNameEqualTo(className);
if (!StringUtils.isEmpty(className)) {
criteria.andClassNameEqualTo(className);
}
criteria.andDeletedEqualTo(false);
return classInfoMapper.selectByExample(example);
}
......
......@@ -38,6 +38,9 @@ public class StudentInfoService {
* @return
*/
public String addStudentInfo(StudentInfo studentInfo) {
if (selectStudentInfoByUniqueId(studentInfo.getStudentUniqueId()) != null) {
return "Fail 学号重复! 请重新输入学号";
}
LocalDateTime now = LocalDateTime.now();
studentInfo.setAddTime(now);
studentInfo.setUpdateTime(now);
......@@ -73,12 +76,25 @@ public class StudentInfoService {
public Object batchDeleted(List<Integer> idList) {
List<StudentInfo> studentInfoList = selectStudentInfo(null, null, idList);
studentInfoList.forEach(x -> {
x.setDeleted(false);
x.setDeleted(null);
updateStudentInfo(x);
});
return "batch deleted OK";
}
/**
* 根据标记学号进行查询
* @param uniqueId
* @return
*/
public StudentInfo selectStudentInfoByUniqueId(String uniqueId) {
StudentInfoExample example = new StudentInfoExample();
StudentInfoExample.Criteria criteria = example.createCriteria();
criteria.andDeletedEqualTo(false).andStudentUniqueIdEqualTo(uniqueId);
return studentInfoMapper.selectOneByExample(example);
}
/**
* 检索学生相关的信息
* @param studentName
......
......@@ -6,9 +6,11 @@ import cn.exploring.engine.server.db.domain.StudentPointInfo;
import cn.exploring.engine.server.db.domain.StudentPointInfoExample;
import cn.exploring.engine.server.db.util.Util;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
......@@ -23,9 +25,15 @@ public class StudentPointService {
@Resource
SpecialSqlMapper specialSqlMapper;
public List<Map> selectPointByWeb( String studentName, String studentUniqueId, Integer classId, String startTime, String endTime, Integer page, Integer limit, String sort, String order) {
public Map selectPointByWeb( String studentName, String studentUniqueId, Integer classId, String startTime, String endTime, Integer page, Integer limit, String sort, String order) {
List<Map> dataList = specialSqlMapper.selectPoint(studentName, studentUniqueId, classId, startTime, endTime, page, limit, sort, order);
return dataList.stream().map((Function<Map, Map>) Util::exchangeMapKeyName).collect(Collectors.toList());
Map<String, String> countInfoData = specialSqlMapper.selectPointCount(studentName, studentUniqueId, classId, startTime, endTime);
Integer countInfo = StringUtils.isEmpty(countInfoData.get("count_info")) ? 0 : Integer.parseInt(countInfoData.get("count_info").toString());
List<Map> targetDataList = dataList.stream().map((Function<Map, Map>) Util::exchangeMapKeyName).collect(Collectors.toList());
return new HashMap() {{
put("items", targetDataList);
put("total", countInfo);
}};
}
/**
......
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