From 062fb1ed6efcaac5d75bbe184524c4929dff7fcd Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期三, 18 十月 2023 15:25:35 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

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

diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
index 5b2a892..49341f6 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -386,7 +386,7 @@
         tAppUser = new TAppUser();
         tAppUser.setCode(UUIDUtil.getNumberRandom(16));
         tAppUser.setPhone(addAppUserVo.getPhone());
-        tAppUser.setPassword(Md5Util.MD5Encode(addAppUserVo.getPassword(), null));
+        tAppUser.setPassword(addAppUserVo.getPassword());
         tAppUser.setIsVip(0);
         tAppUser.setState(1);
         tAppUser.setInsertTime(new Date());
@@ -435,7 +435,7 @@
             return ResultUtil.error("请先注册", "");
         }
         if(tAppUser.getState() == 2){
-            return ResultUtil.error("您的账号已被冻结", "");
+            return ResultUtil.errorCode("您的账号已被冻结", "");
         }
 //        password = Md5Util.MD5Encode(password, null);
         if(!tAppUser.getPassword().equals(password)){
@@ -556,10 +556,13 @@
             return ResultUtil.error("验证码无效");
         }
         TAppUser tAppUser = this.baseMapper.selectOne(new QueryWrapper<TAppUser>().eq("phone", phone).ne("state", 3));
+        if(tAppUser==null){
+            return ResultUtil.error("该账号未注册", "");
+        }
         if(tAppUser.getState() == 2){
             return ResultUtil.error("您的账号已被冻结", "");
         }
-        tAppUser.setPassword(Md5Util.MD5Encode(password, null));
+        tAppUser.setPassword(password);
         this.updateById(tAppUser);
         return ResultUtil.success();
     }
@@ -616,7 +619,7 @@
             for (Store store : stores) {
                 Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat());
                 Double wgs84 = distance.get("WGS84");
-                if(s == null || d.compareTo(wgs84) < 0){
+                if(s == null || d>wgs84){
                     s = store;
                     d = wgs84;
                 }
@@ -835,7 +838,7 @@
                         if (vicinityGood.getRedemptionMethod() == 1) {
                             commodity.setIntegral(vicinityGood.getIntegral().intValue());
                         } else {
-                            commodity.setIntegral(vicinityGood.getIntegral().intValue());
+                            commodity.setIntegral(ToolUtil.isEmpty(vicinityGood.getIntegral())?0:vicinityGood.getIntegral());
                             commodity.setAmount(vicinityGood.getCash());
                         }
                         commodity.setBelongsType(vicinityGood.getUserPopulation());
@@ -869,7 +872,7 @@
                         if (vicinityGood.getRedemptionMethod() == 1) {
                             commodity.setIntegral(vicinityGood.getIntegral().intValue());
                         } else {
-                            commodity.setIntegral(vicinityGood.getIntegral().intValue());
+                            commodity.setIntegral(ToolUtil.isEmpty(vicinityGood.getIntegral())?0:vicinityGood.getIntegral());
                             commodity.setAmount(vicinityGood.getCash());
                         }
                         commodity.setBelongsType(vicinityGood.getUserPopulation());
@@ -1032,7 +1035,27 @@
         if (ToolUtil.isEmpty(merchandise)){
             return ResultUtil.error("商品不存在");
         }
+
+
         TAppUser tAppUser = this.baseMapper.selectById(userIdFormRedis);
+
+
+        if(merchandise.getUserPopulation()==2){
+            if(tAppUser.getIsVip()==0){
+                return ResultUtil.error("该商品只能年度会员购买");
+            }
+        }
+
+
+
+        if(merchandise.getUserPopulation()==3){
+            List<TStudent> students = tsmapper.selectList(new LambdaQueryWrapper<TStudent>().eq(TStudent::getAppUserId, userIdFormRedis));
+            if(students.size()==0){
+                return ResultUtil.error("该商品只能已有学员用户购买");
+            }
+        }
+
+
         if (ToolUtil.isEmpty(tAppUser)){
             return ResultUtil.error("用户不存在");
         }

--
Gitblit v1.7.1