库存警戒值
日志记录
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package cn.ysk.cashier.controller.product;
|
package cn.ysk.cashier.controller.product;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.ysk.cashier.annotation.Log;
|
||||||
import cn.ysk.cashier.exception.BadRequestException;
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.service.product.StockService;
|
import cn.ysk.cashier.service.product.StockService;
|
||||||
import cn.ysk.cashier.utils.JSONUtil;
|
import cn.ysk.cashier.utils.JSONUtil;
|
||||||
@@ -36,6 +37,7 @@ public class StockController {
|
|||||||
|
|
||||||
@PutMapping("warnLine")
|
@PutMapping("warnLine")
|
||||||
@ApiOperation("修改商品警告线")
|
@ApiOperation("修改商品警告线")
|
||||||
|
@Log("修改商品警告值为:#stockUpdateWarnLineVO.warnLine")
|
||||||
public ResponseEntity<Object> updateProductWarnLine(@RequestBody StockUpdateWarnLineVO stockUpdateWarnLineVO) {
|
public ResponseEntity<Object> updateProductWarnLine(@RequestBody StockUpdateWarnLineVO stockUpdateWarnLineVO) {
|
||||||
if (StrUtil.isBlank(stockUpdateWarnLineVO.getShopId()) || stockUpdateWarnLineVO.getWarnLine() == null || stockUpdateWarnLineVO.getWarnLine() <= 0) {
|
if (StrUtil.isBlank(stockUpdateWarnLineVO.getShopId()) || stockUpdateWarnLineVO.getWarnLine() == null || stockUpdateWarnLineVO.getWarnLine() <= 0) {
|
||||||
throw new BadRequestException("参数有误");
|
throw new BadRequestException("参数有误");
|
||||||
|
|||||||
@@ -244,9 +244,11 @@ public class TbProductServiceImpl implements TbProductService {
|
|||||||
public Map<String, Object> queryAllV2(TbProductQueryV2Criteria criteria,Pageable pageable) {
|
public Map<String, Object> queryAllV2(TbProductQueryV2Criteria criteria,Pageable pageable) {
|
||||||
//查询商品数据
|
//查询商品数据
|
||||||
Page<TbProduct> page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
Page<TbProduct> page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||||
|
Integer warnLine = 0;
|
||||||
List<TbProductNewVo> products = new ArrayList<>();
|
List<TbProductNewVo> products = new ArrayList<>();
|
||||||
for (TbProduct product : page.getContent()) {
|
for (TbProduct product : page.getContent()) {
|
||||||
TbProductNewVo productNewVo = new TbProductNewVo();
|
TbProductNewVo productNewVo = new TbProductNewVo();
|
||||||
|
warnLine = product.getWarnLine();
|
||||||
BeanUtils.copyProperties(product, productNewVo);
|
BeanUtils.copyProperties(product, productNewVo);
|
||||||
productNewVo.setLowPrice(product.getLowPrice().toString());
|
productNewVo.setLowPrice(product.getLowPrice().toString());
|
||||||
productNewVo.setStockNumber(Double.valueOf(product.getStockNumber()));
|
productNewVo.setStockNumber(Double.valueOf(product.getStockNumber()));
|
||||||
@@ -274,7 +276,9 @@ public class TbProductServiceImpl implements TbProductService {
|
|||||||
productNewVo.setConInfos(CollectionUtils.isEmpty(skuCons)?Arrays.asList():skuCons);
|
productNewVo.setConInfos(CollectionUtils.isEmpty(skuCons)?Arrays.asList():skuCons);
|
||||||
products.add(productNewVo);
|
products.add(productNewVo);
|
||||||
}
|
}
|
||||||
return PageUtil.toPage(products, page.getTotalElements());
|
Map<String, Object> result = PageUtil.toPage(products, page.getTotalElements());
|
||||||
|
result.put("warnLine",warnLine);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TbProductNewVo.TbProductSkuVos> convert(List<TbProductSku> skuVo1List) {
|
public List<TbProductNewVo.TbProductSkuVos> convert(List<TbProductSku> skuVo1List) {
|
||||||
|
|||||||
Reference in New Issue
Block a user