From a1e4cfc3de4f3f3f3956b769bc7af40d097c8a4c Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期二, 17 十月 2023 15:12:57 +0800
Subject: [PATCH] 修改bug

---
 cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java
index b47bd81..0e0d9d9 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java
@@ -23,7 +23,6 @@
 import com.dsh.account.mapper.CoachMapper;
 import com.dsh.account.mapper.TAppUserMapper;
 import com.dsh.account.mapper.TStudentMapper;
-import com.dsh.account.model.vo.classDetails.AppointmentRecordVo;
 import com.dsh.account.model.vo.classDetails.ClasspaymentRequest;
 import com.dsh.account.model.vo.classDetails.StuEditInfoReq;
 import com.dsh.account.model.vo.classDetails.classInsVo.ClassDetailsInsVo;
@@ -36,7 +35,6 @@
 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.model.vo.userBenefitDetail.Goods;
 import com.dsh.account.service.TCourseInfoRecordService;
 import com.dsh.account.service.TStudentService;
 import com.dsh.account.util.*;
@@ -46,6 +44,7 @@
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -137,11 +136,21 @@
         student.setHeight(stu.getHeight());
         student.setWeight(stu.getWeight());
         BigDecimal bigDecimal = BigDecimal.valueOf(stu.getWeight());
-        BigDecimal multiply = bigDecimal.subtract(BigDecimal.valueOf(stu.getHeight())).multiply(bigDecimal.subtract(BigDecimal.valueOf(stu.getHeight())));
-        multiply.setScale(2);
-        student.setBmi(multiply.doubleValue());
+        double v = stu.getHeight() / 100;
+        double v1 = v * v;
+        BigDecimal bigDecimal1 = new BigDecimal(v1).setScale(2, RoundingMode.HALF_UP);
+        double v2 = bigDecimal.doubleValue() / bigDecimal1.doubleValue();
+        BigDecimal bigDecimal2 = new BigDecimal(v2).setScale(2, RoundingMode.HALF_UP);
+        student.setBmi(bigDecimal2.doubleValue());
         student.setInsertTime(new Date());
         student.setState(1);
+
+        List<TStudent> tStudents = this.baseMapper.selectList(new LambdaQueryWrapper<TStudent>().eq(TStudent::getAppUserId, appUserId));
+        if(tStudents.size()>0){
+            student.setIsDefault(2);
+        }else {
+            student.setIsDefault(1);
+        }
         this.baseMapper.insert(student);
 
         //同步信息到参赛人员信息中
@@ -835,7 +844,10 @@
         return this.baseMapper.getGiftSelect(giftSearchDto);
     }
 
-
+    @Override
+    public List<Map<String, Object>> queryCom(Integer id) {
+        return this.baseMapper.queryCom(id);
+    }
 
 
 }

--
Gitblit v1.7.1