问卷星:发布,答卷,答卷查询
This commit is contained in:
parent
eaf943a0bd
commit
0f572a83e8
|
@ -85,6 +85,9 @@ public class WjxDjxx {
|
|||
@TableField(exist = false)
|
||||
private List<WjxDjxxTmxx> wjxDjxxTmxxList;
|
||||
|
||||
@ApiModelProperty(value = "任务编号")
|
||||
@TableField(exist = false)
|
||||
private String rwbh;
|
||||
@ApiModelProperty(value = "学期学年")
|
||||
@TableField(exist = false)
|
||||
private String xqxn;
|
||||
|
@ -102,4 +105,8 @@ public class WjxDjxx {
|
|||
@TableField(exist = false)
|
||||
private Date endTime;
|
||||
|
||||
@ApiModelProperty(value = "是否完成")
|
||||
@TableField(exist = false)
|
||||
private String isFinished;
|
||||
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ public class WjxDjxxTmlbPage {
|
|||
private java.lang.Integer wjType;
|
||||
/**选择项*/
|
||||
private String itemSelected;
|
||||
/**正确答案*/
|
||||
private String wjAnswer;
|
||||
/**提交内容*/
|
||||
@Excel(name = "提交内容", width = 15)
|
||||
@ApiModelProperty(value = "提交内容")
|
||||
|
|
|
@ -27,4 +27,5 @@ public interface WjxDjxxMapper extends BaseMapper<WjxDjxx> {
|
|||
WjxDjxx findDjxx(@Param("id")String id,@Param("userId")String userId);
|
||||
List<WjxDjxxTmxx> findDjtmxx(@Param("vid")String vid,@Param("jid")String jid);
|
||||
List<WjxDjxx> findDjjgsPage(Page<WjxDjxx> page, WjxDjxx params);
|
||||
List<WjxDjxx> findUnDjjgsPage(Page<WjxDjxx> page, WjxDjxx params);
|
||||
}
|
||||
|
|
|
@ -88,13 +88,13 @@
|
|||
<select id="findDjxx" parameterType="String" resultType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx">
|
||||
select b.atype,b.title,a.vid,a.user_id,a.open_time,a.commit_time,a.jid,a.score,a.total_score,a.answer_seconds,a.user_id,a.user_name
|
||||
from wjx_djxx a
|
||||
inner join wjx_wjxx b on a.vid = b.vid and b.id = #{id}
|
||||
inner join wjx_wjxx b on a.vid = b.vid
|
||||
where a.flag = '1'
|
||||
and a.user_id = #{userId}
|
||||
and a.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findDjtmxx" parameterType="String" resultType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxxTmxx">
|
||||
select x.id,x.wj_index,x.wj_type,x.wj_title,x.wj_score,y.item_selected,y.item_score
|
||||
select x.id,x.wj_index,x.wj_type,x.wj_title,x.wj_score,y.item_selected,y.item_score,y.answer_text
|
||||
from (
|
||||
select c.id,c.wj_index,c.wj_type,c.wj_title,c.wj_score
|
||||
from wjx_djxx a
|
||||
|
@ -104,22 +104,38 @@
|
|||
and a.vid = #{vid}
|
||||
and a.jid = #{jid}
|
||||
) x
|
||||
inner join (
|
||||
select wj_index,item_score,GROUP_CONCAT(item_index) as item_selected
|
||||
inner join (
|
||||
select wj_index,item_score,answer_text,GROUP_CONCAT(item_index) as item_selected
|
||||
from wjx_djxx_tmxx
|
||||
where vid = #{vid}
|
||||
and jid = #{jid}
|
||||
group by wj_index,item_score
|
||||
group by wj_index,item_score,answer_text
|
||||
) y on x.wj_index = y.wj_index
|
||||
order by x.wj_index
|
||||
</select>
|
||||
|
||||
<select id="findDjjgsPage" parameterType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx" resultType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx">
|
||||
select a.id,a.xqxn,a.kcmc,a.start_time,a.end_time,a.title,a.content,b.vid,b.jid,b.user_id,b.user_name,b.open_time,b.commit_time,b.score,b.total_score,b.answer_seconds
|
||||
select a.atype,b.id,a.xqxn,a.kcmc,a.start_time,a.end_time,a.title,a.content,b.vid,b.jid,b.user_id,b.user_name,b.open_time,b.commit_time,b.score,b.total_score,b.answer_seconds
|
||||
from wjx_wjxx a
|
||||
inner join wjx_djxx b on a.vid = b.vid
|
||||
where a.id = #{params.id}
|
||||
order by b.open_time
|
||||
order by b.user_id
|
||||
</select>
|
||||
|
||||
<select id="findUnDjjgsPage" parameterType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx" resultType="org.jeecg.modules.kc.wjxDjxx.entity.WjxDjxx">
|
||||
select x.atype,x.id,x.xqxn,x.kcmc,x.start_time,x.end_time,x.title,x.content,'' as vid,'' as jid,y.xh as user_id,y.xm as user_name,0 as score,0 as total_score,'' as answerSfm
|
||||
from wjx_wjxx x
|
||||
inner join (
|
||||
select a.xh,a.xm,b.KCAPZBBH
|
||||
from xxhbbks a
|
||||
inner join xxhbxsxkb b on a.xh = b.xh and b.KCAPZBBH = #{params.rwbh}
|
||||
) y
|
||||
on y.KCAPZBBH = x.rwbh
|
||||
WHERE x.id = #{params.id}
|
||||
and y.xh not in(
|
||||
select user_id from wjx_djxx c where c.vid = x.vid
|
||||
)
|
||||
order by y.xh
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -69,14 +69,20 @@ public class WjxDjxxServiceImpl extends ServiceImpl<WjxDjxxMapper, WjxDjxx> impl
|
|||
StringBuffer submitDataSb = new StringBuffer();
|
||||
for(WjxDjxxTmlbPage wjxDjxxTmlbPage:list){
|
||||
Integer WjIndex = wjxDjxxTmlbPage.getWjIndex();
|
||||
String itemSelected = wjxDjxxTmlbPage.getItemSelected().replaceAll(",","|").trim();
|
||||
if(itemSelected == null || itemSelected.equals("null") || itemSelected.equals("")){
|
||||
if(wjxDjxxTmlbPage.getWjType().equals("5")){
|
||||
itemSelected = "(跳过)";
|
||||
}else{
|
||||
Integer wjType = wjxDjxxTmlbPage.getWjType();
|
||||
String itemSelected = "";
|
||||
if(wjType == 3 || wjType == 4){
|
||||
itemSelected = wjxDjxxTmlbPage.getItemSelected().replaceAll(",","|").trim();
|
||||
if(itemSelected == null || itemSelected.equals("null") || itemSelected.equals("")){
|
||||
itemSelected = "-3";
|
||||
}
|
||||
}
|
||||
if(wjType == 5){
|
||||
itemSelected = wjxDjxxTmlbPage.getWjAnswer();
|
||||
if(itemSelected == null || itemSelected.equals("null") || itemSelected.equals("")){
|
||||
itemSelected = "(跳过)";
|
||||
}
|
||||
}
|
||||
submitDataSb.append(WjIndex);
|
||||
submitDataSb.append("$");
|
||||
submitDataSb.append(itemSelected);
|
||||
|
@ -107,7 +113,7 @@ public class WjxDjxxServiceImpl extends ServiceImpl<WjxDjxxMapper, WjxDjxx> impl
|
|||
Map<String,Object> selMap = new HashMap<>();
|
||||
selMap.put("vid",Integer.valueOf(vid));
|
||||
selMap.put("jid",Long.valueOf(jidRes));
|
||||
//调用接口,提交
|
||||
//调用接口,查询答卷结果
|
||||
String answerStr = wjxUtil.openapi(selMap,"1001002");
|
||||
if(!answerStr.equals("")){
|
||||
JSONObject ansJsonResult = JSONObject.parseObject(answerStr);
|
||||
|
@ -133,24 +139,46 @@ public class WjxDjxxServiceImpl extends ServiceImpl<WjxDjxxMapper, WjxDjxx> impl
|
|||
JSONObject answerItemJson = answer.getJSONObject("answer_items");
|
||||
for(String key2 : answerItemJson.keySet()){
|
||||
JSONObject answerItem = answerItemJson.getJSONObject(key2);
|
||||
Integer wjIndex = answerItem.getInteger("q_index");
|
||||
String wjTitle = answerItem.getString("title");
|
||||
JSONArray itemIndex = answerItem.getJSONArray("item_index");
|
||||
Double itemScore = answerItem.getDouble("item_value");
|
||||
String answerText = answerItem.getString("answer_text");
|
||||
WjxDjxxTmxx wjxDjxxTmxx = new WjxDjxxTmxx();
|
||||
wjxDjxxTmxx.setVid(answerVid);
|
||||
wjxDjxxTmxx.setJid(jidAns);
|
||||
wjxDjxxTmxx.setUserId(user.getUsername());
|
||||
wjxDjxxTmxx.setCreateBy(user.getUsername());
|
||||
wjxDjxxTmxx.setCreateTime(new Date());
|
||||
wjxDjxxTmxx.setWjIndex(wjIndex);
|
||||
wjxDjxxTmxx.setWjTitle(wjTitle);
|
||||
wjxDjxxTmxx.setItemScore(itemScore);
|
||||
wjxDjxxTmxx.setAnswerText(answerText);
|
||||
for(Object index : itemIndex){
|
||||
Integer ti = (Integer) index;
|
||||
wjxDjxxTmxx.setItemIndex(ti);
|
||||
|
||||
if(answerItem.get("q_index")!=null){
|
||||
Integer wjIndex = answerItem.getInteger("q_index");
|
||||
wjxDjxxTmxx.setWjIndex(wjIndex);
|
||||
}
|
||||
if(answerItem.get("title")!=null){
|
||||
String wjTitle = answerItem.getString("title");
|
||||
wjxDjxxTmxx.setWjTitle(wjTitle);
|
||||
}
|
||||
|
||||
if(answerItem.get("item_value")!=null){
|
||||
Double itemScore = answerItem.getDouble("item_value");
|
||||
wjxDjxxTmxx.setItemScore(itemScore);
|
||||
}
|
||||
if(answerItem.get("answer_text")!=null){
|
||||
String answerText = answerItem.getString("answer_text");
|
||||
wjxDjxxTmxx.setAnswerText(answerText);
|
||||
}
|
||||
if(answerItem.get("item_index")!=null){
|
||||
JSONArray itemIndex = answerItem.getJSONArray("item_index");
|
||||
if(itemIndex.size()>0){
|
||||
for(Object index : itemIndex){
|
||||
Integer ti = (Integer) index;
|
||||
wjxDjxxTmxx.setItemIndex(ti);
|
||||
String id = new DefaultIdentifierGenerator().nextId(new WjxDjxxTmxx()).toString();
|
||||
wjxDjxxTmxx.setId(id);
|
||||
baseMapper.addDjTmxx(wjxDjxxTmxx);
|
||||
}
|
||||
}else{
|
||||
String id = new DefaultIdentifierGenerator().nextId(new WjxDjxxTmxx()).toString();
|
||||
wjxDjxxTmxx.setId(id);
|
||||
baseMapper.addDjTmxx(wjxDjxxTmxx);
|
||||
}
|
||||
}else{
|
||||
String id = new DefaultIdentifierGenerator().nextId(new WjxDjxxTmxx()).toString();
|
||||
wjxDjxxTmxx.setId(id);
|
||||
baseMapper.addDjTmxx(wjxDjxxTmxx);
|
||||
|
@ -301,11 +329,18 @@ public class WjxDjxxServiceImpl extends ServiceImpl<WjxDjxxMapper, WjxDjxx> impl
|
|||
|
||||
@Override
|
||||
public Page<WjxDjxx> findDjjgsPage(WjxDjxx wjxDjxx, Page<WjxDjxx> page){
|
||||
List<WjxDjxx> list = baseMapper.findDjjgsPage(page,wjxDjxx);
|
||||
for(WjxDjxx djxx:list){
|
||||
djxx.setAnswerSfm(convertSecondsToHMS(djxx.getAnswerSeconds()));
|
||||
if(wjxDjxx.getIsFinished().equals("1")){
|
||||
//完成答卷的
|
||||
List<WjxDjxx> list = baseMapper.findDjjgsPage(page,wjxDjxx);
|
||||
for(WjxDjxx djxx:list){
|
||||
djxx.setAnswerSfm(convertSecondsToHMS(djxx.getAnswerSeconds()));
|
||||
}
|
||||
page.setRecords(list);
|
||||
}else{
|
||||
//未完成答卷的
|
||||
List<WjxDjxx> list = baseMapper.findUnDjjgsPage(page,wjxDjxx);
|
||||
page.setRecords(list);
|
||||
}
|
||||
page.setRecords(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,13 +56,34 @@ public class WjxWjxxController extends JeecgController<WjxWjxx, IWjxWjxxService>
|
|||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<WjxWjxx> queryWrapper = QueryGenerator.initQueryWrapper(wjxWjxx, req.getParameterMap());
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
queryWrapper.orderByAsc("start_time");
|
||||
Page<WjxWjxx> page = new Page<WjxWjxx>(pageNo, pageSize);
|
||||
IPage<WjxWjxx> pageList = wjxWjxxService.page(page, queryWrapper);
|
||||
// QueryWrapper<WjxWjxx> queryWrapper = QueryGenerator.initQueryWrapper(wjxWjxx, req.getParameterMap());
|
||||
// queryWrapper.orderByDesc("create_time");
|
||||
// queryWrapper.orderByAsc("start_time");
|
||||
// Page<WjxWjxx> page = new Page<WjxWjxx>(pageNo, pageSize);
|
||||
// IPage<WjxWjxx> pageList = wjxWjxxService.page(page, queryWrapper);
|
||||
Page<WjxWjxx> pageList = wjxWjxxService.findPage(wjxWjxx, new Page<>(pageNo, pageSize));
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 学生问卷分页列表查询
|
||||
*
|
||||
* @param wjxWjxx
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "问卷信息-分页列表查询")
|
||||
@ApiOperation(value="问卷信息-分页列表查询", notes="问卷信息-分页列表查询")
|
||||
@GetMapping(value = "/stuList")
|
||||
public Result<IPage<WjxWjxx>> queryPageStuList(WjxWjxx wjxWjxx,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Page<WjxWjxx> pageList = wjxWjxxService.findStuPage(wjxWjxx, new Page<>(pageNo, pageSize));
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
|
@ -185,8 +206,8 @@ public class WjxWjxxController extends JeecgController<WjxWjxx, IWjxWjxxService>
|
|||
|
||||
@ApiOperation(value="发布问卷", notes="发布问卷")
|
||||
@GetMapping(value = "/fbwj")
|
||||
public Result<String> fbwj(@RequestParam(name="id",required=true) String id) {
|
||||
String res = wjxWjxxService.fbwj(id);
|
||||
public Result<String> fbwj(@RequestParam(name="id",required=true) String id,@RequestParam(name="wjlx",required=true) String wjlx) {
|
||||
String res = wjxWjxxService.fbwj(id,wjlx);
|
||||
return Result.OK(res);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
package org.jeecg.modules.kc.wjxWjxx.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
@ -92,6 +88,12 @@ public class WjxWjxx implements Serializable {
|
|||
private String kcmc;
|
||||
@ApiModelProperty(value = "选课人数")
|
||||
private String xkrs;
|
||||
@ApiModelProperty(value = "已完成人数")
|
||||
@TableField(exist = false)
|
||||
private Integer ywcrs;
|
||||
@ApiModelProperty(value = "未完成人数")
|
||||
@TableField(exist = false)
|
||||
private Integer wwcrs;
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
|
@ -100,5 +102,13 @@ public class WjxWjxx implements Serializable {
|
|||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
@ApiModelProperty(value = "答卷状态标识")
|
||||
@TableField(exist = false)
|
||||
private String flag;// -1 未答卷 0已答卷 1已答卷查询
|
||||
@ApiModelProperty(value = "学生学号")
|
||||
@TableField(exist = false)
|
||||
private String userId;
|
||||
@ApiModelProperty(value = "答卷ID")
|
||||
@TableField(exist = false)
|
||||
private String djId;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package org.jeecg.modules.kc.wjxWjxx.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
/**
|
||||
* @Description: 问卷信息
|
||||
|
@ -13,6 +13,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface WjxWjxxMapper extends BaseMapper<WjxWjxx> {
|
||||
List<WjxWjxx> findPage(Page<WjxWjxx> page,WjxWjxx param);
|
||||
List<WjxWjxx> findStuPage(Page<WjxWjxx> page,WjxWjxx param);
|
||||
WjxWjxx kcxx(@Param("rwbh")String rwbh,@Param("xqxn")String xqxn);
|
||||
void updateVid(@Param("id")String id,@Param("vid")String vid);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,77 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.kc.wjxWjxx.mapper.WjxWjxxMapper">
|
||||
|
||||
<select id="findPage" parameterType="org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx" resultType="org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx">
|
||||
select
|
||||
id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
creater,
|
||||
atype,
|
||||
title,
|
||||
content,
|
||||
qpublish,
|
||||
compress_img,
|
||||
questions,
|
||||
vid,
|
||||
xqxn,
|
||||
rwbh,
|
||||
kcmc,
|
||||
xkrs,
|
||||
(select count(*) from wjx_djxx b where flag = '1' and vid = a.vid) as ywcrs,
|
||||
xkrs - (SELECT count(*) FROM wjx_djxx b WHERE flag = '1' AND vid = a.vid ) AS wwcrs,
|
||||
start_time,
|
||||
end_time
|
||||
from wjx_wjxx a
|
||||
where rwbh = #{param.rwbh}
|
||||
and xqxn = #{param.xqxn}
|
||||
and atype = #{param.atype}
|
||||
and create_by = #{param.createBy}
|
||||
<if test="param.title != null and param.title != ''">
|
||||
and a.title like CONCAT('%', #{param.title}, '%')
|
||||
</if>
|
||||
<if test="param.qpublish != null and param.qpublish != ''">
|
||||
and a.qpublish = #{param.qpublish}
|
||||
</if>
|
||||
order by create_time desc,start_time asc
|
||||
</select>
|
||||
|
||||
<select id="findStuPage" parameterType="org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx" resultType="org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx">
|
||||
select
|
||||
a.id,
|
||||
a.atype,
|
||||
a.title,
|
||||
a.vid,
|
||||
a.xqxn,
|
||||
a.rwbh,
|
||||
a.kcmc,
|
||||
a.start_time,
|
||||
a.end_time,
|
||||
ifnull(b.flag,'-1') as flag,
|
||||
b.id as djId
|
||||
from wjx_wjxx a
|
||||
left join wjx_djxx b on a.vid = b.vid and b.user_id = #{param.userId}
|
||||
where a.qpublish = '1'
|
||||
and a.rwbh = #{param.rwbh}
|
||||
and a.xqxn = #{param.xqxn}
|
||||
and a.atype = #{param.atype}
|
||||
<if test="param.title != null and param.title != ''">
|
||||
and a.title like CONCAT('%', #{param.title}, '%')
|
||||
</if>
|
||||
<if test="param.flag != null and param.flag != ''">
|
||||
<if test="param.flag == '-1'">
|
||||
and (b.id is null or ifnull(b.flag,'-1') = '-1')
|
||||
</if>
|
||||
<if test='param.flag == "0" or param.flag == "1"'>
|
||||
and b.id is not null
|
||||
and b.flag = #{param.flag}
|
||||
</if>
|
||||
</if>
|
||||
order by a.create_time desc,a.start_time asc
|
||||
</select>
|
||||
|
||||
<select id="kcxx" parameterType="String" resultType="org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx">
|
||||
select distinct kcmc,xkrs
|
||||
from kc_kechengbiao
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.kc.wjxWjxx.service;
|
|||
|
||||
import org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
/**
|
||||
* @Description: 问卷信息
|
||||
|
@ -10,7 +11,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface IWjxWjxxService extends IService<WjxWjxx> {
|
||||
|
||||
Page<WjxWjxx> findPage(WjxWjxx wjxWjxx,Page<WjxWjxx> page);
|
||||
Page<WjxWjxx> findStuPage(WjxWjxx wjxWjxx,Page<WjxWjxx> page);
|
||||
WjxWjxx kcxx(String rwbh,String xqxn);
|
||||
String fbwj(String id);
|
||||
String fbwj(String id,String isKs);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package org.jeecg.modules.kc.wjxWjxx.service.impl;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.kc.wjxWjxx.entity.WjxWjxx;
|
||||
import org.jeecg.modules.kc.wjxWjxx.mapper.WjxWjxxMapper;
|
||||
import org.jeecg.modules.kc.wjxWjxx.service.IWjxWjxxService;
|
||||
|
@ -16,17 +13,11 @@ import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmlb;
|
|||
import org.jeecg.modules.kc.wjxWjxxTmlb.entity.WjxWjxxTmxx;
|
||||
import org.jeecg.modules.kc.wjxWjxxTmlb.mapper.WjxWjxxTmlbMapper;
|
||||
import org.jeecg.modules.kc.wjxWjxxTmlb.mapper.WjxWjxxTmxxMapper;
|
||||
import org.jeecg.modules.tools.baidu.HttpUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.hutool.crypto.digest.DigestUtil.sha1;
|
||||
|
||||
/**
|
||||
* @Description: 问卷信息
|
||||
* @Author: jeecg-boot
|
||||
|
@ -43,6 +34,23 @@ public class WjxWjxxServiceImpl extends ServiceImpl<WjxWjxxMapper, WjxWjxx> impl
|
|||
@Autowired
|
||||
private WjxUtil wjxUtil;
|
||||
|
||||
@Override
|
||||
public Page<WjxWjxx> findPage(WjxWjxx wjxWjxx, Page<WjxWjxx> page){
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
wjxWjxx.setCreateBy(user.getUsername());
|
||||
List<WjxWjxx> list = baseMapper.findPage(page,wjxWjxx);
|
||||
page.setRecords(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WjxWjxx> findStuPage(WjxWjxx wjxWjxx, Page<WjxWjxx> page){
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
wjxWjxx.setUserId(user.getUsername());
|
||||
List<WjxWjxx> list = baseMapper.findStuPage(page,wjxWjxx);
|
||||
page.setRecords(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public WjxWjxx fbwj(String id) {
|
||||
|
@ -211,7 +219,7 @@ public class WjxWjxxServiceImpl extends ServiceImpl<WjxWjxxMapper, WjxWjxx> impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public String fbwj(String id) {
|
||||
public String fbwj(String id,String wjlx) {
|
||||
|
||||
WjxWjxx wjxWjxx = baseMapper.selectById(id);
|
||||
|
||||
|
@ -226,29 +234,36 @@ public class WjxWjxxServiceImpl extends ServiceImpl<WjxWjxxMapper, WjxWjxx> impl
|
|||
map.put("q_type",wWjxWjxxTmlb.getWjType());
|
||||
map.put("q_title",wWjxWjxxTmlb.getWjTitle());
|
||||
map.put("is_requir",true);
|
||||
if(wWjxWjxxTmlb.getWjScore()!=null){
|
||||
map.put("q_score",wWjxWjxxTmlb.getWjScore());
|
||||
if(wjlx.equals("6")){
|
||||
if(wWjxWjxxTmlb.getWjScore()!=null){
|
||||
map.put("q_score",wWjxWjxxTmlb.getWjScore());
|
||||
}
|
||||
map.put("q_ceshi",true);
|
||||
}
|
||||
if(wWjxWjxxTmlb.getWjType() == 3){
|
||||
map.put("is_toupiao",3);
|
||||
}
|
||||
if(wWjxWjxxTmlb.getWjType() == 4){
|
||||
map.put("is_toupiao",3);
|
||||
if(wWjxWjxxTmlb.getWjType() == 3 || wWjxWjxxTmlb.getWjType() == 4){
|
||||
//单选和多选
|
||||
List<Map<String,Object>> itemsList = new ArrayList<>();
|
||||
List<WjxWjxxTmxx> tmxxList = wjxWjxxTmxxMapper.selectByMainId(wWjxWjxxTmlb.getId());
|
||||
for(WjxWjxxTmxx wjxWjxxTmxx:tmxxList){
|
||||
Map<String,Object> tmxxMap = new HashMap<>();
|
||||
tmxxMap.put("q_index",wjxWjxxTmxx.getWjIndex());
|
||||
tmxxMap.put("item_index",wjxWjxxTmxx.getItemIndex());
|
||||
tmxxMap.put("item_title",wjxWjxxTmxx.getItemTitle());
|
||||
tmxxMap.put("item_selected",Boolean.parseBoolean(wjxWjxxTmxx.getItemSelected()));
|
||||
tmxxMap.put("item_score",0);
|
||||
JSONObject json = new JSONObject(tmxxMap);
|
||||
itemsList.add(json);
|
||||
}
|
||||
map.put("items",itemsList);
|
||||
}else if(wWjxWjxxTmlb.getWjType() == 5){
|
||||
//填空
|
||||
if(wWjxWjxxTmlb.getWjAnswer()!=null){
|
||||
map.put("answer",wWjxWjxxTmlb.getWjAnswer());
|
||||
}
|
||||
}else if(wWjxWjxxTmlb.getWjType() == 6){
|
||||
//多项填空,预留,之后有需求再开发
|
||||
}
|
||||
List<Map<String,Object>> itemsList = new ArrayList<>();
|
||||
List<WjxWjxxTmxx> tmxxList = wjxWjxxTmxxMapper.selectByMainId(wWjxWjxxTmlb.getId());
|
||||
for(WjxWjxxTmxx wjxWjxxTmxx:tmxxList){
|
||||
Map<String,Object> tmxxMap = new HashMap<>();
|
||||
tmxxMap.put("q_index",wjxWjxxTmxx.getWjIndex());
|
||||
tmxxMap.put("item_index",wjxWjxxTmxx.getItemIndex());
|
||||
tmxxMap.put("item_title",wjxWjxxTmxx.getItemTitle());
|
||||
tmxxMap.put("item_selected",Boolean.parseBoolean(wjxWjxxTmxx.getItemSelected()));
|
||||
tmxxMap.put("item_score",0);
|
||||
JSONObject json = new JSONObject(tmxxMap);
|
||||
itemsList.add(json);
|
||||
}
|
||||
map.put("items",itemsList);
|
||||
JSONObject json = new JSONObject(map);
|
||||
questionsList.add(json);
|
||||
}
|
||||
|
|
|
@ -280,4 +280,11 @@ public class WjxWjxxTmlbController {
|
|||
return Result.OK(WjxWjxxTmlbList);
|
||||
}
|
||||
|
||||
@ApiOperation(value="选项信息主表ID查询", notes="选项信息-通主表ID查询")
|
||||
@GetMapping(value = "/queryDjByMainId")
|
||||
public Result<List<WjxWjxxTmlb>> queryDjByMainId(@RequestParam(name="id",required=true) String id) {
|
||||
List<WjxWjxxTmlb> WjxWjxxTmlbList = wjxWjxxTmlbService.queryDjByMainId(id);
|
||||
return Result.OK(WjxWjxxTmlbList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,6 +82,10 @@ public class WjxWjxxTmlb implements Serializable {
|
|||
@Excel(name = "题目解析", width = 15)
|
||||
@ApiModelProperty(value = "题目解析")
|
||||
private java.lang.String wjParsing;
|
||||
/**正确答案*/
|
||||
@Excel(name = "正确答案", width = 15)
|
||||
@ApiModelProperty(value = "正确答案")
|
||||
private java.lang.String wjAnswer;
|
||||
/**填写提示*/
|
||||
@Excel(name = "填写提示", width = 15)
|
||||
@ApiModelProperty(value = "填写提示")
|
||||
|
|
|
@ -48,4 +48,6 @@ public interface IWjxWjxxTmlbService extends IService<WjxWjxxTmlb> {
|
|||
void removeByMainId(String id);
|
||||
|
||||
List<WjxWjxxTmlb> queryByMainId(String id);
|
||||
|
||||
List<WjxWjxxTmlb> queryDjByMainId(String id);
|
||||
}
|
||||
|
|
|
@ -116,4 +116,17 @@ public class WjxWjxxTmlbServiceImpl extends ServiceImpl<WjxWjxxTmlbMapper, WjxWj
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WjxWjxxTmlb> queryDjByMainId(String id) {
|
||||
QueryWrapper<WjxWjxxTmlb> wjxWjxxTmlbQueryWrapper = new QueryWrapper<WjxWjxxTmlb>();
|
||||
wjxWjxxTmlbQueryWrapper.eq("main_id",id);
|
||||
List<WjxWjxxTmlb> list = wjxWjxxTmlbMapper.selectList(wjxWjxxTmlbQueryWrapper);
|
||||
for(WjxWjxxTmlb WjxWjxxTmlb:list){
|
||||
List<WjxWjxxTmxx> list2= wjxWjxxTmxxMapper.selectByMainId(WjxWjxxTmlb.getId());
|
||||
WjxWjxxTmlb.setWjxWjxxTmxxList(list2);
|
||||
WjxWjxxTmlb.setWjAnswer("");
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,6 +79,10 @@ public class WjxWjxxTmlbPage {
|
|||
@Excel(name = "题目解析", width = 15)
|
||||
@ApiModelProperty(value = "题目解析")
|
||||
private java.lang.String wjParsing;
|
||||
/**正确答案*/
|
||||
@Excel(name = "正确答案", width = 15)
|
||||
@ApiModelProperty(value = "正确答案")
|
||||
private java.lang.String wjAnswer;
|
||||
/**填写提示*/
|
||||
@Excel(name = "填写提示", width = 15)
|
||||
@ApiModelProperty(value = "填写提示")
|
||||
|
|
Loading…
Reference in New Issue