Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
6156ffce
由
sonin
编写于
2025-04-28 13:34:49 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
考试 优化
1 个父辈
8a8794c0
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
47 行增加
和
14 行删除
sk-module-biz/src/main/java/com/skua/modules/edu/controller/UserPaperController.java
sk-module-system/src/main/java/com/skua/config/mybatis/MybatisInterceptor.java
sk-module-biz/src/main/java/com/skua/modules/edu/controller/UserPaperController.java
查看文件 @
6156ffc
package
com
.
skua
.
modules
.
edu
.
controller
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.skua.common.constant.BusinessConstant
;
import
com.skua.core.api.vo.Result
;
import
com.skua.core.aspect.annotation.AutoLog
;
import
com.skua.core.context.BaseContextHandler
;
import
com.skua.core.util.DateUtils
;
import
com.skua.modules.base.service.IBaseService
;
import
com.skua.modules.biz.IBusinessService
;
import
com.skua.modules.edu.entity.*
;
import
com.skua.modules.edu.service.IPaperService
;
import
com.skua.modules.edu.service.IUserPaperService
;
...
...
@@ -30,6 +35,11 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.IOException
;
import
java.math.BigInteger
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Slf4j
@Api
(
tags
=
"在线考试-用户考试"
)
...
...
@@ -41,6 +51,10 @@ public class UserPaperController {
@Autowired
private
IUserPaperService
userPaperService
;
@Autowired
private
IBaseService
baseService
;
@Autowired
private
IBusinessService
businessService
;
// 我的 考试
@AutoLog
(
value
=
"在线考试--试卷列表"
)
...
...
@@ -58,10 +72,11 @@ public class UserPaperController {
queryWrapper.le("start_time",currentDate);// 当前时间 > 开始结束时间
queryWrapper.ge("end_time",currentDate);
IPage<Paper> pageList = paperService.page(page, queryWrapper);*/
paper
.
setUserId
(
BaseContextHandler
.
getUserId
());
String
userId
=
BaseContextHandler
.
getUserId
();
// paper.setUserId(userId);
paper
.
setStartTime
(
DateUtils
.
now
());
paper
.
setEndTime
(
DateUtils
.
now
()
);
paper
.
setExamStatus
(
0
);
//考试状态是未考试的
//
paper.setExamStatus(0);//考试状态是未考试的
IPage
<
Paper
>
pageList
=
paperService
.
queryMyPaperByList
(
page
,
paper
);
result
.
setSuccess
(
true
);
result
.
setResult
(
pageList
);
...
...
@@ -148,12 +163,11 @@ public class UserPaperController {
@AutoLog
(
value
=
"在线考试--历史试卷列表"
)
@ApiOperation
(
value
=
"在线考试--历史试卷列表"
,
notes
=
"在线考试--历史试卷列表"
)
@GetMapping
(
value
=
"/historyList"
)
public
Result
<
IPage
<
Paper
>
>
historyList
(
public
Result
<
Object
>
historyList
(
Paper
paper
,
@RequestParam
(
name
=
"pageNo"
,
defaultValue
=
"1"
)
Integer
pageNo
,
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
,
HttpServletRequest
req
)
throws
Exception
{
Result
<
IPage
<
Paper
>>
result
=
new
Result
<
IPage
<
Paper
>>();
/* StringBuffer sql = new StringBuffer();
sql.append("select up.score, p.* from edu_user_paper up ");
sql.append(" left join edu_paper p on p.id = up.paper_id ");
...
...
@@ -164,16 +178,34 @@ public class UserPaperController {
Page<Map<String, Object>> pageList = iCommonSqlService.queryForPage(page, sql.toString());
List<Paper> paperList = JoinSqlUtils.multiMaps2Beans(pageList.getRecords(), Paper.class);
*/
Page
<
Paper
>
page
=
new
Page
<
Paper
>(
pageNo
,
pageSize
);
if
(
StringUtils
.
isEmpty
(
paper
.
getUserId
())){
paper
.
setUserId
(
BaseContextHandler
.
getUserId
());
//获取当前用户编号
}
IPage
<
Paper
>
paperList
=
paperService
.
queryMyPaperRecoredByList
(
page
,
paper
);
result
.
setResult
(
paperList
);
result
.
setSuccess
(
true
);
return
result
;
String
departIds
=
BaseContextHandler
.
getDeparts
();
QueryWrapper
<?>
queryWrapper0
=
new
QueryWrapper
<>();
queryWrapper0
.
eq
(
StringUtils
.
isNotEmpty
(
paper
.
getUserId
()),
"edu_user_paper.user_id"
,
paper
.
getUserId
())
.
like
(
StringUtils
.
isNotEmpty
(
paper
.
getPaperTitle
()),
"edu_paper.paper_title"
,
paper
.
getPaperTitle
())
.
in
(
"edu_user_paper.depart_id"
,
Arrays
.
asList
(
departIds
.
split
(
","
)))
.
orderByDesc
(
"edu_user_paper.start_time"
,
"edu_user_paper.score"
);
List
<
String
>
columnList
=
new
ArrayList
<
String
>(){{
add
(
"edu_user_paper.score"
);
add
(
"edu_user_paper.user_id"
);
add
(
"edu_user_paper.rank"
);
add
(
"edu_user_paper.depart_id"
);
add
(
"edu_user_paper.id as 'user_paper_id'"
);
add
(
"edu_paper.*"
);
}};
IPage
<
Map
<
String
,
Object
>>
mapIPage
=
baseService
.
queryForPage
(
new
Page
<>(
pageNo
,
pageSize
),
"select "
+
String
.
join
(
","
,
columnList
)
+
" from edu_user_paper left join edu_paper on edu_user_paper.paper_id = edu_paper.id"
,
queryWrapper0
);
// 翻译
Map
<
String
,
String
>
sysDepartDictMap
=
businessService
.
dictMap
(
"sys_depart"
,
null
);
Map
<
String
,
String
>
sysUserDictMap
=
businessService
.
dictMap
(
"sys_user"
,
null
);
// 封装结果集
IPage
<
Map
<
String
,
Object
>>
paperIPage
=
new
Page
<>(
pageNo
,
pageSize
);
paperIPage
.
setTotal
(
mapIPage
.
getTotal
());
paperIPage
.
setRecords
(
mapIPage
.
getRecords
().
stream
().
map
(
item
->
{
Map
<
String
,
Object
>
tmpMap
=
BeanUtil
.
beanToMap
(
BeanUtil
.
toBean
(
item
,
Paper
.
class
));
tmpMap
.
put
(
"userId"
+
BusinessConstant
.
dictText
,
sysUserDictMap
.
get
(
tmpMap
.
get
(
"userId"
)));
tmpMap
.
put
(
"departId"
+
BusinessConstant
.
dictText
,
sysDepartDictMap
.
get
(
tmpMap
.
get
(
"departId"
)));
return
tmpMap
;
}).
collect
(
Collectors
.
toList
()));
return
Result
.
ok
(
paperIPage
);
}
//历史试卷详情 history_detail
@AutoLog
(
value
=
"在线考试--历史试卷详情(复习)"
)
...
...
sk-module-system/src/main/java/com/skua/config/mybatis/MybatisInterceptor.java
查看文件 @
6156ffc
...
...
@@ -87,6 +87,7 @@ public class MybatisInterceptor implements Interceptor {
add
(
"inspection_point_trigger_config"
);
//在线考试
add
(
"edu_paper"
);
//用户的试卷
add
(
"edu_user_paper"
);
//用户的试卷
add
(
"edu_question"
);
//试题
add
(
"edu_question_db"
);
//题库
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论