parent
ca3b16c677
commit
e4a03e583b
|
|
@ -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("参数有误");
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue