Browse Source

后台页修改

zhuhaiwen 3 years ago
parent
commit
0b0ef16216

+ 20 - 0
oa-app/src/main/java/com/css/oa/exam/assign/repository/IAssignRepository.java

21
21
22
    @Modifying
22
    @Modifying
23
    @Transactional
23
    @Transactional
24
    @Query("delete from Assign ass where ass.enroll_id in (?1)")
25
    void deleteByEnrollIds(List<String> ids);
26
27
    @Modifying
28
    @Transactional
29
    @Query("select ass.uuid from Assign ass where ass.enroll_id in (?1)")
30
    List<String> getUuids(List<String> ids);
31
32
    @Modifying
33
    @Transactional
34
    @Query("select ass.adm_num from Assign ass where ass.enroll_id in (?1)")
35
    List<String> getAdmNums(List<String> enroll_ids);
36
37
    @Modifying
38
    @Transactional
39
    @Query("select ass.student_id from Assign ass where ass.enroll_id in (?1)")
40
    List<String> getStuIds(List<String> enroll_id);
41
42
    @Modifying
43
    @Transactional
24
    @Query("select ass from Assign ass where ass.exam_id = :exam_id and ass.student_id = :student_id")
44
    @Query("select ass from Assign ass where ass.exam_id = :exam_id and ass.student_id = :student_id")
25
    List<Assign> findByStuId(@Param("exam_id") String exam_id, @Param("student_id") String student_id);
45
    List<Assign> findByStuId(@Param("exam_id") String exam_id, @Param("student_id") String student_id);
26
46

+ 4 - 0
oa-app/src/main/java/com/css/oa/exam/certificate/repository/ICertificateRepository.java

23
    @Query("select cer from Certificate cer where cer.student_id = :student_id and cer.exam_id = :exam_id")
23
    @Query("select cer from Certificate cer where cer.student_id = :student_id and cer.exam_id = :exam_id")
24
    List<Certificate> myOneCerti(String student_id, String exam_id);
24
    List<Certificate> myOneCerti(String student_id, String exam_id);
25
25
26
    @Modifying
27
    @Transactional
28
    @Query("delete from Certificate cer where cer.adm_num in :adm_nums")
29
    void deleteAllByAdm_nums(List<String> adm_nums);
26
30
27
}
31
}

+ 1 - 1
oa-app/src/main/java/com/css/oa/exam/enroll/controller/EnrollController.java

62
        return result;
62
        return result;
63
    }
63
    }
64
64
65
    @ApiOperation(value = "增加报名")
65
    @ApiOperation(value = "删除报名")
66
    @PostMapping("/delete")
66
    @PostMapping("/delete")
67
    public Result delete(@RequestBody List<String> ids) {
67
    public Result delete(@RequestBody List<String> ids) {
68
        Result<Map> result;
68
        Result<Map> result;

+ 1 - 2
oa-app/src/main/java/com/css/oa/exam/enroll/repository/IEnrollRecord.java

13
@Repository
13
@Repository
14
public interface IEnrollRecord extends JpaRepository<EnrollRecord, String>, JpaSpecificationExecutor<EnrollRecord> {
14
public interface IEnrollRecord extends JpaRepository<EnrollRecord, String>, JpaSpecificationExecutor<EnrollRecord> {
15
15
16
    //批量删除
17
    @Modifying
16
    @Modifying
18
    @Transactional
17
    @Transactional
19
    @Query("delete from EnrollRecord er where er.enroll_id in :ids")
18
    @Query("delete from EnrollRecord er where er.enroll_id in :ids")
20
    void deleteRealByIds(@Param("ids") List<String> ids);
19
    void deleteByEnrollIds(@Param("ids") List<String> ids);
21
20
22
    @Modifying
21
    @Modifying
23
    @Transactional
22
    @Transactional

+ 53 - 6
oa-app/src/main/java/com/css/oa/exam/enroll/service/EnrollService.java

4
import cn.afterturn.easypoi.excel.entity.ExportParams;
4
import cn.afterturn.easypoi.excel.entity.ExportParams;
5
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
5
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
6
import com.css.oa.exam.admin.bean.Admin;
6
import com.css.oa.exam.admin.bean.Admin;
7
import com.css.oa.exam.assign.repository.IAssignRecord;
8
import com.css.oa.exam.assign.repository.IAssignRepository;
7
import com.css.oa.exam.base.BaseVerifyService;
9
import com.css.oa.exam.base.BaseVerifyService;
10
import com.css.oa.exam.certificate.repository.ICertificateRepository;
8
import com.css.oa.exam.constants.*;
11
import com.css.oa.exam.constants.*;
9
import com.css.oa.exam.enroll.bean.*;
12
import com.css.oa.exam.enroll.bean.*;
10
import com.css.oa.exam.enroll.repository.*;
13
import com.css.oa.exam.enroll.repository.*;
104
        return wrap;
107
        return wrap;
105
    }
108
    }
106
109
107
    public void delete(List<String> ids) {
108
        repository.deleteRealByIds(ids);
110
    @Autowired
111
    IAssignRepository assignRepo;
112
    @Autowired
113
    IAssignRecord assignRecord;
114
    @Autowired
115
    IScoreRepository scoreRepository;
116
    @Autowired
117
    ICertificateRepository certificateRepository;
118
119
    public void delete(List<String> enroll_ids) {
120
        //删除报名相关
121
        repository.deleteRealByIds(enroll_ids);
122
        enrollRecord.deleteByEnrollIds(enroll_ids);
123
        //删除分配相关
124
        List<String> stuIds = assignRepo.getStuIds(enroll_ids);
125
        List<String> admNums = assignRepo.getAdmNums(enroll_ids);
126
        List<String> assign_uuids = assignRepo.getUuids(enroll_ids);
127
        assignRecord.deleteRealByIds(assign_uuids);
128
        assignRepo.deleteByEnrollIds(enroll_ids);
129
        //删除成绩相关
130
        List<String> cardNums = studentRepository.findCardNums(stuIds);
131
        scoreRepository.deleteByCardNums(cardNums);
132
        //删除合格证相关
133
        certificateRepository.deleteAllByAdm_nums(admNums);
109
    }
134
    }
110
135
111
    private Specification<Enroll> getSpec(Condition condition) {
136
    private Specification<Enroll> getSpec(Condition condition) {
400
    @Autowired
425
    @Autowired
401
    IExamRepository examRepository;
426
    IExamRepository examRepository;
402
427
403
    @Autowired
404
    IScoreRepository scoreRepository;
405
406
    @Override
428
    @Override
407
    public List<MyEnrollWrap> myEnroll(String student_id) {
429
    public List<MyEnrollWrap> myEnroll(String student_id) {
408
        List<Enroll> enrolls = repository.myEnroll(student_id);
430
        List<Enroll> enrolls = repository.myEnroll(student_id);
410
        //我的报名信息 + 此次考试信息
432
        //我的报名信息 + 此次考试信息
411
        List<MyEnrollWrap> wraps = new ArrayList<>();
433
        List<MyEnrollWrap> wraps = new ArrayList<>();
412
        for (Enroll enroll : enrolls) {
434
        for (Enroll enroll : enrolls) {
413
            wraps.add(getWrap(enroll, student_id));
435
            MyEnrollWrap wrap = new MyEnrollWrap();
436
            CopyObjTool.copyProperties(enroll, wrap);
437
            //增加考试信息
438
            Exam exam = examRepository.findById(enroll.getExam_id()).get();
439
            CopyObjTool.copyProperties(exam, wrap);
440
            //设置 enroll_state
441
            if(enroll.getIs_reject() == BoolState.YES){
442
                wrap.setEnroll_state("未通过");
443
            }else {
444
                if(enroll.getVerify_state().equalsIgnoreCase(VerifyState.LEVEL1_GREE)){
445
                    wrap.setEnroll_state("已通过");
446
                }else {
447
                    wrap.setEnroll_state("审核中");
448
                }
449
            }
450
            //设置 pay_state,
451
            wrap.setPay_state(enroll.getPay_name());
452
            //设置 exam_state,在成绩里边查,如果有成绩或者作弊了就是参加了考试
453
            List<Score> scores = scoreRepository.findScoreByStuId(enroll.getExam_id(), student_id);
454
            if (scores.size() > 0 && scores.get(0).getScore() != BoolState.DEFULT) {
455
                //如果给这个人发了准考证,但是他考试得了0分,也说明他参加了考试
456
                wrap.setExam_state("已完成");
457
            } else {
458
                wrap.setExam_state("未参加");
459
            }
460
            wraps.add(wrap);
414
        }
461
        }
415
        return wraps;
462
        return wraps;
416
    }
463
    }

+ 14 - 29
oa-app/src/main/java/com/css/oa/exam/node/service/NodeService.java

22
    @Override
22
    @Override
23
    public void add(Node obj) {
23
    public void add(Node obj) {
24
        System.out.println("传入的obj => " + obj.toString());
24
        System.out.println("传入的obj => " + obj.toString());
25
        if (obj.getUuid() == null) {
26
            String id = UUIDGenerator.getUUID();
27
            obj.setUuid(id);
28
        }
25
        String id = UUIDGenerator.getUUID();
26
        obj.setUuid(id);
29
        Date newDate = new Date();
27
        Date newDate = new Date();
30
        if (obj.getCreate_time() == null) {
31
            obj.setCreate_time(newDate);
32
        }
33
        if (obj.getUpdate_time() == null) {
34
            obj.setUpdate_time(newDate);
35
        }
36
        if (TextUtils.isEmpty(obj.getCreate_user()) || obj.getCreate_user().equalsIgnoreCase("null")) {
37
            obj.setCreate_user("系统");
38
        }
39
        if (TextUtils.isEmpty(obj.getUpdate_user()) || obj.getCreate_user().equalsIgnoreCase("null")) {
40
            obj.setUpdate_user("系统");
41
        }
42
        if (obj.getDel_flag() == null) {
43
            obj.setDel_flag("1");
44
        }
45
        if (obj.getRemark() == null) {
46
            obj.setRemark("系统默认的备注");
47
        }
28
        obj.setCreate_time(newDate);
29
        obj.setUpdate_time(newDate);
30
        obj.setCreate_user("一级管理员");
31
        obj.setUpdate_user("一级管理员");
32
        obj.setDel_flag("1");
33
        obj.setRemark("系统默认的备注");
48
        repository.save(obj);
34
        repository.save(obj);
49
    }
35
    }
50
36
59
    }
45
    }
60
46
61
    @Override
47
    @Override
62
    public void update(Node newTest) {
63
        if(newTest.getUpdate_time() == null){
48
    public void update(Node obj) {
49
        if(obj.getUpdate_time() == null){
64
            Date newDate = new Date();
50
            Date newDate = new Date();
65
            newTest.setUpdate_time(newDate);
51
            obj.setUpdate_time(newDate);
66
        }
52
        }
67
        Optional<Node> byId = repository.findById(newTest.getUuid());
68
        Node old = byId.get();
69
        CopyObjTool.copyProperties(old, newTest);
70
        repository.save(newTest);
53
        Node old  = repository.findById(obj.getUuid()).get();
54
        CopyObjTool.copyProperties(old, obj);
55
        repository.save(obj);
71
    }
56
    }
72
57
73
    @Override
58
    @Override

+ 5 - 0
oa-app/src/main/java/com/css/oa/exam/score/repository/IScoreRepository.java

22
22
23
    @Modifying
23
    @Modifying
24
    @Transactional
24
    @Transactional
25
    @Query("delete from Score sc where sc.card_num in :card_nums")
26
    void deleteByCardNums(@Param("card_nums") List<String> card_nums);
27
28
    @Modifying
29
    @Transactional
25
    @Query("select sc.cheat_state from Score sc where sc.exam_id = :exam_id and sc.stu_id = :stu_id")
30
    @Query("select sc.cheat_state from Score sc where sc.exam_id = :exam_id and sc.stu_id = :stu_id")
26
    List<Integer> findCheatByStuId(@Param("exam_id") String exam_id, @Param("stu_id") String stu_id);
31
    List<Integer> findCheatByStuId(@Param("exam_id") String exam_id, @Param("stu_id") String stu_id);
27
32

+ 5 - 0
oa-app/src/main/java/com/css/oa/exam/student/repository/IStudentRepository.java

29
    @Query("select stu from Student stu where stu.card_num like :card_num")
29
    @Query("select stu from Student stu where stu.card_num like :card_num")
30
    List<Student> findStuByCardNum(@Param("card_num") String card_num);
30
    List<Student> findStuByCardNum(@Param("card_num") String card_num);
31
31
32
    @Modifying
33
    @Transactional
34
    @Query("select stu.card_num from Student stu where stu.uuid in :uuids")
35
    List<String> findCardNums(@Param("uuids") List<String> uuids);
36
32
}
37
}