//package com.qxueyou.scc.school.action; // //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 javax.servlet.http.HttpServletResponse; // //import org.apache.commons.lang3.StringUtils; //import org.apache.logging.log4j.LogManager; //import org.apache.logging.log4j.Logger; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Qualifier; //import org.springframework.stereotype.Controller; //import org.springframework.web.bind.annotation.PathVariable; //import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMethod; //import org.springframework.web.bind.annotation.RequestParam; //import org.springframework.web.bind.annotation.ResponseBody; //import org.springframework.web.servlet.ModelAndView; // //import com.fasterxml.jackson.databind.ObjectMapper; //import com.qxueyou.scc.base.dao.CommonDAO; //import com.qxueyou.scc.base.model.Constants; //import com.qxueyou.scc.base.model.Pager; //import com.qxueyou.scc.base.model.Result; //import com.qxueyou.scc.base.model.ResultJson; //import com.qxueyou.scc.base.model.UserInfoWrapper; //import com.qxueyou.scc.base.service.ICommonService; //import com.qxueyou.scc.base.util.ClientUtils; //import com.qxueyou.scc.base.util.CollectionUtils; //import com.qxueyou.scc.base.util.TraceUtils; //import com.qxueyou.scc.exercise.model.ExerciseGroup; //import com.qxueyou.scc.exercise.model.ExerciseReCourse; //import com.qxueyou.scc.exercise.service.IExerciseService; //import com.qxueyou.scc.org.model.OrgClass; //import com.qxueyou.scc.org.model.OrgCollegeCourse; //import com.qxueyou.scc.org.model.OrgText; //import com.qxueyou.scc.org.model.Organization; //import com.qxueyou.scc.org.service.IOrgTextService; //import com.qxueyou.scc.school.model.HandoutAnswerData; //import com.qxueyou.scc.school.model.HandoutAnswerResult; //import com.qxueyou.scc.school.model.SchClassSchedule; //import com.qxueyou.scc.school.model.SchClassSubject; //import com.qxueyou.scc.school.model.SchHandout; //import com.qxueyou.scc.school.model.SchHandoutPage; //import com.qxueyou.scc.school.model.SchHandoutPageFavor; //import com.qxueyou.scc.school.model.SchHandoutReCourse; //import com.qxueyou.scc.school.model.SchHandoutRecord; //import com.qxueyou.scc.school.model.SchHandoutStatistic; //import com.qxueyou.scc.school.model.SchSubject; //import com.qxueyou.scc.school.model.SchSubjectReCourse; //import com.qxueyou.scc.school.service.IDocdealMsgSenderService; //import com.qxueyou.scc.school.service.IHandoutService; // ///** // * ½²Òå¿ØÖÆÆ÷ // * // * @author µÂ»¢ // * // */ //@Controller //@RequestMapping(value = "/school/HandOut") //public class HandoutController { // // private final Logger log = LogManager.getLogger("HandoutController"); // // @Autowired // private CommonDAO commonDAO; // // @Autowired // private IHandoutService service; // // @Autowired // IOrgTextService orgTextService; // // @Autowired // IDocdealMsgSenderService docdealMsgSenderService; // // // // @Autowired // IExerciseService exerciseService; // // private static final String initKey = "MDUIZSA5K7HSGB2XQVZR5EZ"; // // @Autowired // @Qualifier("commonAppService") // ICommonService commonService; // // /** // * APP2.0: »ñÈ¡½²ÒåÐÅÏ¢ URL :/school/HandOut/handoutInfo // * // * @return // */ // @RequestMapping(value = "handoutInfo", method = RequestMethod.GET) // public @ResponseBody ResultJson handoutInfo(@RequestParam("handoutId") String handoutId) { // // SchHandout schHandout = commonDAO.read(SchHandout.class, handoutId); // // return new ResultJson(true,schHandout.getFullPath(), CollectionUtils.newObjectMap("subjectId", schHandout.getSubjectId(), // "subjectName", schHandout.getSubjectName(), "fullPath", schHandout.getFullPath(), "coverPageUrl", schHandout.getCoverPageUrl())); // } // // /** // * APP2.0: »ñÈ¡½²ÒåĿ¼ URL :/school/HandOut/handoutDirectory // * // * @param limit // * ÿҳÏÔʾ // * @param page // * Ò³Âë // * @return // */ // @RequestMapping(value = "handoutDirectory", method = RequestMethod.GET) // public @ResponseBody List> getHandoutDirectory(@RequestParam("limit") int limit, @RequestParam("page") int page) { // Pager pager = new Pager(); // pager.setPageNum(page); // pager.setPageSize(limit); // List> lst = new ArrayList>(); // // //²éѯ¿Î³Ì ·ÖÒ³ // String hql = " from SchClassSubject where classId = ? and deleteFlag is false order by createTime"; // List lstSub = commonDAO.findList(hql,pager, CollectionUtils.newList(ClientUtils.getClassId()), SchClassSubject.class); // // List subjectIds = new ArrayList(); // for (SchClassSubject schClassSubject : lstSub) { // subjectIds.add(schClassSubject.getClassSubjectId()); // } // // if(subjectIds.isEmpty()){ // return lst; // } // //¸ù¾Ý¿Î³ÌID²éѯ½²Òå // hql = " from SchHandout where subjectId in (:subjectIds) and deleteFlag is false and status = :status and classId =:classId order by subjectId,orderNum "; // Map args = new HashMap(); // args.put("subjectIds", subjectIds.toArray()); // args.put("status", SchHandout.STATUS_ISSUED); // args.put("classId", ClientUtils.getClassId()); // List handouts = commonDAO.findByComplexHql(hql, args, SchHandout.class); // // for (SchHandout schHandout : handouts) { // Map handoutMap = new HashMap(); // handoutMap.put("handoutId", schHandout.getHandoutId()); // handoutMap.put("name", schHandout.getName()); // handoutMap.put("subjectName", schHandout.getSubjectName()); // handoutMap.put("subjectId", schHandout.getSubjectId()); // handoutMap.put("coverPageUrl", schHandout.getCoverPageUrl()); // handoutMap.put("pageCount", schHandout.getPageCount()); // handoutMap.put("playCount", schHandout.getPlayCount()); // lst.add(handoutMap); // } // return lst; // } // // /** // * APP2.0: »ñÈ¡µ±Ç°Óû§½²ÒåÁбíÊý¾Ý URL :/school/HandOut/handoutListNew // * // * @param limit // * ÿҳÏÔʾ // * @param page // * Ò³Âë // * @return // */ // @RequestMapping(value = "handoutListNew", method = RequestMethod.GET) // public @ResponseBody List getHandoutList(@RequestParam("limit") int limit, @RequestParam("page") int page, String classScheduleId, String timeSort, String timesSort, String lookFlag) { // // // ·ÖÒ³ // Pager pager = new Pager(); // pager.setPageNum(page); // pager.setPageSize(limit); // // // ¹ýÂËÌõ¼þ // List args = new ArrayList(4); // // String hql = generateSql(args,classScheduleId,lookFlag,timeSort,timesSort); // // List lstHandout = this.commonDAO.findList(hql, pager, args, SchHandout.class); // // List handoutIds = new ArrayList(); // for (SchHandout handout : lstHandout) { // handout.setCompDegree(BigDecimal.ZERO); // handoutIds.add(handout.getHandoutId()); // } // // if (handoutIds.isEmpty()) { // return null == lstHandout ? new ArrayList() : lstHandout; // } // // generateCompree(handoutIds, lstHandout); // // return lstHandout; // } // // /** // * Éú³Éhql // * @param args // * @param classScheduleId // * @param lookFlag // * @param timeSort0 // * @param timesSort // * @return // */ // private String generateSql(List args,String classScheduleId,String lookFlag,String timeSort,String timesSort) { // String timeSort0 = timeSort; // // ²éѯ½²ÒåÐÅÏ¢ Ö»²éѯÒÑ·¢²¼µÄ // String hql = "select h " // + " from SchClassSubject l,SchHandout h " // + " where l.deleteFlag is false and h.deleteFlag is false and l.classSubjectId=h.subjectId and h.status=1 " // + " and h.classId=? " ; // args.add(ClientUtils.getClassId()); // // // ¿Î³Ì¹ýÂË // if (StringUtils.isNotBlank(classScheduleId) && !"all".equals(classScheduleId)) { // args.add(classScheduleId); // hql = hql.concat(" and l.classSubjectId = ? "); // } // // // ²é¿´¹ýÂË // if (StringUtils.isNotBlank(lookFlag) && "true".equals(lookFlag)) { // args.add(ClientUtils.getUserId()); // hql = hql.concat(" and h.handoutId in (select s.handoutId from SchHandoutStatistic s where s.deleteFlag is false and s.userId = ? and s.handoutId = h.handoutId ) "); // } else if (StringUtils.isNotBlank(lookFlag) && "false".equals(lookFlag)) { // args.add(ClientUtils.getUserId()); // hql = hql.concat(" and h.handoutId not in (select s.handoutId from SchHandoutStatistic s where s.deleteFlag is false and s.userId = ? and s.handoutId = h.handoutId ) "); // } // // // ÅÅÐòÌõ¼þ,Æ´HQL // boolean flag0 = StringUtils.isNotBlank(timeSort0) && !"desc".equalsIgnoreCase(timeSort0) && !"asc".equalsIgnoreCase(timeSort0); // boolean flag1 = StringUtils.isNotBlank(timesSort) && !"desc".equalsIgnoreCase(timesSort) && !"asc".equalsIgnoreCase(timesSort); // if (flag0||flag1) { // timeSort0 = null; // } // // if (StringUtils.isNotBlank(timeSort0) && StringUtils.isBlank(timesSort)) { // ÉÏ´«Ê±¼äÅÅÐò // hql = hql.concat(" order by h.createTime " + timeSort0); // } else if (StringUtils.isBlank(timeSort0) && StringUtils.isNotBlank(timesSort)) { // ²¥·Å´ÎÊýÅÅÐò // hql = hql.concat(" order by h.playCount " + timesSort); // } else if (StringUtils.isNotBlank(timeSort0) && StringUtils.isNotBlank(timesSort)) { // ÉÏ´«Ê±¼äÅÅÐò ¡¢²¥·Å´ÎÊýÅÅÐò // hql = hql.concat(" order by h.createTime " + timeSort0 + ", h.playCount " + timesSort); // } else { // hql = hql.concat(" order by h.orderNum, h.createTime asc"); // } // // return hql; // } // // /** // * ½²Òå¹Û¿´¶È // * // * @param handoutIds // * @param lstHandout // */ // private void generateCompree(List handoutIds, List lstHandout) { // Map argsMap = new HashMap(); // String hql = " from SchHandoutStatistic where handoutId in (:handoutIds) and deleteFlag is false and userId = :userId and classId = :classId"; // argsMap.put("handoutIds", handoutIds.toArray()); // argsMap.put("userId", ClientUtils.getUserId()); // argsMap.put("classId", ClientUtils.getClassId()); // List handoutStatistic = commonDAO.findByComplexHql(hql, argsMap, SchHandoutStatistic.class); // Map map = new HashMap(); // for (SchHandoutStatistic schHandoutStatistic : handoutStatistic) { // map.put(ClientUtils.getUserId() + schHandoutStatistic.getHandoutId(), schHandoutStatistic.getCompDegree()); // } // // for (SchHandout handout : lstHandout) { // // Object obj = map.get(ClientUtils.getUserId() + handout.getHandoutId()); // if (obj != null) { // BigDecimal b = (BigDecimal) obj; // handout.setCompDegree(b.multiply(new BigDecimal(100))); // } // // } // } // // /** // * APP2.0: ¿Î³ÌÊÓÆµ£º»ñÈ¡µ±Ç°°à¼¶Óн²ÒåµÄÈ«²¿¿Î³Ì URL: /school/HandOut/scheduleList // * // * @return // */ // @RequestMapping(value = "scheduleList", method = RequestMethod.GET) // public @ResponseBody List> scheduleList() { // // String hql = "select distinct l from SchHandout s,SchClassSubject l " + " where s.classId=? " + " and s.subjectId = l.classSubjectId " + " and s.deleteFlag is false " + " and l.deleteFlag is false " + " and s.status = ? "; // // List classSubjects = commonDAO.find(hql, CollectionUtils.newList(ClientUtils.getClassId(), SchHandout.STATUS_ISSUED), SchClassSubject.class); // // List> scheduleLstMap = new ArrayList>(); // Map map = new HashMap(2); // map.put("classScheduleId", "all"); // map.put("name", "È«²¿¿Î³Ì"); // scheduleLstMap.add(map); // // for (SchClassSubject classSubject : classSubjects) { // map = new HashMap(2); // map.put("classScheduleId", classSubject.getClassSubjectId()); // map.put("name", classSubject.getName()); // scheduleLstMap.add(map); // } // // return scheduleLstMap; // } // // /** // * APP2.0: »ñÈ¡µ±Ç°Óû§Êղؽ²ÒåÁбíÊý¾Ý URL :/school/HandOut/handoutFavorListNew // * // * @param iLimit // * ÿҳÏÔʾ // * @param iPage // * Ò³Âë // * @return // */ // @RequestMapping(value = "handoutFavorListNew", method = RequestMethod.GET) // public @ResponseBody List getHandoutFavorList(@RequestParam("limit") int limit, @RequestParam("page") int page) { // // // ·ÖÒ³ // Pager pager = new Pager(); // pager.setPageNum(1); // pager.setPageSize(limit); // // // ²éѯ½²ÒåÐÅÏ¢ Ö»²éѯÒÑ·¢²¼µÄ // String hql = "select DISTINCT h," // //+ "(select p.imgPath from SchHandoutPage p where h.handoutId=p.handoutId and p.deleteFlag is false and p.pageOrder=?),\n" // + "(select count(1) from SchHandoutPageFavor a where a.handoutId=h.handoutId and a.deleteFlag is false and a.userId=? and a.classId=?)\n" // + "from SchHandout h, SchHandoutPageFavor f\n" // + "where h.handoutId=f.handoutId\n" // + "and h.deleteFlag is false\n" // + "and f.deleteFlag is false\n" // + "and f.userId=?\n" // + "and h.status=1\n" // + "and h.classId=? order by f.updateTime desc"; // // // ÏÂÀ­Ë¢Ð·ÖÒ³ // List lstHandout = service.schHandoutList(1, hql, pager, CollectionUtils.newList(ClientUtils.getUserId(), ClientUtils.getClassId(), ClientUtils.getUserId(), ClientUtils.getClassId())); // // // return lstHandout; // } // // /** // * APP2.0: Ìá½»½²ÒåÊղصļǼµ½DB URL :/school/HandOut/submitHandoutFavorNew ÇëÇó²ÎÊý :records ¾ßÌå·â×°·½·¨ºÍÁ·Ï°Ä£¿éÀàËÆ£¬json¶ÔÏóת³É×Ö·û´®£¬ºǫ́½ÓÊÕÖµjavaÀࣺHandoutAnswerData
// * // *
//	 * {
//	 * 	"id"            : "" ±ØÐë´«  ²»ÄÜΪ¿Õ£¬Ëæ±ã¸³Öµ
//	 * 	"handoutId"     : "" ±ØÐë´«  µ±Ç°½²ÒåID
//	 * 	"handoutPageId" : "" ±ØÐë´«  µ±Ç°Ò³½²ÒåID
//	 * 	"favor" 		: "" ±ØÐë´«  ÊÕ²ØorÈ¡ÏûÊÕ²Ø  true£ºÊÕ²Ø     false£ºÈ¡ÏûÊÕ²Ø
//	 * 	"userId" 		: "" ±ØÐë´«  µ±Ç°Óû§ID
//	 * 	"classId" 		: "" ±ØÐë´«  µ±Ç°°à¼¶ID
//	 * }
//	 * 
// * // * @return // */ // @RequestMapping(value = "submitHandoutFavorNew", method = RequestMethod.GET) // public @ResponseBody Result doSubmitExerFaultList(@RequestParam(value = "records") String records) { // Result result = new Result(false); // String classId = ClientUtils.getClassId(); // String userId = ClientUtils.getUserId(); // try { // ObjectMapper mapper = new ObjectMapper(); // // ×°»»jsonµ½¶ÔÏó // HandoutAnswerResult recordResult = mapper.readValue(records, HandoutAnswerResult.class); // List lstRecords = recordResult.getRecords(); // // if (lstRecords.isEmpty()) { // return result; // } // // List lstFavor = new ArrayList(); // SchHandoutPageFavor favor = null; // // // ²éѯ´ËÓû§ÊÇ·ñÓÐÊղؼǼ // String hql = "from SchHandoutPageFavor where userId=? and classId=? "; // List lstExistfavor = commonDAO.find(hql, CollectionUtils.newList(userId, classId), SchHandoutPageFavor.class); // Map favorMap = new HashMap(); // for (SchHandoutPageFavor existfavor : lstExistfavor) { // favorMap.put(existfavor.getHandoutPageId(), existfavor); // } // // // Ñ­»·Ã¿Ò»Ìõ¼Ç¼ // for (HandoutAnswerData record : lstRecords) { // if (record.getFavor()) {// Ìí¼ÓÊղؼǼ // favor = favorMap.get(record.getHandoutPageId()); // if (favor == null) { // favor = new SchHandoutPageFavor(); // favor.setHandoutId(record.getHandoutId()); // favor.setHandoutPageId(record.getHandoutPageId()); // favor.setUserId(userId); // favor.setClassId(classId); // favor.setDeleteFlag(false); // TraceUtils.setCreateTrace(favor); // } else { // if (favor.getDeleteFlag()) { // favor.setDeleteFlag(false); // } // TraceUtils.setUpdateTrace(favor); // } // // } else {// ɾ³ýÊÕ²Ø // favor = favorMap.get(record.getHandoutPageId()); // if (favor == null) { // continue; // } // favor.setDeleteFlag(true); // TraceUtils.setUpdateTrace(favor); // } // lstFavor.add(favor); // } // // // ÅúÁ¿²Ù×÷¼Ç¼ // result = service.doOperHandoutFavorDataBatch(lstFavor); // // } catch (Exception e) { // log.error(e); // } // return result; // } // // /** // * // * @param handoutId // * ½²ÒåID // * @return // */ // @RequestMapping(value = "handoutPageListNew/{handoutId}", method = RequestMethod.GET) // public @ResponseBody List getHandoutPageList(@PathVariable String handoutId) { // // ²éѯ½²ÒåÐÅÏ¢ // String hql = "from SchHandoutPage where deleteFlag is false and handoutId=? order by pageOrder "; // // List args = new ArrayList(2); // args.add(handoutId); // // List lstHandout = commonDAO.find(hql, args, SchHandoutPage.class); // // // ÊղؼǼ // List lstFavorHandout = this.getHandoutFavorHistoryList(handoutId); // // List favorList = new ArrayList(); // if (!lstFavorHandout.isEmpty()) { // for (SchHandoutPage favor : lstFavorHandout) { // favorList.add(favor.getHandoutPageId()); // } // } // // if (!lstHandout.isEmpty() && !favorList.isEmpty()) { // for (SchHandoutPage page : lstHandout) { // page.setFavorFlag(favorList.contains(page.getHandoutPageId())); // } // } // // return lstHandout; // } // // /** // * APP2.0: »ñÈ¡½²Òå·ÖÒ³Ã÷ϸ URL :/school/HandOut/handoutPages/{handoutId} ͼƬ·¾¶±£»¤ // * // * @param handoutId // * ½²ÒåID // * @return // */ // @RequestMapping(value = "handoutPages/{handoutId}", method = RequestMethod.GET) // public @ResponseBody List queryHandoutPageList(@PathVariable String handoutId) { // // ²éѯ½²ÒåÐÅÏ¢ // String hql = "from SchHandoutPage where deleteFlag is false and handoutId=? order by pageOrder "; // // List args = new ArrayList(2); // args.add(handoutId); // // List lstHandout = commonDAO.find(hql, args, SchHandoutPage.class); // // // ÊղؼǼ // List lstFavorHandout = this.getHandoutFavorHistoryList(handoutId); // // List favorList = new ArrayList(lstFavorHandout.size()); // if (!lstFavorHandout.isEmpty()) { // for (SchHandoutPage favor : lstFavorHandout) { // favorList.add(favor.getHandoutPageId()); // } // } // // for (SchHandoutPage page : lstHandout) { // page.setImgPath(null);// ¿ØÖÆÇ°¶Ë¿´²»µ½´Ë×Ö¶Î Òþ˽±£»¤ // page.setFavorFlag(favorList.contains(page.getHandoutPageId())); // } // // return lstHandout; // } // // /** // * APP2.0: »ñÈ¡½²Òå·ÖÒ³Ã÷ϸ URL :/school/HandOut/handoutPage ͼƬ·¾¶±£»¤ // * // * @param handoutId // * ½²ÒåID // * @return // */ // @RequestMapping(value = "handoutPage", method = RequestMethod.GET) // public String goHandoutPage(@RequestParam("handoutId") String handoutId, @RequestParam("pageOrder") int pageOrder, HttpServletResponse response) { //// String imgPath = cacheService.get("handout/imgpath/" + handoutId + pageOrder, String.class); // String imgPath = null; // // if (imgPath == null) { // // String hql = "from SchHandoutPage where deleteFlag is false and handoutId=? and pageOrder=? "; // // SchHandoutPage page = commonDAO.findUnique(hql, CollectionUtils.newList(handoutId, pageOrder), SchHandoutPage.class); // // if (page == null) { // return null; // } // imgPath = page.getImgPath(); // // ·Åµ½»º´æ10·ÖÖÓ //// cacheService.set("handout/imgpath/" + handoutId + pageOrder, 60 * 10, imgPath); // } // // return "redirect:" +imgPath; // // } // // /** // * APP2.0: µã»÷ijһ¸öÊղؽ²Ò壬»ñÈ¡ÊղصĽ²ÒåÃ÷ϸ URL :/school/HandOut/handoutFavorPages/{handoutId} ͼƬ·¾¶±£»¤ // * // * @param handoutId // * ½²ÒåID // * @return // */ // @RequestMapping(value = "handoutFavorPages/{handoutId}", method = RequestMethod.GET) // public @ResponseBody List getHandoutFavorPages(@PathVariable String handoutId) { // // List lstHandout = this.getHandoutFavorHistoryList(handoutId); // // for (SchHandoutPage page : lstHandout) { // page.setImgPath(null); // page.setFavorFlag(true); // } // // return lstHandout; // } // // /** // * APP2.0: µã»÷ijһ¸öÊղؽ²Ò壬»ñÈ¡ÊղصĽ²ÒåÃ÷ϸ URL :/school/HandOut/handoutFavorPageListNew/{handoutId} // * // * @param handoutId // * ½²ÒåID // * @return // */ // @RequestMapping(value = "handoutFavorPageListNew/{handoutId}", method = RequestMethod.GET) // public @ResponseBody List getHandoutFavorPageList(@PathVariable String handoutId) { // // List lstHandout = this.getHandoutFavorHistoryList(handoutId); // // for (SchHandoutPage page : lstHandout) { // page.setFavorFlag(true); // } // // return lstHandout; // } // // /** // * APP2.0: ²éѯ½²Ò壬ģºýÆ¥Åä½²ÒåÃû»òÕ߿γÌÃû URL :/school/HandOut/queryHandout // * // * @param keyWord // * ²éѯ¹Ø¼ü×Ö // * @return // */ // @RequestMapping(value = "queryHandout", method = RequestMethod.GET) // public @ResponseBody List queryHandoutByKeyWord(String keyWord) { // // return service.queryHandoutByKeyWord(keyWord); // // } // // /** // * APP2.0: Ìá½»²¥·Åij¸ö½²Òå URL: /school/HandOut/playHandoutBefore // * // * @param handoutId // * ½²ÒåID // * @return result trueΪ³É¹¦£¬falseʱ£¬msgΪ´íÎóÃèÊö // */ // @RequestMapping(value = "playHandoutBefore", method = RequestMethod.POST) // public @ResponseBody Result playHandoutBefore(String handoutId) { // // return service.updatePlayCount(handoutId); // // } // // /** // * APP2.0: ²¥·ÅÍêij¸ö½²Òå URL: /school/HandOut/playHandoutNew // * @return result trueΪ³É¹¦£¬falseʱ£¬msgΪ´íÎóÃèÊö // */ // @RequestMapping(value = "playHandoutNew", method = RequestMethod.POST) // public @ResponseBody Result submitPlayHandoutNew(SchHandoutRecord record, String pageNums) { // // if (StringUtils.isBlank(record.getHandoutId()) || StringUtils.isBlank(pageNums)) { // return new Result(false, "Ìá½»²ÎÊý²»ÕýÈ·"); // } // return service.insertplayRecordNew(record, pageNums); // // } // // /** // * APP2.0: (Àϰ汾)²¥·ÅÍêij¸ö½²Òå URL: /school/HandOut/playHandout // * @return result trueΪ³É¹¦£¬falseʱ£¬msgΪ´íÎóÃèÊö // */ // @RequestMapping(value = "playHandout", method = RequestMethod.POST) // public @ResponseBody Result submitPlayHandout(SchHandoutRecord record, String pageNums) { // // if (StringUtils.isBlank(record.getHandoutId()) || StringUtils.isBlank(pageNums)) { // return new Result(false, "Ìá½»²ÎÊý²»ÕýÈ·"); // } // return service.insertplayRecord(record, pageNums); // // } // // /** // * APP2.0: ²âÊÔÌí¼ÓÊý¾Ý ÎÞʵ¼ÊÓÃ; URL: /school/HandOut/playHandout1 // * // * @param videoId // * Ò»¸ö»ò¶à¸öÊÓÆµvideoId£¬¶à¸öʱÓá°£¬¡±Æ´½Ó // * @return result trueΪ³É¹¦£¬falseʱ£¬msgΪ´íÎóÃèÊö // */ // @RequestMapping(value = "playHandout1", method = RequestMethod.GET) // public @ResponseBody Result submitPlayVideo1() { // // SchHandoutRecord record = new SchHandoutRecord(); // // record.setHandoutId("297e741653cb61dd0153cb7fb626002f"); // record.setBeginTime(new Date()); // record.setEndTime(new Date()); // record.setType(1); // String pageNums = "1,2,3,4,5,6,7,8,9,10,11,12"; // return service.insertplayRecordNew(record, pageNums); // // } // // /******************************************************************* ÉÏÃæÎªApp½Ó¿Ú£¬ÏÂÃæÎªºǫ́½Ó¿Ú **************************/ // // /** // * ½²Òåά»¤ // * // * @return // */ // @RequestMapping(method = RequestMethod.GET) // public ModelAndView listPage() { // // ModelAndView modelAndView = new ModelAndView("/school/HandOut"); // // return modelAndView; // } // // /** // * »ú¹¹½²Òåά»¤ // * // * @return // */ // @RequestMapping(value = "/org", method = RequestMethod.GET) // public ModelAndView orgPage() { // // ModelAndView modelAndView = new ModelAndView("/school/OrgHandOut"); // // return modelAndView; // } // // /** // * »ñÈ¡½²ÒåÁбíÊý¾Ý // * // * @return // */ // @RequestMapping(value = "data", method = RequestMethod.GET) // public @ResponseBody List> data(String tid) { // // return service.handoutLst(tid); // } // // /** // * »ñÈ¡»ú¹¹½²ÒåÁбíÊý¾Ý // * // * @return // */ // @RequestMapping(value = "orgData", method = RequestMethod.GET) // public @ResponseBody List> orgData(String collegeCourseId, String subjectId) { // // return service.handoutOrgLst(collegeCourseId, subjectId); // } // // /** // * »ñÈ¡»ú¹¹Ö¸¶¨µÄ»ú¹¹ºÍ°à¼¶ // * // * @return // */ // @RequestMapping(value = "handoutOrgIds", method = RequestMethod.GET) // public @ResponseBody ResultJson findAlreadyOrg(String handoutId) { // Map map = new HashMap(); // String hql = " select r from SchHandoutReCourse c,Organization r" // + " where c.orgId = r.organizationId" // + " and c.deleteFlag is false" // + " and r.deleteFlag is false" // + " and c.handoutId = ?"; // List lstOrg = commonDAO.find(hql, CollectionUtils.newList(handoutId), Organization.class); // // StringBuffer sbName = new StringBuffer(); // StringBuffer sbId = new StringBuffer(); // List classIds = new ArrayList(); // // String orgNames = ""; // String orgIds = ""; // for (Organization org : lstOrg) { // // sbName.append(org.getName() + ","); // sbId.append(org.getOrganizationId()).append(','); // List classes = org.getClasses(); // for (OrgClass orgClass : classes) { // classIds.add(orgClass.getClassId()); // } // } // if (classIds.isEmpty()) { // map.put("classIds", ""); // } else { // hql = "select distinct classId from SchHandout where classId in (:classIds) and deleteFlag is false and originHandoutId = :handoutId"; // Map args = new HashMap(); // // args.put("classIds", classIds.toArray()); // // args.put("handoutId", handoutId); // List objs = commonDAO.findByComplexHql(hql, args, String.class); // map.put("classIds", StringUtils.join(objs.toArray(), ",")); // } // /* // * if (sbName.length() > 0) { orgNames = sbName.deleteCharAt(sbName.length() - 1).toString(); } // */ // if (sbId.length() > 0) { // orgIds = sbId.deleteCharAt(sbId.length() - 1).toString(); // } // // map.put("orgNames", orgNames); // map.put("orgIds", orgIds); // // ResultJson result = new ResultJson(true); // result.setData(map); // return result; // } // // /** // * Ö¸¶¨½²ÒåÊý¾Ýµ½Ä³¸ö»ú¹¹ // * // * @return // */ // @RequestMapping(value = "orgHandout", method = RequestMethod.GET) // public @ResponseBody Result orgHandout(String handoutId[], String orgId[], String classIds[], String collegeCourseId) { // // // ɾ³ý΢ÉÌÏîÄ¿ËùÓлº´æ //// new CacheUtils().deleteWBProjectCacheData(); // // return service.insertAppointHandout(handoutId, orgId, classIds, collegeCourseId); // } // // /** // * »ñÈ¡½²ÒåÒ³Êý¾Ý // * // * // * @return // */ // @RequestMapping(value = "pages/{handoutId}", method = RequestMethod.GET) // public @ResponseBody List pages(@PathVariable String handoutId) { // // // »ñÈ¡½²ÒåÒ³Êý¾Ý,Ôö¼ÓÅÅÐò // String hql = "from SchHandoutPage where deleteFlag is false and handoutId= ? order by pageOrder asc "; // List pages = commonDAO.find(hql, CollectionUtils.newList(handoutId), SchHandoutPage.class); // // return pages; // } // // /** // * »ñÈ¡¸ºÔð¿Î³ÌÁбíÊý¾Ý // * // * @return // */ // @RequestMapping(value = "lessons", method = RequestMethod.GET) // public @ResponseBody List lessons() { // // List lessons = new ArrayList(); // // °àÖ÷ÈΣº»ñÈ¡¸Ã°à¼¶£¨class_id£©ÏÂÃæµÄ½²Ê¦¸ºÔðµÄ¿Î³Ì½²Ê¦£º»ñÈ¡¸Ã½²Ê¦£¨teacher_id£©¸ºÔðµÄ¿Î³Ì // if (UserInfoWrapper.ROLE_CHARGER.equals(ClientUtils.getCurrentRole())) { // // String hql = "from SchClassSchedule where deleteFlag is false and classId = ? order by startTime desc"; // lessons = commonDAO.find(hql, CollectionUtils.newList(ClientUtils.getClassId()), SchClassSchedule.class); // // } else if (UserInfoWrapper.ROLE_TEACHER.equals(ClientUtils.getCurrentRole())) { // // String hql = "from SchClassSchedule where deleteFlag is false " + " and teacherId = ( select orgTeacherId from OrgTeacher where userId = ? and orgId = ? and deleteFlag is false ) " + " and classId = ? order by startTime desc"; // lessons = commonDAO.find(hql, CollectionUtils.newList(ClientUtils.getUserId(), ClientUtils.getOrgId(), ClientUtils.getClassId()), SchClassSchedule.class); // // }/* // * else{ String hql = "from SchClassSchedule where deleteFlag is false and classId=?"; lessons = commonDAO.find(hql,CollectionUtils.newList(ClientUtils.getClassId()), SchClassSchedule.class); } // */ // // return lessons; // } // // /** // * ɾ³ý½²ÒåÐÅÏ¢ // * // * @return // */ // @RequestMapping(value = "delete", method = RequestMethod.POST) // @ResponseBody // public Result delete(String handoutIds) { // // // ±£´æµ½·þÎñÆ÷ // Result result = service.deleteHandouts(handoutIds.split(",")); // // // ɾ³ý΢ÉÌÏîÄ¿ËùÓлº´æ //// new CacheUtils().deleteWBProjectCacheData(); // // // ·µ»Ø½á¹û // return result; // } // // /** // * ɾ³ý½²ÒåÐÅÏ¢ // * // * @return // */ // @RequestMapping(value = "deleteOrg", method = RequestMethod.POST) // @ResponseBody // public Result deleteOrg(String handoutIds, Integer delAll, String orgIds[], String classIds[]) { // // // ±£´æµ½·þÎñÆ÷ // Result result = service.deleteOrgHandouts(handoutIds.split(","), delAll, orgIds, classIds); // // // ɾ³ý΢ÉÌÏîÄ¿ËùÓлº´æ //// new CacheUtils().deleteWBProjectCacheData(); // // // ·µ»Ø½á¹û // return result; // } // // /** // * ·¢²¼½²ÒåÐÅÏ¢ // * // * @return // */ // @RequestMapping(value = "start", method = RequestMethod.POST) // @ResponseBody // public Result start(String handoutIds) { // // // ±£´æµ½·þÎñÆ÷ // Result result = service.doStartHandouts(handoutIds); // // // ɾ³ý΢ÉÌÏîÄ¿ËùÓлº´æ //// new CacheUtils().deleteWBProjectCacheData(); // // // ·µ»Ø½á¹û // return result; // } // // /** // * Í£Óý²ÒåÐÅÏ¢ // * // * @return // */ // @RequestMapping(value = "stop", method = RequestMethod.POST) // @ResponseBody // public Result stop(String handoutIds) { // // // ±£´æµ½·þÎñÆ÷ // Result result = service.doStopHandouts(handoutIds.split(",")); // // // ɾ³ý΢ÉÌÏîÄ¿ËùÓлº´æ //// new CacheUtils().deleteWBProjectCacheData(); // // // ·µ»Ø½á¹û // return result; // } // // /** // * ORG »ñÈ¡»ú¹¹¿ÆÄ¿Áбí // * // * @return // */ // @SuppressWarnings("unused") // @RequestMapping(value = "/orgCourse", method = RequestMethod.GET) // public @ResponseBody List orgCollegeCourse() { // // String hql = " from OrgCollegeCourse where topOrgId = ? and deleteFlag is false"; // // Organization org = commonDAO.read(Organization.class, ClientUtils.getOrgId()); // //// List result = this.commonDAO.find(hql, CollectionUtils.newList(org.getTopOrganizationId()), OrgCollegeCourse.class); // List result = this.commonDAO.find(hql, null, OrgCollegeCourse.class); // // return result; // // } // // /** // * µ¼Èë½²ÒåÐÅÏ¢ // * // * @return // */ // @RequestMapping(value = "add", method = RequestMethod.POST) // public @ResponseBody Result add(SchHandout handout, String fullPath, String module) { // // ɾ³ý΢ÉÌÏîÄ¿ËùÓлº´æ //// new CacheUtils().deleteWBProjectCacheData(); // // Result result = service.insertHandout(fullPath, module, handout); // if (!result.isSuccess()) { // return result; // } // boolean pptFlag = (Boolean) result.getAttr("pptFlag"); // if (!pptFlag) { // service.sendMsgConvertPDF(handout.getHandoutId(), fullPath, module, ClientUtils.getUserId()); // } else { // // // OFFICE ·¢ËÍÇëÇóµ½docdeal ÏûÏ¢¶ÓÁУ»²ÎÊý£ºdocpathºÍhandoutid // docdealMsgSenderService.sendMsg(fullPath, handout.getHandoutId(), module, ClientUtils.getUserId()); // } // return result; // } // // /** // * µ¼Èë½²ÒåÐÅÏ¢ // * // * @return // */ ///* @RequestMapping(value = "addOrg", method = RequestMethod.POST) // public @ResponseBody Result addOrg(SchHandout handout, String collegeCourseId, String fullPath, String module) { // // ɾ³ý΢ÉÌÏîÄ¿ËùÓлº´æ //// new CacheUtils().deleteWBProjectCacheData(); // // handout.setHandoutId(null); // Result result = service.insertOrgHandout(fullPath, module, handout, collegeCourseId); // if (!result.isSuccess()) { // return result; // } // boolean pptFlag = (Boolean) result.getAttr("pptFlag"); // if (!pptFlag) { // service.doConvertPDF(handout.getHandoutId(), fullPath, module, ClientUtils.getUserId()); // } else { // // OFFICE ·¢ËÍÇëÇóµ½docdeal ÏûÏ¢¶ÓÁУ»²ÎÊý£ºdocpathºÍhandoutid // service.doConvertDOC(fullPath, handout.getHandoutId(), module, ClientUtils.getUserId()); // } // // return result; // }*/ // // // // // // // // // /** // * ±à¼­½²ÒåÐÅÏ¢ // * @return // */ //// @RequestMapping(value = "edit", method = RequestMethod.POST) //// public @ResponseBody Result edit(SchHandout handout,String type) { //// //// // ɾ³ý΢ÉÌÏîÄ¿ËùÓлº´æ ////// new CacheUtils().deleteWBProjectCacheData(); //// //// return service.doEditHandout(handout,type); //// } // // /** // * »ñÈ¡µ¥¸ö½²ÒåÐÅÏ¢ // * // * @return // */ // @RequestMapping(value = "handout/data", method = RequestMethod.GET) // public @ResponseBody SchHandout handoutData(String handoutId) { // // OrgText orgText = orgTextService.getOrgText(handoutId, OrgText.TABLE_NAME_HANDOUT); // SchHandout handout = commonDAO.read(SchHandout.class, handoutId); // handout.setRemark(orgText != null ? orgText.getContent() : handout != null ? handout.getRemark() : ""); // // return handout; // } // // /** // * »ñÈ¡»ú¹¹Ïµİ༶Êý¾Ý // * // * @return // */ // @RequestMapping(value = "getAllClass", method = RequestMethod.GET) // public @ResponseBody List getAllClass() { // // List classes = null; // // // °àÖ÷Èεϰ µ±Ç°»ú¹¹°àÖ÷ÈÎËùÈοεİ༶ ½²Ê¦µÄ»° µ±Ç°½²Ê¦°à¼¶ // if (UserInfoWrapper.ROLE_CHARGER.equals(ClientUtils.getCurrentRole())) { // // String hql = "select distinct cls from OrgCharger c, OrgClass cls, SchHandout h where" + // " c.orgChargerId = cls.classChargerId and cls.classId = h.classId " + // " and h.deleteFlag is false and cls.deleteFlag is false and c.deleteFlag is false and c.userId = ? and c.orgId = ? "; // // classes = this.commonDAO.find(hql, CollectionUtils.newList(ClientUtils.getUserId(), ClientUtils.getOrgId()), OrgClass.class); // } else if (UserInfoWrapper.ROLE_TEACHER.equals(ClientUtils.getCurrentRole())) { // // String hql = "select distinct c from OrgTeacher t, SchClassSchedule s , OrgClass c " + " where t.orgTeacherId = s.teacherId " + " and s.classId = c.classId " + " and t.deleteFlag is false and s.deleteFlag is false and c.deleteFlag is false " + " and t.userId = ? and t.orgId = ? "; // // classes = this.commonDAO.find(hql, CollectionUtils.newList(ClientUtils.getUserId(), ClientUtils.getOrgId()), OrgClass.class); // } // // List result = new ArrayList(3); // for (OrgClass cls : classes) { // if (!ClientUtils.getClassId().equals(cls.getClassId()) && !cls.getDeleteFlag()) { // result.add(cls); // } // } // // return result; // // } // // /** // * »ñÈ¡°à¼¶ÏµĽ²ÒåÐÅÏ¢ // * // * @return // */ // @RequestMapping(value = "getClassHandout", method = RequestMethod.GET) // public @ResponseBody List getClassHandout(String classId) { // // String hql = "select h from SchHandout h where h.deleteFlag is false and h.classId = ? "; // return commonDAO.find(hql, CollectionUtils.newList(classId), SchHandout.class); // // } // // /** // * Ñ¡ÔñÀúÊ·½²Òå // * // * @return // */ // @RequestMapping(value = "addClassHandout", method = RequestMethod.POST) // public @ResponseBody Result addClassHandout(SchHandout handout, String oldHandoutId) { // // ɾ³ý΢ÉÌÏîÄ¿ËùÓлº´æ //// new CacheUtils().deleteWBProjectCacheData(); // // return service.insertChooseHandout(handout, oldHandoutId); // } // // /** // * »ñÈ¡pptÉÏ´«µÄ // * // * @return // */ // @RequestMapping(value = "getDocdealUrl", method = RequestMethod.GET) // public @ResponseBody Result getDocdealUrl() { // Result objResult = new Result(true); // objResult.setMsg(commonDAO.queryConfigValue(Constants.CONFIG_DOC_DEAL_URL)); // return objResult; // } // // /** // * »ñÈ¡µ±Ç°Óû§µÄµ±Ç°½²ÒåµÄÊղؼǼ // * // * @param handoutId // * @return // */ // private List getHandoutFavorHistoryList(String handoutId) { // String classId = ClientUtils.getClassId(); // String userId = ClientUtils.getUserId(); // // // ²éѯ½²ÒåÐÅÏ¢ // String hql = "select p from SchHandoutPage p ,SchHandoutPageFavor f " + " where f.deleteFlag is false " + " and p.handoutPageId=f.handoutPageId " + " and p.handoutId=? and f.userId=? and f.classId=?" + " order by p.pageOrder "; // // List lstHandout = commonDAO.find(hql, CollectionUtils.newList(handoutId, userId, classId), SchHandoutPage.class); // // return lstHandout; // } // // /** // * ½²ÒåÔ¤ÀÀÐýתͼƬ // * // * @return // */ // @RequestMapping(value = "rotatePic", method = RequestMethod.GET) // public @ResponseBody Result rotatePic(String angle, String handoutPageId) { // // if (StringUtils.isBlank(angle) || StringUtils.isBlank(handoutPageId)) { // return new Result(false, "²ÎÊý²»ºÏ·¨"); // } // // return service.doRotatePic(angle, handoutPageId); // // } // // /** // * ³õʼ»¯Óû§µÄhandout µÄ ÖØ¸´Ã÷ϸ // * // * @return // */ // @RequestMapping(value = "/initHandoutRepeatData", method = RequestMethod.GET) // public @ResponseBody Result initUserReRoleUser(String key) { // // if (!initKey.equals(key)) { // return new Result(true, "auth"); // } // // // ²éѯ´æÔÚ¿ÉÄÜÐÔµÄÖØ¸´µÄ½²Òå // String hql = "select handoutId from SchHandout s where s.originHandoutId = s.handoutId and s.deleteFlag is false "; // List handouts = this.commonDAO.find(hql, CollectionUtils.newList(), String.class); // // if (handouts.isEmpty()) { // return new Result(true, "zero"); // } // // int successCount = 0; // // for (int i = 0; i < handouts.size(); i++) { // this.service.doInitHandoutRepeatData(handouts.get(i)); // successCount++; // } // Result result = new Result(true, "successful"); // result.addAttr("count", successCount); // // return result; // // } // // @RequestMapping(value = "/initHandoutByClassSchedule", method = RequestMethod.GET) // public @ResponseBody Result initHandoutByClassSchedule(String key) { // // if (!initKey.equals(key)) { // return new Result(true, "auth"); // } // int count = 0; // int s = 0; // int y = 0; // int z = 0; // String hql = " from SchHandout where deleteFlag is false"; // List lstHandout = commonDAO.find(hql, SchHandout.class); // // for (SchHandout schHandout : lstHandout) { // // // ÅжÏsubjectIdÓÐûÓÐÖµ£¬ÓÐֵ˵Ã÷²»Óóõʼ»¯ // if (StringUtils.isBlank(schHandout.getSubjectId())) { // // ÅжÏclassScheduleIdÓÐûÓÐÖµ£¬Ã»ÖµËµÃ÷ÊǹÜÀíÔ±µÄÊý¾Ý»òÕßÊÇÔàÊý¾Ý // if (StringUtils.isNotBlank(schHandout.getClassScheduleId())) { // hql = " from SchClassSchedule where classScheduleId = ? and deleteFlag is false"; // SchClassSchedule sch = commonDAO.findUnique(hql, CollectionUtils.newList(schHandout.getClassScheduleId()), SchClassSchedule.class); // if (sch != null) { // OrgClass cls = commonDAO.read(OrgClass.class, sch.getClassId()); // if (cls != null) { // hql = " from SchClassSubject where name = ? and deleteFlag is false and classId = ?"; // SchClassSubject sub = commonDAO.findUnique(hql, CollectionUtils.newList(sch.getName(), sch.getClassId()), SchClassSubject.class); // // Åж϶ÔÓ¦µÄ°à¼¶¿Î³ÌÓÐûÓÐ // if (sub != null) { // // schHandout.setSubjectId(sub.getClassSubjectId()); // schHandout.setSubjectName(sub.getName()); // schHandout.setCollegeCourseId(cls.getCollegeCourseId()); // TraceUtils.setUpdateTrace(schHandout); // // this.service.saveHandout(schHandout); // count++; // // } else { // // sub = new SchClassSubject(); // TraceUtils.setCreateTrace(sub); // sub.setClassId(sch.getClassId()); // sub.setCourseId(cls.getCollegeCourseId()); // sub.setName(sch.getName()); // TraceUtils.setCreateTrace(sub); // commonService.save(sub); // s++; // schHandout.setSubjectId(sub.getClassSubjectId()); // schHandout.setSubjectName(sub.getName()); // schHandout.setCollegeCourseId(cls.getCollegeCourseId()); // TraceUtils.setUpdateTrace(schHandout); // this.service.saveHandout(schHandout); // count++; // // // TODO SchClassSchedule classSubjectId ×Ö¶Î // sch.setClassSubjectId(sub.getClassSubjectId()); // commonService.save(sch); // } // } // // } // } else { // // // ¹ÜÀíÔ± // // hql = " from SchHandoutReCourse where handoutId = ? and deleteFlag is false"; // List lstHandoutCourse = commonDAO.find(hql, CollectionUtils.newList(schHandout.getHandoutId()), SchHandoutReCourse.class); // for (SchHandoutReCourse schHandoutReCourse : lstHandoutCourse) { // Organization org = commonDAO.read(Organization.class, schHandoutReCourse.getOrgId()); // if (org == null) { // continue; // } // hql = " from SchSubjectReCourse where subjectId in " + " ( select subjectId from SchSubject where name = ? and deleteFlag is false ) " + " and deleteFlag is false " + " and collegeCourseId = ?"; // // SchSubjectReCourse reCourse = commonDAO.findUnique(hql, CollectionUtils.newList("¹«¹²¿Î³Ì", schHandoutReCourse.getCollegeCourseId()), SchSubjectReCourse.class); // if (reCourse != null) { // schHandout.setSubjectId(reCourse.getSubjectId()); // schHandout.setSubjectName("¹«¹²¿Î³Ì"); // schHandout.setCollegeCourseId(schHandoutReCourse.getCollegeCourseId()); // TraceUtils.setUpdateTrace(schHandout); // this.service.saveHandout(schHandout); // count++; // } else { // hql = " from SchSubject where name = ? and deleteFlag is false"; // SchSubject subject = commonDAO.findUnique(hql, CollectionUtils.newList("¹«¹²¿Î³Ì"), SchSubject.class); // if (subject != null) { // reCourse = new SchSubjectReCourse(); // reCourse.setCollegeCourseId(schHandoutReCourse.getCollegeCourseId()); // reCourse.setDeleteFlag(false); // reCourse.setOrgId(schHandoutReCourse.getOrgId()); //// reCourse.setTopOrgId(org.getTopOrganizationId()); // reCourse.setSubjectId(subject.getSubjectId()); // TraceUtils.setCreateTrace(reCourse); // commonService.save(reCourse); // y++; // } else { // subject = new SchSubject(); // subject.setName("¹«¹²¿Î³Ì"); // TraceUtils.setCreateTrace(subject); // commonService.save(subject); // z++; // reCourse = new SchSubjectReCourse(); // reCourse.setCollegeCourseId(schHandoutReCourse.getCollegeCourseId()); // reCourse.setDeleteFlag(false); // reCourse.setOrgId(schHandoutReCourse.getOrgId()); //// reCourse.setTopOrgId(org.getTopOrganizationId()); // reCourse.setSubjectId(subject.getSubjectId()); // TraceUtils.setCreateTrace(reCourse); // commonService.save(reCourse); // y++; // } // // schHandout.setSubjectId(reCourse.getSubjectId()); // schHandout.setSubjectName("¹«¹²¿Î³Ì"); // schHandout.setCollegeCourseId(schHandoutReCourse.getCollegeCourseId()); // TraceUtils.setUpdateTrace(schHandout); // this.service.saveHandout(schHandout); // count++; // // } // } // // } // } // // } // return new Result(true, "×ܹ²" + lstHandout.size() + "Ìõ£¬³É¹¦ÁË" + count + "Ìõ,ÐÂÔöÁË" + s + "Ìõ°à¼¶¿Î³Ì¡¢" + y + "Ìõ¿ÆÄ¿¿Î³Ì¡¢" + z + "Ìõ¿Î³Ì"); // } // // @RequestMapping(value = "/initHandoutOrderNum", method = RequestMethod.GET) // public @ResponseBody Result initHandoutOrderNum(String key) { // if (!initKey.equals(key)) { // return new Result(true, "auth"); // } // // ¹ÜÀíÔ± // Map> map = new HashMap>(); // // String hql = " from SchHandoutReCourse where deleteFlag is false order by orgId"; // List courses = commonDAO.find(hql, SchHandoutReCourse.class); // for (SchHandoutReCourse course : courses) { // if (map.get(course.getOrgId()) == null) { // List lst = new ArrayList(); // lst.add(course); // map.put(course.getOrgId(), lst); // } else { // map.get(course.getOrgId()).add(course); // } // } // // for (List lst : map.values()) { // int i = 0; // for (SchHandoutReCourse course : lst) { // i++; // course.setOrderNum(i); // commonService.save(course); // } // } // // // °àÖ÷ÈÎ // Map> handoutMap = new HashMap>(); // hql = " from SchHandout where deleteFlag is false order by classId"; // List lstH = commonDAO.find(hql, SchHandout.class); // for (SchHandout schHandout : lstH) { // if (handoutMap.get(schHandout.getClassId()) == null) { // List lstHandout = new ArrayList(); // lstHandout.add(schHandout); // handoutMap.put(schHandout.getClassId(), lstHandout); // } else { // handoutMap.get(schHandout.getClassId()).add(schHandout); // } // // } // // for (List lst : handoutMap.values()) { // int i = 0; // for (SchHandout handout : lst) { // i++; // handout.setOrderNum(i); // this.service.saveHandout(handout); // } // } // return new Result(true); // } // // /** // * Á·Ï°ÐòºÅ³õʼ»¯ // * // * @param key // * @return // */ // @RequestMapping(value = "/initExerciseOrderNum", method = RequestMethod.GET) // public @ResponseBody Result initExerciseOrderNum(String key) { // if (!initKey.equals(key)) { // return new Result(true, "auth"); // } // // ¹ÜÀíÔ± // Map> map = new HashMap>(); // // String hql = " from ExerciseReCourse where deleteFlag is false order by orgId"; // List courses = commonDAO.find(hql, ExerciseReCourse.class); // for (ExerciseReCourse course : courses) { // if (map.get(course.getOrgId()) == null) { // List lst = new ArrayList(); // lst.add(course); // map.put(course.getOrgId(), lst); // } else { // map.get(course.getOrgId()).add(course); // } // } // // for (List lst : map.values()) { // int i = 0; // for (ExerciseReCourse course : lst) { // i++; // course.setOrderNum(i); // commonService.save(course); // } // } // // // °àÖ÷ÈÎ // Map> groupMap = new HashMap>(); // hql = " from ExerciseGroup where deleteFlag is false order by classId"; // List lstH = commonDAO.find(hql, ExerciseGroup.class); // for (ExerciseGroup group : lstH) { // if (groupMap.get(group.getClassId()) == null) { // List lstGroup = new ArrayList(); // lstGroup.add(group); // groupMap.put(group.getClassId(), lstGroup); // } else { // groupMap.get(group.getClassId()).add(group); // } // // } // // for (List lst : groupMap.values()) { // int i = 0; // for (ExerciseGroup group : lst) { // i++; // group.setOrderNum(new BigInteger(String.valueOf(i))); // // this.exerciseService.saveExerciseGroup(group); // } // } // return new Result(true); // } // // /** // * ½²ÒåÅÅÐò // * // * @param key // * @return // */ // @RequestMapping(value = "/order", method = RequestMethod.POST) // public @ResponseBody Result order(@RequestParam("ids[]") List ids, @RequestParam("index[]") List index) { // service.doOrder(ids, index); // // // ɾ³ý΢ÉÌÏîÄ¿ËùÓлº´æ //// new CacheUtils().deleteWBProjectCacheData(); // // return new Result(true); // } // // /** // * ·ÖÏí½²Òå // * // * @return // */ // @RequestMapping(value = "share", method = RequestMethod.POST) // @ResponseBody // public Result share(String handoutIds,String shareName) { // // // ±£´æµ½·þÎñÆ÷ //// Result result = shareService.doSaveShare(handoutIds.split(","), shareName, ContentShare.SHARE_TYPE_HANDOUT); // // // ·µ»Ø½á¹û //// return result; // return null; // } // // /** // * »ÛÑÛ¶Ë: »ñÈ¡½²ÒåÎĵµÄ¿Â¼ URL :/school/HandOut/courseDirectory // * // * @param limit // * ÿҳÏÔʾ // * @param page // * Ò³Âë // * @return // */ // @RequestMapping(value = "courseDirectory", method = RequestMethod.GET) // public @ResponseBody ResultJson getCourseDirectory(@RequestParam("limit") int limit, @RequestParam("page") int page) { // Pager pager = new Pager(); // pager.setPageNum(page); // pager.setPageSize(limit); // // //²éѯ¿Î³Ì ·ÖÒ³ // String hql = " from SchClassSubject where classId = ? and deleteFlag is false order by createTime asc"; // List lstSub = commonDAO.findList(hql, pager, // CollectionUtils.newList(ClientUtils.getClassId()), SchClassSubject.class); // // if(lstSub.isEmpty()){ // if(page > 1){//±íʾ´ÓµÚ¶þÒ³¿ªÊ¼ // return new ResultJson(true, "µ±Ò³ÎÞÊý¾Ý", lstSub); // } // return new ResultJson(false, "µ±Ç°°à¼¶ÎÞÎĵµÁбí"); // } // // List> lst = new ArrayList>(lstSub.size()); // Map resultMap = null; // // for (SchClassSubject subject:lstSub) { // resultMap = new HashMap(2); // resultMap.put("classSubjectId", subject.getClassSubjectId()); // resultMap.put("name", subject.getName()); // // lst.add(resultMap); // } // // return new ResultJson(true, "²Ù×÷³É¹¦", lst); // } // // /** // * »ÛÑÛ¶Ë: »ñÈ¡½²ÒåÁбíURL:/school/HandOut/handoutListItem // * // * @param limit // * ÿҳÏÔʾ // * @param page // * Ò³Âë // * @return // */ // @RequestMapping(value = "handoutListItem", method = RequestMethod.GET) // public @ResponseBody ResultJson getCourseDirectory( // @RequestParam("classSubjectId") String classSubjectId, // @RequestParam("limit") int limit, // @RequestParam("page") int page) { // // Pager pager = new Pager(); // pager.setPageNum(page); // pager.setPageSize(limit); // // //¸ù¾Ý¿Î³ÌID²éѯ½²Òå // String hql = " from SchHandout where subjectId = ? and status=? and deleteFlag is false order by orderNum "; // List handouts = commonDAO.findList(hql, pager, // CollectionUtils.newList(classSubjectId, SchHandout.STATUS_ISSUED), SchHandout.class); // // if(handouts.isEmpty()){ // if(page > 1){//±íʾ´ÓµÚ¶þÒ³¿ªÊ¼ // return new ResultJson(true, "µ±Ò³ÎÞÊý¾Ý", handouts); // } // return new ResultJson(false, "µ±Ç°¿Î³ÌÎÞÎĵµ"); // } // // // ²éѯÊ×ҳͼƬ // Map argsMap = new HashMap(2); // Object[] args = new Object[handouts.size()]; // for (int i=0;i lstImgPath = commonDAO.findByComplexHql(hql_page, argsMap, Object[].class); // // Map imgMap = new HashMap(lstImgPath.size()); // for(Object[] obj:lstImgPath){ // imgMap.put(String.valueOf(obj[0]), String.valueOf(obj[1])); // } // // // ·µ»Ø½á¹û // List> lst = new ArrayList>(handouts.size()); // Map handoutMap; // for (SchHandout schHandout : handouts) { // handoutMap = new HashMap(5); // handoutMap.put("handoutId", schHandout.getHandoutId()); // handoutMap.put("name", schHandout.getName()); // handoutMap.put("pageCount", schHandout.getPageCount()); // handoutMap.put("playCount", schHandout.getPlayCount()); // handoutMap.put("mainImg", imgMap.get(schHandout.getHandoutId())); // // lst.add(handoutMap); // } // argsMap.put("handoutIds", args); // // return new ResultJson(true, "²Ù×÷³É¹¦", lst); // } // // // /** // * »ñÈ¡Îĵµ ËùÓÐ // * // * @return // */ // @RequestMapping(value = "live/fileItems", method = RequestMethod.GET) // public @ResponseBody ResultJson getFileItems(String videoLiveId) { // // 1¡¢²éѯֱ²¥¹ØÁªËùÓн²ÒåId // List lstHandout = commonDAO.find( // "select h.handoutId,h.name,h.pageCount" // + " from SchVideoFile f, SchHandout h " // + " where f.fileId=h.handoutId " // + " and f.businessId=? " // + " and h.status=? " // + " and f.deleteFlag is false" // + " and h.deleteFlag is false" // + " order by f.createTime asc", // CollectionUtils.newList(videoLiveId, SchHandout.STATUS_ISSUED), Object[].class); // // // if(lstHandout.isEmpty()){ // return new ResultJson(false, "µ±Ç°Ö±²¥Ã»ÓйØÁªµÄÎĵµ", lstHandout); // } // // // 3.×é×°Êý¾Ý // List> resultLst = new ArrayList>(lstHandout.size()); // Map resultMap; // for(Object[] obj:lstHandout){ // resultMap = new HashMap(); // // resultMap.put("handoutId", obj[0]); // resultMap.put("name", obj[1]); // resultMap.put("pageCount", obj[2]); // // resultMap.put("pages", getHandoutPageLiveList(String.valueOf(obj[0]))); // resultLst.add(resultMap); // } // // return new ResultJson(true, "²Ù×÷³É¹¦", resultLst); // } // // /** // * »ñÈ¡Îĵµµ¥¸ö // * // * @return // */ // @RequestMapping(value = "live/fileItem", method = RequestMethod.GET) // public @ResponseBody ResultJson getFileItem(String handoutId) { // // return new ResultJson(true, "²Ù×÷³É¹¦", getHandoutPageLiveList(handoutId)); // } // // /** // * »ñÈ¡µ±¸öÎĵµ // * @param handoutId // * @return // */ // private List> getHandoutPageLiveList(String handoutId){ // // List lstHandoutPage = commonDAO.find( // "from SchHandoutPage p " // + " where p.handoutId=? " // + " and p.deleteFlag is false" // + " order by pageOrder asc", // CollectionUtils.newList(handoutId), SchHandoutPage.class); // // List> resultLst = new ArrayList>(lstHandoutPage.size()); // // Map map; // for(SchHandoutPage page:lstHandoutPage){ // map = new HashMap(3); // map.put("url", page.getImgPath()); // map.put("handoutPageId", page.getHandoutPageId()); // map.put("pageOrder", page.getPageOrder()); // // resultLst.add(map); // } // // return resultLst; // } // // /** // * »ñÈ¡½²Òå½ø¶È // * // * @param handoutId // * @return // */ // @RequestMapping(value = "getUploadSchedule", method = RequestMethod.GET) // public @ResponseBody Float getUploadSchedule(String handoutId) { //// return cacheService.get("handout_upload_schedule_"+handoutId, Float.class); // return null; // } //}