puzhibing
2023-08-14 1882d607549762a84b1a5326f7262eba01363b85
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
package com.dsh.guns.modular.system.controller.code;
 
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dsh.course.feignClient.account.CityManagerClient;
import com.dsh.course.feignClient.account.CoachClient;
import com.dsh.course.feignClient.account.model.CityManager;
import com.dsh.course.feignClient.account.model.Coach;
import com.dsh.course.feignClient.course.CoursePackageClient;
import com.dsh.course.feignClient.course.CoursePackageDiscountClient;
import com.dsh.course.feignClient.course.CoursePackagePaymentConfigClient;
import com.dsh.course.feignClient.course.CoursePackageTypeClient;
import com.dsh.course.feignClient.course.model.*;
import com.dsh.guns.config.UserExt;
import com.dsh.guns.core.base.controller.BaseController;
import com.dsh.guns.core.util.ToolUtil;
import com.dsh.guns.modular.system.model.TSite;
import com.dsh.guns.modular.system.model.TStore;
import com.dsh.guns.modular.system.service.ICoursePackageService;
import com.dsh.guns.modular.system.service.IStoreService;
import com.dsh.guns.modular.system.service.ITSiteService;
import com.dsh.guns.modular.system.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import javax.annotation.Resource;
import java.util.*;
 
/**
 * @author zhibing.pu
 * @Date 2023/8/1 11:50
 */
@Controller
@RequestMapping("/coursePackage")
public class TCoursePackageController extends BaseController {
 
    private String PREFIX = "/system/coursePackage/";
 
    @Autowired
    private ICoursePackageService coursePackageService;
 
    @Resource
    private CoursePackageTypeClient coursePackageTypeClient;
 
    @Autowired
    private IStoreService storeService;
 
    @Resource
    private CityManagerClient cityManagerClient;
 
    @Autowired
    private ITSiteService siteService;
 
    @Resource
    private CoachClient coachClient;
 
    @Resource
    private CoursePackagePaymentConfigClient coursePackagePaymentConfigClient;
 
    @Resource
    private CoursePackageDiscountClient coursePackageDiscountClient;
 
    @Resource
    private CoursePackageClient coursePackageClient;
 
 
 
 
 
    /**
     * 跳转到列表页
     * @param model
     * @return
     */
    @GetMapping("/openCoursePackageListPage")
    public String openCoursePackageListPage(Model model){
        Integer objectType = UserExt.getUser().getObjectType();
        Integer objectId = UserExt.getUser().getObjectId();
        List<TCoursePackageType> tCoursePackageTypes = coursePackageTypeClient.queryAllCoursePackageType();
        model.addAttribute("coursePackageType", tCoursePackageTypes);
        String cityCode = null;
        if(objectType == 2){//城市管理员
            CityManager cityManager = cityManagerClient.queryCityManagerById(objectId);
            cityCode = cityManager.getCityCode();
        }
        List<Map<String, Object>> list = storeService.queryProvince(cityCode);
        model.addAttribute("province", list);
        model.addAttribute("objectType", objectType);
        return PREFIX + "coursePackage.html";
    }
 
 
    /**
     * 跳转到添加页
     * @param model
     * @return
     */
    @GetMapping("/openAddCoursePackage")
    public String openAddCoursePackage(Model model){
        Integer objectType = UserExt.getUser().getObjectType();
        Integer objectId = UserExt.getUser().getObjectId();
        List<TCoursePackageType> tCoursePackageTypes = coursePackageTypeClient.queryAllCoursePackageType();
        model.addAttribute("coursePackageType", tCoursePackageTypes);
        String cityCode = null;
        if(objectType == 2){//城市管理员
            CityManager cityManager = cityManagerClient.queryCityManagerById(objectId);
            cityCode = cityManager.getCityCode();
        }
        List<Map<String, Object>> list = storeService.queryProvince(cityCode);
        model.addAttribute("province", list);
        Object code = list.get(0).get("code");
        List<Map<String, Object>> list1 = storeService.queryCity(code.toString(), cityCode);
        model.addAttribute("city", list1);
        String code1 = list1.get(0).get("code").toString();
        List<TStore> list2 = storeService.list(new QueryWrapper<TStore>().eq("cityCode", code1).eq("state", 1));
        model.addAttribute("store", list2);
        TStore store = list2.get(0);
        List<TSite> list3 = siteService.list(new QueryWrapper<TSite>().eq("storeId", store.getId()).eq("state", 1));
        model.addAttribute("site", list3);
        List<Coach> coaches = coachClient.queryCoachByCity(code1);
        model.addAttribute("coach", coaches);
        return PREFIX + "coursePackage_add.html";
    }
 
 
    /**
     * 跳转到编辑页
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/openEditCoursePackage")
    public String openEditCoursePackage(Model model, Integer id){
        TCoursePackage tCoursePackage = coursePackageService.queryById(id);
        model.addAttribute("item", tCoursePackage);
        model.addAttribute("classTime", tCoursePackage.getClassStartTime() + ":00 - " + tCoursePackage.getClassEndTime() + ":00");
        String[] split = tCoursePackage.getClassWeeks().split(";");
        List<String> list5 = Arrays.asList("周一", "周二", "周三", "周四", "周五", "周六", "周日");
        List<Map<String, Object>> classWeeks = new ArrayList<>();
        for (String s : list5) {
            Map<String, Object> map = new HashMap<>();
            map.put("value", s);
            map.put("checked", false);
            for (String s1 : split) {
                if(s.equals(s1)){
                    map.put("checked", true);
                }
            }
            classWeeks.add(map);
        }
        model.addAttribute("classWeeks", classWeeks);
        List<TCoursePackageType> tCoursePackageTypes = coursePackageTypeClient.queryAllCoursePackageType();
        model.addAttribute("coursePackageType", tCoursePackageTypes);
        String cityCode = tCoursePackage.getCityCode();
        String provinceCode = tCoursePackage.getProvinceCode();
        List<Map<String, Object>> list = storeService.queryProvince(cityCode);
        model.addAttribute("province", list);
        List<Map<String, Object>> list1 = storeService.queryCity(provinceCode, cityCode);
        model.addAttribute("city", list1);
        List<TStore> list2 = storeService.list(new QueryWrapper<TStore>().eq("cityCode", cityCode).eq("state", 1));
        model.addAttribute("store", list2);
        List<TSite> list3 = siteService.list(new QueryWrapper<TSite>().eq("storeId", tCoursePackage.getStoreId()).eq("state", 1));
        model.addAttribute("site", list3);
        List<Coach> coaches = coachClient.queryCoachByCity(cityCode);
        model.addAttribute("coach", coaches);
        List<CoursePackagePaymentConfig> list4 = coursePackagePaymentConfigClient.queryCoursePackagePaymentConfigList(id);
        model.addAttribute("coursePackagePaymentConfig", list4.remove(0));
        model.addAttribute("coursePackagePaymentConfigs", list4);
        CoursePackagePaymentConfig coursePackagePaymentConfig = list4.get(0);
        model.addAttribute("cashPayment", coursePackagePaymentConfig.getCashPayment() == 0 ? false : true);
        model.addAttribute("playPaiCoin", coursePackagePaymentConfig.getPlayPaiCoin() == 0 ? false : true);
        return PREFIX + "coursePackage_edit.html";
    }
 
 
    /**
     * 跳转详情页
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/showCoursePackageDetails")
    public String showCoursePackageDetails(Model model, Integer id){
        TCoursePackage tCoursePackage = coursePackageService.queryById(id);
        model.addAttribute("item", tCoursePackage);
        model.addAttribute("classTime", tCoursePackage.getClassStartTime() + ":00 - " + tCoursePackage.getClassEndTime() + ":00");
        String[] split = tCoursePackage.getClassWeeks().split(";");
        List<String> list5 = Arrays.asList("周一", "周二", "周三", "周四", "周五", "周六", "周日");
        List<Map<String, Object>> classWeeks = new ArrayList<>();
        for (String s : list5) {
            Map<String, Object> map = new HashMap<>();
            map.put("value", s);
            map.put("checked", false);
            for (String s1 : split) {
                if(s.equals(s1)){
                    map.put("checked", true);
                }
            }
            classWeeks.add(map);
        }
        model.addAttribute("classWeeks", classWeeks);
        List<TCoursePackageType> tCoursePackageTypes = coursePackageTypeClient.queryAllCoursePackageType();
        model.addAttribute("coursePackageType", tCoursePackageTypes);
        String cityCode = tCoursePackage.getCityCode();
        String provinceCode = tCoursePackage.getProvinceCode();
        List<Map<String, Object>> list = storeService.queryProvince(cityCode);
        model.addAttribute("province", list);
        List<Map<String, Object>> list1 = storeService.queryCity(provinceCode, cityCode);
        model.addAttribute("city", list1);
        List<TStore> list2 = storeService.list(new QueryWrapper<TStore>().eq("cityCode", cityCode).eq("state", 1));
        model.addAttribute("store", list2);
        List<TSite> list3 = siteService.list(new QueryWrapper<TSite>().eq("storeId", tCoursePackage.getStoreId()).eq("state", 1));
        model.addAttribute("site", list3);
        List<Coach> coaches = coachClient.queryCoachByCity(cityCode);
        model.addAttribute("coach", coaches);
        List<CoursePackagePaymentConfig> list4 = coursePackagePaymentConfigClient.queryCoursePackagePaymentConfigList(id);
        model.addAttribute("coursePackagePaymentConfig", list4.remove(0));
        model.addAttribute("coursePackagePaymentConfigs", list4);
        CoursePackagePaymentConfig coursePackagePaymentConfig = list4.get(0);
        model.addAttribute("cashPayment", coursePackagePaymentConfig.getCashPayment() == 0 ? false : true);
        model.addAttribute("playPaiCoin", coursePackagePaymentConfig.getPlayPaiCoin() == 0 ? false : true);
        return PREFIX + "coursePackage_info.html";
    }
 
 
    /**
     * 跳转到折扣页
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/showCoursePackageDiscount")
    public String showCoursePackageDiscount(Model model, Integer id){
        TCoursePackage tCoursePackage = coursePackageService.queryById(id);
        model.addAttribute("item", tCoursePackage);
        List<CoursePackagePaymentConfig> list4 = coursePackagePaymentConfigClient.queryCoursePackagePaymentConfigList(id);
        List<Map<String, Object>> list = new ArrayList<>();
        for (CoursePackagePaymentConfig coursePackagePaymentConfig : list4) {
            if(coursePackagePaymentConfig.getCashPayment() == 0){
                continue;
            }
            Map<String, Object> map = new HashMap<>();
            map.put("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId());
            map.put("classHours", coursePackagePaymentConfig.getClassHours());
            String payment = "";
            if(coursePackagePaymentConfig.getCashPayment() > 0){
                payment += "现金支付";
            }
            if(coursePackagePaymentConfig.getPlayPaiCoin() > 0){
                payment += (ToolUtil.isNotEmpty(payment) ? "、" : "") + "玩湃币支付";
            }
            map.put("payment",  payment);
            map.put("cashPayment", coursePackagePaymentConfig.getCashPayment());
            List<TCoursePackageDiscount> tCoursePackageDiscounts = coursePackageDiscountClient.queryCoursePackageDiscount(coursePackagePaymentConfig.getId());
            map.put("coursePackageDiscount", tCoursePackageDiscounts);
            list.add(map);
        }
        model.addAttribute("coursePackagePaymentConfig", JSON.toJSONString(list));
        return PREFIX + "coursePackageDiscount.html";
    }
 
 
    /**
     * 跳转到报名列表页
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/registrationRecord")
    public String registrationRecord(Model model, Integer id){
        TCoursePackage tCoursePackage = coursePackageService.queryById(id);
        model.addAttribute("item", tCoursePackage);
        return PREFIX + "registrationRecord.html";
    }
 
 
    /**
     * 跳转到上课记录列表页
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/openClassRecord")
    public String openClassRecord(Model model, Integer id){
        TCoursePackage tCoursePackage = coursePackageClient.queryById(id);
        TStore store = storeService.getById(tCoursePackage.getStoreId());
        Coach coach = coachClient.queryCoachById(tCoursePackage.getCoachId());
        model.addAttribute("item", tCoursePackage);
        model.addAttribute("store", store);
        model.addAttribute("coach", coach);
        return PREFIX + "classRecord.html";
    }
 
 
    /**
     * 跳转到查看学员列表
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/openCoursePackageStudent")
    public String openCoursePackageStudent(Model model, Long id){
        model.addAttribute("id", id);
        return PREFIX + "coursePackageStudent.html";
    }
 
 
    /**
     * 跳转到手动预约列表
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/openManualReservation")
    public String openManualReservation(Model model, Long id){
        model.addAttribute("id", id);
        return PREFIX + "manualReservation.html";
    }
 
 
    /**
     * 跳转到课包审核列表页
     * @return
     */
    @GetMapping("/examineCoursePackage")
    public String examineCoursePackage(Model model){
        List<TCoursePackageType> tCoursePackageTypes = coursePackageTypeClient.queryAllCoursePackageType();
        model.addAttribute("coursePackageType", tCoursePackageTypes);
        List<Map<String, Object>> list = storeService.queryProvince(null);
        model.addAttribute("province", list);
        return PREFIX + "examineCoursePackage.html";
    }
 
 
    /**
     * 跳转到审核详情页
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/showExamineCoursePackageDetails")
    public String showExamineCoursePackageDetails(Model model, Integer id){
        TCoursePackage tCoursePackage = coursePackageService.queryById(id);
        model.addAttribute("item", tCoursePackage);
        model.addAttribute("classTime", tCoursePackage.getClassStartTime() + ":00 - " + tCoursePackage.getClassEndTime() + ":00");
        String[] split = tCoursePackage.getClassWeeks().split(";");
        List<String> list5 = Arrays.asList("周一", "周二", "周三", "周四", "周五", "周六", "周日");
        List<Map<String, Object>> classWeeks = new ArrayList<>();
        for (String s : list5) {
            Map<String, Object> map = new HashMap<>();
            map.put("value", s);
            map.put("checked", false);
            for (String s1 : split) {
                if(s.equals(s1)){
                    map.put("checked", true);
                }
            }
            classWeeks.add(map);
        }
        model.addAttribute("classWeeks", classWeeks);
        List<TCoursePackageType> tCoursePackageTypes = coursePackageTypeClient.queryAllCoursePackageType();
        model.addAttribute("coursePackageType", tCoursePackageTypes);
        String cityCode = tCoursePackage.getCityCode();
        String provinceCode = tCoursePackage.getProvinceCode();
        List<Map<String, Object>> list = storeService.queryProvince(cityCode);
        model.addAttribute("province", list);
        List<Map<String, Object>> list1 = storeService.queryCity(provinceCode, cityCode);
        model.addAttribute("city", list1);
        List<TStore> list2 = storeService.list(new QueryWrapper<TStore>().eq("cityCode", cityCode).eq("state", 1));
        model.addAttribute("store", list2);
        List<TSite> list3 = siteService.list(new QueryWrapper<TSite>().eq("storeId", tCoursePackage.getStoreId()).eq("state", 1));
        model.addAttribute("site", list3);
        List<Coach> coaches = coachClient.queryCoachByCity(cityCode);
        model.addAttribute("coach", coaches);
        List<CoursePackagePaymentConfig> list4 = coursePackagePaymentConfigClient.queryCoursePackagePaymentConfigList(id);
        model.addAttribute("coursePackagePaymentConfig", list4.remove(0));
        model.addAttribute("coursePackagePaymentConfigs", list4);
        CoursePackagePaymentConfig coursePackagePaymentConfig = list4.get(0);
        model.addAttribute("cashPayment", coursePackagePaymentConfig.getCashPayment() == 0 ? false : true);
        model.addAttribute("playPaiCoin", coursePackagePaymentConfig.getPlayPaiCoin() == 0 ? false : true);
        return PREFIX + "examineCoursePackage_info.html";
    }
 
 
 
 
    /**
     * 获取城市列表
     * @param code
     * @return
     */
    @ResponseBody
    @PostMapping("/queryCity")
    public List<Map<String, Object>> queryCity(String code){
        Integer objectType = UserExt.getUser().getObjectType();
        Integer objectId = UserExt.getUser().getObjectId();
        String cityCode = null;
        if(objectType == 2){//城市管理员
            CityManager cityManager = cityManagerClient.queryCityManagerById(objectId);
            cityCode = cityManager.getCityCode();
        }
        return storeService.queryCity(code, cityCode);
    }
 
 
    /**
     * 根据城市code获取门店
     * @param cityCode
     * @return
     */
    @ResponseBody
    @PostMapping("/queryStore")
    public List<TStore> queryStore(String cityCode){
        List<TStore> list = storeService.list(new QueryWrapper<TStore>().eq("cityCode", cityCode).eq("state", 1));
        return list;
    }
 
    /**
     * 根据门店id获取场地
     * @param storeId
     * @return
     */
    @ResponseBody
    @PostMapping("/querySite")
    public List<TSite> querySite(Integer storeId){
        List<TSite> list = siteService.list(new QueryWrapper<TSite>().eq("storeId", storeId).eq("state", 1));
        return list;
    }
 
    /**
     * 获取城市教练
     * @param cityCode
     * @return
     */
    @ResponseBody
    @PostMapping("/queryCoach")
    public List<Coach> queryCoach(String cityCode){
        List<Coach> coaches = coachClient.queryCoachByCity(cityCode);
        return coaches;
    }
 
 
 
    /**
     * 获取列表数据
     * @param provinceCode
     * @param cityCode
     * @param coursePackageTypeId
     * @param name
     * @param status
     * @param state
     * @return
     */
    @ResponseBody
    @PostMapping("/queryCoursePackageLists")
    public Object queryCoursePackageLists(String provinceCode, String cityCode, Integer coursePackageTypeId, String name, Integer status, Integer state){
        Integer objectType = UserExt.getUser().getObjectType();
        Integer objectId = UserExt.getUser().getObjectId();
        Integer storeId = null;
        if(objectType == 2){//城市管理员
            CityManager cityManager = cityManagerClient.queryCityManagerById(objectId);
            provinceCode = cityManager.getProvinceCode();
            cityCode = cityManager.getCityCode();
        }
        if(objectType == 3) {//城市管理员
            storeId = objectId;
        }
        Page<Map<String, Object>> mapPage = coursePackageService.queryCoursePackageLists(provinceCode, cityCode, coursePackageTypeId, storeId, name, status, state);
        return super.packForBT(mapPage);
    }
 
 
    /**
     * 添加课包数据
     * @param coursePackage
     * @param coursePackagePaymentConfig
     * @return
     */
    @ResponseBody
    @PostMapping("/addCoursePackage")
    public ResultUtil addCoursePackage(TCoursePackage coursePackage, String coursePackagePaymentConfig){
        String classStartTime = coursePackage.getClassStartTime();
        String classEndTime = coursePackage.getClassEndTime();
        classStartTime = classStartTime.substring(0, classStartTime.lastIndexOf(":"));
        classEndTime = classEndTime.substring(0, classEndTime.lastIndexOf(":"));
        coursePackage.setClassStartTime(classStartTime);
        coursePackage.setClassEndTime(classEndTime);
        coursePackage.setAuditStatus(1);
        coursePackage.setStatus(1);
        coursePackage.setState(1);
        coursePackage.setInsertTime(new Date());
        coursePackageService.addCoursePackage(coursePackage, coursePackagePaymentConfig);
        return ResultUtil.success();
    }
 
 
    /**
     * 修改数据
     * @param coursePackage
     * @param coursePackagePaymentConfig
     * @return
     */
    @ResponseBody
    @PostMapping("/updateCoursePackage")
    public ResultUtil updateCoursePackage(TCoursePackage coursePackage, String coursePackagePaymentConfig){
        String classStartTime = coursePackage.getClassStartTime();
        String classEndTime = coursePackage.getClassEndTime();
        classStartTime = classStartTime.substring(0, classStartTime.lastIndexOf(":"));
        classEndTime = classEndTime.substring(0, classEndTime.lastIndexOf(":"));
        coursePackage.setClassStartTime(classStartTime);
        coursePackage.setClassEndTime(classEndTime);
        coursePackageService.updateCoursePackage(coursePackage, coursePackagePaymentConfig);
        return ResultUtil.success();
    }
 
 
    /**
     * 修改数据状态
     * @param id
     * @param state
     * @return
     */
    @ResponseBody
    @PostMapping("/editCoursePackageState")
    public ResultUtil editCoursePackageState(Integer id, Integer state){
        TCoursePackage coursePackage = new TCoursePackage();
        coursePackage.setId(id);
        coursePackage.setState(state);
        coursePackageService.editCoursePackageState(coursePackage);
        return ResultUtil.success();
    }
 
 
    /**
     * 编辑课包折扣
     * @param json
     * @return
     */
    @ResponseBody
    @PostMapping("/setCoursePackageDiscount")
    public ResultUtil setCoursePackageDiscount(Integer id, String json){
        return coursePackageService.setCoursePackageDiscount(id, json);
    }
 
 
    /**
     * 获取课包报名信息列表
     * @param id
     * @param userName
     * @param studentName
     * @return
     */
    @ResponseBody
    @PostMapping("/queryRegistrationRecord")
    public Object queryRegistrationRecord(Integer id, String userName, String studentName){
        Page<Map<String, Object>> mapPage = coursePackageService.queryRegistrationRecord(id, userName, studentName);
        return super.packForBT(mapPage);
    }
 
 
    /**
     * 获取课包排课数据
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/queryClassRecord")
    public Object queryClassRecord(Integer id){
        Page<Map<String, Object>> page = coursePackageService.queryCoursePackageSchedulingList(id);
        return super.packForBT(page);
    }
 
 
    /**
     * 根据排课id获取学员预约数据列表
     * @param id
     * @param userName
     * @param studentName
     * @return
     */
    @ResponseBody
    @PostMapping("/queryCoursePackageStudentList")
    public Object queryCoursePackageStudentList(Long id, String userName, String studentName){
        Page<Map<String, Object>> page = coursePackageService.queryCoursePackageStudentList(id, userName, studentName);
        return super.packForBT(page);
    }
 
 
    /**
     * 取消预约
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/cancelReservation")
    public ResultUtil cancelReservation(Long id){
        return coursePackageService.cancelReservation(id);
    }
 
 
    /**
     * 修改缺席状态
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/setAbsenceStatus")
    public ResultUtil setAbsenceStatus(Long id){
        return coursePackageService.setAbsenceStatus(id);
    }
 
 
    /**
     * 取消排课记录
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/cancelClassSchedule")
    public ResultUtil cancelClassSchedule(Long id){
        return coursePackageService.cancelClassSchedule(id);
    }
 
 
    /**
     * 发布课后练习
     * @param id
     * @param courseId
     * @param integral
     * @return
     */
    @ResponseBody
    @PostMapping("/afterClassExercises")
    public ResultUtil afterClassExercises(Long id, Integer courseId, Integer integral){
        return coursePackageService.afterClassExercises(id, courseId, integral);
    }
 
 
    /**
     * 添加消课凭证
     * @param id
     * @param cancelClasses
     * @param deductClassHour
     * @return
     */
    @ResponseBody
    @PostMapping("/cancellationRecord")
    public ResultUtil cancellationRecord(Long id, String cancelClasses, Integer deductClassHour){
        return coursePackageService.cancellationRecord(id, cancelClasses, deductClassHour);
    }
 
 
    /**
     * 获取未预约排课学员列表
     * @param coursePackageSchedulingId
     * @param userName
     * @param studentName
     * @return
     */
    @ResponseBody
    @PostMapping("/queryWalkInStudentList")
    public Object queryWalkInStudentList(Long coursePackageSchedulingId, String userName, String studentName){
        Page<Map<String, Object>> page = coursePackageService.queryWalkInStudentList(coursePackageSchedulingId, userName, studentName);
        return super.packForBT(page);
    }
 
 
    /**
     * 手动预约课程
     * @param coursePackagePaymentId
     * @param coursePackageSchedulingId
     * @return
     */
    @ResponseBody
    @PostMapping("/courseReservation")
    public ResultUtil courseReservation(Long coursePackagePaymentId, Long coursePackageSchedulingId){
        return coursePackageService.courseReservation(coursePackagePaymentId, coursePackageSchedulingId);
    }
 
 
    /**
     * 退课操作
     * @param coursePackagePaymentId
     * @param certificate
     * @return
     */
    @ResponseBody
    @PostMapping("/dropTheClass")
    public ResultUtil dropTheClass(Long coursePackagePaymentId, String certificate){
        return coursePackageService.dropTheClass(coursePackagePaymentId, certificate);
    }
 
 
    /**
     * 补课操作
     * @param coursePackagePaymentId
     * @return
     */
    @ResponseBody
    @PostMapping("/makeUpMissedLessons")
    public ResultUtil makeUpMissedLessons(Long coursePackagePaymentId){
        return coursePackageService.makeUpMissedLessons(coursePackagePaymentId);
    }
 
 
    /**
     * 获取课包审核列表
     * @param provinceCode
     * @param cityCode
     * @param coursePackageTypeId
     * @param name
     * @param auditStatus
     * @return
     */
    @ResponseBody
    @PostMapping("/queryExamineCoursePackageLists")
    public Object queryExamineCoursePackageLists(String provinceCode, String cityCode, Integer coursePackageTypeId, String name, Integer auditStatus){
        Page<Map<String, Object>> mapPage = coursePackageService.queryExamineCoursePackageLists(provinceCode, cityCode, coursePackageTypeId, name, auditStatus);
        return super.packForBT(mapPage);
    }
 
 
    /**
     * 审核课包
     * @param id
     * @param auditStatus
     * @param authRemark
     * @return
     */
    @ResponseBody
    @PostMapping("/setCoursePackageAuditStatus")
    public ResultUtil setCoursePackageAuditStatus(Integer id, Integer auditStatus, String authRemark){
        return coursePackageService.setCoursePackageAuditStatus(id, auditStatus, authRemark);
    }
}