Browse Source

export setProperties

zhuhaiwen 3 years ago
parent
commit
42f69e8b42

+ 1 - 1
oa-app/src/main/java/com/css/oa/exam/assign/service/AssignService.java

414
            Page<Assign> pages = repository.findAll(spec, pageReques);
414
            Page<Assign> pages = repository.findAll(spec, pageReques);
415
            List<Assign> content = pages.getContent();
415
            List<Assign> content = pages.getContent();
416
            beanList.addAll(content);
416
            beanList.addAll(content);
417
            setProperties(beanList);
418
        }
417
        }
418
        setProperties(beanList);
419
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "分配考场"), entityList, beanList);
419
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "分配考场"), entityList, beanList);
420
        workbook.createCellStyle().setLocked(true);
420
        workbook.createCellStyle().setLocked(true);
421
        ExcelDelegate.exportExcel(workbook, "分配考场-导出.xls", response);
421
        ExcelDelegate.exportExcel(workbook, "分配考场-导出.xls", response);

+ 14 - 1
oa-app/src/main/java/com/css/oa/exam/common/controller/CommonController.java

8
import lombok.extern.slf4j.Slf4j;
8
import lombok.extern.slf4j.Slf4j;
9
import org.springframework.web.bind.annotation.*;
9
import org.springframework.web.bind.annotation.*;
10
10
11
import java.util.ArrayList;
12
import java.util.HashMap;
13
import java.util.List;
11
import java.util.Map;
14
import java.util.Map;
12
15
13
@Slf4j
16
@Slf4j
21
    public Result orderKey() {
24
    public Result orderKey() {
22
        Result<Map> result;
25
        Result<Map> result;
23
        try {
26
        try {
24
            result = setResult("res", MyOrder.arr);
27
            List list = new ArrayList<>();
28
            for (int i = 0; i < MyOrder.keys.length; i++) {
29
                Map map = new HashMap();
30
                map.put("key", MyOrder.keys[i]);
31
                map.put("han", MyOrder.hans[i]);
32
                list.add(map);
33
            }
34
            Map map = new HashMap();
35
            map.put("total", list.size());
36
            map.put("list", list);
37
            result = setResult("res", map);
25
        } catch (Exception e) {
38
        } catch (Exception e) {
26
            result = setErr(e.toString());
39
            result = setErr(e.toString());
27
            e.printStackTrace();
40
            e.printStackTrace();

+ 5 - 4
oa-app/src/main/java/com/css/oa/exam/constants/MyOrder.java

2
2
3
public class MyOrder {
3
public class MyOrder {
4
4
5
    public static String[] arr = {"gender", "verify_state", "pay_state"};
5
    public static String[] keys = {"unit", "department", "verify_state", "gender", "pay_state"};
6
    public static String[] hans = {"单位", "部门", "审核状态", "性别", "缴费状态"};
6
    //        性别: 男、女
7
    //        性别: 男、女
7
//        审核状态 :审核通过、审核中、未审核
8
//        审核状态 :审核通过、审核中、未审核
8
//        缴费状态:已经缴费、未缴费
9
//        缴费状态:已经缴费、未缴费
9
    public static String gender = arr[0];
10
    public static String verify_state = arr[1];
11
    public static String pay_state = arr[2];
10
    public static String gender = keys[0];
11
    public static String verify_state = keys[1];
12
    public static String pay_state = keys[2];
12
13
13
}
14
}

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

22
22
23
    public List<String> studentIds = new ArrayList<>();
23
    public List<String> studentIds = new ArrayList<>();
24
24
25
    public String orderKey = ""; //gender verify_state pay_state
25
    public List<String> orderKeys = new ArrayList<>(); //gender verify_state pay_state
26
26
27
}
27
}

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

307
        }
307
        }
308
    }
308
    }
309
309
310
    private void groupBy(List<Enroll> list, String orderKey) {
310
    private void groupBy(List<Enroll> list, List<String> orderKeys) {
311
//        性别: 男、女
311
//        性别: 男、女
312
//        审核状态 :审核通过、审核中、未审核
312
//        审核状态 :审核通过、审核中、未审核
313
//        缴费状态:已经缴费、未缴费
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
        }
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
    }
363
    }
364
364
365
    @Autowired
365
    @Autowired
383
        Page<Enroll> pages = repository.findAll(spec, pageReques);
383
        Page<Enroll> pages = repository.findAll(spec, pageReques);
384
        List<Enroll> enrollList = pages.getContent();
384
        List<Enroll> enrollList = pages.getContent();
385
        setProperties(enrollList);
385
        setProperties(enrollList);
386
        groupBy(enrollList, req.condition.orderKey);
386
        groupBy(enrollList, req.condition.orderKeys);
387
387
388
        Map map = new LinkedHashMap();
388
        Map map = new LinkedHashMap();
389
        map.put("total", count);
389
        map.put("total", count);
525
            Page<Enroll> pages = repository.findAll(spec, pageReques);
525
            Page<Enroll> pages = repository.findAll(spec, pageReques);
526
            List<Enroll> content = pages.getContent();
526
            List<Enroll> content = pages.getContent();
527
            beanList.addAll(content);
527
            beanList.addAll(content);
528
            setProperties(beanList);
529
        }
528
        }
529
        setProperties(beanList);
530
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "报名管理"), entityList, beanList);
530
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "报名管理"), entityList, beanList);
531
        workbook.createCellStyle().setLocked(true);
531
        workbook.createCellStyle().setLocked(true);
532
        ExcelDelegate.exportExcel(workbook, "报名管理-导出.xls", response);
532
        ExcelDelegate.exportExcel(workbook, "报名管理-导出.xls", response);

+ 1 - 1
oa-app/src/main/java/com/css/oa/exam/monitor/service/MonitorService.java

295
            Page<Monitor> pages = repository.findAll(spec, pageReques);
295
            Page<Monitor> pages = repository.findAll(spec, pageReques);
296
            List<Monitor> content = pages.getContent();
296
            List<Monitor> content = pages.getContent();
297
            beanList.addAll(content);
297
            beanList.addAll(content);
298
            setProperties(beanList);
299
        }
298
        }
299
        setProperties(beanList);
300
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "督考员管理"), entityList, beanList);
300
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "督考员管理"), entityList, beanList);
301
        workbook.createCellStyle().setLocked(true);
301
        workbook.createCellStyle().setLocked(true);
302
        ExcelDelegate.exportExcel(workbook, "督考员管理-导出.xls", response);
302
        ExcelDelegate.exportExcel(workbook, "督考员管理-导出.xls", response);

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

520
            Page<Place> pages = repository.findAll(spec, pageReques);
520
            Page<Place> pages = repository.findAll(spec, pageReques);
521
            List<Place> content = pages.getContent();
521
            List<Place> content = pages.getContent();
522
            beanList.addAll(content);
522
            beanList.addAll(content);
523
            setVerifyState(beanList);
524
        }
523
        }
524
        setVerifyState(beanList);
525
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "考点管理"), entityList, beanList);
525
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "考点管理"), entityList, beanList);
526
        workbook.createCellStyle().setLocked(true);
526
        workbook.createCellStyle().setLocked(true);
527
        ExcelDelegate.exportExcel(workbook, "考点管理-导出.xls", response);
527
        ExcelDelegate.exportExcel(workbook, "考点管理-导出.xls", response);

+ 1 - 1
oa-app/src/main/java/com/css/oa/exam/room/service/RoomService.java

321
            Page<Room> pages = repository.findAll(spec, pageReques);
321
            Page<Room> pages = repository.findAll(spec, pageReques);
322
            List<Room> content = pages.getContent();
322
            List<Room> content = pages.getContent();
323
            beanList.addAll(content);
323
            beanList.addAll(content);
324
            setVerifyState(beanList);
325
        }
324
        }
325
        setVerifyState(beanList);
326
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "考场管理"), entityList, beanList);
326
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "考场管理"), entityList, beanList);
327
        workbook.createCellStyle().setLocked(true);
327
        workbook.createCellStyle().setLocked(true);
328
        ExcelDelegate.exportExcel(workbook, "考场管理-导出.xls", response);
328
        ExcelDelegate.exportExcel(workbook, "考场管理-导出.xls", response);

+ 1 - 1
oa-app/src/main/java/com/css/oa/exam/score/service/ScoreService.java

421
            Page<Score> pages = repository.findAll(spec, pageReques);
421
            Page<Score> pages = repository.findAll(spec, pageReques);
422
            List<Score> content = pages.getContent();
422
            List<Score> content = pages.getContent();
423
            beanList.addAll(content);
423
            beanList.addAll(content);
424
            setProperties(beanList);
425
        }
424
        }
425
        setProperties(beanList);
426
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "成绩管理"), entityList, beanList);
426
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "成绩管理"), entityList, beanList);
427
        workbook.createCellStyle().setLocked(true);
427
        workbook.createCellStyle().setLocked(true);
428
        ExcelDelegate.exportExcel(workbook, "成绩管理-导出.xls", response);
428
        ExcelDelegate.exportExcel(workbook, "成绩管理-导出.xls", response);