Browse Source

node相关报错

zhuhaiwen 3 years ago
parent
commit
b43e19fdbc

+ 3 - 3
oa-app/src/main/java/com/css/oa/exam/assign/service/AdmService.java

9
import com.css.oa.exam.constants.BoolState;
9
import com.css.oa.exam.constants.BoolState;
10
import com.css.oa.exam.exam.repository.entity.Exam;
10
import com.css.oa.exam.exam.repository.entity.Exam;
11
import com.css.oa.exam.exam.repository.IExamRepository;
11
import com.css.oa.exam.exam.repository.IExamRepository;
12
import com.css.oa.exam.node.service.impl.NodeQueryService;
12
import com.css.oa.exam.node.service.impl.ExamNodeQueryService;
13
import com.css.oa.exam.room.repository.IRoomRepository;
13
import com.css.oa.exam.room.repository.IRoomRepository;
14
import com.css.oa.exam.room.repository.entity.Room;
14
import com.css.oa.exam.room.repository.entity.Room;
15
import com.css.oa.exam.student.repository.entity.Student;
15
import com.css.oa.exam.student.repository.entity.Student;
310
    IExamRepository examRepository;
310
    IExamRepository examRepository;
311
311
312
    @Autowired
312
    @Autowired
313
    NodeQueryService nodeQueryService;
313
    ExamNodeQueryService examNodeQueryService;
314
314
315
    public Map myAdm(String student_id) {
315
    public Map myAdm(String student_id) {
316
        if(nodeQueryService.printAdmissionIsClose()){
316
        if(examNodeQueryService.printAdmissionIsClose()){
317
            List<MyAdmWrap> wraps = new ArrayList<>();
317
            List<MyAdmWrap> wraps = new ArrayList<>();
318
            Map map = new LinkedHashMap();
318
            Map map = new LinkedHashMap();
319
            map.put("total", 0);
319
            map.put("total", 0);

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

6
import com.css.oa.exam.enroll.viewobjects.*;
6
import com.css.oa.exam.enroll.viewobjects.*;
7
import com.css.oa.exam.enroll.viewobjects.MyEnrollWrap;
7
import com.css.oa.exam.enroll.viewobjects.MyEnrollWrap;
8
import com.css.oa.exam.enroll.service.impl.EnrollServiceImpl;
8
import com.css.oa.exam.enroll.service.impl.EnrollServiceImpl;
9
import com.css.oa.exam.node.service.impl.NodeQueryService;
9
import com.css.oa.exam.node.service.impl.ExamNodeQueryService;
10
import com.css.oa.utils.Result;
10
import com.css.oa.utils.Result;
11
import io.swagger.annotations.Api;
11
import io.swagger.annotations.Api;
12
import io.swagger.annotations.ApiOperation;
12
import io.swagger.annotations.ApiOperation;
27
    private EnrollServiceImpl mService;
27
    private EnrollServiceImpl mService;
28
28
29
    @Autowired
29
    @Autowired
30
    private NodeQueryService nodeQuery;
30
    private ExamNodeQueryService nodeQuery;
31
31
32
    @Autowired
32
    @Autowired
33
    private CheatSetService cheatService;
33
    private CheatSetService cheatService;

+ 13 - 13
oa-app/src/main/java/com/css/oa/exam/node/controller/NodeController.java

2
2
3
import com.css.oa.exam.base.BaseController;
3
import com.css.oa.exam.base.BaseController;
4
import com.css.oa.exam.constants.BoolState;
4
import com.css.oa.exam.constants.BoolState;
5
import com.css.oa.exam.node.repository.entity.Node;
6
import com.css.oa.exam.node.service.impl.NodeQueryService;
7
import com.css.oa.exam.node.service.impl.NodeServiceImpl;
5
import com.css.oa.exam.node.repository.entity.ExamNode;
6
import com.css.oa.exam.node.service.impl.ExamNodeQueryService;
7
import com.css.oa.exam.node.service.impl.ExamNodeServiceImpl;
8
import com.css.oa.utils.Result;
8
import com.css.oa.utils.Result;
9
import io.swagger.annotations.Api;
9
import io.swagger.annotations.Api;
10
import io.swagger.annotations.ApiOperation;
10
import io.swagger.annotations.ApiOperation;
18
@Api(tags = {"节点控制"})
18
@Api(tags = {"节点控制"})
19
@RestController
19
@RestController
20
@RequestMapping("/node")
20
@RequestMapping("/node")
21
public class NodeController extends BaseController {
21
public class ExamNodeController extends BaseController {
22
22
23
    @Autowired
23
    @Autowired
24
    private NodeServiceImpl mService;
24
    private ExamNodeServiceImpl mService;
25
25
26
    @ApiOperation(value = "列表")
26
    @ApiOperation(value = "列表")
27
    @GetMapping("/queryAll")
27
    @GetMapping("/queryAll")
39
39
40
    @ApiOperation(value = "编辑")
40
    @ApiOperation(value = "编辑")
41
    @PostMapping("/update")
41
    @PostMapping("/update")
42
    public Result update(@RequestBody Node obj) {
42
    public Result update(@RequestBody ExamNode obj) {
43
        Result<Map> result;
43
        Result<Map> result;
44
        try {
44
        try {
45
            if (TextUtils.isEmpty(obj.uuid)) {
45
            if (TextUtils.isEmpty(obj.uuid)) {
60
60
61
    @ApiOperation(value = "增加节点控制")
61
    @ApiOperation(value = "增加节点控制")
62
    @PostMapping("/add")
62
    @PostMapping("/add")
63
    public Result add(@RequestBody Node obj) {
63
    public Result add(@RequestBody ExamNode obj) {
64
        Result<Map> result;
64
        Result<Map> result;
65
        try {
65
        try {
66
            if (TextUtils.isEmpty(obj.getName())) {
66
            if (TextUtils.isEmpty(obj.getName())) {
90
    }
90
    }
91
91
92
    @Autowired
92
    @Autowired
93
    NodeQueryService nodeQueryService;
93
    ExamNodeQueryService examNodeQueryService;
94
94
95
    @ApiOperation(value = "报名节点是否已经关闭")
95
    @ApiOperation(value = "报名节点是否已经关闭")
96
    @GetMapping("/enrollIsClose")
96
    @GetMapping("/enrollIsClose")
97
    public Result enrollIsClose() {
97
    public Result enrollIsClose() {
98
        Result<Map> result;
98
        Result<Map> result;
99
        try {
99
        try {
100
            boolean b = nodeQueryService.enrollIsClose();
100
            boolean b = examNodeQueryService.enrollIsClose();
101
            result = setResult("" + b);
101
            result = setResult("" + b);
102
        } catch (Exception e) {
102
        } catch (Exception e) {
103
            result = setErr(e.getMessage());
103
            result = setErr(e.getMessage());
111
    public Result payIsClose() {
111
    public Result payIsClose() {
112
        Result<Map> result;
112
        Result<Map> result;
113
        try {
113
        try {
114
            boolean b = nodeQueryService.payIsClose();
114
            boolean b = examNodeQueryService.payIsClose();
115
            result = setResult("" + b);
115
            result = setResult("" + b);
116
        } catch (Exception e) {
116
        } catch (Exception e) {
117
            result = setErr(e.getMessage());
117
            result = setErr(e.getMessage());
125
    public Result printAdmissionIsClose() {
125
    public Result printAdmissionIsClose() {
126
        Result<Map> result;
126
        Result<Map> result;
127
        try {
127
        try {
128
            boolean b = nodeQueryService.printAdmissionIsClose();
128
            boolean b = examNodeQueryService.printAdmissionIsClose();
129
            result = setResult("" + b);
129
            result = setResult("" + b);
130
        } catch (Exception e) {
130
        } catch (Exception e) {
131
            result = setErr(e.getMessage());
131
            result = setErr(e.getMessage());
139
    public Result joinExamIsClose() {
139
    public Result joinExamIsClose() {
140
        Result<Map> result;
140
        Result<Map> result;
141
        try {
141
        try {
142
            boolean b = nodeQueryService.joinExamIsClose();
142
            boolean b = examNodeQueryService.joinExamIsClose();
143
            result = setResult("" + b);
143
            result = setResult("" + b);
144
        } catch (Exception e) {
144
        } catch (Exception e) {
145
            result = setErr(e.getMessage());
145
            result = setErr(e.getMessage());
153
    public Result queryScoreIsClose() {
153
    public Result queryScoreIsClose() {
154
        Result<Map> result;
154
        Result<Map> result;
155
        try {
155
        try {
156
            boolean b = nodeQueryService.queryScoreIsClose();
156
            boolean b = examNodeQueryService.queryScoreIsClose();
157
            result = setResult("" + b);
157
            result = setResult("" + b);
158
        } catch (Exception e) {
158
        } catch (Exception e) {
159
            result = setErr(e.getMessage());
159
            result = setErr(e.getMessage());

+ 3 - 3
oa-app/src/main/java/com/css/oa/exam/node/repository/INodeRepository.java

1
package com.css.oa.exam.node.repository;
1
package com.css.oa.exam.node.repository;
2
2
3
import com.css.oa.exam.node.repository.entity.Node;
3
import com.css.oa.exam.node.repository.entity.ExamNode;
4
import org.springframework.data.jpa.repository.JpaRepository;
4
import org.springframework.data.jpa.repository.JpaRepository;
5
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
5
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6
import org.springframework.data.jpa.repository.Modifying;
6
import org.springframework.data.jpa.repository.Modifying;
12
import java.util.List;
12
import java.util.List;
13
13
14
@Repository
14
@Repository
15
public interface INodeRepository extends JpaRepository<Node, String>, JpaSpecificationExecutor<Node> {
15
public interface ExamNodeRepository extends JpaRepository<ExamNode, String>, JpaSpecificationExecutor<ExamNode> {
16
16
17
    //批量删除
17
    //批量删除
18
    @Modifying
18
    @Modifying
19
    @Transactional
19
    @Transactional
20
    @Query("delete from Node n where n.uuid in :ids")
20
    @Query("delete from ExamNode n where n.uuid in :ids")
21
    void deleteRealByIds(@Param("ids") List<String> ids);
21
    void deleteRealByIds(@Param("ids") List<String> ids);
22
22
23
}
23
}

+ 1 - 1
oa-app/src/main/java/com/css/oa/exam/node/repository/entity/Node.java

13
@Data
13
@Data
14
@Entity
14
@Entity
15
@Table(name = "OP_EXAM_NODE")
15
@Table(name = "OP_EXAM_NODE")
16
public class Node implements Serializable {
16
public class ExamNode implements Serializable {
17
17
18
    public static final long serialVersionUID = -2982710232836091012L;
18
    public static final long serialVersionUID = -2982710232836091012L;
19
19

+ 18 - 0
oa-app/src/main/java/com/css/oa/exam/node/service/ExamNodeService.java

1
package com.css.oa.exam.node.service;
2
3
import com.css.oa.exam.node.repository.entity.ExamNode;
4
5
import java.util.List;
6
import java.util.Map;
7
8
public interface ExamNodeService {
9
10
    void add(ExamNode test);
11
12
    Map queryAll();
13
14
    void update(ExamNode newTest);
15
16
    void delete(List<String> ids);
17
18
}

+ 0 - 18
oa-app/src/main/java/com/css/oa/exam/node/service/NodeService.java

1
package com.css.oa.exam.node.service;
2
3
import com.css.oa.exam.node.repository.entity.Node;
4
5
import java.util.List;
6
import java.util.Map;
7
8
public interface NodeService {
9
10
    void add(Node test);
11
12
    Map queryAll();
13
14
    void update(Node newTest);
15
16
    void delete(List<String> ids);
17
18
}

+ 42 - 0
oa-app/src/main/java/com/css/oa/exam/node/service/impl/ExamNodeQueryService.java

1
package com.css.oa.exam.node.service.impl;
2
3
import com.css.oa.exam.constants.BoolState;
4
import com.css.oa.exam.node.repository.entity.ExamNode;
5
import com.css.oa.exam.node.viewobjects.NodeType;
6
import com.css.oa.exam.node.repository.ExamNodeRepository;
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.stereotype.Service;
9
10
@Service
11
public class ExamNodeQueryService implements NodeType {
12
13
    @Autowired
14
    ExamNodeRepository repository;
15
16
    public boolean enrollIsClose() {
17
        ExamNode examNode = repository.findById(ENROLL).get();
18
        return examNode.is_open == BoolState.NO;
19
    }
20
21
    public boolean payIsClose() {
22
        ExamNode examNode = repository.findById(PAY).get();
23
        return examNode.is_open == BoolState.NO;
24
    }
25
26
    public boolean printAdmissionIsClose() {
27
        ExamNode examNode = repository.findById(PRINT_ADMISSION).get();
28
        return examNode.is_open == BoolState.NO;
29
    }
30
31
    public boolean joinExamIsClose() {
32
        ExamNode examNode = repository.findById(JOIN_EXAM).get();
33
        return examNode.is_open == BoolState.NO;
34
    }
35
36
    public boolean queryScoreIsClose() {
37
        ExamNode examNode = repository.findById(QUERY_SCORE).get();
38
        return examNode.is_open == BoolState.NO;
39
    }
40
41
42
}

+ 9 - 9
oa-app/src/main/java/com/css/oa/exam/node/service/impl/NodeServiceImpl.java

1
package com.css.oa.exam.node.service.impl;
1
package com.css.oa.exam.node.service.impl;
2
2
3
import com.css.oa.exam.base.BaseService;
3
import com.css.oa.exam.base.BaseService;
4
import com.css.oa.exam.node.repository.entity.Node;
5
import com.css.oa.exam.node.repository.INodeRepository;
6
import com.css.oa.exam.node.service.NodeService;
4
import com.css.oa.exam.node.repository.entity.ExamNode;
5
import com.css.oa.exam.node.repository.ExamNodeRepository;
6
import com.css.oa.exam.node.service.ExamNodeService;
7
import com.css.oa.exam.util.CopyObjTool;
7
import com.css.oa.exam.util.CopyObjTool;
8
import com.css.oa.utils.UUIDGenerator;
8
import com.css.oa.utils.UUIDGenerator;
9
import lombok.extern.slf4j.Slf4j;
9
import lombok.extern.slf4j.Slf4j;
14
14
15
@Slf4j
15
@Slf4j
16
@Service
16
@Service
17
public class NodeServiceImpl extends BaseService implements NodeService {
17
public class ExamNodeServiceImpl extends BaseService implements ExamNodeService {
18
18
19
    @Autowired
19
    @Autowired
20
    INodeRepository repository;
20
    ExamNodeRepository repository;
21
21
22
    @Override
22
    @Override
23
    public void add(Node obj) {
23
    public void add(ExamNode obj) {
24
        System.out.println("传入的obj => " + obj.toString());
24
        System.out.println("传入的obj => " + obj.toString());
25
        String id = UUIDGenerator.getUUID();
25
        String id = UUIDGenerator.getUUID();
26
        obj.setUuid(id);
26
        obj.setUuid(id);
37
    @Override
37
    @Override
38
    public Map queryAll() {
38
    public Map queryAll() {
39
        Long count = repository.count();
39
        Long count = repository.count();
40
        List<Node> list = repository.findAll();
40
        List<ExamNode> list = repository.findAll();
41
        Map map = new LinkedHashMap();
41
        Map map = new LinkedHashMap();
42
        map.put("total", count);
42
        map.put("total", count);
43
        map.put("list", list);
43
        map.put("list", list);
45
    }
45
    }
46
46
47
    @Override
47
    @Override
48
    public void update(Node obj) {
48
    public void update(ExamNode obj) {
49
        if(obj.getUpdate_time() == null){
49
        if(obj.getUpdate_time() == null){
50
            Date newDate = new Date();
50
            Date newDate = new Date();
51
            obj.setUpdate_time(newDate);
51
            obj.setUpdate_time(newDate);
52
        }
52
        }
53
        Node old  = repository.findById(obj.getUuid()).get();
53
        ExamNode old  = repository.findById(obj.getUuid()).get();
54
        CopyObjTool.copyProperties(old, obj);
54
        CopyObjTool.copyProperties(old, obj);
55
        repository.save(obj);
55
        repository.save(obj);
56
    }
56
    }

+ 0 - 42
oa-app/src/main/java/com/css/oa/exam/node/service/impl/NodeQueryService.java

1
package com.css.oa.exam.node.service.impl;
2
3
import com.css.oa.exam.constants.BoolState;
4
import com.css.oa.exam.node.viewobjects.NodeType;
5
import com.css.oa.exam.node.repository.INodeRepository;
6
import com.css.oa.exam.node.repository.entity.Node;
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.stereotype.Service;
9
10
@Service
11
public class NodeQueryService implements NodeType {
12
13
    @Autowired
14
    INodeRepository repository;
15
16
    public boolean enrollIsClose() {
17
        Node node = repository.findById(ENROLL).get();
18
        return node.is_open == BoolState.NO;
19
    }
20
21
    public boolean payIsClose() {
22
        Node node = repository.findById(PAY).get();
23
        return node.is_open == BoolState.NO;
24
    }
25
26
    public boolean printAdmissionIsClose() {
27
        Node node = repository.findById(PRINT_ADMISSION).get();
28
        return node.is_open == BoolState.NO;
29
    }
30
31
    public boolean joinExamIsClose() {
32
        Node node = repository.findById(JOIN_EXAM).get();
33
        return node.is_open == BoolState.NO;
34
    }
35
36
    public boolean queryScoreIsClose() {
37
        Node node = repository.findById(QUERY_SCORE).get();
38
        return node.is_open == BoolState.NO;
39
    }
40
41
42
}

+ 3 - 3
oa-app/src/main/java/com/css/oa/exam/score/service/impl/ScoreServiceImpl.java

21
import com.css.oa.exam.constants.ExportDTO;
21
import com.css.oa.exam.constants.ExportDTO;
22
import com.css.oa.exam.exam.repository.entity.Exam;
22
import com.css.oa.exam.exam.repository.entity.Exam;
23
import com.css.oa.exam.exam.repository.IExamRepository;
23
import com.css.oa.exam.exam.repository.IExamRepository;
24
import com.css.oa.exam.node.service.impl.NodeQueryService;
24
import com.css.oa.exam.node.service.impl.ExamNodeQueryService;
25
import com.css.oa.exam.score.service.ScoreService;
25
import com.css.oa.exam.score.service.ScoreService;
26
import com.css.oa.exam.score.viewobjects.*;
26
import com.css.oa.exam.score.viewobjects.*;
27
import com.css.oa.exam.score.repository.IScoreRepository;
27
import com.css.oa.exam.score.repository.IScoreRepository;
379
    }
379
    }
380
380
381
    @Autowired
381
    @Autowired
382
    NodeQueryService nodeQueryService;
382
    ExamNodeQueryService examNodeQueryService;
383
383
384
    public Map myScore(String student_id) {
384
    public Map myScore(String student_id) {
385
        if(nodeQueryService.queryScoreIsClose()){
385
        if(examNodeQueryService.queryScoreIsClose()){
386
            List<MyAdmWrap> wraps = new ArrayList<>();
386
            List<MyAdmWrap> wraps = new ArrayList<>();
387
            Map map = new LinkedHashMap();
387
            Map map = new LinkedHashMap();
388
            map.put("total", 0);
388
            map.put("total", 0);