| | |
| | | @Override |
| | | public List<MyLectureV> listLectureV(String learnerId, String chapterId, String keyword, Integer pageSize, |
| | | Integer pageNum, String type) { |
| | | StringBuffer hql1 = new StringBuffer("from MyLectureV where subjectId=? and id.userId=?"); |
| | | List<Object> args1 = CollectionUtils.newList(chapterId, learnerId); |
| | | List<MyLectureV> myLectureVList = findList(hql1.toString(), new Pager(pageSize, pageNum), args1, MyLectureV.class); |
| | | StringBuffer hql = new StringBuffer("from MyLectureV where subjectId=? and id.userId=?"); |
| | | List<Object> args = CollectionUtils.newList(chapterId, learnerId); |
| | | List<MyLectureV> myLectureVList = findList(hql.toString(), new Pager(pageSize, pageNum), args, MyLectureV.class); |
| | | |
| | | StringBuffer hql = new StringBuffer("from MyLectureV where chapterId=? and id.userId=? order by lectureCreateTime desc"); |
| | | List<Object> args = CollectionUtils.newList(myLectureVList.get(0).getChapterId(), learnerId); |
| | | if(myLectureVList.size() < 1){ |
| | | |
| | | }else { |
| | | hql = new StringBuffer("from MyLectureV where chapterId=? and id.userId=? order by lectureCreateTime desc"); |
| | | args = CollectionUtils.newList(myLectureVList.get(0).getChapterId(), learnerId); |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(type)) { |
| | | hql.append(" and lectureType=?"); |
| | | args.add(type); |
| | | } |
| | | |
| | | List<MyLectureV> result = findList(hql.toString(), new Pager(pageSize, pageNum), args, MyLectureV.class); |
| | | |
| | | return result; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public Result doStudy(String clsLectureId, Double from, Double to) { |
| | | return progressService.addProgress(Progress.PROGRESS_TYPE_LECTURE, clsLectureId, from.intValue(), to.intValue(), |
| | | return progressService.addProgress(Progress.PROGRESS_TYPE_LECTURE, clsLectureId, from.doubleValue(), to.doubleValue(), |
| | | ClientUtils.getUserId()); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Cacheable(value = "progress", key = "#targetId+#learnerId") |
| | | public int[][] getProgress(String targetId, String learnerId) { |
| | | public Double[][] getProgress(String targetId, String learnerId) { |
| | | List<SubjectLectureProgressDetail> lstDetail = this.find("from SubjectLectureProgressDetail where targetId = ? and learnerId = ? and deleteFlag is false", CollectionUtils.newList(targetId, learnerId), SubjectLectureProgressDetail.class); |
| | | if(lstDetail == null || lstDetail.isEmpty()) { |
| | | return new int[][] {}; |
| | | return new Double[][] {}; |
| | | }else { |
| | | int[][] progress = new int[lstDetail.size()][2]; |
| | | Double[][] progress = new Double[lstDetail.size()][2]; |
| | | int i = 0; |
| | | for(SubjectLectureProgressDetail objDetail : lstDetail) { |
| | | progress[i++] = new int[] {objDetail.getStart(), objDetail.getEnd()}; |
| | | progress[i++] = new Double[] {objDetail.getStart(), objDetail.getEnd()}; |
| | | } |
| | | |
| | | return progress; |
| | |
| | | } |
| | | |
| | | @CachePut(value = "progress", key = "#targetId+#learnerId") |
| | | public int[][] mergeProgress(String targetId, String learnerId, int start, int end, int[][] origProgress) { |
| | | public Double[][] mergeProgress(String targetId, String learnerId, Double start, Double end, Double[][] origProgress) { |
| | | return StudyProgressUtils.merge(origProgress, start, end); |
| | | } |
| | | |
| | |
| | | private static final long serialVersionUID = -1565188126862586738L; |
| | | private String detailId; |
| | | private String progressId; |
| | | private int start; |
| | | private int end; |
| | | private Double start; |
| | | private Double end; |
| | | private String learnerId; |
| | | private String targetId; |
| | | private Date createTime; |
| | |
| | | this.progressId = progressId; |
| | | } |
| | | |
| | | public int getStart() { |
| | | public Double getStart() { |
| | | return start; |
| | | } |
| | | |
| | | |
| | | |
| | | public void setStart(int start) { |
| | | public void setStart(Double start) { |
| | | this.start = start; |
| | | } |
| | | |
| | | |
| | | |
| | | public int getEnd() { |
| | | public Double getEnd() { |
| | | return end; |
| | | } |
| | | |
| | | |
| | | |
| | | public void setEnd(int end) { |
| | | public void setEnd(Double end) { |
| | | this.end = end; |
| | | } |
| | | |
| | |
| | | * @param end 学习结束位置 |
| | | * @return |
| | | */ |
| | | Result addProgress(String targetId,String learnerId,int start,int end); |
| | | Result addProgress(String targetId,String learnerId,Double start,Double end); |
| | | |
| | | /** |
| | | * 返回进度类型 |
| | |
| | | * 学习结束位置 |
| | | * @return |
| | | */ |
| | | Result addProgress(String type, String targetId, int start, int end, String userId); |
| | | Result addProgress(String type, String targetId, Double start, Double end, String userId); |
| | | |
| | | List<SubjectProgressTreeV> getSubjectChapterTreeVList(String parentId,String userId); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result addProgress(String type, String targetId, int start, int end, String userId) { |
| | | public Result addProgress(String type, String targetId, Double start, Double end, String userId) { |
| | | String userId_ = StringUtils.isBlank(userId) ? ClientUtils.getUserId() : userId; |
| | | return resItemServiceMap.get(type).addProgress(targetId, userId_, start, end); |
| | | } |
| | |
| | | BigDecimal progressValue = new BigDecimal(itemProgress.get("progressValue").toString()); |
| | | if (progress == null) { |
| | | String nodeType = subjectProgressTreeV.getNodeType(); |
| | | this.addProgress(nodeType, nodeId, 0, 0, userId); |
| | | this.addProgress(nodeType, nodeId, 0.0, 0.0, userId); |
| | | cacheService.lstRightPush(SUBJECT_PROGRESS_STATISTIC, nodeIdOrUserId); |
| | | return; |
| | | } |
| | |
| | | * 结束位置 |
| | | * @return |
| | | */ |
| | | public static int[][] merge(int[][] orig, int start, int end) { |
| | | public static Double[][] merge(Double[][] orig, Double start, Double end) { |
| | | |
| | | // 中间合并结果 |
| | | int[][] result = new int[orig.length + 1][2]; |
| | | Double[][] result = new Double[orig.length + 1][2]; |
| | | |
| | | int j = 0; |
| | | int i = 0; |
| | |
| | | |
| | | switch (action) { |
| | | case ACTION_INSERT: { |
| | | result[j++] = new int[] { start, end }; |
| | | result[j++] = new Double[] { start, end }; |
| | | result[j++] = orig[i]; |
| | | breakFlag = true; |
| | | break; |
| | | } |
| | | case ACTION_MERGE_01: { |
| | | result[j++] = new int[] { start, orig[i][1] }; |
| | | result[j++] = new Double[] { start, orig[i][1] }; |
| | | breakFlag = true; |
| | | break; |
| | | } |
| | |
| | | } |
| | | |
| | | // 如果本次学习终止位置超出以往所有学习进度,则添加到最后 |
| | | if (orig.length == 0 || pos(end, orig[orig.length - 1]) == POS_AFTER) { |
| | | result[j++] = new int[] { start, end }; |
| | | if (orig.length == 0 ) { |
| | | result[j++] = new Double[] { start, end }; |
| | | }else if(pos(end, orig[orig.length - 1]) == POS_AFTER){ |
| | | result[j++] = new Double[] { start, end }; |
| | | } |
| | | |
| | | // 最终合并结果,去掉中间合并结果的多出为空的元素 |
| | | int[][] finalResult = new int[j][2]; |
| | | Double[][] finalResult = new Double[j][2]; |
| | | |
| | | for (int k = 0; k < result.length; k++) { |
| | | if (result[k][0] == 0 && result[k][1] == 0 && k>0) { |
| | |
| | | * 全部学习进度 |
| | | * @return |
| | | */ |
| | | public static int sum(int[][] orig) { |
| | | public static Double sum(Double[][] orig) { |
| | | |
| | | int sum = 0; |
| | | Double sum = 0.0; |
| | | |
| | | for (int[] item : orig) { |
| | | for (Double[] item : orig) { |
| | | sum += (item[1] - item[0] + 1); |
| | | } |
| | | return sum; |
| | | |
| | | } |
| | | |
| | | private static int action(int[] segment, int start, int end) { |
| | | private static int action(Double[] segment, Double start, Double end) { |
| | | int startPos = pos(start, segment); |
| | | int endPos = pos(end, segment); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | private static int pos(int index, int[] range) { |
| | | private static int pos(Double index, Double[] range) { |
| | | if (index < range[0]) { |
| | | return POS_BEFORE; |
| | | } |
| | |
| | | public class ChapterProgressService extends CommonAppService implements IDetailProgressService { |
| | | |
| | | @Override |
| | | public Result addProgress(String targetId, String learnerId, int start, int end) { |
| | | public Result addProgress(String targetId, String learnerId, Double start, Double end) { |
| | | Progress p = new Progress(); |
| | | TraceUtils.setCreateTrace(p); |
| | | p.setLearnerId(learnerId); |
| | |
| | | public class ClassProgressService extends CommonAppService implements IDetailProgressService { |
| | | |
| | | @Override |
| | | public Result addProgress(String targetId, String learnerId, int start, int end) { |
| | | public Result addProgress(String targetId, String learnerId, Double start, Double end) { |
| | | Progress p = new Progress(); |
| | | TraceUtils.setCreateTrace(p); |
| | | p.setLearnerId(learnerId); |
| | |
| | | |
| | | |
| | | @Override |
| | | public Result addProgress(String targetId,String learnerId, int start, int end) { |
| | | public Result addProgress(String targetId,String learnerId, Double start, Double end) { |
| | | ClsSubjectLecture lecture = lectureService.readClsLecture(targetId); |
| | | |
| | | String lectureType = null; |
| | |
| | | public class SubjectProgressService extends CommonAppService implements IDetailProgressService { |
| | | |
| | | @Override |
| | | public Result addProgress(String targetId, String learnerId, int start, int end) { |
| | | public Result addProgress(String targetId, String learnerId, Double start, Double end) { |
| | | Progress p = new Progress(); |
| | | TraceUtils.setCreateTrace(p); |
| | | p.setLearnerId(learnerId); |
| | |
| | | ProgressDAO dao; |
| | | |
| | | @Override |
| | | public Result addProgress(String targetId, String learnerId, int start, int end) { |
| | | public Result addProgress(String targetId, String learnerId, Double start, Double end) { |
| | | |
| | | if (start > end || start < 0 || end < 0) { |
| | | return new Result(false, "invalid arguments"); |
| | | } |
| | | |
| | | int[][] progress = dao.mergeProgress(targetId, learnerId, start, end , dao.getProgress(targetId, learnerId)); |
| | | Double[][] progress = dao.mergeProgress(targetId, learnerId, start, end , dao.getProgress(targetId, learnerId)); |
| | | |
| | | if (!checkLecture(targetId).isSuccess()) { |
| | | return checkLecture(targetId); |
| | | } |
| | | |
| | | int sum = StudyProgressUtils.sum(progress); |
| | | Double sum = StudyProgressUtils.sum(progress); |
| | | |
| | | Progress p = dao.getProgress(Progress.PROGRESS_TYPE_LECTURE, targetId, learnerId); |
| | | |
| | |
| | | * @param progressId |
| | | * @param learnerId |
| | | */ |
| | | private void saveProgressDetail(int start, int end, String targetId, String progressId, String learnerId) { |
| | | private void saveProgressDetail(Double start, Double end, String targetId, String progressId, String learnerId) { |
| | | SubjectLectureProgressDetail detail = new SubjectLectureProgressDetail(); |
| | | detail.setDeleteFlag(false); |
| | | detail.setEnd(end); |
| | |
| | | * @param sum |
| | | * @return |
| | | */ |
| | | protected double getProgressPercent(String targetId, int sum) { |
| | | protected double getProgressPercent(String targetId, Double sum) { |
| | | return 1.00d; |
| | | } |
| | | |
| | |
| | | return Progress.PROGRESS_TYPE_LECTURE; |
| | | } |
| | | |
| | | protected void updateProgress(String targetId, Progress p, int sum) { |
| | | protected void updateProgress(String targetId, Progress p, Double sum) { |
| | | |
| | | TraceUtils.setUpdateTrace(p); |
| | | p.setProgressValue(BigDecimal.valueOf(Long.valueOf(sum))); |
| | | p.setProgressValue(BigDecimal.valueOf(Double.valueOf(sum))); |
| | | p.setProgressPercent(1d); |
| | | |
| | | save(p); |
| | | |
| | | } |
| | | |
| | | protected Progress newProgress(String targetId, String learnerId, int sum) { |
| | | protected Progress newProgress(String targetId, String learnerId, Double sum) { |
| | | |
| | | Progress p = new Progress(); |
| | | TraceUtils.setCreateTrace(p); |
| | |
| | | p.setLearnerId(learnerId); |
| | | p.setLearnerName(ClientUtils.getUserName()); |
| | | p.setProgressUnit("s"); |
| | | p.setProgressValue(BigDecimal.valueOf(Long.valueOf(sum))); |
| | | p.setProgressValue(BigDecimal.valueOf(Double.valueOf(sum))); |
| | | p.setTargetId(targetId); |
| | | p.setType(Progress.PROGRESS_TYPE_LECTURE); |
| | | p.setProgressPercent(1d); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public double getProgressPercent(String targetId, int sum) { |
| | | public double getProgressPercent(String targetId, Double sum) { |
| | | |
| | | LectureDocV LectureDoc = lectureService.readDocLecture(targetId); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Progress newProgress(String targetId, String learnerId, int sum) { |
| | | public Progress newProgress(String targetId, String learnerId, Double sum) { |
| | | |
| | | Progress p = new Progress(); |
| | | TraceUtils.setCreateTrace(p); |
| | |
| | | p.setLearnerId(learnerId); |
| | | p.setLearnerName(ClientUtils.getUserName()); |
| | | p.setProgressUnit("s"); |
| | | p.setProgressValue(BigDecimal.valueOf(Long.valueOf(sum))); |
| | | p.setProgressValue(BigDecimal.valueOf(Double.valueOf(sum))); |
| | | p.setTargetId(targetId); |
| | | p.setType(Progress.PROGRESS_TYPE_LECTURE); |
| | | p.setProgressPercent(getProgressPercent(targetId, sum)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateProgress(String targetId, Progress p, int sum) { |
| | | public void updateProgress(String targetId, Progress p, Double sum) { |
| | | |
| | | TraceUtils.setUpdateTrace(p); |
| | | p.setProgressValue(BigDecimal.valueOf(Long.valueOf(sum))); |
| | | p.setProgressValue(BigDecimal.valueOf(Double.valueOf(sum))); |
| | | if(p.getProgressPercent() == null || getProgressPercent(targetId, sum)>p.getProgressPercent()) { |
| | | p.setProgressPercent(getProgressPercent(targetId, sum)); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Progress newProgress(String targetId, String learnerId, int sum) { |
| | | public Progress newProgress(String targetId, String learnerId, Double sum) { |
| | | |
| | | Progress p = new Progress(); |
| | | TraceUtils.setCreateTrace(p); |
| | |
| | | p.setLearnerId(learnerId); |
| | | p.setLearnerName(ClientUtils.getUserName()); |
| | | p.setProgressUnit("s"); |
| | | p.setProgressValue(BigDecimal.valueOf(Long.valueOf(sum))); |
| | | p.setProgressValue(BigDecimal.valueOf(Double.valueOf(sum))); |
| | | p.setTargetId(targetId); |
| | | p.setType(Progress.PROGRESS_TYPE_LECTURE); |
| | | p.setProgressPercent(getProgressPercent(targetId, sum)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateProgress(String targetId, Progress p, int sum) { |
| | | public void updateProgress(String targetId, Progress p, Double sum) { |
| | | |
| | | TraceUtils.setUpdateTrace(p); |
| | | p.setProgressValue(BigDecimal.valueOf(Long.valueOf(sum))); |
| | | p.setProgressValue(BigDecimal.valueOf(Double.valueOf(sum))); |
| | | if(p.getProgressPercent() == null || getProgressPercent(targetId, sum)>p.getProgressPercent()) { |
| | | p.setProgressPercent(getProgressPercent(targetId, sum)); |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.qxueyou.scc.base.dao.AbstractRedisTemplate; |
| | | import com.qxueyou.scc.base.dao.CommonRedisTemplate; |
| | | import com.qxueyou.scc.base.model.UserInfoWrapper; |
| | | import com.qxueyou.scc.base.service.impl.RedisCacheBean; |
| | | import com.qxueyou.scc.sys.utils.SpringContextHolder; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import com.qxueyou.scc.base.model.Constants; |
| | |
| | | import com.qxueyou.scc.sys.model.ResponseResult; |
| | | import com.qxueyou.scc.sys.model.SysMenu; |
| | | import com.qxueyou.scc.user.model.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.cache.RedisCache; |
| | | import org.springframework.data.redis.cache.RedisCacheManager; |
| | | import org.springframework.data.redis.core.RedisAccessor; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Repository; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | |
| | | private static ThreadLocal<UserInfoWrapper> threadLocalUserInfo = new ThreadLocal<UserInfoWrapper>(); |
| | | private static UserInfoWrapper wrapper = threadLocalUserInfo.get(); |
| | | |
| | | private static RedisTemplate redisTemplate = (RedisTemplate)SpringContextHolder.getBean("redisTemplate"); |
| | | |
| | | /** 得到用户信息*/ |
| | | public static UserInfoWrapper getUserInfo() { |
| | | UserInfoWrapper wrapper = threadLocalUserInfo.get(); |
| | | // UserInfoWrapper wrapper = threadLocalUserInfo.get(); |
| | | // if(wrapper == null) { |
| | | wrapper = (UserInfoWrapper)redisTemplate.opsForValue().get(UserInfoWrapper.SESSION_USER_INFO_KEY); |
| | | if(wrapper == null){ |
| | | wrapper = new UserInfoWrapper(); |
| | | User user = new User(); |
| | |
| | | wrapper.setUser(user); |
| | | setUserInfo(wrapper); |
| | | } |
| | | // } |
| | | // else{ |
| | | // redisTemplate.opsForValue().set(UserInfoWrapper.SESSION_USER_INFO_KEY,wrapper); |
| | | // } |
| | | |
| | | return wrapper; |
| | | } |
| | |
| | | String info = getUserInfo().getInfo(UserInfoWrapper.INF_USER_ID); |
| | | if(info.equals("visitor_001")){ |
| | | info= (String) session.getAttribute(UserInfoWrapper.INF_USER_ID); |
| | | }else { |
| | | session.setAttribute(UserInfoWrapper.INF_USER_ID,info); |
| | | } |
| | | return info; |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.qxueyou.scc.admin.classes.service.IClassLectureService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | ILectureService lectureService; |
| | | |
| | | @Autowired |
| | | IClassLectureService classLectureService; |
| | | |
| | | @Autowired |
| | | IResService resService; |
| | | |
| | | @Autowired |
| | |
| | | @GetMapping(value = "getSubjectLst") |
| | | public Result getList(String userId,String classId, String startTime, Integer limit, @RequestParam(defaultValue="1")Integer pageNum, HttpServletRequest request) { |
| | | userId = StringUtils.isEmpty(userId)?ClientUtils.getUserId():userId; |
| | | if(userId == null || userId == ""){ |
| | | userId = ClientUtils.getUserId(); |
| | | } |
| | | classId = StringUtils.isEmpty(classId)?ClientUtils.getClassId():classId; |
| | | List<MySubjectV> result = subjectService.listMySubjectV(classId,userId); |
| | | return new Result(true, "success", |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.Cookie; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | IStudentService studentService; |
| | | |
| | | @Resource |
| | | RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private IOrganizationService organizationService; |
| | |
| | | public void khdloginout(HttpServletRequest request, HttpServletResponse response) { |
| | | System.out.println("清除session"); |
| | | HttpSession session = request.getSession(); |
| | | redisTemplate.delete(UserInfoWrapper.SESSION_USER_INFO_KEY); |
| | | System.out.println(session.getAttribute("userId")); |
| | | System.out.println(session.getAttribute("classId")); |
| | | session.invalidate(); |
| | |
| | | param.setIp(RequestClientUtils.getRemoteIP(request)); |
| | | // 缓存到请求线程 |
| | | UserInfoWrapper wrapper = cacheUserInfo(param, null); |
| | | // 存到redis |
| | | redisTemplate.opsForValue().set(UserInfoWrapper.SESSION_USER_INFO_KEY, wrapper); |
| | | request.getSession().setAttribute(UserInfoWrapper.SESSION_USER_INFO_KEY, wrapper); |
| | | |
| | | return new Result(true, "success", |
| | | CollectionUtils.newObjectMap("userId", user.getUserId(), "userName", user.getName(), "imgPath", |
| | | user.getImgPath(), "orgName", ClientUtils.getOrgName(),"orgId", ClientUtils.getOrgId(), "orgLogo", |
| | |
| | | param.setIp(RequestClientUtils.getRemoteIP(request)); |
| | | // 缓存到请求线程 |
| | | UserInfoWrapper wrapper = cacheUserInfo(param, null); |
| | | // 存到redis |
| | | redisTemplate.opsForValue().set(UserInfoWrapper.SESSION_USER_INFO_KEY, wrapper); |
| | | request.getSession().setAttribute(UserInfoWrapper.SESSION_USER_INFO_KEY, wrapper); |
| | | if ("study".equals(logType)) { |
| | | /*if (StringUtils.isEmpty(ClientUtils.getClassId()) && user.getRoles() == null) { |
| | |
| | | private void doRelease(HttpServletRequest httpRequest, HttpServletResponse response) { |
| | | HttpSession se = httpRequest.getSession(); |
| | | se.removeAttribute(UserInfoWrapper.SESSION_USER_INFO_KEY); |
| | | redisTemplate.delete(UserInfoWrapper.SESSION_USER_INFO_KEY); |
| | | se.invalidate(); |
| | | } |
| | | |
New file |
| | |
| | | package com.qxueyou.scc.sys.utils; |
| | | |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | public class SpringContextHolder implements ApplicationContextAware { |
| | | |
| | | /** |
| | | * 以静态变量保存ApplicationContext,可在任意代码中取出ApplicaitonContext. |
| | | */ |
| | | private static ApplicationContext context; |
| | | |
| | | /** |
| | | * 实现ApplicationContextAware接口的context注入函数, 将其存入静态变量. |
| | | */ |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| | | SpringContextHolder.context = applicationContext; |
| | | } |
| | | |
| | | /** |
| | | * 获取applicationContext |
| | | * @return |
| | | */ |
| | | public ApplicationContext getApplicationContext() { |
| | | return context; |
| | | } |
| | | |
| | | /** |
| | | * 通过name获取 Bean. |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public static Object getBean(String name){ |
| | | return context.getBean(name); |
| | | } |
| | | |
| | | /** |
| | | * 通过class获取Bean. |
| | | * @param <T> |
| | | * @param clazz |
| | | * @return |
| | | */ |
| | | public static <T> Map<String, T> getBeans(Class<T> clazz){ |
| | | return context.getBeansOfType(clazz); |
| | | } |
| | | |
| | | /** |
| | | * 通过class获取Bean. |
| | | * @param clazz |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> T getBean(Class<T> clazz){ |
| | | return context.getBean(clazz); |
| | | } |
| | | |
| | | /** |
| | | * 通过name,以及Clazz返回指定的Bean |
| | | * @param name |
| | | * @param clazz |
| | | * @param <T> |
| | | * @return |
| | | */ |
| | | public static <T> T getBean(String name, Class<T> clazz){ |
| | | return context.getBean(name, clazz); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.qxueyou.scc.admin.classes.service.IClassLectureService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | |
| | | |
| | | @Autowired |
| | | IProgressService progressService; |
| | | |
| | | @Autowired |
| | | IClassLectureService clsLectureService; |
| | | |
| | | @Override |
| | | public Result addChapter(String subjectId, String parentChapterId, String name) { |
| | |
| | | lecture.setRemark(res.getRemark()); |
| | | lecture.setSubjectId(chapter.getSubjectId()); |
| | | lecture.setResItemId(res.getResId()); |
| | | |
| | | |
| | | save(lecture); |
| | | |
| | |
| | | @Override |
| | | public Result doStudy(String lectureId, Double from, Double to) { |
| | | String userId = null; |
| | | return progressService.addProgress(Progress.PROGRESS_TYPE_LECTURE, lectureId, from.intValue(), to.intValue(), |
| | | return progressService.addProgress(Progress.PROGRESS_TYPE_LECTURE, lectureId, from.doubleValue(), to.doubleValue(), |
| | | userId); |
| | | } |
| | | |
| | |
| | | @Autowired |
| | | private IMediaLiveService mediaLiveService; |
| | | |
| | | |
| | | @Override |
| | | public Result add(String subjectName,String coverPageFileId, String contentFileId,int type) { |
| | | |
| | |
| | | @Override |
| | | public MySubjectV getMy1stSubjectVById(String subjectId) { |
| | | String hql = "from MySubjectV p where p.id.userId=? and p.id.subjectId=?"; |
| | | |
| | | MySubjectV result = findUnique(hql, CollectionUtils.newList(ClientUtils.getUserId(), subjectId), |
| | | String UserId = ClientUtils.getUserId(); |
| | | MySubjectV result = findUnique(hql, CollectionUtils.newList(UserId, subjectId), |
| | | MySubjectV.class); |
| | | |
| | | return result; |
| | |
| | | //清理并复制原课程 |
| | | clsLectureService.doClearLecturesToClass(classId,subjectId); |
| | | clsLectureService.doCopyLecturesToClass(origSubjectId, subjectId, classId); |
| | | }else { |
| | | clsLectureService.doClearLecturesToClass(classId,subjectId); |
| | | clsLectureService.doCopyLecturesToClass(origSubjectId, subjectId, classId); |
| | | } |
| | | |
| | | TraceUtils.setUpdateTrace(subject); |
| | | subject.setTeacherId(teacherId); |
| | | subject.setTeacherName(teacher.getName()); |
| | |
| | | com\qxueyou\scc\base\dao\BaseDAO$2.class |
| | | com\qxueyou\scc\teach\subject\dao\SubjectDAO.class |
| | | com\qxueyou\scc\exercise\action\ExerciseDeepAnaController.class |
| | | com\qxueyou\scc\exam\dao\ExamResultVDao.class |
| | | com\qxueyou\scc\exercise\service\impl\ExerciseGroupService$1.class |
| | | com\qxueyou\scc\admin\score\dao\HomeworkScoreVDAO.class |
| | | com\qxueyou\scc\operation\comment\mode\QSnsMyPraise.class |
| | |
| | | com\qxueyou\scc\user\service\IUserService.class |
| | | com\qxueyou\scc\sys\service\IPrivilegeService.class |
| | | com\qxueyou\scc\school\model\SchClassCard.class |
| | | com\qxueyou\scc\admin\schoolRoll\ISchoolRollService.class |
| | | com\qxueyou\scc\base\dao\ReidsSharedPoolWrapper.class |
| | | com\qxueyou\scc\user\model\User.class |
| | | com\qxueyou\scc\org\service\IOrganizationService.class |
| | |
| | | com\qxueyou\scc\media\dao\MediaVideoDAO.class |
| | | com\qxueyou\scc\school\model\StudentEvaCategory.class |
| | | com\qxueyou\scc\stucontroller\StuExamController.class |
| | | com\qxueyou\scc\admin\schoolRoll\impl\SchoolRollServiceImpl.class |
| | | com\qxueyou\scc\operation\topic\service\impl\TopicService.class |
| | | com\qxueyou\scc\sys\service\ITestService.class |
| | | com\qxueyou\scc\org\model\OrgCourseData.class |
| | |
| | | com\qxueyou\scc\school\service\impl\SchoolDayService.class |
| | | com\qxueyou\scc\user\model\QUserRole.class |
| | | com\qxueyou\scc\school\service\IScoreChangeService.class |
| | | com\qxueyou\scc\controller\SchoolRollController.class |
| | | com\qxueyou\scc\controller\EvaluateController.class |
| | | com\qxueyou\scc\base\util\Base64Utils.class |
| | | com\qxueyou\scc\base\util\TraceUtils.class |
| | |
| | | com\qxueyou\scc\exercise\model\ExerciseExtendRecordData.class |
| | | com\qxueyou\scc\school\service\impl\NoteService.class |
| | | com\qxueyou\scc\exercise\model\QExerciseFaultBook.class |
| | | com\qxueyou\scc\admin\score\action\ScoreController.class |
| | | com\qxueyou\scc\base\handler\QCacheRedis.class |
| | | com\qxueyou\scc\school\model\QSchRankHis.class |
| | | com\qxueyou\scc\school\dao\RankDAO.class |