Browse Source

place半途

zhuhaiwen 3 years ago
parent
commit
dfc304ccec

+ 5 - 0
oa-app/src/main/java/com/css/oa/exam/admin/repository/IUnitRepository.java

21
    @Query(nativeQuery = true, value = "select * from OP_EXAM_UNIT where UUID = :unit_id")
21
    @Query(nativeQuery = true, value = "select * from OP_EXAM_UNIT where UUID = :unit_id")
22
    List<Unit> getUnitBy(@Param("unit_id") String unit_id);
22
    List<Unit> getUnitBy(@Param("unit_id") String unit_id);
23
23
24
    @Modifying
25
    @Transactional
26
    @Query(nativeQuery = true, value = "select * from OP_EXAM_UNIT where P_ID = -1")
27
    List<Unit> getTop();
28
24
}
29
}

+ 2 - 5
oa-app/src/main/java/com/css/oa/exam/place/bean/PlaceQueryReq.java

14
    //包含exam_id、考点名称、维护单位、区域、状态
14
    //包含exam_id、考点名称、维护单位、区域、状态
15
    public class Condition {
15
    public class Condition {
16
        public String exam_id;
16
        public String exam_id;
17
17
        public String place_name;
18
        public String place_name;
18
        public String unit;
19
        public String unit;
19
        public String area;
20
        public String area;
20
        public String state;
21
22
        public String fatherName;
23
        public String myName;
24
        public ArrayList<String> sonNames = new ArrayList<>();
21
        public String verify_state;
25
22
26
    }
23
    }
27
24

+ 13 - 7
oa-app/src/main/java/com/css/oa/exam/place/controller/PlaceController.java

33
    public Result add(@RequestBody Place place) {
33
    public Result add(@RequestBody Place place) {
34
        Result<Map> result;
34
        Result<Map> result;
35
        try {
35
        try {
36
            String token = getToken();
37
            mService.setToken(token);
38
            if (TextUtils.isEmpty(place.getUnit())) {
36
            if (TextUtils.isEmpty(place.getUnit())) {
39
                return setErr("unit参数不能为空");
37
                return setErr("unit参数不能为空");
40
            }
38
            }
39
            String token = getToken();
40
            mService.setToken(token);
41
            mService.add(place);
41
            mService.add(place);
42
            result = setResult();
42
            result = setResult();
43
        } catch (Exception e) {
43
        } catch (Exception e) {
66
    public Result update(@RequestBody Place newPlace) {
66
    public Result update(@RequestBody Place newPlace) {
67
        Result<Map> result;
67
        Result<Map> result;
68
        try {
68
        try {
69
            String token = getToken();
70
            mService.setToken(token);
71
            if (TextUtils.isEmpty(newPlace.getUuid())) {
69
            if (TextUtils.isEmpty(newPlace.getUuid())) {
72
                return setErr("uuid参数不能为空");
70
                return setErr("uuid参数不能为空");
73
            }
71
            }
72
            String token = getToken();
73
            mService.setToken(token);
74
            mService.update(newPlace);
74
            mService.update(newPlace);
75
            result = setResult();
75
            result = setResult();
76
        } catch (Exception e) {
76
        } catch (Exception e) {
80
        return result;
80
        return result;
81
    }
81
    }
82
82
83
    @ApiOperation(value = "考点管理-查询")
83
    @ApiOperation(value = "无条件查询")
84
    @PostMapping("/queryByExamId")
84
    @PostMapping("/queryByExamId")
85
    public Result queryByExamId(@RequestBody PlaceQueryReq req) {
85
    public Result queryByExamId(@RequestBody PlaceQueryReq req) {
86
        //1,根据考试id查询考点
86
        //1,根据考试id查询考点
89
            if (req.condition.exam_id == null || req.condition.exam_id.equals("")) {
89
            if (req.condition.exam_id == null || req.condition.exam_id.equals("")) {
90
                return setErr("exam_id不能为空");
90
                return setErr("exam_id不能为空");
91
            }
91
            }
92
            String token = getToken();
93
            mService.setToken(token);
92
            Map obj = mService.query(req);
94
            Map obj = mService.query(req);
93
            result = setResult("places", obj);
95
            result = setResult("places", obj);
94
        } catch (Exception e) {
96
        } catch (Exception e) {
107
            if (req == null) {
109
            if (req == null) {
108
                return setErr("请求参数格式错误");
110
                return setErr("请求参数格式错误");
109
            }
111
            }
112
            String token = getToken();
113
            mService.setToken(token);
110
            Map obj = mService.query(req);
114
            Map obj = mService.query(req);
111
            result = setResult("places", obj);
115
            result = setResult("places", obj);
112
        } catch (Exception e) {
116
        } catch (Exception e) {
139
    public Result verifyOne(@RequestBody VerifyOneReq req) {
143
    public Result verifyOne(@RequestBody VerifyOneReq req) {
140
        Result<Map> result;
144
        Result<Map> result;
141
        try {
145
        try {
142
            String token = getToken();
143
            mService.setToken(token);
144
            if (TextUtils.isEmpty(req.uuid)) {
146
            if (TextUtils.isEmpty(req.uuid)) {
145
                return setErr("uuid参数不能为空");
147
                return setErr("uuid参数不能为空");
146
            }
148
            }
149
            String token = getToken();
150
            mService.setToken(token);
147
            mService.verifyOne(req.uuid, req.suggest);
151
            mService.verifyOne(req.uuid, req.suggest);
148
            result = setResult();
152
            result = setResult();
149
        } catch (Exception e) {
153
        } catch (Exception e) {
158
    public Result batchVerify(@RequestBody List<String> ids) {
162
    public Result batchVerify(@RequestBody List<String> ids) {
159
        Result<Map> result;
163
        Result<Map> result;
160
        try {
164
        try {
165
            String token = getToken();
166
            mService.setToken(token);
161
            mService.batchVerify(ids);
167
            mService.batchVerify(ids);
162
            result = setResult();
168
            result = setResult();
163
        } catch (Exception e) {
169
        } catch (Exception e) {

+ 2 - 2
oa-app/src/main/java/com/css/oa/exam/place/repository/Place.java

9
9
10
@Data
10
@Data
11
@Entity
11
@Entity
12
@Table(name = "ATT_EXAM_PLACE")
12
@Table(name = "OP_EXAM_PLACE")
13
public class Place implements Serializable, Cloneable {
13
public class Place implements Serializable, Cloneable {
14
14
15
    public static final long serialVersionUID = -2982710232836091001L;
15
    public static final long serialVersionUID = -2982710232836091001L;
25
    public String place_code;
25
    public String place_code;
26
26
27
    @Column(name = "QUEUE")
27
    @Column(name = "QUEUE")
28
    public String queue;
28
    public String queue;// 1,2,3,4
29
29
30
    @Column(name = "CURR_ID")
30
    @Column(name = "CURR_ID")
31
    public String curr_id;
31
    public String curr_id;

+ 32 - 9
oa-app/src/main/java/com/css/oa/exam/place/service/PlaceService.java

6
import com.css.oa.exam.base.BaseService;
6
import com.css.oa.exam.base.BaseService;
7
import com.css.oa.exam.exam.repository.Exam;
7
import com.css.oa.exam.exam.repository.Exam;
8
import com.css.oa.exam.exam.repository.IExamRepository;
8
import com.css.oa.exam.exam.repository.IExamRepository;
9
import com.css.oa.exam.place.bean.DropdownVerifyState;
9
import com.css.oa.exam.place.bean.PlaceDuplicateBean;
10
import com.css.oa.exam.place.bean.PlaceDuplicateBean;
10
import com.css.oa.exam.place.bean.PlaceQueryReq;
11
import com.css.oa.exam.place.bean.PlaceQueryReq;
11
import com.css.oa.exam.place.bean.PlaceResultWrap;
12
import com.css.oa.exam.place.bean.PlaceResultWrap;
23
import org.springframework.stereotype.Service;
24
import org.springframework.stereotype.Service;
24
25
25
import javax.persistence.criteria.*;
26
import javax.persistence.criteria.*;
27
import javax.persistence.metamodel.Attribute;
28
import javax.persistence.metamodel.EntityType;
26
import java.util.*;
29
import java.util.*;
27
30
28
@Slf4j
31
@Slf4j
55
            public Predicate toPredicate(Root<Place> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
58
            public Predicate toPredicate(Root<Place> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
56
                List<Predicate> predicateList = new ArrayList<>();
59
                List<Predicate> predicateList = new ArrayList<>();
57
                if (condition != null) {
60
                if (condition != null) {
58
                    //0.
61
                    //0.所属考试
59
                    String exam_id = condition.exam_id;
62
                    String exam_id = condition.exam_id;
60
                    if (!TextUtils.isEmpty(exam_id)) {
63
                    if (!TextUtils.isEmpty(exam_id)) {
61
                        predicateList.add(criteriaBuilder.equal(root.get("exam_id").as(String.class), exam_id));
64
                        predicateList.add(criteriaBuilder.equal(root.get("exam_id").as(String.class), exam_id));
62
                    }
65
                    }
66
                    //我创建的、我的下级提交的
67
                    Admin admin = Admin.getAdminByToken(token);
68
                    if (!TextUtils.isEmpty(admin.my_unit_id)) {
69
                        String pattern = "%" + admin.my_unit_id + "%";
70
                        Predicate inQueue = criteriaBuilder.like(root.get("queue").as(String.class), pattern);
71
                        predicateList.add(inQueue);//包含 包含条件
72
                    }
63
                    //1,考点名
73
                    //1,考点名
64
                    String place_name = condition.place_name;
74
                    String place_name = condition.place_name;
65
                    if (!TextUtils.isEmpty(place_name)) {
75
                    if (!TextUtils.isEmpty(place_name)) {
76
                    if (!TextUtils.isEmpty(area)) {
86
                    if (!TextUtils.isEmpty(area)) {
77
                        predicateList.add(criteriaBuilder.equal(root.get("area").as(String.class), area));
87
                        predicateList.add(criteriaBuilder.equal(root.get("area").as(String.class), area));
78
                    }
88
                    }
79
                    //4.状态
80
                    String state = condition.state;
81
                    if (!TextUtils.isEmpty(state)) {
82
                        int stateInt = Integer.parseInt(state);
83
                        predicateList.add(criteriaBuilder.equal(root.get("state").as(Integer.class), stateInt));
89
                    //4.审核状态
90
                    String verify_state = condition.verify_state;
91
                    if(verify_state.equalsIgnoreCase(DropdownVerifyState.WAIT)){
92
                        //待提交
93
                        predicateList.add(criteriaBuilder.equal(root.get("curr_id").as(String.class), admin.my_unit_id));
94
                    }else if(verify_state.equalsIgnoreCase(DropdownVerifyState.ING)){
95
                        //上级审核中
96
                        Expression<String> queue = root.get("queue").as(String.class);
97
                        EntityType<Place> model = root.getModel();
98
                        //Attribute<Place> queue1 = model.getAttribute("queue");
99
                        //root.join()
100
                        //Path<Place> queue1 = root.get("queue");
101
102
                    }else if(verify_state.equalsIgnoreCase(DropdownVerifyState.ED)){
103
                        //审核通过
104
                        List<Unit> top = unitRepository.getTop();
105
                        if(top != null && top.size() > 0){
106
                            predicateList.add(criteriaBuilder.equal(root.get("curr_id").as(String.class), top.get(0).getUuid()));
107
                        }
84
                    }
108
                    }
85
86
                    //进入考点管理页面默认的筛选
109
                    /*//进入考点管理页面默认的筛选
87
                    List<String> sonNames = condition.sonNames;
110
                    List<String> sonNames = condition.sonNames;
88
                    String myName = condition.myName;
111
                    String myName = condition.myName;
89
                    if (sonNames == null || sonNames.size() == 0) {
112
                    if (sonNames == null || sonNames.size() == 0) {
145
                            Predicate or = criteriaBuilder.or(isMe, totalSon);
168
                            Predicate or = criteriaBuilder.or(isMe, totalSon);
146
                            predicateList.add(or);
169
                            predicateList.add(or);
147
                        }
170
                        }
148
                    }
171
                    }*/
149
                }
172
                }
150
                Predicate[] pre = new Predicate[predicateList.size()];
173
                Predicate[] pre = new Predicate[predicateList.size()];
151
                pre = predicateList.toArray(pre);
174
                pre = predicateList.toArray(pre);

+ 4 - 4
oa-app/src/main/java/com/css/oa/exam/room/controller/RoomController.java

65
            if(TextUtils.isEmpty(req.uuid)){
65
            if(TextUtils.isEmpty(req.uuid)){
66
                return setErr("uuid参数不能为空");
66
                return setErr("uuid参数不能为空");
67
            }
67
            }
68
            if(req.state == 0){
69
                return setErr("state参数不能为空或不能为0");
70
            }
71
            mService.verify(req.uuid, req.state, req.suggest);
68
//            if(req.state == 0){
69
//                return setErr("state参数不能为空或不能为0");
70
//            }
71
//            mService.verify(req.uuid, req.state, req.suggest);
72
            result = setResult();
72
            result = setResult();
73
        } catch (Exception e) {
73
        } catch (Exception e) {
74
            result = setErr(e.getMessage());
74
            result = setErr(e.getMessage());