Selaa lähdekoodia

Merge branch 'dev-feat' of https://e.coding.net/chuanghaikeji/moxuanyunshangwaimai/backend into dev-feat

夏文涛 1 vuosi sitten
vanhempi
commit
06be043800

+ 7 - 1
src/main/java/com/sqx/modules/common/service/impl/CommonInfoServiceImpl.java

@@ -32,6 +32,9 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
         Date now = new Date();
         commonInfo.setCreateAt(sdf.format(now));
         commonInfoDao.updateById(commonInfo);
+
+        // 缓存失效
+        redisUtils.delete(String.format(RedisKey.COMMON_INFO_CACHE_KEY, commonInfo.getType()));
         return Result.success();
     }
 
@@ -43,7 +46,7 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
         if (ObjectUtil.isNull(commonInfo)) {
             commonInfo = commonInfoDao.findOne(id);
 
-            redisUtils.set(key, commonInfo);
+            redisUtils.set(key, commonInfo, RedisUtils.HOUR_ONE_EXPIRE);
         }
         return commonInfo;
     }
@@ -58,6 +61,9 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
     @Override
     public Result updateBody(CommonInfo commonInfo) {
         commonInfoDao.updateById(commonInfo);
+
+        // 缓存失效
+        redisUtils.delete(String.format(RedisKey.COMMON_INFO_CACHE_KEY, commonInfo.getType()));
         return Result.success();
     }
 

+ 4 - 4
src/main/java/com/sqx/modules/order/service/impl/AppAppOrderServiceImpl.java

@@ -275,7 +275,7 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
      * @return boolean
      */
     private boolean isShopBusinessTime(Long shopId) {
-        GoodsShop goodsShop = goodsShopDao.selectById(shopId);
+        GoodsShop goodsShop = shopMessageService.getShopInfoById(shopId);
         if (goodsShop == null) {
             throw new SqxException("无效的店铺id");
         }
@@ -570,7 +570,7 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
             try {
                 addOrderMessageAndPush(order, goodsShop, mpPushConfig, userEntity);
             } catch (Exception e) {
-                log.error("订单:{},订单支付成功通知发送失败,失败原因:{}", e);
+                log.error("订单:{},订单支付成功通知发送失败,失败原因:{}", order.getOrderId(), e);
             }
         });
 
@@ -614,7 +614,7 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
                 try {
                     sendOrderAcceptMessage(order, goodsShop, mpPushConfig, userEntity);
                 } catch (Exception e) {
-                    log.error("订单:{},商家接单通知发送失败,失败原因:{}", e);
+                    log.error("订单:{},商家接单通知发送失败,失败原因:{}", order.getOrderId(), e);
                 }
             });
 
@@ -635,7 +635,7 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
 
                         FeiYunUtils.print(goodsShop.getSnCode(), null, order);
                     } catch (Exception e) {
-                        log.error("订单:{},小票打印失败,失败原因:{}", e);
+                        log.error("订单:{},小票打印失败,失败原因:{}", order.getOrderId(), e);
                     }
                 });
             }

+ 3 - 0
src/main/java/com/sqx/modules/shop/service/impl/ShopMessageServiceImpl.java

@@ -315,6 +315,9 @@ public class ShopMessageServiceImpl extends ServiceImpl<ShopMessageDao, GoodsSho
         // }
 
         baseMapper.updateById(goodsShop);
+
+        redisUtils.delete(String.format(RedisKey.SHOP_INFO_CACHE_KEY, goodsShop.getShopId()));
+
         return Result.success();
     }
 

+ 5 - 0
src/main/java/com/sqx/modules/timedtask/service/impl/RiderLocationServiceImpl.java

@@ -1,7 +1,9 @@
 package com.sqx.modules.timedtask.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.sqx.common.exception.SqxException;
 import com.sqx.common.utils.Result;
 import com.sqx.modules.common.entity.CommonInfo;
 import com.sqx.modules.common.service.CommonInfoService;
@@ -55,6 +57,9 @@ public class RiderLocationServiceImpl extends ServiceImpl<RiderLocationDao, Ride
         HashMap hashMap = new HashMap();
         //查看骑手即时位置
         RiderLocation riderLocation = baseMapper.selectOne(new QueryWrapper<RiderLocation>().eq("user_id", riderUserId));
+        if (ObjectUtil.isNull(riderLocation)) {
+            throw new SqxException("无效的用户id");
+        }
         //计算骑手到用户的距离
         Double aDouble = riderLocationDao.calculateDistance(lng, lat, riderLocation.getLng(), riderLocation.getLat());
         //计算预计送达时间