库存警戒值

日志记录
This commit is contained in:
wangw 2024-10-08 15:27:41 +08:00
parent ca3b16c677
commit e4a03e583b
2 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package cn.ysk.cashier.controller.product;
import cn.hutool.core.util.StrUtil;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.service.product.StockService;
import cn.ysk.cashier.utils.JSONUtil;
@ -36,6 +37,7 @@ public class StockController {
@PutMapping("warnLine")
@ApiOperation("修改商品警告线")
@Log("修改商品警告值为:#stockUpdateWarnLineVO.warnLine")
public ResponseEntity<Object> updateProductWarnLine(@RequestBody StockUpdateWarnLineVO stockUpdateWarnLineVO) {
if (StrUtil.isBlank(stockUpdateWarnLineVO.getShopId()) || stockUpdateWarnLineVO.getWarnLine() == null || stockUpdateWarnLineVO.getWarnLine() <= 0) {
throw new BadRequestException("参数有误");

View File

@ -244,9 +244,11 @@ public class TbProductServiceImpl implements TbProductService {
public Map<String, Object> queryAllV2(TbProductQueryV2Criteria criteria,Pageable pageable) {
//查询商品数据
Page<TbProduct> page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
Integer warnLine = 0;
List<TbProductNewVo> products = new ArrayList<>();
for (TbProduct product : page.getContent()) {
TbProductNewVo productNewVo = new TbProductNewVo();
warnLine = product.getWarnLine();
BeanUtils.copyProperties(product, productNewVo);
productNewVo.setLowPrice(product.getLowPrice().toString());
productNewVo.setStockNumber(Double.valueOf(product.getStockNumber()));
@ -274,7 +276,9 @@ public class TbProductServiceImpl implements TbProductService {
productNewVo.setConInfos(CollectionUtils.isEmpty(skuCons)?Arrays.asList():skuCons);
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) {