修改三个导出功能,和首页考核列表查询功能

master
xiaoCJ 4 months ago
parent 678e1dfd93
commit ff476f9192

@ -93,25 +93,32 @@ public class TeaGradeManageController {
return null; return null;
} }
List<TeaExamManageCountDto> teaExamManageCountDtos = new ArrayList<>(); List<TeaExamManageCountDto> teaExamManageCountDtos = new ArrayList<>();
Map<Integer, StuUser> userMap = new HashMap<>(); Map<String, StuUser> userMap = new HashMap<>();
List<Integer> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
for (TeaExamManage teaExamManage : teaExamManages) { for (TeaExamManage teaExamManage : teaExamManages) {
Integer zyUserId = Integer.parseInt(teaExamManage.getUserId()); //这里是智云 zyUserId userIds.add(teaExamManage.getUserId());
userIds.add(zyUserId);
} }
//存储用户信息 //存储用户信息
StuUserExample example = new StuUserExample(); StuUserExample example = new StuUserExample();
example.createCriteria().andSystemOnwerEqualTo(systemOwner).andZyUseridIn(userIds); example.createCriteria().andSystemOnwerEqualTo(systemOwner).andUseridIn(userIds);
List<StuUser> stuUsers = userMapper.selectByExample(example); List<StuUser> stuUsers = userMapper.selectByExample(example);
for (StuUser stuUser : stuUsers) { for (StuUser stuUser : stuUsers) {
userMap.put(stuUser.getZyUserid(), stuUser); userMap.put(stuUser.getUserid(), stuUser);
} }
for (TeaExamManage teaExamManage : teaExamManages) { for (TeaExamManage teaExamManage : teaExamManages) {
TeaExamManageCountDto copyexamManageWithBLOBs = new TeaExamManageCountDto(); TeaExamManageCountDto copyexamManageWithBLOBs = new TeaExamManageCountDto();
String userId = teaExamManage.getUserId();
StuUser stuUser = userMap.get(userId);
if (stuUser==null){
continue;
}
copyexamManageWithBLOBs.setName(stuUser.getName()); //发布人
teaExamManageCountDtos.add(copyexamManageWithBLOBs);
//获取班级和考试人数 //获取班级和考试人数
TeaAndStudentExam teaAndStudentExam = teaAndStudentExamMapper.selectByExamMangeId(teaExamManage.getExamManageId()); TeaAndStudentExam teaAndStudentExam = teaAndStudentExamMapper.selectByExamMangeId(teaExamManage.getExamManageId());
@ -139,10 +146,6 @@ public class TeaGradeManageController {
String concatenatedTimeString = startTime + " -- " + endTime; String concatenatedTimeString = startTime + " -- " + endTime;
copyexamManageWithBLOBs.setExamTime(concatenatedTimeString); //考试时间 copyexamManageWithBLOBs.setExamTime(concatenatedTimeString); //考试时间
String userId = teaExamManage.getUserId();
StuUser stuUser = userMap.get(Integer.parseInt(userId));
copyexamManageWithBLOBs.setName(stuUser.getName()); //发布人
teaExamManageCountDtos.add(copyexamManageWithBLOBs);
} }
PageInfo pageInfo = PageUtil.pageHelper(teaExamManageCountDtos, index, size); PageInfo pageInfo = PageUtil.pageHelper(teaExamManageCountDtos, index, size);
return new ResultEntity<>(pageInfo); return new ResultEntity<>(pageInfo);
@ -644,8 +647,9 @@ public class TeaGradeManageController {
@ApiOperation("理论考试--导出理论考试信息") @ApiOperation("理论考试--导出理论考试信息")
public void exportTheoryExamInfo(HttpServletResponse response, public void exportTheoryExamInfo(HttpServletResponse response,
@ApiParam("不选择班级就是学习全部导出") @RequestParam(required = false) String classId, @ApiParam("不选择班级就是学习全部导出") @RequestParam(required = false) String classId,
@RequestParam String schoolId) { @RequestParam String schoolId,
iTeaGradeManageService.exportTheoryExamInfo(response, classId, schoolId); @RequestParam String systemOwner) {
iTeaGradeManageService.exportTheoryExamInfo(response, classId, schoolId,systemOwner);
} }

@ -33,4 +33,9 @@ public interface StuTheoryRecordMapper {
int updateByPrimaryKey(StuTheoryRecord record); int updateByPrimaryKey(StuTheoryRecord record);
StuTheoryIndexInfoDto selectTheoryInfo(@Param("userId") String userId); StuTheoryIndexInfoDto selectTheoryInfo(@Param("userId") String userId);
List<StuTheoryRecord> selectConditions(@Param("schoolId") String schoolId,
@Param("classId") String classId,
@Param("keyWord") String keyWord,
@Param("systemOwner") String systemOwner);
} }

@ -31,7 +31,7 @@ public interface ITeaGradeManageService {
PageInfo<StuTheoryRecord> getTheoryInfo(Integer index, Integer size, String schoolId, String classId, String keyWord, String systemOwner); PageInfo<StuTheoryRecord> getTheoryInfo(Integer index, Integer size, String schoolId, String classId, String keyWord, String systemOwner);
void exportTheoryExamInfo(HttpServletResponse response, String classId, String schoolId); void exportTheoryExamInfo(HttpServletResponse response, String classId, String schoolId,String systemOwner);
SysWeight getSysWeightResultEntity(String courseId, String schoolId, String systemOwner); SysWeight getSysWeightResultEntity(String courseId, String schoolId, String systemOwner);
} }

@ -272,37 +272,38 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
@Override @Override
public PageInfo<StuTheoryRecord> getTheoryInfo(Integer index, Integer size, String schoolId, String classId, String keyWord, String systemOwner) { public PageInfo<StuTheoryRecord> getTheoryInfo(Integer index, Integer size, String schoolId, String classId, String keyWord, String systemOwner) {
PageHelper.startPage(index, size); PageHelper.startPage(index, size);
List<StuTheoryRecord> list = getStuTheoryRecordPageInfo(schoolId, classId, keyWord, systemOwner); // List<StuTheoryRecord> list = getStuTheoryRecordPageInfo(schoolId, classId, keyWord, systemOwner);
List<StuTheoryRecord> list = stuTheoryRecordMapper.selectConditions(schoolId, classId, keyWord, systemOwner);
PageInfo<StuTheoryRecord> pageInfo = new PageInfo<>(list); PageInfo<StuTheoryRecord> pageInfo = new PageInfo<>(list);
return pageInfo; return pageInfo;
} }
//查询方法 // //查询方法
private List<StuTheoryRecord> getStuTheoryRecordPageInfo(String schoolId, String classId, String keyWord, String systemOwner) { // private List<StuTheoryRecord> getStuTheoryRecordPageInfo(String schoolId, String classId, String keyWord, String systemOwner) {
StuTheoryRecordExample s = new StuTheoryRecordExample(); // StuTheoryRecordExample s = new StuTheoryRecordExample();
StuTheoryRecordExample.Criteria criteria = s.createCriteria(); // StuTheoryRecordExample.Criteria criteria = s.createCriteria();
StuTheoryRecordExample.Criteria orCriteria = s.createCriteria(); // StuTheoryRecordExample.Criteria orCriteria = s.createCriteria();
criteria.andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner); // criteria.andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner);
orCriteria.andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner); // orCriteria.andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner);
if (StringUtils.isNotBlank(classId)) { // if (StringUtils.isNotBlank(classId)) {
criteria.andClassIdEqualTo(classId); // criteria.andClassIdEqualTo(classId);
orCriteria.andClassIdEqualTo(classId); // orCriteria.andClassIdEqualTo(classId);
} // }
if (StringUtils.isNotBlank(keyWord)) { // if (StringUtils.isNotBlank(keyWord)) {
criteria.andStudentIdEqualTo(keyWord); // criteria.andStudentIdEqualTo(keyWord);
orCriteria.andNameEqualTo(keyWord); // orCriteria.andNameEqualTo(keyWord);
} // }
s.or(orCriteria); // s.or(orCriteria);
s.setOrderByClause("average_score ASC"); // s.setOrderByClause("average_score ASC");
return stuTheoryRecordMapper.selectByExample(s); // return stuTheoryRecordMapper.selectByExample(s);
} // }
@Override @Override
public void exportTheoryExamInfo(HttpServletResponse response, String classId, String schoolId) { public void exportTheoryExamInfo(HttpServletResponse response, String classId, String schoolId, String systemOwner) {
StuTheoryRecordExample s = new StuTheoryRecordExample(); StuTheoryRecordExample s = new StuTheoryRecordExample();
StuTheoryRecordExample.Criteria criteria = s.createCriteria(); StuTheoryRecordExample.Criteria criteria = s.createCriteria();
criteria.andSchoolIdEqualTo(schoolId); criteria.andSchoolIdEqualTo(schoolId).andSystemOwnerEqualTo(systemOwner);
if (StringUtils.isNotBlank(classId)) { if (StringUtils.isNotBlank(classId)) {
criteria.andClassIdEqualTo(classId); criteria.andClassIdEqualTo(classId);
} }

@ -32,7 +32,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -61,7 +62,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -73,10 +75,12 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
user_id, school_id, class_id, name, student_id, exam_count, highest_score, lowest_score, user_id
, school_id, class_id, name, student_id, exam_count, highest_score, lowest_score,
total_duration, average_score, system_owner total_duration, average_score, system_owner
</sql> </sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample"
resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
@ -97,7 +101,8 @@
where user_id = #{userId,jdbcType=VARCHAR} where user_id = #{userId,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from stu_theory_record delete
from stu_theory_record
where user_id = #{userId,jdbcType=VARCHAR} where user_id = #{userId,jdbcType=VARCHAR}
</delete> </delete>
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample"> <delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample">
@ -189,7 +194,8 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuTheoryRecordExample"
resultType="java.lang.Long">
select count(*) from stu_theory_record select count(*) from stu_theory_record
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
@ -311,8 +317,12 @@
<result column="rank" jdbcType="INTEGER" property="theoryLastRank"/> <result column="rank" jdbcType="INTEGER" property="theoryLastRank"/>
</resultMap> </resultMap>
<select id="selectTheoryInfo" parameterType="com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryIndexInfoDto" resultMap="DtoMap"> <select id="selectTheoryInfo" parameterType="com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryIndexInfoDto"
SELECT ste.score, str.total_duration,str.exam_count, ( resultMap="DtoMap">
SELECT ste.score,
str.total_duration,
str.exam_count,
(
SELECT COUNT(*) AS `rank` SELECT COUNT(*) AS `rank`
FROM stu_theory_exam FROM stu_theory_exam
WHERE accuracy &gt;= ( WHERE accuracy &gt;= (
@ -320,11 +330,11 @@
FROM stu_theory_exam FROM stu_theory_exam
WHERE user_id = 4 WHERE user_id = 4
ORDER BY exam_time DESC ORDER BY exam_time DESC
LIMIT 1 LIMIT 1 )
)
) AS `rank` ) AS `rank`
FROM stu_theory_exam ste FROM stu_theory_exam ste
JOIN stu_theory_record str ON ste.user_id = str.user_id JOIN stu_theory_record str
ON ste.user_id = str.user_id
WHERE ste.user_id = 4 WHERE ste.user_id = 4
AND ste.answered = 1 AND ste.answered = 1
AND ste.accuracy &gt;= ( AND ste.accuracy &gt;= (
@ -337,4 +347,20 @@
ORDER BY ste.exam_time DESC ORDER BY ste.exam_time DESC
LIMIT 1; LIMIT 1;
</select> </select>
<select id="selectConditions" resultMap="BaseResultMap">
select *
from stu_theory_record
<where>
system_owner = #{systemOwner}
AND school_id = #{schoolId}
<if test="classId != null and classId != ''">
AND class_id = #{classId}
</if>
<if test="keyWord != null and keyWord != ''">
AND (student_id like CONCAT ('%',#{keyWord},'%') or name like CONCAT ('%',#{keyWord},'%'))
</if>
</where>
</select>
</mapper> </mapper>
Loading…
Cancel
Save