浏览代码

place半途

zhuhaiwen 3 年之前
父节点
当前提交
dfc304ccec

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

@ -21,4 +21,9 @@ public interface IUnitRepository extends JpaRepository<Unit, String>, JpaSpecifi
21 21
    @Query(nativeQuery = true, value = "select * from OP_EXAM_UNIT where UUID = :unit_id")
22 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,14 +14,11 @@ public class PlaceQueryReq {
14 14
    //包含exam_id、考点名称、维护单位、区域、状态
15 15
    public class Condition {
16 16
        public String exam_id;
17
17 18
        public String place_name;
18 19
        public String unit;
19 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,11 +33,11 @@ public class PlaceController extends BaseController {
33 33
    public Result add(@RequestBody Place place) {
34 34
        Result<Map> result;
35 35
        try {
36
            String token = getToken();
37
            mService.setToken(token);
38 36
            if (TextUtils.isEmpty(place.getUnit())) {
39 37
                return setErr("unit参数不能为空");
40 38
            }
39
            String token = getToken();
40
            mService.setToken(token);
41 41
            mService.add(place);
42 42
            result = setResult();
43 43
        } catch (Exception e) {
@ -66,11 +66,11 @@ public class PlaceController extends BaseController {
66 66
    public Result update(@RequestBody Place newPlace) {
67 67
        Result<Map> result;
68 68
        try {
69
            String token = getToken();
70
            mService.setToken(token);
71 69
            if (TextUtils.isEmpty(newPlace.getUuid())) {
72 70
                return setErr("uuid参数不能为空");
73 71
            }
72
            String token = getToken();
73
            mService.setToken(token);
74 74
            mService.update(newPlace);
75 75
            result = setResult();
76 76
        } catch (Exception e) {
@ -80,7 +80,7 @@ public class PlaceController extends BaseController {
80 80
        return result;
81 81
    }
82 82
83
    @ApiOperation(value = "考点管理-查询")
83
    @ApiOperation(value = "无条件查询")
84 84
    @PostMapping("/queryByExamId")
85 85
    public Result queryByExamId(@RequestBody PlaceQueryReq req) {
86 86
        //1,根据考试id查询考点
@ -89,6 +89,8 @@ public class PlaceController extends BaseController {
89 89
            if (req.condition.exam_id == null || req.condition.exam_id.equals("")) {
90 90
                return setErr("exam_id不能为空");
91 91
            }
92
            String token = getToken();
93
            mService.setToken(token);
92 94
            Map obj = mService.query(req);
93 95
            result = setResult("places", obj);
94 96
        } catch (Exception e) {
@ -107,6 +109,8 @@ public class PlaceController extends BaseController {
107 109
            if (req == null) {
108 110
                return setErr("请求参数格式错误");
109 111
            }
112
            String token = getToken();
113
            mService.setToken(token);
110 114
            Map obj = mService.query(req);
111 115
            result = setResult("places", obj);
112 116
        } catch (Exception e) {
@ -139,11 +143,11 @@ public class PlaceController extends BaseController {
139 143
    public Result verifyOne(@RequestBody VerifyOneReq req) {
140 144
        Result<Map> result;
141 145
        try {
142
            String token = getToken();
143
            mService.setToken(token);
144 146
            if (TextUtils.isEmpty(req.uuid)) {
145 147
                return setErr("uuid参数不能为空");
146 148
            }
149
            String token = getToken();
150
            mService.setToken(token);
147 151
            mService.verifyOne(req.uuid, req.suggest);
148 152
            result = setResult();
149 153
        } catch (Exception e) {
@ -158,6 +162,8 @@ public class PlaceController extends BaseController {
158 162
    public Result batchVerify(@RequestBody List<String> ids) {
159 163
        Result<Map> result;
160 164
        try {
165
            String token = getToken();
166
            mService.setToken(token);
161 167
            mService.batchVerify(ids);
162 168
            result = setResult();
163 169
        } catch (Exception e) {

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

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

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

@ -6,6 +6,7 @@ import com.css.oa.exam.admin.repository.Unit;
6 6
import com.css.oa.exam.base.BaseService;
7 7
import com.css.oa.exam.exam.repository.Exam;
8 8
import com.css.oa.exam.exam.repository.IExamRepository;
9
import com.css.oa.exam.place.bean.DropdownVerifyState;
9 10
import com.css.oa.exam.place.bean.PlaceDuplicateBean;
10 11
import com.css.oa.exam.place.bean.PlaceQueryReq;
11 12
import com.css.oa.exam.place.bean.PlaceResultWrap;
@ -23,6 +24,8 @@ import org.springframework.data.jpa.domain.Specification;
23 24
import org.springframework.stereotype.Service;
24 25
25 26
import javax.persistence.criteria.*;
27
import javax.persistence.metamodel.Attribute;
28
import javax.persistence.metamodel.EntityType;
26 29
import java.util.*;
27 30
28 31
@Slf4j
@ -55,11 +58,18 @@ public class PlaceService extends BaseService implements IPlaceService {
55 58
            public Predicate toPredicate(Root<Place> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
56 59
                List<Predicate> predicateList = new ArrayList<>();
57 60
                if (condition != null) {
58
                    //0.
61
                    //0.所属考试
59 62
                    String exam_id = condition.exam_id;
60 63
                    if (!TextUtils.isEmpty(exam_id)) {
61 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 73
                    //1,考点名
64 74
                    String place_name = condition.place_name;
65 75
                    if (!TextUtils.isEmpty(place_name)) {
@ -76,14 +86,27 @@ public class PlaceService extends BaseService implements IPlaceService {
76 86
                    if (!TextUtils.isEmpty(area)) {
77 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 110
                    List<String> sonNames = condition.sonNames;
88 111
                    String myName = condition.myName;
89 112
                    if (sonNames == null || sonNames.size() == 0) {
@ -145,7 +168,7 @@ public class PlaceService extends BaseService implements IPlaceService {
145 168
                            Predicate or = criteriaBuilder.or(isMe, totalSon);
146 169
                            predicateList.add(or);
147 170
                        }
148
                    }
171
                    }*/
149 172
                }
150 173
                Predicate[] pre = new Predicate[predicateList.size()];
151 174
                pre = predicateList.toArray(pre);

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

@ -65,10 +65,10 @@ public class RoomController extends BaseController {
65 65
            if(TextUtils.isEmpty(req.uuid)){
66 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 72
            result = setResult();
73 73
        } catch (Exception e) {
74 74
            result = setErr(e.getMessage());