出入库商品添加库存警告线
This commit is contained in:
@@ -4,8 +4,11 @@ import cn.ysk.cashier.dto.product.OutAndOnDto;
|
||||
import cn.ysk.cashier.dto.product.StockQueryDto;
|
||||
import cn.ysk.cashier.dto.product.TbProductDto;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.mapper.shop.TbShopInfoMapper;
|
||||
import cn.ysk.cashier.pojo.product.TbProductSku;
|
||||
import cn.ysk.cashier.pojo.shop.TbShopInfo;
|
||||
import cn.ysk.cashier.repository.product.TbProductSkuRepository;
|
||||
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
|
||||
import cn.ysk.cashier.service.TbProductStockOperateService;
|
||||
import cn.ysk.cashier.service.product.StockService;
|
||||
import cn.ysk.cashier.service.product.TbProductService;
|
||||
@@ -13,6 +16,7 @@ import cn.ysk.cashier.utils.FileUtil;
|
||||
import cn.ysk.cashier.utils.RedisUtils;
|
||||
import cn.ysk.cashier.utils.StringUtils;
|
||||
import cn.ysk.cashier.vo.StockUpdateValueVO;
|
||||
import cn.ysk.cashier.vo.StockUpdateWarnLineVO;
|
||||
import cn.ysk.cashier.vo.StockV2Vo;
|
||||
import cn.ysk.cashier.vo.StockVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -24,6 +28,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -31,6 +36,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.transaction.Transactional;
|
||||
import java.io.IOException;
|
||||
@@ -49,6 +58,7 @@ public class StockServiceImpl implements StockService {
|
||||
|
||||
private final TbProductStockOperateService stockOperateService;
|
||||
private final TbProductSkuRepository skuRepository;
|
||||
private final TbShopInfoRepository tbShopInfoRepository;
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
@@ -313,4 +323,13 @@ public class StockServiceImpl implements StockService {
|
||||
Query nativeQuery = em.createNativeQuery(String.valueOf(sqlQuery));
|
||||
nativeQuery.executeUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProductWarnLine(StockUpdateWarnLineVO stockUpdateWarnLineVO) {
|
||||
TbShopInfo shopInfo = tbShopInfoRepository.findById(Integer.valueOf(stockUpdateWarnLineVO.getShopId())).orElse(null);
|
||||
if (shopInfo == null) {
|
||||
throw new BadRequestException("店铺不存在");
|
||||
}
|
||||
tbProductSkuRepository.updateWarnLineByShopId(stockUpdateWarnLineVO.getWarnLine(), stockUpdateWarnLineVO.getShopId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package cn.ysk.cashier.service.product;
|
||||
|
||||
import cn.ysk.cashier.dto.product.StockQueryDto;
|
||||
import cn.ysk.cashier.vo.StockUpdateValueVO;
|
||||
import cn.ysk.cashier.vo.StockUpdateWarnLineVO;
|
||||
import cn.ysk.cashier.vo.StockV2Vo;
|
||||
import cn.ysk.cashier.vo.StockVo;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -20,7 +21,7 @@ public interface StockService {
|
||||
*/
|
||||
Page queryAll(StockQueryDto criteria, Integer page, Integer size);
|
||||
|
||||
Page queryAllV2(StockQueryDto criteria, Integer page, Integer size);
|
||||
Page<StockV2Vo> queryAllV2(StockQueryDto criteria, Integer page, Integer size);
|
||||
|
||||
List<StockV2Vo> queryProductSku(String productId);
|
||||
|
||||
@@ -37,4 +38,10 @@ public interface StockService {
|
||||
void updateIsStock(Integer proId, String shopId,Integer isStock);
|
||||
|
||||
void updateProductStatus(StockUpdateValueVO updateValueVO);
|
||||
|
||||
/**
|
||||
* 商品库存警戒线设置
|
||||
* @param stockUpdateWarnLineVO 警戒线
|
||||
*/
|
||||
void updateProductWarnLine(StockUpdateWarnLineVO stockUpdateWarnLineVO);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user