|
|
@@ -57,6 +57,7 @@ import com.ruoyi.system.service.ISysOssService;
|
|
|
import com.ruoyi.tool.service.JzqService;
|
|
|
import com.ruoyi.user.service.IUserService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -79,6 +80,7 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@RequiredArgsConstructor
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class BusinessServiceImpl implements IBusinessService {
|
|
|
|
|
|
private final BusinessMapper baseMapper;
|
|
|
@@ -646,6 +648,22 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
public void autoExpires(Business business) {
|
|
|
business.setExpiresStatus(true);
|
|
|
baseMapper.updateById(business);
|
|
|
+ //下架商品 下架失败暂不处理
|
|
|
+ downShelfProduct(business.getBusinessId(), false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //下架商品
|
|
|
+ private void downShelfProduct(Long businessId, Boolean tw) {
|
|
|
+ try {
|
|
|
+ //查商户下处于上架的商品id
|
|
|
+ List<Long> productIds = iProductInnerApi.queryShelvedProductIdsByBusinessId(businessId);
|
|
|
+ iProductInnerApi.downShelfProduct(businessId, productIds);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("下架商品异常{}", businessId, e);
|
|
|
+ if (tw) {
|
|
|
+ throw new ServiceException(BusinessExceptionEnum.BUSINESS_PRODUCT_DOWN_SHELF_FAIL);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -667,6 +685,7 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
return baseMapper.updateById(business) > 0;
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void close(Long businessId) {
|
|
|
Business business = loadById(businessId, true);
|
|
|
@@ -675,6 +694,8 @@ public class BusinessServiceImpl implements IBusinessService {
|
|
|
}
|
|
|
business.setCloseStatus(true);
|
|
|
baseMapper.updateById(business);
|
|
|
+ //下架商品
|
|
|
+ downShelfProduct(businessId, true);
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|