//package com.qxueyou.scc.org.service.impl;
|
//
|
//import java.text.ParseException;
|
//import java.text.SimpleDateFormat;
|
//import java.util.Date;
|
//import java.util.HashMap;
|
//import java.util.List;
|
//import java.util.Map;
|
//
|
//import org.apache.commons.lang3.StringUtils;
|
//import org.apache.logging.log4j.LogManager;
|
//import org.apache.logging.log4j.Logger;
|
//import org.springframework.stereotype.Service;
|
//
|
//import com.qxueyou.scc.base.model.Pager;
|
//import com.qxueyou.scc.base.model.Result;
|
//import com.qxueyou.scc.base.service.impl.CommonAppService;
|
//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.org.model.OrgClass;
|
//import com.qxueyou.scc.org.model.OrgCourse;
|
//import com.qxueyou.scc.org.service.IOrgClassService;
|
//
|
///**
|
// * °à¼¶·þÎñÀà
|
// *
|
// * @author chenjunliang
|
// *
|
// */
|
//@Service
|
//public class OrgClassService extends CommonAppService implements IOrgClassService {
|
// private final Logger log = LogManager.getLogger("OrgClassService");
|
//
|
// /**
|
// * Ìí¼Ó°à¼¶
|
// */
|
// @Override
|
// public Result insertClass(String className, String classNumber, String startTime, String endTime,
|
// String courseIds, boolean overTime, boolean quitClass, boolean displayAnswer, boolean repeatExercise,
|
// boolean forum) {
|
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
// Date startTime_ = null;
|
// Date endTime_ = null;
|
// try {
|
// startTime_ = simpleDateFormat.parse(startTime);
|
// if (!StringUtils.isBlank(endTime)) {
|
// endTime_ = simpleDateFormat.parse(endTime);
|
// }
|
// } catch (ParseException e) {
|
// log.error("ÈÕÆÚת»»Ê§°Ü", e);
|
// }
|
// String teacherId = ClientUtils.getUserId();
|
// OrgClass orgClass = new OrgClass();
|
// orgClass.setClassNumber(classNumber);
|
// orgClass.setTeacherId(teacherId);
|
// orgClass.setName(className);
|
// orgClass.setStartTime(startTime_);
|
// orgClass.setEndTime(endTime_);
|
// orgClass.setCourseId(courseIds);
|
// orgClass.setOverTime(overTime);
|
// orgClass.setQuitClass(quitClass);
|
// orgClass.setDisplayAnswer(displayAnswer);
|
// orgClass.setRepeatExercise(repeatExercise);
|
// orgClass.setForum(forum);
|
// orgClass.setTeacherId(ClientUtils.getUserId());
|
// TraceUtils.setCreateTrace(orgClass);
|
// save(orgClass);
|
//
|
// return new Result(true, "success");
|
// }
|
//
|
// /**
|
// * »ñÈ¡°à¼¶Áбí
|
// */
|
// @SuppressWarnings("unused")
|
// @Override
|
// public Result getClassLst(String keyword, Integer pageNo, Integer currentPage) {
|
// String keyword_ = StringUtils.isEmpty(keyword) ? "" : keyword;
|
// String hql = "select classId as classId , name as name ,classNumber as classNumber ,studentCount as studentCount ,createTime as createTime"
|
// + ", startTime as startTime ,courseId as courseId from OrgClass where deleteFlag is false and className like :keyword order by createTime desc";
|
// List<Map<String, Object>> orgClassLst = findListWithMapByHql(hql,
|
// CollectionUtils.newObjectMap("keyword", "%" + keyword_ + "%"), new Pager(pageNo, currentPage));
|
// int orgClassCount = this.orgClassCount(keyword_);
|
//
|
// Map<String, Object> classCountMap = CollectionUtils.newObjectMap("orgClassCount", orgClassCount);// ÏÔʾ²éѯµÄÌõÊý
|
// Map<String, Object> argsMap = null;
|
// for (Map<String, Object> map : orgClassLst) {
|
// String courseId = (String) map.get("courseId");
|
// String[] courseIds = courseId.split(",");
|
// argsMap = new HashMap<String, Object>(1);
|
// argsMap.put("courseIds", courseIds);
|
// List<OrgCourse> courseName = findByComplexHql(
|
// "select name as courseName from OrgCourse where noticeId in (:noticeIds)", argsMap,
|
// OrgCourse.class);
|
// Map<String, Object> courseNameMap = CollectionUtils.newObjectMap("courseName", courseName);
|
// }
|
//
|
// return new Result(true, "success", null);
|
// }
|
//
|
// /**
|
// * »ñÈ¡°à¼¶Áбí×ÜÌõÊý
|
// */
|
// private int orgClassCount(String keyword) {
|
// String hql = "select count(1) from OrgClass where deleteFlas is false and name like:keyword";
|
// int findCount = findCountByComplexHql(hql, CollectionUtils.newObjectMap("keyword", "%" + keyword + "%"));
|
//
|
// return findCount;
|
// }
|
//
|
// /**
|
// * ɾ³ý°à¼¶
|
// */
|
// @Override
|
// public Result deleteClass(String classIds) {
|
// if (StringUtils.isBlank(classIds)) {
|
// return new Result(false, "param is not null");
|
// }
|
// String[] arrClass = classIds.split(",");
|
//
|
// // 1. ɾ³ý°à¼¶
|
// getCommonDAO().bulkUpdateInLoop("update OrgClass set deleteFlag = true where classId = ?", arrClass);
|
// // 2.ɾ³ý°à¼¶¶ÔÓ¦µÄ¿Î³Ì
|
// return null;
|
// }
|
//
|
// /**
|
// * ²é¿´°à¼¶»ù±¾ÐÅÏ¢
|
// */
|
// @SuppressWarnings("unused")
|
// @Override
|
// public Result queryClass(String classId) {
|
// String hql = "select o.name as name,o.classNumber as classNumber,o.studentCount as studentCount ,o.startTime as startTime , o.createTime as createTime"
|
// + " ,o.overTime as overTime , o.quitClass as quitClass ,o.displayAnswer as displayAnswer,o.repeatExercise as repeatExercise, o.forum as forum "
|
// + "u.name as teacherName from OrgClass o,User u where o.deleteFlag is false and o.classId =:classId and u.userId = o.teacherId";
|
//
|
// return null;
|
// }
|
//
|
// @Override
|
// public Result getCourseLst() {
|
// String hql = "select courseId as courseId, name as courseName from OrgCourse where deleteFlag is false ";
|
// List<Map<String, Object>> courseName = findListWithMapByHql(hql, null);
|
// return new Result(true, "success", courseName);
|
// }
|
//
|
//}
|