zhuhaiwen 3 gadi atpakaļ
vecāks
revīzija
cf376b62fb

+ 34 - 0
oa-app/src/main/java/com/css/oa/exam/place/bean/DropdownVerifyState.java

@ -0,0 +1,34 @@
1
package com.css.oa.exam.place.bean;
2
3
import java.util.*;
4
5
public class DropdownVerifyState {
6
7
    private static DropdownVerifyState states;
8
9
    private static LinkedList list;
10
11
    public static String WAIT = "待提交";
12
    public static String ING = "审核中";
13
    public static String ED = "审核通过";
14
15
    public DropdownVerifyState() {
16
        //待提交、审核中、审核通过
17
        list = new LinkedList();
18
        list.add(WAIT);
19
        list.add(ING);
20
        list.add(ED);
21
    }
22
23
    public static DropdownVerifyState getInstance() {
24
        if (states == null) {
25
            states = new DropdownVerifyState();
26
        }
27
        return states;
28
    }
29
30
    public List getData() {
31
        return list;
32
    }
33
34
}

+ 0 - 58
oa-app/src/main/java/com/css/oa/exam/place/bean/a.json

@ -1,58 +0,0 @@
1
2
3
{
4
  "total": 3,
5
  "list":[
6
    {
7
      "year": 2021,
8
      "list": [
9
        {
10
          "exam_name": "上半年考试",
11
          "list": [
12
            {},{},{}
13
          ]
14
        },
15
        {
16
          "exam_name": "下半年考试",
17
          "list": [
18
            {},{},{}
19
          ]
20
        }
21
      ]
22
    },
23
    {
24
      "year": 2020,
25
      "list": [
26
        {
27
          "exam_name": "上半年考试",
28
          "list": [
29
            {},{},{}
30
          ]
31
        },
32
        {
33
          "exam_name": "下半年考试",
34
          "list": [
35
            {},{},{}
36
          ]
37
        }
38
      ]
39
    },
40
    {
41
      "year": 2019,
42
      "list": [
43
        {
44
          "exam_name": "上半年考试",
45
          "list": [
46
            {},{},{}
47
          ]
48
        },
49
        {
50
          "exam_name": "下半年考试",
51
          "list": [
52
            {},{},{}
53
          ]
54
        }
55
      ]
56
    }
57
  ]
58
}

+ 20 - 5
oa-app/src/main/java/com/css/oa/exam/place/controller/PlaceController.java

@ -1,10 +1,7 @@
1 1
package com.css.oa.exam.place.controller;
2 2
3 3
import com.css.oa.exam.base.BaseController;
4
import com.css.oa.exam.place.bean.PlaceDuplicateBean;
5
import com.css.oa.exam.place.bean.PlaceQueryReq;
6
import com.css.oa.exam.place.bean.PlaceResultWrap;
7
import com.css.oa.exam.place.bean.VerifyReq;
4
import com.css.oa.exam.place.bean.*;
8 5
import com.css.oa.exam.place.repository.Place;
9 6
import com.css.oa.exam.place.service.PlaceService;
10 7
import com.css.oa.utils.Result;
@ -14,6 +11,8 @@ import org.apache.http.util.TextUtils;
14 11
import org.springframework.beans.factory.annotation.Autowired;
15 12
import org.springframework.web.bind.annotation.*;
16 13
14
import java.util.ArrayList;
15
import java.util.HashMap;
17 16
import java.util.List;
18 17
import java.util.Map;
19 18
@ -36,8 +35,10 @@ public class PlaceController extends BaseController {
36 35
    public Result add(@RequestBody Place place) {
37 36
        Result<Map> result;
38 37
        try {
38
            String token = getToken();
39
            mService.setToken(token);
39 40
            if (TextUtils.isEmpty(place.getUnit())) {
40
                return setErr("unit参数不能为空(当前用户所属机构名称)");
41
                return setErr("unit参数不能为空");
41 42
            }
42 43
            mService.add(place);
43 44
            result = setResult();
@ -182,4 +183,18 @@ public class PlaceController extends BaseController {
182 183
        return result;
183 184
    }
184 185
186
    @ApiOperation(value = "年份-考试-考点")
187
    @GetMapping("/dropdownState")
188
    public Result dropdownState() {
189
        Result<Map> result;
190
        try {
191
            List data = DropdownVerifyState.getInstance().getData();
192
            result = setResult("verifyState", data);
193
        } catch (Exception e) {
194
            result = setErr();
195
            e.printStackTrace();
196
        }
197
        return result;
198
    }
199
185 200
}

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

@ -24,6 +24,12 @@ public class Place implements Serializable, Cloneable {
24 24
    @Column(name = "PLACE_CODE")
25 25
    public String place_code;
26 26
27
    @Column(name = "QUEUE")
28
    public String queue;
29
30
    @Column(name = "CURR_ID")
31
    public String curr_id;
32
27 33
    @Column(name = "ROOM_COUNT")
28 34
    public int room_count;
29 35

+ 45 - 1
oa-app/src/main/java/com/css/oa/exam/place/service/PlaceService.java

@ -1,5 +1,8 @@
1 1
package com.css.oa.exam.place.service;
2 2
3
import com.css.oa.exam.admin.bean.Admin;
4
import com.css.oa.exam.admin.repository.IUnitRepository;
5
import com.css.oa.exam.admin.repository.Unit;
3 6
import com.css.oa.exam.base.BaseService;
4 7
import com.css.oa.exam.exam.repository.Exam;
5 8
import com.css.oa.exam.exam.repository.IExamRepository;
@ -46,7 +49,7 @@ public class PlaceService extends BaseService implements IPlaceService {
46 49
        return map;
47 50
    }
48 51
49
    private Specification getSpec(PlaceQueryReq.Condition condition){
52
    private Specification getSpec(PlaceQueryReq.Condition condition) {
50 53
        Specification<Place> spec = new Specification<Place>() {
51 54
            @Override
52 55
            public Predicate toPredicate(Root<Place> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
@ -159,9 +162,49 @@ public class PlaceService extends BaseService implements IPlaceService {
159 162
        return list;
160 163
    }
161 164
165
    @Autowired
166
    IUnitRepository unitRepository;
167
168
    private ArrayList<String> getArr(Unit unit) {
169
        ArrayList list = new ArrayList();
170
        list.add(unit.uuid);
171
        String p_id = unit.getP_id();
172
        while (!TextUtils.isEmpty(p_id)) {
173
            List<Unit> unitList = unitRepository.getUnitBy(p_id);
174
            if (unitList.size() > 0) {
175
                Unit pUnit = unitList.get(0);
176
                list.add(pUnit.uuid);
177
                list.addAll(getArr(pUnit));
178
            }
179
        }
180
        return list;
181
    }
182
183
    private void setQue(Place place) {
184
        String adminUnitId = Admin.getAdminUnitId(token);
185
        List<Unit> unitList = unitRepository.getUnitBy(adminUnitId);
186
        if (unitList.size() > 0) {
187
            Unit unit = unitList.get(0);
188
            place.setCurr_id(unit.uuid);
189
            ArrayList<String> list = getArr(unit);
190
            String que = "";
191
            for (int i = 0; i < list.size(); i++) {
192
                String id  = list.get(i);
193
                if(i == 0){
194
                    que = que + id;
195
                }else {
196
                    que = que + "," + id;
197
                }
198
            }
199
            place.setQueue(que);
200
        }
201
202
    }
203
162 204
    @Override
163 205
    public void add(Place place) {
164 206
        log.info("examPlace => " + place.toString());
207
165 208
        if (place.getUuid() == null) {
166 209
            String id = UUIDGenerator.getUUID();
167 210
            place.setUuid(id);
@ -179,6 +222,7 @@ public class PlaceService extends BaseService implements IPlaceService {
179 222
        if (TextUtils.isEmpty(place.getUpdate_user()) || place.getCreate_user().equalsIgnoreCase("null")) {
180 223
            place.setUpdate_user("无管理员");
181 224
        }
225
        setQue(place);
182 226
        repository.save(place);
183 227
    }
184 228