派生自 projectDept/qhighschool

yn147
2023-11-24 d7963a84282c548fee3595b3343e6ae6ca49bb29
学籍,考勤
6个文件已修改
116 ■■■■ 已修改文件
src/main/java/com/qxueyou/scc/admin/attendance/impl/AttendanceServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/controller/AttendanceController.java 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/controller/SubjectController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/teach/subject/model/Subject.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/teach/subject/service/ISubjectService.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/qxueyou/scc/admin/attendance/impl/AttendanceServiceImpl.java
@@ -28,13 +28,13 @@
        try{
            SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
            //上课时间
            String classTime = "9:00:00";
            //当前时间
            String currentTime = sdf.format(new Date());
            String hqlTwo = "from Subject where name = ?";
            List<Object> argsTwo = CollectionUtils.newList(subjectName);
            Subject subject = findUnique(hqlTwo,argsTwo,Subject.class);
            //上课时间
            String classTime = subject.getEndTime();
            //当前时间
            String currentTime = sdf.format(new Date());
            //添加subjectId
            if(subject.getSubjectId() == subjectId){
                stuStudent.setSubjectId(subjectId);
@@ -45,17 +45,17 @@
            int compareTo = classTime.compareTo(currentTime);
            if(compareTo>0)
            {
                s="签到时间已过,本节课按照旷课处理";
                s="签到时间已过";
                stuStudent.setAttendanceStatus(stuStudent.STATUS_TRUANCY);
            }
            else
            {
                //打卡时间
                String clockTime = "8:50:00";
                String clockTime = subject.getEndTime();
                compareTo = currentTime.compareTo(clockTime);
                if(compareTo<0)
                {
                    s="未到签到时间,请与上课时间前10分钟签到";
                    s="未到签到时间";
                    stuStudent.setAttendanceStatus(stuStudent.STATUS_NO_CLOCKING);
                }
                else
@@ -76,10 +76,10 @@
    }
    @Override
    public List<StuStudent> findAttendanceList(Integer limit, Integer pageNum, String keyword, String subjectId) {
        StringBuffer hql=new StringBuffer("from StuStudent where name like ? and subjectId = ? and deleteFlag is false");
    public List<StuStudent> findAttendanceList(Integer limit, Integer pageNum, String keyword, String classId) {
        StringBuffer hql=new StringBuffer("from StuStudent where name like ? and classId = ? and deleteFlag is false");
        List<Object> args = CollectionUtils.newList(keyword + "%",subjectId);
        List<Object> args = CollectionUtils.newList(keyword + "%",classId);
        hql.append(" order by createTime desc");
src/main/java/com/qxueyou/scc/controller/AttendanceController.java
@@ -5,13 +5,18 @@
import com.qxueyou.scc.base.util.CollectionUtils;
import com.qxueyou.scc.base.util.QBeanUtils;
import com.qxueyou.scc.teach.student.model.StuStudent;
import com.qxueyou.scc.teach.subject.model.Subject;
import com.qxueyou.scc.teach.subject.service.ISubjectService;
import com.qxueyou.scc.teach.subject.service.impl.SubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Api(tags="考勤管理接口")
@RestController
@@ -20,7 +25,8 @@
    @Autowired
    private AttendanceService attendanceService;
    private SubjectService subjectService;
    @Autowired
    private ISubjectService iSubjectService;
    @ApiOperation(value = "打卡", notes = "")
    @GetMapping(value = "/attendanceUpAndAdd")
@@ -30,17 +36,47 @@
    @ApiOperation(value = "考勤信息", notes = "")
    @GetMapping(value = "/attendanceList")
    public Result attendanceList(@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "1") Integer pageNum, String keyword, String subjectId) {
    public Result attendanceList(@RequestParam(defaultValue = "10") Integer limit, @RequestParam(defaultValue = "1") Integer pageNum, String keyword, String classId) {
        List<StuStudent> attendanceList = attendanceService.findAttendanceList(limit, pageNum, keyword,subjectId);
        List<StuStudent> attendanceList = attendanceService.findAttendanceList(limit, pageNum, keyword,classId);
        int count = attendanceService.findAttendanceListCount(keyword,subjectId);
        int count = attendanceService.findAttendanceListCount(keyword,classId);
        List<Object> list = new ArrayList<>();
        for (StuStudent stuStudent : attendanceList){
                Map<String,String> mapList = new HashMap<>();
                mapList.put("name",stuStudent.getName());
                mapList.put("studentNo",stuStudent.getStudentNo());
                mapList.put("sex",String.valueOf(stuStudent.getSex()));
                mapList.put("mobilePhone",stuStudent.getMobilePhone());
                mapList.put("attendanceStatus",stuStudent.getAttendanceStatus());
                mapList.put("createTime",String.valueOf(stuStudent.getCreateTime()));
                mapList.put("studentId",stuStudent.getStudentId());
                mapList.put("photo",stuStudent.getPhoto());
                mapList.put("passporName",stuStudent.getPassporName());
                mapList.put("nationality",stuStudent.getNationality());
                mapList.put("ancestralHome",stuStudent.getAncestralHome());
                mapList.put("birthday",stuStudent.getBirthday());
                mapList.put("birthplace",stuStudent.getBirthplace());
                mapList.put("chinaStatus",stuStudent.getChinaStatus());
                mapList.put("registeredAddress",stuStudent.getRegisteredAddress());
                mapList.put("homeAddress",stuStudent.getHomeAddress());
                mapList.put("religiousBelief",stuStudent.getReligiousBelief());
                mapList.put("email",stuStudent.getEmail());
                mapList.put("workUnit",stuStudent.getWorkUnit());
                mapList.put("graduationDestination",stuStudent.getGraduationDestination());
                if(stuStudent.getSubjectId()!=null){
                    String subjectName = iSubjectService.findSubjectName(stuStudent.getSubjectId());
                    mapList.put("subjectName",subjectName);
                }
                list.add(mapList);
        }
        return new Result(true,"success", CollectionUtils.newObjectMap("attendanceList",
                QBeanUtils.listBean2ListMap(attendanceList,
                QBeanUtils.listBean2ListMap(list,
                        CollectionUtils.newStringMap("name", "studentName", "studentNo", "studentNo","sex","sex","mobilePhone","mobilePhone", "attendanceStatus",
                                "attendanceStatus", "createTime", "createTime", "studentId", "studentId")),
                                "attendanceStatus", "createTime", "createTime", "studentId", "studentId","photo","photo","passporName","passporName","nationality","nationality","ancestralHome","ancestralHome","birthday","birthday","birthplace","birthplace","chinaStatus","chinaStatus","registeredAddress","registeredAddress","homeAddress","homeAddress","religiousBelief","religiousBelief","email","email","workUnit","workUnit","graduationDestination","graduationDestination","subjectName","subjectName")),
                "attendanceCount", count));
    }
src/main/java/com/qxueyou/scc/controller/SubjectController.java
@@ -177,8 +177,8 @@
     *            课程介绍
     */
    @PostMapping(value = "/copy")
    public Result copy(String subjectId, String subjectName, String imgPath, String content,int type) {
        return add(subjectName, imgPath, content,type);
    public Result copy(String subjectId, String subjectName, String imgPath, String content,int type,String startTime,String endTime) {
        return add(subjectName, imgPath, content,type,startTime,endTime);
    }
    /**
@@ -193,7 +193,7 @@
     * @return
     */
    @PostMapping(value = "/add")
    public Result add(String subjectName, String imgPath, String content,int type) {
    public Result add(String subjectName, String imgPath, String content,int type,String startTime,String endTime) {
        String contentFileId = null;
        
        if(StringUtils.isNotEmpty(content)){
@@ -207,7 +207,7 @@
            coverPageFileId = fileService.readIdByPath(imgPath);
        }
        
        return subjectService.add(subjectName, coverPageFileId,contentFileId,type);
        return subjectService.add(subjectName, coverPageFileId,contentFileId,type,startTime,endTime);
    }
    /**
src/main/java/com/qxueyou/scc/teach/subject/model/Subject.java
@@ -102,6 +102,12 @@
    @Column(name="CONTENT_FILE_ID")
    private String contentFileId;
    
    @Column(name = "START_TIME")
    private String startTime;
    @Column(name = "END_TIME")
    private String endTime;
    public final static String STATUS_DRAFT = "0";
    
    public final static String STATUS_ISSUED = "1";
@@ -362,5 +368,19 @@
        this.orgId = orgId;
    }
    public String getStartTime() {
        return startTime;
    }
    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }
    public String getEndTime() {
        return endTime;
    }
    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }
}
src/main/java/com/qxueyou/scc/teach/subject/service/ISubjectService.java
@@ -24,7 +24,7 @@
     *            内容文件id
     * @return
     */
    Result add(String subjectName, String coverPageFileId, String contentFileId,int type);
    Result add(String subjectName, String coverPageFileId, String contentFileId,int type,String startTime,String endTime);
    /**
     * 修改课程
@@ -387,4 +387,11 @@
     * @return
     */
    public long getLectureCount(String subjectId);
    /**
     * 获取课程名称
     * @param subjectId
     * @return
     */
    String findSubjectName(String subjectId);
}
src/main/java/com/qxueyou/scc/teach/subject/service/impl/SubjectService.java
@@ -107,7 +107,7 @@
    @Override
    public Result add(String subjectName, String coverPageFileId, String contentFileId, int type) {
    public Result add(String subjectName, String coverPageFileId, String contentFileId, int type,String startTime,String endTime) {
        Subject subject = new Subject();
        if (StringUtils.isNotEmpty(coverPageFileId)) {
@@ -122,6 +122,9 @@
        subject.setStatus(Subject.STATUS_DRAFT);
        subject.setLectureCount(0);
        subject.setType(type);
        //签到时间
        subject.setStartTime(startTime);
        subject.setEndTime(endTime);
        subject.setOrgId(ClientUtils.getOrgId());
        save(subject);
@@ -1097,6 +1100,12 @@
        }
    }
    @Override
    public String findSubjectName(String subjectId) {
        Subject subject = findUnique("from Subject where subjectId = ? ",CollectionUtils.newList(subjectId),Subject.class);
        return subject.getName();
    }
    /**
     * 我的公开课列表