|
@@ -11,6 +11,9 @@ 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.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;
|
|
@@ -26,7 +29,11 @@ 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;
|
|
@@ -35,6 +42,7 @@ 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;
|
|
|
|
|
@@ -44,6 +52,7 @@ import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.ORDER_NOT_
|
|
|
* @author 非繁源码
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
|
|
|
|
|
@Resource
|
|
@@ -63,6 +72,12 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
|
|
@Resource
|
|
|
private ProductSkuApi productSkuApi;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private StringRedisTemplate stringRedisTemplate;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private AdminUserMapper userMapper;
|
|
|
+
|
|
|
|
|
|
// =================== Order ===================
|
|
|
|
|
@@ -190,8 +205,25 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<TradeOrderDO> getOrderByMerId(Long merId) {
|
|
|
- return tradeOrderMapper.selectOrderListByMerId(merId);
|
|
|
+ public List<TradeOrderDO> getOrderByMerId(Long id) {
|
|
|
+ ShopBO shop = getShop();
|
|
|
+ return tradeOrderMapper.selectOrderListByMerId(id,shop.getMerId(),shop.getShopId());
|
|
|
+ }
|
|
|
+
|
|
|
+ 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
|