Explorar el Código

报名管理排序

zhuhaiwen %!s(int64=3) %!d(string=hace) años
padre
commit
46d20c1819

+ 32 - 0
oa-app/src/main/java/com/css/oa/exam/common/controller/CommonController.java

@ -0,0 +1,32 @@
1
package com.css.oa.exam.common.controller;
2
3
import com.css.oa.exam.base.BaseController;
4
import com.css.oa.exam.constants.MyOrder;
5
import com.css.oa.utils.Result;
6
import io.swagger.annotations.Api;
7
import io.swagger.annotations.ApiOperation;
8
import lombok.extern.slf4j.Slf4j;
9
import org.springframework.web.bind.annotation.*;
10
11
import java.util.Map;
12
13
@Slf4j
14
@Api(tags = {"获取考试中公共参数"})
15
@RestController
16
@RequestMapping("/common")
17
public class CommonController extends BaseController {
18
19
    @ApiOperation(value = "排序所用的键值")
20
    @GetMapping("/orderKey")
21
    public Result orderKey() {
22
        Result<Map> result;
23
        try {
24
            result = setResult("res", MyOrder.arr);
25
        } catch (Exception e) {
26
            result = setErr(e.toString());
27
            e.printStackTrace();
28
        }
29
        return result;
30
    }
31
32
}

+ 13 - 0
oa-app/src/main/java/com/css/oa/exam/constants/MyOrder.java

@ -0,0 +1,13 @@
1
package com.css.oa.exam.constants;
2
3
public class MyOrder {
4
5
    public static String[] arr = {"gender", "verify_state", "pay_state"};
6
    //        性别: 男、女
7
//        审核状态 :审核通过、审核中、未审核
8
//        缴费状态:已经缴费、未缴费
9
    public static String gender = arr[0];
10
    public static String verify_state = arr[1];
11
    public static String pay_state = arr[2];
12
13
}

+ 3 - 0
oa-app/src/main/java/com/css/oa/exam/enroll/bean/Condition.java

@ -1,6 +1,7 @@
1 1
package com.css.oa.exam.enroll.bean;
2 2
3 3
import com.css.oa.exam.constants.BoolState;
4
import com.css.oa.exam.constants.MyOrder;
4 5
5 6
import java.util.ArrayList;
6 7
import java.util.List;
@ -21,4 +22,6 @@ public class Condition {
21 22
22 23
    public List<String> studentIds = new ArrayList<>();
23 24
25
    public String orderKey = ""; //gender verify_state pay_state
26
24 27
}

+ 58 - 5
oa-app/src/main/java/com/css/oa/exam/enroll/service/EnrollService.java

@ -5,15 +5,12 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
5 5
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
6 6
import com.css.oa.exam.admin.bean.Admin;
7 7
import com.css.oa.exam.base.BaseVerifyService;
8
import com.css.oa.exam.constants.BoolState;
9
import com.css.oa.exam.constants.ExamConfig;
10
import com.css.oa.exam.constants.VerifyState;
8
import com.css.oa.exam.constants.*;
11 9
import com.css.oa.exam.enroll.bean.*;
12 10
import com.css.oa.exam.enroll.repository.*;
13 11
import com.css.oa.exam.exam.repository.Exam;
14 12
import com.css.oa.exam.exam.repository.IExamRepository;
15 13
import com.css.oa.exam.place.bean.DropdownVerifyState;
16
import com.css.oa.exam.constants.ExportDTO;
17 14
import com.css.oa.exam.place.repository.IPlaceRepository;
18 15
import com.css.oa.exam.place.repository.Place;
19 16
import com.css.oa.exam.score.repository.IScoreRepository;
@ -310,6 +307,61 @@ public class EnrollService extends BaseVerifyService implements IEnrollService {
310 307
        }
311 308
    }
312 309
310
    private void groupBy(List<Enroll> list, String orderKey) {
311
//        性别: 男、女
312
//        审核状态 :审核通过、审核中、未审核
313
//        缴费状态:已经缴费、未缴费
314
        if (orderKey.equalsIgnoreCase(MyOrder.gender)) {
315
            LinkedList<Enroll> man = new LinkedList();
316
            LinkedList<Enroll> women = new LinkedList();
317
            for (Enroll enroll : list) {
318
                if(enroll.getGender() == 1){
319
                    man.add(enroll);
320
                }else {
321
                    women.add(enroll);
322
                }
323
            }
324
            list.clear();
325
            list.addAll(man);
326
            list.addAll(women);
327
        } else if (orderKey.equalsIgnoreCase(MyOrder.verify_state)) {
328
            LinkedList<Enroll> ed = new LinkedList();
329
            LinkedList<Enroll> ing = new LinkedList();
330
            LinkedList<Enroll> no = new LinkedList();
331
            LinkedList<Enroll> reject = new LinkedList();
332
            for (Enroll enroll : list) {
333
                if(enroll.getVerify_state().equalsIgnoreCase(VerifyState.LEVEL1_GREE)){
334
                    ed.add(enroll);
335
                }else if(enroll.getVerify_state().equalsIgnoreCase(VerifyState.WAIT_COMMITE)){
336
                    no.add(enroll);
337
                }else if(enroll.getVerify_state().equalsIgnoreCase(VerifyState.REJECT)){
338
                    reject.add(enroll);
339
                }else {
340
                    //待xx单位审核
341
                    ing.add(enroll);
342
                }
343
            }
344
            list.clear();
345
            list.addAll(ed);
346
            list.addAll(ing);
347
            list.addAll(no);
348
            list.addAll(reject);
349
        } else if (orderKey.equalsIgnoreCase(MyOrder.pay_state)) {
350
            LinkedList<Enroll> yes = new LinkedList();
351
            LinkedList<Enroll> no = new LinkedList();
352
            for (Enroll enroll : list) {
353
                if(enroll.getPay_state() == 1){
354
                    yes.add(enroll);
355
                }else {
356
                    no.add(enroll);
357
                }
358
            }
359
            list.clear();
360
            list.addAll(yes);
361
            list.addAll(no);
362
        }
363
    }
364
313 365
    @Autowired
314 366
    IPlaceRepository placeRepository;
315 367
@ -331,6 +383,7 @@ public class EnrollService extends BaseVerifyService implements IEnrollService {
331 383
        Page<Enroll> pages = repository.findAll(spec, pageReques);
332 384
        List<Enroll> enrollList = pages.getContent();
333 385
        setProperties(enrollList);
386
        groupBy(enrollList, req.condition.orderKey);
334 387
335 388
        Map map = new LinkedHashMap();
336 389
        map.put("total", count);
@ -412,7 +465,7 @@ public class EnrollService extends BaseVerifyService implements IEnrollService {
412 465
        //我的报名信息 + 此次考试信息
413 466
        List<MyEnrollWrap> wraps = new ArrayList<>();
414 467
        for (Enroll enroll : enrolls) {
415
            wraps.add(getWrap(enroll,student_id));
468
            wraps.add(getWrap(enroll, student_id));
416 469
        }
417 470
        return wraps;
418 471
    }