|
@@ -8,9 +8,12 @@ import cn.newfeifan.mall.framework.common.pojo.PageResult;
|
|
import cn.newfeifan.mall.framework.common.util.object.ObjectUtils;
|
|
import cn.newfeifan.mall.framework.common.util.object.ObjectUtils;
|
|
import cn.newfeifan.mall.module.pay.api.refund.PayRefundApi;
|
|
import cn.newfeifan.mall.module.pay.api.refund.PayRefundApi;
|
|
import cn.newfeifan.mall.module.pay.api.refund.dto.PayRefundCreateReqDTO;
|
|
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.trade.controller.admin.aftersale.vo.AfterSaleDisagreeReqVO;
|
|
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.AfterSalePageReqVO;
|
|
import cn.newfeifan.mall.module.trade.controller.admin.aftersale.vo.AfterSaleRefuseReqVO;
|
|
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.AppAfterSaleCreateReqVO;
|
|
import cn.newfeifan.mall.module.trade.controller.app.aftersale.vo.AppAfterSaleDeliveryReqVO;
|
|
import cn.newfeifan.mall.module.trade.controller.app.aftersale.vo.AppAfterSaleDeliveryReqVO;
|
|
import cn.newfeifan.mall.module.trade.convert.aftersale.AfterSaleConvert;
|
|
import cn.newfeifan.mall.module.trade.convert.aftersale.AfterSaleConvert;
|
|
@@ -32,9 +35,13 @@ 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.delivery.DeliveryExpressService;
|
|
import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
|
|
import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
|
|
import cn.newfeifan.mall.module.trade.service.order.TradeOrderUpdateService;
|
|
import cn.newfeifan.mall.module.trade.service.order.TradeOrderUpdateService;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
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.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.support.TransactionSynchronization;
|
|
import org.springframework.transaction.support.TransactionSynchronization;
|
|
@@ -46,6 +53,7 @@ import java.time.LocalDateTime;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
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.*;
|
|
import static cn.newfeifan.mall.module.trade.enums.ErrorCodeConstants.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -76,6 +84,11 @@ public class AfterSaleServiceImpl implements AfterSaleService {
|
|
@Resource
|
|
@Resource
|
|
private TradeOrderProperties tradeOrderProperties;
|
|
private TradeOrderProperties tradeOrderProperties;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private StringRedisTemplate stringRedisTemplate;
|
|
|
|
+ @Resource
|
|
|
|
+ private AdminUserMapper userMapper;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public PageResult<AfterSaleDO> getAfterSalePage(AfterSalePageReqVO pageReqVO) {
|
|
public PageResult<AfterSaleDO> getAfterSalePage(AfterSalePageReqVO pageReqVO) {
|
|
return tradeAfterSaleMapper.selectPage(pageReqVO);
|
|
return tradeAfterSaleMapper.selectPage(pageReqVO);
|
|
@@ -98,7 +111,7 @@ public class AfterSaleServiceImpl implements AfterSaleService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public AfterSaleDO getAfterSaleByOrderNo(String orderNo) {
|
|
public AfterSaleDO getAfterSaleByOrderNo(String orderNo) {
|
|
- return tradeAfterSaleMapper.selectOne(new LambdaQueryWrapper<AfterSaleDO>().eq(AfterSaleDO::getOrderNo,orderNo));
|
|
|
|
|
|
+ return tradeAfterSaleMapper.selectOne(new LambdaQueryWrapper<AfterSaleDO>().eq(AfterSaleDO::getOrderNo, orderNo));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -419,8 +432,9 @@ public class AfterSaleServiceImpl implements AfterSaleService {
|
|
public Long getApplyingAfterSaleCount(Long userId) {
|
|
public Long getApplyingAfterSaleCount(Long userId) {
|
|
return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, AfterSaleStatusEnum.APPLYING_STATUSES);
|
|
return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, AfterSaleStatusEnum.APPLYING_STATUSES);
|
|
}
|
|
}
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
- public Long getApplyingAfterSaleCount(Long userId,Long shopId, Long merId) {
|
|
|
|
|
|
+ public Long getApplyingAfterSaleCount(Long userId, Long shopId, Long merId) {
|
|
return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, shopId, merId, AfterSaleStatusEnum.APPLYING_STATUSES);
|
|
return tradeAfterSaleMapper.selectCountByUserIdAndStatus(userId, shopId, merId, AfterSaleStatusEnum.APPLYING_STATUSES);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -430,4 +444,39 @@ public class AfterSaleServiceImpl implements AfterSaleService {
|
|
.in(AfterSaleDO::getOrderId, orderIds));
|
|
.in(AfterSaleDO::getOrderId, orderIds));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<AfterSaleDO> getAfterSaleByProId(Long spuId) {
|
|
|
|
+ return tradeAfterSaleMapper.selectList(new LambdaQueryWrapper<AfterSaleDO>()
|
|
|
|
+ .eq(AfterSaleDO::getSpuId, spuId));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<AfterSaleDO> getAfterSaleByMerAndShop() {
|
|
|
|
+ ShopBO shop = getShop();
|
|
|
|
+
|
|
|
|
+ return tradeAfterSaleMapper.selectList(new LambdaQueryWrapper<AfterSaleDO>()
|
|
|
|
+ .eq(AfterSaleDO::getShopId, shop.getShopId())
|
|
|
|
+ .eq(AfterSaleDO::getMerchantId, shop.getMerId()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private ShopBO getShop() {
|
|
|
|
+ return getShopBO(stringRedisTemplate, userMapper, log);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|