| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.querydsl.core.types.dsl.StringPath; |
| | | import com.qxueyou.scc.admin.classes.model.ClsClass; |
| | | import com.qxueyou.scc.teach.res.model.Res; |
| | | import org.apache.commons.beanutils.BeanUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import org.apache.tools.ant.taskdefs.Concat; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Service |
| | | public class EvaluateService extends CommonAppService implements IEvaluateService { |
| | | |
| | | |
| | | private final Logger log = LogManager.getLogger(EvaluateService.class); |
| | | |
| | | |
| | | @Autowired |
| | | EvaluateRepository evaRepository; |
| | | |
| | | |
| | | @Autowired |
| | | IEvaluateTemplateService templateService; |
| | | |
| | | |
| | | @Autowired |
| | | ITeacherService teacherService; |
| | | |
| | | |
| | | @Autowired |
| | | IExerciseService exerciseService; |
| | | |
| | | |
| | | @Autowired |
| | | IMsgInfoService msgInfoService; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public ResultJson queryList(Integer pageNum, Integer pageSize, String keyword, String sort) { |
| | | |
| | | |
| | | QSchEvaluate qEva = QSchEvaluate.schEvaluate; |
| | | QSchEvaluateTemplate template = QSchEvaluateTemplate.schEvaluateTemplate; |
| | | QExerciseGroup group = QExerciseGroup.exerciseGroup; |
| | | QSubject subject = QSubject.subject; |
| | | |
| | | QClsClass clsClass = QClsClass.clsClass; |
| | | QStuStudent stuStudent = QStuStudent.stuStudent; |
| | | // 搜索名 |
| | | keyword = StringUtils.isBlank(keyword) ? null : "%"+keyword+"%"; |
| | | |
| | | // 获取查询结果集合 |
| | | QueryResults<Tuple> results = this.getQueryFactory() |
| | | .select(qEva, group,subject) |
| | | .from(qEva, template, group,subject) |
| | | .where(new QueryDslOptionBuilder() |
| | | .and(qEva.evalTemplateId::eq, template.evaluateTemplateId) |
| | | .and(template.groupId::eq,group.groupId) |
| | | .and(qEva.evalRangeId::eq,subject.subjectId) |
| | | .and(qEva.createId::eq,ClientUtils.getUserId()) |
| | | .and(qEva.evaluateName::like, keyword) |
| | | .and(qEva.deleteFlag::eq,false) |
| | | .build() |
| | | // 获取查询结果集合 |
| | | QueryResults<Tuple> results = this.getQueryFactory() |
| | | .select(qEva, group, subject) |
| | | .from(qEva, template, group, subject) |
| | | .where(new QueryDslOptionBuilder() |
| | | .and(qEva.evalTemplateId::eq, template.evaluateTemplateId) |
| | | .and(template.groupId::eq, group.groupId) |
| | | .and(qEva.evalRangeId::like, subject.subjectId) |
| | | .and(qEva.createId::eq, ClientUtils.getUserId()) |
| | | .and(qEva.evaluateName::like, keyword) |
| | | .and(qEva.deleteFlag::eq, false) |
| | | .build() |
| | | ) |
| | | .orderBy(qEva.createTime.desc()) |
| | | .fetchResults(); |
| | | |
| | | .orderBy(qEva.createTime.desc()) |
| | | .fetchResults(); |
| | | // QueryResults<Tuple> results2 = this.getQueryFactory() |
| | | // .select(qEva, group, clsClass) |
| | | // .from(qEva, template, group, clsClass) |
| | | // .where(new QueryDslOptionBuilder() |
| | | // .and(qEva.evalTemplateId::eq, template.evaluateTemplateId) |
| | | // .and(template.groupId::eq, group.groupId) |
| | | // .and(qEva.evalRangeId::like,clsClass.classId)//qEva.evalRangeId::like, clsClass.classId |
| | | // .and(qEva.createId::eq, ClientUtils.getUserId()) |
| | | // .and(qEva.evaluateName::like, keyword) |
| | | // .and(qEva.deleteFlag::eq, false) |
| | | // .build() |
| | | // ) |
| | | // .orderBy(qEva.createTime.desc()) |
| | | // .fetchResults(); |
| | | QueryResults<Tuple> results3 = this.getQueryFactory() |
| | | .select(qEva, group, stuStudent) |
| | | .from(qEva, template, group, stuStudent) |
| | | .where(new QueryDslOptionBuilder() |
| | | .and(qEva.evalTemplateId::eq, template.evaluateTemplateId) |
| | | .and(template.groupId::eq, group.groupId) |
| | | .and(qEva.evalRangeId::like,stuStudent.userId) |
| | | .and(qEva.createId::eq, ClientUtils.getUserId()) |
| | | .and(qEva.evaluateName::like, keyword) |
| | | .and(qEva.deleteFlag::eq, false) |
| | | .build() |
| | | ) |
| | | .orderBy(qEva.createTime.desc()) |
| | | .fetchResults(); |
| | | Map<String, Object> args = null; |
| | | String hql = "select s.evaluateId,s.evaluateName,s.evalRangeId,s.evalRangeType,s.evalRangeName,s.evalRangeCount,s.evalObjectName,s.status,s.endTime,s.createTime,e.groupId,s.evaluateCount " + |
| | | "from SchEvaluate as s,SchEvaluateTemplate as t,ExerciseGroup as e,ClsClass as c " + |
| | | "where s.evalTemplateId =t.evaluateTemplateId and e.groupId =t.groupId and find_in_set(c.classId,s.evalRangeId)>0"; |
| | | if(keyword != null){ |
| | | hql = hql+" and s.evaluateName like:evaluateName"; |
| | | args = CollectionUtils.newObjectMap("evaluateName", keyword); |
| | | } |
| | | hql = hql+" and s.deleteFlag is false group by s.evaluateId"; |
| | | List<Map<String, Object>> results2 = findListWithMapByHql(hql, args); |
| | | for (Map<String, Object> map: results2) { |
| | | map.put("evaluateId", map.get("0")); |
| | | map.put("evaluateName", map.get("1")); |
| | | map.put("evalRangeId", map.get("2")); |
| | | map.put("evalRangeType", map.get("3")); |
| | | map.put("evalRangeName", map.get("4")); |
| | | map.put("evalRangeCount", map.get("5")); |
| | | map.put("evalObjectName", map.get("6")); |
| | | map.put("status", map.get("7")); |
| | | map.put("endTime", map.get("8")); |
| | | map.put("createTime", map.get("9")); |
| | | map.put("groupId", map.get("10")); |
| | | map.put("exerCount", map.get("11")); |
| | | map.remove(map.get("1")); |
| | | map.remove("0"); |
| | | map.remove("1"); |
| | | map.remove("2"); |
| | | map.remove("3"); |
| | | map.remove("4"); |
| | | map.remove("5"); |
| | | map.remove("6"); |
| | | map.remove("7"); |
| | | map.remove("8"); |
| | | map.remove("9"); |
| | | map.remove("10"); |
| | | map.remove("11"); |
| | | // map.put("exerCount", tuple.get(group).getAllCount()); |
| | | // map.put("evaluateCount", this.getEvaluateCount(tuple.get(qEva).getEvaluateId()));//已评估人数 |
| | | // map.put("evaluateAllCount", this |
| | | // .queryEvaluateAllCount(tuple.get(qEva).getEvalRangeType(), tuple.get(qEva).getEvalRangeId().split(",")));//应评估人数 |
| | | } |
| | | // 封装参数 |
| | | List<Map<String,Object>> resultLst = |
| | | results.getResults() |
| | | .stream() |
| | | .map(tuple -> { |
| | | Map<String,Object> map = new HashMap<String,Object>(2); |
| | | map.put("evaluateId", tuple.get(qEva).getEvaluateId()); |
| | | map.put("evaluateName", tuple.get(qEva).getEvaluateName()); |
| | | map.put("evalRangeId", tuple.get(qEva).getEvalRangeId()); |
| | | map.put("evalRangeType", tuple.get(qEva).getEvalRangeType()); |
| | | map.put("evalRangeName", tuple.get(subject).getName()); |
| | | map.put("evalRangeCount", tuple.get(qEva).getEvalRangeCount()); |
| | | map.put("evalObjectName", tuple.get(qEva).getEvalObjectName()); |
| | | map.put("status", tuple.get(qEva).getStatus()); |
| | | map.put("endTime", tuple.get(qEva).getEndTime()); |
| | | map.put("createTime", tuple.get(qEva).getCreateTime()); |
| | | map.put("groupId", tuple.get(group).getGroupId()); |
| | | map.put("exerCount", tuple.get(group).getAllCount()); |
| | | map.put("evaluateCount", this.getEvaluateCount(tuple.get(qEva).getEvaluateId()));//已评估人数 |
| | | map.put("evaluateAllCount", this |
| | | .queryEvaluateAllCount(tuple.get(qEva).getEvalRangeType(), tuple.get(qEva).getEvalRangeId().split(",")));//应评估人数 |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | |
| | | return new ResultJson(true, "success", |
| | | CollectionUtils.newObjectMap("allCount",results.getTotal(),"datas",resultLst)); |
| | | List<Map<String, Object>> resultLst = |
| | | results.getResults() |
| | | .stream() |
| | | .map(tuple -> { |
| | | Map<String, Object> map = new HashMap<String, Object>(2); |
| | | map.put("evaluateId", tuple.get(qEva).getEvaluateId()); |
| | | map.put("evaluateName", tuple.get(qEva).getEvaluateName()); |
| | | map.put("evalRangeId", tuple.get(qEva).getEvalRangeId()); |
| | | map.put("evalRangeType", tuple.get(qEva).getEvalRangeType()); |
| | | map.put("evalRangeName", tuple.get(subject).getName()); |
| | | map.put("evalRangeCount", tuple.get(qEva).getEvalRangeCount()); |
| | | map.put("evalObjectName", tuple.get(qEva).getEvalObjectName()); |
| | | map.put("status", tuple.get(qEva).getStatus()); |
| | | map.put("endTime", tuple.get(qEva).getEndTime()); |
| | | map.put("createTime", tuple.get(qEva).getCreateTime()); |
| | | map.put("groupId", tuple.get(group).getGroupId()); |
| | | map.put("exerCount", tuple.get(group).getAllCount()); |
| | | map.put("evaluateCount", this.getEvaluateCount(tuple.get(qEva).getEvaluateId()));//已评估人数 |
| | | map.put("evaluateAllCount", this |
| | | .queryEvaluateAllCount(tuple.get(qEva).getEvalRangeType(), tuple.get(qEva).getEvalRangeId().split(",")));//应评估人数 |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | // resultLst.addAll( |
| | | // results2.getResults() |
| | | // .stream() |
| | | // .map(tuple -> { |
| | | // Map<String, Object> map = new HashMap<String, Object>(2); |
| | | // map.put("evaluateId", tuple.get(qEva).getEvaluateId()); |
| | | // map.put("evaluateName", tuple.get(qEva).getEvaluateName()); |
| | | // map.put("evalRangeId", tuple.get(qEva).getEvalRangeId()); |
| | | // map.put("evalRangeType", tuple.get(qEva).getEvalRangeType()); |
| | | // map.put("evalRangeName", tuple.get(clsClass).getName()); |
| | | // map.put("evalRangeCount", tuple.get(qEva).getEvalRangeCount()); |
| | | // map.put("evalObjectName", tuple.get(qEva).getEvalObjectName()); |
| | | // map.put("status", tuple.get(qEva).getStatus()); |
| | | // map.put("endTime", tuple.get(qEva).getEndTime()); |
| | | // map.put("createTime", tuple.get(qEva).getCreateTime()); |
| | | // map.put("groupId", tuple.get(group).getGroupId()); |
| | | // map.put("exerCount", tuple.get(group).getAllCount()); |
| | | // map.put("evaluateCount", this.getEvaluateCount(tuple.get(qEva).getEvaluateId()));//已评估人数 |
| | | // map.put("evaluateAllCount", this |
| | | // .queryEvaluateAllCount(tuple.get(qEva).getEvalRangeType(), tuple.get(qEva).getEvalRangeId().split(",")));//应评估人数 |
| | | // return map; |
| | | // }).collect(Collectors.toList())); |
| | | resultLst.addAll( |
| | | results3.getResults() |
| | | .stream() |
| | | .map(tuple -> { |
| | | Map<String, Object> map = new HashMap<String, Object>(2); |
| | | map.put("evaluateId", tuple.get(qEva).getEvaluateId()); |
| | | map.put("evaluateName", tuple.get(qEva).getEvaluateName()); |
| | | map.put("evalRangeId", tuple.get(qEva).getEvalRangeId()); |
| | | map.put("evalRangeType", tuple.get(qEva).getEvalRangeType()); |
| | | map.put("evalRangeName", tuple.get(stuStudent).getName()); |
| | | map.put("evalRangeCount", tuple.get(qEva).getEvalRangeCount()); |
| | | map.put("evalObjectName", tuple.get(qEva).getEvalObjectName()); |
| | | map.put("status", tuple.get(qEva).getStatus()); |
| | | map.put("endTime", tuple.get(qEva).getEndTime()); |
| | | map.put("createTime", tuple.get(qEva).getCreateTime()); |
| | | map.put("groupId", tuple.get(group).getGroupId()); |
| | | map.put("exerCount", tuple.get(group).getAllCount()); |
| | | map.put("evaluateCount", this.getEvaluateCount(tuple.get(qEva).getEvaluateId()));//已评估人数 |
| | | map.put("evaluateAllCount", this |
| | | .queryEvaluateAllCount(tuple.get(qEva).getEvalRangeType(), tuple.get(qEva).getEvalRangeId().split(",")));//应评估人数 |
| | | return map; |
| | | }).collect(Collectors.toList())); |
| | | resultLst = results2.stream().collect(Collectors.toList()); |
| | | return new ResultJson(true, "success", |
| | | CollectionUtils.newObjectMap("allCount",results.getTotal()+results2.stream().count()+results3.getTotal(),"datas",resultLst)); |
| | | } |
| | | |
| | | /** |
| | | * 获取范围选择 |
| | | * |
| | | * |
| | | * type: lesson:课程 class:班级 person:人员 |
| | | * |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultJson queryRangeList(String type,String searchName) { |
| | | |
| | | |
| | | List<Tuple> tupleLst = null; |
| | | // 搜索名 |
| | | searchName = StringUtils.isBlank(searchName) ? null : "%"+searchName+"%"; |
| | | |
| | | |
| | | if(ClientUtils.isAdmin()){// 管理员 |
| | | |
| | | |
| | | tupleLst = getAdminRangeList(type,searchName); |
| | | }else{// 老师 |
| | | |
| | | |
| | | tupleLst = getTeacherRangeList(type,searchName); |
| | | } |
| | | |
| | | |
| | | // 统一处理返回数据 |
| | | List<Map<String,Object>> resultLst = tupleLst.stream() |
| | | .map(tuple -> { |
| | |
| | | map.put("id", tuple.get(1, String.class)); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | |
| | | return new ResultJson(true, "success", resultLst); |
| | | } |
| | | |
| | |
| | | QClsClass cls = QClsClass.clsClass; |
| | | QUser user = QUser.user; |
| | | List<Tuple> tupleLst = null; |
| | | |
| | | |
| | | if(SchEvaluate.EVALUATE_RANGE_LESSON.equals(type)){//课程 |
| | | |
| | | |
| | | tupleLst = this.getQueryFactory().select(subject.name.as("name"),subject.subjectId.as("id")).distinct() |
| | | .from(subject) |
| | | .where(subject.type.eq(Subject.TYPE_ORG_SUBJECT) |
| | |
| | | .and(subject.deleteFlag.isFalse())) |
| | | .orderBy(subject.createTime.desc()) |
| | | .fetch(); |
| | | |
| | | |
| | | }else if(SchEvaluate.EVALUATE_RANGE_CLASS.equals(type)){//班级 |
| | | |
| | | |
| | | tupleLst = this.getQueryFactory().select(cls.name.as("name"),cls.classId.as("id")).distinct() |
| | | .from(cls) |
| | | .where( new QueryDslOptionBuilder() |
| | |
| | | .orderBy(stu.createTime.desc()) |
| | | .fetch(); |
| | | } |
| | | |
| | | |
| | | return tupleLst; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取老师范围选择 |
| | | * @param type |
| | |
| | | QSubject subject = QSubject.subject; |
| | | QClsClassReSubject re = QClsClassReSubject.clsClassReSubject; |
| | | QClsClass cls = QClsClass.clsClass; |
| | | |
| | | |
| | | List<Tuple> tupleLst = null; |
| | | String teacherId = teacherService.getTeacherIdByUserId(ClientUtils.getUserId()); |
| | | |
| | | |
| | | if(SchEvaluate.EVALUATE_RANGE_LESSON.equals(type)){//课程 |
| | | |
| | | |
| | | tupleLst = this.getQueryFactory().select(subject.name.as("name"),subject.subjectId.as("id")).distinct() |
| | | .from(subject) |
| | | .where(subject.createId.eq(ClientUtils.getUserId()) |
| | |
| | | .and(subject.deleteFlag.isFalse())) |
| | | .orderBy(subject.createTime.desc()) |
| | | .fetch(); |
| | | |
| | | |
| | | }else if(SchEvaluate.EVALUATE_RANGE_CLASS.equals(type)){//班级 |
| | | |
| | | |
| | | tupleLst = this.getQueryFactory().select(cls.name.as("name"),cls.classId.as("id")).distinct() |
| | | .from(subject, re, cls) |
| | | .where(new QueryDslOptionBuilder() |
| | |
| | | .build()).groupBy(cls.classId) |
| | | .orderBy(subject.createTime.desc()) |
| | | .fetch(); |
| | | |
| | | |
| | | }else if(SchEvaluate.EVALUATE_RANGE_PERSON.equals(type)){//人员 |
| | | QStuStudent stu = QStuStudent.stuStudent; |
| | | |
| | | |
| | | tupleLst = this.getQueryFactory().select(stu.name.as("name"),stu.userId.as("id")).distinct() |
| | | .from(stu,cls,subject, re) |
| | | .where(new QueryDslOptionBuilder() |
| | |
| | | .orderBy(stu.createTime.desc()) |
| | | .fetch(); |
| | | } |
| | | |
| | | |
| | | return tupleLst; |
| | | } |
| | | |
| | |
| | | //1、插入组 |
| | | ExerciseGroup obj = this.insertExerciseGroup(eva.getEvaluateName(), |
| | | ExerciseGroup.TYPE_EXERCISE_TEACH_EVALUATE); |
| | | |
| | | |
| | | //2、插入评估模板 |
| | | SchEvaluateTemplate objTemplate = new SchEvaluateTemplate(); |
| | | TraceUtils.setCreateTrace(objTemplate); |
| | |
| | | objTemplate.setOrgId(ClientUtils.getOrgId()); |
| | | objTemplate.setOrgName(ClientUtils.getOrgName()); |
| | | this.save(objTemplate); |
| | | |
| | | |
| | | // 3、插入评估表 |
| | | eva.setEvalTemplateId(objTemplate.getEvaluateTemplateId()); |
| | | eva.setEvalTemplateName(objTemplate.getEvaluateTemplateName()); |
| | |
| | | eva.setDeleteFlag(false); |
| | | TraceUtils.setCreateTrace(eva); |
| | | evaRepository.save(eva); |
| | | |
| | | |
| | | evaluateId = eva.getEvaluateId(); |
| | | groupId = obj.getGroupId(); |
| | | }else{// 编辑 |
| | | SchEvaluate newEva = this.read(SchEvaluate.class, eva.getEvaluateId()); |
| | | |
| | | |
| | | newEva.setEvaluateName(eva.getEvaluateName()); |
| | | newEva.setEvalObjectName(eva.getEvalObjectName()); |
| | | newEva.setEndTime(eva.getEndTime()); |
| | |
| | | TraceUtils.setUpdateTrace(newEva); |
| | | evaRepository.save(newEva); |
| | | } |
| | | |
| | | |
| | | return new ResultJson(true, "success", CollectionUtils.newObjectMap("evaluateId", evaluateId, "groupId", groupId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * :后台 插入评估模板时调用 |
| | | * |
| | | * |
| | | * @param name |
| | | * @param type |
| | | * @return |
| | |
| | | */ |
| | | @Override |
| | | public ResultJson queryBaseInfo(String evaluateId) { |
| | | |
| | | |
| | | SchEvaluate eva = evaRepository.getOne(evaluateId); |
| | | QSchEvaluate qEva = QSchEvaluate.schEvaluate; |
| | | QSchEvaluateTemplate template = QSchEvaluateTemplate.schEvaluateTemplate; |
| | | QExerciseGroup group = QExerciseGroup.exerciseGroup; |
| | | |
| | | |
| | | // 获取查询结果集合 |
| | | ExerciseGroup g = this.getQueryFactory() |
| | | .select(group) |
| | |
| | | .build() |
| | | ) |
| | | .fetchOne(); |
| | | |
| | | return new ResultJson(true, "success", |
| | | |
| | | return new ResultJson(true, "success", |
| | | CollectionUtils.newObjectMap("evaluateName",eva.getEvaluateName(), |
| | | "evaluateId",eva.getEvaluateId(), |
| | | "evalObjectName",eva.getEvalObjectName(), |
| | |
| | | "evalRangeId",eva.getEvalRangeId(), |
| | | "evalRangeName",eva.getEvalRangeName())); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @Override |
| | | public ResultJson delete(String evaluateIds){ |
| | | QSchEvaluate qEva = QSchEvaluate.schEvaluate; |
| | | |
| | | |
| | | this.getQueryFactory() |
| | | .update(qEva) |
| | | .set(qEva.deleteFlag, true) |
| | | .where(qEva.evaluateId.in(evaluateIds.split(","))) |
| | | .execute(); |
| | | |
| | | |
| | | return new ResultJson(true, "success"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 激活 |
| | | */ |
| | | @Override |
| | | public ResultJson doActive(String evaluateIds){ |
| | | |
| | | |
| | | QSchEvaluate qEva = QSchEvaluate.schEvaluate; |
| | | |
| | | |
| | | this.getQueryFactory() |
| | | .update(qEva) |
| | | .set(qEva.status, SchEvaluate.STATUS_EVA) |
| | | .where(qEva.evaluateId.in(evaluateIds.split(","))) |
| | | .execute(); |
| | | |
| | | |
| | | if(StringUtils.isNotEmpty(evaluateIds)){ |
| | | String [] arrIds = evaluateIds.split(","); |
| | | for(String evaluateId:arrIds){ |
| | | this.doSendhMsg(evaluateId); |
| | | } |
| | | } |
| | | |
| | | |
| | | return new ResultJson(true, "success"); |
| | | } |
| | | |
| | | |
| | | //发布消息 |
| | | private void doSendhMsg(String evaluateId){ |
| | | SchEvaluate evaluate = this.read(SchEvaluate.class,evaluateId); |
| | | |
| | | |
| | | List<Map<String,Object>> lst= this.queryNotAnswerEvaLst(evaluateId, new ArrayList<String>(1)); |
| | | |
| | | |
| | | List<String> lstUserIds = null; |
| | | if(lst!=null && lst.size()>0){ |
| | | lstUserIds = new ArrayList<String>(lst.size()); |
| | | for(Map<String,Object> map:lst){ |
| | | lstUserIds.add((String)map.get("userId")); |
| | | } |
| | | |
| | | |
| | | Map<String,String> attrs = CollectionUtils.newStringMap("evaluateId",evaluate.getEvaluateId(),"evaluateName",evaluate.getEvaluateName(), |
| | | "templateId",evaluate.getEvalTemplateId(),"evalRangeName",evaluate.getEvalRangeName(),"creator",evaluate.getCreator()); |
| | | |
| | | |
| | | msgInfoService.doSendTextMsgToUsersLoop(lstUserIds, MsgInfo.TYPE_EVALUATE, "发布了问卷调查", attrs); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | *回退 |
| | | */ |
| | | @Override |
| | | public ResultJson doWithdraw(String evaluateIds){ |
| | | QSchEvaluate qEva = QSchEvaluate.schEvaluate; |
| | | |
| | | |
| | | this.getQueryFactory() |
| | | .update(qEva) |
| | | .set(qEva.status, SchEvaluate.STATUS_NOT_EVA) |
| | | .where(qEva.evaluateId.in(evaluateIds.split(","))) |
| | | .execute(); |
| | | |
| | | |
| | | return new ResultJson(true, "success"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 复制 |
| | | */ |
| | |
| | | try { |
| | | SchEvaluate schEva = evaRepository.getOne(eva.getEvaluateId()); |
| | | SchEvaluateTemplate oldTemplate = this.read(SchEvaluateTemplate.class, schEva.getEvalTemplateId()); |
| | | |
| | | |
| | | // 1、生成习题组 |
| | | String newGroupId = exerciseService.doCopyExerciseByEvaluate(oldTemplate.getGroupId()); |
| | | |
| | | |
| | | // 2、生成模板 |
| | | SchEvaluateTemplate newTemplate = new SchEvaluateTemplate(); |
| | | |
| | | |
| | | BeanUtils.copyProperties(newTemplate, oldTemplate); |
| | | newTemplate.setEvaluateTemplateId(null); |
| | | newTemplate.setGroupId(newGroupId); |
| | | TraceUtils.setCreateTrace(newTemplate); |
| | | this.save(newTemplate); |
| | | |
| | | |
| | | // 3、生成评估表 |
| | | SchEvaluate newEva = new SchEvaluate(); |
| | | BeanUtils.copyProperties(newEva, eva); |
| | |
| | | newEva.setDeleteFlag(false); |
| | | TraceUtils.setCreateTrace(newEva); |
| | | this.save(newEva); |
| | | |
| | | |
| | | return new ResultJson(true, "success", CollectionUtils.newObjectMap("evaluateId", newEva.getEvaluateId(), "groupId", newGroupId)); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | log.error("doCopy评估复制:复制练习BeanUtils.copyProperties()方法copy失败", e); |
| | | } |
| | | |
| | | |
| | | return new ResultJson(false); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查看结果 问卷整体情况 |
| | | * @param evaluateId |
| | |
| | | */ |
| | | @Override |
| | | public ResultJson queryEvaluateDetail(String evaluateId,String groupId){ |
| | | |
| | | |
| | | // 1、查询已提交问卷list |
| | | List<Map<String, Object>> answerUserLst = queryAnswerEvaLst(evaluateId); |
| | | |
| | | |
| | | // 已经答题过的学员id |
| | | List<String> userAnswerList = new ArrayList<String>(answerUserLst.size()); |
| | | for(Map<String,Object> map:answerUserLst){ |
| | | userAnswerList.add(String.valueOf(map.get("userId"))); |
| | | } |
| | | |
| | | |
| | | // 2、查询未提交答案list |
| | | List<Map<String,Object>> notAnswerUserLst = this.queryNotAnswerEvaLst(evaluateId, userAnswerList); |
| | | |
| | | |
| | | return new ResultJson(true, "success", |
| | | |
| | | |
| | | return new ResultJson(true, "success", |
| | | CollectionUtils.newObjectMap("answerUserLst",answerUserLst, |
| | | "notAnswerUserLst",notAnswerUserLst)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | private List<Map<String, Object>> queryAnswerEvaLst(String evaluateId) { |
| | | |
| | | |
| | | QExerciseRecord record = QExerciseRecord.exerciseRecord; |
| | | QSchEvaRecordRe reEva = QSchEvaRecordRe.schEvaRecordRe; |
| | | |
| | | |
| | | List<Map<String,Object>> answerUserLst = this.getQueryFactory() |
| | | .select(record).from(record, reEva) |
| | | .where(record.recordId.eq(reEva.exerciseRecordId) |
| | |
| | | map.put("submitTime", tuple.getSubmitTime()); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | |
| | | return answerUserLst; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询未答题的学员list |
| | | * @param rangeType |
| | |
| | | * @return |
| | | */ |
| | | private List<Map<String,Object>> queryNotAnswerEvaLst(String evaluateId,List<String> userAnswerList ){ |
| | | |
| | | |
| | | SchEvaluate eva = this.read(SchEvaluate.class, evaluateId); |
| | | String[] evalRangeIds = eva.getEvalRangeId().split(","); |
| | | String rangeType = eva.getEvalRangeType(); |
| | | |
| | | |
| | | QClsClassReSubject re = QClsClassReSubject.clsClassReSubject; |
| | | QStuStudent stu = QStuStudent.stuStudent; |
| | | QSubject qSubject = QSubject.subject; |
| | | |
| | | |
| | | Predicate predicate = null; |
| | | if(SchEvaluate.EVALUATE_RANGE_LESSON.equals(rangeType)){//课程 |
| | | |
| | | |
| | | predicate = stu.classId.in(getQueryFactory().select(re.classId).from(re,qSubject) |
| | | .where(qSubject.origSubjectId.in(evalRangeIds).and(re.subjectId.eq(qSubject.subjectId)) |
| | | .and(qSubject.deleteFlag.isFalse()).and(re.deleteFlag.eq(false)))); |
| | | }else if(SchEvaluate.EVALUATE_RANGE_CLASS.equals(rangeType)){//班级 |
| | | |
| | | |
| | | predicate = stu.classId.in(evalRangeIds); |
| | | }else if(SchEvaluate.EVALUATE_RANGE_PERSON.equals(rangeType)){//人员 |
| | | |
| | | |
| | | predicate = stu.userId.in(evalRangeIds); |
| | | } |
| | | |
| | | |
| | | List<Map<String,Object>> notAnswerUserLst = this.getQueryFactory().select(stu.userId, stu.name).distinct() |
| | | .from(stu) |
| | | .where(stu.userId.notIn(userAnswerList)// 过滤掉已经答题过的学员 |
| | |
| | | map.put("submitTime", null); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | |
| | | return notAnswerUserLst; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** ------前端 ---------------------------start------------------------------------------------------------------ */ |
| | | |
| | | |
| | | /** |
| | | * 提交答案 |
| | | * @param score |
| | |
| | | */ |
| | | @Override |
| | | public ResultJson doSubmitTeachEvalScoreData(TeachEvaScoreResult scoreResult, String userId) { |
| | | |
| | | |
| | | List<TeachEvaScoreData> lstScore = scoreResult.getItems(); |
| | | String evaluateId = scoreResult.getEvaluateId(); |
| | | |
| | | |
| | | // 1.操作ExerciseRecord做题记录 |
| | | ExerciseRecord record = this.doOperExerciseRecord(scoreResult); |
| | | |
| | | |
| | | if(null == record){ |
| | | return new ResultJson(false,"您已经提交,不能重复提交"); |
| | | } |
| | | String exerciseRecordId = record.getRecordId(); |
| | | |
| | | |
| | | if(!scoreResult.getItems().isEmpty()){ |
| | | // 2.记录练习答案 ExerciseItemAnswerU |
| | | this.doOperExerciseItemAnswerUBatch(lstScore, exerciseRecordId); |
| | | } |
| | | |
| | | |
| | | // 3.插入评估记录关联表 |
| | | this.doOperSchEvaRecordRe(exerciseRecordId, evaluateId); |
| | | |
| | | |
| | | // 4.更新评估表的完成人数 |
| | | SchEvaluate eval = this.updateEvaluateCount(evaluateId); |
| | | |
| | | |
| | | if(!scoreResult.getItems().isEmpty()){ |
| | | // 5.插入评估明细表 |
| | | this.insertEvaluateDetailBatch(lstScore,evaluateId); |
| | | } |
| | | |
| | | return new ResultJson(true, "操作成功", |
| | | |
| | | return new ResultJson(true, "操作成功", |
| | | CollectionUtils.newObjectMap("doNumber", eval.getEvaluateCount(), "recordId", exerciseRecordId)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 操作本次做题记录 |
| | | * @return |
| | | */ |
| | | public ExerciseRecord doOperExerciseRecord(TeachEvaScoreResult scoreResult) { |
| | | |
| | | |
| | | String hql = "select count(r.recordId) from SchEvaRecordRe re, ExerciseRecord r " |
| | | + " where re.exerciseRecordId=r.recordId and re.evaluateId=? and r.userId=? and r.deleteFlag is false"; |
| | | |
| | | |
| | | int count = this.findCount(hql, CollectionUtils.newList(scoreResult.getEvaluateId(), ClientUtils.getUserId())); |
| | | |
| | | |
| | | if(count > 0){ |
| | | return null; |
| | | } |
| | | |
| | | |
| | | String doCount = String.valueOf(scoreResult.getItems().size()); |
| | | |
| | | |
| | | // 2.查询总题目数 |
| | | ExerciseGroup group = this.findUnique("select g from ExerciseGroup g,SchEvaluate e,SchEvaluateTemplate t " |
| | | + "where g.groupId=t.groupId and e.evalTemplateId=t.evaluateTemplateId and e.evaluateId=?" |
| | | + " and g.deleteFlag is false and e.deleteFlag is false ", |
| | | + " and g.deleteFlag is false and e.deleteFlag is false ", |
| | | CollectionUtils.newList(scoreResult.getEvaluateId()), ExerciseGroup.class); |
| | | BigInteger allCount = group.getAllCount(); |
| | | |
| | | |
| | | // 3.查询做题记录obj |
| | | BigDecimal completionRate = ExerciseUtils.parseStrToBigDecimal(doCount, String.valueOf(allCount)); |
| | | |
| | | |
| | | ExerciseRecord record = new ExerciseRecord(); |
| | | record.setExerciseGroupId(group.getGroupId()); |
| | | record.setUserId(ClientUtils.getUserId()); |
| | |
| | | record.setDoCount(new BigInteger(doCount)); |
| | | TraceUtils.setCreateTrace(record); |
| | | this.save(record); |
| | | |
| | | |
| | | return record; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 批量增加或修改练习记录答案 |
| | | * @return |
| | | */ |
| | | public Result doOperExerciseItemAnswerUBatch(List<TeachEvaScoreData> lstScore, String exerciseRecordId) { |
| | | String userId = ClientUtils.getUserId(); |
| | | |
| | | |
| | | List<ExerciseItemAnswerU> lstNewAnswerU = new ArrayList<ExerciseItemAnswerU>(lstScore.size()); |
| | | // 组装答案记录 |
| | | ExerciseItemAnswerU answerU = null; |
| | |
| | | continue; |
| | | } |
| | | answerU = new ExerciseItemAnswerU(); |
| | | |
| | | |
| | | answerU.setExerciseItemId(score.getExerciseId()); |
| | | answerU.setExerciseRecordId(exerciseRecordId); |
| | | answerU.setAnswer(score.getAnswer()); |
| | |
| | | TraceUtils.setCreateTrace(answerU); |
| | | lstNewAnswerU.add(answerU); |
| | | } |
| | | |
| | | |
| | | // 批量保存 |
| | | this.saveOrUpdateAll(lstNewAnswerU); |
| | | |
| | | |
| | | return new Result(true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 批量增加或修改评估明细记录 |
| | | * @return |
| | | */ |
| | | public Result insertEvaluateDetailBatch(List<TeachEvaScoreData> lstScore,String evaluateId) { |
| | | |
| | | |
| | | Map<String, Object> argsMap = new HashMap<String, Object>(lstScore.size()); |
| | | |
| | | |
| | | Object[] args = new Object[lstScore.size()]; |
| | | for(int i=0; i<lstScore.size(); i++){ |
| | | args[i] = lstScore.get(i).getExerciseId(); |
| | | } |
| | | argsMap.put("exerciseIds", args); |
| | | |
| | | |
| | | String hql_score = "from ExerciseItemScore where exerciseItemId in (:exerciseIds) and deleteFlag is false "; |
| | | List<ExerciseItemScore> lstscores = this.findByComplexHql(hql_score, argsMap, ExerciseItemScore.class); |
| | | Map<String, String> scoreMap = new HashMap<String,String>(lstscores.size()); |
| | | for(ExerciseItemScore score:lstscores){ |
| | | scoreMap.put(score.getExerciseItemId()+score.getExerciseItemAnswer(), score.getScore()); |
| | | } |
| | | |
| | | |
| | | String userId = ClientUtils.getUserId(); |
| | | String userName = ClientUtils.getUserName(); |
| | | |
| | | |
| | | List<SchEvaluateDetail> lstDetail = new ArrayList<SchEvaluateDetail>(lstScore.size()); |
| | | SchEvaluateDetail record = null; |
| | | for(TeachEvaScoreData score:lstScore){ |
| | |
| | | record.setEvaluater(userName); |
| | | record.setDeleteFlag(false); |
| | | TraceUtils.setCreateTrace(record); |
| | | |
| | | |
| | | lstDetail.add(record); |
| | | } |
| | | |
| | | |
| | | // 批量保存 |
| | | this.saveOrUpdateAll(lstDetail); |
| | | |
| | | |
| | | return new Result(true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增评估与记录关联表 |
| | | * @param groupId |
| | | * @return |
| | | * @return |
| | | */ |
| | | public Result doOperSchEvaRecordRe(String recordId, String evaluateId) { |
| | | |
| | | String hql = "from SchEvaRecordRe where evaluateId=? and exerciseRecordId=?"; |
| | | |
| | | List<SchEvaRecordRe> recordLst = this.find(hql, |
| | | |
| | | List<SchEvaRecordRe> recordLst = this.find(hql, |
| | | CollectionUtils.newList(evaluateId, recordId), SchEvaRecordRe.class); |
| | | |
| | | |
| | | if(!recordLst.isEmpty()){ |
| | | return new Result(true); |
| | | } |
| | | |
| | | |
| | | SchEvaRecordRe record = new SchEvaRecordRe(); |
| | | record.setEvaluateId(evaluateId); |
| | | record.setExerciseRecordId(recordId); |
| | |
| | | record.setClassId(ClientUtils.getClassId()); |
| | | record.setOrgId(ClientUtils.getOrgId()); |
| | | } |
| | | |
| | | |
| | | this.save(record); |
| | | |
| | | |
| | | return new Result(true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新评估表记录 |
| | | * @return |
| | | */ |
| | | public SchEvaluate updateEvaluateCount(String evaluateId) { |
| | | |
| | | |
| | | SchEvaluate record = this.read(SchEvaluate.class, evaluateId); |
| | | |
| | | |
| | | if(record == null){ |
| | | return null; |
| | | return null; |
| | | } |
| | | |
| | | |
| | | record.setEvaluateCount(BigInteger.valueOf(this.getEvaluateCount(evaluateId))); |
| | | TraceUtils.setUpdateTrace(record); |
| | | |
| | | |
| | | // 保存 |
| | | this.save(record); |
| | | |
| | | |
| | | return record; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询问卷统计 |
| | | * @param groupId |
| | |
| | | public ResultJson queryEvaluateStatis(String groupId, String evaluateId) { |
| | | |
| | | List<ExerciseItem> items = exerciseService.readExerciseItems4Evaluate(groupId); |
| | | |
| | | |
| | | SchEvaluate objSchEvaluate = this.read(SchEvaluate.class, evaluateId); |
| | | |
| | | |
| | | QExerciseRecord record = QExerciseRecord.exerciseRecord; |
| | | QExerciseItemAnswerU answerU = QExerciseItemAnswerU.exerciseItemAnswerU; |
| | | QSchEvaRecordRe re = QSchEvaRecordRe.schEvaRecordRe; |
| | | QUser qUser = QUser.user; |
| | | |
| | | |
| | | for (ExerciseItem objExerciseItem : items) { |
| | | |
| | | |
| | | List<Tuple> lstTuple = this.getQueryFactory().select(answerU, qUser) |
| | | .from(record,answerU,re,qUser) |
| | | .where(record.recordId.eq(answerU.exerciseRecordId) |
| | |
| | | .and(answerU.deleteFlag.eq(false)) |
| | | .and(record.deleteFlag.eq(false)) |
| | | ).orderBy(answerU.createTime.desc()).fetch(); |
| | | |
| | | |
| | | if(lstTuple != null && !lstTuple.isEmpty()) { |
| | | List<ExerciseItemAnswerU> lstExerciseItemAnswerU = new ArrayList<>(); |
| | | for(Tuple tuple : lstTuple) { |
| | |
| | | objExerciseItemAnswerU.setImgPath(tuple.get(qUser).getImgPath()); |
| | | lstExerciseItemAnswerU.add(objExerciseItemAnswerU); |
| | | } |
| | | |
| | | |
| | | // 查询答案 |
| | | objExerciseItem.setExerciseItemAnswerU(lstExerciseItemAnswerU); |
| | | } |
| | |
| | | // 查询应评估总人数 |
| | | objSchEvaluate.setEvaluateAllCount(BigInteger.valueOf(this |
| | | .queryEvaluateAllCount(objSchEvaluate.getEvalRangeType(),objSchEvaluate.getEvalRangeId().split(",")))); |
| | | |
| | | |
| | | //拼装前端所需要的数据 |
| | | Map<String, Object> resultMap = |
| | | Map<String, Object> resultMap = |
| | | ExerciseUtils.packageExerciseDetail(items, objSchEvaluate); |
| | | |
| | | |
| | | return new ResultJson(true, "success", resultMap); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询应评估人数 |
| | | * @param rangeType |
| | |
| | | * @return |
| | | */ |
| | | private long queryEvaluateAllCount(String rangeType, String[] evalRangeIds){ |
| | | |
| | | |
| | | QClsClassReSubject re = QClsClassReSubject.clsClassReSubject; |
| | | QStuStudent stu = QStuStudent.stuStudent; |
| | | QSubject qSubject = QSubject.subject; |
| | | |
| | | |
| | | Predicate predicate = null; |
| | | if(SchEvaluate.EVALUATE_RANGE_LESSON.equals(rangeType)){//课程 |
| | | |
| | | |
| | | predicate = stu.classId.in(getQueryFactory().select(re.classId).from(re,qSubject) |
| | | .where(qSubject.origSubjectId.in(evalRangeIds).and(re.subjectId.eq(qSubject.subjectId)) |
| | | .and(qSubject.deleteFlag.isFalse()).and(re.deleteFlag.eq(false)))); |
| | | }else if(SchEvaluate.EVALUATE_RANGE_CLASS.equals(rangeType)){//班级 |
| | | |
| | | |
| | | predicate = stu.classId.in(evalRangeIds); |
| | | }else if(SchEvaluate.EVALUATE_RANGE_PERSON.equals(rangeType)){//人员 |
| | | |
| | | |
| | | return evalRangeIds.length; |
| | | } |
| | | |
| | | |
| | | long allCount = this.getQueryFactory() |
| | | .from(stu) |
| | | .where(stu.deleteFlag.eq(false).and(predicate).and(stu.status.eq(StuStudent.STATUS_ACTIVE))).groupBy(stu.userId) |
| | | .fetchCount(); |
| | | |
| | | |
| | | return allCount; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取问卷答卷人数 |
| | | * |
| | | * |
| | | * @param schEvaluateId |
| | | * @param classId |
| | | * @return |
| | |
| | | private long getEvaluateCount(String evaluateId){ |
| | | QSchEvaRecordRe re = QSchEvaRecordRe.schEvaRecordRe; |
| | | QExerciseRecord record = QExerciseRecord.exerciseRecord; |
| | | |
| | | |
| | | long count = this.getQueryFactory().from(re,record) |
| | | .where(re.exerciseRecordId.eq(record.recordId) |
| | | .and(record.deleteFlag.eq(false)) |
| | | .and(re.evaluateId.eq(evaluateId)) |
| | | ).groupBy(record.userId) |
| | | .fetchCount(); |
| | | |
| | | |
| | | return count; |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public ResultJson queryStuEvaluateList(Pager pager) { |
| | | |
| | | |
| | | QEvaluateStuStudentV view = QEvaluateStuStudentV.evaluateStuStudentV; |
| | | List<EvaluateStuStudentV> lstView = this.getQueryFactory() |
| | | .selectFrom(view) |
| | | .where(view.id.userId.eq(ClientUtils.getUserId())).limit(pager.getPageSize()).offset(pager.getOffset()) |
| | | .orderBy(view.createTime.desc()) |
| | | .fetch(); |
| | | |
| | | |
| | | QSchEvaRecordRe re = QSchEvaRecordRe.schEvaRecordRe; |
| | | QExerciseRecord r= QExerciseRecord.exerciseRecord; |
| | | |
| | | |
| | | ExerciseRecord record = null; |
| | | for(EvaluateStuStudentV evaV:lstView){ |
| | | |
| | | |
| | | record = this.getQueryFactory().select(r) |
| | | .from(re,r) |
| | | .where(re.exerciseRecordId.eq(r.recordId) |
| | |
| | | evaV.setExerciseRecordId(record.getRecordId()); |
| | | evaV.setGroupId(record.getExerciseGroupId()); |
| | | } |
| | | |
| | | |
| | | evaV.setEvaluateId(evaV.getId().getEvaluateId()); |
| | | evaV.setUserId(evaV.getId().getUserId()); |
| | | } |
| | | |
| | | |
| | | return new ResultJson(true,"success",lstView); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询学生评估count |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryStuEvaluateCount() { |
| | | |
| | | |
| | | QEvaluateStuStudentV view = QEvaluateStuStudentV.evaluateStuStudentV; |
| | | |
| | | |
| | | long allCount = this.getQueryFactory() |
| | | .selectFrom(view) |
| | | .where(view.id.userId.eq(ClientUtils.getUserId())) |
| | | .fetchCount(); |
| | | QSchEvaRecordRe re = QSchEvaRecordRe.schEvaRecordRe; |
| | | QExerciseRecord r= QExerciseRecord.exerciseRecord; |
| | | |
| | | |
| | | long doCount = this.getQueryFactory().select(view).distinct() |
| | | .from(re,r, view) |
| | | .where(re.exerciseRecordId.eq(r.recordId) |
| | |
| | | .and(r.userId.eq(ClientUtils.getUserId())).and(view.id.userId.eq(ClientUtils.getUserId())) |
| | | .and(r.deleteFlag.eq(false)) |
| | | ).fetchCount(); |
| | | |
| | | |
| | | return CollectionUtils.newObjectMap("allCount", allCount, "doCount", doCount); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public ResultJson doGetEvalExerItemResponseDataNew(String evaluateId) { |
| | | String groupId = this.findUnique("select t.groupId from SchEvaluateTemplate t,SchEvaluate e " |
| | | + "where t.evaluateTemplateId=e.evalTemplateId and e.evaluateId=?", |
| | | + "where t.evaluateTemplateId=e.evalTemplateId and e.evaluateId=?", |
| | | CollectionUtils.newList(evaluateId),String.class); |
| | | |
| | | |
| | | // 2.查找评估组下所有对应的练习 |
| | | String hql_item = "select item" |
| | | + " from ExerciseItem item, ExerciseGroupItemRe re, ExerciseGroup g" |
| | |
| | | + " and re.deleteFlag is false" |
| | | + " and item.deleteFlag is false" |
| | | + " order by re.itemOrder"; |
| | | |
| | | |
| | | List<ExerciseItem> lstItems = this.find(hql_item, CollectionUtils.newList(groupId), ExerciseItem.class); |
| | | if(lstItems.isEmpty()){ |
| | | return new ResultJson(false,"当前评估未添加题目"); |
| | |
| | | |
| | | // 重新组装练习选项 |
| | | ExerciseUtils.packageExerciseItem(lstItems, lstUserAnswer, lstOptionImgs); |
| | | |
| | | |
| | | Map<String, List<ExerciseObjectImg>> imgItemMap = ExerciseUtils.packageExerciseItemImg(lstItemImgs); |
| | | |
| | | |
| | | for(ExerciseItem item:lstItems){ |
| | | // 4.5题目中是否有图片 |
| | | if(imgItemMap.get(item.getExerciseId()) != null){ |
| | | item.setImgs(imgItemMap.get(item.getExerciseId())); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | return new ResultJson(true,"success",lstItems); |
| | | } |
| | | |
| | | |
| | | } |