From 41b60f3df5f3054aad44307c13a26b14f3b32ac0 Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期二, 21 十一月 2023 09:46:03 +0800
Subject: [PATCH] 11.21

---
 cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java |  141 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 125 insertions(+), 16 deletions(-)

diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java
index 210bd96..13bff14 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java
@@ -3,6 +3,7 @@
 
 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;
@@ -14,10 +15,7 @@
 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.EvaluateStudentService;
-import com.dsh.account.service.StudentHonorService;
-import com.dsh.account.service.TAppUserService;
-import com.dsh.account.service.TStudentService;
+import com.dsh.account.service.*;
 import com.dsh.account.util.*;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -34,6 +32,7 @@
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -60,6 +59,9 @@
     @Autowired
     private TokenUtil tokenUtil;
 
+    @Autowired
+    private TAppGiftService appGiftService;
+
 
 
     @ResponseBody
@@ -68,13 +70,13 @@
     @ApiImplicitParams({
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
-    public ResultUtil<ClassInfoVo> queryCouponRecord(){
+    public ResultUtil<ClassInfoVo> queryCouponRecord(Integer stuId){
         try {
             Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
             if(null == userIdFormRedis){
                 return ResultUtil.tokenErr();
             }
-            return ResultUtil.success(tappuService.queryUserOfStus(userIdFormRedis));
+            return ResultUtil.success(tappuService.queryUserOfStus(stuId,userIdFormRedis));
         }catch (Exception e){
             e.printStackTrace();
             return ResultUtil.runErr();
@@ -105,6 +107,85 @@
         }
 
     }
+    @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
@@ -120,7 +201,10 @@
         if (ToolUtil.isNotEmpty(tStudent)){
             vo.setBmi(tStudent.getBmi());
             vo.setBodyStatus(BMIBodyUtil.getBodyStatus(tStudent.getBmi()));
-            vo.setUrl(tStudent.getLateralSurface());
+            if (tStudent.getLateralSurface()!=null) {
+                String[] split = tStudent.getLateralSurface().split(";");
+                vo.setUrls(split);
+            }
             vo.setHeight(tStudent.getHeight());
             vo.setWeight(tStudent.getWeight());
         }
@@ -166,7 +250,7 @@
             }
             List<StuListVo> stuListVos = new ArrayList<>();
             List<TStudent> tStudents = istuService.list(new QueryWrapper<TStudent>()
-                    .eq("appUserId",userIdFormRedis));
+                    .eq("appUserId",userIdFormRedis).eq("state",1));
             if (tStudents.size() > 0){
                 tStudents.forEach(sts -> {
                     StuListVo vo = new StuListVo();
@@ -182,6 +266,7 @@
                     vo.setStuWeight(sts.getWeight());
                     vo.setIsNot(sts.getIsDefault());
                     vo.setStuPhone(sts.getPhone());
+                    vo.setSex(sts.getSex());
                     stuListVos.add(vo);
                 });
             }
@@ -260,13 +345,34 @@
             @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(StuEditInfoReq stu){
+    public ResultUtil commitEditStu(StuDetailsReq stu){
         try {
             Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
             if(null == userIdFormRedis){
                 return ResultUtil.tokenErr();
             }
-            return ResultUtil.success(istuService.commitEditStudentInfo(stu,userIdFormRedis));
+            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);
+          return  ResultUtil.success(istuService.updateById(tStudent));
+
+//            return ResultUtil.success(istuService.commitEditStudentInfo(stu,userIdFormRedis));
         }catch (Exception e){
             return ResultUtil.runErr();
         }
@@ -465,6 +571,9 @@
     })
     public ResultUtil<List<StuMedalVo>> queryStuMedal( Integer stuId){
         try {
+
+
+
             Integer appUserId = tokenUtil.getUserIdFormRedis();
             if(null == appUserId){
                 return ResultUtil.tokenErr();
@@ -511,16 +620,16 @@
             @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){
-        try {
+    public ResultUtil<List<RecordAppoint>> cgeClassAppointmentRecordList(Integer stuId, Integer appointStatus, Integer timeType, String search,Integer pageNum){
+//        try {
             Integer appUserId = tokenUtil.getUserIdFormRedis();
             if(null == appUserId){
                 return ResultUtil.tokenErr();
             }
-            return ResultUtil.success(istuService.getAppointmentRecords(stuId,appUserId,appointStatus,timeType,search));
-        }catch (Exception e){
-            return ResultUtil.runErr();
-        }
+            return ResultUtil.success(istuService.getAppointmentRecords(stuId,appUserId,appointStatus,timeType,search,pageNum));
+//        }catch (Exception e){
+//            return ResultUtil.runErr();
+//        }
     }
 
 

--
Gitblit v1.7.1