puzhibing
2023-11-25 53e7558400dcacecdce70e39ebfe1727740f9296
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
package com.dsh.account.controller;
 
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.account.entity.TAppGift;
import com.dsh.account.entity.TStudent;
import com.dsh.account.feignclient.competition.model.PurchaseRecordVo;
import com.dsh.account.feignclient.course.model.RecordAppoint;
import com.dsh.account.model.vo.classDetails.*;
import com.dsh.account.model.vo.classDetails.classInsVo.*;
import com.dsh.account.model.vo.commentDetail.StuCommentsVo;
import com.dsh.account.model.vo.medalDetail.GongVo;
import com.dsh.account.model.vo.medalDetail.StuMedalVo;
import com.dsh.account.model.vo.sourceDetail.CouponStuAvailableVo;
import com.dsh.account.model.vo.sourceDetail.CourseDetailsOfContinuationResp;
import com.dsh.account.model.vo.sourceDetail.RecordTimeRequest;
import com.dsh.account.service.*;
import com.dsh.account.util.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
 
 
/**
 * 学员上课情况 接口
 */
@RestController
@RequestMapping("")
public class ClassDetailsController {
 
    private Logger logger = LoggerFactory.getLogger("business-log");
 
    @Autowired
    private TStudentService istuService;
 
    @Autowired
    private TAppUserService tappuService;
 
    @Autowired
    private EvaluateStudentService evalstuService;
 
    @Autowired
    private StudentHonorService honorService;
 
    @Autowired
    private TokenUtil tokenUtil;
 
    @Autowired
    private TAppGiftService appGiftService;
 
 
    @ResponseBody
    @PostMapping("/api/startCource/queryStudentData")
    @ApiOperation(value = "上课首页", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<ClassInfoVo> queryCouponRecord(Integer stuId) {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(tappuService.queryUserOfStus(stuId, userIdFormRedis));
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/startCource/weeksOfCourseDetails")
    @ApiOperation(value = "上课首页-课程列表", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "查询时间yyyy-MM-dd", name = "time", required = true, dataType = "string"),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "用户经度", name = "longitude", required = false, dataType = "string"),
            @ApiImplicitParam(value = "用户纬度", name = "latitude", required = false, dataType = "string"),
    })
    public ResultUtil<List<CourseVenue>> queryWeeksOfClassInfo(String time, Integer stuId, String longitude, String latitude) {
        try {
            Integer appUserId = tokenUtil.getUserIdFormRedis();
            if (null == appUserId) {
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(tappuService.queryWeekOfCourseDetails(appUserId, stuId, time, longitude, latitude));
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.runErr();
        }
 
    }
 
    @ResponseBody
    @PostMapping("/api/startCource/weeksOfCourseDetailsList")
    @ApiOperation(value = "上课首页-课程列表2.0", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "查询时间yyyy-MM-dd", name = "time", required = true, dataType = "string"),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "门店id", name = "storeId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "用户经度", name = "longitude", required = false, dataType = "string"),
            @ApiImplicitParam(value = "用户纬度", name = "latitude", required = false, dataType = "string"),
    })
    public ResultUtil<Map<String, Object>> weeksOfCourseDetailsList(String time, Integer stuId, Integer storeId, String longitude, String latitude) {
        try {
            Integer appUserId = tokenUtil.getUserIdFormRedis();
            if (null == appUserId) {
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(tappuService.weeksOfCourseDetailsList(appUserId, stuId, time, storeId, longitude, latitude));
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
    @ResponseBody
    @PostMapping("/api/startCource/weeksOfGetHours")
    @ApiOperation(value = "上课首页获取未分配课时-课程列表", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
    })
    public ResultUtil<Integer> weeksOfGetHours() {
        try {
            Integer appUserId = tokenUtil.getUserIdFormRedis();
            if (null == appUserId) {
                return ResultUtil.tokenErr();
            }
            TAppGift one = appGiftService.getOne(new LambdaQueryWrapper<TAppGift>().eq(TAppGift::getUserId, appUserId));
 
            return ResultUtil.success(one == null ? 0 : one.getNum());
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/startCource/weeksOfAddHours")
    @ApiOperation(value = "上课首页分配课时-课程列表", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "分配给课包id", name = "packetId", required = true, dataType = "Long"),
    })
    public ResultUtil<Integer> weeksOfAddHours(Long packetId) {
        try {
            Integer appUserId = tokenUtil.getUserIdFormRedis();
            if (null == appUserId) {
                return ResultUtil.tokenErr();
            }
            TAppGift one = appGiftService.getOne(new LambdaQueryWrapper<TAppGift>().eq(TAppGift::getUserId, appUserId));
            Boolean b = false;
            Integer i = 0;
            if (one != null && one.getNum() > 0) {
                i = appGiftService.weeksOfAddHours(packetId, appUserId, one.getNum());
 
            }
            if (i == 1) {
                // 送完清0
                one.setNum(0);
                appGiftService.updateById(one);
                return ResultUtil.success();
            } else {
                return ResultUtil.runErr();
            }
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    @ResponseBody
    @PostMapping("/api/startCource/queryPhysical")
    @ApiOperation(value = "获取学员测试报告", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "学员id", name = "stuID", required = true, dataType = "int"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<StuPhysicalVo> getStuPhysicalInfo(Integer stuID) {
        StuPhysicalVo vo = new StuPhysicalVo();
        TStudent tStudent = istuService.getById(stuID);
        if (ToolUtil.isNotEmpty(tStudent)) {
            vo.setBmi(tStudent.getBmi());
            vo.setBodyStatus(BMIBodyUtil.getBodyStatus(tStudent.getBmi()));
            if (tStudent.getLateralSurface() != null) {
                String[] split = tStudent.getLateralSurface().split(";");
                vo.setUrls(split);
            }
            vo.setHeight(tStudent.getHeight());
            vo.setWeight(tStudent.getWeight());
        }
        return ResultUtil.success(vo);
    }
 
    /**
     * 添加学员信息
     */
    @ResponseBody
    @PostMapping("/api/startCource/addData")
    @ApiOperation(value = "添加学员信息", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    @Transactional
    public ResultUtil addStu(StuDetailsReq stu) {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
            return istuService.addStuOfAppUser(stu, userIdFormRedis);
        } catch (Exception e) {
            return ResultUtil.runErr(ResultUtil.ERROR);
        }
    }
 
    /**
     * 该APP用户下的学员列表
     */
    @ResponseBody
    @PostMapping("/api/startCource/listOfStu")
    @ApiOperation(value = "学员列表", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<List<StuListVo>> queryStuList() {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
            List<StuListVo> stuListVos = new ArrayList<>();
            List<TStudent> tStudents = istuService.list(new QueryWrapper<TStudent>()
                    .eq("appUserId", userIdFormRedis).eq("state", 1));
            if (tStudents.size() > 0) {
                tStudents.forEach(sts -> {
                    StuListVo vo = new StuListVo();
                    vo.setStuId(sts.getId());
                    vo.setStuHeadImg(sts.getHeadImg());
                    vo.setStuPhone(ToolUtil.isEmpty(sts.getPhone()) ? "" : sts.getPhone());
                    vo.setIdCard(ToolUtil.isEmpty(sts.getIdCard()) ? "" : sts.getIdCard());
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
                    vo.setBirthday(simpleDateFormat.format(sts.getBirthday()));
                    vo.setStuName(sts.getName());
                    vo.setStuAge(DateUtil.age(sts.getBirthday()));
                    vo.setStuHeight(sts.getHeight());
                    vo.setStuWeight(sts.getWeight());
                    vo.setIsNot(sts.getIsDefault());
                    vo.setStuPhone(sts.getPhone());
                    vo.setSex(sts.getSex());
                    stuListVos.add(vo);
                });
            }
            return ResultUtil.success(stuListVos);
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 切换学员
     */
    @ResponseBody
    @PostMapping("/api/startCource/switchStu")
    @ApiOperation(value = "切换学员", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<List<StuListVo>> dealSwitchStudents(Integer stuId) {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(istuService.switchStudentActions(userIdFormRedis, stuId));
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 编辑学员详情
     */
    @ResponseBody
    @PostMapping("/api/startCource/editStu")
    @ApiOperation(value = "编辑学员详情", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<StuDetailsVo> editStudentInfo(Integer stuId) {
        try {
            TStudent byId = istuService.getById(stuId);
            if (ToolUtil.isEmpty(byId)) {
                ResultUtil.error("未查询到该学员!");
            }
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
            StuDetailsVo detailsVo = new StuDetailsVo();
            detailsVo.setStuId(byId.getId());
            detailsVo.setStuHeadImg(byId.getHeadImg());
            detailsVo.setStuName(byId.getName());
            detailsVo.setBirthday(simpleDateFormat.format(byId.getBirthday()));
            detailsVo.setStuHeight(byId.getHeight());
            detailsVo.setStuWeight(byId.getWeight());
            detailsVo.setIdCard(ToolUtil.isEmpty(byId.getIdCard()) ? "" : byId.getIdCard());
            detailsVo.setStuPhone(ToolUtil.isEmpty(byId.getPhone()) ? "" : byId.getPhone());
            return ResultUtil.success(detailsVo);
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 提交编辑学员
     */
    @ResponseBody
    @PostMapping("/api/startCource/commitEditStu")
    @ApiOperation(value = "提交编辑学员", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil commitEditStu(StuDetailsReq stu) {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
 
            Double height = stu.getHeight();
            Double squareHeight = Math.pow(height / 100, 2);
            Double weight = stu.getWeight();
 
            Double bim = weight / squareHeight;
 
            TStudent tStudent = new TStudent();
 
 
            tStudent.setId(stu.getStuId());
            tStudent.setBirthday(format.parse(stu.getBirthday()));
            tStudent.setHeadImg(stu.getHeadImg());
            tStudent.setHeight(stu.getHeight());
            tStudent.setWeight(stu.getWeight());
            tStudent.setPhone(stu.getPhone());
            tStudent.setSex(stu.getSex());
            tStudent.setName(stu.getName());
            tStudent.setIdCard(stu.getIdCard());
            tStudent.setBmi(bim);
 
            if (ToolUtil.isNotEmpty(tStudent.getName()) && ToolUtil.isNotEmpty(tStudent.getIdCard())) {
                Boolean aBoolean = JuHeUtil.idcardAuthentication(tStudent.getIdCard(), tStudent.getName());
                if (!aBoolean) {
                    return ResultUtil.error("身份证和姓名不匹配");
                }
            }
 
            return ResultUtil.success(istuService.updateById(tStudent));
 
//            return ResultUtil.success(istuService.commitEditStudentInfo(stu,userIdFormRedis));
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 学员设为默认
     */
    @ResponseBody
    @PostMapping("/api/startCource/editDefault")
    @ApiOperation(value = "设为默认", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil editDefault(Integer stuId) {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
            TStudent byId = istuService.getById(stuId);
            if (ToolUtil.isEmpty(byId)) {
                ResultUtil.error("未查询到该学员!");
            }
            byId.setIsDefault(1);
            istuService.updateById(byId);
            List<TStudent> list = istuService.list(new LambdaQueryWrapper<TStudent>()
                    .eq(TStudent::getAppUserId, userIdFormRedis)
                    .ne(TStudent::getId, byId.getId()));
            for (TStudent tStudent : list) {
                tStudent.setIsDefault(2);
                istuService.updateById(tStudent);
            }
            return ResultUtil.success();
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 课时详情
     */
    @ResponseBody
    @PostMapping("/api/startCource/lessonDetails")
    @ApiOperation(value = "课时详情", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "课包id", name = "lessonId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<ClassDetailsInsVo> coursePackageDetails(Integer lessonId, Integer stuId) {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
 
            return ResultUtil.success(istuService.querySessionDetailsDt(userIdFormRedis, lessonId, stuId));
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
 
    }
 
 
    /**
     * 课时详情-记录列表
     */
    @ResponseBody
    @PostMapping("/api/startCource/recordDetails")
    @ApiOperation(value = "课时详情-记录列表", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
    })
    public ResultUtil<List<PurchaseRecordVo>> recordList(RecordTimeRequest timeRequest) {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(istuService.queryDeduRecordDetails(timeRequest, userIdFormRedis));
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 课时详情-续课课包详情
     */
    @ResponseBody
    @PostMapping("/api/startCource/renewal")
    @ApiOperation(value = "课时详情-续课课包详情", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "课包id", name = "lessonId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<CourseDetailsOfContinuationResp> renewalOfCourses(Integer lessonId, Integer stuId) {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(istuService.queryStuOfCourseDetails(lessonId, stuId, userIdFormRedis));
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
 
    }
 
 
    /**
     * 课时详情-选择优惠券
     */
    @ResponseBody
    @PostMapping("/api/startCource/conponList")
    @ApiOperation(value = "课时详情-选择优惠券", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<List<CouponStuAvailableVo>> queryCouponList() {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(istuService.queryStuOfConponDetails(userIdFormRedis));
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
 
    }
 
 
    /**
     * 课时详情-支付
     */
    @ResponseBody
    @PostMapping("/api/startCource/payment")
    @ApiOperation(value = "课时详情-支付", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
    })
    public ResultUtil continuationOperation(ClasspaymentRequest request) {
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if (null == userIdFormRedis) {
                return ResultUtil.tokenErr();
            }
            return istuService.renewClassPayment(userIdFormRedis, request);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.runErr();
        }
 
    }
 
 
    /**
     * 学员评语
     */
    @ResponseBody
    @PostMapping("/api/startCource/stuComment")
    @ApiOperation(value = "学员评语", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<List<StuCommentsVo>> queryStuComment(Integer stuId) {
        try {
            return ResultUtil.success(evalstuService.queryStuCommentsList(stuId));
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 学员勋章详情
     */
    @ResponseBody
    @PostMapping("/api/startCource/stuMedal")
    @ApiOperation(value = "学员勋章详情", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<List<StuMedalVo>> queryStuMedal(Integer stuId) {
        try {
 
 
            Integer appUserId = tokenUtil.getUserIdFormRedis();
            if (null == appUserId) {
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(honorService.queryHonorDetails(stuId));
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 学员勋章
     */
    @ResponseBody
    @PostMapping("/api/startCource/stuGoog")
    @ApiOperation(value = "学员勋章", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<List<GongVo>> queryStuGoog(Integer stuId) {
        try {
            Integer appUserId = tokenUtil.getUserIdFormRedis();
            if (null == appUserId) {
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(honorService.queryStuOfMedalData(stuId));
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
    /**
     * 上课预约记录
     */
    @ResponseBody
    @PostMapping("/api/startCource/stuAppointList")
    @ApiOperation(value = "上课预约记录", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "预约状态 0=全部 1=待上课 2=已完成 3=已取消", name = "appointStatus", required = false, dataType = "int"),
            @ApiImplicitParam(value = "时间类型 0=全部 1=近一周 2=近一个月 3=近一年", name = "timeType", required = false, dataType = "int"),
            @ApiImplicitParam(value = "课程名称", name = "appointStatus", required = false, dataType = "string"),
    })
    public ResultUtil<List<RecordAppoint>> cgeClassAppointmentRecordList(Integer stuId, Integer appointStatus, Integer timeType, String search, Integer pageNum) {
        Integer appUserId = tokenUtil.getUserIdFormRedis();
        if (null == appUserId) {
            return ResultUtil.tokenErr();
        }
        return ResultUtil.success(istuService.getAppointmentRecords(stuId, appUserId, appointStatus, timeType, search, pageNum));
    }
 
 
    /**
     * 取消预约
     */
    @ResponseBody
    @PostMapping("/api/startCource/cancelCourse")
    @ApiOperation(value = "上课预约-取消预约", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "上课记录id", name = "courseStuRecordId", required = true, dataType = "int"),
    })
    public ResultUtil cancelReservation(Integer courseStuRecordId) {
        try {
            Integer appUserId = tokenUtil.getUserIdFormRedis();
            if (null == appUserId) {
                return ResultUtil.tokenErr();
            }
            return istuService.cancelReservationOfCourse(courseStuRecordId);
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
}