派生自 projectDept/qhighschool

胡仁荣
2023-08-04 2174b22bbbb45284765a23b8189df59583c65d29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//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);
//    }
//
//}