소스 검색

Merge branch 'dev/2024/0420/update-business' of Harper/feifan-backend-zx-business into master

修改商品售后订单显示
Yangzw 11 달 전
부모
커밋
8e7553eef4
11개의 변경된 파일120개의 추가작업 그리고 184개의 파일을 삭제
  1. 0 23
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/admin/spu/vo/ShopBO.java
  2. 19 39
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spu/ProductSpuServiceImpl.java
  3. 4 1
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/aftersale/vo/AfterSalePageReqVO.java
  4. 0 9
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/delivery/vo/expresstemplate/ShopBO.java
  5. 1 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/aftersale/AfterSaleMapper.java
  6. 14 40
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/aftersale/AfterSaleServiceImpl.java
  7. 16 37
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/delivery/DeliveryExpressTemplateServiceImpl.java
  8. 12 24
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java
  9. 19 0
      feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/controller/admin/user/vo/user/UserShopDetailsVO.java
  10. 9 7
      feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/service/user/AdminUserService.java
  11. 26 4
      feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/service/user/AdminUserServiceImpl.java

+ 0 - 23
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/admin/spu/vo/ShopBO.java

@@ -1,23 +0,0 @@
-package cn.newfeifan.mall.module.product.controller.admin.spu.vo;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * 商户、店铺 BO
- */
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-public class ShopBO {
-    /**
-     * 店铺id
-     */
-    private Long shopId;
-    /**
-     * 商户id
-     */
-    private Long merId;
-}

+ 19 - 39
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spu/ProductSpuServiceImpl.java

@@ -15,14 +15,11 @@ import cn.newfeifan.mall.module.product.dal.mysql.spu.ProductSpuMapper;
 import cn.newfeifan.mall.module.product.enums.spu.ProductSpuStatusEnum;
 import cn.newfeifan.mall.module.product.service.category.ProductCategoryService;
 import cn.newfeifan.mall.module.product.service.sku.ProductSkuService;
-import cn.newfeifan.mall.module.system.dal.dataobject.user.AdminUserDO;
-import cn.newfeifan.mall.module.system.dal.mysql.user.AdminUserMapper;
-import com.alibaba.fastjson.JSONObject;
+import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserShopDetailsVO;
+import cn.newfeifan.mall.module.system.service.user.AdminUserService;
 import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.context.annotation.Lazy;
-import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
@@ -32,7 +29,6 @@ import java.util.*;
 
 import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.*;
-import static cn.newfeifan.mall.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 import static cn.newfeifan.mall.module.product.dal.dataobject.category.ProductCategoryDO.CATEGORY_LEVEL;
 import static cn.newfeifan.mall.module.product.enums.ErrorCodeConstants.*;
 
@@ -55,9 +51,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
     @Resource
     private ProductCategoryService categoryService;
     @Resource
-    private StringRedisTemplate stringRedisTemplate;
-    @Resource
-    private AdminUserMapper userMapper;
+    private AdminUserService userService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -79,13 +73,14 @@ public class ProductSpuServiceImpl implements ProductSpuService {
         initSpuFromSkus(spu, skuSaveReqList);
 
         //加入商户、店铺信息
-        ShopBO shop = getShop();
-        spu.setShopId(shop.getShopId());
-        spu.setMerchantId(shop.getMerId());
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+
+        spu.setShopId(userShopDetails.getShopId());
+        spu.setMerchantId(userShopDetails.getMerchantId());
 
         for (ProductSkuSaveReqVO productSkuSaveReqVO : skuSaveReqList) {
-            productSkuSaveReqVO.setShopId(shop.getShopId());
-            productSkuSaveReqVO.setMerchantId(shop.getMerId());
+            productSkuSaveReqVO.setShopId(userShopDetails.getShopId());
+            productSkuSaveReqVO.setMerchantId(userShopDetails.getMerchantId());
         }
 
         // 插入 SPU
@@ -96,22 +91,6 @@ public class ProductSpuServiceImpl implements ProductSpuService {
         return spu.getId();
     }
 
-    private ShopBO getShop() {
-        Long loginUserId = getLoginUserId();
-        String s = stringRedisTemplate.opsForValue().get("shop:" + loginUserId);
-        if (StringUtils.isEmpty(s)) {
-            AdminUserDO adminUserDO = userMapper.selectById(loginUserId);
-            ShopBO shop = new ShopBO();
-            shop.setShopId(adminUserDO.getShopId());
-            shop.setMerId(adminUserDO.getMerchantId());
-            log.info("====shop:{}",shop);
-            return shop;
-        } else {
-            log.info("====shop:{}",s);
-            return JSONObject.parseObject(s, ShopBO.class);
-        }
-    }
-
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void updateSpu(ProductSpuSaveReqVO updateReqVO) {
@@ -245,9 +224,10 @@ public class ProductSpuServiceImpl implements ProductSpuService {
 
     @Override
     public PageResult<ProductSpuDO> getSpuPage(ProductSpuPageReqVO pageReqVO) {
-        ShopBO shop = getShop();
-        pageReqVO.setShopId(shop.getShopId());
-        pageReqVO.setMerchantId(shop.getMerId());
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+
+        pageReqVO.setShopId(userShopDetails.getShopId());
+        pageReqVO.setMerchantId(userShopDetails.getMerchantId());
         return productSpuMapper.selectPage(pageReqVO);
     }
 
@@ -314,23 +294,23 @@ public class ProductSpuServiceImpl implements ProductSpuService {
     public Map<Integer, Long> getTabsCountByMer() {
         Map<Integer, Long> counts = Maps.newLinkedHashMapWithExpectedSize(5);
 
-        ShopBO shop = getShop();
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
 
         // 查询销售中的商品数量
         counts.put(ProductSpuPageReqVO.FOR_SALE,
-                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus(), shop.getMerId(),shop.getShopId()));
+                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus(), userShopDetails.getMerchantId(),userShopDetails.getShopId()));
         // 查询仓库中的商品数量
         counts.put(ProductSpuPageReqVO.IN_WAREHOUSE,
-                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.DISABLE.getStatus(), shop.getMerId(),shop.getShopId()));
+                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.DISABLE.getStatus(), userShopDetails.getMerchantId(),userShopDetails.getShopId()));
         // 查询售空的商品数量
         counts.put(ProductSpuPageReqVO.SOLD_OUT,
-                productSpuMapper.selectCount(ProductSpuDO::getStock, 0, shop.getMerId(),shop.getShopId()));
+                productSpuMapper.selectCount(ProductSpuDO::getStock, 0, userShopDetails.getMerchantId(),userShopDetails.getShopId()));
         // 查询触发警戒库存的商品数量
         counts.put(ProductSpuPageReqVO.ALERT_STOCK,
-                productSpuMapper.selectCount(shop.getMerId(),shop.getShopId()));
+                productSpuMapper.selectCount(userShopDetails.getMerchantId(),userShopDetails.getShopId()));
         // 查询回收站中的商品数量
         counts.put(ProductSpuPageReqVO.RECYCLE_BIN,
-                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus(), shop.getMerId(),shop.getShopId()));
+                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus(), userShopDetails.getMerchantId(),userShopDetails.getShopId()));
         return counts;
     }
 

+ 4 - 1
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/aftersale/vo/AfterSalePageReqVO.java

@@ -46,6 +46,9 @@ public class AfterSalePageReqVO extends PageParam {
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
     private LocalDateTime[] createTime;
 
-    @Schema(description = "店铺id", example = "20588")
+    @Schema(description = "店铺id", example = "1")
     private Long shopId;
+
+    @Schema(description = "商户id", example = "1")
+    private Long merchantId;
 }

+ 0 - 9
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/delivery/vo/expresstemplate/ShopBO.java

@@ -1,9 +0,0 @@
-package cn.newfeifan.mall.module.trade.controller.admin.delivery.vo.expresstemplate;
-
-import lombok.Data;
-
-@Data
-public class ShopBO {
-    private Long shopId;
-    private Long merId;
-}

+ 1 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/mysql/aftersale/AfterSaleMapper.java

@@ -20,6 +20,7 @@ public interface AfterSaleMapper extends BaseMapperX<AfterSaleDO> {
                 .eqIfPresent(AfterSaleDO::getStatus, reqVO.getStatus())
                 .eqIfPresent(AfterSaleDO::getType, reqVO.getType())
                 .eqIfPresent(AfterSaleDO::getShopId,reqVO.getShopId())
+                .eqIfPresent(AfterSaleDO::getMerchantId,reqVO.getMerchantId())
                 .eqIfPresent(AfterSaleDO::getWay, reqVO.getWay())
                 .likeIfPresent(AfterSaleDO::getOrderNo, reqVO.getOrderNo())
                 .likeIfPresent(AfterSaleDO::getSpuName, reqVO.getSpuName())

+ 14 - 40
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/aftersale/AfterSaleServiceImpl.java

@@ -9,12 +9,11 @@ import cn.newfeifan.mall.framework.common.util.object.ObjectUtils;
 import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.newfeifan.mall.module.pay.api.refund.PayRefundApi;
 import cn.newfeifan.mall.module.pay.api.refund.dto.PayRefundCreateReqDTO;
-import cn.newfeifan.mall.module.system.dal.dataobject.user.AdminUserDO;
-import cn.newfeifan.mall.module.system.dal.mysql.user.AdminUserMapper;
+import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserShopDetailsVO;
+import cn.newfeifan.mall.module.system.service.user.AdminUserService;
 import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSaleDisagreeReqVO;
 import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
 import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSaleRefuseReqVO;
-import cn.newfeifan.mall.module.trade.controller.admin.delivery.vo.expresstemplate.ShopBO;
 import cn.newfeifan.mall.module.trade.controller.app.aftersale.vo.AppAfterSaleCreateReqVO;
 import cn.newfeifan.mall.module.trade.controller.app.aftersale.vo.AppAfterSaleDeliveryReqVO;
 import cn.newfeifan.mall.module.trade.convert.aftersale.AfterSaleConvert;
@@ -36,12 +35,8 @@ import cn.newfeifan.mall.module.trade.framework.order.config.TradeOrderPropertie
 import cn.newfeifan.mall.module.trade.service.delivery.DeliveryExpressService;
 import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
 import cn.newfeifan.mall.module.trade.service.order.TradeOrderUpdateService;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.support.TransactionSynchronization;
@@ -53,7 +48,6 @@ import java.time.LocalDateTime;
 import java.util.List;
 
 import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.newfeifan.mall.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.*;
 
 /**
@@ -85,12 +79,13 @@ public class AfterSaleServiceImpl implements AfterSaleService {
     private TradeOrderProperties tradeOrderProperties;
 
     @Resource
-    private StringRedisTemplate stringRedisTemplate;
-    @Resource
-    private AdminUserMapper userMapper;
+    private AdminUserService userService;
 
     @Override
     public PageResult<AfterSaleDO> getAfterSalePage(AfterSalePageReqVO pageReqVO) {
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+        pageReqVO.setShopId(userShopDetails.getShopId());
+        pageReqVO.setMerchantId(userShopDetails.getMerchantId());
         return tradeAfterSaleMapper.selectPage(pageReqVO);
     }
 
@@ -430,8 +425,8 @@ public class AfterSaleServiceImpl implements AfterSaleService {
 
     @Override
     public Long getApplyingAfterSaleCount(Long userId) {
-        ShopBO shop = getShop();
-        return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, shop.getShopId(),shop.getMerId(), AfterSaleStatusEnum.APPLYING_STATUSES);
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+        return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, userShopDetails.getShopId(),userShopDetails.getMerchantId(), AfterSaleStatusEnum.APPLYING_STATUSES);
     }
 
     @Override
@@ -442,41 +437,20 @@ public class AfterSaleServiceImpl implements AfterSaleService {
 
     @Override
     public List<AfterSaleDO> getAfterSaleByProId(Long spuId) {
-        ShopBO shop = getShop();
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
         return tradeAfterSaleMapper.selectList(new LambdaQueryWrapperX<AfterSaleDO>()
                 .eq(AfterSaleDO::getSpuId, spuId)
-                .eqIfPresent(AfterSaleDO::getShopId, shop.getShopId())
-                .eqIfPresent(AfterSaleDO::getMerchantId,shop.getMerId())
+                .eqIfPresent(AfterSaleDO::getShopId, userShopDetails.getShopId())
+                .eqIfPresent(AfterSaleDO::getMerchantId,userShopDetails.getMerchantId())
         );
     }
 
     @Override
     public List<AfterSaleDO> getAfterSaleByMerAndShop() {
-        ShopBO shop = getShop();
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
 
         return tradeAfterSaleMapper.selectList(new LambdaQueryWrapperX<AfterSaleDO>()
-                .eqIfPresent(AfterSaleDO::getShopId, shop.getShopId())
-                .eq(AfterSaleDO::getMerchantId, shop.getMerId()));
-    }
-
-    private ShopBO getShop() {
-        return getShopBO(stringRedisTemplate, userMapper, log);
+                .eqIfPresent(AfterSaleDO::getShopId, userShopDetails.getShopId())
+                .eq(AfterSaleDO::getMerchantId, userShopDetails.getMerchantId()));
     }
-
-    public static ShopBO getShopBO(StringRedisTemplate stringRedisTemplate, AdminUserMapper userMapper, Logger log) {
-        Long loginUserId = getLoginUserId();
-        String s = stringRedisTemplate.opsForValue().get("shop:" + loginUserId);
-        if (StringUtils.isEmpty(s)) {
-            AdminUserDO adminUserDO = userMapper.selectById(loginUserId);
-            ShopBO shop = new ShopBO();
-            shop.setShopId(adminUserDO.getShopId());
-            shop.setMerId(adminUserDO.getMerchantId());
-            log.info("====shop:{}", shop);
-            return shop;
-        } else {
-            log.info("====shop:{}", s);
-            return JSONObject.parseObject(s, ShopBO.class);
-        }
-    }
-
 }

+ 16 - 37
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/delivery/DeliveryExpressTemplateServiceImpl.java

@@ -5,8 +5,8 @@ import cn.hutool.core.lang.Assert;
 import cn.hutool.core.util.ObjectUtil;
 import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.framework.common.util.collection.CollectionUtils;
-import cn.newfeifan.mall.module.system.dal.dataobject.user.AdminUserDO;
-import cn.newfeifan.mall.module.system.dal.mysql.user.AdminUserMapper;
+import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserShopDetailsVO;
+import cn.newfeifan.mall.module.system.service.user.AdminUserService;
 import cn.newfeifan.mall.module.trade.controller.admin.delivery.vo.expresstemplate.*;
 import cn.newfeifan.mall.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateChargeDO;
 import cn.newfeifan.mall.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateDO;
@@ -15,12 +15,9 @@ import cn.newfeifan.mall.module.trade.dal.mysql.delivery.DeliveryExpressTemplate
 import cn.newfeifan.mall.module.trade.dal.mysql.delivery.DeliveryExpressTemplateFreeMapper;
 import cn.newfeifan.mall.module.trade.dal.mysql.delivery.DeliveryExpressTemplateMapper;
 import cn.newfeifan.mall.module.trade.service.delivery.bo.DeliveryExpressTemplateRespBO;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
@@ -30,7 +27,6 @@ import java.util.*;
 
 import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.*;
-import static cn.newfeifan.mall.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 import static cn.newfeifan.mall.module.trade.convert.delivery.DeliveryExpressTemplateConvert.INSTANCE;
 import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.EXPRESS_TEMPLATE_NAME_DUPLICATE;
 import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.EXPRESS_TEMPLATE_NOT_EXISTS;
@@ -51,11 +47,9 @@ public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTempla
     private DeliveryExpressTemplateChargeMapper expressTemplateChargeMapper;
     @Resource
     private DeliveryExpressTemplateFreeMapper expressTemplateFreeMapper;
-    @Resource
-    private StringRedisTemplate stringRedisTemplate;
 
     @Resource
-    private AdminUserMapper userMapper;
+    private AdminUserService userService;
 
 
     @Override
@@ -66,9 +60,10 @@ public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTempla
 
         // 插入
         DeliveryExpressTemplateDO template = INSTANCE.convert(createReqVO);
-        ShopBO shop = getShop();
-        template.setShopId(shop.getShopId());
-        template.setMerchantId(shop.getMerId());
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+
+        template.setShopId(userShopDetails.getShopId());
+        template.setMerchantId(userShopDetails.getMerchantId());
         expressTemplateMapper.insert(template);
         // 插入运费模板计费表
         if (CollUtil.isNotEmpty(createReqVO.getCharges())) {
@@ -167,10 +162,11 @@ public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTempla
      * @param id   运费模板编号,可以为 null
      */
     private void validateTemplateNameUnique(String name, Long id) {
-        ShopBO shop = getShop();
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+
         QueryWrapper<DeliveryExpressTemplateDO> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda()
-                .eq(DeliveryExpressTemplateDO::getShopId,shop.getShopId())
+                .eq(DeliveryExpressTemplateDO::getShopId,userShopDetails.getShopId())
                 .eq(DeliveryExpressTemplateDO::getName,name);
         DeliveryExpressTemplateDO template = expressTemplateMapper.selectOne(queryWrapper);
         if (template == null) {
@@ -206,15 +202,17 @@ public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTempla
 
     @Override
     public List<DeliveryExpressTemplateDO> getDeliveryExpressTemplateList() {
-        ShopBO shop = getShop();
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+
         return expressTemplateMapper.selectList(new LambdaQueryWrapper<DeliveryExpressTemplateDO>()
-                .eq(DeliveryExpressTemplateDO::getShopId,shop.getShopId()));
+                .eq(DeliveryExpressTemplateDO::getShopId,userShopDetails.getShopId()));
     }
 
     @Override
     public PageResult<DeliveryExpressTemplateDO> getDeliveryExpressTemplatePage(DeliveryExpressTemplatePageReqVO pageReqVO) {
-        ShopBO shop = getShop();
-        pageReqVO.setShopId(shop.getShopId());
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+
+        pageReqVO.setShopId(userShopDetails.getShopId());
         return expressTemplateMapper.selectPage(pageReqVO);
     }
 
@@ -244,23 +242,4 @@ public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTempla
         return INSTANCE.convertMap(areaId, templateList, chargeList, freeList);
     }
 
-    private ShopBO getShop() {
-        Long loginUserId = getLoginUserId();
-        String s = stringRedisTemplate.opsForValue().get("shop:" + loginUserId);
-        log.info("");
-        if (StringUtils.isEmpty(s)) {
-            AdminUserDO adminUserDO = userMapper.selectById(loginUserId);
-            ShopBO shop = new ShopBO();
-            shop.setShopId(adminUserDO.getShopId());
-            shop.setMerId(adminUserDO.getMerchantId());
-            log.info("====shop:{}",shop);
-            return shop;
-        } else {
-            log.info("====shop:{}",s);
-           return JSONObject.parseObject(s, ShopBO.class);
-        }
-    }
-
-
-
 }

+ 12 - 24
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java

@@ -10,10 +10,8 @@ import cn.newfeifan.mall.module.member.api.user.MemberUserApi;
 import cn.newfeifan.mall.module.member.api.user.dto.MemberUserRespDTO;
 import cn.newfeifan.mall.module.pay.controller.admin.order.vo.PayOrderPageItemRespVO;
 import cn.newfeifan.mall.module.product.api.sku.ProductSkuApi;
-import cn.newfeifan.mall.module.product.api.sku.dto.ProductSkuRespDTO;
-import cn.newfeifan.mall.module.system.dal.dataobject.user.AdminUserDO;
-import cn.newfeifan.mall.module.system.dal.mysql.user.AdminUserMapper;
-import cn.newfeifan.mall.module.trade.controller.admin.delivery.vo.expresstemplate.ShopBO;
+import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserShopDetailsVO;
+import cn.newfeifan.mall.module.system.service.user.AdminUserService;
 import cn.newfeifan.mall.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
 import cn.newfeifan.mall.module.trade.controller.admin.order.vo.TradeOrderSummaryRespVO;
 import cn.newfeifan.mall.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
@@ -29,23 +27,17 @@ import cn.newfeifan.mall.module.trade.framework.delivery.core.client.ExpressClie
 import cn.newfeifan.mall.module.trade.framework.delivery.core.client.dto.ExpressTrackQueryReqDTO;
 import cn.newfeifan.mall.module.trade.framework.delivery.core.client.dto.ExpressTrackRespDTO;
 import cn.newfeifan.mall.module.trade.service.delivery.DeliveryExpressService;
-import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.cache.annotation.Cacheable;
-import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.*;
-import java.util.stream.Collectors;
 
 import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertSet;
-import static cn.newfeifan.mall.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.EXPRESS_NOT_EXISTS;
 import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
-import static cn.newfeifan.mall.module.trade.service.aftersale.AfterSaleServiceImpl.getShopBO;
 
 /**
  * 交易订单【读】 Service 实现类
@@ -74,10 +66,7 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
     private ProductSkuApi productSkuApi;
 
     @Resource
-    private StringRedisTemplate stringRedisTemplate;
-
-    @Resource
-    private AdminUserMapper userMapper;
+    private AdminUserService userService;
 
 
     // =================== Order ===================
@@ -118,9 +107,10 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
             return PageResult.empty();
         }
 
-        ShopBO shop = getShop();
-        reqVO.setMerchantId(shop.getMerId());
-        reqVO.setShopId(shop.getShopId());
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+
+        reqVO.setMerchantId(userShopDetails.getMerchantId());
+        reqVO.setShopId(userShopDetails.getShopId());
 
         // 分页查询
         return tradeOrderMapper.selectPage(reqVO, userIds);
@@ -182,8 +172,9 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
 
     @Override
     public Long getOrderCount(Integer status) {
-        ShopBO shop = getShop();
-        return tradeOrderMapper.selectCountByStatus(status,shop.getShopId(),shop.getMerId());
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
+
+        return tradeOrderMapper.selectCountByStatus(status,userShopDetails.getShopId(),userShopDetails.getMerchantId());
     }
 
     @Override
@@ -213,12 +204,9 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
 
     @Override
     public List<TradeOrderDO> getOrderByMerId(Long id) {
-        ShopBO shop = getShop();
-        return tradeOrderMapper.selectOrderListByMerId(id,shop.getMerId(),shop.getShopId());
-    }
+        UserShopDetailsVO userShopDetails = userService.getUserShopDetails();
 
-    private ShopBO getShop() {
-        return getShopBO(stringRedisTemplate, userMapper, log);
+        return tradeOrderMapper.selectOrderListByMerId(id,userShopDetails.getMerchantId(),userShopDetails.getShopId());
     }
 
     @Override

+ 19 - 0
feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/controller/admin/user/vo/user/UserShopDetailsVO.java

@@ -0,0 +1,19 @@
+package cn.newfeifan.mall.module.system.controller.admin.user.vo.user;
+
+import lombok.Data;
+
+/**
+ * 用户的店铺详情
+ */
+@Data
+public class UserShopDetailsVO {
+    /**
+     * 店铺id
+     */
+    private Long shopId;
+
+    /**
+     * 商户id
+     */
+    private Long merchantId;
+}

+ 9 - 7
feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/service/user/AdminUserService.java

@@ -37,7 +37,7 @@ public interface AdminUserService {
     /**
      * 更新用户的最后登陆信息
      *
-     * @param id 用户编号
+     * @param id      用户编号
      * @param loginIp 登陆 IP
      */
     void updateUserLogin(Long id, String loginIp);
@@ -45,7 +45,7 @@ public interface AdminUserService {
     /**
      * 修改用户个人信息
      *
-     * @param id 用户编号
+     * @param id    用户编号
      * @param reqVO 用户个人信息
      */
     void updateUserProfile(Long id, @Valid UserProfileUpdateReqVO reqVO);
@@ -53,7 +53,7 @@ public interface AdminUserService {
     /**
      * 修改用户个人密码
      *
-     * @param id 用户编号
+     * @param id    用户编号
      * @param reqVO 更新用户个人密码
      */
     void updateUserPassword(Long id, @Valid UserProfileUpdatePasswordReqVO reqVO);
@@ -195,7 +195,7 @@ public interface AdminUserService {
     /**
      * 判断密码是否匹配
      *
-     * @param rawPassword 未加密的密码
+     * @param rawPassword     未加密的密码
      * @param encodedPassword 加密后的密码
      * @return 是否匹配
      */
@@ -209,13 +209,15 @@ public interface AdminUserService {
     /**
      * 根据手机号创建用户
      *
-     * @param merId 商户ID
-     * @param shopId 店铺ID
+     * @param merId         商户ID
+     * @param shopId        店铺ID
      * @param contactMobile 用户手机号码
-     * @param contactName 用户名称
+     * @param contactName   用户名称
      */
     void createUserByMobile(Long merId, Long shopId, String contactMobile, String contactName);
 
 
     List<AdminUserDO> getUserByMerId(Long merId);
+
+    UserShopDetailsVO getUserShopDetails();
 }

+ 26 - 4
feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/service/user/AdminUserServiceImpl.java

@@ -13,10 +13,7 @@ import cn.newfeifan.mall.framework.datapermission.core.util.DataPermissionUtils;
 import cn.newfeifan.mall.module.infra.api.file.FileApi;
 import cn.newfeifan.mall.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
 import cn.newfeifan.mall.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
-import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserImportExcelVO;
-import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserImportRespVO;
-import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserPageReqVO;
-import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.UserSaveReqVO;
+import cn.newfeifan.mall.module.system.controller.admin.user.vo.user.*;
 import cn.newfeifan.mall.module.system.dal.dataobject.dept.DeptDO;
 import cn.newfeifan.mall.module.system.dal.dataobject.dept.UserPostDO;
 import cn.newfeifan.mall.module.system.dal.dataobject.permission.RoleDO;
@@ -30,11 +27,14 @@ import cn.newfeifan.mall.module.system.service.dept.DeptService;
 import cn.newfeifan.mall.module.system.service.dept.PostService;
 import cn.newfeifan.mall.module.system.service.permission.PermissionService;
 import cn.newfeifan.mall.module.system.service.tenant.TenantService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.google.common.annotations.VisibleForTesting;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -47,6 +47,7 @@ import java.util.*;
 import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertList;
 import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertSet;
+import static cn.newfeifan.mall.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 import static cn.newfeifan.mall.module.system.enums.ErrorCodeConstants.*;
 
 /**
@@ -86,6 +87,9 @@ public class AdminUserServiceImpl implements AdminUserService {
 
     @Resource
     private UserRoleMapper userRoleMapper;
+    @Resource
+    private StringRedisTemplate stringRedisTemplate;
+
 
 
     @Override
@@ -507,6 +511,24 @@ public class AdminUserServiceImpl implements AdminUserService {
         return userMapper.selectList(new LambdaQueryWrapper<AdminUserDO>().eq(AdminUserDO::getMerchantId, merId));
     }
 
+    @Override
+    public UserShopDetailsVO getUserShopDetails() {
+        Long loginUserId = getLoginUserId();
+        String s = stringRedisTemplate.opsForValue().get("shop:" + loginUserId);
+        log.info("");
+        if (StringUtils.isEmpty(s)) {
+            AdminUserDO adminUserDO = userMapper.selectById(loginUserId);
+            UserShopDetailsVO userShopDetailsVO = new UserShopDetailsVO();
+            userShopDetailsVO.setShopId(adminUserDO.getShopId());
+            userShopDetailsVO.setMerchantId(adminUserDO.getMerchantId());
+            log.info("====userShopDetailsVO:{}",userShopDetailsVO);
+            return userShopDetailsVO;
+        } else {
+            log.info("====userShopDetailsVO:{}",s);
+            return JSONObject.parseObject(s, UserShopDetailsVO.class);
+        }
+    }
+
     /**
      * 对密码进行加密
      *