From 1e790795f4e2c365f604ecc0fc1b290e3ff3c35f Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期五, 20 十月 2023 09:34:22 +0800
Subject: [PATCH] 更新bug

---
 cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 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 ec78a66..03f305a 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
@@ -556,6 +556,9 @@
             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("您的账号已被冻结", "");
         }
@@ -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;
                 }
@@ -626,6 +629,10 @@
             joinPlayPaiVo.setLat(s.getLat());
             joinPlayPaiVo.setStoreId(s.getId());
             joinPlayPaiVo.setPhone(s.getPhone());
+            joinPlayPaiVo.setProvince(s.getProvince());
+            joinPlayPaiVo.setProvinceCode(s.getProvinceCode());
+            joinPlayPaiVo.setCity(s.getCity());
+            joinPlayPaiVo.setCityCode(s.getCityCode());
         }
         return joinPlayPaiVo;
     }
@@ -835,7 +842,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 +876,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 +1039,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("用户不存在");
         }
@@ -1049,6 +1076,9 @@
         if (ToolUtil.isNotEmpty(count) && count >= merchandise.getPickUpQuantity()){
             return ResultUtil.error("超过限领数量");
         }
+        if (ToolUtil.isNotEmpty(count) && count >= merchandise.getQuantityIssued()){
+            return ResultUtil.error("超过发放数量");
+        }
 
         for (int i = 0; i < goodsNums; i++) {
 //            新增积分商品兑换记录

--
Gitblit v1.7.1